diff --git a/kt b/kt index b2463c3..ec4d5a6 100755 --- a/kt +++ b/kt @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys import signal -from ktlib import arg_parse, color_red, color_green, exit_gracefully +from src.ktlib import arg_parse, color_red, color_green, exit_gracefully if __name__ == '__main__': diff --git a/ktlib.pxd b/ktlib.pxd deleted file mode 100644 index 868a85f..0000000 --- a/ktlib.pxd +++ /dev/null @@ -1,49 +0,0 @@ -#cython: language_level=3, c_string_type=unicode, c_string_encoding=utf8, boundscheck=False, cdivision=True, wraparound=False -# distutils: language=c++ -from libcpp.string cimport string -from libcpp.vector cimport vector -from libcpp cimport bool as bool_t - -cpdef string color_cyan(const string& text) nogil -cpdef string color_green(const string& text) nogil -cpdef string color_red(const string& text) nogil - -cdef void make_list_equal(vector[string]& lhs, vector[string]& rhs, string pad_element=*) nogil - -cdef class Action: - cdef: - string config_path - object cfg - object cookies - string kt_config - - cdef read_config_from_file(self) - cdef login(self) - cdef string get_problem_url(self) - cdef string get_problem_id(self) - cdef string get_url(self, const string& option, string default = *) - cdef _act(self) - -cpdef void write_samples(tuple sample_data) - -cdef class Gen(Action): - ''' Handle `gen` command for kt_tool ''' - cdef: - string _problem_id - string _url - - cdef _gen_samples(self) - cdef _act(self) - -cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil - -cdef class Test(Action): - cdef: - string file_name - string pre_script - string script - string post_script - string lang - - cdef detect_file_name(self) - cdef _act(self) \ No newline at end of file diff --git a/setup.py b/setup.py index 85b10b0..144908b 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ from distutils.command.sdist import sdist as _sdist from setuptools import setup, find_packages, Extension +from src.version import version import pathlib try: @@ -19,8 +20,8 @@ extensions = [ Extension( - "ktlib", - sources=[f"ktlib.{ext}"], + "src.ktlib", + sources=[f"src/ktlib.{ext}"], extra_compile_args=["-O3", "--std=c++17"], language="c++" ), @@ -36,7 +37,7 @@ name='kttool', cmdclass=cmdclass, ext_modules=extensions, - version="0.0.6", + version=version, description="Kattis command line tool", long_description=README, long_description_content_type="text/markdown", diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ktlib.cpp b/src/ktlib.cpp similarity index 60% rename from ktlib.cpp rename to src/ktlib.cpp index 4422698..283ced6 100644 --- a/ktlib.cpp +++ b/src/ktlib.cpp @@ -9,12 +9,12 @@ "--std=c++17" ], "language": "c++", - "name": "ktlib", + "name": "src.ktlib", "sources": [ - "ktlib.pyx" + "src/ktlib.pyx" ] }, - "module_name": "ktlib" + "module_name": "src.ktlib" } END: Cython Metadata */ @@ -624,16 +624,16 @@ static CYTHON_INLINE float __PYX_NAN() { #endif #endif -#define __PYX_HAVE__ktlib -#define __PYX_HAVE_API__ktlib +#define __PYX_HAVE__src__ktlib +#define __PYX_HAVE_API__src__ktlib /* Early includes */ -#include #include "ios" #include "new" #include "stdexcept" #include "typeinfo" -#include #include +#include +#include #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -646,11 +646,11 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 1 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "utf8" -#define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ @@ -842,267 +842,294 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "ktlib.pyx", + "src/ktlib.pyx", "stringsource", }; -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - /*--- Type declarations ---*/ -struct __pyx_obj_5ktlib_Action; -struct __pyx_obj_5ktlib_Gen; -struct __pyx_obj_5ktlib_Test; -struct __pyx_obj_5ktlib_ConfigError; -struct __pyx_obj_5ktlib_Submit; -struct __pyx_obj_5ktlib_Config; -struct __pyx_obj_5ktlib_Open; -struct __pyx_obj_5ktlib_Version; -struct __pyx_obj_5ktlib_Update; -struct __pyx_opt_args_5ktlib_make_list_equal; -struct __pyx_opt_args_5ktlib_6Action_get_url; -struct __pyx_opt_args_5ktlib_ask_with_default; - -/* "ktlib.pxd":11 - * cpdef string color_red(const string& text) nogil - * - * cdef void make_list_equal(vector[string]& lhs, vector[string]& rhs, string pad_element=*) nogil # <<<<<<<<<<<<<< - * - * cdef class Action: - */ -struct __pyx_opt_args_5ktlib_make_list_equal { +struct __pyx_obj_3src_5ktlib_ConfigError; +struct __pyx_obj_3src_5ktlib_Action; +struct __pyx_obj_3src_5ktlib_SampleData; +struct __pyx_obj_3src_5ktlib_Gen; +struct __pyx_obj_3src_5ktlib_RunnableFile; +struct __pyx_obj_3src_5ktlib_Test; +struct __pyx_obj_3src_5ktlib_Submit; +struct __pyx_obj_3src_5ktlib_Config; +struct __pyx_obj_3src_5ktlib_Open; +struct __pyx_obj_3src_5ktlib_Version; +struct __pyx_obj_3src_5ktlib_Update; +struct __pyx_opt_args_3src_5ktlib_ask_with_default; +struct __pyx_opt_args_3src_5ktlib_make_list_equal; +struct __pyx_opt_args_3src_5ktlib_6Action_get_url; + +/* "src/ktlib.pyx":125 + * log = print + * # -------------- Utility functions ---------------- + * cdef str ask_with_default(str qu, str default_val=''): # <<<<<<<<<<<<<< + * ''' Print out `qu` to console and ask for input value from user + * If no input was provided by user, `default_val` will be returned instead + */ +struct __pyx_opt_args_3src_5ktlib_ask_with_default { int __pyx_n; - std::string pad_element; + PyObject *default_val; }; -/* "ktlib.pxd":24 - * cdef string get_problem_url(self) - * cdef string get_problem_id(self) - * cdef string get_url(self, const string& option, string default = *) # <<<<<<<<<<<<<< - * cdef _act(self) +/* "src/ktlib.pyx":142 + * return ret * + * cdef void make_list_equal( # <<<<<<<<<<<<<< + * list lhs, + * list rhs, */ -struct __pyx_opt_args_5ktlib_6Action_get_url { +struct __pyx_opt_args_3src_5ktlib_make_list_equal { int __pyx_n; - std::string __pyx_default; + PyObject *pad_element; }; -/* "ktlib.pyx":135 +/* "src/ktlib.pyx":174 + * self.cfg = None * - * # -------------- Utility functions ---------------- - * cdef string ask_with_default(string qu, string default_val=b''): # <<<<<<<<<<<<<< - * ''' Print out `qu` to console and ask for input value from user - * If no input was provided by user, `default_val` will be returned instead + * cdef str get_url(self, str option, str default = '') : # <<<<<<<<<<<<<< + * ''' Get appropriate urls from kattisrc file + * Args: */ -struct __pyx_opt_args_5ktlib_ask_with_default { +struct __pyx_opt_args_3src_5ktlib_6Action_get_url { int __pyx_n; - std::string default_val; + PyObject *__pyx_default; }; -/* "ktlib.pxd":13 - * cdef void make_list_equal(vector[string]& lhs, vector[string]& rhs, string pad_element=*) nogil +/* "src/ktlib.pyx":50 + * ) + * + * cdef class ConfigError(Exception): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_3src_5ktlib_ConfigError { + PyBaseExceptionObject __pyx_base; +}; + + +/* "src/ktlib.pyx":160 * + * # -------------- Core functions/classes ---------------- * cdef class Action: # <<<<<<<<<<<<<< * cdef: - * string config_path + * object config_path */ -struct __pyx_obj_5ktlib_Action { +struct __pyx_obj_3src_5ktlib_Action { PyObject_HEAD - struct __pyx_vtabstruct_5ktlib_Action *__pyx_vtab; - std::string config_path; + struct __pyx_vtabstruct_3src_5ktlib_Action *__pyx_vtab; + PyObject *config_path; PyObject *cfg; PyObject *cookies; - std::string kt_config; + PyObject *kt_config; }; -/* "ktlib.pxd":29 - * cpdef void write_samples(tuple sample_data) +/* "src/ktlib.pyx":287 * - * cdef class Gen(Action): # <<<<<<<<<<<<<< - * ''' Handle `gen` command for kt_tool ''' + * @cython.final + * cdef class SampleData: # <<<<<<<<<<<<<< * cdef: + * str problem_id */ -struct __pyx_obj_5ktlib_Gen { - struct __pyx_obj_5ktlib_Action __pyx_base; - std::string _problem_id; - std::string _url; +struct __pyx_obj_3src_5ktlib_SampleData { + PyObject_HEAD + PyObject *problem_id; + int is_in; + PyObject *sample_id; + PyObject *data; }; -/* "ktlib.pxd":40 - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil +/* "src/ktlib.pyx":316 * - * cdef class Test(Action): # <<<<<<<<<<<<<< + * @cython.final + * cdef class Gen(Action): # <<<<<<<<<<<<<< + * ''' Handle `gen` command for kt_tool ''' * cdef: - * string file_name - */ -struct __pyx_obj_5ktlib_Test { - struct __pyx_obj_5ktlib_Action __pyx_base; - std::string file_name; - std::string pre_script; - std::string script; - std::string post_script; - std::string lang; + */ +struct __pyx_obj_3src_5ktlib_Gen { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; + PyObject *_problem_id; + PyObject *_url; }; -/* "ktlib.pyx":47 - * ) - * - * cdef class ConfigError(Exception): # <<<<<<<<<<<<<< - * pass +/* "src/ktlib.pyx":402 * + * @cython.final + * cdef class RunnableFile: # <<<<<<<<<<<<<< + * cdef: + * str ext */ -struct __pyx_obj_5ktlib_ConfigError { - PyBaseExceptionObject __pyx_base; +struct __pyx_obj_3src_5ktlib_RunnableFile { + PyObject_HEAD + PyObject *ext; + PyObject *problem_id; + PyObject *file_name; }; -/* "ktlib.pyx":540 +/* "src/ktlib.pyx":415 * + * @cython.final + * cdef class Test(Action): # <<<<<<<<<<<<<< + * cdef: + * str file_name + */ +struct __pyx_obj_3src_5ktlib_Test { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; + PyObject *file_name; + PyObject *pre_script; + PyObject *script; + PyObject *post_script; + PyObject *lang; +}; + + +/* "src/ktlib.pyx":587 * + * @cython.final * cdef class Submit(Action): # <<<<<<<<<<<<<< * '''Handle kt submit action to push the file to kattis website''' * cdef: */ -struct __pyx_obj_5ktlib_Submit { - struct __pyx_obj_5ktlib_Action __pyx_base; - std::string ac_icon; - std::string rj_icon; - std::string sk_icon; - std::string file_name; - std::string lang; - std::string submission_id; - std::string problem_id; +struct __pyx_obj_3src_5ktlib_Submit { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; + PyObject *ac_icon; + PyObject *rj_icon; + PyObject *sk_icon; + PyObject *file_name; + PyObject *lang; + PyObject *submission_id; + PyObject *problem_id; }; -/* "ktlib.pyx":742 +/* "src/ktlib.pyx":792 * * * cdef class Config(Action): # <<<<<<<<<<<<<< * cdef add_template(self): * cdef: */ -struct __pyx_obj_5ktlib_Config { - struct __pyx_obj_5ktlib_Action __pyx_base; +struct __pyx_obj_3src_5ktlib_Config { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; }; -/* "ktlib.pyx":867 +/* "src/ktlib.pyx":917 * raise ValueError('Invalid option') * * cdef class Open(Action): # <<<<<<<<<<<<<< - * cdef _act(self): + * cdef void _act(self) except *: * webbrowser.open(self.get_problem_url()) */ -struct __pyx_obj_5ktlib_Open { - struct __pyx_obj_5ktlib_Action __pyx_base; +struct __pyx_obj_3src_5ktlib_Open { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; }; -/* "ktlib.pyx":871 +/* "src/ktlib.pyx":921 * webbrowser.open(self.get_problem_url()) * * cdef class Version(Action): # <<<<<<<<<<<<<< - * cdef _act(self): - * print(f'Current version: {color_cyan(_VERSION)}') + * cdef void _act(self) except *: + * log(f'Current version: {color_cyan(version)}') */ -struct __pyx_obj_5ktlib_Version { - struct __pyx_obj_5ktlib_Action __pyx_base; +struct __pyx_obj_3src_5ktlib_Version { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; }; -/* "ktlib.pyx":875 - * print(f'Current version: {color_cyan(_VERSION)}') +/* "src/ktlib.pyx":925 + * log(f'Current version: {color_cyan(version)}') * * cdef class Update(Action): # <<<<<<<<<<<<<< - * cdef _act(self): + * cdef void _act(self) except *: * cdef: */ -struct __pyx_obj_5ktlib_Update { - struct __pyx_obj_5ktlib_Action __pyx_base; +struct __pyx_obj_3src_5ktlib_Update { + struct __pyx_obj_3src_5ktlib_Action __pyx_base; }; -/* "ktlib.pyx":172 +/* "src/ktlib.pyx":160 * * # -------------- Core functions/classes ---------------- - * cdef class Action(object): # <<<<<<<<<<<<<< - * ''' Base class for handle general command. - * Handle loading up .kattisrc config file + * cdef class Action: # <<<<<<<<<<<<<< + * cdef: + * object config_path */ -struct __pyx_vtabstruct_5ktlib_Action { - PyObject *(*read_config_from_file)(struct __pyx_obj_5ktlib_Action *); - PyObject *(*login)(struct __pyx_obj_5ktlib_Action *); - std::string (*get_problem_url)(struct __pyx_obj_5ktlib_Action *); - std::string (*get_problem_id)(struct __pyx_obj_5ktlib_Action *); - std::string (*get_url)(struct __pyx_obj_5ktlib_Action *, std::string const &, struct __pyx_opt_args_5ktlib_6Action_get_url *__pyx_optional_args); - PyObject *(*_act)(struct __pyx_obj_5ktlib_Action *); +struct __pyx_vtabstruct_3src_5ktlib_Action { + PyObject *(*get_url)(struct __pyx_obj_3src_5ktlib_Action *, PyObject *, struct __pyx_opt_args_3src_5ktlib_6Action_get_url *__pyx_optional_args); + void (*read_config_from_file)(struct __pyx_obj_3src_5ktlib_Action *); + void (*login)(struct __pyx_obj_3src_5ktlib_Action *); + PyObject *(*get_problem_id)(struct __pyx_obj_3src_5ktlib_Action *); + PyObject *(*get_problem_url)(struct __pyx_obj_3src_5ktlib_Action *); + void (*_act)(struct __pyx_obj_3src_5ktlib_Action *); + void (*act)(struct __pyx_obj_3src_5ktlib_Action *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_5ktlib_Action *__pyx_vtabptr_5ktlib_Action; +static struct __pyx_vtabstruct_3src_5ktlib_Action *__pyx_vtabptr_3src_5ktlib_Action; -/* "ktlib.pyx":306 - * f.write(sample_data[1]) +/* "src/ktlib.pyx":316 * + * @cython.final * cdef class Gen(Action): # <<<<<<<<<<<<<< * ''' Handle `gen` command for kt_tool ''' - * def __cinit__(self, string problem_id): + * cdef: */ -struct __pyx_vtabstruct_5ktlib_Gen { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; - PyObject *(*_gen_samples)(struct __pyx_obj_5ktlib_Gen *); +struct __pyx_vtabstruct_3src_5ktlib_Gen { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; + void (*_gen_samples)(struct __pyx_obj_3src_5ktlib_Gen *); }; -static struct __pyx_vtabstruct_5ktlib_Gen *__pyx_vtabptr_5ktlib_Gen; +static struct __pyx_vtabstruct_3src_5ktlib_Gen *__pyx_vtabptr_3src_5ktlib_Gen; +static void __pyx_f_3src_5ktlib_3Gen__gen_samples(struct __pyx_obj_3src_5ktlib_Gen *); -/* "ktlib.pyx":388 - * +/* "src/ktlib.pyx":415 * + * @cython.final * cdef class Test(Action): # <<<<<<<<<<<<<< - * cdef detect_file_name(self): - * ''' Confirm the executable file if there is multiple files that are runnable in current folder + * cdef: + * str file_name */ -struct __pyx_vtabstruct_5ktlib_Test { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; - PyObject *(*detect_file_name)(struct __pyx_obj_5ktlib_Test *); +struct __pyx_vtabstruct_3src_5ktlib_Test { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; + void (*detect_file_name)(struct __pyx_obj_3src_5ktlib_Test *); }; -static struct __pyx_vtabstruct_5ktlib_Test *__pyx_vtabptr_5ktlib_Test; +static struct __pyx_vtabstruct_3src_5ktlib_Test *__pyx_vtabptr_3src_5ktlib_Test; +static void __pyx_f_3src_5ktlib_4Test_detect_file_name(struct __pyx_obj_3src_5ktlib_Test *); -/* "ktlib.pyx":540 - * +/* "src/ktlib.pyx":587 * + * @cython.final * cdef class Submit(Action): # <<<<<<<<<<<<<< * '''Handle kt submit action to push the file to kattis website''' * cdef: */ -struct __pyx_vtabstruct_5ktlib_Submit { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; - bool (*is_finished)(struct __pyx_obj_5ktlib_Submit *, PyObject *, PyObject *, std::string &, std::string); - PyObject *(*_render_result)(struct __pyx_obj_5ktlib_Submit *, std::string); - PyObject *(*detect_file_name)(struct __pyx_obj_5ktlib_Submit *); +struct __pyx_vtabstruct_3src_5ktlib_Submit { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; + int (*is_finished)(struct __pyx_obj_3src_5ktlib_Submit *, PyObject *, PyObject *, PyObject *, PyObject *); + void (*_render_result)(struct __pyx_obj_3src_5ktlib_Submit *, PyObject *); + PyObject *(*detect_file_name)(struct __pyx_obj_3src_5ktlib_Submit *); }; -static struct __pyx_vtabstruct_5ktlib_Submit *__pyx_vtabptr_5ktlib_Submit; +static struct __pyx_vtabstruct_3src_5ktlib_Submit *__pyx_vtabptr_3src_5ktlib_Submit; +static int __pyx_f_3src_5ktlib_6Submit_is_finished(struct __pyx_obj_3src_5ktlib_Submit *, PyObject *, PyObject *, PyObject *, PyObject *); +static void __pyx_f_3src_5ktlib_6Submit__render_result(struct __pyx_obj_3src_5ktlib_Submit *, PyObject *); +static PyObject *__pyx_f_3src_5ktlib_6Submit_detect_file_name(struct __pyx_obj_3src_5ktlib_Submit *); -/* "ktlib.pyx":742 +/* "src/ktlib.pyx":792 * * * cdef class Config(Action): # <<<<<<<<<<<<<< @@ -1110,55 +1137,56 @@ static struct __pyx_vtabstruct_5ktlib_Submit *__pyx_vtabptr_5ktlib_Submit; * cdef: */ -struct __pyx_vtabstruct_5ktlib_Config { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; - PyObject *(*add_template)(struct __pyx_obj_5ktlib_Config *); - PyObject *(*remove_template)(struct __pyx_obj_5ktlib_Config *); - PyObject *(*update_default)(struct __pyx_obj_5ktlib_Config *); +struct __pyx_vtabstruct_3src_5ktlib_Config { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; + PyObject *(*add_template)(struct __pyx_obj_3src_5ktlib_Config *); + PyObject *(*remove_template)(struct __pyx_obj_3src_5ktlib_Config *); + void (*update_default)(struct __pyx_obj_3src_5ktlib_Config *); + void (*_act)(struct __pyx_obj_3src_5ktlib_Config *); }; -static struct __pyx_vtabstruct_5ktlib_Config *__pyx_vtabptr_5ktlib_Config; +static struct __pyx_vtabstruct_3src_5ktlib_Config *__pyx_vtabptr_3src_5ktlib_Config; -/* "ktlib.pyx":867 +/* "src/ktlib.pyx":917 * raise ValueError('Invalid option') * * cdef class Open(Action): # <<<<<<<<<<<<<< - * cdef _act(self): + * cdef void _act(self) except *: * webbrowser.open(self.get_problem_url()) */ -struct __pyx_vtabstruct_5ktlib_Open { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; +struct __pyx_vtabstruct_3src_5ktlib_Open { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; }; -static struct __pyx_vtabstruct_5ktlib_Open *__pyx_vtabptr_5ktlib_Open; +static struct __pyx_vtabstruct_3src_5ktlib_Open *__pyx_vtabptr_3src_5ktlib_Open; -/* "ktlib.pyx":871 +/* "src/ktlib.pyx":921 * webbrowser.open(self.get_problem_url()) * * cdef class Version(Action): # <<<<<<<<<<<<<< - * cdef _act(self): - * print(f'Current version: {color_cyan(_VERSION)}') + * cdef void _act(self) except *: + * log(f'Current version: {color_cyan(version)}') */ -struct __pyx_vtabstruct_5ktlib_Version { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; +struct __pyx_vtabstruct_3src_5ktlib_Version { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; }; -static struct __pyx_vtabstruct_5ktlib_Version *__pyx_vtabptr_5ktlib_Version; +static struct __pyx_vtabstruct_3src_5ktlib_Version *__pyx_vtabptr_3src_5ktlib_Version; -/* "ktlib.pyx":875 - * print(f'Current version: {color_cyan(_VERSION)}') +/* "src/ktlib.pyx":925 + * log(f'Current version: {color_cyan(version)}') * * cdef class Update(Action): # <<<<<<<<<<<<<< - * cdef _act(self): + * cdef void _act(self) except *: * cdef: */ -struct __pyx_vtabstruct_5ktlib_Update { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; +struct __pyx_vtabstruct_3src_5ktlib_Update { + struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_base; }; -static struct __pyx_vtabstruct_5ktlib_Update *__pyx_vtabptr_5ktlib_Update; +static struct __pyx_vtabstruct_3src_5ktlib_Update *__pyx_vtabptr_3src_5ktlib_Update; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1331,6 +1359,9 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif +/* PyUnicode_Unicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); + /* IncludeStringH.proto */ #include @@ -1338,6 +1369,12 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); @@ -1383,10 +1420,29 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); +/* py_abs.proto */ +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num); +#define __Pyx_PyNumber_Absolute(x)\ + ((likely(PyLong_CheckExact(x))) ?\ + (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\ + PyNumber_Absolute(x)) +#else +#define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x) +#endif + +/* ListExtend.proto */ +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, @@ -1395,8 +1451,12 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, /* KeywordStringCheck.proto */ static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif /* PyObjectLookupSpecial.proto */ #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS @@ -1424,12 +1484,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK @@ -1455,25 +1511,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); - /* PyObjectFormatSimple.proto */ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_FormatSimple(s, f) (\ @@ -1496,11 +1533,24 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, PyObject_Format(s, f)) #endif -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +/* PyIntCompare.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); @@ -1510,14 +1560,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AndObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAnd(op1, op2) : PyNumber_And(op1, op2)) -#endif - /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { @@ -1535,22 +1577,6 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2)) -#endif - /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -1573,13 +1599,6 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - /* BuildPyUnicode.proto */ static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, int prepend_sign, char padding_char); @@ -1629,6 +1648,51 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* UnpackUnboundCMethod.proto */ +typedef struct { + PyObject *type; + PyObject **method_name; + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; + +/* CallUnboundCMethod1.proto */ +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* CallUnboundCMethod2.proto */ +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* DictGetItem.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1646,17 +1710,18 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } -/* PyObjectCallMethod1.proto */ -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char); -/* append.proto */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); +/* unicode_tailmatch.proto */ +static int __Pyx_PyUnicode_Tailmatch( + PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction); /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); @@ -1721,6 +1786,26 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, PyObject *module, PyObject *globals, PyObject* code); +/* CallUnboundCMethod0.proto */ +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CallUnboundCMethod0(cfunc, self)\ + (likely((cfunc)->func) ?\ + (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\ + (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\ + (PY_VERSION_HEX >= 0x030700A0 ?\ + (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\ + (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\ + (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\ + (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\ + (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\ + ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\ + __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\ + __Pyx__CallUnboundCMethod0(cfunc, self)) +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); @@ -1739,11 +1824,11 @@ static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject * static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); /* CIntToPyUnicode.proto */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); @@ -1751,34 +1836,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t wi /* PyIntCompare.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* PyUnicode_Unicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); -#define __Pyx_PyObject_Dict_GetItem(obj, name)\ - (likely(PyDict_CheckExact(obj)) ?\ - __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) -#else -#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) -#endif +/* py_dict_pop.proto */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value); /* IterNext.proto */ #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* py_dict_keys.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); + /* SliceTupleAndList.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); @@ -1814,15 +1886,15 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - /* PyObjectGetAttrStrNoError.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1849,51 +1921,6 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); -/* None.proto */ -#include - -/* CppExceptionConversion.proto */ -#ifndef __Pyx_CppExn2PyErr -#include -#include -#include -#include -static void __Pyx_CppExn2PyErr() { - try { - if (PyErr_Occurred()) - ; // let the latest Python exn pass through and ignore the current one - else - throw; - } catch (const std::bad_alloc& exn) { - PyErr_SetString(PyExc_MemoryError, exn.what()); - } catch (const std::bad_cast& exn) { - PyErr_SetString(PyExc_TypeError, exn.what()); - } catch (const std::bad_typeid& exn) { - PyErr_SetString(PyExc_TypeError, exn.what()); - } catch (const std::domain_error& exn) { - PyErr_SetString(PyExc_ValueError, exn.what()); - } catch (const std::invalid_argument& exn) { - PyErr_SetString(PyExc_ValueError, exn.what()); - } catch (const std::ios_base::failure& exn) { - PyErr_SetString(PyExc_IOError, exn.what()); - } catch (const std::out_of_range& exn) { - PyErr_SetString(PyExc_IndexError, exn.what()); - } catch (const std::overflow_error& exn) { - PyErr_SetString(PyExc_OverflowError, exn.what()); - } catch (const std::range_error& exn) { - PyErr_SetString(PyExc_ArithmeticError, exn.what()); - } catch (const std::underflow_error& exn) { - PyErr_SetString(PyExc_ArithmeticError, exn.what()); - } catch (const std::exception& exn) { - PyErr_SetString(PyExc_RuntimeError, exn.what()); - } - catch (...) - { - PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); - } -} -#endif - /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); @@ -1915,102 +1942,86 @@ static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); -/* FunctionExport.proto */ -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); - /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); -static std::string __pyx_f_5ktlib_6Action_get_url(struct __pyx_obj_5ktlib_Action *__pyx_v_self, std::string const &__pyx_v_option, struct __pyx_opt_args_5ktlib_6Action_get_url *__pyx_optional_args); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto*/ -static std::string __pyx_f_5ktlib_6Action_get_problem_id(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto*/ -static std::string __pyx_f_5ktlib_6Action_get_problem_url(struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Action__act(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_3Gen__gen_samples(struct __pyx_obj_5ktlib_Gen *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_3Gen__act(struct __pyx_obj_5ktlib_Gen *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_Test *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v_self); /* proto*/ -static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *__pyx_v_self, PyObject *__pyx_v_output_lines, PyObject *__pyx_v_result, std::string &__pyx_v_status, std::string __pyx_v_run_time); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_Submit *__pyx_v_self, std::string __pyx_v_submission_url_ret); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib_Submit *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Config *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_Config *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Config_update_default(struct __pyx_obj_5ktlib_Config *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_4Open__act(struct __pyx_obj_5ktlib_Open *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_7Version__act(CYTHON_UNUSED struct __pyx_obj_5ktlib_Version *__pyx_v_self); /* proto*/ -static PyObject *__pyx_f_5ktlib_6Update__act(CYTHON_UNUSED struct __pyx_obj_5ktlib_Update *__pyx_v_self); /* proto*/ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libcpp.string' */ +static PyObject *__pyx_f_3src_5ktlib_6Action_get_url(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self, PyObject *__pyx_v_option, struct __pyx_opt_args_3src_5ktlib_6Action_get_url *__pyx_optional_args); /* proto*/ +static void __pyx_f_3src_5ktlib_6Action_read_config_from_file(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_6Action_login(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_3src_5ktlib_6Action_get_problem_id(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_3src_5ktlib_6Action_get_problem_url(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_6Action__act(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_6Action_act(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_3src_5ktlib_3Gen__gen_samples(struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_3Gen__act(struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_4Test_detect_file_name(struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_4Test__act(struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self); /* proto*/ +static int __pyx_f_3src_5ktlib_6Submit_is_finished(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self, PyObject *__pyx_v_output_lines, PyObject *__pyx_v_result, PyObject *__pyx_v_status, PyObject *__pyx_v_run_time); /* proto*/ +static void __pyx_f_3src_5ktlib_6Submit__render_result(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self, PyObject *__pyx_v_submission_url_ret); /* proto*/ +static PyObject *__pyx_f_3src_5ktlib_6Submit_detect_file_name(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_6Submit__act(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_3src_5ktlib_6Config_add_template(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_3src_5ktlib_6Config_remove_template(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_6Config_update_default(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self); /* proto*/ +void __pyx_f_3src_5ktlib_6Config__act(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self); /* proto*/ +void __pyx_f_3src_5ktlib_6Config__act__pyx_wrap_1(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_4Open__act(struct __pyx_obj_3src_5ktlib_Open *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_7Version__act(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Version *__pyx_v_self); /* proto*/ +static void __pyx_f_3src_5ktlib_6Update__act(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Update *__pyx_v_self); /* proto*/ + +/* Module declarations from 'cython' */ /* Module declarations from 'libcpp.vector' */ /* Module declarations from 'libcpp' */ -/* Module declarations from 'ktlib' */ -static PyTypeObject *__pyx_ptype_5ktlib_Action = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Gen = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Test = 0; -static PyTypeObject *__pyx_ptype_5ktlib_ConfigError = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Submit = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Config = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Open = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Version = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Update = 0; -static char const *__pyx_v_5ktlib__KATTIS_RC_URL; -static PyObject *__pyx_v_5ktlib__HEADERS = 0; -static char const *__pyx_v_5ktlib__VERSION; -static char const *__pyx_v_5ktlib__PYPI_PACKAGE_INFO; -static PyObject *__pyx_v_5ktlib_test_subprocesses = 0; -static PyObject *__pyx_v_5ktlib_map_template_to_plang = 0; -static std::string __pyx_v_5ktlib_BOLD_SEQ; -static std::string __pyx_v_5ktlib_RESET_SEQ; -static std::string __pyx_v_5ktlib_BLACK; -static std::string __pyx_v_5ktlib_RED; -static std::string __pyx_v_5ktlib_GREEN; -static std::string __pyx_v_5ktlib_YELLOW; -static std::string __pyx_v_5ktlib_BLUE; -static std::string __pyx_v_5ktlib_MAGENTA; -static std::string __pyx_v_5ktlib_CYAN; -static std::string __pyx_v_5ktlib_WHITE; -static PyObject *__pyx_v_5ktlib_map_key_to_class = 0; -static std::string __pyx_f_5ktlib_color_cyan(std::string const &, int __pyx_skip_dispatch); /*proto*/ -static std::string __pyx_f_5ktlib_color_green(std::string const &, int __pyx_skip_dispatch); /*proto*/ -static std::string __pyx_f_5ktlib_color_red(std::string const &, int __pyx_skip_dispatch); /*proto*/ -static void __pyx_f_5ktlib_make_list_equal(std::vector &, std::vector &, struct __pyx_opt_args_5ktlib_make_list_equal *__pyx_optional_args); /*proto*/ -static void __pyx_f_5ktlib_write_samples(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static bool __pyx_f_5ktlib_compare_entity(std::string const &, std::string const &, std::string &); /*proto*/ -static std::string __pyx_f_5ktlib_ask_with_default(std::string, struct __pyx_opt_args_5ktlib_ask_with_default *__pyx_optional_args); /*proto*/ -static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_5ktlib_exit_gracefully(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_5ktlib___pyx_unpickle_ConfigError__set_state(struct __pyx_obj_5ktlib_ConfigError *, PyObject *); /*proto*/ -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ -static std::vector __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/ -static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector &); /*proto*/ -#define __Pyx_MODULE_NAME "ktlib" -extern int __pyx_module_is_main_ktlib; -int __pyx_module_is_main_ktlib = 0; - -/* Implementation of 'ktlib' */ +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'src.ktlib' */ +static PyTypeObject *__pyx_ptype_3src_5ktlib_ConfigError = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Action = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_SampleData = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Gen = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_RunnableFile = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Test = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Submit = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Config = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Open = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Version = 0; +static PyTypeObject *__pyx_ptype_3src_5ktlib_Update = 0; +static PyObject *__pyx_v_3src_5ktlib__HEADERS = 0; +static PyObject *__pyx_v_3src_5ktlib_test_subprocesses = 0; +static PyObject *__pyx_v_3src_5ktlib_map_template_to_plang = 0; +static PyObject *__pyx_v_3src_5ktlib_map_key_to_class = 0; +static PyObject *__pyx_f_3src_5ktlib_color_cyan(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_color_green(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_color_red(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_ask_with_default(PyObject *, struct __pyx_opt_args_3src_5ktlib_ask_with_default *__pyx_optional_args); /*proto*/ +static void __pyx_f_3src_5ktlib_make_list_equal(PyObject *, PyObject *, struct __pyx_opt_args_3src_5ktlib_make_list_equal *__pyx_optional_args); /*proto*/ +static void __pyx_f_3src_5ktlib_write_samples(struct __pyx_obj_3src_5ktlib_SampleData *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_compare_entity(PyObject *, PyObject *); /*proto*/ +static struct __pyx_obj_3src_5ktlib_Action *__pyx_f_3src_5ktlib_arg_parse(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_exit_gracefully(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib___pyx_unpickle_ConfigError__set_state(struct __pyx_obj_3src_5ktlib_ConfigError *, PyObject *); /*proto*/ +#define __Pyx_MODULE_NAME "src.ktlib" +extern int __pyx_module_is_main_src__ktlib; +int __pyx_module_is_main_src__ktlib = 0; + +/* Implementation of 'src.ktlib' */ +static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_input; static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_NotImplementedError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_sorted; static PyObject *__pyx_builtin_ValueError; +static const char __pyx_k_[] = ""; static const char __pyx_k_C[] = "C"; +static const char __pyx_k_M[] = " M"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_d[] = "\\d+"; static const char __pyx_k_m[] = "-m"; @@ -2018,14 +2029,12 @@ static const char __pyx_k_r[] = "r"; static const char __pyx_k_s[] = " s "; static const char __pyx_k_w[] = "w"; static const char __pyx_k_0m[] = "\033[0m"; -static const char __pyx_k_1m[] = "\033[1m"; static const char __pyx_k_2f[] = ".2f"; static const char __pyx_k_3f[] = ".3f"; static const char __pyx_k_Go[] = "Go"; -static const char __pyx_k_Mb[] = " Mb"; static const char __pyx_k__2[] = "\n"; -static const char __pyx_k__6[] = "/"; -static const char __pyx_k__7[] = "{}\n"; +static const char __pyx_k__4[] = "/"; +static const char __pyx_k__5[] = "{}\n"; static const char __pyx_k_br[] = "
"; static const char __pyx_k_cc[] = "cc"; static const char __pyx_k_go[] = "go"; @@ -2040,26 +2049,28 @@ static const char __pyx_k_rs[] = "rs"; static const char __pyx_k_td[] = "td"; static const char __pyx_k_C_2[] = "C++"; static const char __pyx_k_Gen[] = "Gen"; -static const char __pyx_k__16[] = "."; -static const char __pyx_k__20[] = " "; -static const char __pyx_k__21[] = ": "; -static const char __pyx_k__22[] = " \n"; -static const char __pyx_k__23[] = "-"; -static const char __pyx_k__24[] = " "; -static const char __pyx_k__26[] = " ... "; -static const char __pyx_k__33[] = ""; -static const char __pyx_k__38[] = " ("; -static const char __pyx_k__39[] = "): "; -static const char __pyx_k__50[] = "*"; +static const char __pyx_k__15[] = "."; +static const char __pyx_k__18[] = " "; +static const char __pyx_k__22[] = " "; +static const char __pyx_k__23[] = ": "; +static const char __pyx_k__24[] = " \n"; +static const char __pyx_k__25[] = "-"; +static const char __pyx_k__27[] = " ... "; +static const char __pyx_k__37[] = " ("; +static const char __pyx_k__38[] = "): "; +static const char __pyx_k__49[] = "*"; +static const char __pyx_k_act[] = "act"; static const char __pyx_k_all[] = "__all__"; static const char __pyx_k_ans[] = "ans"; static const char __pyx_k_bs4[] = "bs4"; static const char __pyx_k_cpp[] = "cpp"; +static const char __pyx_k_cwd[] = "cwd"; static const char __pyx_k_div[] = "div"; static const char __pyx_k_ext[] = "ext"; static const char __pyx_k_gen[] = "gen"; static const char __pyx_k_get[] = "get"; static const char __pyx_k_key[] = "key"; +static const char __pyx_k_log[] = "log"; static const char __pyx_k_map[] = "map"; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_pid[] = "pid"; @@ -2072,20 +2083,23 @@ static const char __pyx_k_rss[] = "rss"; static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_tag[] = "tag"; static const char __pyx_k_txt[] = ".txt"; +static const char __pyx_k_w_2[] = "w+"; static const char __pyx_k_Diff[] = "--- Diff ---"; -static const char __pyx_k_HOME[] = "HOME"; static const char __pyx_k_Java[] = "Java"; static const char __pyx_k_None[] = "None"; static const char __pyx_k_Open[] = "Open"; static const char __pyx_k_PIPE[] = "PIPE"; +static const char __pyx_k_Path[] = "Path"; static const char __pyx_k_Rust[] = "Rust"; static const char __pyx_k_Test[] = "Test"; +static const char __pyx_k_back[] = "back"; static const char __pyx_k_data[] = "data"; static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_dump[] = "dump"; static const char __pyx_k_exit[] = "__exit__"; static const char __pyx_k_file[] = "$%file%$"; static const char __pyx_k_find[] = "find"; +static const char __pyx_k_home[] = "home"; static const char __pyx_k_java[] = "java"; static const char __pyx_k_join[] = "join"; static const char __pyx_k_json[] = "json"; @@ -2093,7 +2107,7 @@ static const char __pyx_k_keys[] = "keys"; static const char __pyx_k_kill[] = "kill"; static const char __pyx_k_load[] = "load"; static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_name[] = "name"; static const char __pyx_k_open[] = "open"; static const char __pyx_k_path[] = "path"; static const char __pyx_k_post[] = "post"; @@ -2105,18 +2119,14 @@ static const char __pyx_k_time[] = "time"; static const char __pyx_k_true[] = "true"; static const char __pyx_k_user[] = "user"; static const char __pyx_k_wait[] = "wait"; -static const char __pyx_k_6_90m[] = "\033[6;90m"; static const char __pyx_k_6_91m[] = "\033[6;91m"; static const char __pyx_k_6_92m[] = "\033[6;92m"; -static const char __pyx_k_6_93m[] = "\033[6;93m"; -static const char __pyx_k_6_94m[] = "\033[6;94m"; -static const char __pyx_k_6_95m[] = "\033[6;95m"; static const char __pyx_k_6_96m[] = "\033[6;96m"; -static const char __pyx_k_6_97m[] = "\033[6;97m"; static const char __pyx_k_Input[] = "--- Input ---"; static const char __pyx_k_Popen[] = "Popen"; static const char __pyx_k_alias[] = "alias"; static const char __pyx_k_class[] = "class"; +static const char __pyx_k_clear[] = "clear"; static const char __pyx_k_emoji[] = "emoji"; static const char __pyx_k_enter[] = "__enter__"; static const char __pyx_k_files[] = "files"; @@ -2125,10 +2135,11 @@ static const char __pyx_k_group[] = "group"; static const char __pyx_k_https[] = "https://"; static const char __pyx_k_index[] = "index"; static const char __pyx_k_input[] = "input"; +static const char __pyx_k_is_in[] = "is_in"; static const char __pyx_k_items[] = "items"; -static const char __pyx_k_ktlib[] = "ktlib"; static const char __pyx_k_ljust[] = "ljust"; static const char __pyx_k_login[] = "login"; +static const char __pyx_k_mkdir[] = "mkdir"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_shell[] = "shell"; @@ -2156,14 +2167,12 @@ static const char __pyx_k_dict_2[] = "dict"; static const char __pyx_k_exists[] = "exists"; static const char __pyx_k_exit_2[] = "exit"; static const char __pyx_k_file_2[] = "./$%file%$"; -static const char __pyx_k_getcwd[] = "getcwd"; -static const char __pyx_k_getenv[] = "getenv"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_indent[] = "indent"; -static const char __pyx_k_isfile[] = "isfile"; static const char __pyx_k_kattis[] = "kattis"; static const char __pyx_k_kttool[] = "kttool=="; static const char __pyx_k_latest[] = "latest"; +static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_output[] = "output"; static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_psutil[] = "psutil"; @@ -2181,6 +2190,8 @@ static const char __pyx_k_test_2[] = "__test__"; static const char __pyx_k_update[] = "update"; static const char __pyx_k_Lanuage[] = "Lanuage : "; static const char __pyx_k_Process[] = "Process"; +static const char __pyx_k_Running[] = "Running"; +static const char __pyx_k_VERSION[] = "VERSION"; static const char __pyx_k_Version[] = "Version"; static const char __pyx_k_abspath[] = "abspath"; static const char __pyx_k_class_2[] = "class_"; @@ -2192,13 +2203,16 @@ static const char __pyx_k_emojize[] = "emojize"; static const char __pyx_k_futures[] = "futures"; static const char __pyx_k_headers[] = "headers"; static const char __pyx_k_install[] = "install"; -static const char __pyx_k_listdir[] = "listdir"; +static const char __pyx_k_is_file[] = "is_file"; +static const char __pyx_k_iterdir[] = "iterdir"; +static const char __pyx_k_parents[] = "parents"; +static const char __pyx_k_pathlib[] = "pathlib"; static const char __pyx_k_problem[] = "problem"; static const char __pyx_k_replace[] = "replace"; static const char __pyx_k_reprint[] = "reprint"; static const char __pyx_k_rm_file[] = "rm $%file%$"; static const char __pyx_k_upgrade[] = "--upgrade"; -static const char __pyx_k_version[] = " version!"; +static const char __pyx_k_version[] = "version"; static const char __pyx_k_Accepted[] = "Accepted"; static const char __pyx_k_Generate[] = "Generate "; static const char __pyx_k_Python_2[] = "Python 2"; @@ -2216,7 +2230,6 @@ static const char __pyx_k_kattisrc[] = ".kattisrc"; static const char __pyx_k_ktconfig[] = ".ktconfig"; static const char __pyx_k_language[] = "language "; static const char __pyx_k_loginurl[] = "loginurl"; -static const char __pyx_k_makedirs[] = "makedirs"; static const char __pyx_k_password[] = "password"; static const char __pyx_k_problems[] = "problems"; static const char __pyx_k_pyx_type[] = "__pyx_type"; @@ -2228,6 +2241,7 @@ static const char __pyx_k_strftime[] = "strftime"; static const char __pyx_k_sub_file[] = "sub_file[]"; static const char __pyx_k_template[] = "~/template."; static const char __pyx_k_username[] = "username"; +static const char __pyx_k_Compiling[] = "Compiling"; static const char __pyx_k_PLanguage[] = "PLanguage"; static const char __pyx_k_Test_Case[] = "Test Case #"; static const char __pyx_k_Test_case[] = "Test case #"; @@ -2243,13 +2257,16 @@ static const char __pyx_k_mainclass[] = "mainclass"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_readlines[] = "readlines"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_sample_id[] = "sample_id"; +static const char __pyx_k_src_ktlib[] = "src.ktlib"; static const char __pyx_k_testcases[] = "testcases"; -static const char __pyx_k_version_2[] = "version"; +static const char __pyx_k_version_2[] = " version!"; static const char __pyx_k_HTMLParser[] = "HTMLParser"; static const char __pyx_k_JavaScript[] = "JavaScript"; static const char __pyx_k_Pre_script[] = "Pre-script"; static const char __pyx_k_Problem_ID[] = "Problem ID : "; static const char __pyx_k_Problem_is[] = "Problem is "; +static const char __pyx_k_SampleData[] = "SampleData"; static const char __pyx_k_User_Agent[] = "User-Agent"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_check_call[] = "check_call"; @@ -2265,7 +2282,6 @@ static const char __pyx_k_preexec_fn[] = "preexec_fn"; static const char __pyx_k_problem_id[] = "problem_id"; static const char __pyx_k_pyx_result[] = "__pyx_result"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_startswith[] = "startswith"; static const char __pyx_k_submit_ctr[] = "submit_ctr"; static const char __pyx_k_subprocess[] = "subprocess"; static const char __pyx_k_test_cases[] = "test cases "; @@ -2305,6 +2321,7 @@ static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_successfully[] = " successfully!"; static const char __pyx_k_BeautifulSoup[] = "BeautifulSoup"; static const char __pyx_k_Choose_a_file[] = "Choose a file:"; +static const char __pyx_k_Compile_Error[] = "Compile Error"; static const char __pyx_k_Default_value[] = " | Default value: "; static const char __pyx_k_For_eg_cpp_cc[] = " ? For eg cpp, cc, ..."; static const char __pyx_k_Invalid_input[] = "Invalid input"; @@ -2346,7 +2363,6 @@ static const char __pyx_k_white_medium_square[] = ":white_medium_square:"; static const char __pyx_k_Choose_a_file_to_run[] = "Choose a file to run"; static const char __pyx_k_You_already_have_the[] = "You already have the "; static const char __pyx_k_Invalid_option_chosen[] = "Invalid option chosen"; -static const char __pyx_k_Please_download_it_at[] = ". Please download it at "; static const char __pyx_k_Submission_successful[] = "Submission successful"; static const char __pyx_k_gcc_file_c_o_file_out[] = "gcc $%file%$.c -o $%file%$.out"; static const char __pyx_k_heavy_multiplication_x[] = ":heavy_multiplication_x:"; @@ -2364,7 +2380,10 @@ static const char __pyx_k_ktconfig_file_has_not_been_set[] = ".ktconfig file has static const char __pyx_k_First_argument_should_be_one_of[] = "First argument should be one of "; static const char __pyx_k_Internal_error_Number_of_sample[] = "Internal error: Number of sample input is not equal to number of sample output"; static const char __pyx_k_No_default_template_detected_in[] = "No default template detected in "; +static const char __pyx_k_Please_download_it_at_https_ope[] = ". Please download it at https://open.kattis.com/download/kattisrc"; static const char __pyx_k_Your_kattisrc_file_appears_corr[] = " Your .kattisrc file appears corrupted. It must provide a token (or a\n KATTIS password).\n Please download a new .kattisrc file"; +static const char __pyx_k_https_pypi_org_pypi_kttool_json[] = "https://pypi.org/pypi/kttool/json"; +static const char __pyx_k_1_Add_a_template_2_Remove_a_temp[] = "1: Add a template\n2: Remove a template\n3: Select a default template\n"; static const char __pyx_k_Great_is_the_art_of_beginning_bu[] = "Great is the art of beginning, but greater is the art of ending."; static const char __pyx_k_Hmm_seems_like_there_is_currentl[] = "Hmm seems like there is currently no pypi releases :-?"; static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())"; @@ -2380,41 +2399,45 @@ static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __red static const char __pyx_k_Which_template_would_you_like_to_2[] = "Which template would you like to "; static const char __pyx_k_Which_template_would_you_like_to_3[] = "Which template would you like to gen as "; static const char __pyx_k_g_std_c_14_D_GLIBCXX_DEBUG_D_GLI_2[] = "g++ -std=c++14 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -O3 $%file%$.cc -o $%file%$.out"; +static PyObject *__pyx_kp_u_; static PyObject *__pyx_kp_u_02l_M_p_Z_on_b_d_Y; -static PyObject *__pyx_kp_b_0m; -static PyObject *__pyx_kp_b_1m; +static PyObject *__pyx_kp_u_0m; +static PyObject *__pyx_kp_u_1_Add_a_template_2_Remove_a_temp; static PyObject *__pyx_kp_u_2f; static PyObject *__pyx_kp_u_3f; -static PyObject *__pyx_kp_b_6_90m; -static PyObject *__pyx_kp_b_6_91m; -static PyObject *__pyx_kp_b_6_92m; -static PyObject *__pyx_kp_b_6_93m; -static PyObject *__pyx_kp_b_6_94m; -static PyObject *__pyx_kp_b_6_95m; -static PyObject *__pyx_kp_b_6_96m; -static PyObject *__pyx_kp_b_6_97m; +static PyObject *__pyx_kp_u_6_91m; +static PyObject *__pyx_kp_u_6_92m; +static PyObject *__pyx_kp_u_6_96m; static PyObject *__pyx_n_u_Accepted; -static PyObject *__pyx_kp_b_Access_denied_403; +static PyObject *__pyx_kp_u_Access_denied_403; static PyObject *__pyx_n_s_Action; +static PyObject *__pyx_kp_u_Adapted_from_xalanq_s_cf_tool; static PyObject *__pyx_n_s_BeautifulSoup; static PyObject *__pyx_n_u_C; static PyObject *__pyx_kp_u_C_2; +static PyObject *__pyx_kp_u_Choose_a_file; +static PyObject *__pyx_kp_u_Choose_a_file_to_run; +static PyObject *__pyx_kp_u_Compile_Error; +static PyObject *__pyx_n_u_Compiling; static PyObject *__pyx_n_s_Config; static PyObject *__pyx_n_s_ConfigError; static PyObject *__pyx_n_s_ConfigParser; static PyObject *__pyx_kp_u_Current_version; static PyObject *__pyx_kp_u_Default_value; +static PyObject *__pyx_kp_u_Diff; static PyObject *__pyx_kp_u_First_argument_should_be_one_of; static PyObject *__pyx_kp_u_For_eg_cpp_cc; static PyObject *__pyx_n_s_Gen; static PyObject *__pyx_kp_u_Generate; static PyObject *__pyx_n_u_Go; -static PyObject *__pyx_n_u_HOME; +static PyObject *__pyx_kp_u_Great_is_the_art_of_beginning_bu; static PyObject *__pyx_n_s_HTMLParser; +static PyObject *__pyx_kp_u_Hmm_seems_like_there_is_currentl; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4; -static PyObject *__pyx_kp_b_Incorrect_login_URL_404; -static PyObject *__pyx_kp_b_Incorrect_submit_URL_404; -static PyObject *__pyx_kp_b_Incorrect_username_or_password_t; +static PyObject *__pyx_kp_u_Incorrect_login_URL_404; +static PyObject *__pyx_kp_u_Incorrect_submit_URL_404; +static PyObject *__pyx_kp_u_Incorrect_username_or_password_t; +static PyObject *__pyx_kp_u_Input; static PyObject *__pyx_kp_u_Installed_version; static PyObject *__pyx_kp_u_Internal_error; static PyObject *__pyx_kp_u_Internal_error_Number_of_sample; @@ -2426,7 +2449,7 @@ static PyObject *__pyx_n_u_Java; static PyObject *__pyx_n_u_JavaScript; static PyObject *__pyx_kp_u_Lanuage; static PyObject *__pyx_kp_u_Login_failed; -static PyObject *__pyx_kp_u_Mb; +static PyObject *__pyx_kp_u_M; static PyObject *__pyx_n_s_NoOptionError; static PyObject *__pyx_kp_u_No_command_provided_to_kt; static PyObject *__pyx_kp_u_No_default_template_detected_in; @@ -2437,12 +2460,13 @@ static PyObject *__pyx_kp_u_Not_executable_code_file_detecte; static PyObject *__pyx_n_s_Open; static PyObject *__pyx_n_s_PIPE; static PyObject *__pyx_n_s_PLanguage; +static PyObject *__pyx_n_s_Path; static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_kp_u_Please_download_it_at; +static PyObject *__pyx_kp_u_Please_download_it_at_https_ope; static PyObject *__pyx_kp_u_Please_enter; static PyObject *__pyx_n_s_Popen; -static PyObject *__pyx_kp_b_Post_script; -static PyObject *__pyx_kp_b_Pre_script; +static PyObject *__pyx_kp_u_Post_script; +static PyObject *__pyx_kp_u_Pre_script; static PyObject *__pyx_kp_u_Problem_ID; static PyObject *__pyx_kp_u_Problem_is; static PyObject *__pyx_n_s_Process; @@ -2451,18 +2475,24 @@ static PyObject *__pyx_n_u_ProgrammingLanguage; static PyObject *__pyx_kp_u_Python; static PyObject *__pyx_kp_u_Python_2; static PyObject *__pyx_kp_u_Python_3; +static PyObject *__pyx_n_s_RunnableFile; static PyObject *__pyx_n_u_RunnableFile; +static PyObject *__pyx_n_u_Running; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_kp_u_Runtime_Error; static PyObject *__pyx_n_u_Rust; static PyObject *__pyx_n_s_SIGINT; static PyObject *__pyx_n_u_Sample; -static PyObject *__pyx_n_b_Script; +static PyObject *__pyx_n_s_SampleData; +static PyObject *__pyx_n_u_Script; +static PyObject *__pyx_kp_u_Select_an_option; static PyObject *__pyx_kp_u_Status_code; static PyObject *__pyx_kp_u_Submission_ID_d; static PyObject *__pyx_kp_u_Submission_failed; +static PyObject *__pyx_kp_u_Submission_successful; static PyObject *__pyx_n_s_Submit; -static PyObject *__pyx_kp_b_Template_path; +static PyObject *__pyx_kp_u_Template_file_has_been_generated; +static PyObject *__pyx_kp_u_Template_path; static PyObject *__pyx_kp_u_Template_will_run_3_scripts_in; static PyObject *__pyx_n_s_Test; static PyObject *__pyx_kp_u_Test_Case; @@ -2472,40 +2502,41 @@ static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_Update; static PyObject *__pyx_kp_u_User_Agent; static PyObject *__pyx_kp_u_Username; +static PyObject *__pyx_n_s_VERSION; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_Version; static PyObject *__pyx_kp_u_Which_python_version_you_want_to; -static PyObject *__pyx_kp_b_Which_template_would_you_like_to; +static PyObject *__pyx_kp_u_Which_template_would_you_like_to; static PyObject *__pyx_kp_u_Which_template_would_you_like_to_2; static PyObject *__pyx_kp_u_Which_template_would_you_like_to_3; static PyObject *__pyx_kp_u_Wrong_Answer; +static PyObject *__pyx_kp_u_Yosh_your_configuration_has_been; static PyObject *__pyx_kp_u_You_already_have_the; static PyObject *__pyx_kp_u_Your_kattisrc_file_appears_corr; -static PyObject *__pyx_kp_u__16; +static PyObject *__pyx_kp_u__15; +static PyObject *__pyx_kp_u__18; static PyObject *__pyx_kp_u__2; -static PyObject *__pyx_kp_u__20; -static PyObject *__pyx_kp_u__21; static PyObject *__pyx_kp_u__22; static PyObject *__pyx_kp_u__23; static PyObject *__pyx_kp_u__24; -static PyObject *__pyx_kp_u__26; -static PyObject *__pyx_kp_b__33; -static PyObject *__pyx_kp_u__33; +static PyObject *__pyx_kp_u__25; +static PyObject *__pyx_kp_u__27; +static PyObject *__pyx_kp_u__37; static PyObject *__pyx_kp_u__38; -static PyObject *__pyx_kp_u__39; -static PyObject *__pyx_n_s__50; -static PyObject *__pyx_kp_u__6; -static PyObject *__pyx_kp_u__7; +static PyObject *__pyx_kp_u__4; +static PyObject *__pyx_n_s__49; +static PyObject *__pyx_kp_u__5; static PyObject *__pyx_n_s_abspath; static PyObject *__pyx_n_u_accepted; +static PyObject *__pyx_n_s_act; static PyObject *__pyx_n_s_alias; static PyObject *__pyx_n_u_alias; static PyObject *__pyx_n_s_all; -static PyObject *__pyx_n_b_ans; static PyObject *__pyx_n_u_ans; static PyObject *__pyx_n_s_append; static PyObject *__pyx_kp_u_application_octet_stream; static PyObject *__pyx_n_u_arg_parse; +static PyObject *__pyx_n_s_back; static PyObject *__pyx_n_s_basename; static PyObject *__pyx_kp_u_br; static PyObject *__pyx_n_s_bs4; @@ -2514,6 +2545,7 @@ static PyObject *__pyx_n_u_cc; static PyObject *__pyx_n_s_check_call; static PyObject *__pyx_n_u_class; static PyObject *__pyx_n_s_class_2; +static PyObject *__pyx_n_s_clear; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_collections; static PyObject *__pyx_n_u_color_green; @@ -2529,10 +2561,13 @@ static PyObject *__pyx_n_s_cookies; static PyObject *__pyx_n_s_copyfile; static PyObject *__pyx_n_u_cpp; static PyObject *__pyx_kp_u_current_time; +static PyObject *__pyx_n_s_cwd; static PyObject *__pyx_kp_u_d; static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_s_decode; static PyObject *__pyx_n_u_default; +static PyObject *__pyx_kp_u_default_2; +static PyObject *__pyx_n_u_delete; static PyObject *__pyx_n_s_dict; static PyObject *__pyx_n_u_dict_2; static PyObject *__pyx_n_u_div; @@ -2567,8 +2602,6 @@ static PyObject *__pyx_kp_u_g_std_c_14_D_GLIBCXX_DEBUG_D_GLI_2; static PyObject *__pyx_kp_u_gcc_file_c_o_file_out; static PyObject *__pyx_n_u_gen; static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_getcwd; -static PyObject *__pyx_n_s_getenv; static PyObject *__pyx_n_s_getsignal; static PyObject *__pyx_n_s_getstate; static PyObject *__pyx_n_u_go; @@ -2576,14 +2609,15 @@ static PyObject *__pyx_kp_u_go_build_o_file; static PyObject *__pyx_n_s_group; static PyObject *__pyx_n_s_has_option; static PyObject *__pyx_n_s_headers; -static PyObject *__pyx_kp_b_heavy_check_mark; -static PyObject *__pyx_kp_b_heavy_multiplication_x; +static PyObject *__pyx_kp_u_heavy_check_mark; +static PyObject *__pyx_kp_u_heavy_multiplication_x; +static PyObject *__pyx_n_s_home; static PyObject *__pyx_n_u_hostname; static PyObject *__pyx_n_s_html_parser; static PyObject *__pyx_kp_u_html_parser; static PyObject *__pyx_kp_u_https; +static PyObject *__pyx_kp_u_https_pypi_org_pypi_kttool_json; static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_b_in; static PyObject *__pyx_n_u_in; static PyObject *__pyx_n_s_indent; static PyObject *__pyx_n_s_index; @@ -2592,9 +2626,11 @@ static PyObject *__pyx_n_s_input; static PyObject *__pyx_n_s_input_file; static PyObject *__pyx_n_u_input_file; static PyObject *__pyx_n_u_install; +static PyObject *__pyx_n_s_is_file; +static PyObject *__pyx_n_s_is_in; static PyObject *__pyx_kp_u_is_not_in_ur_config_file; -static PyObject *__pyx_n_s_isfile; static PyObject *__pyx_n_s_items; +static PyObject *__pyx_n_s_iterdir; static PyObject *__pyx_n_u_java; static PyObject *__pyx_kp_u_javac_java; static PyObject *__pyx_n_s_join; @@ -2607,23 +2643,26 @@ static PyObject *__pyx_n_s_keys; static PyObject *__pyx_n_s_kill; static PyObject *__pyx_n_u_kt; static PyObject *__pyx_kp_u_ktconfig; -static PyObject *__pyx_n_s_ktlib; +static PyObject *__pyx_kp_u_ktconfig_file_has_not_been_set; static PyObject *__pyx_kp_u_kttool; static PyObject *__pyx_kp_u_language; static PyObject *__pyx_n_u_language_2; -static PyObject *__pyx_n_s_listdir; +static PyObject *__pyx_n_u_latest; static PyObject *__pyx_n_s_ljust; static PyObject *__pyx_n_s_load; -static PyObject *__pyx_n_b_login; +static PyObject *__pyx_n_s_log; +static PyObject *__pyx_n_u_login; +static PyObject *__pyx_n_u_loginurl; static PyObject *__pyx_kp_u_m; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_u_mainclass; -static PyObject *__pyx_n_s_makedirs; static PyObject *__pyx_n_s_map; static PyObject *__pyx_n_s_max_workers; static PyObject *__pyx_n_s_memory_info; +static PyObject *__pyx_n_s_mkdir; static PyObject *__pyx_n_s_multiprocessing; static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_n_s_namedtuple; static PyObject *__pyx_n_s_new; static PyObject *__pyx_kp_u_no_cache_dir; @@ -2636,9 +2675,11 @@ static PyObject *__pyx_n_s_output; static PyObject *__pyx_n_s_output_file; static PyObject *__pyx_n_u_output_file; static PyObject *__pyx_n_s_output_type; +static PyObject *__pyx_n_s_parents; static PyObject *__pyx_n_u_password; static PyObject *__pyx_n_s_path; static PyObject *__pyx_n_u_path; +static PyObject *__pyx_n_s_pathlib; static PyObject *__pyx_n_s_perf_counter; static PyObject *__pyx_n_s_pickle; static PyObject *__pyx_n_s_pid; @@ -2691,6 +2732,7 @@ static PyObject *__pyx_kp_u_running_time; static PyObject *__pyx_kp_u_runtime_middle; static PyObject *__pyx_kp_u_rustc_file_rs; static PyObject *__pyx_kp_u_s; +static PyObject *__pyx_n_s_sample_id; static PyObject *__pyx_kp_u_sample_s_to; static PyObject *__pyx_n_s_script; static PyObject *__pyx_n_u_script; @@ -2707,7 +2749,7 @@ static PyObject *__pyx_n_s_sleep; static PyObject *__pyx_n_s_sorted; static PyObject *__pyx_n_u_span; static PyObject *__pyx_n_s_split; -static PyObject *__pyx_n_s_startswith; +static PyObject *__pyx_n_s_src_ktlib; static PyObject *__pyx_n_s_status_code; static PyObject *__pyx_kp_u_status_middle; static PyObject *__pyx_n_s_stdin; @@ -2718,8 +2760,9 @@ static PyObject *__pyx_n_s_strip; static PyObject *__pyx_kp_u_sub_file; static PyObject *__pyx_kp_u_submission_id; static PyObject *__pyx_kp_u_submission_result; -static PyObject *__pyx_n_b_submissions; -static PyObject *__pyx_n_b_submit; +static PyObject *__pyx_n_u_submissions; +static PyObject *__pyx_n_u_submissionsurl; +static PyObject *__pyx_n_u_submissionurl; static PyObject *__pyx_n_u_submit; static PyObject *__pyx_n_u_submit_ctr; static PyObject *__pyx_n_s_subprocess; @@ -2743,53 +2786,69 @@ static PyObject *__pyx_kp_u_upgrade; static PyObject *__pyx_n_u_user; static PyObject *__pyx_n_u_username; static PyObject *__pyx_kp_u_utf_8; -static PyObject *__pyx_kp_u_version; -static PyObject *__pyx_n_u_version_2; +static PyObject *__pyx_n_s_version; +static PyObject *__pyx_n_u_version; +static PyObject *__pyx_kp_u_version_2; static PyObject *__pyx_n_u_w; +static PyObject *__pyx_kp_u_w_2; static PyObject *__pyx_n_s_wait; static PyObject *__pyx_n_s_webbrowser; -static PyObject *__pyx_kp_b_white_medium_square; +static PyObject *__pyx_kp_u_white_medium_square; static PyObject *__pyx_n_s_write; static PyObject *__pyx_n_s_write_samples; -static PyObject *__pyx_pf_5ktlib_11ConfigError___reduce_cython__(struct __pyx_obj_5ktlib_ConfigError *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx_obj_5ktlib_ConfigError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_color_cyan(CYTHON_UNUSED PyObject *__pyx_self, std::string __pyx_v_text); /* proto */ -static PyObject *__pyx_pf_5ktlib_2color_green(CYTHON_UNUSED PyObject *__pyx_self, std::string __pyx_v_text); /* proto */ -static PyObject *__pyx_pf_5ktlib_4color_red(CYTHON_UNUSED PyObject *__pyx_self, std::string __pyx_v_text); /* proto */ -static int __pyx_pf_5ktlib_6Action___cinit__(struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Action_2act(struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Action_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_6write_samples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample_data); /* proto */ -static int __pyx_pf_5ktlib_3Gen___cinit__(struct __pyx_obj_5ktlib_Gen *__pyx_v_self, std::string __pyx_v_problem_id); /* proto */ -static PyObject *__pyx_pf_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Gen *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_3Gen_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Gen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_11ConfigError___reduce_cython__(struct __pyx_obj_3src_5ktlib_ConfigError *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx_obj_3src_5ktlib_ConfigError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_color_cyan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_2color_green(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_4color_red(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */ +static int __pyx_pf_3src_5ktlib_6Action___cinit__(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Action_2act(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Action_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_3src_5ktlib_10SampleData___cinit__(struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_self, PyObject *__pyx_v_problem_id, PyObject *__pyx_v_data, int __pyx_v_is_in, PyObject *__pyx_v_sample_id); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_10SampleData_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_10SampleData_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6write_samples(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_sample_data); /* proto */ +static int __pyx_pf_3src_5ktlib_3Gen___cinit__(struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self, PyObject *__pyx_v_problem_id); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_3Gen_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_3src_5ktlib_12RunnableFile___cinit__(struct __pyx_obj_3src_5ktlib_RunnableFile *__pyx_v_self, PyObject *__pyx_v_problem_id, PyObject *__pyx_v_ext, PyObject *__pyx_v_file_name); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_12RunnableFile_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_RunnableFile *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_12RunnableFile_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_RunnableFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ -static PyObject *__pyx_pf_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Test *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_4Test_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Test *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static int __pyx_pf_5ktlib_6Submit___cinit__(struct __pyx_obj_5ktlib_Submit *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Submit_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Submit *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Submit_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Submit *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Config *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Config_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Config *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Open *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_4Open_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Version *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_7Version_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Version *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Update *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Update *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_5ktlib_10exit_gracefully(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signum, PyObject *__pyx_v_frame); /* proto */ -static PyObject *__pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_tp_new_5ktlib_Action(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Gen(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Test(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_ConfigError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Submit(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Open(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Version(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5ktlib_Update(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_pf_3src_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_4Test_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_3src_5ktlib_6Submit___cinit__(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Submit_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Submit_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Config_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Open *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_4Open_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Version *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_7Version_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Version *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Update *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Update *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_10exit_gracefully(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signum, PyObject *__pyx_v_frame); /* proto */ +static PyObject *__pyx_pf_3src_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_3src_5ktlib_ConfigError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Action(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_SampleData(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Gen(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_RunnableFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Test(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Submit(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Open(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Version(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_3src_5ktlib_Update(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_back = {0, &__pyx_n_s_back, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_clear = {0, &__pyx_n_s_clear, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type_append = {0, &__pyx_n_s_append, 0, 0, 0}; static PyObject *__pyx_float_0_4; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; @@ -2800,10 +2859,9 @@ static PyObject *__pyx_int_200; static PyObject *__pyx_int_403; static PyObject *__pyx_int_404; static PyObject *__pyx_int_222419149; -static std::string __pyx_k_; -static std::string __pyx_k__3; -static std::string __pyx_k__4; -static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__3; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; @@ -2811,21 +2869,22 @@ static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__13; static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__16; static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__26; static PyObject *__pyx_tuple__28; static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__30; static PyObject *__pyx_tuple__31; static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__35; static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__37; +static PyObject *__pyx_tuple__39; static PyObject *__pyx_tuple__40; static PyObject *__pyx_tuple__41; static PyObject *__pyx_tuple__42; @@ -2835,7 +2894,7 @@ static PyObject *__pyx_tuple__45; static PyObject *__pyx_tuple__46; static PyObject *__pyx_tuple__47; static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__49; +static PyObject *__pyx_tuple__50; static PyObject *__pyx_tuple__51; static PyObject *__pyx_tuple__52; static PyObject *__pyx_tuple__53; @@ -2845,8 +2904,7 @@ static PyObject *__pyx_tuple__56; static PyObject *__pyx_tuple__57; static PyObject *__pyx_tuple__58; static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_codeobj__61; +static PyObject *__pyx_codeobj__60; /* Late includes */ /* "(tree fragment)":1 @@ -2856,19 +2914,19 @@ static PyObject *__pyx_codeobj__61; */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_11ConfigError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_11ConfigError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_11ConfigError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_11ConfigError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_11ConfigError___reduce_cython__(((struct __pyx_obj_5ktlib_ConfigError *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_11ConfigError___reduce_cython__(((struct __pyx_obj_3src_5ktlib_ConfigError *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_11ConfigError___reduce_cython__(struct __pyx_obj_5ktlib_ConfigError *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_11ConfigError___reduce_cython__(struct __pyx_obj_3src_5ktlib_ConfigError *__pyx_v_self) { PyObject *__pyx_v_state = 0; PyObject *__pyx_v__dict = 0; int __pyx_v_use_setstate; @@ -3064,7 +3122,7 @@ static PyObject *__pyx_pf_5ktlib_11ConfigError___reduce_cython__(struct __pyx_ob __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("ktlib.ConfigError.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.ConfigError.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_state); @@ -3082,19 +3140,19 @@ static PyObject *__pyx_pf_5ktlib_11ConfigError___reduce_cython__(struct __pyx_ob */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_11ConfigError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_11ConfigError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_11ConfigError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_11ConfigError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_11ConfigError_2__setstate_cython__(((struct __pyx_obj_5ktlib_ConfigError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_11ConfigError_2__setstate_cython__(((struct __pyx_obj_3src_5ktlib_ConfigError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx_obj_5ktlib_ConfigError *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx_obj_3src_5ktlib_ConfigError *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3106,7 +3164,7 @@ static PyObject *__pyx_pf_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx * __pyx_unpickle_ConfigError__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_f_5ktlib___pyx_unpickle_ConfigError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib___pyx_unpickle_ConfigError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3122,7 +3180,7 @@ static PyObject *__pyx_pf_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.ConfigError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.ConfigError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3130,99 +3188,103 @@ static PyObject *__pyx_pf_5ktlib_11ConfigError_2__setstate_cython__(struct __pyx return __pyx_r; } -/* "ktlib.pyx":112 - * string WHITE = b'\033[6;97m' +/* "src/ktlib.pyx":112 + * DEF WHITE = '\033[6;97m' + * + * cpdef str color_cyan(str text): # <<<<<<<<<<<<<< + * return f'{CYAN}{text}{RESET_SEQ}' * - * cpdef string color_cyan(const string& text) nogil: # <<<<<<<<<<<<<< - * cdef: - * string res = CYAN - */ - -static PyObject *__pyx_pw_5ktlib_1color_cyan(PyObject *__pyx_self, PyObject *__pyx_arg_text); /*proto*/ -static std::string __pyx_f_5ktlib_color_cyan(std::string const &__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) { - std::string __pyx_v_res; - std::string __pyx_r; - - /* "ktlib.pyx":114 - * cpdef string color_cyan(const string& text) nogil: - * cdef: - * string res = CYAN # <<<<<<<<<<<<<< - * res.append(text) - * res.append(RESET_SEQ) */ - __pyx_v_res = __pyx_v_5ktlib_CYAN; - /* "ktlib.pyx":115 - * cdef: - * string res = CYAN - * res.append(text) # <<<<<<<<<<<<<< - * res.append(RESET_SEQ) - * return res - */ - (void)(__pyx_v_res.append(__pyx_v_text)); +static PyObject *__pyx_pw_3src_5ktlib_1color_cyan(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_color_cyan(PyObject *__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("color_cyan", 0); - /* "ktlib.pyx":116 - * string res = CYAN - * res.append(text) - * res.append(RESET_SEQ) # <<<<<<<<<<<<<< - * return res + /* "src/ktlib.pyx":113 * - */ - (void)(__pyx_v_res.append(__pyx_v_5ktlib_RESET_SEQ)); - - /* "ktlib.pyx":117 - * res.append(text) - * res.append(RESET_SEQ) - * return res # <<<<<<<<<<<<<< + * cpdef str color_cyan(str text): + * return f'{CYAN}{text}{RESET_SEQ}' # <<<<<<<<<<<<<< * - * cpdef string color_green(const string& text) nogil: - */ - __pyx_r = __pyx_v_res; - goto __pyx_L0; - - /* "ktlib.pyx":112 - * string WHITE = b'\033[6;97m' * - * cpdef string color_cyan(const string& text) nogil: # <<<<<<<<<<<<<< - * cdef: - * string res = CYAN + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_6_96m); + __pyx_t_2 += 7; + __Pyx_GIVEREF(__pyx_kp_u_6_96m); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_6_96m); + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_0m); + __pyx_t_2 += 4; + __Pyx_GIVEREF(__pyx_kp_u_0m); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_0m); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "src/ktlib.pyx":112 + * DEF WHITE = '\033[6;97m' + * + * cpdef str color_cyan(str text): # <<<<<<<<<<<<<< + * return f'{CYAN}{text}{RESET_SEQ}' + * */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.color_cyan", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_1color_cyan(PyObject *__pyx_self, PyObject *__pyx_arg_text); /*proto*/ -static PyObject *__pyx_pw_5ktlib_1color_cyan(PyObject *__pyx_self, PyObject *__pyx_arg_text) { - std::string __pyx_v_text; +static PyObject *__pyx_pw_3src_5ktlib_1color_cyan(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_1color_cyan(PyObject *__pyx_self, PyObject *__pyx_v_text) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("color_cyan (wrapper)", 0); - assert(__pyx_arg_text); { - __pyx_v_text = __pyx_convert_string_from_py_std__in_string(__pyx_arg_text); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("ktlib.color_cyan", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5ktlib_color_cyan(__pyx_self, ((std::string)__pyx_v_text)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_color_cyan(__pyx_self, ((PyObject*)__pyx_v_text)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_color_cyan(CYTHON_UNUSED PyObject *__pyx_self, std::string __pyx_v_text) { +static PyObject *__pyx_pf_3src_5ktlib_color_cyan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("color_cyan", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_v_text, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_color_cyan(__pyx_v_text, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3231,7 +3293,7 @@ static PyObject *__pyx_pf_5ktlib_color_cyan(CYTHON_UNUSED PyObject *__pyx_self, /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.color_cyan", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.color_cyan", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3239,99 +3301,103 @@ static PyObject *__pyx_pf_5ktlib_color_cyan(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "ktlib.pyx":119 - * return res +/* "src/ktlib.pyx":116 + * + * + * cpdef str color_green(str text): # <<<<<<<<<<<<<< + * return f'{GREEN}{text}{RESET_SEQ}' * - * cpdef string color_green(const string& text) nogil: # <<<<<<<<<<<<<< - * cdef: - * string res = GREEN - */ - -static PyObject *__pyx_pw_5ktlib_3color_green(PyObject *__pyx_self, PyObject *__pyx_arg_text); /*proto*/ -static std::string __pyx_f_5ktlib_color_green(std::string const &__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) { - std::string __pyx_v_res; - std::string __pyx_r; - - /* "ktlib.pyx":121 - * cpdef string color_green(const string& text) nogil: - * cdef: - * string res = GREEN # <<<<<<<<<<<<<< - * res.append(text) - * res.append(RESET_SEQ) */ - __pyx_v_res = __pyx_v_5ktlib_GREEN; - /* "ktlib.pyx":122 - * cdef: - * string res = GREEN - * res.append(text) # <<<<<<<<<<<<<< - * res.append(RESET_SEQ) - * return res - */ - (void)(__pyx_v_res.append(__pyx_v_text)); +static PyObject *__pyx_pw_3src_5ktlib_3color_green(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_color_green(PyObject *__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("color_green", 0); - /* "ktlib.pyx":123 - * string res = GREEN - * res.append(text) - * res.append(RESET_SEQ) # <<<<<<<<<<<<<< - * return res + /* "src/ktlib.pyx":117 * - */ - (void)(__pyx_v_res.append(__pyx_v_5ktlib_RESET_SEQ)); - - /* "ktlib.pyx":124 - * res.append(text) - * res.append(RESET_SEQ) - * return res # <<<<<<<<<<<<<< + * cpdef str color_green(str text): + * return f'{GREEN}{text}{RESET_SEQ}' # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_res; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_6_92m); + __pyx_t_2 += 7; + __Pyx_GIVEREF(__pyx_kp_u_6_92m); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_6_92m); + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_0m); + __pyx_t_2 += 4; + __Pyx_GIVEREF(__pyx_kp_u_0m); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_0m); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; goto __pyx_L0; - /* "ktlib.pyx":119 - * return res + /* "src/ktlib.pyx":116 + * + * + * cpdef str color_green(str text): # <<<<<<<<<<<<<< + * return f'{GREEN}{text}{RESET_SEQ}' * - * cpdef string color_green(const string& text) nogil: # <<<<<<<<<<<<<< - * cdef: - * string res = GREEN */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.color_green", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_3color_green(PyObject *__pyx_self, PyObject *__pyx_arg_text); /*proto*/ -static PyObject *__pyx_pw_5ktlib_3color_green(PyObject *__pyx_self, PyObject *__pyx_arg_text) { - std::string __pyx_v_text; +static PyObject *__pyx_pw_3src_5ktlib_3color_green(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_3color_green(PyObject *__pyx_self, PyObject *__pyx_v_text) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("color_green (wrapper)", 0); - assert(__pyx_arg_text); { - __pyx_v_text = __pyx_convert_string_from_py_std__in_string(__pyx_arg_text); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("ktlib.color_green", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5ktlib_2color_green(__pyx_self, ((std::string)__pyx_v_text)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_2color_green(__pyx_self, ((PyObject*)__pyx_v_text)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_2color_green(CYTHON_UNUSED PyObject *__pyx_self, std::string __pyx_v_text) { +static PyObject *__pyx_pf_3src_5ktlib_2color_green(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("color_green", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_v_text, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_color_green(__pyx_v_text, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3340,7 +3406,7 @@ static PyObject *__pyx_pf_5ktlib_2color_green(CYTHON_UNUSED PyObject *__pyx_self /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.color_green", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.color_green", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3348,99 +3414,103 @@ static PyObject *__pyx_pf_5ktlib_2color_green(CYTHON_UNUSED PyObject *__pyx_self return __pyx_r; } -/* "ktlib.pyx":127 +/* "src/ktlib.pyx":120 * * - * cpdef string color_red(const string& text) nogil: # <<<<<<<<<<<<<< - * cdef: - * string res = RED - */ - -static PyObject *__pyx_pw_5ktlib_5color_red(PyObject *__pyx_self, PyObject *__pyx_arg_text); /*proto*/ -static std::string __pyx_f_5ktlib_color_red(std::string const &__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) { - std::string __pyx_v_res; - std::string __pyx_r; - - /* "ktlib.pyx":129 - * cpdef string color_red(const string& text) nogil: - * cdef: - * string res = RED # <<<<<<<<<<<<<< - * res.append(text) - * res.append(RESET_SEQ) + * cpdef str color_red(str text): # <<<<<<<<<<<<<< + * return f'{RED}{text}{RESET_SEQ}' + * */ - __pyx_v_res = __pyx_v_5ktlib_RED; - /* "ktlib.pyx":130 - * cdef: - * string res = RED - * res.append(text) # <<<<<<<<<<<<<< - * res.append(RESET_SEQ) - * return res - */ - (void)(__pyx_v_res.append(__pyx_v_text)); +static PyObject *__pyx_pw_3src_5ktlib_5color_red(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_color_red(PyObject *__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("color_red", 0); - /* "ktlib.pyx":131 - * string res = RED - * res.append(text) - * res.append(RESET_SEQ) # <<<<<<<<<<<<<< - * return res + /* "src/ktlib.pyx":121 * - */ - (void)(__pyx_v_res.append(__pyx_v_5ktlib_RESET_SEQ)); - - /* "ktlib.pyx":132 - * res.append(text) - * res.append(RESET_SEQ) - * return res # <<<<<<<<<<<<<< + * cpdef str color_red(str text): + * return f'{RED}{text}{RESET_SEQ}' # <<<<<<<<<<<<<< * - * # -------------- Utility functions ---------------- + * log = print */ - __pyx_r = __pyx_v_res; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_6_91m); + __pyx_t_2 += 7; + __Pyx_GIVEREF(__pyx_kp_u_6_91m); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_6_91m); + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_0m); + __pyx_t_2 += 4; + __Pyx_GIVEREF(__pyx_kp_u_0m); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_0m); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; goto __pyx_L0; - /* "ktlib.pyx":127 + /* "src/ktlib.pyx":120 * * - * cpdef string color_red(const string& text) nogil: # <<<<<<<<<<<<<< - * cdef: - * string res = RED + * cpdef str color_red(str text): # <<<<<<<<<<<<<< + * return f'{RED}{text}{RESET_SEQ}' + * */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.color_red", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_5color_red(PyObject *__pyx_self, PyObject *__pyx_arg_text); /*proto*/ -static PyObject *__pyx_pw_5ktlib_5color_red(PyObject *__pyx_self, PyObject *__pyx_arg_text) { - std::string __pyx_v_text; +static PyObject *__pyx_pw_3src_5ktlib_5color_red(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_5color_red(PyObject *__pyx_self, PyObject *__pyx_v_text) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("color_red (wrapper)", 0); - assert(__pyx_arg_text); { - __pyx_v_text = __pyx_convert_string_from_py_std__in_string(__pyx_arg_text); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("ktlib.color_red", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5ktlib_4color_red(__pyx_self, ((std::string)__pyx_v_text)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_4color_red(__pyx_self, ((PyObject*)__pyx_v_text)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_4color_red(CYTHON_UNUSED PyObject *__pyx_self, std::string __pyx_v_text) { +static PyObject *__pyx_pf_3src_5ktlib_4color_red(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("color_red", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_v_text, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_color_red(__pyx_v_text, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3449,7 +3519,7 @@ static PyObject *__pyx_pf_5ktlib_4color_red(CYTHON_UNUSED PyObject *__pyx_self, /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.color_red", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.color_red", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3457,166 +3527,168 @@ static PyObject *__pyx_pf_5ktlib_4color_red(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "ktlib.pyx":135 - * +/* "src/ktlib.pyx":125 + * log = print * # -------------- Utility functions ---------------- - * cdef string ask_with_default(string qu, string default_val=b''): # <<<<<<<<<<<<<< + * cdef str ask_with_default(str qu, str default_val=''): # <<<<<<<<<<<<<< * ''' Print out `qu` to console and ask for input value from user * If no input was provided by user, `default_val` will be returned instead */ -static std::string __pyx_f_5ktlib_ask_with_default(std::string __pyx_v_qu, struct __pyx_opt_args_5ktlib_ask_with_default *__pyx_optional_args) { - std::string __pyx_v_default_val = __pyx_k_; - std::string __pyx_v_ret; - std::string __pyx_r; +static PyObject *__pyx_f_3src_5ktlib_ask_with_default(PyObject *__pyx_v_qu, struct __pyx_opt_args_3src_5ktlib_ask_with_default *__pyx_optional_args) { + PyObject *__pyx_v_default_val = ((PyObject*)__pyx_kp_u_); + PyObject *__pyx_v_ret = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - std::string __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_UCS4 __pyx_t_6; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_UCS4 __pyx_t_5; + int __pyx_t_6; __Pyx_RefNannySetupContext("ask_with_default", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_default_val = __pyx_optional_args->default_val; } } + __Pyx_INCREF(__pyx_v_qu); - /* "ktlib.pyx":146 - * cdef: - * string ret + /* "src/ktlib.pyx":134 + * - string value as the response + * ''' * qu = f'Please enter {color_cyan(qu)}' # <<<<<<<<<<<<<< - * if default_val.size() > 0: + * if default_val: * qu = f'{qu} | Default value: {default_val}\n' */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_v_qu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_color_cyan(__pyx_v_qu, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Please_enter, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Please_enter, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_qu = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_qu, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "ktlib.pyx":147 - * string ret + /* "src/ktlib.pyx":135 + * ''' * qu = f'Please enter {color_cyan(qu)}' - * if default_val.size() > 0: # <<<<<<<<<<<<<< + * if default_val: # <<<<<<<<<<<<<< * qu = f'{qu} | Default value: {default_val}\n' - * ret = input(qu) + * cdef str ret = input(qu) */ - __pyx_t_4 = ((__pyx_v_default_val.size() > 0) != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__pyx_v_default_val != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_default_val) != 0); + if (__pyx_t_3) { - /* "ktlib.pyx":148 + /* "src/ktlib.pyx":136 * qu = f'Please enter {color_cyan(qu)}' - * if default_val.size() > 0: + * if default_val: * qu = f'{qu} | Default value: {default_val}\n' # <<<<<<<<<<<<<< - * ret = input(qu) - * if ret.size() == 0: + * cdef str ret = input(qu) + * if not ret: */ - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = 0; - __pyx_t_6 = 127; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_qu); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_v_qu); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_qu) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_qu) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_v_qu); + __Pyx_GIVEREF(__pyx_v_qu); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_qu); __Pyx_INCREF(__pyx_kp_u_Default_value); - __pyx_t_5 += 18; + __pyx_t_4 += 18; __Pyx_GIVEREF(__pyx_kp_u_Default_value); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_Default_value); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_default_val); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_Default_value); + __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_v_default_val); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); + __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u__2); - __pyx_t_5 += 1; + __pyx_t_4 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u__2); - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__2); + __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_qu = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_qu, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "ktlib.pyx":147 - * string ret + /* "src/ktlib.pyx":135 + * ''' * qu = f'Please enter {color_cyan(qu)}' - * if default_val.size() > 0: # <<<<<<<<<<<<<< + * if default_val: # <<<<<<<<<<<<<< * qu = f'{qu} | Default value: {default_val}\n' - * ret = input(qu) + * cdef str ret = input(qu) */ } - /* "ktlib.pyx":149 - * if default_val.size() > 0: + /* "src/ktlib.pyx":137 + * if default_val: * qu = f'{qu} | Default value: {default_val}\n' - * ret = input(qu) # <<<<<<<<<<<<<< - * if ret.size() == 0: + * cdef str ret = input(qu) # <<<<<<<<<<<<<< + * if not ret: * return default_val */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_qu); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_input, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_input, __pyx_v_qu); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_ret = __pyx_t_3; + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_v_ret = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "ktlib.pyx":150 + /* "src/ktlib.pyx":138 * qu = f'{qu} | Default value: {default_val}\n' - * ret = input(qu) - * if ret.size() == 0: # <<<<<<<<<<<<<< + * cdef str ret = input(qu) + * if not ret: # <<<<<<<<<<<<<< * return default_val * return ret */ - __pyx_t_4 = ((__pyx_v_ret.size() == 0) != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__pyx_v_ret != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_ret) != 0); + __pyx_t_6 = ((!__pyx_t_3) != 0); + if (__pyx_t_6) { - /* "ktlib.pyx":151 - * ret = input(qu) - * if ret.size() == 0: + /* "src/ktlib.pyx":139 + * cdef str ret = input(qu) + * if not ret: * return default_val # <<<<<<<<<<<<<< * return ret * */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_default_val); __pyx_r = __pyx_v_default_val; goto __pyx_L0; - /* "ktlib.pyx":150 + /* "src/ktlib.pyx":138 * qu = f'{qu} | Default value: {default_val}\n' - * ret = input(qu) - * if ret.size() == 0: # <<<<<<<<<<<<<< + * cdef str ret = input(qu) + * if not ret: # <<<<<<<<<<<<<< * return default_val * return ret */ } - /* "ktlib.pyx":152 - * if ret.size() == 0: + /* "src/ktlib.pyx":140 + * if not ret: * return default_val * return ret # <<<<<<<<<<<<<< * * cdef void make_list_equal( */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); __pyx_r = __pyx_v_ret; goto __pyx_L0; - /* "ktlib.pyx":135 - * + /* "src/ktlib.pyx":125 + * log = print * # -------------- Utility functions ---------------- - * cdef string ask_with_default(string qu, string default_val=b''): # <<<<<<<<<<<<<< + * cdef str ask_with_default(str qu, str default_val=''): # <<<<<<<<<<<<<< * ''' Print out `qu` to console and ask for input value from user * If no input was provided by user, `default_val` will be returned instead */ @@ -3625,323 +3697,289 @@ static std::string __pyx_f_5ktlib_ask_with_default(std::string __pyx_v_qu, struc __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("ktlib.ask_with_default", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __Pyx_pretend_to_initialize(&__pyx_r); + __Pyx_AddTraceback("src.ktlib.ask_with_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_qu); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":154 +/* "src/ktlib.pyx":142 * return ret * * cdef void make_list_equal( # <<<<<<<<<<<<<< - * vector[string]& lhs, - * vector[string]& rhs, + * list lhs, + * list rhs, */ -static void __pyx_f_5ktlib_make_list_equal(std::vector &__pyx_v_lhs, std::vector &__pyx_v_rhs, struct __pyx_opt_args_5ktlib_make_list_equal *__pyx_optional_args) { - std::string __pyx_v_pad_element = __pyx_k__3; - int __pyx_t_1; +static void __pyx_f_3src_5ktlib_make_list_equal(PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, struct __pyx_opt_args_3src_5ktlib_make_list_equal *__pyx_optional_args) { + PyObject *__pyx_v_pad_element = ((PyObject*)__pyx_kp_u_); + int __pyx_v_delta_size; + PyObject *__pyx_v_delta_list = 0; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("make_list_equal", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_pad_element = __pyx_optional_args->pad_element; } } - /* "ktlib.pyx":164 + /* "src/ktlib.pyx":152 * - pad_element: string to fill the shorter vector * ''' - * while lhs.size() < rhs.size(): # <<<<<<<<<<<<<< - * lhs.push_back(pad_element) - * while rhs.size() < lhs.size(): + * cdef int delta_size = abs(len(lhs) - len(rhs)) # <<<<<<<<<<<<<< + * cdef list delta_list = [ pad_element ] * delta_size + * if len(lhs) < len(rhs): */ - while (1) { - __pyx_t_1 = ((__pyx_v_lhs.size() < __pyx_v_rhs.size()) != 0); - if (!__pyx_t_1) break; + if (unlikely(__pyx_v_lhs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 152, __pyx_L1_error) + } + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_lhs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 152, __pyx_L1_error) + if (unlikely(__pyx_v_rhs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 152, __pyx_L1_error) + } + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_rhs); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_delta_size = __pyx_t_5; - /* "ktlib.pyx":165 + /* "src/ktlib.pyx":153 * ''' - * while lhs.size() < rhs.size(): - * lhs.push_back(pad_element) # <<<<<<<<<<<<<< - * while rhs.size() < lhs.size(): - * rhs.push_back(pad_element) - */ - try { - __pyx_v_lhs.push_back(__pyx_v_pad_element); - } catch(...) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_CppExn2PyErr(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 165, __pyx_L1_error) + * cdef int delta_size = abs(len(lhs) - len(rhs)) + * cdef list delta_list = [ pad_element ] * delta_size # <<<<<<<<<<<<<< + * if len(lhs) < len(rhs): + * lhs.extend(delta_list) + */ + __pyx_t_4 = PyList_New(1 * ((__pyx_v_delta_size<0) ? 0:__pyx_v_delta_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_delta_size; __pyx_temp++) { + __Pyx_INCREF(__pyx_v_pad_element); + __Pyx_GIVEREF(__pyx_v_pad_element); + PyList_SET_ITEM(__pyx_t_4, __pyx_temp, __pyx_v_pad_element); } } + __pyx_v_delta_list = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":166 - * while lhs.size() < rhs.size(): - * lhs.push_back(pad_element) - * while rhs.size() < lhs.size(): # <<<<<<<<<<<<<< - * rhs.push_back(pad_element) - * + /* "src/ktlib.pyx":154 + * cdef int delta_size = abs(len(lhs) - len(rhs)) + * cdef list delta_list = [ pad_element ] * delta_size + * if len(lhs) < len(rhs): # <<<<<<<<<<<<<< + * lhs.extend(delta_list) + * else: */ - while (1) { - __pyx_t_1 = ((__pyx_v_rhs.size() < __pyx_v_lhs.size()) != 0); - if (!__pyx_t_1) break; + if (unlikely(__pyx_v_lhs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 154, __pyx_L1_error) + } + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_lhs); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 154, __pyx_L1_error) + if (unlikely(__pyx_v_rhs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 154, __pyx_L1_error) + } + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_rhs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_6 = ((__pyx_t_2 < __pyx_t_1) != 0); + if (__pyx_t_6) { - /* "ktlib.pyx":167 - * lhs.push_back(pad_element) - * while rhs.size() < lhs.size(): - * rhs.push_back(pad_element) # <<<<<<<<<<<<<< - * + /* "src/ktlib.pyx":155 + * cdef list delta_list = [ pad_element ] * delta_size + * if len(lhs) < len(rhs): + * lhs.extend(delta_list) # <<<<<<<<<<<<<< + * else: + * rhs.extend(delta_list) + */ + if (unlikely(__pyx_v_lhs == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 155, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_lhs, __pyx_v_delta_list); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 155, __pyx_L1_error) + + /* "src/ktlib.pyx":154 + * cdef int delta_size = abs(len(lhs) - len(rhs)) + * cdef list delta_list = [ pad_element ] * delta_size + * if len(lhs) < len(rhs): # <<<<<<<<<<<<<< + * lhs.extend(delta_list) + * else: + */ + goto __pyx_L3; + } + + /* "src/ktlib.pyx":157 + * lhs.extend(delta_list) + * else: + * rhs.extend(delta_list) # <<<<<<<<<<<<<< * + * # -------------- Core functions/classes ---------------- */ - try { - __pyx_v_rhs.push_back(__pyx_v_pad_element); - } catch(...) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_CppExn2PyErr(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 167, __pyx_L1_error) + /*else*/ { + if (unlikely(__pyx_v_rhs == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 157, __pyx_L1_error) } + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_rhs, __pyx_v_delta_list); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 157, __pyx_L1_error) } + __pyx_L3:; - /* "ktlib.pyx":154 + /* "src/ktlib.pyx":142 * return ret * * cdef void make_list_equal( # <<<<<<<<<<<<<< - * vector[string]& lhs, - * vector[string]& rhs, + * list lhs, + * list rhs, */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("ktlib.make_list_equal", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.make_list_equal", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; + __Pyx_XDECREF(__pyx_v_delta_list); + __Pyx_RefNannyFinishContext(); } -/* "ktlib.pyx":176 +/* "src/ktlib.pyx":169 * Handle loading up .kattisrc config file * ''' * def __cinit__(self): # <<<<<<<<<<<<<< - * self.config_path = os.path.join(os.getenv('HOME'), '.kattisrc') # kattis config file - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file + * self.config_path = Path.home() / '.kattisrc' # kattis config file + * self.kt_config = Path.home() / '.ktconfig' # kt tool file */ /* Python wrapper */ -static int __pyx_pw_5ktlib_6Action_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5ktlib_6Action_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_3src_5ktlib_6Action_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3src_5ktlib_6Action_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - __pyx_r = __pyx_pf_5ktlib_6Action___cinit__(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_6Action___cinit__(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5ktlib_6Action___cinit__(struct __pyx_obj_5ktlib_Action *__pyx_v_self) { +static int __pyx_pf_3src_5ktlib_6Action___cinit__(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - std::string __pyx_t_7; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "ktlib.pyx":177 + /* "src/ktlib.pyx":170 * ''' * def __cinit__(self): - * self.config_path = os.path.join(os.getenv('HOME'), '.kattisrc') # kattis config file # <<<<<<<<<<<<<< - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file - * + * self.config_path = Path.home() / '.kattisrc' # kattis config file # <<<<<<<<<<<<<< + * self.kt_config = Path.home() / '.ktconfig' # kt tool file + * self.cfg = None */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_home); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getenv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_n_u_HOME) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_HOME); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_kp_u_kattisrc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->config_path); + __Pyx_DECREF(__pyx_v_self->config_path); + __pyx_v_self->config_path = __pyx_t_3; + __pyx_t_3 = 0; + + /* "src/ktlib.pyx":171 + * def __cinit__(self): + * self.config_path = Path.home() / '.kattisrc' # kattis config file + * self.kt_config = Path.home() / '.ktconfig' # kt tool file # <<<<<<<<<<<<<< + * self.cfg = None + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_home); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_kp_u_kattisrc}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_kp_u_kattisrc}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_t_3); - __Pyx_INCREF(__pyx_kp_u_kattisrc); - __Pyx_GIVEREF(__pyx_kp_u_kattisrc); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_kp_u_kattisrc); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->config_path = __pyx_t_7; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_kp_u_ktconfig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->kt_config); + __Pyx_DECREF(__pyx_v_self->kt_config); + __pyx_v_self->kt_config = __pyx_t_2; + __pyx_t_2 = 0; - /* "ktlib.pyx":178 - * def __cinit__(self): - * self.config_path = os.path.join(os.getenv('HOME'), '.kattisrc') # kattis config file - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":172 + * self.config_path = Path.home() / '.kattisrc' # kattis config file + * self.kt_config = Path.home() / '.ktconfig' # kt tool file + * self.cfg = None # <<<<<<<<<<<<<< * - * cdef string get_url(self, const string& option, string default = b''): + * cdef str get_url(self, str option, str default = '') : */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_getenv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_n_u_HOME) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_HOME); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_kp_u_ktconfig}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_kp_u_ktconfig}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_4); - __Pyx_INCREF(__pyx_kp_u_ktconfig); - __Pyx_GIVEREF(__pyx_kp_u_ktconfig); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_kp_u_ktconfig); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->kt_config = __pyx_t_7; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = Py_None; - /* "ktlib.pyx":176 + /* "src/ktlib.pyx":169 * Handle loading up .kattisrc config file * ''' * def __cinit__(self): # <<<<<<<<<<<<<< - * self.config_path = os.path.join(os.getenv('HOME'), '.kattisrc') # kattis config file - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file + * self.config_path = Path.home() / '.kattisrc' # kattis config file + * self.kt_config = Path.home() / '.ktconfig' # kt tool file */ /* function exit code */ @@ -3951,38 +3989,34 @@ static int __pyx_pf_5ktlib_6Action___cinit__(struct __pyx_obj_5ktlib_Action *__p __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("ktlib.Action.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Action.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":180 - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file +/* "src/ktlib.pyx":174 + * self.cfg = None * - * cdef string get_url(self, const string& option, string default = b''): # <<<<<<<<<<<<<< + * cdef str get_url(self, str option, str default = '') : # <<<<<<<<<<<<<< * ''' Get appropriate urls from kattisrc file * Args: */ -static std::string __pyx_f_5ktlib_6Action_get_url(struct __pyx_obj_5ktlib_Action *__pyx_v_self, std::string const &__pyx_v_option, struct __pyx_opt_args_5ktlib_6Action_get_url *__pyx_optional_args) { - std::string __pyx_v_default = __pyx_k__4; - std::string __pyx_v_kattis_host; - std::string __pyx_r; +static PyObject *__pyx_f_3src_5ktlib_6Action_get_url(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self, PyObject *__pyx_v_option, struct __pyx_opt_args_3src_5ktlib_6Action_get_url *__pyx_optional_args) { + PyObject *__pyx_v_default = ((PyObject*)__pyx_kp_u_); + PyObject *__pyx_v_kattis_host = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - std::string __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_UCS4 __pyx_t_10; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_UCS4 __pyx_t_8; __Pyx_RefNannySetupContext("get_url", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { @@ -3990,203 +4024,194 @@ static std::string __pyx_f_5ktlib_6Action_get_url(struct __pyx_obj_5ktlib_Action } } - /* "ktlib.pyx":190 - * cdef: - * string kattis_host + /* "src/ktlib.pyx":183 + * ''' + * cdef str kattis_host * if self.cfg.has_option('kattis', option): # <<<<<<<<<<<<<< * return self.cfg.get('kattis', option) - * else: + * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_has_option); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_has_option); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_option); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; + __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_5 = 1; + __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_u_kattis, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_kattis, __pyx_v_option}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_u_kattis, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_kattis, __pyx_v_option}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_n_u_kattis); __Pyx_GIVEREF(__pyx_n_u_kattis); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_n_u_kattis); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_kattis); + __Pyx_INCREF(__pyx_v_option); + __Pyx_GIVEREF(__pyx_v_option); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_option); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { - /* "ktlib.pyx":191 - * string kattis_host + /* "src/ktlib.pyx":184 + * cdef str kattis_host * if self.cfg.has_option('kattis', option): * return self.cfg.get('kattis', option) # <<<<<<<<<<<<<< - * else: - * kattis_host = self.cfg.get('kattis', 'hostname') + * + * kattis_host = self.cfg.get('kattis', 'hostname') */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_option); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = NULL; - __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_5 = 1; + __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_kattis, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_u_kattis, __pyx_v_option}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_kattis, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_u_kattis, __pyx_v_option}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_n_u_kattis); __Pyx_GIVEREF(__pyx_n_u_kattis); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_n_u_kattis); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_n_u_kattis); + __Pyx_INCREF(__pyx_v_option); + __Pyx_GIVEREF(__pyx_v_option); + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_option); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_8; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; - /* "ktlib.pyx":190 - * cdef: - * string kattis_host + /* "src/ktlib.pyx":183 + * ''' + * cdef str kattis_host * if self.cfg.has_option('kattis', option): # <<<<<<<<<<<<<< * return self.cfg.get('kattis', option) - * else: + * */ } - /* "ktlib.pyx":193 + /* "src/ktlib.pyx":186 * return self.cfg.get('kattis', option) - * else: - * kattis_host = self.cfg.get('kattis', 'hostname') # <<<<<<<<<<<<<< - * return f'https://{kattis_host}/{default}' + * + * kattis_host = self.cfg.get('kattis', 'hostname') # <<<<<<<<<<<<<< + * return f'https://{kattis_host}/{default}' * */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_kattis_host = __pyx_t_8; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_v_kattis_host = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "ktlib.pyx":194 - * else: - * kattis_host = self.cfg.get('kattis', 'hostname') - * return f'https://{kattis_host}/{default}' # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":187 + * + * kattis_host = self.cfg.get('kattis', 'hostname') + * return f'https://{kattis_host}/{default}' # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_https); - __pyx_t_9 += 8; - __Pyx_GIVEREF(__pyx_kp_u_https); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_https); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_kattis_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_10; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_9 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__6); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_10; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_8; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = 0; + __pyx_t_8 = 127; + __Pyx_INCREF(__pyx_kp_u_https); + __pyx_t_7 += 8; + __Pyx_GIVEREF(__pyx_kp_u_https); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_https); + __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_kattis_host); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_8; + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_kp_u__4); + __pyx_t_7 += 1; + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__4); + __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_8; + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; - /* "ktlib.pyx":180 - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file + /* "src/ktlib.pyx":174 + * self.cfg = None * - * cdef string get_url(self, const string& option, string default = b''): # <<<<<<<<<<<<<< + * cdef str get_url(self, str option, str default = '') : # <<<<<<<<<<<<<< * ''' Get appropriate urls from kattisrc file * Args: */ @@ -4196,36 +4221,36 @@ static std::string __pyx_f_5ktlib_6Action_get_url(struct __pyx_obj_5ktlib_Action __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("ktlib.Action.get_url", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __Pyx_pretend_to_initialize(&__pyx_r); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("src.ktlib.Action.get_url", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_kattis_host); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":197 +/* "src/ktlib.pyx":190 * * - * cdef read_config_from_file(self): # <<<<<<<<<<<<<< + * cdef void read_config_from_file(self) except *: # <<<<<<<<<<<<<< * ''' kttool deals with 2 config files: * - kattisrc: provided by official kattis website, provide domain name and general urls */ -static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5ktlib_Action *__pyx_v_self) { +static void __pyx_f_3src_5ktlib_6Action_read_config_from_file(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_username = NULL; + PyObject *__pyx_v_username = 0; PyObject *__pyx_v_password = NULL; PyObject *__pyx_v_token = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; int __pyx_t_5; - int __pyx_t_6; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; @@ -4236,90 +4261,78 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 PyObject *__pyx_t_14 = NULL; int __pyx_t_15; int __pyx_t_16; - std::string __pyx_t_17; __Pyx_RefNannySetupContext("read_config_from_file", 0); - /* "ktlib.pyx":203 + /* "src/ktlib.pyx":196 * ''' * # Initialize ktconfig file if file doesnt exist - * if not os.path.exists(self.kt_config): # <<<<<<<<<<<<<< + * if not self.kt_config.is_file(): # <<<<<<<<<<<<<< * with open(self.kt_config, 'w') as f: * f.write('{}\n') */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->kt_config, __pyx_n_s_is_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->kt_config); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; + __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = ((!__pyx_t_5) != 0); - if (__pyx_t_6) { + __pyx_t_5 = ((!__pyx_t_4) != 0); + if (__pyx_t_5) { - /* "ktlib.pyx":204 + /* "src/ktlib.pyx":197 * # Initialize ktconfig file if file doesnt exist - * if not os.path.exists(self.kt_config): + * if not self.kt_config.is_file(): * with open(self.kt_config, 'w') as f: # <<<<<<<<<<<<<< * f.write('{}\n') * */ /*with:*/ { - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_v_self->kt_config); + __Pyx_GIVEREF(__pyx_v_self->kt_config); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->kt_config); __Pyx_INCREF(__pyx_n_u_w); __Pyx_GIVEREF(__pyx_n_u_w); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_w); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L4_error) + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_w); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; + __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_PyThreadState_declare @@ -4332,35 +4345,35 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 __pyx_v_f = __pyx_t_3; __pyx_t_3 = 0; - /* "ktlib.pyx":205 - * if not os.path.exists(self.kt_config): + /* "src/ktlib.pyx":198 + * if not self.kt_config.is_file(): * with open(self.kt_config, 'w') as f: * f.write('{}\n') # <<<<<<<<<<<<<< * * self.cfg = configparser.ConfigParser() */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L8_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_kp_u__7) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u__7); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L8_error) + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_u__5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":204 + /* "src/ktlib.pyx":197 * # Initialize ktconfig file if file doesnt exist - * if not os.path.exists(self.kt_config): + * if not self.kt_config.is_file(): * with open(self.kt_config, 'w') as f: # <<<<<<<<<<<<<< * f.write('{}\n') * @@ -4374,35 +4387,35 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Action.read_config_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L10_except_error) + __Pyx_AddTraceback("src.ktlib.Action.read_config_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 197, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L10_except_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L10_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 204, __pyx_L10_except_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 197, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_6 < 0) __PYX_ERR(0, 204, __pyx_L10_except_error) - __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_5) { + if (__pyx_t_5 < 0) __PYX_ERR(0, 197, __pyx_L10_except_error) + __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_2); - __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 204, __pyx_L10_except_error) + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 197, __pyx_L10_except_error) } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L9_exception_handled; } __pyx_L10_except_error:; @@ -4421,10 +4434,10 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_7) { - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 204, __pyx_L1_error) + if (__pyx_t_6) { + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -4434,206 +4447,172 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 } goto __pyx_L17; __pyx_L4_error:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L1_error; __pyx_L17:; } - /* "ktlib.pyx":203 + /* "src/ktlib.pyx":196 * ''' * # Initialize ktconfig file if file doesnt exist - * if not os.path.exists(self.kt_config): # <<<<<<<<<<<<<< + * if not self.kt_config.is_file(): # <<<<<<<<<<<<<< * with open(self.kt_config, 'w') as f: * f.write('{}\n') */ } - /* "ktlib.pyx":207 + /* "src/ktlib.pyx":200 * f.write('{}\n') * * self.cfg = configparser.ConfigParser() # <<<<<<<<<<<<<< - * if not os.path.exists(self.config_path): + * if not self.config_path.is_file(): * raise RuntimeError(f'No valid config file at {self.config_path}. ' */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_configparser); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ConfigParser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_configparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ConfigParser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_1)) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->cfg); __Pyx_DECREF(__pyx_v_self->cfg); - __pyx_v_self->cfg = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_self->cfg = __pyx_t_1; + __pyx_t_1 = 0; - /* "ktlib.pyx":208 + /* "src/ktlib.pyx":201 * * self.cfg = configparser.ConfigParser() - * if not os.path.exists(self.config_path): # <<<<<<<<<<<<<< + * if not self.config_path.is_file(): # <<<<<<<<<<<<<< * raise RuntimeError(f'No valid config file at {self.config_path}. ' * f'Please download it at {_KATTIS_RC_URL}') */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->config_path, __pyx_n_s_is_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->config_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; + __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = ((!__pyx_t_5) != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((!__pyx_t_4) != 0); + if (unlikely(__pyx_t_5)) { - /* "ktlib.pyx":209 + /* "src/ktlib.pyx":202 * self.cfg = configparser.ConfigParser() - * if not os.path.exists(self.config_path): + * if not self.config_path.is_file(): * raise RuntimeError(f'No valid config file at {self.config_path}. ' # <<<<<<<<<<<<<< * f'Please download it at {_KATTIS_RC_URL}') * */ - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = 0; __pyx_t_13 = 127; __Pyx_INCREF(__pyx_kp_u_No_valid_config_file_at); __pyx_t_12 += 24; __Pyx_GIVEREF(__pyx_kp_u_No_valid_config_file_at); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_No_valid_config_file_at); - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->config_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13; - __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_kp_u_Please_download_it_at); - __pyx_t_12 += 24; - __Pyx_GIVEREF(__pyx_kp_u_Please_download_it_at); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_Please_download_it_at); - - /* "ktlib.pyx":210 - * if not os.path.exists(self.config_path): - * raise RuntimeError(f'No valid config file at {self.config_path}. ' - * f'Please download it at {_KATTIS_RC_URL}') # <<<<<<<<<<<<<< - * - * self.cfg.read(self.config_path) - */ - __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_5ktlib__KATTIS_RC_URL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_No_valid_config_file_at); + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_self->config_path, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13; __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __pyx_t_3 = 0; - - /* "ktlib.pyx":209 - * self.cfg = configparser.ConfigParser() - * if not os.path.exists(self.config_path): - * raise RuntimeError(f'No valid config file at {self.config_path}. ' # <<<<<<<<<<<<<< - * f'Please download it at {_KATTIS_RC_URL}') - * - */ - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_INCREF(__pyx_kp_u_Please_download_it_at_https_ope); + __pyx_t_12 += 65; + __Pyx_GIVEREF(__pyx_kp_u_Please_download_it_at_https_ope); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_Please_download_it_at_https_ope); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 202, __pyx_L1_error) - /* "ktlib.pyx":208 + /* "src/ktlib.pyx":201 * * self.cfg = configparser.ConfigParser() - * if not os.path.exists(self.config_path): # <<<<<<<<<<<<<< + * if not self.config_path.is_file(): # <<<<<<<<<<<<<< * raise RuntimeError(f'No valid config file at {self.config_path}. ' * f'Please download it at {_KATTIS_RC_URL}') */ } - /* "ktlib.pyx":212 + /* "src/ktlib.pyx":205 * f'Please download it at {_KATTIS_RC_URL}') * * self.cfg.read(self.config_path) # <<<<<<<<<<<<<< - * username = self.cfg.get('user', 'username') + * cdef str username = self.cfg.get('user', 'username') * password = token = None */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->config_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; + __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_self->config_path) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->config_path); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":213 + /* "src/ktlib.pyx":206 * * self.cfg.read(self.config_path) - * username = self.cfg.get('user', 'username') # <<<<<<<<<<<<<< + * cdef str username = self.cfg.get('user', 'username') # <<<<<<<<<<<<<< * password = token = None * try: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_username = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_v_username = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":214 + /* "src/ktlib.pyx":207 * self.cfg.read(self.config_path) - * username = self.cfg.get('user', 'username') + * cdef str username = self.cfg.get('user', 'username') * password = token = None # <<<<<<<<<<<<<< * try: * password = self.cfg.get('user', 'password') @@ -4643,8 +4622,8 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 __Pyx_INCREF(Py_None); __pyx_v_token = Py_None; - /* "ktlib.pyx":215 - * username = self.cfg.get('user', 'username') + /* "src/ktlib.pyx":208 + * cdef str username = self.cfg.get('user', 'username') * password = token = None * try: # <<<<<<<<<<<<<< * password = self.cfg.get('user', 'password') @@ -4653,36 +4632,36 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_10, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_10, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - /* "ktlib.pyx":216 + /* "src/ktlib.pyx":209 * password = token = None * try: * password = self.cfg.get('user', 'password') # <<<<<<<<<<<<<< * except configparser.NoOptionError: * pass */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L19_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L19_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L19_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_password, __pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_password, __pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":215 - * username = self.cfg.get('user', 'username') + /* "src/ktlib.pyx":208 + * cdef str username = self.cfg.get('user', 'username') * password = token = None * try: # <<<<<<<<<<<<<< * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: */ } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L24_try_end; @@ -4690,25 +4669,25 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "ktlib.pyx":217 + /* "src/ktlib.pyx":210 * try: * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: # <<<<<<<<<<<<<< * pass * try: */ - __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_configparser); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L21_except_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L21_except_error) + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_configparser); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __pyx_L21_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 210, __pyx_L21_except_error) __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_14); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_3, __pyx_t_1); - __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_2); + __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; if (__pyx_t_15) { __Pyx_ErrRestore(0,0,0); goto __pyx_L20_exception_handled; @@ -4716,27 +4695,27 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 goto __pyx_L21_except_error; __pyx_L21_except_error:; - /* "ktlib.pyx":215 - * username = self.cfg.get('user', 'username') + /* "src/ktlib.pyx":208 + * cdef str username = self.cfg.get('user', 'username') * password = token = None * try: # <<<<<<<<<<<<<< * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: */ - __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_10, __pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_10, __pyx_t_9); goto __pyx_L1_error; __pyx_L20_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_10, __pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_10, __pyx_t_9); __pyx_L24_try_end:; } - /* "ktlib.pyx":219 + /* "src/ktlib.pyx":212 * except configparser.NoOptionError: * pass * try: # <<<<<<<<<<<<<< @@ -4746,28 +4725,28 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_7); + __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { - /* "ktlib.pyx":220 + /* "src/ktlib.pyx":213 * pass * try: * token = self.cfg.get('user', 'token') # <<<<<<<<<<<<<< * except configparser.NoOptionError: * pass */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L25_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L25_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L25_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":219 + /* "src/ktlib.pyx":212 * except configparser.NoOptionError: * pass * try: # <<<<<<<<<<<<<< @@ -4777,32 +4756,32 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 } __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L30_try_end; __pyx_L25_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "ktlib.pyx":221 + /* "src/ktlib.pyx":214 * try: * token = self.cfg.get('user', 'token') * except configparser.NoOptionError: # <<<<<<<<<<<<<< * pass * if password is None and token is None: */ - __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_configparser); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 221, __pyx_L27_except_error) + __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_configparser); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 214, __pyx_L27_except_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L27_except_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L27_except_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_2); - __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; + __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; if (__pyx_t_15) { __Pyx_ErrRestore(0,0,0); goto __pyx_L26_exception_handled; @@ -4810,7 +4789,7 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 goto __pyx_L27_except_error; __pyx_L27_except_error:; - /* "ktlib.pyx":219 + /* "src/ktlib.pyx":212 * except configparser.NoOptionError: * pass * try: # <<<<<<<<<<<<<< @@ -4819,51 +4798,51 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 */ __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_6); goto __pyx_L1_error; __pyx_L26_exception_handled:; __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_6); __pyx_L30_try_end:; } - /* "ktlib.pyx":223 + /* "src/ktlib.pyx":216 * except configparser.NoOptionError: * pass * if password is None and token is None: # <<<<<<<<<<<<<< * raise ConfigError('''\ * Your .kattisrc file appears corrupted. It must provide a token (or a */ - __pyx_t_5 = (__pyx_v_password == Py_None); - __pyx_t_16 = (__pyx_t_5 != 0); + __pyx_t_4 = (__pyx_v_password == Py_None); + __pyx_t_16 = (__pyx_t_4 != 0); if (__pyx_t_16) { } else { - __pyx_t_6 = __pyx_t_16; + __pyx_t_5 = __pyx_t_16; goto __pyx_L32_bool_binop_done; } __pyx_t_16 = (__pyx_v_token == Py_None); - __pyx_t_5 = (__pyx_t_16 != 0); - __pyx_t_6 = __pyx_t_5; + __pyx_t_4 = (__pyx_t_16 != 0); + __pyx_t_5 = __pyx_t_4; __pyx_L32_bool_binop_done:; - if (unlikely(__pyx_t_6)) { + if (unlikely(__pyx_t_5)) { - /* "ktlib.pyx":224 + /* "src/ktlib.pyx":217 * pass * if password is None and token is None: * raise ConfigError('''\ # <<<<<<<<<<<<<< * Your .kattisrc file appears corrupted. It must provide a token (or a * KATTIS password). */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5ktlib_ConfigError), __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_3src_5ktlib_ConfigError), __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 217, __pyx_L1_error) - /* "ktlib.pyx":223 + /* "src/ktlib.pyx":216 * except configparser.NoOptionError: * pass * if password is None and token is None: # <<<<<<<<<<<<<< @@ -4872,70 +4851,67 @@ static PyObject *__pyx_f_5ktlib_6Action_read_config_from_file(struct __pyx_obj_5 */ } - /* "ktlib.pyx":228 + /* "src/ktlib.pyx":221 * KATTIS password). * Please download a new .kattisrc file''') * print(f'Username: {color_green(username)}') # <<<<<<<<<<<<<< * * */ - __pyx_t_17 = __pyx_convert_string_from_py_std__in_string(__pyx_v_username); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_t_17, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_color_green(__pyx_v_username, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Username, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Username, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":197 + /* "src/ktlib.pyx":190 * * - * cdef read_config_from_file(self): # <<<<<<<<<<<<<< + * cdef void read_config_from_file(self) except *: # <<<<<<<<<<<<<< * ''' kttool deals with 2 config files: * - kattisrc: provided by official kattis website, provide domain name and general urls */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("ktlib.Action.read_config_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("src.ktlib.Action.read_config_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); __Pyx_XDECREF(__pyx_v_username); __Pyx_XDECREF(__pyx_v_password); __Pyx_XDECREF(__pyx_v_token); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":231 +/* "src/ktlib.pyx":224 * * - * cdef login(self): # <<<<<<<<<<<<<< + * cdef void login(self) except *: # <<<<<<<<<<<<<< * ''' Try to login and obtain cookies from succesful signin * ''' */ -static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__pyx_v_self) { - std::string __pyx_v_login_url; - std::string __pyx_v_err; - PyObject *__pyx_v_username = NULL; - PyObject *__pyx_v_password = NULL; +static void __pyx_f_3src_5ktlib_6Action_login(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { + PyObject *__pyx_v_login_url = 0; + PyObject *__pyx_v_err = 0; + PyObject *__pyx_v_username = 0; + PyObject *__pyx_v_password = 0; PyObject *__pyx_v_token = NULL; PyObject *__pyx_v_login_args = NULL; PyObject *__pyx_v_login_reply = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -4946,43 +4922,42 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; - std::string __pyx_t_10; - std::string __pyx_t_11; - struct __pyx_opt_args_5ktlib_6Action_get_url __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; + struct __pyx_opt_args_3src_5ktlib_6Action_get_url __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; __Pyx_RefNannySetupContext("login", 0); - /* "ktlib.pyx":237 - * string login_url - * string err + /* "src/ktlib.pyx":233 + * str password + * * username = self.cfg.get('user', 'username') # <<<<<<<<<<<<<< - * password = token = None + * password = token = '' * try: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_username = __pyx_t_2; + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_v_username = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":238 - * string err + /* "src/ktlib.pyx":234 + * * username = self.cfg.get('user', 'username') - * password = token = None # <<<<<<<<<<<<<< + * password = token = '' # <<<<<<<<<<<<<< * try: * password = self.cfg.get('user', 'password') */ - __Pyx_INCREF(Py_None); - __pyx_v_password = Py_None; - __Pyx_INCREF(Py_None); - __pyx_v_token = Py_None; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_v_password = __pyx_kp_u_; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_v_token = __pyx_kp_u_; - /* "ktlib.pyx":239 + /* "src/ktlib.pyx":235 * username = self.cfg.get('user', 'username') - * password = token = None + * password = token = '' * try: # <<<<<<<<<<<<<< * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: @@ -4996,24 +4971,25 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "ktlib.pyx":240 - * password = token = None + /* "src/ktlib.pyx":236 + * password = token = '' * try: * password = self.cfg.get('user', 'password') # <<<<<<<<<<<<<< * except configparser.NoOptionError: * pass */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_password, __pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 236, __pyx_L3_error) + __Pyx_DECREF_SET(__pyx_v_password, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "ktlib.pyx":239 + /* "src/ktlib.pyx":235 * username = self.cfg.get('user', 'username') - * password = token = None + * password = token = '' * try: # <<<<<<<<<<<<<< * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: @@ -5027,7 +5003,7 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":241 + /* "src/ktlib.pyx":237 * try: * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: # <<<<<<<<<<<<<< @@ -5035,9 +5011,9 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ * try: */ __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_configparser); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_configparser); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 237, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 241, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 237, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); @@ -5051,9 +5027,9 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "ktlib.pyx":239 + /* "src/ktlib.pyx":235 * username = self.cfg.get('user', 'username') - * password = token = None + * password = token = '' * try: # <<<<<<<<<<<<<< * password = self.cfg.get('user', 'password') * except configparser.NoOptionError: @@ -5071,7 +5047,7 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __pyx_L8_try_end:; } - /* "ktlib.pyx":243 + /* "src/ktlib.pyx":239 * except configparser.NoOptionError: * pass * try: # <<<<<<<<<<<<<< @@ -5087,22 +5063,22 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "ktlib.pyx":244 + /* "src/ktlib.pyx":240 * pass * try: * token = self.cfg.get('user', 'token') # <<<<<<<<<<<<<< * except configparser.NoOptionError: * pass */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L9_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L9_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":243 + /* "src/ktlib.pyx":239 * except configparser.NoOptionError: * pass * try: # <<<<<<<<<<<<<< @@ -5121,17 +5097,17 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "ktlib.pyx":245 + /* "src/ktlib.pyx":241 * try: * token = self.cfg.get('user', 'token') * except configparser.NoOptionError: # <<<<<<<<<<<<<< * pass - * login_url = self.get_url(b'loginurl', b'login') + * login_url = self.get_url('loginurl', 'login') */ __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_6, &__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_configparser); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 245, __pyx_L11_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_configparser); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 241, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L11_except_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_NoOptionError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_7); @@ -5145,7 +5121,7 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ goto __pyx_L11_except_error; __pyx_L11_except_error:; - /* "ktlib.pyx":243 + /* "src/ktlib.pyx":239 * except configparser.NoOptionError: * pass * try: # <<<<<<<<<<<<<< @@ -5165,54 +5141,55 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __pyx_L14_try_end:; } - /* "ktlib.pyx":247 + /* "src/ktlib.pyx":243 * except configparser.NoOptionError: * pass - * login_url = self.get_url(b'loginurl', b'login') # <<<<<<<<<<<<<< + * login_url = self.get_url('loginurl', 'login') # <<<<<<<<<<<<<< * login_args = {'user': username, 'script': 'true'} * if password: */ - __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_login); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) - __pyx_t_12.__pyx_n = 1; - __pyx_t_12.__pyx_default = __pyx_t_10; - __pyx_t_11 = ((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->get_url(__pyx_v_self, __pyx_k_loginurl, &__pyx_t_12); - __pyx_v_login_url = __pyx_t_11; + __pyx_t_10.__pyx_n = 1; + __pyx_t_10.__pyx_default = __pyx_n_u_login; + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->get_url(__pyx_v_self, __pyx_n_u_loginurl, &__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_login_url = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":248 + /* "src/ktlib.pyx":244 * pass - * login_url = self.get_url(b'loginurl', b'login') + * login_url = self.get_url('loginurl', 'login') * login_args = {'user': username, 'script': 'true'} # <<<<<<<<<<<<<< * if password: * login_args['password'] = password */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_user, __pyx_v_username) < 0) __PYX_ERR(0, 248, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_script, __pyx_n_u_true) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_user, __pyx_v_username) < 0) __PYX_ERR(0, 244, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_script, __pyx_n_u_true) < 0) __PYX_ERR(0, 244, __pyx_L1_error) __pyx_v_login_args = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":249 - * login_url = self.get_url(b'loginurl', b'login') + /* "src/ktlib.pyx":245 + * login_url = self.get_url('loginurl', 'login') * login_args = {'user': username, 'script': 'true'} * if password: # <<<<<<<<<<<<<< * login_args['password'] = password * if token: */ - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_password); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 249, __pyx_L1_error) - if (__pyx_t_13) { + __pyx_t_11 = (__pyx_v_password != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_password) != 0); + if (__pyx_t_11) { - /* "ktlib.pyx":250 + /* "src/ktlib.pyx":246 * login_args = {'user': username, 'script': 'true'} * if password: * login_args['password'] = password # <<<<<<<<<<<<<< * if token: * login_args['token'] = token */ - if (unlikely(PyDict_SetItem(__pyx_v_login_args, __pyx_n_u_password, __pyx_v_password) < 0)) __PYX_ERR(0, 250, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_login_args, __pyx_n_u_password, __pyx_v_password) < 0)) __PYX_ERR(0, 246, __pyx_L1_error) - /* "ktlib.pyx":249 - * login_url = self.get_url(b'loginurl', b'login') + /* "src/ktlib.pyx":245 + * login_url = self.get_url('loginurl', 'login') * login_args = {'user': username, 'script': 'true'} * if password: # <<<<<<<<<<<<<< * login_args['password'] = password @@ -5220,26 +5197,26 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ */ } - /* "ktlib.pyx":251 + /* "src/ktlib.pyx":247 * if password: * login_args['password'] = password * if token: # <<<<<<<<<<<<<< * login_args['token'] = token * login_reply = requests.post(login_url, data=login_args, headers=_HEADERS) */ - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_token); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) - if (__pyx_t_13) { + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_token); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 247, __pyx_L1_error) + if (__pyx_t_11) { - /* "ktlib.pyx":252 + /* "src/ktlib.pyx":248 * login_args['password'] = password * if token: * login_args['token'] = token # <<<<<<<<<<<<<< * login_reply = requests.post(login_url, data=login_args, headers=_HEADERS) * */ - if (unlikely(PyDict_SetItem(__pyx_v_login_args, __pyx_n_u_token, __pyx_v_token) < 0)) __PYX_ERR(0, 252, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_login_args, __pyx_n_u_token, __pyx_v_token) < 0)) __PYX_ERR(0, 248, __pyx_L1_error) - /* "ktlib.pyx":251 + /* "src/ktlib.pyx":247 * if password: * login_args['password'] = password * if token: # <<<<<<<<<<<<<< @@ -5248,201 +5225,194 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ */ } - /* "ktlib.pyx":253 + /* "src/ktlib.pyx":249 * if token: * login_args['token'] = token * login_reply = requests.post(login_url, data=login_args, headers=_HEADERS) # <<<<<<<<<<<<<< * * if not login_reply.status_code == 200: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_requests); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_requests); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_post); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_post); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_login_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_INCREF(__pyx_v_login_url); + __Pyx_GIVEREF(__pyx_v_login_url); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_login_url); + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_login_args) < 0) __PYX_ERR(0, 253, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_headers, __pyx_v_5ktlib__HEADERS) < 0) __PYX_ERR(0, 253, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_v_login_args) < 0) __PYX_ERR(0, 249, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_headers, __pyx_v_3src_5ktlib__HEADERS) < 0) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_login_reply = __pyx_t_7; __pyx_t_7 = 0; - /* "ktlib.pyx":255 + /* "src/ktlib.pyx":251 * login_reply = requests.post(login_url, data=login_args, headers=_HEADERS) * * if not login_reply.status_code == 200: # <<<<<<<<<<<<<< * if login_reply.status_code == 403: - * err = b'Incorrect username or password/token (403)' + * err = 'Incorrect username or password/token (403)' */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_200, 0xC8, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_200, 0xC8, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = ((!__pyx_t_13) != 0); - if (__pyx_t_14) { + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_12 = ((!__pyx_t_11) != 0); + if (__pyx_t_12) { - /* "ktlib.pyx":256 + /* "src/ktlib.pyx":252 * * if not login_reply.status_code == 200: * if login_reply.status_code == 403: # <<<<<<<<<<<<<< - * err = b'Incorrect username or password/token (403)' + * err = 'Incorrect username or password/token (403)' * elif login_reply.status_code == 404: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_403, 0x193, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_403, 0x193, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_14) { + if (__pyx_t_12) { - /* "ktlib.pyx":257 + /* "src/ktlib.pyx":253 * if not login_reply.status_code == 200: * if login_reply.status_code == 403: - * err = b'Incorrect username or password/token (403)' # <<<<<<<<<<<<<< + * err = 'Incorrect username or password/token (403)' # <<<<<<<<<<<<<< * elif login_reply.status_code == 404: - * err = b'Incorrect login URL (404)' + * err = 'Incorrect login URL (404)' */ - __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Incorrect_username_or_password_t); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) - __pyx_v_err = __pyx_t_11; + __Pyx_INCREF(__pyx_kp_u_Incorrect_username_or_password_t); + __pyx_v_err = __pyx_kp_u_Incorrect_username_or_password_t; - /* "ktlib.pyx":256 + /* "src/ktlib.pyx":252 * * if not login_reply.status_code == 200: * if login_reply.status_code == 403: # <<<<<<<<<<<<<< - * err = b'Incorrect username or password/token (403)' + * err = 'Incorrect username or password/token (403)' * elif login_reply.status_code == 404: */ goto __pyx_L18; } - /* "ktlib.pyx":258 + /* "src/ktlib.pyx":254 * if login_reply.status_code == 403: - * err = b'Incorrect username or password/token (403)' + * err = 'Incorrect username or password/token (403)' * elif login_reply.status_code == 404: # <<<<<<<<<<<<<< - * err = b'Incorrect login URL (404)' + * err = 'Incorrect login URL (404)' * else: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_404, 0x194, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_404, 0x194, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_14) { + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_12) { - /* "ktlib.pyx":259 - * err = b'Incorrect username or password/token (403)' + /* "src/ktlib.pyx":255 + * err = 'Incorrect username or password/token (403)' * elif login_reply.status_code == 404: - * err = b'Incorrect login URL (404)' # <<<<<<<<<<<<<< + * err = 'Incorrect login URL (404)' # <<<<<<<<<<<<<< * else: * err = f'Status code: {login_reply.status_code}' */ - __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Incorrect_login_URL_404); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error) - __pyx_v_err = __pyx_t_11; + __Pyx_INCREF(__pyx_kp_u_Incorrect_login_URL_404); + __pyx_v_err = __pyx_kp_u_Incorrect_login_URL_404; - /* "ktlib.pyx":258 + /* "src/ktlib.pyx":254 * if login_reply.status_code == 403: - * err = b'Incorrect username or password/token (403)' + * err = 'Incorrect username or password/token (403)' * elif login_reply.status_code == 404: # <<<<<<<<<<<<<< - * err = b'Incorrect login URL (404)' + * err = 'Incorrect login URL (404)' * else: */ goto __pyx_L18; } - /* "ktlib.pyx":261 - * err = b'Incorrect login URL (404)' + /* "src/ktlib.pyx":257 + * err = 'Incorrect login URL (404)' * else: * err = f'Status code: {login_reply.status_code}' # <<<<<<<<<<<<<< * raise RuntimeError(f'Login failed. {err}') * self.cookies = login_reply.cookies */ /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_status_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Status_code, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Status_code, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_err = __pyx_t_11; + __pyx_v_err = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; } __pyx_L18:; - /* "ktlib.pyx":262 + /* "src/ktlib.pyx":258 * else: * err = f'Status code: {login_reply.status_code}' * raise RuntimeError(f'Login failed. {err}') # <<<<<<<<<<<<<< * self.cookies = login_reply.cookies * */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Login_failed, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 262, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Login_failed, __pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 262, __pyx_L1_error) + __PYX_ERR(0, 258, __pyx_L1_error) - /* "ktlib.pyx":255 + /* "src/ktlib.pyx":251 * login_reply = requests.post(login_url, data=login_args, headers=_HEADERS) * * if not login_reply.status_code == 200: # <<<<<<<<<<<<<< * if login_reply.status_code == 403: - * err = b'Incorrect username or password/token (403)' + * err = 'Incorrect username or password/token (403)' */ } - /* "ktlib.pyx":263 + /* "src/ktlib.pyx":259 * err = f'Status code: {login_reply.status_code}' * raise RuntimeError(f'Login failed. {err}') * self.cookies = login_reply.cookies # <<<<<<<<<<<<<< * - * cdef string get_problem_id(self): + * cdef str get_problem_id(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_cookies); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_login_reply, __pyx_n_s_cookies); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); __Pyx_GOTREF(__pyx_v_self->cookies); __Pyx_DECREF(__pyx_v_self->cookies); - __pyx_v_self->cookies = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_self->cookies = __pyx_t_7; + __pyx_t_7 = 0; - /* "ktlib.pyx":231 + /* "src/ktlib.pyx":224 * * - * cdef login(self): # <<<<<<<<<<<<<< + * cdef void login(self) except *: # <<<<<<<<<<<<<< * ''' Try to login and obtain cookies from succesful signin * ''' */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -5450,100 +5420,76 @@ static PyObject *__pyx_f_5ktlib_6Action_login(struct __pyx_obj_5ktlib_Action *__ __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("ktlib.Action.login", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("src.ktlib.Action.login", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; + __Pyx_XDECREF(__pyx_v_login_url); + __Pyx_XDECREF(__pyx_v_err); __Pyx_XDECREF(__pyx_v_username); __Pyx_XDECREF(__pyx_v_password); __Pyx_XDECREF(__pyx_v_token); __Pyx_XDECREF(__pyx_v_login_args); __Pyx_XDECREF(__pyx_v_login_reply); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":265 +/* "src/ktlib.pyx":261 * self.cookies = login_reply.cookies * - * cdef string get_problem_id(self): # <<<<<<<<<<<<<< - * # ASsuming user is in the folder with the name of the problem id - * return os.path.basename(os.getcwd()) + * cdef str get_problem_id(self): # <<<<<<<<<<<<<< + * # Assuming user is in the folder with the name of the problem id + * return Path.cwd().name */ -static std::string __pyx_f_5ktlib_6Action_get_problem_id(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self) { - std::string __pyx_r; +static PyObject *__pyx_f_3src_5ktlib_6Action_get_problem_id(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - std::string __pyx_t_6; __Pyx_RefNannySetupContext("get_problem_id", 0); - /* "ktlib.pyx":267 - * cdef string get_problem_id(self): - * # ASsuming user is in the folder with the name of the problem id - * return os.path.basename(os.getcwd()) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":263 + * cdef str get_problem_id(self): + * # Assuming user is in the folder with the name of the problem id + * return Path.cwd().name # <<<<<<<<<<<<<< * - * cdef string get_problem_url(self): + * cdef str get_problem_url(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cwd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_basename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getcwd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_6; + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "ktlib.pyx":265 + /* "src/ktlib.pyx":261 * self.cookies = login_reply.cookies * - * cdef string get_problem_id(self): # <<<<<<<<<<<<<< - * # ASsuming user is in the folder with the name of the problem id - * return os.path.basename(os.getcwd()) + * cdef str get_problem_id(self): # <<<<<<<<<<<<<< + * # Assuming user is in the folder with the name of the problem id + * return Path.cwd().name */ /* function exit code */ @@ -5551,290 +5497,344 @@ static std::string __pyx_f_5ktlib_6Action_get_problem_id(CYTHON_UNUSED struct __ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("ktlib.Action.get_problem_id", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __Pyx_pretend_to_initialize(&__pyx_r); + __Pyx_AddTraceback("src.ktlib.Action.get_problem_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":269 - * return os.path.basename(os.getcwd()) +/* "src/ktlib.pyx":265 + * return Path.cwd().name * - * cdef string get_problem_url(self): # <<<<<<<<<<<<<< + * cdef str get_problem_url(self): # <<<<<<<<<<<<<< * cdef: - * string domain = f"https://{self.get_url(b'hostname')}" + * str domain = f"https://{self.get_url('hostname')}" */ -static std::string __pyx_f_5ktlib_6Action_get_problem_url(struct __pyx_obj_5ktlib_Action *__pyx_v_self) { - std::string __pyx_v_domain; - std::string __pyx_v_problem_id; - std::string __pyx_r; +static PyObject *__pyx_f_3src_5ktlib_6Action_get_problem_url(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { + PyObject *__pyx_v_domain = 0; + PyObject *__pyx_v_problem_id = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - std::string __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("get_problem_url", 0); - /* "ktlib.pyx":271 - * cdef string get_problem_url(self): + /* "src/ktlib.pyx":267 + * cdef str get_problem_url(self): * cdef: - * string domain = f"https://{self.get_url(b'hostname')}" # <<<<<<<<<<<<<< - * string problem_id = self.get_problem_id() + * str domain = f"https://{self.get_url('hostname')}" # <<<<<<<<<<<<<< + * str problem_id = self.get_problem_id() * */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->get_url(__pyx_v_self, __pyx_k_hostname, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->get_url(__pyx_v_self, __pyx_n_u_hostname, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_https, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_https, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_domain = __pyx_t_3; + __pyx_v_domain = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":272 + /* "src/ktlib.pyx":268 * cdef: - * string domain = f"https://{self.get_url(b'hostname')}" - * string problem_id = self.get_problem_id() # <<<<<<<<<<<<<< + * str domain = f"https://{self.get_url('hostname')}" + * str problem_id = self.get_problem_id() # <<<<<<<<<<<<<< * * return os.path.join( */ - __pyx_v_problem_id = ((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->get_problem_id(__pyx_v_self); + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->get_problem_id(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_problem_id = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":274 - * string problem_id = self.get_problem_id() + /* "src/ktlib.pyx":270 + * str problem_id = self.get_problem_id() * * return os.path.join( # <<<<<<<<<<<<<< * domain, * 'problems', */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "ktlib.pyx":275 - * - * return os.path.join( - * domain, # <<<<<<<<<<<<<< - * 'problems', - * problem_id - */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_domain); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":277 + /* "src/ktlib.pyx":273 * domain, * 'problems', * problem_id # <<<<<<<<<<<<<< * ) * */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_problem_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_7 = 1; + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_n_u_problems, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_domain, __pyx_n_u_problems, __pyx_v_problem_id}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_n_u_problems, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_domain, __pyx_n_u_problems, __pyx_v_problem_id}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); + __Pyx_INCREF(__pyx_v_domain); + __Pyx_GIVEREF(__pyx_v_domain); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_domain); __Pyx_INCREF(__pyx_n_u_problems); __Pyx_GIVEREF(__pyx_n_u_problems); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_n_u_problems); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_u_problems); + __Pyx_INCREF(__pyx_v_problem_id); + __Pyx_GIVEREF(__pyx_v_problem_id); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_problem_id); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":274 - * string problem_id = self.get_problem_id() + /* "src/ktlib.pyx":270 + * str problem_id = self.get_problem_id() * * return os.path.join( # <<<<<<<<<<<<<< * domain, * 'problems', */ - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; - /* "ktlib.pyx":269 - * return os.path.basename(os.getcwd()) + /* "src/ktlib.pyx":265 + * return Path.cwd().name * - * cdef string get_problem_url(self): # <<<<<<<<<<<<<< + * cdef str get_problem_url(self): # <<<<<<<<<<<<<< * cdef: - * string domain = f"https://{self.get_url(b'hostname')}" + * str domain = f"https://{self.get_url('hostname')}" */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_WriteUnraisable("ktlib.Action.get_problem_url", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __Pyx_pretend_to_initialize(&__pyx_r); + __Pyx_AddTraceback("src.ktlib.Action.get_problem_url", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_domain); + __Pyx_XDECREF(__pyx_v_problem_id); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":281 +/* "src/ktlib.pyx":277 * * - * cdef _act(self): # <<<<<<<<<<<<<< - * raise NotImplementedError + * cdef void _act(self) except *: # <<<<<<<<<<<<<< + * raise NotImplementedError() * */ -static PyObject *__pyx_f_5ktlib_6Action__act(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_f_3src_5ktlib_6Action__act(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":282 + /* "src/ktlib.pyx":278 * - * cdef _act(self): - * raise NotImplementedError # <<<<<<<<<<<<<< + * cdef void _act(self) except *: + * raise NotImplementedError() # <<<<<<<<<<<<<< * - * def act(self): + * cpdef void act(self) except *: */ - __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); - __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 278, __pyx_L1_error) - /* "ktlib.pyx":281 + /* "src/ktlib.pyx":277 * * - * cdef _act(self): # <<<<<<<<<<<<<< - * raise NotImplementedError + * cdef void _act(self) except *: # <<<<<<<<<<<<<< + * raise NotImplementedError() * */ /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("ktlib.Action._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.Action._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":284 - * raise NotImplementedError +/* "src/ktlib.pyx":280 + * raise NotImplementedError() * - * def act(self): # <<<<<<<<<<<<<< + * cpdef void act(self) except *: # <<<<<<<<<<<<<< * ''' Python wrapper function to call cython private method _act * ''' */ -/* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Action_3act(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5ktlib_6Action_2act[] = " Python wrapper function to call cython private method _act\n "; -static PyObject *__pyx_pw_5ktlib_6Action_3act(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("act (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Action_2act(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5ktlib_6Action_2act(struct __pyx_obj_5ktlib_Action *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static PyObject *__pyx_pw_3src_5ktlib_6Action_3act(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_3src_5ktlib_6Action_act(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("act", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_act); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_3src_5ktlib_6Action_3act)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } - /* "ktlib.pyx":287 + /* "src/ktlib.pyx":283 * ''' Python wrapper function to call cython private method _act * ''' * self.read_config_from_file() # <<<<<<<<<<<<<< * self._act() * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->read_config_from_file(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_vtabstruct_3src_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->read_config_from_file(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L1_error) - /* "ktlib.pyx":288 + /* "src/ktlib.pyx":284 * ''' * self.read_config_from_file() * self._act() # <<<<<<<<<<<<<< * - * + * @cython.final */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->_act(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_vtabstruct_3src_5ktlib_Action *)__pyx_v_self->__pyx_vtab)->_act(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 284, __pyx_L1_error) - /* "ktlib.pyx":284 - * raise NotImplementedError + /* "src/ktlib.pyx":280 + * raise NotImplementedError() * - * def act(self): # <<<<<<<<<<<<<< + * cpdef void act(self) except *: # <<<<<<<<<<<<<< * ''' Python wrapper function to call cython private method _act * ''' */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Action.act", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.Action.act", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3src_5ktlib_6Action_3act(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3src_5ktlib_6Action_2act[] = " Python wrapper function to call cython private method _act\n "; +static PyObject *__pyx_pw_3src_5ktlib_6Action_3act(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("act (wrapper)", 0); + __pyx_r = __pyx_pf_3src_5ktlib_6Action_2act(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3src_5ktlib_6Action_2act(struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("act", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_3src_5ktlib_6Action_act(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.Action.act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5849,19 +5849,19 @@ static PyObject *__pyx_pf_5ktlib_6Action_2act(struct __pyx_obj_5ktlib_Action *__ */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Action_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Action_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_6Action_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Action_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Action_4__reduce_cython__(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_6Action_4__reduce_cython__(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5873,7 +5873,7 @@ static PyObject *__pyx_pf_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5888,7 +5888,7 @@ static PyObject *__pyx_pf_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Action.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Action.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -5903,19 +5903,19 @@ static PyObject *__pyx_pf_5ktlib_6Action_4__reduce_cython__(CYTHON_UNUSED struct */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Action_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Action_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_6Action_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Action_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Action_6__setstate_cython__(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_6Action_6__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Action_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Action *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_6Action_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Action *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5926,7 +5926,7 @@ static PyObject *__pyx_pf_5ktlib_6Action_6__setstate_cython__(CYTHON_UNUSED stru * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5942,1132 +5942,1259 @@ static PyObject *__pyx_pf_5ktlib_6Action_6__setstate_cython__(CYTHON_UNUSED stru /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Action.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Action.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":293 +/* "src/ktlib.pyx":294 + * str data * - * - * cpdef void write_samples(tuple sample_data): # <<<<<<<<<<<<<< - * ''' Write input/output sample to file. This is used for multiprocess pool to generate input/output files - * Args: + * def __cinit__(self, str problem_id='', str data='', bint is_in=True, str sample_id=''): # <<<<<<<<<<<<<< + * self.problem_id = problem_id + * self.is_in = is_in */ -static PyObject *__pyx_pw_5ktlib_7write_samples(PyObject *__pyx_self, PyObject *__pyx_v_sample_data); /*proto*/ -static void __pyx_f_5ktlib_write_samples(PyObject *__pyx_v_sample_data, CYTHON_UNUSED int __pyx_skip_dispatch) { - std::string __pyx_v_file_name_prefix; - std::string __pyx_v_file_name; - PyObject *__pyx_v_f = NULL; +/* Python wrapper */ +static int __pyx_pw_3src_5ktlib_10SampleData_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3src_5ktlib_10SampleData_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_problem_id = 0; + PyObject *__pyx_v_data = 0; + int __pyx_v_is_in; + PyObject *__pyx_v_sample_id = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - int __pyx_t_2; - std::string __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - Py_UCS4 __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - __Pyx_RefNannySetupContext("write_samples", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_problem_id,&__pyx_n_s_data,&__pyx_n_s_is_in,&__pyx_n_s_sample_id,0}; + PyObject* values[4] = {0,0,0,0}; + values[0] = ((PyObject*)__pyx_kp_u_); + values[1] = ((PyObject*)__pyx_kp_u_); + values[3] = ((PyObject*)__pyx_kp_u_); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_problem_id); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_in); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_id); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 294, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_problem_id = ((PyObject*)values[0]); + __pyx_v_data = ((PyObject*)values[1]); + if (values[2]) { + __pyx_v_is_in = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_is_in == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L3_error) + } else { + __pyx_v_is_in = ((int)1); + } + __pyx_v_sample_id = ((PyObject*)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("src.ktlib.SampleData.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_problem_id), (&PyUnicode_Type), 1, "problem_id", 1))) __PYX_ERR(0, 294, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 1, "data", 1))) __PYX_ERR(0, 294, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_id), (&PyUnicode_Type), 1, "sample_id", 1))) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_10SampleData___cinit__(((struct __pyx_obj_3src_5ktlib_SampleData *)__pyx_v_self), __pyx_v_problem_id, __pyx_v_data, __pyx_v_is_in, __pyx_v_sample_id); - /* "ktlib.pyx":300 - * ''' - * cdef: - * string file_name_prefix = b'in' if sample_data[3] else b'ans' # <<<<<<<<<<<<<< - * string file_name = f'{sample_data[2]}/{file_name_prefix}{sample_data[0]}.txt' + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3src_5ktlib_10SampleData___cinit__(struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_self, PyObject *__pyx_v_problem_id, PyObject *__pyx_v_data, int __pyx_v_is_in, PyObject *__pyx_v_sample_id) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "src/ktlib.pyx":295 * + * def __cinit__(self, str problem_id='', str data='', bint is_in=True, str sample_id=''): + * self.problem_id = problem_id # <<<<<<<<<<<<<< + * self.is_in = is_in + * self.sample_id = sample_id */ - if (unlikely(__pyx_v_sample_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 300, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_v_sample_data, 3)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 300, __pyx_L1_error) - if (__pyx_t_2) { - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_in); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error) - __pyx_t_1 = __pyx_t_3; - } else { - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_ans); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error) - __pyx_t_1 = __pyx_t_3; - } - __pyx_v_file_name_prefix = __pyx_t_1; + __Pyx_INCREF(__pyx_v_problem_id); + __Pyx_GIVEREF(__pyx_v_problem_id); + __Pyx_GOTREF(__pyx_v_self->problem_id); + __Pyx_DECREF(__pyx_v_self->problem_id); + __pyx_v_self->problem_id = __pyx_v_problem_id; - /* "ktlib.pyx":301 - * cdef: - * string file_name_prefix = b'in' if sample_data[3] else b'ans' - * string file_name = f'{sample_data[2]}/{file_name_prefix}{sample_data[0]}.txt' # <<<<<<<<<<<<<< - * - * with open(file_name, 'w') as f: - */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_6 = 127; - if (unlikely(__pyx_v_sample_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 301, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyObject_FormatSimple(PyTuple_GET_ITEM(__pyx_v_sample_data, 2), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_5 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u__6); - __pyx_t_7 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_file_name_prefix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_7); - __pyx_t_7 = 0; - if (unlikely(__pyx_v_sample_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 301, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyObject_FormatSimple(PyTuple_GET_ITEM(__pyx_v_sample_data, 0), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u_txt); - __pyx_t_5 += 4; - __Pyx_GIVEREF(__pyx_kp_u_txt); - PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u_txt); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_file_name = __pyx_t_1; - - /* "ktlib.pyx":303 - * string file_name = f'{sample_data[2]}/{file_name_prefix}{sample_data[0]}.txt' - * - * with open(file_name, 'w') as f: # <<<<<<<<<<<<<< - * f.write(sample_data[1]) - * + /* "src/ktlib.pyx":296 + * def __cinit__(self, str problem_id='', str data='', bint is_in=True, str sample_id=''): + * self.problem_id = problem_id + * self.is_in = is_in # <<<<<<<<<<<<<< + * self.sample_id = sample_id + * self.data = data */ - /*with:*/ { - __pyx_t_7 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_file_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __Pyx_INCREF(__pyx_n_u_w); - __Pyx_GIVEREF(__pyx_n_u_w); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_w); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_7, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_7, __pyx_n_s_enter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 303, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - /*try:*/ { - __pyx_v_f = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_self->is_in = __pyx_v_is_in; - /* "ktlib.pyx":304 + /* "src/ktlib.pyx":297 + * self.problem_id = problem_id + * self.is_in = is_in + * self.sample_id = sample_id # <<<<<<<<<<<<<< + * self.data = data * - * with open(file_name, 'w') as f: - * f.write(sample_data[1]) # <<<<<<<<<<<<<< - * - * cdef class Gen(Action): */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 304, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_7); - if (unlikely(__pyx_v_sample_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 304, __pyx_L7_error) - } - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_9 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, PyTuple_GET_ITEM(__pyx_v_sample_data, 1)) : __Pyx_PyObject_CallOneArg(__pyx_t_7, PyTuple_GET_ITEM(__pyx_v_sample_data, 1)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 304, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_v_sample_id); + __Pyx_GIVEREF(__pyx_v_sample_id); + __Pyx_GOTREF(__pyx_v_self->sample_id); + __Pyx_DECREF(__pyx_v_self->sample_id); + __pyx_v_self->sample_id = __pyx_v_sample_id; - /* "ktlib.pyx":303 - * string file_name = f'{sample_data[2]}/{file_name_prefix}{sample_data[0]}.txt' + /* "src/ktlib.pyx":298 + * self.is_in = is_in + * self.sample_id = sample_id + * self.data = data # <<<<<<<<<<<<<< * - * with open(file_name, 'w') as f: # <<<<<<<<<<<<<< - * f.write(sample_data[1]) * */ - } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L12_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /*except:*/ { - __Pyx_AddTraceback("ktlib.write_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 303, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_Pack(3, __pyx_t_9, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 303, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 303, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_2 < 0) __PYX_ERR(0, 303, __pyx_L9_except_error) - __pyx_t_15 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ErrRestoreWithState(__pyx_t_9, __pyx_t_7, __pyx_t_4); - __pyx_t_9 = 0; __pyx_t_7 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 303, __pyx_L9_except_error) - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L8_exception_handled; - } - __pyx_L9_except_error:; - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - goto __pyx_L1_error; - __pyx_L8_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - __pyx_L12_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_8) { - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - goto __pyx_L6; - } - __pyx_L6:; - } - goto __pyx_L16; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L1_error; - __pyx_L16:; - } + __Pyx_INCREF(__pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = __pyx_v_data; - /* "ktlib.pyx":293 - * + /* "src/ktlib.pyx":294 + * str data * - * cpdef void write_samples(tuple sample_data): # <<<<<<<<<<<<<< - * ''' Write input/output sample to file. This is used for multiprocess pool to generate input/output files - * Args: + * def __cinit__(self, str problem_id='', str data='', bint is_in=True, str sample_id=''): # <<<<<<<<<<<<<< + * self.problem_id = problem_id + * self.is_in = is_in */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_WriteUnraisable("ktlib.write_samples", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); + __pyx_r = 0; __Pyx_RefNannyFinishContext(); + return __pyx_r; } +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_7write_samples(PyObject *__pyx_self, PyObject *__pyx_v_sample_data); /*proto*/ -static char __pyx_doc_5ktlib_6write_samples[] = " Write input/output sample to file. This is used for multiprocess pool to generate input/output files\n Args:\n - sample_data: a tuple representing index, string data, problem id and a boolean declaring whether current\n file is input (False if the file is output)\n "; -static PyObject *__pyx_pw_5ktlib_7write_samples(PyObject *__pyx_self, PyObject *__pyx_v_sample_data) { +static PyObject *__pyx_pw_3src_5ktlib_10SampleData_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_10SampleData_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_samples (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_data), (&PyTuple_Type), 1, "sample_data", 1))) __PYX_ERR(0, 293, __pyx_L1_error) - __pyx_r = __pyx_pf_5ktlib_6write_samples(__pyx_self, ((PyObject*)__pyx_v_sample_data)); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_3src_5ktlib_10SampleData_2__reduce_cython__(((struct __pyx_obj_3src_5ktlib_SampleData *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6write_samples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample_data) { +static PyObject *__pyx_pf_3src_5ktlib_10SampleData_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("write_samples", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_void_to_None(__pyx_f_5ktlib_write_samples(__pyx_v_sample_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.write_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.SampleData.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":308 - * cdef class Gen(Action): - * ''' Handle `gen` command for kt_tool ''' - * def __cinit__(self, string problem_id): # <<<<<<<<<<<<<< - * self._problem_id = problem_id - * +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ -static int __pyx_pw_5ktlib_3Gen_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5ktlib_3Gen_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - std::string __pyx_v_problem_id; - int __pyx_r; +static PyObject *__pyx_pw_3src_5ktlib_10SampleData_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_10SampleData_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_problem_id,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_problem_id)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 308, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_problem_id = __pyx_convert_string_from_py_std__in_string(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 308, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("ktlib.Gen.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5ktlib_3Gen___cinit__(((struct __pyx_obj_5ktlib_Gen *)__pyx_v_self), __pyx_v_problem_id); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_3src_5ktlib_10SampleData_4__setstate_cython__(((struct __pyx_obj_3src_5ktlib_SampleData *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5ktlib_3Gen___cinit__(struct __pyx_obj_5ktlib_Gen *__pyx_v_self, std::string __pyx_v_problem_id) { - int __pyx_r; +static PyObject *__pyx_pf_3src_5ktlib_10SampleData_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "ktlib.pyx":309 - * ''' Handle `gen` command for kt_tool ''' - * def __cinit__(self, string problem_id): - * self._problem_id = problem_id # <<<<<<<<<<<<<< - * - * + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_v_self->_problem_id = __pyx_v_problem_id; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) - /* "ktlib.pyx":308 - * cdef class Gen(Action): - * ''' Handle `gen` command for kt_tool ''' - * def __cinit__(self, string problem_id): # <<<<<<<<<<<<<< - * self._problem_id = problem_id - * + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ - __pyx_r = 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.SampleData.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":312 +/* "src/ktlib.pyx":301 * * - * cdef _gen_samples(self): # <<<<<<<<<<<<<< - * ''' Generate sample input file for `self._problem_id` - * The basic flow is to scrape the problem task page and retrieve the relevent fields + * cpdef void write_samples(SampleData sample_data) except *: # <<<<<<<<<<<<<< + * ''' Write input/output sample to file. This is used for multiprocess pool to generate input/output files + * Args: */ -static PyObject *__pyx_f_5ktlib_3Gen__gen_samples(struct __pyx_obj_5ktlib_Gen *__pyx_v_self) { - std::string __pyx_v_domain; - PyObject *__pyx_v_template_file = 0; - PyObject *__pyx_v_sample_data = 0; - PyObject *__pyx_v_page = NULL; - PyObject *__pyx_v_soup = NULL; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_executor = NULL; +static PyObject *__pyx_pw_3src_5ktlib_7write_samples(PyObject *__pyx_self, PyObject *__pyx_v_sample_data); /*proto*/ +static void __pyx_f_3src_5ktlib_write_samples(struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_sample_data, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_file_name_prefix = 0; + PyObject *__pyx_v_file_name = 0; PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_k = NULL; - PyObject *__pyx_v_template = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - std::string __pyx_t_3; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - int __pyx_t_18; - Py_UCS4 __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; - Py_ssize_t __pyx_t_22; - PyObject *__pyx_t_23 = NULL; - __Pyx_RefNannySetupContext("_gen_samples", 0); - - /* "ktlib.pyx":327 - * ''' - * cdef: - * string domain = f"https://{self.get_url(b'hostname')}" # <<<<<<<<<<<<<< - * object template_file = {} - * list sample_data = [] - */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_5ktlib_Gen *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_url(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self), __pyx_k_hostname, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_https, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_domain = __pyx_t_3; + int __pyx_t_13; + __Pyx_RefNannySetupContext("write_samples", 0); - /* "ktlib.pyx":328 - * cdef: - * string domain = f"https://{self.get_url(b'hostname')}" - * object template_file = {} # <<<<<<<<<<<<<< - * list sample_data = [] + /* "src/ktlib.pyx":308 + * ''' + * cdef: + * str file_name_prefix = 'in' if sample_data.is_in else 'ans' # <<<<<<<<<<<<<< + * str file_name = f'{sample_data.problem_id}/{file_name_prefix}{sample_data.sample_id}.txt' * */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_template_file = __pyx_t_2; - __pyx_t_2 = 0; + if ((__pyx_v_sample_data->is_in != 0)) { + __Pyx_INCREF(__pyx_n_u_in); + __pyx_t_1 = __pyx_n_u_in; + } else { + __Pyx_INCREF(__pyx_n_u_ans); + __pyx_t_1 = __pyx_n_u_ans; + } + __pyx_v_file_name_prefix = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":329 - * string domain = f"https://{self.get_url(b'hostname')}" - * object template_file = {} - * list sample_data = [] # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":309 + * cdef: + * str file_name_prefix = 'in' if sample_data.is_in else 'ans' + * str file_name = f'{sample_data.problem_id}/{file_name_prefix}{sample_data.sample_id}.txt' # <<<<<<<<<<<<<< * - * self.login() + * with open(file_name, 'w+') as f: */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_sample_data = ((PyObject*)__pyx_t_2); + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = 127; + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_sample_data->problem_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__4); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__4); + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_file_name_prefix); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_sample_data->sample_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_txt); + __pyx_t_2 += 4; + __Pyx_GIVEREF(__pyx_kp_u_txt); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_txt); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_file_name = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":331 - * list sample_data = [] + /* "src/ktlib.pyx":311 + * str file_name = f'{sample_data.problem_id}/{file_name_prefix}{sample_data.sample_id}.txt' * - * self.login() # <<<<<<<<<<<<<< - * self._url = os.path.join( - * domain, - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5ktlib_Gen *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.login(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "ktlib.pyx":332 + * with open(file_name, 'w+') as f: # <<<<<<<<<<<<<< + * f.write(sample_data.data) * - * self.login() - * self._url = os.path.join( # <<<<<<<<<<<<<< - * domain, - * 'problems', */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*with:*/ { + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_file_name); + __Pyx_GIVEREF(__pyx_v_file_name); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_file_name); + __Pyx_INCREF(__pyx_kp_u_w_2); + __Pyx_GIVEREF(__pyx_kp_u_w_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_w_2); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + __pyx_v_f = __pyx_t_6; + __pyx_t_6 = 0; - /* "ktlib.pyx":333 - * self.login() - * self._url = os.path.join( - * domain, # <<<<<<<<<<<<<< - * 'problems', - * self._problem_id + /* "src/ktlib.pyx":312 + * + * with open(file_name, 'w+') as f: + * f.write(sample_data.data) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_domain); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_sample_data->data) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sample_data->data); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 312, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "ktlib.pyx":335 - * domain, - * 'problems', - * self._problem_id # <<<<<<<<<<<<<< - * ) - * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) + /* "src/ktlib.pyx":311 + * str file_name = f'{sample_data.problem_id}/{file_name_prefix}{sample_data.sample_id}.txt' + * + * with open(file_name, 'w+') as f: # <<<<<<<<<<<<<< + * f.write(sample_data.data) + * */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_7 = 1; + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + /*except:*/ { + __Pyx_AddTraceback("src.ktlib.write_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 311, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 311, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 311, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_12 < 0) __PYX_ERR(0, 311, __pyx_L9_except_error) + __pyx_t_13 = ((!(__pyx_t_12 != 0)) != 0); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_1, __pyx_t_4); + __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 311, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_L12_try_end:; + } } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_n_u_problems, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_n_u_problems, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_5) { + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); - __Pyx_INCREF(__pyx_n_u_problems); - __Pyx_GIVEREF(__pyx_n_u_problems); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_n_u_problems); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L1_error; + __pyx_L16:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":332 + /* "src/ktlib.pyx":301 * - * self.login() - * self._url = os.path.join( # <<<<<<<<<<<<<< - * domain, - * 'problems', + * + * cpdef void write_samples(SampleData sample_data) except *: # <<<<<<<<<<<<<< + * ''' Write input/output sample to file. This is used for multiprocess pool to generate input/output files + * Args: */ - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->_url = __pyx_t_3; - /* "ktlib.pyx":337 - * self._problem_id - * ) - * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) # <<<<<<<<<<<<<< - * soup = BeautifulSoup(page.content, 'html.parser') - * data = soup.find_all('pre') - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_requests); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_url); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cookies, __pyx_v_self->__pyx_base.cookies) < 0) __PYX_ERR(0, 337, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_headers, __pyx_v_5ktlib__HEADERS) < 0) __PYX_ERR(0, 337, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_page = __pyx_t_5; - __pyx_t_5 = 0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("src.ktlib.write_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_name_prefix); + __Pyx_XDECREF(__pyx_v_file_name); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_RefNannyFinishContext(); +} - /* "ktlib.pyx":338 - * ) - * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) - * soup = BeautifulSoup(page.content, 'html.parser') # <<<<<<<<<<<<<< - * data = soup.find_all('pre') +/* Python wrapper */ +static PyObject *__pyx_pw_3src_5ktlib_7write_samples(PyObject *__pyx_self, PyObject *__pyx_v_sample_data); /*proto*/ +static char __pyx_doc_3src_5ktlib_6write_samples[] = " Write input/output sample to file. This is used for multiprocess pool to generate input/output files\n Args:\n - sample_data: a tuple representing index, string data, problem id and a boolean declaring whether current\n file is input (False if the file is output)\n "; +static PyObject *__pyx_pw_3src_5ktlib_7write_samples(PyObject *__pyx_self, PyObject *__pyx_v_sample_data) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_samples (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_data), __pyx_ptype_3src_5ktlib_SampleData, 1, "sample_data", 0))) __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_6write_samples(__pyx_self, ((struct __pyx_obj_3src_5ktlib_SampleData *)__pyx_v_sample_data)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3src_5ktlib_6write_samples(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3src_5ktlib_SampleData *__pyx_v_sample_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("write_samples", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_f_3src_5ktlib_write_samples(__pyx_v_sample_data, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.write_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "src/ktlib.pyx":323 + * + * ''' Handle `gen` command for kt_tool ''' + * def __cinit__(self, str problem_id): # <<<<<<<<<<<<<< + * self._problem_id = problem_id + * self._url = '' + */ + +/* Python wrapper */ +static int __pyx_pw_3src_5ktlib_3Gen_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3src_5ktlib_3Gen_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_problem_id = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_problem_id,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_problem_id)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 323, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_problem_id = ((PyObject*)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 323, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("src.ktlib.Gen.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_problem_id), (&PyUnicode_Type), 1, "problem_id", 1))) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_3Gen___cinit__(((struct __pyx_obj_3src_5ktlib_Gen *)__pyx_v_self), __pyx_v_problem_id); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3src_5ktlib_3Gen___cinit__(struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self, PyObject *__pyx_v_problem_id) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "src/ktlib.pyx":324 + * ''' Handle `gen` command for kt_tool ''' + * def __cinit__(self, str problem_id): + * self._problem_id = problem_id # <<<<<<<<<<<<<< + * self._url = '' + * + */ + __Pyx_INCREF(__pyx_v_problem_id); + __Pyx_GIVEREF(__pyx_v_problem_id); + __Pyx_GOTREF(__pyx_v_self->_problem_id); + __Pyx_DECREF(__pyx_v_self->_problem_id); + __pyx_v_self->_problem_id = __pyx_v_problem_id; + + /* "src/ktlib.pyx":325 + * def __cinit__(self, str problem_id): + * self._problem_id = problem_id + * self._url = '' # <<<<<<<<<<<<<< + * + * cdef void _gen_samples(self) except *: + */ + __Pyx_INCREF(__pyx_kp_u_); + __Pyx_GIVEREF(__pyx_kp_u_); + __Pyx_GOTREF(__pyx_v_self->_url); + __Pyx_DECREF(__pyx_v_self->_url); + __pyx_v_self->_url = __pyx_kp_u_; + + /* "src/ktlib.pyx":323 + * + * ''' Handle `gen` command for kt_tool ''' + * def __cinit__(self, str problem_id): # <<<<<<<<<<<<<< + * self._problem_id = problem_id + * self._url = '' + */ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "src/ktlib.pyx":327 + * self._url = '' + * + * cdef void _gen_samples(self) except *: # <<<<<<<<<<<<<< + * ''' Generate sample input file for `self._problem_id` + * The basic flow is to scrape the problem task page and retrieve the relevent fields + */ + +static void __pyx_f_3src_5ktlib_3Gen__gen_samples(struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self) { + CYTHON_UNUSED PyObject *__pyx_v_domain = 0; + PyObject *__pyx_v_template_file = 0; + PyObject *__pyx_v_sample_data = 0; + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_soup = 0; + PyObject *__pyx_v_page = 0; + size_t __pyx_v_i; + PyObject *__pyx_v_k = 0; + PyObject *__pyx_v_template = 0; + PyObject *__pyx_v_executor = NULL; + PyObject *__pyx_v_f = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + size_t __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + int __pyx_t_17; + Py_UCS4 __pyx_t_18; + int __pyx_t_19; + Py_ssize_t __pyx_t_20; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + __Pyx_RefNannySetupContext("_gen_samples", 0); + + /* "src/ktlib.pyx":342 + * ''' + * cdef: + * str domain = f"https://{self.get_url('hostname')}" # <<<<<<<<<<<<<< + * dict template_file = {} + * list sample_data = [] + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Gen *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_url(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self), __pyx_n_u_hostname, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_https, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_domain = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":343 + * cdef: + * str domain = f"https://{self.get_url('hostname')}" + * dict template_file = {} # <<<<<<<<<<<<<< + * list sample_data = [] + * object data + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_template_file = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":344 + * str domain = f"https://{self.get_url('hostname')}" + * dict template_file = {} + * list sample_data = [] # <<<<<<<<<<<<<< + * object data + * object soup + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_sample_data = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":348 + * object soup + * object page + * size_t i = 0 # <<<<<<<<<<<<<< + * str k + * dict template + */ + __pyx_v_i = 0; + + /* "src/ktlib.pyx":353 + * * + * self.login() # <<<<<<<<<<<<<< + * self._url = self.get_problem_url() + * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) + */ + ((struct __pyx_vtabstruct_3src_5ktlib_Gen *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.login(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L1_error) + + /* "src/ktlib.pyx":354 + * + * self.login() + * self._url = self.get_problem_url() # <<<<<<<<<<<<<< + * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) + * soup = BeautifulSoup(page.content, 'html.parser') */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BeautifulSoup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Gen *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_url(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_url); + __Pyx_DECREF(__pyx_v_self->_url); + __pyx_v_self->_url = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":355 + * self.login() + * self._url = self.get_problem_url() + * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) # <<<<<<<<<<<<<< + * soup = BeautifulSoup(page.content, 'html.parser') + * data = soup.find_all('pre') + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_requests); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_page, __pyx_n_s_content); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->_url); + __Pyx_GIVEREF(__pyx_v_self->_url); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_url); + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cookies, __pyx_v_self->__pyx_base.cookies) < 0) __PYX_ERR(0, 355, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_headers, __pyx_v_3src_5ktlib__HEADERS) < 0) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_page = __pyx_t_4; + __pyx_t_4 = 0; + + /* "src/ktlib.pyx":356 + * self._url = self.get_problem_url() + * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) + * soup = BeautifulSoup(page.content, 'html.parser') # <<<<<<<<<<<<<< + * data = soup.find_all('pre') + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BeautifulSoup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_page, __pyx_n_s_content); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_7 = 1; + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_8, __pyx_kp_u_html_parser}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_u_html_parser}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_8, __pyx_kp_u_html_parser}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_u_html_parser}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL; + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_2) { + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL; } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_kp_u_html_parser); __Pyx_GIVEREF(__pyx_kp_u_html_parser); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_kp_u_html_parser); - __pyx_t_8 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_kp_u_html_parser); + __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_soup = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_soup = __pyx_t_4; + __pyx_t_4 = 0; - /* "ktlib.pyx":339 + /* "src/ktlib.pyx":357 * page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) * soup = BeautifulSoup(page.content, 'html.parser') * data = soup.find_all('pre') # <<<<<<<<<<<<<< * * for i in range(len(data)): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_n_u_pre) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_pre); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_data = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_n_u_pre) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_pre); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_data = __pyx_t_4; + __pyx_t_4 = 0; - /* "ktlib.pyx":341 + /* "src/ktlib.pyx":359 * data = soup.find_all('pre') * * for i in range(len(data)): # <<<<<<<<<<<<<< * if i & 1: - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=False)) */ - __pyx_t_9 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 341, __pyx_L1_error) - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 341, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 341, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 341, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_10(__pyx_t_5); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 341, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_7 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "ktlib.pyx":342 + /* "src/ktlib.pyx":360 * * for i in range(len(data)): * if i & 1: # <<<<<<<<<<<<<< - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=False)) * else: */ - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { + __pyx_t_10 = ((__pyx_v_i & 1) != 0); + if (__pyx_t_10) { - /* "ktlib.pyx":343 + /* "src/ktlib.pyx":361 * for i in range(len(data)): * if i & 1: - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) # <<<<<<<<<<<<<< + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=False)) # <<<<<<<<<<<<<< * else: - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, True)) + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=True)) */ - __pyx_t_2 = __Pyx_PyInt_FloorDivideObjC(__pyx_v_i, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_text); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); - __Pyx_INCREF(Py_False); - __Pyx_GIVEREF(Py_False); - PyTuple_SET_ITEM(__pyx_t_1, 3, Py_False); - __pyx_t_4 = 0; - __pyx_t_8 = 0; - __pyx_t_2 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_sample_data, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_FromSize_t(((__pyx_v_i / 2) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sample_id, __pyx_t_3) < 0) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_data, __pyx_t_6) < 0) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_problem_id, __pyx_v_self->_problem_id) < 0) __PYX_ERR(0, 361, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_is_in, Py_False) < 0) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_3src_5ktlib_SampleData), __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_sample_data, __pyx_t_6); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "ktlib.pyx":342 + /* "src/ktlib.pyx":360 * * for i in range(len(data)): * if i & 1: # <<<<<<<<<<<<<< - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=False)) * else: */ goto __pyx_L5; } - /* "ktlib.pyx":345 - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) + /* "src/ktlib.pyx":363 + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=False)) * else: - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, True)) # <<<<<<<<<<<<<< + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=True)) # <<<<<<<<<<<<<< * - * assert(len(data) % 2 == 0, 'Internal error: Number of sample input ' + * assert len(data) % 2 == 0, 'Internal error: Number of sample input '\ */ /*else*/ { - __pyx_t_1 = __Pyx_PyInt_FloorDivideObjC(__pyx_v_i, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_data, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_text); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyInt_FromSize_t(((__pyx_v_i / 2) + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); - __Pyx_INCREF(Py_True); - __Pyx_GIVEREF(Py_True); - PyTuple_SET_ITEM(__pyx_t_4, 3, Py_True); - __pyx_t_2 = 0; - __pyx_t_8 = 0; - __pyx_t_1 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_sample_data, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 345, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_sample_id, __pyx_t_4) < 0) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_problem_id, __pyx_v_self->_problem_id) < 0) __PYX_ERR(0, 363, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_is_in, Py_True) < 0) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_3src_5ktlib_SampleData), __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_sample_data, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L5:; - - /* "ktlib.pyx":341 - * data = soup.find_all('pre') - * - * for i in range(len(data)): # <<<<<<<<<<<<<< - * if i & 1: - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) - */ } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":347 - * sample_data.append((i // 2 + 1, data[i].text, self._problem_id, True)) + /* "src/ktlib.pyx":365 + * sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=True)) * - * assert(len(data) % 2 == 0, 'Internal error: Number of sample input ' # <<<<<<<<<<<<<< - * ' is not equal to number of sample output') + * assert len(data) % 2 == 0, 'Internal error: Number of sample input '\ # <<<<<<<<<<<<<< + * ' is not equal to number of sample output' * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_9 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 347, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyBool_FromLong(((__pyx_t_9 % 2) == 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_INCREF(__pyx_kp_u_Internal_error_Number_of_sample); - __Pyx_GIVEREF(__pyx_kp_u_Internal_error_Number_of_sample); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_Internal_error_Number_of_sample); - __pyx_t_5 = 0; - __pyx_t_11 = (PyTuple_GET_SIZE(__pyx_t_4) != 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_11)) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 365, __pyx_L1_error) + if (unlikely(!(((__pyx_t_7 % 2) == 0) != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Internal_error_Number_of_sample); + __PYX_ERR(0, 365, __pyx_L1_error) } } #endif - /* "ktlib.pyx":350 - * ' is not equal to number of sample output') + /* "src/ktlib.pyx":368 + * ' is not equal to number of sample output' * * with concurrent.futures.ProcessPoolExecutor(max_workers=4) as executor: # <<<<<<<<<<<<<< * executor.map(write_samples, sample_data) * */ /*with:*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_concurrent); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_futures); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ProcessPoolExecutor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_max_workers, __pyx_int_4) < 0) __PYX_ERR(0, 350, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_13 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L6_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_concurrent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_futures); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ProcessPoolExecutor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_max_workers, __pyx_int_4) < 0) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_6; + __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); + __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_16); /*try:*/ { - __pyx_v_executor = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_executor = __pyx_t_3; + __pyx_t_3 = 0; - /* "ktlib.pyx":351 + /* "src/ktlib.pyx":369 * * with concurrent.futures.ProcessPoolExecutor(max_workers=4) as executor: * executor.map(write_samples, sample_data) # <<<<<<<<<<<<<< * - * print(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) + * log(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_executor, __pyx_n_s_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_write_samples); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_executor, __pyx_n_s_map); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_write_samples); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_7 = 1; + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_5, __pyx_v_sample_data}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L10_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_6, __pyx_v_sample_data}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L10_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_5, __pyx_v_sample_data}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L10_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_6, __pyx_v_sample_data}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L10_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L10_error) + __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_2); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL; + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL; } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_v_sample_data); __Pyx_GIVEREF(__pyx_v_sample_data); - PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_v_sample_data); - __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_sample_data); + __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":350 - * ' is not equal to number of sample output') + /* "src/ktlib.pyx":368 + * ' is not equal to number of sample output' * * with concurrent.futures.ProcessPoolExecutor(max_workers=4) as executor: # <<<<<<<<<<<<<< * executor.map(write_samples, sample_data) * */ } + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L15_try_end; __pyx_L10_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Gen._gen_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 350, __pyx_L12_except_error) + __Pyx_AddTraceback("src.ktlib.Gen._gen_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) __PYX_ERR(0, 368, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L12_except_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_5, NULL); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 350, __pyx_L12_except_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_17); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 350, __pyx_L12_except_error) - __pyx_t_18 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_18) { + __pyx_t_6 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_6, NULL); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 368, __pyx_L12_except_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_16); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (__pyx_t_10 < 0) __PYX_ERR(0, 368, __pyx_L12_except_error) + __pyx_t_17 = ((!(__pyx_t_10 != 0)) != 0); + if (__pyx_t_17) { + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_2); - __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 350, __pyx_L12_except_error) + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_4, __pyx_t_2); + __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0; + __PYX_ERR(0, 368, __pyx_L12_except_error) } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L11_exception_handled; } __pyx_L12_except_error:; + __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); goto __pyx_L1_error; __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_L15_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_13) { - __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (__pyx_t_12) { + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } goto __pyx_L9; } @@ -7075,284 +7202,306 @@ static PyObject *__pyx_f_5ktlib_3Gen__gen_samples(struct __pyx_obj_5ktlib_Gen *_ } goto __pyx_L19; __pyx_L6_error:; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L1_error; __pyx_L19:; } - /* "ktlib.pyx":353 + /* "src/ktlib.pyx":371 * executor.map(write_samples, sample_data) * - * print(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) # <<<<<<<<<<<<<< + * log(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) # <<<<<<<<<<<<<< * if not os.path.exists(self.kt_config): - * print(color_red(b'.ktconfig file has not been set up so no template was generated. ' + * log(color_red('.ktconfig file has not been set up so no template was generated. ' */ - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = 0; - __pyx_t_19 = 127; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = 0; + __pyx_t_18 = 127; __Pyx_INCREF(__pyx_kp_u_Generate); - __pyx_t_9 += 9; + __pyx_t_7 += 9; __Pyx_GIVEREF(__pyx_kp_u_Generate); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Generate); - __pyx_t_20 = PyList_GET_SIZE(__pyx_v_sample_data); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 353, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyUnicode_From_Py_ssize_t((__pyx_t_20 / 2), 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Generate); + __pyx_t_8 = PyList_GET_SIZE(__pyx_v_sample_data); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 371, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t((__pyx_t_8 / 2), 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6); + __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u_sample_s_to); - __pyx_t_9 += 14; + __pyx_t_7 += 14; __Pyx_GIVEREF(__pyx_kp_u_sample_s_to); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_sample_s_to); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_19 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_19) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_19; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_9, __pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_sample_s_to); + __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_18; + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_7, __pyx_t_18); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_f_3src_5ktlib_color_green(((PyObject*)__pyx_t_6), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":354 + /* "src/ktlib.pyx":372 * - * print(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) + * log(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) * if not os.path.exists(self.kt_config): # <<<<<<<<<<<<<< - * print(color_red(b'.ktconfig file has not been set up so no template was generated. ' - * b'Please use `kt config` to set up a template file')) + * log(color_red('.ktconfig file has not been set up so no template was generated. ' + * 'Please use `kt config` to set up a template file')) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_self->__pyx_base.kt_config) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->__pyx_base.kt_config); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = ((!__pyx_t_18) != 0); - if (__pyx_t_11) { + __pyx_t_10 = ((!__pyx_t_17) != 0); + if (__pyx_t_10) { - /* "ktlib.pyx":355 - * print(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) + /* "src/ktlib.pyx":373 + * log(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) * if not os.path.exists(self.kt_config): - * print(color_red(b'.ktconfig file has not been set up so no template was generated. ' # <<<<<<<<<<<<<< - * b'Please use `kt config` to set up a template file')) + * log(color_red('.ktconfig file has not been set up so no template was generated. ' # <<<<<<<<<<<<<< + * 'Please use `kt config` to set up a template file')) * return */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_k_ktconfig_file_has_not_been_set, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_f_3src_5ktlib_color_red(__pyx_kp_u_ktconfig_file_has_not_been_set, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":357 - * print(color_red(b'.ktconfig file has not been set up so no template was generated. ' - * b'Please use `kt config` to set up a template file')) + /* "src/ktlib.pyx":375 + * log(color_red('.ktconfig file has not been set up so no template was generated. ' + * 'Please use `kt config` to set up a template file')) * return # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ktlib.pyx":354 + /* "src/ktlib.pyx":372 * - * print(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) + * log(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) * if not os.path.exists(self.kt_config): # <<<<<<<<<<<<<< - * print(color_red(b'.ktconfig file has not been set up so no template was generated. ' - * b'Please use `kt config` to set up a template file')) + * log(color_red('.ktconfig file has not been set up so no template was generated. ' + * 'Please use `kt config` to set up a template file')) */ } - /* "ktlib.pyx":360 + /* "src/ktlib.pyx":378 * * * with open(self.kt_config, 'r') as f: # <<<<<<<<<<<<<< * template_file = json.load(f) - * for k, template in template_file.items(): + * */ /*with:*/ { - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_v_self->__pyx_base.kt_config); + __Pyx_GIVEREF(__pyx_v_self->__pyx_base.kt_config); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->__pyx_base.kt_config); __Pyx_INCREF(__pyx_n_u_r); __Pyx_GIVEREF(__pyx_n_u_r); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_r); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L21_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L21_error) + __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_t_2; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_2; __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_16); + __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_13); /*try:*/ { - __pyx_v_f = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; - /* "ktlib.pyx":361 + /* "src/ktlib.pyx":379 * * with open(self.kt_config, 'r') as f: * template_file = json.load(f) # <<<<<<<<<<<<<< + * * for k, template in template_file.items(): - * if template.get('default', False): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_json); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L25_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L25_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_json); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L25_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_f); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L25_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_f); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_template_file, __pyx_t_4); - __pyx_t_4 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 379, __pyx_L25_error) + __Pyx_DECREF_SET(__pyx_v_template_file, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":360 + /* "src/ktlib.pyx":378 * * * with open(self.kt_config, 'r') as f: # <<<<<<<<<<<<<< * template_file = json.load(f) - * for k, template in template_file.items(): + * */ } - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L30_try_end; __pyx_L25_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Gen._gen_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 360, __pyx_L27_except_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.Gen._gen_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) __PYX_ERR(0, 378, __pyx_L27_except_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L27_except_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_5, NULL); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 360, __pyx_L27_except_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_17); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 360, __pyx_L27_except_error) - __pyx_t_18 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_18) { - __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L27_except_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_6, NULL); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 378, __pyx_L27_except_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_16); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (__pyx_t_10 < 0) __PYX_ERR(0, 378, __pyx_L27_except_error) + __pyx_t_17 = ((!(__pyx_t_10 != 0)) != 0); + if (__pyx_t_17) { + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_2, __pyx_t_1); - __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; - __PYX_ERR(0, 360, __pyx_L27_except_error) + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_4); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 378, __pyx_L27_except_error) } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L26_exception_handled; } __pyx_L27_except_error:; - __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13); goto __pyx_L1_error; __pyx_L26_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13); __pyx_L30_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_13) { - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__8, NULL); + if (__pyx_t_12) { + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } goto __pyx_L24; } @@ -7360,282 +7509,301 @@ static PyObject *__pyx_f_5ktlib_3Gen__gen_samples(struct __pyx_obj_5ktlib_Gen *_ } goto __pyx_L34; __pyx_L21_error:; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L1_error; __pyx_L34:; } - /* "ktlib.pyx":362 - * with open(self.kt_config, 'r') as f: + /* "src/ktlib.pyx":381 * template_file = json.load(f) + * * for k, template in template_file.items(): # <<<<<<<<<<<<<< * if template.get('default', False): * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') */ - __pyx_t_9 = 0; + __pyx_t_7 = 0; if (unlikely(__pyx_v_template_file == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 362, __pyx_L1_error) + __PYX_ERR(0, 381, __pyx_L1_error) } - __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_template_file, 0, __pyx_n_s_items, (&__pyx_t_20), (&__pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error) + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_template_file, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_2; + __Pyx_XDECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_2; __pyx_t_2 = 0; while (1) { - __pyx_t_21 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_20, &__pyx_t_9, &__pyx_t_2, &__pyx_t_4, NULL, __pyx_t_7); - if (unlikely(__pyx_t_21 == 0)) break; - if (unlikely(__pyx_t_21 == -1)) __PYX_ERR(0, 362, __pyx_L1_error) + __pyx_t_19 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_8, &__pyx_t_7, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_5); + if (unlikely(__pyx_t_19 == 0)) break; + if (unlikely(__pyx_t_19 == -1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 381, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_template, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_template, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":363 - * template_file = json.load(f) + /* "src/ktlib.pyx":382 + * * for k, template in template_file.items(): * if template.get('default', False): # <<<<<<<<<<<<<< * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') - * print(color_green(b'Template file has been generated')) + * log(color_green('Template file has been generated')) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_template, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_18) { + if (unlikely(__pyx_v_template == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 382, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_template, __pyx_n_u_default, Py_False); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_17) { - /* "ktlib.pyx":364 + /* "src/ktlib.pyx":383 * for k, template in template_file.items(): * if template.get('default', False): * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') # <<<<<<<<<<<<<< - * print(color_green(b'Template file has been generated')) + * log(color_green('Template file has been generated')) * return */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_shutil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copyfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_template, __pyx_n_s_get); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_n_u_path) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_n_u_path); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_22 = 0; - __pyx_t_19 = 127; - __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_19 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_19) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_19; - __pyx_t_22 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_22 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_kp_u__6); - __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_19 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_19) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_19; - __pyx_t_22 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u__16); - __pyx_t_22 += 1; - __Pyx_GIVEREF(__pyx_kp_u__16); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_kp_u__16); - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_extension); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_23, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_19 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_19) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_19; - __pyx_t_22 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, __pyx_t_22, __pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_shutil); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copyfile); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_v_template == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 383, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_template, __pyx_n_u_path, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = 0; + __pyx_t_18 = 127; + __pyx_t_21 = __Pyx_PyUnicode_Unicode(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) : __pyx_t_18; + __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_21); __pyx_t_21 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_kp_u__4); + __pyx_t_20 += 1; + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__4); + __pyx_t_21 = __Pyx_PyUnicode_Unicode(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) : __pyx_t_18; + __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_21); + __pyx_t_21 = 0; + __Pyx_INCREF(__pyx_kp_u__15); + __pyx_t_20 += 1; + __Pyx_GIVEREF(__pyx_kp_u__15); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__15); + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 383, __pyx_L1_error) + } + __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_3src_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_extension); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyObject_FormatSimple(__pyx_t_22, __pyx_empty_unicode); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) : __pyx_t_18; + __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_21); + __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_20, __pyx_t_18); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_19 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_21 = 1; + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_19 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_4, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_21, 2+__pyx_t_21); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_2, __pyx_t_21}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_4, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_21, 2+__pyx_t_21); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_2, __pyx_t_21}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } else #endif { - __pyx_t_23 = PyTuple_New(2+__pyx_t_21); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_8); __pyx_t_8 = NULL; + __pyx_t_22 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_1); __pyx_t_1 = NULL; } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_21, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_21, __pyx_t_6); - __pyx_t_4 = 0; - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_19, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_19, __pyx_t_21); + __pyx_t_2 = 0; + __pyx_t_21 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":365 + /* "src/ktlib.pyx":384 * if template.get('default', False): * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') - * print(color_green(b'Template file has been generated')) # <<<<<<<<<<<<<< + * log(color_green('Template file has been generated')) # <<<<<<<<<<<<<< * return - * print(color_red(f'No default template detected in {self.kt_config}')) + * log(color_red(f'No default template detected in {self.kt_config}')) */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_Template_file_has_been_generated, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_22 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_Template_file_has_been_generated, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_21 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_21)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_21); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_3 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_21, __pyx_t_22) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_22); + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":366 + /* "src/ktlib.pyx":385 * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') - * print(color_green(b'Template file has been generated')) + * log(color_green('Template file has been generated')) * return # <<<<<<<<<<<<<< - * print(color_red(f'No default template detected in {self.kt_config}')) + * log(color_red(f'No default template detected in {self.kt_config}')) * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; - /* "ktlib.pyx":363 - * template_file = json.load(f) + /* "src/ktlib.pyx":382 + * * for k, template in template_file.items(): * if template.get('default', False): # <<<<<<<<<<<<<< * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') - * print(color_green(b'Template file has been generated')) + * log(color_green('Template file has been generated')) */ } } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":367 - * print(color_green(b'Template file has been generated')) + /* "src/ktlib.pyx":386 + * log(color_green('Template file has been generated')) * return - * print(color_red(f'No default template detected in {self.kt_config}')) # <<<<<<<<<<<<<< - * + * log(color_red(f'No default template detected in {self.kt_config}')) # <<<<<<<<<<<<<< * + * cdef void _act(self) except *: */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_No_default_template_detected_in, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_t_3, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_self->__pyx_base.kt_config, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_22 = __Pyx_PyUnicode_Concat(__pyx_kp_u_No_default_template_detected_in, __pyx_t_6); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_f_3src_5ktlib_color_red(((PyObject*)__pyx_t_22), 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_4 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_22, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":312 + /* "src/ktlib.pyx":327 + * self._url = '' * - * - * cdef _gen_samples(self): # <<<<<<<<<<<<<< + * cdef void _gen_samples(self) except *: # <<<<<<<<<<<<<< * ''' Generate sample input file for `self._problem_id` * The basic flow is to scrape the problem task page and retrieve the relevent fields */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_AddTraceback("ktlib.Gen._gen_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_AddTraceback("src.ktlib.Gen._gen_samples", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; + __Pyx_XDECREF(__pyx_v_domain); __Pyx_XDECREF(__pyx_v_template_file); __Pyx_XDECREF(__pyx_v_sample_data); - __Pyx_XDECREF(__pyx_v_page); - __Pyx_XDECREF(__pyx_v_soup); __Pyx_XDECREF(__pyx_v_data); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_executor); - __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_soup); + __Pyx_XDECREF(__pyx_v_page); __Pyx_XDECREF(__pyx_v_k); __Pyx_XDECREF(__pyx_v_template); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_executor); + __Pyx_XDECREF(__pyx_v_f); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":371 +/* "src/ktlib.pyx":388 + * log(color_red(f'No default template detected in {self.kt_config}')) * - * - * cdef _act(self): # <<<<<<<<<<<<<< - * print(f'Problem is {self._problem_id}') - * os.makedirs(self._problem_id, exist_ok=True) + * cdef void _act(self) except *: # <<<<<<<<<<<<<< + * log(f'Problem is {self._problem_id}') + * cdef object problem_dir = Path.cwd() / self._problem_id */ -static PyObject *__pyx_f_5ktlib_3Gen__act(struct __pyx_obj_5ktlib_Gen *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_f_3src_5ktlib_3Gen__act(struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self) { + PyObject *__pyx_v_problem_dir = 0; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -7643,85 +7811,118 @@ static PyObject *__pyx_f_5ktlib_3Gen__act(struct __pyx_obj_5ktlib_Gen *__pyx_v_s PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":372 + /* "src/ktlib.pyx":389 * - * cdef _act(self): - * print(f'Problem is {self._problem_id}') # <<<<<<<<<<<<<< - * os.makedirs(self._problem_id, exist_ok=True) - * self._gen_samples() + * cdef void _act(self) except *: + * log(f'Problem is {self._problem_id}') # <<<<<<<<<<<<<< + * cdef object problem_dir = Path.cwd() / self._problem_id + * problem_dir.mkdir(parents=True, exist_ok=True) */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Problem_is, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Problem_is, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":373 - * cdef _act(self): - * print(f'Problem is {self._problem_id}') - * os.makedirs(self._problem_id, exist_ok=True) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":390 + * cdef void _act(self) except *: + * log(f'Problem is {self._problem_id}') + * cdef object problem_dir = Path.cwd() / self._problem_id # <<<<<<<<<<<<<< + * problem_dir.mkdir(parents=True, exist_ok=True) * self._gen_samples() - * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_makedirs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_problem_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exist_ok, Py_True) < 0) __PYX_ERR(0, 373, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cwd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_self->_problem_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_problem_dir = __pyx_t_4; + __pyx_t_4 = 0; - /* "ktlib.pyx":374 - * print(f'Problem is {self._problem_id}') - * os.makedirs(self._problem_id, exist_ok=True) - * self._gen_samples() # <<<<<<<<<<<<<< - * + /* "src/ktlib.pyx":391 + * log(f'Problem is {self._problem_id}') + * cdef object problem_dir = Path.cwd() / self._problem_id + * problem_dir.mkdir(parents=True, exist_ok=True) # <<<<<<<<<<<<<< + * self._gen_samples() * */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5ktlib_Gen *)__pyx_v_self->__pyx_base.__pyx_vtab)->_gen_samples(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_problem_dir, __pyx_n_s_mkdir); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_parents, Py_True) < 0) __PYX_ERR(0, 391, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exist_ok, Py_True) < 0) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":371 + /* "src/ktlib.pyx":392 + * cdef object problem_dir = Path.cwd() / self._problem_id + * problem_dir.mkdir(parents=True, exist_ok=True) + * self._gen_samples() # <<<<<<<<<<<<<< * * - * cdef _act(self): # <<<<<<<<<<<<<< - * print(f'Problem is {self._problem_id}') - * os.makedirs(self._problem_id, exist_ok=True) + */ + __pyx_f_3src_5ktlib_3Gen__gen_samples(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) + + /* "src/ktlib.pyx":388 + * log(color_red(f'No default template detected in {self.kt_config}')) + * + * cdef void _act(self) except *: # <<<<<<<<<<<<<< + * log(f'Problem is {self._problem_id}') + * cdef object problem_dir = Path.cwd() / self._problem_id */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("ktlib.Gen._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("src.ktlib.Gen._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_problem_dir); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "(tree fragment)":1 @@ -7731,19 +7932,19 @@ static PyObject *__pyx_f_5ktlib_3Gen__act(struct __pyx_obj_5ktlib_Gen *__pyx_v_s */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_3Gen_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_3Gen_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_3Gen_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_3Gen_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_3Gen_2__reduce_cython__(((struct __pyx_obj_5ktlib_Gen *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_3Gen_2__reduce_cython__(((struct __pyx_obj_3src_5ktlib_Gen *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Gen *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7755,7 +7956,7 @@ static PyObject *__pyx_pf_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __ * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7770,7 +7971,7 @@ static PyObject *__pyx_pf_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Gen.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Gen.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -7785,19 +7986,19 @@ static PyObject *__pyx_pf_5ktlib_3Gen_2__reduce_cython__(CYTHON_UNUSED struct __ */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_3Gen_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_3Gen_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_3Gen_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_3Gen_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_3Gen_4__setstate_cython__(((struct __pyx_obj_5ktlib_Gen *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_3Gen_4__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Gen *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_3Gen_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Gen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_3Gen_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Gen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7808,7 +8009,7 @@ static PyObject *__pyx_pf_5ktlib_3Gen_4__setstate_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7824,288 +8025,577 @@ static PyObject *__pyx_pf_5ktlib_3Gen_4__setstate_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Gen.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Gen.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":377 +/* "src/ktlib.pyx":395 * * - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil: # <<<<<<<<<<<<<< + * cdef tuple compare_entity(str lhs, str rhs): # <<<<<<<<<<<<<< * if lhs == rhs: - * diff.append(lhs) + * return True, f'{lhs} ' */ -static bool __pyx_f_5ktlib_compare_entity(std::string const &__pyx_v_lhs, std::string const &__pyx_v_rhs, std::string &__pyx_v_diff) { - bool __pyx_r; +static PyObject *__pyx_f_3src_5ktlib_compare_entity(PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("compare_entity", 0); - /* "ktlib.pyx":378 + /* "src/ktlib.pyx":396 * - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil: + * cdef tuple compare_entity(str lhs, str rhs): * if lhs == rhs: # <<<<<<<<<<<<<< - * diff.append(lhs) - * diff.push_back(b' ') - */ - __pyx_t_1 = ((__pyx_v_lhs == __pyx_v_rhs) != 0); - if (__pyx_t_1) { - - /* "ktlib.pyx":379 - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil: - * if lhs == rhs: - * diff.append(lhs) # <<<<<<<<<<<<<< - * diff.push_back(b' ') - * return True + * return True, f'{lhs} ' + * return False, f'{color_red(lhs)}{color_green(rhs)} ' */ - (void)(__pyx_v_diff.append(__pyx_v_lhs)); + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_lhs, __pyx_v_rhs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 396, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "ktlib.pyx":380 + /* "src/ktlib.pyx":397 + * cdef tuple compare_entity(str lhs, str rhs): * if lhs == rhs: - * diff.append(lhs) - * diff.push_back(b' ') # <<<<<<<<<<<<<< - * return True - * diff.append(color_red(lhs)) - */ - __pyx_v_diff.push_back(' '); - - /* "ktlib.pyx":381 - * diff.append(lhs) - * diff.push_back(b' ') - * return True # <<<<<<<<<<<<<< - * diff.append(color_red(lhs)) - * diff.append(color_green(rhs)) + * return True, f'{lhs} ' # <<<<<<<<<<<<<< + * return False, f'{color_red(lhs)}{color_green(rhs)} ' + * */ - __pyx_r = 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_lhs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_3, __pyx_kp_u__18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_True); + __Pyx_GIVEREF(Py_True); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_True); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "ktlib.pyx":378 + /* "src/ktlib.pyx":396 * - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil: + * cdef tuple compare_entity(str lhs, str rhs): * if lhs == rhs: # <<<<<<<<<<<<<< - * diff.append(lhs) - * diff.push_back(b' ') + * return True, f'{lhs} ' + * return False, f'{color_red(lhs)}{color_green(rhs)} ' */ } - /* "ktlib.pyx":382 - * diff.push_back(b' ') - * return True - * diff.append(color_red(lhs)) # <<<<<<<<<<<<<< - * diff.append(color_green(rhs)) - * diff.push_back(b' ') - */ - (void)(__pyx_v_diff.append(__pyx_f_5ktlib_color_red(__pyx_v_lhs, 0))); - - /* "ktlib.pyx":383 - * return True - * diff.append(color_red(lhs)) - * diff.append(color_green(rhs)) # <<<<<<<<<<<<<< - * diff.push_back(b' ') - * return False - */ - (void)(__pyx_v_diff.append(__pyx_f_5ktlib_color_green(__pyx_v_rhs, 0))); - - /* "ktlib.pyx":384 - * diff.append(color_red(lhs)) - * diff.append(color_green(rhs)) - * diff.push_back(b' ') # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_v_diff.push_back(' '); - - /* "ktlib.pyx":385 - * diff.append(color_green(rhs)) - * diff.push_back(b' ') - * return False # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":398 + * if lhs == rhs: + * return True, f'{lhs} ' + * return False, f'{color_red(lhs)}{color_green(rhs)} ' # <<<<<<<<<<<<<< * * */ - __pyx_r = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __pyx_t_4 = __pyx_f_3src_5ktlib_color_red(__pyx_v_lhs, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __pyx_f_3src_5ktlib_color_green(__pyx_v_rhs, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__18); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__18); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__18); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_False); + __Pyx_GIVEREF(Py_False); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_False); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "ktlib.pyx":377 + /* "src/ktlib.pyx":395 * * - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil: # <<<<<<<<<<<<<< + * cdef tuple compare_entity(str lhs, str rhs): # <<<<<<<<<<<<<< * if lhs == rhs: - * diff.append(lhs) + * return True, f'{lhs} ' */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("src.ktlib.compare_entity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":389 +/* "src/ktlib.pyx":408 + * str file_name #Path * - * cdef class Test(Action): - * cdef detect_file_name(self): # <<<<<<<<<<<<<< - * ''' Confirm the executable file if there is multiple files that are runnable in current folder - * ''' + * def __cinit__(self, str problem_id, str ext, object file_name): # <<<<<<<<<<<<<< + * self.problem_id = problem_id + * self.ext = ext */ -static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_Test *__pyx_v_self) { - PyObject *__pyx_v_existed_templates = 0; - PyObject *__pyx_v_acceptable_file_ext = 0; - std::string __pyx_v_alias; - std::string __pyx_v_res; - int __pyx_v_opt; - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_k = NULL; - CYTHON_UNUSED PyObject *__pyx_v_v = NULL; - PyObject *__pyx_v_files = NULL; - PyObject *__pyx_v_runnable_files = NULL; - PyObject *__pyx_v_parts = NULL; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_7genexpr__pyx_v_f = NULL; - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static int __pyx_pw_3src_5ktlib_12RunnableFile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3src_5ktlib_12RunnableFile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_problem_id = 0; + PyObject *__pyx_v_ext = 0; + PyObject *__pyx_v_file_name = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - PyObject *(*__pyx_t_16)(PyObject *); - PyObject *__pyx_t_17 = NULL; - int __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_UCS4 __pyx_t_21; - std::string __pyx_t_22; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = NULL; - __Pyx_RefNannySetupContext("detect_file_name", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_problem_id,&__pyx_n_s_ext,&__pyx_n_s_file_name,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_problem_id)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ext)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 408, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_name)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 408, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 408, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_problem_id = ((PyObject*)values[0]); + __pyx_v_ext = ((PyObject*)values[1]); + __pyx_v_file_name = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 408, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("src.ktlib.RunnableFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_problem_id), (&PyUnicode_Type), 1, "problem_id", 1))) __PYX_ERR(0, 408, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ext), (&PyUnicode_Type), 1, "ext", 1))) __PYX_ERR(0, 408, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_12RunnableFile___cinit__(((struct __pyx_obj_3src_5ktlib_RunnableFile *)__pyx_v_self), __pyx_v_problem_id, __pyx_v_ext, __pyx_v_file_name); - /* "ktlib.pyx":393 - * ''' - * cdef: - * object existed_templates = {} # <<<<<<<<<<<<<< - * object acceptable_file_ext = {} - * string alias - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_existed_templates = __pyx_t_1; - __pyx_t_1 = 0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "ktlib.pyx":394 - * cdef: - * object existed_templates = {} - * object acceptable_file_ext = {} # <<<<<<<<<<<<<< - * string alias - * string res - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_acceptable_file_ext = __pyx_t_1; - __pyx_t_1 = 0; +static int __pyx_pf_3src_5ktlib_12RunnableFile___cinit__(struct __pyx_obj_3src_5ktlib_RunnableFile *__pyx_v_self, PyObject *__pyx_v_problem_id, PyObject *__pyx_v_ext, PyObject *__pyx_v_file_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "ktlib.pyx":397 - * string alias - * string res - * int opt = 0 # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":409 * - * with open(self.kt_config) as f: + * def __cinit__(self, str problem_id, str ext, object file_name): + * self.problem_id = problem_id # <<<<<<<<<<<<<< + * self.ext = ext + * self.file_name = file_name */ - __pyx_v_opt = 0; + __Pyx_INCREF(__pyx_v_problem_id); + __Pyx_GIVEREF(__pyx_v_problem_id); + __Pyx_GOTREF(__pyx_v_self->problem_id); + __Pyx_DECREF(__pyx_v_self->problem_id); + __pyx_v_self->problem_id = __pyx_v_problem_id; - /* "ktlib.pyx":399 - * int opt = 0 - * - * with open(self.kt_config) as f: # <<<<<<<<<<<<<< - * existed_templates = json.load(f) + /* "src/ktlib.pyx":410 + * def __cinit__(self, str problem_id, str ext, object file_name): + * self.problem_id = problem_id + * self.ext = ext # <<<<<<<<<<<<<< + * self.file_name = file_name * */ - /*with:*/ { - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { - __pyx_v_f = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_v_ext); + __Pyx_GIVEREF(__pyx_v_ext); + __Pyx_GOTREF(__pyx_v_self->ext); + __Pyx_DECREF(__pyx_v_self->ext); + __pyx_v_self->ext = __pyx_v_ext; - /* "ktlib.pyx":400 + /* "src/ktlib.pyx":411 + * self.problem_id = problem_id + * self.ext = ext + * self.file_name = file_name # <<<<<<<<<<<<<< * - * with open(self.kt_config) as f: - * existed_templates = json.load(f) # <<<<<<<<<<<<<< * - * for k, v in existed_templates.items(): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_f); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_existed_templates, __pyx_t_4); - __pyx_t_4 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_v_file_name))||((__pyx_v_file_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_file_name)->tp_name), 0))) __PYX_ERR(0, 411, __pyx_L1_error) + __pyx_t_1 = __pyx_v_file_name; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->file_name); + __Pyx_DECREF(__pyx_v_self->file_name); + __pyx_v_self->file_name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":399 - * int opt = 0 + /* "src/ktlib.pyx":408 + * str file_name #Path * - * with open(self.kt_config) as f: # <<<<<<<<<<<<<< - * existed_templates = json.load(f) + * def __cinit__(self, str problem_id, str ext, object file_name): # <<<<<<<<<<<<<< + * self.problem_id = problem_id + * self.ext = ext + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.RunnableFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_3src_5ktlib_12RunnableFile_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_12RunnableFile_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_3src_5ktlib_12RunnableFile_2__reduce_cython__(((struct __pyx_obj_3src_5ktlib_RunnableFile *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3src_5ktlib_12RunnableFile_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_RunnableFile *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.RunnableFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_3src_5ktlib_12RunnableFile_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_12RunnableFile_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_3src_5ktlib_12RunnableFile_4__setstate_cython__(((struct __pyx_obj_3src_5ktlib_RunnableFile *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3src_5ktlib_12RunnableFile_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_RunnableFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.RunnableFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "src/ktlib.pyx":423 + * str lang + * + * cdef void detect_file_name(self) except *: # <<<<<<<<<<<<<< + * ''' Confirm the executable file if there is multiple files that are runnable in current folder + * ''' + */ + +static void __pyx_f_3src_5ktlib_4Test_detect_file_name(struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self) { + PyObject *__pyx_v_existed_templates = 0; + PyObject *__pyx_v_acceptable_file_ext = 0; + PyObject *__pyx_v_alias = 0; + int __pyx_v_opt; + PyObject *__pyx_v_parts = 0; + PyObject *__pyx_v_runnable_files = 0; + PyObject *__pyx_v_files = 0; + size_t __pyx_v_i; + PyObject *__pyx_v_k = 0; + PyObject *__pyx_v_f = 0; + PyObject *__pyx_7genexpr__pyx_v_x = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + PyObject *(*__pyx_t_17)(PyObject *); + int __pyx_t_18; + size_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_UCS4 __pyx_t_21; + __Pyx_RefNannySetupContext("detect_file_name", 0); + + /* "src/ktlib.pyx":427 + * ''' + * cdef: + * dict existed_templates = {} # <<<<<<<<<<<<<< + * dict acceptable_file_ext = {} + * str alias + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_existed_templates = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":428 + * cdef: + * dict existed_templates = {} + * dict acceptable_file_ext = {} # <<<<<<<<<<<<<< + * str alias + * str res + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_acceptable_file_ext = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":431 + * str alias + * str res + * int opt = 0 # <<<<<<<<<<<<<< + * list parts + * list runnable_files + */ + __pyx_v_opt = 0; + + /* "src/ktlib.pyx":435 + * list runnable_files + * list files + * size_t i = 0 # <<<<<<<<<<<<<< + * str k + * object x, f + */ + __pyx_v_i = 0; + + /* "src/ktlib.pyx":439 + * object x, f + * + * with open(self.kt_config) as f: # <<<<<<<<<<<<<< + * existed_templates = json.load(f) + * + */ + /*with:*/ { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { + __pyx_v_f = __pyx_t_4; + __pyx_t_4 = 0; + + /* "src/ktlib.pyx":440 + * + * with open(self.kt_config) as f: + * existed_templates = json.load(f) # <<<<<<<<<<<<<< + * + * for k in existed_templates.keys(): + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_json); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_f); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 440, __pyx_L7_error) + __Pyx_DECREF_SET(__pyx_v_existed_templates, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "src/ktlib.pyx":439 + * object x, f + * + * with open(self.kt_config) as f: # <<<<<<<<<<<<<< + * existed_templates = json.load(f) * */ } @@ -8115,37 +8605,37 @@ static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_T goto __pyx_L12_try_end; __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Test.detect_file_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 399, __pyx_L9_except_error) + __Pyx_AddTraceback("src.ktlib.Test.detect_file_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 439, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 399, __pyx_L9_except_error) + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 439, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 399, __pyx_L9_except_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 439, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_10 < 0) __PYX_ERR(0, 399, __pyx_L9_except_error) + if (__pyx_t_10 < 0) __PYX_ERR(0, 439, __pyx_L9_except_error) __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_2); - __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 399, __pyx_L9_except_error) + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_3, __pyx_t_1); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 439, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L8_exception_handled; } __pyx_L9_except_error:; @@ -8164,10 +8654,10 @@ static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_T } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_3) { - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 399, __pyx_L1_error) + if (__pyx_t_2) { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -8177,343 +8667,379 @@ static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_T } goto __pyx_L16; __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L1_error; __pyx_L16:; } - /* "ktlib.pyx":402 + /* "src/ktlib.pyx":442 * existed_templates = json.load(f) * - * for k, v in existed_templates.items(): # <<<<<<<<<<<<<< + * for k in existed_templates.keys(): # <<<<<<<<<<<<<< * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] * */ __pyx_t_12 = 0; if (unlikely(__pyx_v_existed_templates == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 402, __pyx_L1_error) + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys"); + __PYX_ERR(0, 442, __pyx_L1_error) } - __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_existed_templates, 0, __pyx_n_s_items, (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_existed_templates, 1, __pyx_n_s_keys, (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; while (1) { - __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_13, &__pyx_t_12, &__pyx_t_1, &__pyx_t_4, NULL, __pyx_t_14); + __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_13, &__pyx_t_12, &__pyx_t_3, NULL, NULL, __pyx_t_14); if (unlikely(__pyx_t_15 == 0)) break; - if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4); - __pyx_t_4 = 0; + if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":403 + /* "src/ktlib.pyx":443 * - * for k, v in existed_templates.items(): + * for k in existed_templates.keys(): * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] # <<<<<<<<<<<<<< * - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + * files = [x for x in Path('.').iterdir() if x.is_file()] */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error) + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 443, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_3src_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 443, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_3src_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_extension); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_extension); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_acceptable_file_ext, __pyx_t_5, __pyx_t_4) < 0)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_acceptable_file_ext, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":405 + /* "src/ktlib.pyx":445 * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] * - * files = [f for f in os.listdir('.') if os.path.isfile(f)] # <<<<<<<<<<<<<< + * files = [x for x in Path('.').iterdir() if x.is_file()] # <<<<<<<<<<<<<< * runnable_files = [] * for f in files: */ { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_listdir); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L21_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_16)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_kp_u__15) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__15); + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_iterdir); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_kp_u__16) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u__16); + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; - __pyx_t_16 = NULL; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0; + __pyx_t_17 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 405, __pyx_L21_error) + __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_17 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 445, __pyx_L21_error) } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 405, __pyx_L21_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 445, __pyx_L21_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_3); #endif } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 405, __pyx_L21_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 445, __pyx_L21_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_3); #endif } } else { - __pyx_t_4 = __pyx_t_16(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { + __pyx_t_3 = __pyx_t_17(__pyx_t_4); + if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 405, __pyx_L21_error) + else __PYX_ERR(0, 445, __pyx_L21_error) } break; } - __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); } - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_f, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_isfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L21_error) + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_x, __pyx_n_s_is_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = NULL; + __pyx_t_16 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_17)) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_16)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_4 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_17, __pyx_7genexpr__pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_7genexpr__pyx_v_f); - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 405, __pyx_L21_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 445, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_11) { - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_f))) __PYX_ERR(0, 405, __pyx_L21_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_x))) __PYX_ERR(0, 445, __pyx_L21_error) } } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_f); __pyx_7genexpr__pyx_v_f = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0; goto __pyx_L25_exit_scope; __pyx_L21_error:; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_f); __pyx_7genexpr__pyx_v_f = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0; goto __pyx_L1_error; __pyx_L25_exit_scope:; } /* exit inner scope */ - __pyx_v_files = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_files = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":406 + /* "src/ktlib.pyx":446 * - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + * files = [x for x in Path('.').iterdir() if x.is_file()] * runnable_files = [] # <<<<<<<<<<<<<< * for f in files: - * parts = f.split('.') + * parts = str(f).split('.') */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_runnable_files = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_runnable_files = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":407 - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + /* "src/ktlib.pyx":447 + * files = [x for x in Path('.').iterdir() if x.is_file()] * runnable_files = [] * for f in files: # <<<<<<<<<<<<<< - * parts = f.split('.') + * parts = str(f).split('.') * if len(parts) <= 1: */ - __pyx_t_2 = __pyx_v_files; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0; + __pyx_t_1 = __pyx_v_files; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; for (;;) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 447, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); #endif - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":408 + /* "src/ktlib.pyx":448 * runnable_files = [] * for f in files: - * parts = f.split('.') # <<<<<<<<<<<<<< + * parts = str(f).split('.') # <<<<<<<<<<<<<< * if len(parts) <= 1: * continue */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__16) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__16); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyUnicode_Split(((PyObject*)__pyx_t_4), __pyx_kp_u__15, -1L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_parts, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_parts, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":409 + /* "src/ktlib.pyx":449 * for f in files: - * parts = f.split('.') + * parts = str(f).split('.') * if len(parts) <= 1: # <<<<<<<<<<<<<< * continue - * if parts[1] in acceptable_file_ext: + * if parts[1] in acceptable_file_ext: */ - __pyx_t_12 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 409, __pyx_L1_error) + if (unlikely(__pyx_v_parts == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 449, __pyx_L1_error) + } + __pyx_t_12 = PyList_GET_SIZE(__pyx_v_parts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 449, __pyx_L1_error) __pyx_t_11 = ((__pyx_t_12 <= 1) != 0); if (__pyx_t_11) { - /* "ktlib.pyx":410 - * parts = f.split('.') + /* "src/ktlib.pyx":450 + * parts = str(f).split('.') * if len(parts) <= 1: * continue # <<<<<<<<<<<<<< - * if parts[1] in acceptable_file_ext: - * runnable_files.append((parts[0], f, parts[1])) + * if parts[1] in acceptable_file_ext: + * runnable_files.append(RunnableFile( */ goto __pyx_L26_continue; - /* "ktlib.pyx":409 + /* "src/ktlib.pyx":449 * for f in files: - * parts = f.split('.') + * parts = str(f).split('.') * if len(parts) <= 1: # <<<<<<<<<<<<<< * continue - * if parts[1] in acceptable_file_ext: + * if parts[1] in acceptable_file_ext: */ } - /* "ktlib.pyx":411 + /* "src/ktlib.pyx":451 * if len(parts) <= 1: * continue - * if parts[1] in acceptable_file_ext: # <<<<<<<<<<<<<< - * runnable_files.append((parts[0], f, parts[1])) - * + * if parts[1] in acceptable_file_ext: # <<<<<<<<<<<<<< + * runnable_files.append(RunnableFile( + * problem_id=parts[0], */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_v_acceptable_file_ext, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_v_parts == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 451, __pyx_L1_error) + } + __pyx_t_11 = (__Pyx_PyDict_ContainsTF(PyList_GET_ITEM(__pyx_v_parts, 1), __pyx_v_acceptable_file_ext, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 451, __pyx_L1_error) __pyx_t_10 = (__pyx_t_11 != 0); if (__pyx_t_10) { - /* "ktlib.pyx":412 - * continue - * if parts[1] in acceptable_file_ext: - * runnable_files.append((parts[0], f, parts[1])) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":453 + * if parts[1] in acceptable_file_ext: + * runnable_files.append(RunnableFile( + * problem_id=parts[0], # <<<<<<<<<<<<<< + * ext=parts[1], + * file_name=str(f) + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_v_parts == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 453, __pyx_L1_error) + } + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_problem_id, PyList_GET_ITEM(__pyx_v_parts, 0)) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + + /* "src/ktlib.pyx":454 + * runnable_files.append(RunnableFile( + * problem_id=parts[0], + * ext=parts[1], # <<<<<<<<<<<<<< + * file_name=str(f) + * )) + */ + if (unlikely(__pyx_v_parts == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 454, __pyx_L1_error) + } + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ext, PyList_GET_ITEM(__pyx_v_parts, 1)) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + + /* "src/ktlib.pyx":455 + * problem_id=parts[0], + * ext=parts[1], + * file_name=str(f) # <<<<<<<<<<<<<< + * )) * - * if len(runnable_files) == 0: */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_f); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_runnable_files, __pyx_t_5); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_file_name, __pyx_t_4) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "src/ktlib.pyx":452 + * continue + * if parts[1] in acceptable_file_ext: + * runnable_files.append(RunnableFile( # <<<<<<<<<<<<<< + * problem_id=parts[0], + * ext=parts[1], + */ + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_3src_5ktlib_RunnableFile), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_runnable_files, __pyx_t_4); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":411 + /* "src/ktlib.pyx":451 * if len(parts) <= 1: * continue - * if parts[1] in acceptable_file_ext: # <<<<<<<<<<<<<< - * runnable_files.append((parts[0], f, parts[1])) - * + * if parts[1] in acceptable_file_ext: # <<<<<<<<<<<<<< + * runnable_files.append(RunnableFile( + * problem_id=parts[0], */ } - /* "ktlib.pyx":407 - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + /* "src/ktlib.pyx":447 + * files = [x for x in Path('.').iterdir() if x.is_file()] * runnable_files = [] * for f in files: # <<<<<<<<<<<<<< - * parts = f.split('.') + * parts = str(f).split('.') * if len(parts) <= 1: */ __pyx_L26_continue:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":414 - * runnable_files.append((parts[0], f, parts[1])) + /* "src/ktlib.pyx":458 + * )) * * if len(runnable_files) == 0: # <<<<<<<<<<<<<< * raise RuntimeError('Not executable code file detected') * */ - __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 458, __pyx_L1_error) __pyx_t_10 = ((__pyx_t_13 == 0) != 0); if (unlikely(__pyx_t_10)) { - /* "ktlib.pyx":415 + /* "src/ktlib.pyx":459 * * if len(runnable_files) == 0: * raise RuntimeError('Not executable code file detected') # <<<<<<<<<<<<<< * * if len(runnable_files) > 1: */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 415, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 459, __pyx_L1_error) - /* "ktlib.pyx":414 - * runnable_files.append((parts[0], f, parts[1])) + /* "src/ktlib.pyx":458 + * )) * * if len(runnable_files) == 0: # <<<<<<<<<<<<<< * raise RuntimeError('Not executable code file detected') @@ -8521,119 +9047,136 @@ static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_T */ } - /* "ktlib.pyx":417 + /* "src/ktlib.pyx":461 * raise RuntimeError('Not executable code file detected') * * if len(runnable_files) > 1: # <<<<<<<<<<<<<< - * print(color_cyan(b'Choose a file to run')) + * log(color_cyan('Choose a file to run')) * for i in range(len(runnable_files)): */ - __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 461, __pyx_L1_error) __pyx_t_10 = ((__pyx_t_13 > 1) != 0); if (__pyx_t_10) { - /* "ktlib.pyx":418 + /* "src/ktlib.pyx":462 * * if len(runnable_files) > 1: - * print(color_cyan(b'Choose a file to run')) # <<<<<<<<<<<<<< + * log(color_cyan('Choose a file to run')) # <<<<<<<<<<<<<< * for i in range(len(runnable_files)): - * print(f' {i}: {runnable_files[i][1]}') + * log(f' {i}: {runnable_files[i].file_name}') */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_k_Choose_a_file_to_run, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_f_3src_5ktlib_color_cyan(__pyx_kp_u_Choose_a_file_to_run, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":419 + /* "src/ktlib.pyx":463 * if len(runnable_files) > 1: - * print(color_cyan(b'Choose a file to run')) + * log(color_cyan('Choose a file to run')) * for i in range(len(runnable_files)): # <<<<<<<<<<<<<< - * print(f' {i}: {runnable_files[i][1]}') - * res = input() + * log(f' {i}: {runnable_files[i].file_name}') + * opt = int(input()) */ - __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 463, __pyx_L1_error) __pyx_t_12 = __pyx_t_13; for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_12; __pyx_t_19+=1) { __pyx_v_i = __pyx_t_19; - /* "ktlib.pyx":420 - * print(color_cyan(b'Choose a file to run')) + /* "src/ktlib.pyx":464 + * log(color_cyan('Choose a file to run')) * for i in range(len(runnable_files)): - * print(f' {i}: {runnable_files[i][1]}') # <<<<<<<<<<<<<< - * res = input() - * opt = int(res) + * log(f' {i}: {runnable_files[i].file_name}') # <<<<<<<<<<<<<< + * opt = int(input()) + * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' */ - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_20 = 0; __pyx_t_21 = 127; - __Pyx_INCREF(__pyx_kp_u__20); + __Pyx_INCREF(__pyx_kp_u__22); __pyx_t_20 += 2; - __Pyx_GIVEREF(__pyx_kp_u__20); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u__20); - __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_kp_u__21); + __Pyx_GIVEREF(__pyx_kp_u__22); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u__22); + __pyx_t_5 = __Pyx_PyUnicode_From_size_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__23); __pyx_t_20 += 2; - __Pyx_GIVEREF(__pyx_kp_u__21); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__21); - __pyx_t_2 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_i), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_21 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_21) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_21; - __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_kp_u__23); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__23); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_i), __pyx_n_s_file_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_21 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) > __pyx_t_21) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) : __pyx_t_21; + __pyx_t_20 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_16); + __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_16); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "ktlib.pyx":421 + /* "src/ktlib.pyx":465 * for i in range(len(runnable_files)): - * print(f' {i}: {runnable_files[i][1]}') - * res = input() # <<<<<<<<<<<<<< - * opt = int(res) - * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' - */ - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 421, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_res = __pyx_t_22; - - /* "ktlib.pyx":422 - * print(f' {i}: {runnable_files[i][1]}') - * res = input() - * opt = int(res) # <<<<<<<<<<<<<< + * log(f' {i}: {runnable_files[i].file_name}') + * opt = int(input()) # <<<<<<<<<<<<<< * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' * */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_opt = __pyx_t_14; - /* "ktlib.pyx":423 - * res = input() - * opt = int(res) + /* "src/ktlib.pyx":466 + * log(f' {i}: {runnable_files[i].file_name}') + * opt = int(input()) * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' # <<<<<<<<<<<<<< * * @@ -8642,440 +9185,304 @@ static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_T if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = (0 <= __pyx_v_opt); if (__pyx_t_10) { - __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_13 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 466, __pyx_L1_error) __pyx_t_10 = (__pyx_v_opt < __pyx_t_13); } if (unlikely(!(__pyx_t_10 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Invalid_option_chosen); - __PYX_ERR(0, 423, __pyx_L1_error) + __PYX_ERR(0, 466, __pyx_L1_error) } } #endif - /* "ktlib.pyx":417 + /* "src/ktlib.pyx":461 * raise RuntimeError('Not executable code file detected') * * if len(runnable_files) > 1: # <<<<<<<<<<<<<< - * print(color_cyan(b'Choose a file to run')) + * log(color_cyan('Choose a file to run')) * for i in range(len(runnable_files)): */ } - /* "ktlib.pyx":426 + /* "src/ktlib.pyx":469 * * - * self.file_name = runnable_files[opt][0] # <<<<<<<<<<<<<< - * alias = acceptable_file_ext[runnable_files[opt][2]].alias - * self.lang = acceptable_file_ext[runnable_files[opt][2]].full_name + * self.file_name = runnable_files[opt].problem_id # <<<<<<<<<<<<<< + * alias = acceptable_file_ext[runnable_files[opt].ext].alias + * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name */ - __pyx_t_4 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_problem_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->file_name = __pyx_t_22; + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->file_name); + __Pyx_DECREF(__pyx_v_self->file_name); + __pyx_v_self->file_name = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":427 + /* "src/ktlib.pyx":470 * - * self.file_name = runnable_files[opt][0] - * alias = acceptable_file_ext[runnable_files[opt][2]].alias # <<<<<<<<<<<<<< - * self.lang = acceptable_file_ext[runnable_files[opt][2]].full_name + * self.file_name = runnable_files[opt].problem_id + * alias = acceptable_file_ext[runnable_files[opt].ext].alias # <<<<<<<<<<<<<< + * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name * self.pre_script = existed_templates.get(alias, {}).get('pre_script').replace('$%file%$', self.file_name) */ - __pyx_t_4 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_ext); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_acceptable_file_ext, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_acceptable_file_ext, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_alias); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_alias); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_alias = __pyx_t_22; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_v_alias = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":428 - * self.file_name = runnable_files[opt][0] - * alias = acceptable_file_ext[runnable_files[opt][2]].alias - * self.lang = acceptable_file_ext[runnable_files[opt][2]].full_name # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":471 + * self.file_name = runnable_files[opt].problem_id + * alias = acceptable_file_ext[runnable_files[opt].ext].alias + * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name # <<<<<<<<<<<<<< * self.pre_script = existed_templates.get(alias, {}).get('pre_script').replace('$%file%$', self.file_name) * self.script = existed_templates.get(alias, {}).get('script').replace('$%file%$', self.file_name) */ - __pyx_t_4 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_ext); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_acceptable_file_ext, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_acceptable_file_ext, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_full_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_full_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->lang = __pyx_t_22; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->lang); + __Pyx_DECREF(__pyx_v_self->lang); + __pyx_v_self->lang = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":429 - * alias = acceptable_file_ext[runnable_files[opt][2]].alias - * self.lang = acceptable_file_ext[runnable_files[opt][2]].full_name + /* "src/ktlib.pyx":472 + * alias = acceptable_file_ext[runnable_files[opt].ext].alias + * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name * self.pre_script = existed_templates.get(alias, {}).get('pre_script').replace('$%file%$', self.file_name) # <<<<<<<<<<<<<< * self.script = existed_templates.get(alias, {}).get('script').replace('$%file%$', self.file_name) * self.post_script = existed_templates.get(alias, {}).get('post_script').replace('$%file%$', self.file_name) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_existed_templates, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 472, __pyx_L1_error) + } + __pyx_t_16 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_existed_templates, __pyx_v_alias, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_16, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_3, __pyx_n_u_pre_script) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_n_u_pre_script); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_alias); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_23 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_replace); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_24)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_24); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_16, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_17, __pyx_t_23}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + if (PyFunction_Check(__pyx_t_16)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_file, __pyx_v_self->file_name}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_17, __pyx_t_23}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_file, __pyx_v_self->file_name}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_4); } else #endif { - __pyx_t_25 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - if (__pyx_t_24) { - __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_24); __pyx_t_24 = NULL; - } - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_14, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_14, __pyx_t_23); - __pyx_t_17 = 0; - __pyx_t_23 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_3 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL; + } + __Pyx_INCREF(__pyx_kp_u_file); + __Pyx_GIVEREF(__pyx_kp_u_file); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_14, __pyx_kp_u_file); + __Pyx_INCREF(__pyx_v_self->file_name); + __Pyx_GIVEREF(__pyx_v_self->file_name); + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_14, __pyx_v_self->file_name); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_n_u_pre_script) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_u_pre_script); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->file_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_file, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_file, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_25 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_INCREF(__pyx_kp_u_file); - __Pyx_GIVEREF(__pyx_kp_u_file); - PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_14, __pyx_kp_u_file); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_14, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_25, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->pre_script = __pyx_t_22; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->pre_script); + __Pyx_DECREF(__pyx_v_self->pre_script); + __pyx_v_self->pre_script = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":430 - * self.lang = acceptable_file_ext[runnable_files[opt][2]].full_name + /* "src/ktlib.pyx":473 + * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name * self.pre_script = existed_templates.get(alias, {}).get('pre_script').replace('$%file%$', self.file_name) * self.script = existed_templates.get(alias, {}).get('script').replace('$%file%$', self.file_name) # <<<<<<<<<<<<<< * self.post_script = existed_templates.get(alias, {}).get('post_script').replace('$%file%$', self.file_name) * */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_existed_templates, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_alias); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_23 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_17 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_2, __pyx_t_23}; - __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_2, __pyx_t_23}; - __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - } else - #endif - { - __pyx_t_24 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - if (__pyx_t_17) { - __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_17); __pyx_t_17 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_14, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_14, __pyx_t_23); - __pyx_t_2 = 0; - __pyx_t_23 = 0; - __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_24, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 473, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_25, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_25)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_25); + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_existed_templates, __pyx_v_alias, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_25) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_25, __pyx_n_u_script) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_script); - __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_replace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_25 = NULL; + __pyx_t_16 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_script) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_script); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = NULL; __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_25)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_25); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_16)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_25, __pyx_kp_u_file, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_kp_u_file, __pyx_v_self->file_name}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_25, __pyx_kp_u_file, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_kp_u_file, __pyx_v_self->file_name}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_24 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - if (__pyx_t_25) { - __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_25); __pyx_t_25 = NULL; + __pyx_t_1 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__pyx_t_16) { + __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_16); __pyx_t_16 = NULL; } __Pyx_INCREF(__pyx_kp_u_file); __Pyx_GIVEREF(__pyx_kp_u_file); - PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_14, __pyx_kp_u_file); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_14, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_14, __pyx_kp_u_file); + __Pyx_INCREF(__pyx_v_self->file_name); + __Pyx_GIVEREF(__pyx_v_self->file_name); + PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_14, __pyx_v_self->file_name); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 430, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->script = __pyx_t_22; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->script); + __Pyx_DECREF(__pyx_v_self->script); + __pyx_v_self->script = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":431 + /* "src/ktlib.pyx":474 * self.pre_script = existed_templates.get(alias, {}).get('pre_script').replace('$%file%$', self.file_name) * self.script = existed_templates.get(alias, {}).get('script').replace('$%file%$', self.file_name) * self.post_script = existed_templates.get(alias, {}).get('post_script').replace('$%file%$', self.file_name) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_existed_templates, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_25 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_alias); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __pyx_t_23 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_2 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_25, __pyx_t_23}; - __pyx_t_24 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_24); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_25, __pyx_t_23}; - __pyx_t_24 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_24); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - } else - #endif - { - __pyx_t_17 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_25); - PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_14, __pyx_t_25); - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_14, __pyx_t_23); - __pyx_t_25 = 0; - __pyx_t_23 = 0; - __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 474, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = __Pyx_PyDict_GetItemDefault(__pyx_v_existed_templates, __pyx_v_alias, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_24, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_24)) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_16)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_24); + __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_5 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_24, __pyx_n_u_post_script) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_u_post_script); - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_16, __pyx_n_u_post_script) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_u_post_script); + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->file_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; __pyx_t_14 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_24)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_24); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_14 = 1; @@ -9083,92 +9490,86 @@ static PyObject *__pyx_f_5ktlib_4Test_detect_file_name(struct __pyx_obj_5ktlib_T } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_kp_u_file, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_file, __pyx_v_self->file_name}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_kp_u_file, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_file, __pyx_v_self->file_name}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_17 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - if (__pyx_t_24) { - __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_24); __pyx_t_24 = NULL; + __pyx_t_16 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_u_file); __Pyx_GIVEREF(__pyx_kp_u_file); - PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_14, __pyx_kp_u_file); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_14, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_14, __pyx_kp_u_file); + __Pyx_INCREF(__pyx_v_self->file_name); + __Pyx_GIVEREF(__pyx_v_self->file_name); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_14, __pyx_v_self->file_name); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_22 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->post_script = __pyx_t_22; + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->post_script); + __Pyx_DECREF(__pyx_v_self->post_script); + __pyx_v_self->post_script = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":389 + /* "src/ktlib.pyx":423 + * str lang * - * cdef class Test(Action): - * cdef detect_file_name(self): # <<<<<<<<<<<<<< + * cdef void detect_file_name(self) except *: # <<<<<<<<<<<<<< * ''' Confirm the executable file if there is multiple files that are runnable in current folder * ''' */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_24); - __Pyx_XDECREF(__pyx_t_25); - __Pyx_AddTraceback("ktlib.Test.detect_file_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("src.ktlib.Test.detect_file_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_existed_templates); __Pyx_XDECREF(__pyx_v_acceptable_file_ext); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XDECREF(__pyx_v_v); - __Pyx_XDECREF(__pyx_v_files); - __Pyx_XDECREF(__pyx_v_runnable_files); + __Pyx_XDECREF(__pyx_v_alias); __Pyx_XDECREF(__pyx_v_parts); - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_f); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_runnable_files); + __Pyx_XDECREF(__pyx_v_files); + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":477 +/* "src/ktlib.pyx":509 * break * # run test from ascending number of file index * usable_samples = sorted(usable_samples, key=lambda x: x.index) # <<<<<<<<<<<<<< * # run test - * print(f'Problem ID : {color_cyan(self.get_problem_id())}') + * log(f'Problem ID : {color_cyan(self.get_problem_id())}') */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_4Test_4_act_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_mdef_5ktlib_4Test_4_act_lambda = {"lambda", (PyCFunction)__pyx_pw_5ktlib_4Test_4_act_lambda, METH_O, 0}; -static PyObject *__pyx_pw_5ktlib_4Test_4_act_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pw_3src_5ktlib_4Test_4_act_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_3src_5ktlib_4Test_4_act_lambda = {"lambda", (PyCFunction)__pyx_pw_3src_5ktlib_4Test_4_act_lambda, METH_O, 0}; +static PyObject *__pyx_pw_3src_5ktlib_4Test_4_act_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda (wrapper)", 0); @@ -9185,7 +9586,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("lambda", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9194,7 +9595,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Test._act.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Test._act.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9202,65 +9603,66 @@ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "ktlib.pyx":434 +/* "src/ktlib.pyx":477 * * - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * ''' Run the executable file against sample input and output files present in the folder * The sample files will only be recognized if the conditions hold: */ -static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v_self) { - int __pyx_v_idx; - float __pyx_v_start_time; - float __pyx_v_taken; - std::vector __pyx_v_actual; - std::vector __pyx_v_expected; - std::vector __pyx_v_diff; - std::vector __pyx_v_ith_line_exp; - std::vector __pyx_v_ith_line_actual; - std::string __pyx_v_current_diff; - bool __pyx_v_is_ac; - std::string __pyx_v_raw_output; - std::string __pyx_v_lhs; - std::string __pyx_v_rhs; - float __pyx_v_mem_used; - long __pyx_v_rusage_denom; - PyObject *__pyx_v_p = 0; - PyObject *__pyx_v_input_files = NULL; - PyObject *__pyx_v_output_files = NULL; - PyObject *__pyx_v_usable_samples = NULL; +static void __pyx_f_3src_5ktlib_4Test__act(struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self) { + PyObject *__pyx_v_input_files = 0; + PyObject *__pyx_v_output_files = 0; + PyObject *__pyx_v_usable_samples = 0; + PyObject *__pyx_v_input_file = 0; + PyObject *__pyx_v_output_file = 0; PyObject *__pyx_v_Sample = NULL; PyObject *__pyx_v_pattern = NULL; - PyObject *__pyx_v_input_file = NULL; - PyObject *__pyx_v_output_file = NULL; + PyObject *__pyx_v_idx = NULL; + double __pyx_v_mem_used; + long __pyx_v_rusage_denom; + int __pyx_v_is_ac; + int __pyx_v_is_good; + PyObject *__pyx_v_actual = 0; + PyObject *__pyx_v_expected = 0; + PyObject *__pyx_v_diff = 0; + PyObject *__pyx_v_raw_input = 0; + PyObject *__pyx_v_proc = 0; + double __pyx_v_start_time; + double __pyx_v_taken; + PyObject *__pyx_v_raw_output = 0; + PyObject *__pyx_v_ith_line_exp = 0; + PyObject *__pyx_v_ith_line_actual = 0; + int __pyx_v_i; + int __pyx_v_j; + PyObject *__pyx_v_current_diff = 0; + PyObject *__pyx_v_now_diff = 0; PyObject *__pyx_v_sample = NULL; PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_raw_input = NULL; - PyObject *__pyx_v_proc = NULL; - std::vector ::size_type __pyx_v_i; - Py_ssize_t __pyx_v_j; + PyObject *__pyx_v_p = NULL; + PyObject *__pyx_v_lhs = NULL; + PyObject *__pyx_v_rhs = NULL; PyObject *__pyx_v_e = NULL; - PyObject *__pyx_8genexpr1__pyx_v_f = NULL; - PyObject *__pyx_8genexpr2__pyx_v_f = NULL; + PyObject *__pyx_8genexpr1__pyx_v_x = NULL; + PyObject *__pyx_8genexpr2__pyx_v_x = NULL; PyObject *__pyx_8genexpr3__pyx_v_l = NULL; PyObject *__pyx_8genexpr4__pyx_v_z = NULL; PyObject *__pyx_8genexpr5__pyx_v_z = NULL; PyObject *__pyx_8genexpr6__pyx_v_z = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_11 = NULL; + Py_ssize_t __pyx_t_12; PyObject *__pyx_t_13 = NULL; int __pyx_t_14; PyObject *__pyx_t_15 = NULL; @@ -9270,61 +9672,60 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; - PyObject *(*__pyx_t_22)(PyObject *); - std::vector __pyx_t_23; - PyObject *__pyx_t_24 = NULL; - float __pyx_t_25; - std::string __pyx_t_26; - Py_ssize_t __pyx_t_27; - std::vector ::size_type __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_UCS4 __pyx_t_32; - std::vector ::size_type __pyx_t_33; - std::vector ::size_type __pyx_t_34; - int __pyx_t_35; - char const *__pyx_t_36; - PyObject *__pyx_t_37 = NULL; + PyObject *__pyx_t_22 = NULL; + double __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + int __pyx_t_27; + Py_UCS4 __pyx_t_28; + PyObject *__pyx_t_29 = NULL; + PyObject *__pyx_t_30 = NULL; + char const *__pyx_t_31; + PyObject *__pyx_t_32 = NULL; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":457 - * string temp - * float mem_used - * long rusage_denom = 1 << 20 # <<<<<<<<<<<<<< - * object p + /* "src/ktlib.pyx":488 * - */ - __pyx_v_rusage_denom = 0x100000; - - /* "ktlib.pyx":460 - * object p * * self.detect_file_name() # <<<<<<<<<<<<<< - * input_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('in')] - * output_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('ans')] + * input_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('in')] + * output_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('ans')] */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Test *)__pyx_v_self->__pyx_base.__pyx_vtab)->detect_file_name(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_f_3src_5ktlib_4Test_detect_file_name(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 488, __pyx_L1_error) - /* "ktlib.pyx":461 + /* "src/ktlib.pyx":489 * * self.detect_file_name() - * input_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('in')] # <<<<<<<<<<<<<< - * output_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('ans')] + * input_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('in')] # <<<<<<<<<<<<<< + * output_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('ans')] * usable_samples = [] */ { /* enter inner scope */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__15) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__15); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_listdir); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_iterdir); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); @@ -9333,136 +9734,130 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u__16) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__16); + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L5_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 489, __pyx_L5_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (likely(!__pyx_t_6)) { + if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 489, __pyx_L5_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 489, __pyx_L5_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { - __pyx_t_2 = __pyx_t_6(__pyx_t_4); + __pyx_t_2 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 461, __pyx_L5_error) + else __PYX_ERR(0, 489, __pyx_L5_error) } break; } __Pyx_GOTREF(__pyx_t_2); } - __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_f, __pyx_t_2); + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_x, __pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr1__pyx_v_x, __pyx_n_s_is_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 461, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_isfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_8)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_8genexpr1__pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_8genexpr1__pyx_v_f); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_9) { } else { - __pyx_t_7 = __pyx_t_9; + __pyx_t_8 = __pyx_t_9; goto __pyx_L9_bool_binop_done; } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr1__pyx_v_f, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_n_u_in) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_in); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_8genexpr1__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 461, __pyx_L5_error) + __pyx_t_9 = __Pyx_PyUnicode_Tailmatch(__pyx_t_2, __pyx_n_u_in, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 489, __pyx_L5_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_t_9; + __pyx_t_8 = (__pyx_t_9 != 0); __pyx_L9_bool_binop_done:; - if (__pyx_t_7) { - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_f))) __PYX_ERR(0, 461, __pyx_L5_error) + if (__pyx_t_8) { + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_x))) __PYX_ERR(0, 489, __pyx_L5_error) } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_f); __pyx_8genexpr1__pyx_v_f = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_x); __pyx_8genexpr1__pyx_v_x = 0; goto __pyx_L11_exit_scope; __pyx_L5_error:; - __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_f); __pyx_8genexpr1__pyx_v_f = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_x); __pyx_8genexpr1__pyx_v_x = 0; goto __pyx_L1_error; __pyx_L11_exit_scope:; } /* exit inner scope */ __pyx_v_input_files = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":462 + /* "src/ktlib.pyx":490 * self.detect_file_name() - * input_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('in')] - * output_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('ans')] # <<<<<<<<<<<<<< + * input_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('in')] + * output_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('ans')] # <<<<<<<<<<<<<< * usable_samples = [] * */ { /* enter inner scope */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L14_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u__15) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u__15); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_listdir); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L14_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_iterdir); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); @@ -9471,149 +9866,128 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_u__16) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u__16); + __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L14_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; - __pyx_t_6 = NULL; + __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 490, __pyx_L14_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { - if (likely(!__pyx_t_6)) { + if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 490, __pyx_L14_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 490, __pyx_L14_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { - __pyx_t_4 = __pyx_t_6(__pyx_t_3); + __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 462, __pyx_L14_error) + else __PYX_ERR(0, 490, __pyx_L14_error) } break; } __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_f, __pyx_t_4); + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_x, __pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 462, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr2__pyx_v_x, __pyx_n_s_is_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_8)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_8genexpr2__pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_8genexpr2__pyx_v_f); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_9) { } else { - __pyx_t_7 = __pyx_t_9; + __pyx_t_8 = __pyx_t_9; goto __pyx_L18_bool_binop_done; } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr2__pyx_v_f, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_n_u_ans) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_ans); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_8genexpr2__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 462, __pyx_L14_error) + __pyx_t_9 = __Pyx_PyUnicode_Tailmatch(__pyx_t_4, __pyx_n_u_ans, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 490, __pyx_L14_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __pyx_t_9; + __pyx_t_8 = (__pyx_t_9 != 0); __pyx_L18_bool_binop_done:; - if (__pyx_t_7) { - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr2__pyx_v_f))) __PYX_ERR(0, 462, __pyx_L14_error) + if (__pyx_t_8) { + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr2__pyx_v_x))) __PYX_ERR(0, 490, __pyx_L14_error) } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_f); __pyx_8genexpr2__pyx_v_f = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_x); __pyx_8genexpr2__pyx_v_x = 0; goto __pyx_L20_exit_scope; __pyx_L14_error:; - __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_f); __pyx_8genexpr2__pyx_v_f = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_x); __pyx_8genexpr2__pyx_v_x = 0; goto __pyx_L1_error; __pyx_L20_exit_scope:; } /* exit inner scope */ __pyx_v_output_files = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":463 - * input_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('in')] - * output_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('ans')] + /* "src/ktlib.pyx":491 + * input_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('in')] + * output_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('ans')] * usable_samples = [] # <<<<<<<<<<<<<< * * # Get sample files that match the condition */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_usable_samples = __pyx_t_1; + __pyx_v_usable_samples = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":466 + /* "src/ktlib.pyx":494 * * # Get sample files that match the condition * Sample = namedtuple('Sample', # <<<<<<<<<<<<<< * ['index', 'input_file', 'output_file'] * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "ktlib.pyx":467 + /* "src/ktlib.pyx":495 * # Get sample files that match the condition * Sample = namedtuple('Sample', * ['index', 'input_file', 'output_file'] # <<<<<<<<<<<<<< * ) * pattern = re.compile(r"\d+") */ - __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_n_u_index); __Pyx_GIVEREF(__pyx_n_u_index); @@ -9639,7 +10013,7 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_u_Sample, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9648,106 +10022,109 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_u_Sample, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_INCREF(__pyx_n_u_Sample); __Pyx_GIVEREF(__pyx_n_u_Sample); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_n_u_Sample); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_n_u_Sample); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_Sample = __pyx_t_1; __pyx_t_1 = 0; - /* "ktlib.pyx":469 + /* "src/ktlib.pyx":497 * ['index', 'input_file', 'output_file'] * ) * pattern = re.compile(r"\d+") # <<<<<<<<<<<<<< * for input_file in input_files: - * idx = int(pattern.search(input_file).group(0)) + * idx = int(pattern.search(str(input_file)).group(0)) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_compile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_3, __pyx_kp_u_d) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_u_d); + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_u_d) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_d); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_pattern = __pyx_t_1; __pyx_t_1 = 0; - /* "ktlib.pyx":470 + /* "src/ktlib.pyx":498 * ) * pattern = re.compile(r"\d+") * for input_file in input_files: # <<<<<<<<<<<<<< - * idx = int(pattern.search(input_file).group(0)) + * idx = int(pattern.search(str(input_file)).group(0)) * for output_file in output_files: */ - __pyx_t_1 = __pyx_v_input_files; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_v_input_files; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; for (;;) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 498, __pyx_L1_error) #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif - __Pyx_XDECREF_SET(__pyx_v_input_file, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_input_file, __pyx_t_5); + __pyx_t_5 = 0; - /* "ktlib.pyx":471 + /* "src/ktlib.pyx":499 * pattern = re.compile(r"\d+") * for input_file in input_files: - * idx = int(pattern.search(input_file).group(0)) # <<<<<<<<<<<<<< + * idx = int(pattern.search(str(input_file)).group(0)) # <<<<<<<<<<<<<< * for output_file in output_files: - * if idx == int(pattern.search(output_file).group(0)): + * if idx == int(pattern.search(str(output_file)).group(0)): */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = NULL; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_input_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_input_file) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_input_file); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_11, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_group); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_group); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -9760,374 +10137,389 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_0); + __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_0); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_idx = __pyx_t_10; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":472 + /* "src/ktlib.pyx":500 * for input_file in input_files: - * idx = int(pattern.search(input_file).group(0)) + * idx = int(pattern.search(str(input_file)).group(0)) * for output_file in output_files: # <<<<<<<<<<<<<< - * if idx == int(pattern.search(output_file).group(0)): - * usable_samples.append(Sample(idx, input_file, output_file)) + * if idx == int(pattern.search(str(output_file)).group(0)): + * usable_samples.append(Sample( */ - __pyx_t_4 = __pyx_v_output_files; __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0; + __pyx_t_4 = __pyx_v_output_files; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 500, __pyx_L1_error) #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif - __Pyx_XDECREF_SET(__pyx_v_output_file, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_output_file, __pyx_t_5); + __pyx_t_5 = 0; - /* "ktlib.pyx":473 - * idx = int(pattern.search(input_file).group(0)) + /* "src/ktlib.pyx":501 + * idx = int(pattern.search(str(input_file)).group(0)) * for output_file in output_files: - * if idx == int(pattern.search(output_file).group(0)): # <<<<<<<<<<<<<< - * usable_samples.append(Sample(idx, input_file, output_file)) - * break + * if idx == int(pattern.search(str(output_file)).group(0)): # <<<<<<<<<<<<<< + * usable_samples.append(Sample( + * index=idx, */ - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_search); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_search); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_output_file); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_2 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_v_output_file) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_output_file); + __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_group); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_2); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_group); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_2, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_int_0); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_t_8, __pyx_t_12, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_0); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { - /* "ktlib.pyx":474 - * for output_file in output_files: - * if idx == int(pattern.search(output_file).group(0)): - * usable_samples.append(Sample(idx, input_file, output_file)) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":503 + * if idx == int(pattern.search(str(output_file)).group(0)): + * usable_samples.append(Sample( + * index=idx, # <<<<<<<<<<<<<< + * input_file=input_file, + * output_file=output_file) + */ + __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_index, __pyx_v_idx) < 0) __PYX_ERR(0, 503, __pyx_L1_error) + + /* "src/ktlib.pyx":504 + * usable_samples.append(Sample( + * index=idx, + * input_file=input_file, # <<<<<<<<<<<<<< + * output_file=output_file) + * ) + */ + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_input_file, __pyx_v_input_file) < 0) __PYX_ERR(0, 503, __pyx_L1_error) + + /* "src/ktlib.pyx":505 + * index=idx, + * input_file=input_file, + * output_file=output_file) # <<<<<<<<<<<<<< + * ) * break - * # run test from ascending number of file index */ - __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_Sample); - __pyx_t_8 = __pyx_v_Sample; __pyx_t_2 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_12, __pyx_v_input_file, __pyx_v_output_file}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_12, __pyx_v_input_file, __pyx_v_output_file}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_10, __pyx_t_12); - __Pyx_INCREF(__pyx_v_input_file); - __Pyx_GIVEREF(__pyx_v_input_file); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_10, __pyx_v_input_file); - __Pyx_INCREF(__pyx_v_output_file); - __Pyx_GIVEREF(__pyx_v_output_file); - PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_10, __pyx_v_output_file); - __pyx_t_12 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_usable_samples, __pyx_t_3); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_output_file, __pyx_v_output_file) < 0) __PYX_ERR(0, 503, __pyx_L1_error) + + /* "src/ktlib.pyx":502 + * for output_file in output_files: + * if idx == int(pattern.search(str(output_file)).group(0)): + * usable_samples.append(Sample( # <<<<<<<<<<<<<< + * index=idx, + * input_file=input_file, + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_Sample, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_usable_samples, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":475 - * if idx == int(pattern.search(output_file).group(0)): - * usable_samples.append(Sample(idx, input_file, output_file)) + /* "src/ktlib.pyx":507 + * output_file=output_file) + * ) * break # <<<<<<<<<<<<<< * # run test from ascending number of file index * usable_samples = sorted(usable_samples, key=lambda x: x.index) */ goto __pyx_L24_break; - /* "ktlib.pyx":473 - * idx = int(pattern.search(input_file).group(0)) + /* "src/ktlib.pyx":501 + * idx = int(pattern.search(str(input_file)).group(0)) * for output_file in output_files: - * if idx == int(pattern.search(output_file).group(0)): # <<<<<<<<<<<<<< - * usable_samples.append(Sample(idx, input_file, output_file)) - * break + * if idx == int(pattern.search(str(output_file)).group(0)): # <<<<<<<<<<<<<< + * usable_samples.append(Sample( + * index=idx, */ } - /* "ktlib.pyx":472 + /* "src/ktlib.pyx":500 * for input_file in input_files: - * idx = int(pattern.search(input_file).group(0)) + * idx = int(pattern.search(str(input_file)).group(0)) * for output_file in output_files: # <<<<<<<<<<<<<< - * if idx == int(pattern.search(output_file).group(0)): - * usable_samples.append(Sample(idx, input_file, output_file)) + * if idx == int(pattern.search(str(output_file)).group(0)): + * usable_samples.append(Sample( */ } __pyx_L24_break:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":470 + /* "src/ktlib.pyx":498 * ) * pattern = re.compile(r"\d+") * for input_file in input_files: # <<<<<<<<<<<<<< - * idx = int(pattern.search(input_file).group(0)) + * idx = int(pattern.search(str(input_file)).group(0)) * for output_file in output_files: */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":477 + /* "src/ktlib.pyx":509 * break * # run test from ascending number of file index * usable_samples = sorted(usable_samples, key=lambda x: x.index) # <<<<<<<<<<<<<< * # run test - * print(f'Problem ID : {color_cyan(self.get_problem_id())}') + * log(f'Problem ID : {color_cyan(self.get_problem_id())}') */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_usable_samples); __Pyx_GIVEREF(__pyx_v_usable_samples); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_usable_samples); - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5ktlib_4Test_4_act_lambda, 0, __pyx_n_s_Test__act_locals_lambda, NULL, __pyx_n_s_ktlib, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_key, __pyx_t_3) < 0) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_3src_5ktlib_4Test_4_act_lambda, 0, __pyx_n_s_Test__act_locals_lambda, NULL, __pyx_n_s_src_ktlib, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_key, __pyx_t_2) < 0) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_usable_samples, __pyx_t_3); - __pyx_t_3 = 0; + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_usable_samples, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "ktlib.pyx":479 + /* "src/ktlib.pyx":511 * usable_samples = sorted(usable_samples, key=lambda x: x.index) * # run test - * print(f'Problem ID : {color_cyan(self.get_problem_id())}') # <<<<<<<<<<<<<< - * print(f'Lanuage : {self.lang}') - * if self.pre_script.size() > 0: + * log(f'Problem ID : {color_cyan(self.get_problem_id())}') # <<<<<<<<<<<<<< + * log(f'Lanuage : {self.lang}') + * if self.pre_script: */ - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(((struct __pyx_vtabstruct_5ktlib_Test *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_id(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Problem_ID, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Test *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_id(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __pyx_f_3src_5ktlib_color_cyan(((PyObject*)__pyx_t_1), 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Problem_ID, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":480 + /* "src/ktlib.pyx":512 * # run test - * print(f'Problem ID : {color_cyan(self.get_problem_id())}') - * print(f'Lanuage : {self.lang}') # <<<<<<<<<<<<<< - * if self.pre_script.size() > 0: + * log(f'Problem ID : {color_cyan(self.get_problem_id())}') + * log(f'Lanuage : {self.lang}') # <<<<<<<<<<<<<< + * if self.pre_script: * subprocess.check_call(shlex.split(self.pre_script)) */ - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->lang); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Lanuage, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_self->lang); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Lanuage, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":481 - * print(f'Problem ID : {color_cyan(self.get_problem_id())}') - * print(f'Lanuage : {self.lang}') - * if self.pre_script.size() > 0: # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":513 + * log(f'Problem ID : {color_cyan(self.get_problem_id())}') + * log(f'Lanuage : {self.lang}') + * if self.pre_script: # <<<<<<<<<<<<<< * subprocess.check_call(shlex.split(self.pre_script)) * */ - __pyx_t_7 = ((__pyx_v_self->pre_script.size() > 0) != 0); - if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_self->pre_script != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_self->pre_script) != 0); + if (__pyx_t_8) { - /* "ktlib.pyx":482 - * print(f'Lanuage : {self.lang}') - * if self.pre_script.size() > 0: + /* "src/ktlib.pyx":514 + * log(f'Lanuage : {self.lang}') + * if self.pre_script: * subprocess.check_call(shlex.split(self.pre_script)) # <<<<<<<<<<<<<< * - * for sample in usable_samples: + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_check_call); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_check_call); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_shlex); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->pre_script); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_12); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_shlex); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_self->pre_script) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->pre_script); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_13)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_13, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":481 - * print(f'Problem ID : {color_cyan(self.get_problem_id())}') - * print(f'Lanuage : {self.lang}') - * if self.pre_script.size() > 0: # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":513 + * log(f'Problem ID : {color_cyan(self.get_problem_id())}') + * log(f'Lanuage : {self.lang}') + * if self.pre_script: # <<<<<<<<<<<<<< * subprocess.check_call(shlex.split(self.pre_script)) * */ } - /* "ktlib.pyx":484 - * subprocess.check_call(shlex.split(self.pre_script)) + /* "src/ktlib.pyx":519 + * cdef: + * double mem_used + * long rusage_denom = 1 << 20 # <<<<<<<<<<<<<< + * bint is_ac, is_good + * list actual = [], expected = [], diff = [] + */ + __pyx_v_rusage_denom = 0x100000; + + /* "src/ktlib.pyx":521 + * long rusage_denom = 1 << 20 + * bint is_ac, is_good + * list actual = [], expected = [], diff = [] # <<<<<<<<<<<<<< + * list raw_input + * object proc # process + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_actual = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_expected = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_diff = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "src/ktlib.pyx":530 + * str current_diff, now_diff * * for sample in usable_samples: # <<<<<<<<<<<<<< * is_ac = True * actual.clear() */ - if (likely(PyList_CheckExact(__pyx_v_usable_samples)) || PyTuple_CheckExact(__pyx_v_usable_samples)) { - __pyx_t_3 = __pyx_v_usable_samples; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_usable_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error) + if (unlikely(__pyx_v_usable_samples == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 530, __pyx_L1_error) } + __pyx_t_2 = __pyx_v_usable_samples; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 484, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 484, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 484, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 530, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":485 + /* "src/ktlib.pyx":531 * * for sample in usable_samples: * is_ac = True # <<<<<<<<<<<<<< @@ -10136,34 +10528,40 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v */ __pyx_v_is_ac = 1; - /* "ktlib.pyx":486 + /* "src/ktlib.pyx":532 * for sample in usable_samples: * is_ac = True * actual.clear() # <<<<<<<<<<<<<< * expected.clear() * diff.clear() */ - __pyx_v_actual.clear(); + __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_clear, __pyx_v_actual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":487 + /* "src/ktlib.pyx":533 * is_ac = True * actual.clear() * expected.clear() # <<<<<<<<<<<<<< * diff.clear() * try: */ - __pyx_v_expected.clear(); + __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_clear, __pyx_v_expected); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":488 + /* "src/ktlib.pyx":534 * actual.clear() * expected.clear() * diff.clear() # <<<<<<<<<<<<<< * try: * with open(sample.output_file, 'r') as f: */ - __pyx_v_diff.clear(); + __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_clear, __pyx_v_diff); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":489 + /* "src/ktlib.pyx":535 * expected.clear() * diff.clear() * try: # <<<<<<<<<<<<<< @@ -10179,7 +10577,7 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_XGOTREF(__pyx_t_17); /*try:*/ { - /* "ktlib.pyx":490 + /* "src/ktlib.pyx":536 * diff.clear() * try: * with open(sample.output_file, 'r') as f: # <<<<<<<<<<<<<< @@ -10187,9 +10585,9 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v * with open(sample.input_file, 'rb') as f: */ /*with:*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_output_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L29_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_output_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L29_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -10197,29 +10595,29 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_GIVEREF(__pyx_n_u_r); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_r); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L29_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_18 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 490, __pyx_L29_error) + __pyx_t_18 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 536, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_18); - __pyx_t_13 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 490, __pyx_L37_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L37_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L37_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L37_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { @@ -10231,10 +10629,10 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); /*try:*/ { - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_13); - __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_3); + __pyx_t_3 = 0; - /* "ktlib.pyx":491 + /* "src/ktlib.pyx":537 * try: * with open(sample.output_file, 'r') as f: * expected = [l.strip(" \n") for l in f.readlines()] # <<<<<<<<<<<<<< @@ -10242,60 +10640,60 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v * raw_input = f.read() */ { /* enter inner scope */ - __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 491, __pyx_L53_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_readlines); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L53_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_readlines); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; + __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0; - __pyx_t_22 = NULL; + __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_22 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L53_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_22)) { + if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 537, __pyx_L53_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 537, __pyx_L53_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_22(__pyx_t_4); + __pyx_t_1 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 491, __pyx_L53_error) + else __PYX_ERR(0, 537, __pyx_L53_error) } break; } @@ -10303,24 +10701,24 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v } __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_l, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr3__pyx_v_l, __pyx_n_s_strip); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 491, __pyx_L53_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_12); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr3__pyx_v_l, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L53_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_12, __pyx_kp_u__22) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_u__22); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L53_error) + __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_11, __pyx_kp_u__24) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u__24); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_13, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 491, __pyx_L53_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 537, __pyx_L53_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10331,11 +10729,10 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L43_error; __pyx_L56_exit_scope:; } /* exit inner scope */ - __pyx_t_23 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L43_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_expected = __pyx_t_23; + __Pyx_DECREF_SET(__pyx_v_expected, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":490 + /* "src/ktlib.pyx":536 * diff.clear() * try: * with open(sample.output_file, 'r') as f: # <<<<<<<<<<<<<< @@ -10349,37 +10746,37 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L50_try_end; __pyx_L43_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_4, &__pyx_t_1) < 0) __PYX_ERR(0, 490, __pyx_L45_except_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_AddTraceback("src.ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) __PYX_ERR(0, 536, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_Pack(3, __pyx_t_13, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 490, __pyx_L45_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_8, NULL); + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_5, NULL); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 490, __pyx_L45_except_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_24); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - if (__pyx_t_7 < 0) __PYX_ERR(0, 490, __pyx_L45_except_error) - __pyx_t_9 = ((!(__pyx_t_7 != 0)) != 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 536, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_22); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (__pyx_t_8 < 0) __PYX_ERR(0, 536, __pyx_L45_except_error) + __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0); if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_13); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ErrRestoreWithState(__pyx_t_13, __pyx_t_4, __pyx_t_1); - __pyx_t_13 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0; - __PYX_ERR(0, 490, __pyx_L45_except_error) + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_4, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 536, __pyx_L45_except_error) } - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L44_exception_handled; @@ -10401,9 +10798,9 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v /*finally:*/ { /*normal exit:*/{ if (__pyx_t_18) { - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_tuple__8, NULL); + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_tuple__6, NULL); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 490, __pyx_L29_error) + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 536, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } @@ -10418,7 +10815,7 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __pyx_L60:; } - /* "ktlib.pyx":492 + /* "src/ktlib.pyx":538 * with open(sample.output_file, 'r') as f: * expected = [l.strip(" \n") for l in f.readlines()] * with open(sample.input_file, 'rb') as f: # <<<<<<<<<<<<<< @@ -10426,9 +10823,9 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v * */ /*with:*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_input_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L29_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_input_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L29_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -10436,29 +10833,29 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_GIVEREF(__pyx_n_u_rb); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_rb); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L29_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_18 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 492, __pyx_L29_error) + __pyx_t_18 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 538, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_18); - __pyx_t_13 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 492, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L61_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L61_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L61_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { @@ -10470,17 +10867,17 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_19); /*try:*/ { - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_13); - __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_3); + __pyx_t_3 = 0; - /* "ktlib.pyx":493 + /* "src/ktlib.pyx":539 * expected = [l.strip(" \n") for l in f.readlines()] * with open(sample.input_file, 'rb') as f: * raw_input = f.read() # <<<<<<<<<<<<<< * * p = Popen([self.script, '-'], stdin=PIPE, stdout=PIPE, shell=False, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L67_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L67_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -10492,15 +10889,16 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_13 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1); + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 493, __pyx_L67_error) - __Pyx_GOTREF(__pyx_t_13); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L67_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_raw_input, __pyx_t_13); - __pyx_t_13 = 0; + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 539, __pyx_L67_error) + __Pyx_XDECREF_SET(__pyx_v_raw_input, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":492 + /* "src/ktlib.pyx":538 * with open(sample.output_file, 'r') as f: * expected = [l.strip(" \n") for l in f.readlines()] * with open(sample.input_file, 'rb') as f: # <<<<<<<<<<<<<< @@ -10514,37 +10912,37 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L74_try_end; __pyx_L67_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 492, __pyx_L69_except_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_AddTraceback("src.ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 538, __pyx_L69_except_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_Pack(3, __pyx_t_13, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 492, __pyx_L69_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_8, NULL); + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L69_except_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_5, NULL); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 492, __pyx_L69_except_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_24); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - if (__pyx_t_9 < 0) __PYX_ERR(0, 492, __pyx_L69_except_error) - __pyx_t_7 = ((!(__pyx_t_9 != 0)) != 0); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 538, __pyx_L69_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_22); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (__pyx_t_9 < 0) __PYX_ERR(0, 538, __pyx_L69_except_error) + __pyx_t_8 = ((!(__pyx_t_9 != 0)) != 0); + if (__pyx_t_8) { + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ErrRestoreWithState(__pyx_t_13, __pyx_t_1, __pyx_t_4); - __pyx_t_13 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 492, __pyx_L69_except_error) + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_4); + __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 538, __pyx_L69_except_error) } - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L68_exception_handled; @@ -10566,9 +10964,9 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v /*finally:*/ { /*normal exit:*/{ if (__pyx_t_18) { - __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_tuple__8, NULL); + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_tuple__6, NULL); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 492, __pyx_L29_error) + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 538, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; } @@ -10583,329 +10981,346 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __pyx_L78:; } - /* "ktlib.pyx":495 + /* "src/ktlib.pyx":541 * raw_input = f.read() * * p = Popen([self.script, '-'], stdin=PIPE, stdout=PIPE, shell=False, # <<<<<<<<<<<<<< * preexec_fn=os.setsid) * test_subprocesses.append(p) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Popen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L29_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Popen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 541, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->script); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L29_error) + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyList_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_INCREF(__pyx_v_self->script); + __Pyx_GIVEREF(__pyx_v_self->script); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->script); + __Pyx_INCREF(__pyx_kp_u__25); + __Pyx_GIVEREF(__pyx_kp_u__25); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__25); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_kp_u__23); - __Pyx_GIVEREF(__pyx_kp_u__23); - PyList_SET_ITEM(__pyx_t_13, 1, __pyx_kp_u__23); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L29_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_stdin, __pyx_t_8) < 0) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_stdout, __pyx_t_8) < 0) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_shell, Py_False) < 0) __PYX_ERR(0, 495, __pyx_L29_error) - - /* "ktlib.pyx":496 + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_stdin, __pyx_t_5) < 0) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_stdout, __pyx_t_5) < 0) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shell, Py_False) < 0) __PYX_ERR(0, 541, __pyx_L29_error) + + /* "src/ktlib.pyx":542 * * p = Popen([self.script, '-'], stdin=PIPE, stdout=PIPE, shell=False, * preexec_fn=os.setsid) # <<<<<<<<<<<<<< * test_subprocesses.append(p) * proc = psutil.Process(p.pid) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 496, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_setsid); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 496, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_preexec_fn, __pyx_t_12) < 0) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setsid); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 542, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_preexec_fn, __pyx_t_11) < 0) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "ktlib.pyx":495 + /* "src/ktlib.pyx":541 * raw_input = f.read() * * p = Popen([self.script, '-'], stdin=PIPE, stdout=PIPE, shell=False, # <<<<<<<<<<<<<< * preexec_fn=os.setsid) * test_subprocesses.append(p) */ - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 495, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 541, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_12); - __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_11); + __pyx_t_11 = 0; - /* "ktlib.pyx":497 + /* "src/ktlib.pyx":543 * p = Popen([self.script, '-'], stdin=PIPE, stdout=PIPE, shell=False, * preexec_fn=os.setsid) * test_subprocesses.append(p) # <<<<<<<<<<<<<< * proc = psutil.Process(p.pid) * mem_used = proc.memory_info().rss / rusage_denom */ - if (unlikely(__pyx_v_5ktlib_test_subprocesses == Py_None)) { + if (unlikely(__pyx_v_3src_5ktlib_test_subprocesses == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 497, __pyx_L29_error) + __PYX_ERR(0, 543, __pyx_L29_error) } - __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_5ktlib_test_subprocesses, __pyx_v_p); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 497, __pyx_L29_error) + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_3src_5ktlib_test_subprocesses, __pyx_v_p); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 543, __pyx_L29_error) - /* "ktlib.pyx":498 + /* "src/ktlib.pyx":544 * preexec_fn=os.setsid) * test_subprocesses.append(p) * proc = psutil.Process(p.pid) # <<<<<<<<<<<<<< * mem_used = proc.memory_info().rss / rusage_denom * start_time = time.perf_counter() */ - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_psutil); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 498, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_Process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L29_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_psutil); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_pid); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 498, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_12 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); + __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 498, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_proc, __pyx_t_12); - __pyx_t_12 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 544, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_proc, __pyx_t_11); + __pyx_t_11 = 0; - /* "ktlib.pyx":499 + /* "src/ktlib.pyx":545 * test_subprocesses.append(p) * proc = psutil.Process(p.pid) * mem_used = proc.memory_info().rss / rusage_denom # <<<<<<<<<<<<<< * start_time = time.perf_counter() - * raw_output = p.communicate(raw_input)[0] - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_memory_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_13); + * raw_output = p.communicate(raw_input)[0].decode() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_proc, __pyx_n_s_memory_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 499, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_rss); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L29_error) + __pyx_t_11 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 545, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_rss); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_rusage_denom); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 545, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_v_rusage_denom); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 499, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 499, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L29_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_25 = __pyx_PyFloat_AsFloat(__pyx_t_13); if (unlikely((__pyx_t_25 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_mem_used = __pyx_t_25; + __pyx_v_mem_used = __pyx_t_23; - /* "ktlib.pyx":500 + /* "src/ktlib.pyx":546 * proc = psutil.Process(p.pid) * mem_used = proc.memory_info().rss / rusage_denom * start_time = time.perf_counter() # <<<<<<<<<<<<<< - * raw_output = p.communicate(raw_input)[0] + * raw_output = p.communicate(raw_input)[0].decode() * p.wait() */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_time); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 500, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_time); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 546, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_13 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 500, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L29_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_25 = __pyx_PyFloat_AsFloat(__pyx_t_13); if (unlikely((__pyx_t_25 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 500, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_start_time = __pyx_t_25; + __pyx_v_start_time = __pyx_t_23; - /* "ktlib.pyx":501 + /* "src/ktlib.pyx":547 * mem_used = proc.memory_info().rss / rusage_denom * start_time = time.perf_counter() - * raw_output = p.communicate(raw_input)[0] # <<<<<<<<<<<<<< + * raw_output = p.communicate(raw_input)[0].decode() # <<<<<<<<<<<<<< * p.wait() * taken = time.perf_counter() - start_time */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_communicate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_v_raw_input)) { __Pyx_RaiseUnboundLocalError("raw_input"); __PYX_ERR(0, 501, __pyx_L29_error) } - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_communicate); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 547, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + if (unlikely(!__pyx_v_raw_input)) { __Pyx_RaiseUnboundLocalError("raw_input"); __PYX_ERR(0, 547, __pyx_L29_error) } + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_11, function); } } - __pyx_t_13 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_v_raw_input) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_raw_input); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 501, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_13, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L29_error) + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_v_raw_input) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_raw_input); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 547, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_26 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 501, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_raw_output = __pyx_t_26; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 547, __pyx_L29_error) + __Pyx_XDECREF_SET(__pyx_v_raw_output, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "ktlib.pyx":502 + /* "src/ktlib.pyx":548 * start_time = time.perf_counter() - * raw_output = p.communicate(raw_input)[0] + * raw_output = p.communicate(raw_input)[0].decode() * p.wait() # <<<<<<<<<<<<<< * taken = time.perf_counter() - start_time - * + * actual = [z.strip(" \n") for z in raw_output.split('\n')] */ - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_wait); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 502, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_wait); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L29_error) + __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":503 - * raw_output = p.communicate(raw_input)[0] + /* "src/ktlib.pyx":549 + * raw_output = p.communicate(raw_input)[0].decode() * p.wait() * taken = time.perf_counter() - start_time # <<<<<<<<<<<<<< - * * actual = [z.strip(" \n") for z in raw_output.split('\n')] + * make_list_equal(actual, expected) */ - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_time); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 503, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 503, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_13); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 549, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); + __Pyx_DECREF_SET(__pyx_t_11, function); } } - __pyx_t_1 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L29_error) + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyFloat_FromDouble(__pyx_v_start_time); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 503, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = PyNumber_Subtract(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 503, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_start_time); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 549, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_25 = __pyx_PyFloat_AsFloat(__pyx_t_13); if (unlikely((__pyx_t_25 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_taken = __pyx_t_25; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 549, __pyx_L29_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_taken = __pyx_t_23; - /* "ktlib.pyx":505 + /* "src/ktlib.pyx":550 + * p.wait() * taken = time.perf_counter() - start_time - * * actual = [z.strip(" \n") for z in raw_output.split('\n')] # <<<<<<<<<<<<<< * make_list_equal(actual, expected) - * diff.clear() + * */ { /* enter inner scope */ - __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 505, __pyx_L81_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_raw_output); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 505, __pyx_L81_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyUnicode_Split(((PyObject*)__pyx_t_12), __pyx_kp_u__2, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L81_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __pyx_t_1; __Pyx_INCREF(__pyx_t_12); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 550, __pyx_L81_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_v_raw_output == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "split"); + __PYX_ERR(0, 550, __pyx_L81_error) + } + __pyx_t_11 = PyUnicode_Split(__pyx_v_raw_output, __pyx_kp_u__2, -1L); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 550, __pyx_L81_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __pyx_t_11; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_12)) break; + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 505, __pyx_L81_error) + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_11); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 550, __pyx_L81_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_12, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L81_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 550, __pyx_L81_error) + __Pyx_GOTREF(__pyx_t_11); #endif - __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_z, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_z, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L81_error) + __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_z, __pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_z, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 550, __pyx_L81_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; + __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_kp_u__22) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__22); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L81_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__24) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__24); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 550, __pyx_L81_error) + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_13, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 505, __pyx_L81_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 550, __pyx_L81_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_z); __pyx_8genexpr4__pyx_v_z = 0; goto __pyx_L84_exit_scope; __pyx_L81_error:; @@ -10913,44 +11328,31 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L29_error; __pyx_L84_exit_scope:; } /* exit inner scope */ - __pyx_t_23 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_actual = __pyx_t_23; + __Pyx_DECREF_SET(__pyx_v_actual, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":506 - * + /* "src/ktlib.pyx":551 + * taken = time.perf_counter() - start_time * actual = [z.strip(" \n") for z in raw_output.split('\n')] * make_list_equal(actual, expected) # <<<<<<<<<<<<<< - * diff.clear() - * - */ - __pyx_f_5ktlib_make_list_equal(__pyx_v_actual, __pyx_v_expected, NULL); - - /* "ktlib.pyx":507 - * actual = [z.strip(" \n") for z in raw_output.split('\n')] - * make_list_equal(actual, expected) - * diff.clear() # <<<<<<<<<<<<<< * * for i in range(len(expected)): */ - __pyx_v_diff.clear(); + __pyx_f_3src_5ktlib_make_list_equal(__pyx_v_actual, __pyx_v_expected, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 551, __pyx_L29_error) - /* "ktlib.pyx":509 - * diff.clear() + /* "src/ktlib.pyx":553 + * make_list_equal(actual, expected) * * for i in range(len(expected)): # <<<<<<<<<<<<<< * ''' Compare the values line by line * For each line, compare the values from left to right. */ - __pyx_t_13 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_expected); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 509, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_11 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 509, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_27 = __pyx_t_11; - for (__pyx_t_28 = 0; __pyx_t_28 < __pyx_t_27; __pyx_t_28+=1) { - __pyx_v_i = __pyx_t_28; + __pyx_t_12 = PyList_GET_SIZE(__pyx_v_expected); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 553, __pyx_L29_error) + __pyx_t_24 = __pyx_t_12; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_24; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* "ktlib.pyx":513 + /* "src/ktlib.pyx":557 * For each line, compare the values from left to right. * ''' * ith_line_exp = [z for z in expected[i].split(' ')] # <<<<<<<<<<<<<< @@ -10958,28 +11360,70 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v * */ { /* enter inner scope */ - __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 513, __pyx_L89_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __pyx_convert_PyUnicode_string_to_py_std__in_string((__pyx_v_expected[__pyx_v_i])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 513, __pyx_L89_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyUnicode_Split(((PyObject*)__pyx_t_12), __pyx_kp_u__24, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L89_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L89_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_expected, __pyx_v_i), __pyx_n_s_split); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 557, __pyx_L89_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_kp_u__18) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_kp_u__18); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L89_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __pyx_t_1; __Pyx_INCREF(__pyx_t_12); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_11 = __pyx_t_1; __Pyx_INCREF(__pyx_t_11); __pyx_t_25 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_25 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 557, __pyx_L89_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_7 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 557, __pyx_L89_error) + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (__pyx_t_29 >= PyList_GET_SIZE(__pyx_t_12)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_29); __Pyx_INCREF(__pyx_t_1); __pyx_t_29++; if (unlikely(0 < 0)) __PYX_ERR(0, 513, __pyx_L89_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_12, __pyx_t_29); __pyx_t_29++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L89_error) - __Pyx_GOTREF(__pyx_t_1); - #endif + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_11))) { + if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_11)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_25); __Pyx_INCREF(__pyx_t_1); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 557, __pyx_L89_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_11, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L89_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_25 >= PyTuple_GET_SIZE(__pyx_t_11)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_25); __Pyx_INCREF(__pyx_t_1); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 557, __pyx_L89_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_11, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L89_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_7(__pyx_t_11); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 557, __pyx_L89_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_z, __pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_13, (PyObject*)__pyx_8genexpr5__pyx_v_z))) __PYX_ERR(0, 513, __pyx_L89_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_8genexpr5__pyx_v_z))) __PYX_ERR(0, 557, __pyx_L89_error) } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_z); __pyx_8genexpr5__pyx_v_z = 0; goto __pyx_L92_exit_scope; __pyx_L89_error:; @@ -10987,11 +11431,10 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L29_error; __pyx_L92_exit_scope:; } /* exit inner scope */ - __pyx_t_23 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 513, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_ith_line_exp = __pyx_t_23; + __Pyx_XDECREF_SET(__pyx_v_ith_line_exp, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":514 + /* "src/ktlib.pyx":558 * ''' * ith_line_exp = [z for z in expected[i].split(' ')] * ith_line_actual = [z for z in actual[i].split(' ')] # <<<<<<<<<<<<<< @@ -10999,28 +11442,70 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v * make_list_equal(ith_line_exp, ith_line_actual) */ { /* enter inner scope */ - __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 514, __pyx_L95_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __pyx_convert_PyUnicode_string_to_py_std__in_string((__pyx_v_actual[__pyx_v_i])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 514, __pyx_L95_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyUnicode_Split(((PyObject*)__pyx_t_12), __pyx_kp_u__24, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L95_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L95_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_actual, __pyx_v_i), __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L95_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __pyx_t_1; __Pyx_INCREF(__pyx_t_12); __pyx_t_29 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_u__18) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u__18); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L95_error) + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_29 >= PyList_GET_SIZE(__pyx_t_12)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_29); __Pyx_INCREF(__pyx_t_1); __pyx_t_29++; if (unlikely(0 < 0)) __PYX_ERR(0, 514, __pyx_L95_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_12, __pyx_t_29); __pyx_t_29++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L95_error) + if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { + __pyx_t_1 = __pyx_t_11; __Pyx_INCREF(__pyx_t_1); __pyx_t_25 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_25 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L95_error) __Pyx_GOTREF(__pyx_t_1); - #endif - __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_z, __pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_13, (PyObject*)__pyx_8genexpr6__pyx_v_z))) __PYX_ERR(0, 514, __pyx_L95_error) + __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L95_error) + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_25); __Pyx_INCREF(__pyx_t_11); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L95_error) + #else + __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L95_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + } else { + if (__pyx_t_25 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_25); __Pyx_INCREF(__pyx_t_11); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L95_error) + #else + __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L95_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + } + } else { + __pyx_t_11 = __pyx_t_7(__pyx_t_1); + if (unlikely(!__pyx_t_11)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 558, __pyx_L95_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_z, __pyx_t_11); + __pyx_t_11 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_8genexpr6__pyx_v_z))) __PYX_ERR(0, 558, __pyx_L95_error) } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_z); __pyx_8genexpr6__pyx_v_z = 0; goto __pyx_L98_exit_scope; __pyx_L95_error:; @@ -11028,367 +11513,485 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L29_error; __pyx_L98_exit_scope:; } /* exit inner scope */ - __pyx_t_23 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 514, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_v_ith_line_actual = __pyx_t_23; + __Pyx_XDECREF_SET(__pyx_v_ith_line_actual, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":516 + /* "src/ktlib.pyx":560 * ith_line_actual = [z for z in actual[i].split(' ')] * * make_list_equal(ith_line_exp, ith_line_actual) # <<<<<<<<<<<<<< - * current_diff.clear() + * current_diff = '' * for j in range(len(ith_line_exp)): */ - __pyx_f_5ktlib_make_list_equal(__pyx_v_ith_line_exp, __pyx_v_ith_line_actual, NULL); + __pyx_f_3src_5ktlib_make_list_equal(__pyx_v_ith_line_exp, __pyx_v_ith_line_actual, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L29_error) - /* "ktlib.pyx":517 + /* "src/ktlib.pyx":561 * * make_list_equal(ith_line_exp, ith_line_actual) - * current_diff.clear() # <<<<<<<<<<<<<< + * current_diff = '' # <<<<<<<<<<<<<< * for j in range(len(ith_line_exp)): * lhs = ith_line_exp[j] */ - __pyx_v_current_diff.clear(); + __Pyx_INCREF(__pyx_kp_u_); + __Pyx_XDECREF_SET(__pyx_v_current_diff, __pyx_kp_u_); - /* "ktlib.pyx":518 + /* "src/ktlib.pyx":562 * make_list_equal(ith_line_exp, ith_line_actual) - * current_diff.clear() + * current_diff = '' * for j in range(len(ith_line_exp)): # <<<<<<<<<<<<<< * lhs = ith_line_exp[j] * rhs = ith_line_actual[j] */ - __pyx_t_13 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_ith_line_exp); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 518, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_29 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_29 == ((Py_ssize_t)-1))) __PYX_ERR(0, 518, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_30 = __pyx_t_29; - for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) { - __pyx_v_j = __pyx_t_31; + __pyx_t_25 = PyList_GET_SIZE(__pyx_v_ith_line_exp); if (unlikely(__pyx_t_25 == ((Py_ssize_t)-1))) __PYX_ERR(0, 562, __pyx_L29_error) + __pyx_t_26 = __pyx_t_25; + for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) { + __pyx_v_j = __pyx_t_27; - /* "ktlib.pyx":519 - * current_diff.clear() + /* "src/ktlib.pyx":563 + * current_diff = '' * for j in range(len(ith_line_exp)): * lhs = ith_line_exp[j] # <<<<<<<<<<<<<< * rhs = ith_line_actual[j] - * is_ac &= compare_entity(rhs,lhs, current_diff) + * is_good, now_diff = compare_entity(rhs,lhs) */ - __pyx_v_lhs = (__pyx_v_ith_line_exp[__pyx_v_j]); + __pyx_t_3 = PyList_GET_ITEM(__pyx_v_ith_line_exp, __pyx_v_j); + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_lhs, __pyx_t_3); + __pyx_t_3 = 0; - /* "ktlib.pyx":520 + /* "src/ktlib.pyx":564 * for j in range(len(ith_line_exp)): * lhs = ith_line_exp[j] * rhs = ith_line_actual[j] # <<<<<<<<<<<<<< - * is_ac &= compare_entity(rhs,lhs, current_diff) - * + * is_good, now_diff = compare_entity(rhs,lhs) + * is_ac &= is_good */ - __pyx_v_rhs = (__pyx_v_ith_line_actual[__pyx_v_j]); + __pyx_t_3 = PyList_GET_ITEM(__pyx_v_ith_line_actual, __pyx_v_j); + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_rhs, __pyx_t_3); + __pyx_t_3 = 0; - /* "ktlib.pyx":521 + /* "src/ktlib.pyx":565 * lhs = ith_line_exp[j] * rhs = ith_line_actual[j] - * is_ac &= compare_entity(rhs,lhs, current_diff) # <<<<<<<<<<<<<< + * is_good, now_diff = compare_entity(rhs,lhs) # <<<<<<<<<<<<<< + * is_ac &= is_good + * current_diff += now_diff + */ + if (!(likely(PyUnicode_CheckExact(__pyx_v_rhs))||((__pyx_v_rhs) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_rhs)->tp_name), 0))) __PYX_ERR(0, 565, __pyx_L29_error) + if (!(likely(PyUnicode_CheckExact(__pyx_v_lhs))||((__pyx_v_lhs) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_lhs)->tp_name), 0))) __PYX_ERR(0, 565, __pyx_L29_error) + __pyx_t_3 = __pyx_f_3src_5ktlib_compare_entity(((PyObject*)__pyx_v_rhs), ((PyObject*)__pyx_v_lhs)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(__pyx_t_3 != Py_None)) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 565, __pyx_L29_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_11); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 565, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 565, __pyx_L29_error) + } + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L29_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_11)->tp_name), 0))) __PYX_ERR(0, 565, __pyx_L29_error) + __pyx_v_is_good = __pyx_t_8; + __Pyx_XDECREF_SET(__pyx_v_now_diff, ((PyObject*)__pyx_t_11)); + __pyx_t_11 = 0; + + /* "src/ktlib.pyx":566 + * rhs = ith_line_actual[j] + * is_good, now_diff = compare_entity(rhs,lhs) + * is_ac &= is_good # <<<<<<<<<<<<<< + * current_diff += now_diff + * + */ + __pyx_v_is_ac = (__pyx_v_is_ac & __pyx_v_is_good); + + /* "src/ktlib.pyx":567 + * is_good, now_diff = compare_entity(rhs,lhs) + * is_ac &= is_good + * current_diff += now_diff # <<<<<<<<<<<<<< * - * diff.push_back(current_diff) + * diff.append(current_diff) */ - __pyx_v_is_ac = (__pyx_v_is_ac & __pyx_f_5ktlib_compare_entity(__pyx_v_rhs, __pyx_v_lhs, __pyx_v_current_diff)); + __pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_current_diff, __pyx_v_now_diff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_current_diff, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; } - /* "ktlib.pyx":523 - * is_ac &= compare_entity(rhs,lhs, current_diff) + /* "src/ktlib.pyx":569 + * current_diff += now_diff * - * diff.push_back(current_diff) # <<<<<<<<<<<<<< + * diff.append(current_diff) # <<<<<<<<<<<<<< * if is_ac: - * print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + * log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) */ - try { - __pyx_v_diff.push_back(__pyx_v_current_diff); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 523, __pyx_L29_error) - } + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_diff, __pyx_v_current_diff); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 569, __pyx_L29_error) } - /* "ktlib.pyx":524 + /* "src/ktlib.pyx":570 * - * diff.push_back(current_diff) + * diff.append(current_diff) * if is_ac: # <<<<<<<<<<<<<< - * print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + * log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) * else: */ - __pyx_t_7 = (__pyx_v_is_ac != 0); - if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_is_ac != 0); + if (__pyx_t_8) { - /* "ktlib.pyx":525 - * diff.push_back(current_diff) + /* "src/ktlib.pyx":571 + * diff.append(current_diff) * if is_ac: - * print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) # <<<<<<<<<<<<<< + * log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) # <<<<<<<<<<<<<< * else: - * print(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + * log(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) */ - __pyx_t_13 = PyTuple_New(9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_11 = 0; - __pyx_t_32 = 127; - __Pyx_INCREF(__pyx_kp_u_Test_Case); - __pyx_t_11 += 11; - __Pyx_GIVEREF(__pyx_kp_u_Test_Case); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_Test_Case); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_12, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u__21); - __pyx_t_11 += 2; - __Pyx_GIVEREF(__pyx_kp_u__21); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_kp_u__21); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_n_u_Accepted, __pyx_n_s_ljust); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_12, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u__26); - __pyx_t_11 += 5; - __Pyx_GIVEREF(__pyx_kp_u__26); - PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_kp_u__26); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_taken); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_kp_u_3f); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_12); __pyx_t_12 = 0; + __pyx_t_28 = 127; + __Pyx_INCREF(__pyx_kp_u_Test_Case); + __pyx_t_12 += 11; + __Pyx_GIVEREF(__pyx_kp_u_Test_Case); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Test_Case); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__23); + __pyx_t_12 += 2; + __Pyx_GIVEREF(__pyx_kp_u__23); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__23); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_n_u_Accepted, __pyx_n_s_ljust); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__27); + __pyx_t_12 += 5; + __Pyx_GIVEREF(__pyx_kp_u__27); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__27); + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_taken); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_kp_u_3f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u_s); - __pyx_t_11 += 5; + __pyx_t_12 += 5; __Pyx_GIVEREF(__pyx_kp_u_s); - PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_kp_u_s); - __pyx_t_12 = PyFloat_FromDouble(__pyx_v_mem_used); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_Format(__pyx_t_12, __pyx_kp_u_2f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 7, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u_Mb); - __pyx_t_11 += 3; - __Pyx_GIVEREF(__pyx_kp_u_Mb); - PyTuple_SET_ITEM(__pyx_t_13, 8, __pyx_kp_u_Mb); - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_13, 9, __pyx_t_11, __pyx_t_32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_26 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 525, __pyx_L29_error) + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_s); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mem_used); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_kp_u_2f); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u_M); + __pyx_t_12 += 2; + __Pyx_GIVEREF(__pyx_kp_u_M); + PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u_M); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_12, __pyx_t_28); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_t_26, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L29_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_color_green(((PyObject*)__pyx_t_5), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 525, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":524 + /* "src/ktlib.pyx":570 * - * diff.push_back(current_diff) + * diff.append(current_diff) * if is_ac: # <<<<<<<<<<<<<< - * print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + * log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) * else: */ goto __pyx_L101; } - /* "ktlib.pyx":527 - * print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + /* "src/ktlib.pyx":573 + * log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) * else: - * print(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) # <<<<<<<<<<<<<< - * print(color_cyan(b'--- Input ---')) - * print(raw_input.decode('utf-8')) + * log(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) # <<<<<<<<<<<<<< + * log(color_cyan('--- Input ---')) + * log(raw_input) */ /*else*/ { - __pyx_t_13 = PyTuple_New(9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_11 = 0; - __pyx_t_32 = 127; - __Pyx_INCREF(__pyx_kp_u_Test_Case); - __pyx_t_11 += 11; - __Pyx_GIVEREF(__pyx_kp_u_Test_Case); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_Test_Case); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_kp_u__21); - __pyx_t_11 += 2; - __Pyx_GIVEREF(__pyx_kp_u__21); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_kp_u__21); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Wrong_Answer, __pyx_n_s_ljust); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L29_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_12); __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_kp_u__26); - __pyx_t_11 += 5; - __Pyx_GIVEREF(__pyx_kp_u__26); - PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_kp_u__26); - __pyx_t_12 = PyFloat_FromDouble(__pyx_v_taken); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_Format(__pyx_t_12, __pyx_kp_u_3f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_28 = 127; + __Pyx_INCREF(__pyx_kp_u_Test_Case); + __pyx_t_12 += 11; + __Pyx_GIVEREF(__pyx_kp_u_Test_Case); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Test_Case); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__23); + __pyx_t_12 += 2; + __Pyx_GIVEREF(__pyx_kp_u__23); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__23); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Wrong_Answer, __pyx_n_s_ljust); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__27); + __pyx_t_12 += 5; + __Pyx_GIVEREF(__pyx_kp_u__27); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__27); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_taken); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_kp_u_3f); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5); + __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_s); - __pyx_t_11 += 5; + __pyx_t_12 += 5; __Pyx_GIVEREF(__pyx_kp_u_s); - PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_kp_u_s); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mem_used); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L29_error) + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_s); + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mem_used); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_kp_u_2f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_M); + __pyx_t_12 += 2; + __Pyx_GIVEREF(__pyx_kp_u_M); + PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u_M); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_12, __pyx_t_28); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_f_3src_5ktlib_color_red(((PyObject*)__pyx_t_4), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_kp_u_2f); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 7, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_kp_u_Mb); - __pyx_t_11 += 3; - __Pyx_GIVEREF(__pyx_kp_u_Mb); - PyTuple_SET_ITEM(__pyx_t_13, 8, __pyx_kp_u_Mb); - __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_13, 9, __pyx_t_11, __pyx_t_32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_26 = __pyx_convert_string_from_py_std__in_string(__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_t_26, 0)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 527, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "ktlib.pyx":528 + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "src/ktlib.pyx":574 * else: - * print(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) - * print(color_cyan(b'--- Input ---')) # <<<<<<<<<<<<<< - * print(raw_input.decode('utf-8')) - * print(color_cyan(b'--- Diff ---')) - */ - __pyx_t_13 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_k_Input, 0)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 528, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 528, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + * log(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) + * log(color_cyan('--- Input ---')) # <<<<<<<<<<<<<< + * log(raw_input) + * log(color_cyan('--- Diff ---')) + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 574, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __pyx_f_3src_5ktlib_color_cyan(__pyx_kp_u_Input, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":529 - * print(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) - * print(color_cyan(b'--- Input ---')) - * print(raw_input.decode('utf-8')) # <<<<<<<<<<<<<< - * print(color_cyan(b'--- Diff ---')) - * for i in range(diff.size()): + /* "src/ktlib.pyx":575 + * log(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) + * log(color_cyan('--- Input ---')) + * log(raw_input) # <<<<<<<<<<<<<< + * log(color_cyan('--- Diff ---')) + * for i in range(len(diff)): */ - if (unlikely(!__pyx_v_raw_input)) { __Pyx_RaiseUnboundLocalError("raw_input"); __PYX_ERR(0, 529, __pyx_L29_error) } - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_raw_input, __pyx_n_s_decode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 529, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 575, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + if (unlikely(!__pyx_v_raw_input)) { __Pyx_RaiseUnboundLocalError("raw_input"); __PYX_ERR(0, 575, __pyx_L29_error) } __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); + __Pyx_DECREF_SET(__pyx_t_11, function); } } - __pyx_t_12 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_1, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_u_utf_8); + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_1, __pyx_v_raw_input) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_raw_input); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 529, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 529, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":530 - * print(color_cyan(b'--- Input ---')) - * print(raw_input.decode('utf-8')) - * print(color_cyan(b'--- Diff ---')) # <<<<<<<<<<<<<< - * for i in range(diff.size()): - * print(diff[i]) + /* "src/ktlib.pyx":576 + * log(color_cyan('--- Input ---')) + * log(raw_input) + * log(color_cyan('--- Diff ---')) # <<<<<<<<<<<<<< + * for i in range(len(diff)): + * log(diff[i]) */ - __pyx_t_13 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_k_Diff, 0)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 530, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 530, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 576, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __pyx_f_3src_5ktlib_color_cyan(__pyx_kp_u_Diff, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":531 - * print(raw_input.decode('utf-8')) - * print(color_cyan(b'--- Diff ---')) - * for i in range(diff.size()): # <<<<<<<<<<<<<< - * print(diff[i]) + /* "src/ktlib.pyx":577 + * log(raw_input) + * log(color_cyan('--- Diff ---')) + * for i in range(len(diff)): # <<<<<<<<<<<<<< + * log(diff[i]) * */ - __pyx_t_28 = __pyx_v_diff.size(); - __pyx_t_33 = __pyx_t_28; - for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) { - __pyx_v_i = __pyx_t_34; + __pyx_t_12 = PyList_GET_SIZE(__pyx_v_diff); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 577, __pyx_L29_error) + __pyx_t_24 = __pyx_t_12; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_24; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* "ktlib.pyx":532 - * print(color_cyan(b'--- Diff ---')) - * for i in range(diff.size()): - * print(diff[i]) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":578 + * log(color_cyan('--- Diff ---')) + * for i in range(len(diff)): + * log(diff[i]) # <<<<<<<<<<<<<< * * except Exception as e: */ - __pyx_t_12 = __pyx_convert_PyUnicode_string_to_py_std__in_string((__pyx_v_diff[__pyx_v_i])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 532, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 532, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 578, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_1, PyList_GET_ITEM(__pyx_v_diff, __pyx_v_i)) : __Pyx_PyObject_CallOneArg(__pyx_t_11, PyList_GET_ITEM(__pyx_v_diff, __pyx_v_i)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L29_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } __pyx_L101:; - /* "ktlib.pyx":489 + /* "src/ktlib.pyx":535 * expected.clear() * diff.clear() * try: # <<<<<<<<<<<<<< @@ -11402,85 +12005,99 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v goto __pyx_L36_try_end; __pyx_L29_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":534 - * print(diff[i]) + /* "src/ktlib.pyx":580 + * log(diff[i]) * * except Exception as e: # <<<<<<<<<<<<<< - * print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) - * if self.post_script.size() > 0: + * log(color_red(f'Test case #{sample.index}: Runtime Error {e}')) + * */ __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_10) { - __Pyx_AddTraceback("ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_1) < 0) __PYX_ERR(0, 534, __pyx_L31_except_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GOTREF(__pyx_t_12); + __Pyx_AddTraceback("src.ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_11, &__pyx_t_1) < 0) __PYX_ERR(0, 580, __pyx_L31_except_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_11); __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); - __pyx_v_e = __pyx_t_12; + __Pyx_INCREF(__pyx_t_11); + __pyx_v_e = __pyx_t_11; /*try:*/ { - /* "ktlib.pyx":535 + /* "src/ktlib.pyx":581 * * except Exception as e: - * print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) # <<<<<<<<<<<<<< - * if self.post_script.size() > 0: - * subprocess.check_call(shlex.split(self.post_script)) + * log(color_red(f'Test case #{sample.index}: Runtime Error {e}')) # <<<<<<<<<<<<<< + * + * if self.post_script: */ - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = 0; - __pyx_t_32 = 127; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = 0; + __pyx_t_28 = 127; __Pyx_INCREF(__pyx_kp_u_Test_case); - __pyx_t_11 += 11; + __pyx_t_12 += 11; __Pyx_GIVEREF(__pyx_kp_u_Test_case); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Test_case); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_Test_case); + __pyx_t_29 = __Pyx_PyObject_GetAttrStr(__pyx_v_sample, __pyx_n_s_index); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_30 = __Pyx_PyObject_FormatSimple(__pyx_t_29, __pyx_empty_unicode); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_30) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_30) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_30); + __pyx_t_30 = 0; __Pyx_INCREF(__pyx_kp_u_Runtime_Error); - __pyx_t_11 += 16; + __pyx_t_12 += 16; __Pyx_GIVEREF(__pyx_kp_u_Runtime_Error); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_Runtime_Error); - __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_32; - __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_11, __pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_26 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_t_26, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L109_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 535, __pyx_L109_error) + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_kp_u_Runtime_Error); + __pyx_t_30 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_28 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_30) > __pyx_t_28) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_30) : __pyx_t_28; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_30); + __pyx_t_30 = 0; + __pyx_t_30 = __Pyx_PyUnicode_Join(__pyx_t_13, 4, __pyx_t_12, __pyx_t_28); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __pyx_f_3src_5ktlib_color_red(((PyObject*)__pyx_t_30), 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 581, __pyx_L109_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __pyx_t_30 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_30 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_30)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_30); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_30) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_30, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_13); + __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L109_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "ktlib.pyx":534 - * print(diff[i]) + /* "src/ktlib.pyx":580 + * log(diff[i]) * * except Exception as e: # <<<<<<<<<<<<<< - * print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) - * if self.post_script.size() > 0: + * log(color_red(f'Test case #{sample.index}: Runtime Error {e}')) + * */ /*finally:*/ { /*normal exit:*/{ @@ -11492,48 +12109,50 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_24 = 0; __pyx_t_37 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_32 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_24, &__pyx_t_37); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_32); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_37); - __pyx_t_10 = __pyx_lineno; __pyx_t_35 = __pyx_clineno; __pyx_t_36 = __pyx_filename; + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_32); + __pyx_t_10 = __pyx_lineno; __pyx_t_27 = __pyx_clineno; __pyx_t_31 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_37); - __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_24, __pyx_t_37); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_32); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_32); } __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); - __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_24 = 0; __pyx_t_37 = 0; - __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_35; __pyx_filename = __pyx_t_36; + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_32 = 0; + __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_27; __pyx_filename = __pyx_t_31; goto __pyx_L31_except_error; } __pyx_L110:; } - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L30_exception_handled; } goto __pyx_L31_except_error; __pyx_L31_except_error:; - /* "ktlib.pyx":489 + /* "src/ktlib.pyx":535 * expected.clear() * diff.clear() * try: # <<<<<<<<<<<<<< @@ -11553,132 +12172,138 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v __pyx_L36_try_end:; } - /* "ktlib.pyx":484 - * subprocess.check_call(shlex.split(self.pre_script)) + /* "src/ktlib.pyx":530 + * str current_diff, now_diff * * for sample in usable_samples: # <<<<<<<<<<<<<< * is_ac = True * actual.clear() */ } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":536 - * except Exception as e: - * print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) - * if self.post_script.size() > 0: # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":583 + * log(color_red(f'Test case #{sample.index}: Runtime Error {e}')) + * + * if self.post_script: # <<<<<<<<<<<<<< * subprocess.check_call(shlex.split(self.post_script)) * */ - __pyx_t_7 = ((__pyx_v_self->post_script.size() > 0) != 0); - if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_self->post_script != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_self->post_script) != 0); + if (__pyx_t_8) { - /* "ktlib.pyx":537 - * print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) - * if self.post_script.size() > 0: - * subprocess.check_call(shlex.split(self.post_script)) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":584 * + * if self.post_script: + * subprocess.check_call(shlex.split(self.post_script)) # <<<<<<<<<<<<<< * + * @cython.final */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_check_call); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_check_call); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_shlex); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_shlex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->post_script); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_13); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_self->post_script) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->post_script); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); + __Pyx_DECREF_SET(__pyx_t_11, function); } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_1); + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":536 - * except Exception as e: - * print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) - * if self.post_script.size() > 0: # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":583 + * log(color_red(f'Test case #{sample.index}: Runtime Error {e}')) + * + * if self.post_script: # <<<<<<<<<<<<<< * subprocess.check_call(shlex.split(self.post_script)) * */ } - /* "ktlib.pyx":434 + /* "src/ktlib.pyx":477 * * - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * ''' Run the executable file against sample input and output files present in the folder * The sample files will only be recognized if the conditions hold: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_29); + __Pyx_XDECREF(__pyx_t_30); + __Pyx_AddTraceback("src.ktlib.Test._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_p); __Pyx_XDECREF(__pyx_v_input_files); __Pyx_XDECREF(__pyx_v_output_files); __Pyx_XDECREF(__pyx_v_usable_samples); - __Pyx_XDECREF(__pyx_v_Sample); - __Pyx_XDECREF(__pyx_v_pattern); __Pyx_XDECREF(__pyx_v_input_file); __Pyx_XDECREF(__pyx_v_output_file); - __Pyx_XDECREF(__pyx_v_sample); - __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_Sample); + __Pyx_XDECREF(__pyx_v_pattern); + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_XDECREF(__pyx_v_actual); + __Pyx_XDECREF(__pyx_v_expected); + __Pyx_XDECREF(__pyx_v_diff); __Pyx_XDECREF(__pyx_v_raw_input); __Pyx_XDECREF(__pyx_v_proc); + __Pyx_XDECREF(__pyx_v_raw_output); + __Pyx_XDECREF(__pyx_v_ith_line_exp); + __Pyx_XDECREF(__pyx_v_ith_line_actual); + __Pyx_XDECREF(__pyx_v_current_diff); + __Pyx_XDECREF(__pyx_v_now_diff); + __Pyx_XDECREF(__pyx_v_sample); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_p); + __Pyx_XDECREF(__pyx_v_lhs); + __Pyx_XDECREF(__pyx_v_rhs); __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_f); - __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_f); + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_x); + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_x); __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_l); __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_z); __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_z); __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_z); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "(tree fragment)":1 @@ -11688,19 +12313,19 @@ static PyObject *__pyx_f_5ktlib_4Test__act(struct __pyx_obj_5ktlib_Test *__pyx_v */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_4Test_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_4Test_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_4Test_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_4Test_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_4Test___reduce_cython__(((struct __pyx_obj_5ktlib_Test *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_4Test___reduce_cython__(((struct __pyx_obj_3src_5ktlib_Test *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Test *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11712,7 +12337,7 @@ static PyObject *__pyx_pf_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __ * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11727,7 +12352,7 @@ static PyObject *__pyx_pf_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Test.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Test.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -11742,19 +12367,19 @@ static PyObject *__pyx_pf_5ktlib_4Test___reduce_cython__(CYTHON_UNUSED struct __ */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_4Test_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_4Test_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_4Test_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_4Test_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_4Test_2__setstate_cython__(((struct __pyx_obj_5ktlib_Test *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_4Test_2__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Test *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_4Test_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Test *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_4Test_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Test *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11765,7 +12390,7 @@ static PyObject *__pyx_pf_5ktlib_4Test_2__setstate_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11781,110 +12406,113 @@ static PyObject *__pyx_pf_5ktlib_4Test_2__setstate_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Test.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Test.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":552 - * string problem_id +/* "src/ktlib.pyx":599 + * str problem_id * * def __cinit__(self): # <<<<<<<<<<<<<< - * self.ac_icon = b':heavy_check_mark:' - * self.rj_icon = b':heavy_multiplication_x:' + * self.ac_icon = ':heavy_check_mark:' + * self.rj_icon = ':heavy_multiplication_x:' */ /* Python wrapper */ -static int __pyx_pw_5ktlib_6Submit_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5ktlib_6Submit_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_3src_5ktlib_6Submit_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3src_5ktlib_6Submit_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - __pyx_r = __pyx_pf_5ktlib_6Submit___cinit__(((struct __pyx_obj_5ktlib_Submit *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_6Submit___cinit__(((struct __pyx_obj_3src_5ktlib_Submit *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5ktlib_6Submit___cinit__(struct __pyx_obj_5ktlib_Submit *__pyx_v_self) { +static int __pyx_pf_3src_5ktlib_6Submit___cinit__(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - std::string __pyx_t_1; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "ktlib.pyx":553 + /* "src/ktlib.pyx":600 * * def __cinit__(self): - * self.ac_icon = b':heavy_check_mark:' # <<<<<<<<<<<<<< - * self.rj_icon = b':heavy_multiplication_x:' - * self.sk_icon = b':white_medium_square:' + * self.ac_icon = ':heavy_check_mark:' # <<<<<<<<<<<<<< + * self.rj_icon = ':heavy_multiplication_x:' + * self.sk_icon = ':white_medium_square:' */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_heavy_check_mark); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 553, __pyx_L1_error) - __pyx_v_self->ac_icon = __pyx_t_1; + __Pyx_INCREF(__pyx_kp_u_heavy_check_mark); + __Pyx_GIVEREF(__pyx_kp_u_heavy_check_mark); + __Pyx_GOTREF(__pyx_v_self->ac_icon); + __Pyx_DECREF(__pyx_v_self->ac_icon); + __pyx_v_self->ac_icon = __pyx_kp_u_heavy_check_mark; - /* "ktlib.pyx":554 + /* "src/ktlib.pyx":601 * def __cinit__(self): - * self.ac_icon = b':heavy_check_mark:' - * self.rj_icon = b':heavy_multiplication_x:' # <<<<<<<<<<<<<< - * self.sk_icon = b':white_medium_square:' + * self.ac_icon = ':heavy_check_mark:' + * self.rj_icon = ':heavy_multiplication_x:' # <<<<<<<<<<<<<< + * self.sk_icon = ':white_medium_square:' * */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_heavy_multiplication_x); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 554, __pyx_L1_error) - __pyx_v_self->rj_icon = __pyx_t_1; + __Pyx_INCREF(__pyx_kp_u_heavy_multiplication_x); + __Pyx_GIVEREF(__pyx_kp_u_heavy_multiplication_x); + __Pyx_GOTREF(__pyx_v_self->rj_icon); + __Pyx_DECREF(__pyx_v_self->rj_icon); + __pyx_v_self->rj_icon = __pyx_kp_u_heavy_multiplication_x; - /* "ktlib.pyx":555 - * self.ac_icon = b':heavy_check_mark:' - * self.rj_icon = b':heavy_multiplication_x:' - * self.sk_icon = b':white_medium_square:' # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":602 + * self.ac_icon = ':heavy_check_mark:' + * self.rj_icon = ':heavy_multiplication_x:' + * self.sk_icon = ':white_medium_square:' # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_white_medium_square); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L1_error) - __pyx_v_self->sk_icon = __pyx_t_1; + __Pyx_INCREF(__pyx_kp_u_white_medium_square); + __Pyx_GIVEREF(__pyx_kp_u_white_medium_square); + __Pyx_GOTREF(__pyx_v_self->sk_icon); + __Pyx_DECREF(__pyx_v_self->sk_icon); + __pyx_v_self->sk_icon = __pyx_kp_u_white_medium_square; - /* "ktlib.pyx":552 - * string problem_id + /* "src/ktlib.pyx":599 + * str problem_id * * def __cinit__(self): # <<<<<<<<<<<<<< - * self.ac_icon = b':heavy_check_mark:' - * self.rj_icon = b':heavy_multiplication_x:' + * self.ac_icon = ':heavy_check_mark:' + * self.rj_icon = ':heavy_multiplication_x:' */ /* function exit code */ __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("ktlib.Submit.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":558 +/* "src/ktlib.pyx":605 * * - * cdef bool_t is_finished(self, object output_lines, object result, string& status, string run_time): # <<<<<<<<<<<<<< + * cdef bint is_finished(self, object output_lines, object result, str status, str run_time) except? -1: # <<<<<<<<<<<<<< * ''' Judge whether the result and status obtained from kattis submission * page has indicated whether the solution judgement has been done */ -static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *__pyx_v_self, PyObject *__pyx_v_output_lines, PyObject *__pyx_v_result, std::string &__pyx_v_status, std::string __pyx_v_run_time) { +static int __pyx_f_3src_5ktlib_6Submit_is_finished(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self, PyObject *__pyx_v_output_lines, PyObject *__pyx_v_result, PyObject *__pyx_v_status, PyObject *__pyx_v_run_time) { int __pyx_v_tot_res; int __pyx_v_ac_ct; - bool __pyx_v_is_ac; - bool __pyx_v_rejected; - bool __pyx_v_finished; - std::string __pyx_v__status; + int __pyx_v_is_ac; + int __pyx_v_rejected; + int __pyx_v_finished; + PyObject *__pyx_v__status = 0; PyObject *__pyx_v_res = NULL; PyObject *__pyx_v__class = NULL; - bool __pyx_r; + int __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -11893,66 +12521,68 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("is_finished", 0); - /* "ktlib.pyx":569 + /* "src/ktlib.pyx":616 * ''' * cdef: * int tot_res = len(result) # <<<<<<<<<<<<<< * int ac_ct = 0 - * bool_t is_ac = True + * bint is_ac = True */ - __pyx_t_1 = PyObject_Length(__pyx_v_result); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 569, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_result); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 616, __pyx_L1_error) __pyx_v_tot_res = __pyx_t_1; - /* "ktlib.pyx":570 + /* "src/ktlib.pyx":617 * cdef: * int tot_res = len(result) * int ac_ct = 0 # <<<<<<<<<<<<<< - * bool_t is_ac = True - * bool_t rejected = False + * bint is_ac = True + * bint rejected = False */ __pyx_v_ac_ct = 0; - /* "ktlib.pyx":571 + /* "src/ktlib.pyx":618 * int tot_res = len(result) * int ac_ct = 0 - * bool_t is_ac = True # <<<<<<<<<<<<<< - * bool_t rejected = False - * bool_t finished = False + * bint is_ac = True # <<<<<<<<<<<<<< + * bint rejected = False + * bint finished = False */ __pyx_v_is_ac = 1; - /* "ktlib.pyx":572 + /* "src/ktlib.pyx":619 * int ac_ct = 0 - * bool_t is_ac = True - * bool_t rejected = False # <<<<<<<<<<<<<< - * bool_t finished = False - * string _status = status + * bint is_ac = True + * bint rejected = False # <<<<<<<<<<<<<< + * bint finished = False + * str _status = status */ __pyx_v_rejected = 0; - /* "ktlib.pyx":573 - * bool_t is_ac = True - * bool_t rejected = False - * bool_t finished = False # <<<<<<<<<<<<<< - * string _status = status + /* "src/ktlib.pyx":620 + * bint is_ac = True + * bint rejected = False + * bint finished = False # <<<<<<<<<<<<<< + * str _status = status * */ __pyx_v_finished = 0; - /* "ktlib.pyx":574 - * bool_t rejected = False - * bool_t finished = False - * string _status = status # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":621 + * bint rejected = False + * bint finished = False + * str _status = status # <<<<<<<<<<<<<< * * for res in result: */ + __Pyx_INCREF(__pyx_v_status); __pyx_v__status = __pyx_v_status; - /* "ktlib.pyx":576 - * string _status = status + /* "src/ktlib.pyx":623 + * str _status = status * * for res in result: # <<<<<<<<<<<<<< * _class = res.get('class', None) @@ -11962,26 +12592,26 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __pyx_t_2 = __pyx_v_result; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -11991,7 +12621,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 576, __pyx_L1_error) + else __PYX_ERR(0, 623, __pyx_L1_error) } break; } @@ -12000,45 +12630,45 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __Pyx_XDECREF_SET(__pyx_v_res, __pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":577 + /* "src/ktlib.pyx":624 * * for res in result: * _class = res.get('class', None) # <<<<<<<<<<<<<< * if _class: * if _class[0] == 'accepted': */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v__class, __pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":578 + /* "src/ktlib.pyx":625 * for res in result: * _class = res.get('class', None) * if _class: # <<<<<<<<<<<<<< * if _class[0] == 'accepted': * ac_ct += 1 */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v__class); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v__class); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 625, __pyx_L1_error) if (__pyx_t_6) { - /* "ktlib.pyx":579 + /* "src/ktlib.pyx":626 * _class = res.get('class', None) * if _class: * if _class[0] == 'accepted': # <<<<<<<<<<<<<< * ac_ct += 1 * else: # rejected */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v__class, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v__class, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_accepted, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_accepted, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "ktlib.pyx":580 + /* "src/ktlib.pyx":627 * if _class: * if _class[0] == 'accepted': * ac_ct += 1 # <<<<<<<<<<<<<< @@ -12047,7 +12677,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ */ __pyx_v_ac_ct = (__pyx_v_ac_ct + 1); - /* "ktlib.pyx":579 + /* "src/ktlib.pyx":626 * _class = res.get('class', None) * if _class: * if _class[0] == 'accepted': # <<<<<<<<<<<<<< @@ -12057,7 +12687,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ goto __pyx_L6; } - /* "ktlib.pyx":582 + /* "src/ktlib.pyx":629 * ac_ct += 1 * else: # rejected * rejected = True # <<<<<<<<<<<<<< @@ -12067,7 +12697,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ /*else*/ { __pyx_v_rejected = 1; - /* "ktlib.pyx":583 + /* "src/ktlib.pyx":630 * else: # rejected * rejected = True * is_ac = False # <<<<<<<<<<<<<< @@ -12076,7 +12706,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ */ __pyx_v_is_ac = 0; - /* "ktlib.pyx":584 + /* "src/ktlib.pyx":631 * rejected = True * is_ac = False * break # <<<<<<<<<<<<<< @@ -12087,7 +12717,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ } __pyx_L6:; - /* "ktlib.pyx":578 + /* "src/ktlib.pyx":625 * for res in result: * _class = res.get('class', None) * if _class: # <<<<<<<<<<<<<< @@ -12096,8 +12726,8 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ */ } - /* "ktlib.pyx":576 - * string _status = status + /* "src/ktlib.pyx":623 + * str _status = status * * for res in result: # <<<<<<<<<<<<<< * _class = res.get('class', None) @@ -12107,29 +12737,26 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __pyx_L4_break:; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":585 + /* "src/ktlib.pyx":632 * is_ac = False * break * res = [self.ac_icon] * ac_ct # <<<<<<<<<<<<<< * * if rejected: */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->ac_icon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error) + __pyx_t_2 = PyList_New(1 * ((__pyx_v_ac_ct<0) ? 0:__pyx_v_ac_ct)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyList_New(1 * ((__pyx_v_ac_ct<0) ? 0:__pyx_v_ac_ct)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_ac_ct; __pyx_temp++) { - __Pyx_INCREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyList_SET_ITEM(__pyx_t_5, __pyx_temp, __pyx_t_2); + __Pyx_INCREF(__pyx_v_self->ac_icon); + __Pyx_GIVEREF(__pyx_v_self->ac_icon); + PyList_SET_ITEM(__pyx_t_2, __pyx_temp, __pyx_v_self->ac_icon); } } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_res, __pyx_t_5); - __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_res, __pyx_t_2); + __pyx_t_2 = 0; - /* "ktlib.pyx":587 + /* "src/ktlib.pyx":634 * res = [self.ac_icon] * ac_ct * * if rejected: # <<<<<<<<<<<<<< @@ -12139,19 +12766,16 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __pyx_t_6 = (__pyx_v_rejected != 0); if (__pyx_t_6) { - /* "ktlib.pyx":588 + /* "src/ktlib.pyx":635 * * if rejected: * res.append(self.rj_icon) # <<<<<<<<<<<<<< * while len(res) < tot_res: * res.append(self.sk_icon) */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->rj_icon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_res, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 588, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_res, __pyx_v_self->rj_icon); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 635, __pyx_L1_error) - /* "ktlib.pyx":587 + /* "src/ktlib.pyx":634 * res = [self.ac_icon] * ac_ct * * if rejected: # <<<<<<<<<<<<<< @@ -12160,7 +12784,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ */ } - /* "ktlib.pyx":589 + /* "src/ktlib.pyx":636 * if rejected: * res.append(self.rj_icon) * while len(res) < tot_res: # <<<<<<<<<<<<<< @@ -12168,24 +12792,21 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ * */ while (1) { - __pyx_t_1 = PyObject_Length(__pyx_v_res); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_res); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 636, __pyx_L1_error) __pyx_t_6 = ((__pyx_t_1 < __pyx_v_tot_res) != 0); if (!__pyx_t_6) break; - /* "ktlib.pyx":590 + /* "src/ktlib.pyx":637 * res.append(self.rj_icon) * while len(res) < tot_res: * res.append(self.sk_icon) # <<<<<<<<<<<<<< * * if rejected: */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->sk_icon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 590, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_res, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 590, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_res, __pyx_v_self->sk_icon); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 637, __pyx_L1_error) } - /* "ktlib.pyx":592 + /* "src/ktlib.pyx":639 * res.append(self.sk_icon) * * if rejected: # <<<<<<<<<<<<<< @@ -12195,7 +12816,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __pyx_t_6 = (__pyx_v_rejected != 0); if (__pyx_t_6) { - /* "ktlib.pyx":593 + /* "src/ktlib.pyx":640 * * if rejected: * finished = True # <<<<<<<<<<<<<< @@ -12204,7 +12825,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ */ __pyx_v_finished = 1; - /* "ktlib.pyx":592 + /* "src/ktlib.pyx":639 * res.append(self.sk_icon) * * if rejected: # <<<<<<<<<<<<<< @@ -12214,78 +12835,83 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ goto __pyx_L10; } - /* "ktlib.pyx":595 + /* "src/ktlib.pyx":642 * finished = True * else: * finished = ac_ct == tot_res # <<<<<<<<<<<<<< * - * if status == b'Compiling': + * if status == 'Compiling': */ /*else*/ { __pyx_v_finished = (__pyx_v_ac_ct == __pyx_v_tot_res); } __pyx_L10:; - /* "ktlib.pyx":597 + /* "src/ktlib.pyx":644 * finished = ac_ct == tot_res * - * if status == b'Compiling': # <<<<<<<<<<<<<< + * if status == 'Compiling': # <<<<<<<<<<<<<< * finished = False - * elif status == b'Compile Error': + * elif status == 'Compile Error': */ - __pyx_t_6 = ((__pyx_v_status == ((char const *)"Compiling")) != 0); - if (__pyx_t_6) { + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_status, __pyx_n_u_Compiling, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 644, __pyx_L1_error) + __pyx_t_8 = (__pyx_t_6 != 0); + if (__pyx_t_8) { - /* "ktlib.pyx":598 + /* "src/ktlib.pyx":645 * - * if status == b'Compiling': + * if status == 'Compiling': * finished = False # <<<<<<<<<<<<<< - * elif status == b'Compile Error': + * elif status == 'Compile Error': * _status = color_red(status) */ __pyx_v_finished = 0; - /* "ktlib.pyx":597 + /* "src/ktlib.pyx":644 * finished = ac_ct == tot_res * - * if status == b'Compiling': # <<<<<<<<<<<<<< + * if status == 'Compiling': # <<<<<<<<<<<<<< * finished = False - * elif status == b'Compile Error': + * elif status == 'Compile Error': */ goto __pyx_L11; } - /* "ktlib.pyx":599 - * if status == b'Compiling': + /* "src/ktlib.pyx":646 + * if status == 'Compiling': * finished = False - * elif status == b'Compile Error': # <<<<<<<<<<<<<< + * elif status == 'Compile Error': # <<<<<<<<<<<<<< * _status = color_red(status) * elif not finished: */ - __pyx_t_6 = ((__pyx_v_status == ((char const *)"Compile Error")) != 0); + __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_status, __pyx_kp_u_Compile_Error, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 646, __pyx_L1_error) + __pyx_t_6 = (__pyx_t_8 != 0); if (__pyx_t_6) { - /* "ktlib.pyx":600 + /* "src/ktlib.pyx":647 * finished = False - * elif status == b'Compile Error': + * elif status == 'Compile Error': * _status = color_red(status) # <<<<<<<<<<<<<< * elif not finished: * _status = color_cyan(status) */ - __pyx_v__status = __pyx_f_5ktlib_color_red(__pyx_v_status, 0); + __pyx_t_2 = __pyx_f_3src_5ktlib_color_red(__pyx_v_status, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v__status, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "ktlib.pyx":599 - * if status == b'Compiling': + /* "src/ktlib.pyx":646 + * if status == 'Compiling': * finished = False - * elif status == b'Compile Error': # <<<<<<<<<<<<<< + * elif status == 'Compile Error': # <<<<<<<<<<<<<< * _status = color_red(status) * elif not finished: */ goto __pyx_L11; } - /* "ktlib.pyx":601 - * elif status == b'Compile Error': + /* "src/ktlib.pyx":648 + * elif status == 'Compile Error': * _status = color_red(status) * elif not finished: # <<<<<<<<<<<<<< * _status = color_cyan(status) @@ -12294,17 +12920,20 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __pyx_t_6 = ((!(__pyx_v_finished != 0)) != 0); if (__pyx_t_6) { - /* "ktlib.pyx":602 + /* "src/ktlib.pyx":649 * _status = color_red(status) * elif not finished: * _status = color_cyan(status) # <<<<<<<<<<<<<< * else: - * if status == b'Running': # status text not updated, lets try again + * if status == 'Running': # status text not updated, lets try again */ - __pyx_v__status = __pyx_f_5ktlib_color_cyan(__pyx_v_status, 0); + __pyx_t_2 = __pyx_f_3src_5ktlib_color_cyan(__pyx_v_status, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 649, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v__status, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "ktlib.pyx":601 - * elif status == b'Compile Error': + /* "src/ktlib.pyx":648 + * elif status == 'Compile Error': * _status = color_red(status) * elif not finished: # <<<<<<<<<<<<<< * _status = color_cyan(status) @@ -12313,57 +12942,61 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ goto __pyx_L11; } - /* "ktlib.pyx":604 + /* "src/ktlib.pyx":651 * _status = color_cyan(status) * else: - * if status == b'Running': # status text not updated, lets try again # <<<<<<<<<<<<<< + * if status == 'Running': # status text not updated, lets try again # <<<<<<<<<<<<<< * finished = False * elif is_ac: */ /*else*/ { - __pyx_t_6 = ((__pyx_v_status == ((char const *)"Running")) != 0); - if (__pyx_t_6) { + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_status, __pyx_n_u_Running, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 651, __pyx_L1_error) + __pyx_t_8 = (__pyx_t_6 != 0); + if (__pyx_t_8) { - /* "ktlib.pyx":605 + /* "src/ktlib.pyx":652 * else: - * if status == b'Running': # status text not updated, lets try again + * if status == 'Running': # status text not updated, lets try again * finished = False # <<<<<<<<<<<<<< * elif is_ac: * _status = color_green(status) */ __pyx_v_finished = 0; - /* "ktlib.pyx":604 + /* "src/ktlib.pyx":651 * _status = color_cyan(status) * else: - * if status == b'Running': # status text not updated, lets try again # <<<<<<<<<<<<<< + * if status == 'Running': # status text not updated, lets try again # <<<<<<<<<<<<<< * finished = False * elif is_ac: */ goto __pyx_L12; } - /* "ktlib.pyx":606 - * if status == b'Running': # status text not updated, lets try again + /* "src/ktlib.pyx":653 + * if status == 'Running': # status text not updated, lets try again * finished = False * elif is_ac: # <<<<<<<<<<<<<< * _status = color_green(status) * else: */ - __pyx_t_6 = (__pyx_v_is_ac != 0); - if (__pyx_t_6) { + __pyx_t_8 = (__pyx_v_is_ac != 0); + if (__pyx_t_8) { - /* "ktlib.pyx":607 + /* "src/ktlib.pyx":654 * finished = False * elif is_ac: * _status = color_green(status) # <<<<<<<<<<<<<< * else: * _status = color_red(status) */ - __pyx_v__status = __pyx_f_5ktlib_color_green(__pyx_v_status, 0); + __pyx_t_2 = __pyx_f_3src_5ktlib_color_green(__pyx_v_status, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v__status, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "ktlib.pyx":606 - * if status == b'Running': # status text not updated, lets try again + /* "src/ktlib.pyx":653 + * if status == 'Running': # status text not updated, lets try again * finished = False * elif is_ac: # <<<<<<<<<<<<<< * _status = color_green(status) @@ -12372,7 +13005,7 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ goto __pyx_L12; } - /* "ktlib.pyx":609 + /* "src/ktlib.pyx":656 * _status = color_green(status) * else: * _status = color_red(status) # <<<<<<<<<<<<<< @@ -12380,142 +13013,145 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ * output_lines['current time '] = f"{time.strftime('%02l:%M%p %Z on %b %d, %Y')}" */ /*else*/ { - __pyx_v__status = __pyx_f_5ktlib_color_red(__pyx_v_status, 0); + __pyx_t_2 = __pyx_f_3src_5ktlib_color_red(__pyx_v_status, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v__status, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; } __pyx_L12:; } __pyx_L11:; - /* "ktlib.pyx":611 + /* "src/ktlib.pyx":658 * _status = color_red(status) * * output_lines['current time '] = f"{time.strftime('%02l:%M%p %Z on %b %d, %Y')}" # <<<<<<<<<<<<<< * output_lines['language '] = f'{self.lang}' * output_lines['problem id '] = self.problem_id */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strftime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_strftime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_kp_u_02l_M_p_Z_on_b_d_Y) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_02l_M_p_Z_on_b_d_Y); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_02l_M_p_Z_on_b_d_Y) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_02l_M_p_Z_on_b_d_Y); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_current_time, __pyx_t_4) < 0)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_current_time, __pyx_t_4) < 0)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":612 + /* "src/ktlib.pyx":659 * * output_lines['current time '] = f"{time.strftime('%02l:%M%p %Z on %b %d, %Y')}" * output_lines['language '] = f'{self.lang}' # <<<<<<<<<<<<<< * output_lines['problem id '] = self.problem_id * output_lines['running time '] = f'{run_time}' */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->lang); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_self->lang); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_language, __pyx_t_4) < 0)) __PYX_ERR(0, 612, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_language, __pyx_t_4) < 0)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":613 + /* "src/ktlib.pyx":660 * output_lines['current time '] = f"{time.strftime('%02l:%M%p %Z on %b %d, %Y')}" * output_lines['language '] = f'{self.lang}' * output_lines['problem id '] = self.problem_id # <<<<<<<<<<<<<< * output_lines['running time '] = f'{run_time}' * output_lines['submission id '] = self.submission_id */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->problem_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_problem_id_2, __pyx_t_4) < 0)) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_t_4 = __pyx_v_self->problem_id; + __Pyx_INCREF(__pyx_t_4); + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_problem_id_2, __pyx_t_4) < 0)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":614 + /* "src/ktlib.pyx":661 * output_lines['language '] = f'{self.lang}' * output_lines['problem id '] = self.problem_id * output_lines['running time '] = f'{run_time}' # <<<<<<<<<<<<<< * output_lines['submission id '] = self.submission_id * output_lines['submission result '] = f'{_status}' */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_run_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_run_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_running_time, __pyx_t_4) < 0)) __PYX_ERR(0, 614, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_running_time, __pyx_t_4) < 0)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":615 + /* "src/ktlib.pyx":662 * output_lines['problem id '] = self.problem_id * output_lines['running time '] = f'{run_time}' * output_lines['submission id '] = self.submission_id # <<<<<<<<<<<<<< * output_lines['submission result '] = f'{_status}' * output_lines['test cases '] = f"{emoji.emojize(' '.join(res))}" */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->submission_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_submission_id, __pyx_t_4) < 0)) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_t_4 = __pyx_v_self->submission_id; + __Pyx_INCREF(__pyx_t_4); + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_submission_id, __pyx_t_4) < 0)) __PYX_ERR(0, 662, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":616 + /* "src/ktlib.pyx":663 * output_lines['running time '] = f'{run_time}' * output_lines['submission id '] = self.submission_id * output_lines['submission result '] = f'{_status}' # <<<<<<<<<<<<<< * output_lines['test cases '] = f"{emoji.emojize(' '.join(res))}" * return finished */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v__status); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v__status); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_submission_result, __pyx_t_4) < 0)) __PYX_ERR(0, 616, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_submission_result, __pyx_t_4) < 0)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":617 + /* "src/ktlib.pyx":664 * output_lines['submission id '] = self.submission_id * output_lines['submission result '] = f'{_status}' * output_lines['test cases '] = f"{emoji.emojize(' '.join(res))}" # <<<<<<<<<<<<<< * return finished * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_emoji); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_emojize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_emoji); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyUnicode_Join(__pyx_kp_u__24, __pyx_v_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_emojize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyUnicode_Join(__pyx_kp_u__18, __pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_test_cases, __pyx_t_2) < 0)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyObject_SetItem(__pyx_v_output_lines, __pyx_kp_u_test_cases, __pyx_t_5) < 0)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":618 + /* "src/ktlib.pyx":665 * output_lines['submission result '] = f'{_status}' * output_lines['test cases '] = f"{emoji.emojize(' '.join(res))}" * return finished # <<<<<<<<<<<<<< @@ -12525,10 +13161,10 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __pyx_r = __pyx_v_finished; goto __pyx_L0; - /* "ktlib.pyx":558 + /* "src/ktlib.pyx":605 * * - * cdef bool_t is_finished(self, object output_lines, object result, string& status, string run_time): # <<<<<<<<<<<<<< + * cdef bint is_finished(self, object output_lines, object result, str status, str run_time) except? -1: # <<<<<<<<<<<<<< * ''' Judge whether the result and status obtained from kattis submission * page has indicated whether the solution judgement has been done */ @@ -12538,37 +13174,37 @@ static bool __pyx_f_5ktlib_6Submit_is_finished(struct __pyx_obj_5ktlib_Submit *_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_WriteUnraisable("ktlib.Submit.is_finished", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("src.ktlib.Submit.is_finished", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; + __Pyx_XDECREF(__pyx_v__status); __Pyx_XDECREF(__pyx_v_res); __Pyx_XDECREF(__pyx_v__class); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":622 +/* "src/ktlib.pyx":669 * * - * cdef _render_result(self, string submission_url_ret): # <<<<<<<<<<<<<< + * cdef void _render_result(self, str submission_url_ret) except *: # <<<<<<<<<<<<<< * ''' Continuously polling for result from `submission_url_ret` * Args: */ -static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_Submit *__pyx_v_self, std::string __pyx_v_submission_url_ret) { +static void __pyx_f_3src_5ktlib_6Submit__render_result(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self, PyObject *__pyx_v_submission_url_ret) { int __pyx_v_time_out; - float __pyx_v_cur_time; - std::string __pyx_v_status_ret; - std::string __pyx_v_runtime_ret; - bool __pyx_v_done; + double __pyx_v_cur_time; + PyObject *__pyx_v_status_ret = 0; + PyObject *__pyx_v_runtime_ret = 0; + int __pyx_v_done; PyObject *__pyx_v_output_lines = NULL; PyObject *__pyx_v_page = NULL; PyObject *__pyx_v_soup = NULL; PyObject *__pyx_v_submission_data = NULL; PyObject *__pyx_v_submission_ret = NULL; PyObject *__pyx_v_e = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -12585,45 +13221,46 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S PyObject *__pyx_t_13 = NULL; int __pyx_t_14; PyObject *__pyx_t_15 = NULL; - std::string __pyx_t_16; - int __pyx_t_17; - char const *__pyx_t_18; - PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + int __pyx_t_18; + char const *__pyx_t_19; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; __Pyx_RefNannySetupContext("_render_result", 0); - /* "ktlib.pyx":628 + /* "src/ktlib.pyx":675 * ''' * cdef: * int time_out = 20 # <<<<<<<<<<<<<< - * float cur_time = 0 - * string status_ret + * double cur_time = 0 + * str status_ret */ __pyx_v_time_out = 20; - /* "ktlib.pyx":629 + /* "src/ktlib.pyx":676 * cdef: * int time_out = 20 - * float cur_time = 0 # <<<<<<<<<<<<<< - * string status_ret - * string runtime_ret + * double cur_time = 0 # <<<<<<<<<<<<<< + * str status_ret + * str runtime_ret */ __pyx_v_cur_time = 0.0; - /* "ktlib.pyx":632 - * string status_ret - * string runtime_ret - * bool_t done = False # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":679 + * str status_ret + * str runtime_ret + * bint done = False # <<<<<<<<<<<<<< * * */ __pyx_v_done = 0; - /* "ktlib.pyx":635 + /* "src/ktlib.pyx":682 * * * with output(output_type='dict') as output_lines: # <<<<<<<<<<<<<< @@ -12631,18 +13268,18 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S * try: */ /*with:*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_output_type, __pyx_n_u_dict_2) < 0) __PYX_ERR(0, 635, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_output_type, __pyx_n_u_dict_2) < 0) __PYX_ERR(0, 682, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -12656,7 +13293,7 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L3_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_2; @@ -12674,7 +13311,7 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __pyx_v_output_lines = __pyx_t_1; __pyx_t_1 = 0; - /* "ktlib.pyx":636 + /* "src/ktlib.pyx":683 * * with output(output_type='dict') as output_lines: * while cur_time < time_out and not done: # <<<<<<<<<<<<<< @@ -12693,7 +13330,7 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __pyx_L15_bool_binop_done:; if (!__pyx_t_9) break; - /* "ktlib.pyx":637 + /* "src/ktlib.pyx":684 * with output(output_type='dict') as output_lines: * while cur_time < time_out and not done: * try: # <<<<<<<<<<<<<< @@ -12709,229 +13346,226 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __Pyx_XGOTREF(__pyx_t_13); /*try:*/ { - /* "ktlib.pyx":638 + /* "src/ktlib.pyx":685 * while cur_time < time_out and not done: * try: * self.login() # <<<<<<<<<<<<<< * page = requests.get(submission_url_ret, cookies=self.cookies, headers=_HEADERS) * soup = BeautifulSoup(page.content, 'html.parser') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.login(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_vtabstruct_3src_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.login(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 685, __pyx_L17_error) - /* "ktlib.pyx":639 + /* "src/ktlib.pyx":686 * try: * self.login() * page = requests.get(submission_url_ret, cookies=self.cookies, headers=_HEADERS) # <<<<<<<<<<<<<< * soup = BeautifulSoup(page.content, 'html.parser') * submission_data = soup.find('div', class_='testcases') */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_requests); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L17_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_requests); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L17_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_submission_url_ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L17_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L17_error) + __Pyx_INCREF(__pyx_v_submission_url_ret); + __Pyx_GIVEREF(__pyx_v_submission_url_ret); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_submission_url_ret); + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cookies, __pyx_v_self->__pyx_base.cookies) < 0) __PYX_ERR(0, 639, __pyx_L17_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_headers, __pyx_v_5ktlib__HEADERS) < 0) __PYX_ERR(0, 639, __pyx_L17_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L17_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cookies, __pyx_v_self->__pyx_base.cookies) < 0) __PYX_ERR(0, 686, __pyx_L17_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_headers, __pyx_v_3src_5ktlib__HEADERS) < 0) __PYX_ERR(0, 686, __pyx_L17_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 686, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_page, __pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":640 + /* "src/ktlib.pyx":687 * self.login() * page = requests.get(submission_url_ret, cookies=self.cookies, headers=_HEADERS) * soup = BeautifulSoup(page.content, 'html.parser') # <<<<<<<<<<<<<< * submission_data = soup.find('div', class_='testcases') * submission_ret = submission_data.find_all('span') */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BeautifulSoup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_page, __pyx_n_s_content); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L17_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BeautifulSoup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_page, __pyx_n_s_content); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_kp_u_html_parser}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L17_error) + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_1, __pyx_kp_u_html_parser}; + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 687, __pyx_L17_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_kp_u_html_parser}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L17_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_1, __pyx_kp_u_html_parser}; + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 687, __pyx_L17_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 640, __pyx_L17_error) + __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 687, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_15); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL; } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_1); __Pyx_INCREF(__pyx_kp_u_html_parser); __Pyx_GIVEREF(__pyx_kp_u_html_parser); PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_kp_u_html_parser); - __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L17_error) + __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 687, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_soup, __pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":641 + /* "src/ktlib.pyx":688 * page = requests.get(submission_url_ret, cookies=self.cookies, headers=_HEADERS) * soup = BeautifulSoup(page.content, 'html.parser') * submission_data = soup.find('div', class_='testcases') # <<<<<<<<<<<<<< * submission_ret = submission_data.find_all('span') * status_ret = soup.find('td', class_='status middle').find('span').text */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 641, __pyx_L17_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 688, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_class_2, __pyx_n_u_testcases) < 0) __PYX_ERR(0, 641, __pyx_L17_error) - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__30, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 641, __pyx_L17_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_class_2, __pyx_n_u_testcases) < 0) __PYX_ERR(0, 688, __pyx_L17_error) + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__31, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 688, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_submission_data, __pyx_t_15); __pyx_t_15 = 0; - /* "ktlib.pyx":642 + /* "src/ktlib.pyx":689 * soup = BeautifulSoup(page.content, 'html.parser') * submission_data = soup.find('div', class_='testcases') * submission_ret = submission_data.find_all('span') # <<<<<<<<<<<<<< * status_ret = soup.find('td', class_='status middle').find('span').text * runtime_ret = soup.find('td', class_='runtime middle').text */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_submission_data, __pyx_n_s_find_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_submission_data, __pyx_n_s_find_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_15 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_n_u_span) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_u_span); + __pyx_t_15 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_u_span) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_span); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 642, __pyx_L17_error) + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 689, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_submission_ret, __pyx_t_15); __pyx_t_15 = 0; - /* "ktlib.pyx":643 + /* "src/ktlib.pyx":690 * submission_data = soup.find('div', class_='testcases') * submission_ret = submission_data.find_all('span') * status_ret = soup.find('td', class_='status middle').find('span').text # <<<<<<<<<<<<<< * runtime_ret = soup.find('td', class_='runtime middle').text * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_class_2, __pyx_kp_u_status_middle) < 0) __PYX_ERR(0, 643, __pyx_L17_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__31, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L17_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L17_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_class_2, __pyx_kp_u_status_middle) < 0) __PYX_ERR(0, 690, __pyx_L17_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__32, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_15 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_n_u_span) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_span); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 643, __pyx_L17_error) + __pyx_t_15 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_n_u_span) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_span); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 690, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L17_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 643, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_status_ret = __pyx_t_16; + if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 690, __pyx_L17_error) + __Pyx_XDECREF_SET(__pyx_v_status_ret, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; - /* "ktlib.pyx":644 + /* "src/ktlib.pyx":691 * submission_ret = submission_data.find_all('span') * status_ret = soup.find('td', class_='status middle').find('span').text * runtime_ret = soup.find('td', class_='runtime middle').text # <<<<<<<<<<<<<< * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) * except Exception as e: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L17_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_soup, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 691, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 644, __pyx_L17_error) + __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 691, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_15); - if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_class_2, __pyx_kp_u_runtime_middle) < 0) __PYX_ERR(0, 644, __pyx_L17_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__31, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_class_2, __pyx_kp_u_runtime_middle) < 0) __PYX_ERR(0, 691, __pyx_L17_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__32, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_text); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 644, __pyx_L17_error) + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_text); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 691, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_t_15); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 644, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_v_runtime_ret = __pyx_t_16; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_15)->tp_name), 0))) __PYX_ERR(0, 691, __pyx_L17_error) + __Pyx_XDECREF_SET(__pyx_v_runtime_ret, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; - /* "ktlib.pyx":645 + /* "src/ktlib.pyx":692 * status_ret = soup.find('td', class_='status middle').find('span').text * runtime_ret = soup.find('td', class_='runtime middle').text * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) # <<<<<<<<<<<<<< * except Exception as e: - * print(color_red(f'Internal error: {e}')) + * log(color_red(f'Internal error: {e}')) */ - __pyx_v_done = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->is_finished(__pyx_v_self, __pyx_v_output_lines, __pyx_v_submission_ret, __pyx_v_status_ret, __pyx_v_runtime_ret); + __pyx_t_9 = __pyx_f_3src_5ktlib_6Submit_is_finished(__pyx_v_self, __pyx_v_output_lines, __pyx_v_submission_ret, __pyx_v_status_ret, __pyx_v_runtime_ret); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L17_error) + __pyx_v_done = __pyx_t_9; - /* "ktlib.pyx":637 + /* "src/ktlib.pyx":684 * with output(output_type='dict') as output_lines: * while cur_time < time_out and not done: * try: # <<<<<<<<<<<<<< @@ -12950,51 +13584,65 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":646 + /* "src/ktlib.pyx":693 * runtime_ret = soup.find('td', class_='runtime middle').text * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) * except Exception as e: # <<<<<<<<<<<<<< - * print(color_red(f'Internal error: {e}')) + * log(color_red(f'Internal error: {e}')) * */ __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_14) { - __Pyx_AddTraceback("ktlib.Submit._render_result", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 646, __pyx_L19_except_error) + __Pyx_AddTraceback("src.ktlib.Submit._render_result", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 693, __pyx_L19_except_error) __Pyx_GOTREF(__pyx_t_15); - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_e = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_e = __pyx_t_1; /*try:*/ { - /* "ktlib.pyx":647 + /* "src/ktlib.pyx":694 * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) * except Exception as e: - * print(color_red(f'Internal error: {e}')) # <<<<<<<<<<<<<< + * log(color_red(f'Internal error: {e}')) # <<<<<<<<<<<<<< * * time.sleep(0.4) */ - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Internal_error, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L30_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L30_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 647, __pyx_L30_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_t_16, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 694, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Internal_error, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 694, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __pyx_f_3src_5ktlib_color_red(((PyObject*)__pyx_t_17), 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 694, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_17, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "ktlib.pyx":646 + /* "src/ktlib.pyx":693 * runtime_ret = soup.find('td', class_='runtime middle').text * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) * except Exception as e: # <<<<<<<<<<<<<< - * print(color_red(f'Internal error: {e}')) + * log(color_red(f'Internal error: {e}')) * */ /*finally:*/ { @@ -13007,47 +13655,49 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_19); + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __Pyx_XGOTREF(__pyx_t_24); - __pyx_t_14 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename; + __Pyx_XGOTREF(__pyx_t_25); + __pyx_t_14 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); + __Pyx_XGIVEREF(__pyx_t_25); + __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25); } - __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21); - __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; - __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18; + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22); + __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; + __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19; goto __pyx_L19_except_error; } __pyx_L31:; } __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L18_exception_handled; } goto __pyx_L19_except_error; __pyx_L19_except_error:; - /* "ktlib.pyx":637 + /* "src/ktlib.pyx":684 * with output(output_type='dict') as output_lines: * while cur_time < time_out and not done: * try: # <<<<<<<<<<<<<< @@ -13067,36 +13717,36 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __pyx_L24_try_end:; } - /* "ktlib.pyx":649 - * print(color_red(f'Internal error: {e}')) + /* "src/ktlib.pyx":696 + * log(color_red(f'Internal error: {e}')) * * time.sleep(0.4) # <<<<<<<<<<<<<< * cur_time += 0.4 * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 649, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sleep); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 649, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sleep); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 696, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_2)) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_15, function); } } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_2, __pyx_float_0_4) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_float_0_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 649, __pyx_L7_error) + __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_1, __pyx_float_0_4) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_float_0_4); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":650 + /* "src/ktlib.pyx":697 * * time.sleep(0.4) * cur_time += 0.4 # <<<<<<<<<<<<<< @@ -13106,7 +13756,7 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __pyx_v_cur_time = (__pyx_v_cur_time + 0.4); } - /* "ktlib.pyx":635 + /* "src/ktlib.pyx":682 * * * with output(output_type='dict') as output_lines: # <<<<<<<<<<<<<< @@ -13121,37 +13771,39 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Submit._render_result", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_15, &__pyx_t_2) < 0) __PYX_ERR(0, 635, __pyx_L9_except_error) + __Pyx_AddTraceback("src.ktlib.Submit._render_result", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_15, &__pyx_t_1) < 0) __PYX_ERR(0, 682, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_15); - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_15, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_15, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 635, __pyx_L9_except_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 682, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (__pyx_t_9 < 0) __PYX_ERR(0, 635, __pyx_L9_except_error) + if (__pyx_t_9 < 0) __PYX_ERR(0, 682, __pyx_L9_except_error) __pyx_t_10 = ((!(__pyx_t_9 != 0)) != 0); if (__pyx_t_10) { __Pyx_GIVEREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_15, __pyx_t_2); - __pyx_t_5 = 0; __pyx_t_15 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 635, __pyx_L9_except_error) + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_15, __pyx_t_1); + __pyx_t_5 = 0; __pyx_t_15 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 682, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L8_exception_handled; } __pyx_L9_except_error:; @@ -13171,9 +13823,9 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S /*finally:*/ { /*normal exit:*/{ if (__pyx_t_4) { - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__6, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 635, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -13188,16 +13840,15 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __pyx_L39:; } - /* "ktlib.pyx":622 + /* "src/ktlib.pyx":669 * * - * cdef _render_result(self, string submission_url_ret): # <<<<<<<<<<<<<< + * cdef void _render_result(self, str submission_url_ret) except *: # <<<<<<<<<<<<<< * ''' Continuously polling for result from `submission_url_ret` * Args: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -13205,41 +13856,41 @@ static PyObject *__pyx_f_5ktlib_6Submit__render_result(struct __pyx_obj_5ktlib_S __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("ktlib.Submit._render_result", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_AddTraceback("src.ktlib.Submit._render_result", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; + __Pyx_XDECREF(__pyx_v_status_ret); + __Pyx_XDECREF(__pyx_v_runtime_ret); __Pyx_XDECREF(__pyx_v_output_lines); __Pyx_XDECREF(__pyx_v_page); __Pyx_XDECREF(__pyx_v_soup); __Pyx_XDECREF(__pyx_v_submission_data); __Pyx_XDECREF(__pyx_v_submission_ret); __Pyx_XDECREF(__pyx_v_e); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":653 +/* "src/ktlib.pyx":700 * * - * cdef detect_file_name(self): # <<<<<<<<<<<<<< + * cdef str detect_file_name(self): # <<<<<<<<<<<<<< * ''' Detect executable file to submit for kattis judge if there are multiple files * that are executable based on user ktconfig file */ -static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib_Submit *__pyx_v_self) { +static PyObject *__pyx_f_3src_5ktlib_6Submit_detect_file_name(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self) { PyObject *__pyx_v_acceptable_file_ext = 0; int __pyx_v_opt; + int __pyx_v_i; int __pyx_v_res_int; - std::string __pyx_v_res; + PyObject *__pyx_v_res = 0; + PyObject *__pyx_v_files = 0; + PyObject *__pyx_v_runnable_files = 0; + PyObject *__pyx_v_f = 0; PyObject *__pyx_v_k = NULL; - CYTHON_UNUSED PyObject *__pyx_v_v = NULL; - PyObject *__pyx_v_files = NULL; - PyObject *__pyx_v_runnable_files = NULL; PyObject *__pyx_v_RunnableFile = NULL; - PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_parts = NULL; - Py_ssize_t __pyx_v_i; PyObject *__pyx_8genexpr7__pyx_v_f = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13248,193 +13899,205 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib Py_ssize_t __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - PyObject *(*__pyx_t_9)(PyObject *); - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); int __pyx_t_11; int __pyx_t_12; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; int __pyx_t_15; Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_UCS4 __pyx_t_18; - std::string __pyx_t_19; + Py_UCS4 __pyx_t_17; __Pyx_RefNannySetupContext("detect_file_name", 0); - /* "ktlib.pyx":658 + /* "src/ktlib.pyx":705 * ''' * cdef: - * object acceptable_file_ext = {} # <<<<<<<<<<<<<< - * string alias - * int opt = 0 + * dict acceptable_file_ext = {} # <<<<<<<<<<<<<< + * str alias + * int opt = 0, i */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_acceptable_file_ext = __pyx_t_1; + __pyx_v_acceptable_file_ext = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":660 - * object acceptable_file_ext = {} - * string alias - * int opt = 0 # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":707 + * dict acceptable_file_ext = {} + * str alias + * int opt = 0, i # <<<<<<<<<<<<<< * int res_int - * string res + * str res */ __pyx_v_opt = 0; - /* "ktlib.pyx":664 - * string res + /* "src/ktlib.pyx":713 + * object f * - * for k, v in map_template_to_plang.items(): # <<<<<<<<<<<<<< + * for k in map_template_to_plang.keys(): # <<<<<<<<<<<<<< * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + * files = [f for f in Path().iterdir() if f.is_file()] */ __pyx_t_2 = 0; - if (unlikely(__pyx_v_5ktlib_map_template_to_plang == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 664, __pyx_L1_error) + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys"); + __PYX_ERR(0, 713, __pyx_L1_error) } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_5ktlib_map_template_to_plang, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_3src_5ktlib_map_template_to_plang, 1, __pyx_n_s_keys, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; while (1) { - __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); - if (unlikely(__pyx_t_7 == 0)) break; - if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, NULL, NULL, __pyx_t_4); + if (unlikely(__pyx_t_6 == 0)) break; + if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); - __pyx_t_6 = 0; - /* "ktlib.pyx":665 + /* "src/ktlib.pyx":714 * - * for k, v in map_template_to_plang.items(): + * for k in map_template_to_plang.keys(): * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] # <<<<<<<<<<<<<< - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + * files = [f for f in Path().iterdir() if f.is_file()] * runnable_files = [] */ - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error) + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 714, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_3src_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_extension); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 665, __pyx_L1_error) + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 714, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_3src_5ktlib_map_template_to_plang, __pyx_v_k); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 714, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_extension); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_acceptable_file_ext, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_acceptable_file_ext, __pyx_t_8, __pyx_t_5) < 0)) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":666 - * for k, v in map_template_to_plang.items(): + /* "src/ktlib.pyx":715 + * for k in map_template_to_plang.keys(): * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] - * files = [f for f in os.listdir('.') if os.path.isfile(f)] # <<<<<<<<<<<<<< + * files = [f for f in Path().iterdir() if f.is_file()] # <<<<<<<<<<<<<< * runnable_files = [] * RunnableFile = namedtuple('RunnableFile', */ { /* enter inner scope */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L7_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 666, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 715, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_listdir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_iterdir); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_7, function); } } - __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_kp_u__16) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u__16); + __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { - __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0; - __pyx_t_9 = NULL; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = 0; + __pyx_t_10 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 666, __pyx_L7_error) + __pyx_t_3 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 715, __pyx_L7_error) } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break; + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_7)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 666, __pyx_L7_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 715, __pyx_L7_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_7)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 666, __pyx_L7_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 715, __pyx_L7_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); #endif } } else { - __pyx_t_6 = __pyx_t_9(__pyx_t_5); - if (unlikely(!__pyx_t_6)) { + __pyx_t_5 = __pyx_t_10(__pyx_t_7); + if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 666, __pyx_L7_error) + else __PYX_ERR(0, 715, __pyx_L7_error) } break; } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_f, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_path); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isfile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 666, __pyx_L7_error) + __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_f, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr7__pyx_v_f, __pyx_n_s_is_file); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 715, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; + __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_10)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } - __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_8genexpr7__pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_8genexpr7__pyx_v_f); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 666, __pyx_L7_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 715, __pyx_L7_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_11) { - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr7__pyx_v_f))) __PYX_ERR(0, 666, __pyx_L7_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr7__pyx_v_f))) __PYX_ERR(0, 715, __pyx_L7_error) } } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_f); __pyx_8genexpr7__pyx_v_f = 0; goto __pyx_L11_exit_scope; __pyx_L7_error:; @@ -13445,97 +14108,97 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib __pyx_v_files = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":667 + /* "src/ktlib.pyx":716 * acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + * files = [f for f in Path().iterdir() if f.is_file()] * runnable_files = [] # <<<<<<<<<<<<<< * RunnableFile = namedtuple('RunnableFile', * ['file_name', 'full_name', 'ext'] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_runnable_files = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":668 - * files = [f for f in os.listdir('.') if os.path.isfile(f)] + /* "src/ktlib.pyx":717 + * files = [f for f in Path().iterdir() if f.is_file()] * runnable_files = [] * RunnableFile = namedtuple('RunnableFile', # <<<<<<<<<<<<<< * ['file_name', 'full_name', 'ext'] * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "ktlib.pyx":669 + /* "src/ktlib.pyx":718 * runnable_files = [] * RunnableFile = namedtuple('RunnableFile', * ['file_name', 'full_name', 'ext'] # <<<<<<<<<<<<<< * ) * for f in files: */ - __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 669, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_n_u_file_name); __Pyx_GIVEREF(__pyx_n_u_file_name); - PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_file_name); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_file_name); __Pyx_INCREF(__pyx_n_u_full_name); __Pyx_GIVEREF(__pyx_n_u_full_name); - PyList_SET_ITEM(__pyx_t_6, 1, __pyx_n_u_full_name); + PyList_SET_ITEM(__pyx_t_5, 1, __pyx_n_u_full_name); __Pyx_INCREF(__pyx_n_u_ext); __Pyx_GIVEREF(__pyx_n_u_ext); - PyList_SET_ITEM(__pyx_t_6, 2, __pyx_n_u_ext); + PyList_SET_ITEM(__pyx_t_5, 2, __pyx_n_u_ext); __pyx_t_8 = NULL; __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_RunnableFile, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_RunnableFile, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_RunnableFile, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_RunnableFile, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_10 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_INCREF(__pyx_n_u_RunnableFile); __Pyx_GIVEREF(__pyx_n_u_RunnableFile); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_n_u_RunnableFile); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_n_u_RunnableFile); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_RunnableFile = __pyx_t_1; __pyx_t_1 = 0; - /* "ktlib.pyx":671 + /* "src/ktlib.pyx":720 * ['file_name', 'full_name', 'ext'] * ) * for f in files: # <<<<<<<<<<<<<< @@ -13546,53 +14209,53 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib for (;;) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 671, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 720, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 720, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); #endif - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_5); - __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_7); + __pyx_t_7 = 0; - /* "ktlib.pyx":672 + /* "src/ktlib.pyx":721 * ) * for f in files: * parts = f.split('.') # <<<<<<<<<<<<<< * if len(parts) <= 1: * continue */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_split); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_split); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); + __Pyx_DECREF_SET(__pyx_t_9, function); } } - __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_6, __pyx_kp_u__16) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_u__16); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF_SET(__pyx_v_parts, __pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_kp_u__15) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_kp_u__15); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_parts, __pyx_t_7); + __pyx_t_7 = 0; - /* "ktlib.pyx":673 + /* "src/ktlib.pyx":722 * for f in files: * parts = f.split('.') * if len(parts) <= 1: # <<<<<<<<<<<<<< * continue * if parts[1] in acceptable_file_ext: */ - __pyx_t_2 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 673, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 722, __pyx_L1_error) __pyx_t_11 = ((__pyx_t_2 <= 1) != 0); if (__pyx_t_11) { - /* "ktlib.pyx":674 + /* "src/ktlib.pyx":723 * parts = f.split('.') * if len(parts) <= 1: * continue # <<<<<<<<<<<<<< @@ -13601,7 +14264,7 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib */ goto __pyx_L12_continue; - /* "ktlib.pyx":673 + /* "src/ktlib.pyx":722 * for f in files: * parts = f.split('.') * if len(parts) <= 1: # <<<<<<<<<<<<<< @@ -13610,31 +14273,31 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib */ } - /* "ktlib.pyx":675 + /* "src/ktlib.pyx":724 * if len(parts) <= 1: * continue * if parts[1] in acceptable_file_ext: # <<<<<<<<<<<<<< * runnable_files.append(RunnableFile(parts[0], f, parts[1])) * */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_t_5, __pyx_v_acceptable_file_ext, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_t_7, __pyx_v_acceptable_file_ext, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = (__pyx_t_11 != 0); if (__pyx_t_12) { - /* "ktlib.pyx":676 + /* "src/ktlib.pyx":725 * continue * if parts[1] in acceptable_file_ext: * runnable_files.append(RunnableFile(parts[0], f, parts[1])) # <<<<<<<<<<<<<< * * if len(runnable_files) == 0: */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_RunnableFile); __pyx_t_8 = __pyx_v_RunnableFile; __pyx_t_13 = NULL; __pyx_t_4 = 0; @@ -13650,48 +14313,48 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_10, __pyx_v_f, __pyx_t_6}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) + PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_9, __pyx_v_f, __pyx_t_5}; + __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_10, __pyx_v_f, __pyx_t_6}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) + PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_9, __pyx_v_f, __pyx_t_5}; + __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_14 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 676, __pyx_L1_error) + __pyx_t_14 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_v_f); __Pyx_GIVEREF(__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_4, __pyx_v_f); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_4, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_4, __pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_runnable_files, __pyx_t_5); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_runnable_files, __pyx_t_7); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "ktlib.pyx":675 + /* "src/ktlib.pyx":724 * if len(parts) <= 1: * continue * if parts[1] in acceptable_file_ext: # <<<<<<<<<<<<<< @@ -13700,7 +14363,7 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib */ } - /* "ktlib.pyx":671 + /* "src/ktlib.pyx":720 * ['file_name', 'full_name', 'ext'] * ) * for f in files: # <<<<<<<<<<<<<< @@ -13711,31 +14374,31 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":678 + /* "src/ktlib.pyx":727 * runnable_files.append(RunnableFile(parts[0], f, parts[1])) * * if len(runnable_files) == 0: # <<<<<<<<<<<<<< * raise RuntimeError('Not executable code file detected') * */ - __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 678, __pyx_L1_error) + __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 727, __pyx_L1_error) __pyx_t_12 = ((__pyx_t_3 == 0) != 0); if (unlikely(__pyx_t_12)) { - /* "ktlib.pyx":679 + /* "src/ktlib.pyx":728 * * if len(runnable_files) == 0: * raise RuntimeError('Not executable code file detected') # <<<<<<<<<<<<<< * * if len(runnable_files) > 1: */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 679, __pyx_L1_error) + __PYX_ERR(0, 728, __pyx_L1_error) - /* "ktlib.pyx":678 + /* "src/ktlib.pyx":727 * runnable_files.append(RunnableFile(parts[0], f, parts[1])) * * if len(runnable_files) == 0: # <<<<<<<<<<<<<< @@ -13744,117 +14407,129 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib */ } - /* "ktlib.pyx":681 + /* "src/ktlib.pyx":730 * raise RuntimeError('Not executable code file detected') * * if len(runnable_files) > 1: # <<<<<<<<<<<<<< - * print(color_cyan(b'Choose a file:')) + * log(color_cyan('Choose a file:')) * for i in range(len(runnable_files)): */ - __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 681, __pyx_L1_error) + __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 730, __pyx_L1_error) __pyx_t_12 = ((__pyx_t_3 > 1) != 0); if (__pyx_t_12) { - /* "ktlib.pyx":682 + /* "src/ktlib.pyx":731 * * if len(runnable_files) > 1: - * print(color_cyan(b'Choose a file:')) # <<<<<<<<<<<<<< + * log(color_cyan('Choose a file:')) # <<<<<<<<<<<<<< * for i in range(len(runnable_files)): * print(f' {i}: {runnable_files[i].full_name}') */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_k_Choose_a_file, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_f_3src_5ktlib_color_cyan(__pyx_kp_u_Choose_a_file, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_14, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":683 + /* "src/ktlib.pyx":732 * if len(runnable_files) > 1: - * print(color_cyan(b'Choose a file:')) + * log(color_cyan('Choose a file:')) * for i in range(len(runnable_files)): # <<<<<<<<<<<<<< * print(f' {i}: {runnable_files[i].full_name}') * res = input() */ - __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 683, __pyx_L1_error) + __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 732, __pyx_L1_error) __pyx_t_2 = __pyx_t_3; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_2; __pyx_t_16+=1) { - __pyx_v_i = __pyx_t_16; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "ktlib.pyx":684 - * print(color_cyan(b'Choose a file:')) + /* "src/ktlib.pyx":733 + * log(color_cyan('Choose a file:')) * for i in range(len(runnable_files)): * print(f' {i}: {runnable_files[i].full_name}') # <<<<<<<<<<<<<< * res = input() * opt = int(res) */ - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_17 = 0; - __pyx_t_18 = 127; - __Pyx_INCREF(__pyx_kp_u__20); - __pyx_t_17 += 2; - __Pyx_GIVEREF(__pyx_kp_u__20); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u__20); - __pyx_t_1 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u__21); - __pyx_t_17 += 2; - __Pyx_GIVEREF(__pyx_kp_u__21); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__21); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_i), __pyx_n_s_full_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 684, __pyx_L1_error) + __pyx_t_16 = 0; + __pyx_t_17 = 127; + __Pyx_INCREF(__pyx_kp_u__22); + __pyx_t_16 += 2; + __Pyx_GIVEREF(__pyx_kp_u__22); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__22); + __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__23); + __pyx_t_16 += 2; + __Pyx_GIVEREF(__pyx_kp_u__23); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__23); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_i), __pyx_n_s_full_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_18; - __pyx_t_17 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_17; + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 684, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "ktlib.pyx":685 + /* "src/ktlib.pyx":734 * for i in range(len(runnable_files)): * print(f' {i}: {runnable_files[i].full_name}') * res = input() # <<<<<<<<<<<<<< * opt = int(res) * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' */ - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 685, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 685, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_res = __pyx_t_19; + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 734, __pyx_L1_error) + __pyx_v_res = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":686 + /* "src/ktlib.pyx":735 * print(f' {i}: {runnable_files[i].full_name}') * res = input() * opt = int(res) # <<<<<<<<<<<<<< * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' * self.problem_id = runnable_files[opt].file_name */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_opt = __pyx_t_4; - /* "ktlib.pyx":687 + /* "src/ktlib.pyx":736 * res = input() * opt = int(res) * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' # <<<<<<<<<<<<<< @@ -13865,118 +14540,121 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib if (unlikely(!Py_OptimizeFlag)) { __pyx_t_12 = (0 <= __pyx_v_opt); if (__pyx_t_12) { - __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 687, __pyx_L1_error) + __pyx_t_3 = PyList_GET_SIZE(__pyx_v_runnable_files); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 736, __pyx_L1_error) __pyx_t_12 = (__pyx_v_opt < __pyx_t_3); } if (unlikely(!(__pyx_t_12 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Invalid_option_chosen); - __PYX_ERR(0, 687, __pyx_L1_error) + __PYX_ERR(0, 736, __pyx_L1_error) } } #endif - /* "ktlib.pyx":681 + /* "src/ktlib.pyx":730 * raise RuntimeError('Not executable code file detected') * * if len(runnable_files) > 1: # <<<<<<<<<<<<<< - * print(color_cyan(b'Choose a file:')) + * log(color_cyan('Choose a file:')) * for i in range(len(runnable_files)): */ } - /* "ktlib.pyx":688 + /* "src/ktlib.pyx":737 * opt = int(res) * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' * self.problem_id = runnable_files[opt].file_name # <<<<<<<<<<<<<< * self.file_name = os.path.abspath(runnable_files[opt].full_name) * if runnable_files[opt].ext == 'py': */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_file_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 688, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 688, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_self->problem_id = __pyx_t_19; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 737, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->problem_id); + __Pyx_DECREF(__pyx_v_self->problem_id); + __pyx_v_self->problem_id = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":689 + /* "src/ktlib.pyx":738 * assert 0 <= opt < len(runnable_files), 'Invalid option chosen' * self.problem_id = runnable_files[opt].file_name * self.file_name = os.path.abspath(runnable_files[opt].full_name) # <<<<<<<<<<<<<< * if runnable_files[opt].ext == 'py': * res = input('Which python version you want to submit, 2 or 3?\n') */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_abspath); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_full_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_abspath); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_full_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_8, function); } } - __pyx_t_8 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_14, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); + __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_14, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_self->file_name = __pyx_t_19; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->file_name); + __Pyx_DECREF(__pyx_v_self->file_name); + __pyx_v_self->file_name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":690 + /* "src/ktlib.pyx":739 * self.problem_id = runnable_files[opt].file_name * self.file_name = os.path.abspath(runnable_files[opt].full_name) * if runnable_files[opt].ext == 'py': # <<<<<<<<<<<<<< * res = input('Which python version you want to submit, 2 or 3?\n') * res_int = int(res) */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_ext); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_n_u_py, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_ext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_py, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_12) { - /* "ktlib.pyx":691 + /* "src/ktlib.pyx":740 * self.file_name = os.path.abspath(runnable_files[opt].full_name) * if runnable_files[opt].ext == 'py': * res = input('Which python version you want to submit, 2 or 3?\n') # <<<<<<<<<<<<<< * res_int = int(res) * assert 2 <= res_int <= 3, "Invalid option" */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_input, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_res = __pyx_t_19; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_input, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 740, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_res, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "ktlib.pyx":692 + /* "src/ktlib.pyx":741 * if runnable_files[opt].ext == 'py': * res = input('Which python version you want to submit, 2 or 3?\n') * res_int = int(res) # <<<<<<<<<<<<<< * assert 2 <= res_int <= 3, "Invalid option" * self.lang = f'Python {res_int}' */ - __pyx_t_8 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_res); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_res_int = __pyx_t_4; - /* "ktlib.pyx":693 + /* "src/ktlib.pyx":742 * res = input('Which python version you want to submit, 2 or 3?\n') * res_int = int(res) * assert 2 <= res_int <= 3, "Invalid option" # <<<<<<<<<<<<<< @@ -13991,28 +14669,30 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib } if (unlikely(!(__pyx_t_12 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Invalid_option); - __PYX_ERR(0, 693, __pyx_L1_error) + __PYX_ERR(0, 742, __pyx_L1_error) } } #endif - /* "ktlib.pyx":694 + /* "src/ktlib.pyx":743 * res_int = int(res) * assert 2 <= res_int <= 3, "Invalid option" * self.lang = f'Python {res_int}' # <<<<<<<<<<<<<< * else: * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name */ - __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_res_int, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Python, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 694, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_res_int, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Python, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_self->lang = __pyx_t_19; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_v_self->lang); + __Pyx_DECREF(__pyx_v_self->lang); + __pyx_v_self->lang = ((PyObject*)__pyx_t_8); + __pyx_t_8 = 0; - /* "ktlib.pyx":690 + /* "src/ktlib.pyx":739 * self.problem_id = runnable_files[opt].file_name * self.file_name = os.path.abspath(runnable_files[opt].full_name) * if runnable_files[opt].ext == 'py': # <<<<<<<<<<<<<< @@ -14022,7 +14702,7 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib goto __pyx_L20; } - /* "ktlib.pyx":696 + /* "src/ktlib.pyx":745 * self.lang = f'Python {res_int}' * else: * self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name # <<<<<<<<<<<<<< @@ -14030,49 +14710,52 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib * */ /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_ext); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 696, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_runnable_files, __pyx_v_opt), __pyx_n_s_ext); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_acceptable_file_ext, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_acceptable_file_ext, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_full_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 696, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_full_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_self->lang = __pyx_t_19; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_v_self->lang); + __Pyx_DECREF(__pyx_v_self->lang); + __pyx_v_self->lang = ((PyObject*)__pyx_t_8); + __pyx_t_8 = 0; } __pyx_L20:; - /* "ktlib.pyx":653 + /* "src/ktlib.pyx":700 * * - * cdef detect_file_name(self): # <<<<<<<<<<<<<< + * cdef str detect_file_name(self): # <<<<<<<<<<<<<< * ''' Detect executable file to submit for kattis judge if there are multiple files * that are executable based on user ktconfig file */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("ktlib.Submit.detect_file_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Submit.detect_file_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_acceptable_file_ext); - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_res); __Pyx_XDECREF(__pyx_v_files); __Pyx_XDECREF(__pyx_v_runnable_files); - __Pyx_XDECREF(__pyx_v_RunnableFile); __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XDECREF(__pyx_v_RunnableFile); __Pyx_XDECREF(__pyx_v_parts); __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_f); __Pyx_XGIVEREF(__pyx_r); @@ -14080,26 +14763,25 @@ static PyObject *__pyx_f_5ktlib_6Submit_detect_file_name(struct __pyx_obj_5ktlib return __pyx_r; } -/* "ktlib.pyx":699 +/* "src/ktlib.pyx":748 * * - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * '''Submit the code file for kattis judge''' * cdef: */ -static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__pyx_v_self) { - std::string __pyx_v_err; - std::string __pyx_v_submissions_url; - std::string __pyx_v_submission_url_ret; - std::string __pyx_v_submit_response; - std::string __pyx_v_problem_id; +static void __pyx_f_3src_5ktlib_6Submit__act(struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self) { + PyObject *__pyx_v_err = 0; + PyObject *__pyx_v_submissions_url = 0; + PyObject *__pyx_v_submission_url_ret = 0; + PyObject *__pyx_v_submit_response = 0; + PyObject *__pyx_v_problem_id = 0; + PyObject *__pyx_v_files = 0; PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_files = NULL; PyObject *__pyx_v_sub_file = NULL; - std::string __pyx_v_submit_url; + PyObject *__pyx_v_submit_url = NULL; PyObject *__pyx_v_ret = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -14113,90 +14795,84 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_t_12; - std::string __pyx_t_13; - std::string __pyx_t_14; - struct __pyx_opt_args_5ktlib_6Action_get_url __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - int __pyx_t_17; - PyObject *__pyx_t_18 = NULL; - Py_ssize_t __pyx_t_19; - Py_UCS4 __pyx_t_20; + struct __pyx_opt_args_3src_5ktlib_6Action_get_url __pyx_t_13; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + Py_ssize_t __pyx_t_16; + Py_UCS4 __pyx_t_17; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":706 - * string submission_url_ret - * string submit_response - * string problem_id = self.get_problem_id() # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":755 + * str submission_url_ret + * str submit_response + * str problem_id = self.get_problem_id() # <<<<<<<<<<<<<< + * list files * - * self.detect_file_name() */ - __pyx_v_problem_id = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_id(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); - - /* "ktlib.pyx":708 - * string problem_id = self.get_problem_id() + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_id(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_problem_id = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "src/ktlib.pyx":758 + * list files * * self.detect_file_name() # <<<<<<<<<<<<<< * data = {'submit': 'true', * 'submit_ctr': 2, */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->detect_file_name(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_6Submit_detect_file_name(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":709 + /* "src/ktlib.pyx":759 * * self.detect_file_name() * data = {'submit': 'true', # <<<<<<<<<<<<<< * 'submit_ctr': 2, * 'language': self.lang, */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_submit, __pyx_n_u_true) < 0) __PYX_ERR(0, 709, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_submit_ctr, __pyx_int_2) < 0) __PYX_ERR(0, 709, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_submit, __pyx_n_u_true) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_submit_ctr, __pyx_int_2) < 0) __PYX_ERR(0, 759, __pyx_L1_error) - /* "ktlib.pyx":711 + /* "src/ktlib.pyx":761 * data = {'submit': 'true', * 'submit_ctr': 2, * 'language': self.lang, # <<<<<<<<<<<<<< * 'mainclass': '', * 'problem': problem_id, */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->lang); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_language_2, __pyx_t_2) < 0) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_mainclass, __pyx_kp_u__33) < 0) __PYX_ERR(0, 709, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_language_2, __pyx_v_self->lang) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_mainclass, __pyx_kp_u_) < 0) __PYX_ERR(0, 759, __pyx_L1_error) - /* "ktlib.pyx":713 + /* "src/ktlib.pyx":763 * 'language': self.lang, * 'mainclass': '', * 'problem': problem_id, # <<<<<<<<<<<<<< * 'tag': '', * 'script': 'true'} */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_problem_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_problem, __pyx_t_2) < 0) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tag, __pyx_kp_u__33) < 0) __PYX_ERR(0, 709, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_script, __pyx_n_u_true) < 0) __PYX_ERR(0, 709, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_problem, __pyx_v_problem_id) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tag, __pyx_kp_u_) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_script, __pyx_n_u_true) < 0) __PYX_ERR(0, 759, __pyx_L1_error) __pyx_v_data = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":716 + /* "src/ktlib.pyx":766 * 'tag': '', * 'script': 'true'} * files = [] # <<<<<<<<<<<<<< * with open(self.file_name) as sub_file: * files.append(('sub_file[]', */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_files = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":717 + /* "src/ktlib.pyx":767 * 'script': 'true'} * files = [] * with open(self.file_name) as sub_file: # <<<<<<<<<<<<<< @@ -14204,14 +14880,11 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p * (os.path.basename(self.file_name), */ /*with:*/ { - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_v_self->file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -14223,14 +14896,14 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare @@ -14243,103 +14916,100 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p __pyx_v_sub_file = __pyx_t_4; __pyx_t_4 = 0; - /* "ktlib.pyx":719 + /* "src/ktlib.pyx":769 * with open(self.file_name) as sub_file: * files.append(('sub_file[]', * (os.path.basename(self.file_name), # <<<<<<<<<<<<<< * sub_file.read(), * 'application/octet-stream'))) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_basename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L7_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_basename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L7_error) + __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_self->file_name) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_self->file_name); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 769, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":720 + /* "src/ktlib.pyx":770 * files.append(('sub_file[]', * (os.path.basename(self.file_name), * sub_file.read(), # <<<<<<<<<<<<<< * 'application/octet-stream'))) - * submit_url = self.get_url(b'submissionurl', b'submit') + * submit_url = self.get_url('submissionurl', 'submit') */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sub_file, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sub_file, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1); + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":719 + /* "src/ktlib.pyx":769 * with open(self.file_name) as sub_file: * files.append(('sub_file[]', * (os.path.basename(self.file_name), # <<<<<<<<<<<<<< * sub_file.read(), * 'application/octet-stream'))) */ - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __Pyx_INCREF(__pyx_kp_u_application_octet_stream); __Pyx_GIVEREF(__pyx_kp_u_application_octet_stream); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_application_octet_stream); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_application_octet_stream); __pyx_t_4 = 0; - __pyx_t_2 = 0; + __pyx_t_1 = 0; - /* "ktlib.pyx":718 + /* "src/ktlib.pyx":768 * files = [] * with open(self.file_name) as sub_file: * files.append(('sub_file[]', # <<<<<<<<<<<<<< * (os.path.basename(self.file_name), * sub_file.read(), */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_kp_u_sub_file); __Pyx_GIVEREF(__pyx_kp_u_sub_file); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_sub_file); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_files, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 718, __pyx_L7_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_sub_file); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_files, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 768, __pyx_L7_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":717 + /* "src/ktlib.pyx":767 * 'script': 'true'} * files = [] * with open(self.file_name) as sub_file: # <<<<<<<<<<<<<< @@ -14353,36 +15023,36 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p goto __pyx_L12_try_end; __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Submit._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 717, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_AddTraceback("src.ktlib.Submit._act", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 767, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 717, __pyx_L9_except_error) + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 717, __pyx_L9_except_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 767, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 717, __pyx_L9_except_error) + if (__pyx_t_11 < 0) __PYX_ERR(0, 767, __pyx_L9_except_error) __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0); if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_4); - __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 717, __pyx_L9_except_error) + __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_4); + __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 767, __pyx_L9_except_error) } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L8_exception_handled; } @@ -14402,10 +15072,10 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_3) { - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 717, __pyx_L1_error) + if (__pyx_t_2) { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -14415,444 +15085,450 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p } goto __pyx_L16; __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L1_error; __pyx_L16:; } - /* "ktlib.pyx":722 + /* "src/ktlib.pyx":772 * sub_file.read(), * 'application/octet-stream'))) - * submit_url = self.get_url(b'submissionurl', b'submit') # <<<<<<<<<<<<<< + * submit_url = self.get_url('submissionurl', 'submit') # <<<<<<<<<<<<<< * self.login() * ret = requests.post(submit_url, data=data, files=files, */ - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_submit); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 722, __pyx_L1_error) - __pyx_t_15.__pyx_n = 1; - __pyx_t_15.__pyx_default = __pyx_t_13; - __pyx_t_14 = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_url(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self), __pyx_k_submissionurl, &__pyx_t_15); - __pyx_v_submit_url = __pyx_t_14; + __pyx_t_13.__pyx_n = 1; + __pyx_t_13.__pyx_default = __pyx_n_u_submit; + __pyx_t_4 = ((struct __pyx_vtabstruct_3src_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_url(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self), __pyx_n_u_submissionurl, &__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_submit_url = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "ktlib.pyx":723 + /* "src/ktlib.pyx":773 * 'application/octet-stream'))) - * submit_url = self.get_url(b'submissionurl', b'submit') + * submit_url = self.get_url('submissionurl', 'submit') * self.login() # <<<<<<<<<<<<<< * ret = requests.post(submit_url, data=data, files=files, * cookies=self.cookies, headers=_HEADERS) */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.login(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + ((struct __pyx_vtabstruct_3src_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.login(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 773, __pyx_L1_error) - /* "ktlib.pyx":724 - * submit_url = self.get_url(b'submissionurl', b'submit') + /* "src/ktlib.pyx":774 + * submit_url = self.get_url('submissionurl', 'submit') * self.login() * ret = requests.post(submit_url, data=data, files=files, # <<<<<<<<<<<<<< * cookies=self.cookies, headers=_HEADERS) * if ret.status_code != 200: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_requests); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_requests); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_post); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_post); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_submit_url); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_data, __pyx_v_data) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_files, __pyx_v_files) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_INCREF(__pyx_v_submit_url); + __Pyx_GIVEREF(__pyx_v_submit_url); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_submit_url); + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_data) < 0) __PYX_ERR(0, 774, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_files, __pyx_v_files) < 0) __PYX_ERR(0, 774, __pyx_L1_error) - /* "ktlib.pyx":725 + /* "src/ktlib.pyx":775 * self.login() * ret = requests.post(submit_url, data=data, files=files, * cookies=self.cookies, headers=_HEADERS) # <<<<<<<<<<<<<< * if ret.status_code != 200: * if ret.status_code == 403: */ - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cookies, __pyx_v_self->__pyx_base.cookies) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_headers, __pyx_v_5ktlib__HEADERS) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cookies, __pyx_v_self->__pyx_base.cookies) < 0) __PYX_ERR(0, 774, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_headers, __pyx_v_3src_5ktlib__HEADERS) < 0) __PYX_ERR(0, 774, __pyx_L1_error) - /* "ktlib.pyx":724 - * submit_url = self.get_url(b'submissionurl', b'submit') + /* "src/ktlib.pyx":774 + * submit_url = self.get_url('submissionurl', 'submit') * self.login() * ret = requests.post(submit_url, data=data, files=files, # <<<<<<<<<<<<<< * cookies=self.cookies, headers=_HEADERS) * if ret.status_code != 200: */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ret = __pyx_t_5; __pyx_t_5 = 0; - /* "ktlib.pyx":726 + /* "src/ktlib.pyx":776 * ret = requests.post(submit_url, data=data, files=files, * cookies=self.cookies, headers=_HEADERS) * if ret.status_code != 200: # <<<<<<<<<<<<<< * if ret.status_code == 403: - * err = b'Access denied (403)' + * err = 'Access denied (403)' */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyInt_NeObjC(__pyx_t_5, __pyx_int_200, 0xC8, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_t_5, __pyx_int_200, 0xC8, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 776, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_12) { - /* "ktlib.pyx":727 + /* "src/ktlib.pyx":777 * cookies=self.cookies, headers=_HEADERS) * if ret.status_code != 200: * if ret.status_code == 403: # <<<<<<<<<<<<<< - * err = b'Access denied (403)' + * err = 'Access denied (403)' * elif ret.status_code == 404: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_403, 0x193, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 727, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_403, 0x193, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 727, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_12) { - /* "ktlib.pyx":728 + /* "src/ktlib.pyx":778 * if ret.status_code != 200: * if ret.status_code == 403: - * err = b'Access denied (403)' # <<<<<<<<<<<<<< + * err = 'Access denied (403)' # <<<<<<<<<<<<<< * elif ret.status_code == 404: - * err = b'Incorrect submit URL (404)' + * err = 'Incorrect submit URL (404)' */ - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Access_denied_403); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L1_error) - __pyx_v_err = __pyx_t_14; + __Pyx_INCREF(__pyx_kp_u_Access_denied_403); + __pyx_v_err = __pyx_kp_u_Access_denied_403; - /* "ktlib.pyx":727 + /* "src/ktlib.pyx":777 * cookies=self.cookies, headers=_HEADERS) * if ret.status_code != 200: * if ret.status_code == 403: # <<<<<<<<<<<<<< - * err = b'Access denied (403)' + * err = 'Access denied (403)' * elif ret.status_code == 404: */ goto __pyx_L18; } - /* "ktlib.pyx":729 + /* "src/ktlib.pyx":779 * if ret.status_code == 403: - * err = b'Access denied (403)' + * err = 'Access denied (403)' * elif ret.status_code == 404: # <<<<<<<<<<<<<< - * err = b'Incorrect submit URL (404)' + * err = 'Incorrect submit URL (404)' * else: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 729, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_404, 0x194, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_404, 0x194, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_12) { - /* "ktlib.pyx":730 - * err = b'Access denied (403)' + /* "src/ktlib.pyx":780 + * err = 'Access denied (403)' * elif ret.status_code == 404: - * err = b'Incorrect submit URL (404)' # <<<<<<<<<<<<<< + * err = 'Incorrect submit URL (404)' # <<<<<<<<<<<<<< * else: * err = f'Status code: {ret.status_code}' */ - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Incorrect_submit_URL_404); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L1_error) - __pyx_v_err = __pyx_t_14; + __Pyx_INCREF(__pyx_kp_u_Incorrect_submit_URL_404); + __pyx_v_err = __pyx_kp_u_Incorrect_submit_URL_404; - /* "ktlib.pyx":729 + /* "src/ktlib.pyx":779 * if ret.status_code == 403: - * err = b'Access denied (403)' + * err = 'Access denied (403)' * elif ret.status_code == 404: # <<<<<<<<<<<<<< - * err = b'Incorrect submit URL (404)' + * err = 'Incorrect submit URL (404)' * else: */ goto __pyx_L18; } - /* "ktlib.pyx":732 - * err = b'Incorrect submit URL (404)' + /* "src/ktlib.pyx":782 + * err = 'Incorrect submit URL (404)' * else: * err = f'Status code: {ret.status_code}' # <<<<<<<<<<<<<< * raise RuntimeError(f'Submission failed: {err}') - * submissions_url = self.get_url(b'submissionsurl', b'submissions') + * submissions_url = self.get_url('submissionsurl', 'submissions') */ /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_status_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Status_code, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Status_code, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_err = __pyx_t_14; + __pyx_v_err = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; } __pyx_L18:; - /* "ktlib.pyx":733 + /* "src/ktlib.pyx":783 * else: * err = f'Status code: {ret.status_code}' * raise RuntimeError(f'Submission failed: {err}') # <<<<<<<<<<<<<< - * submissions_url = self.get_url(b'submissionsurl', b'submissions') + * submissions_url = self.get_url('submissionsurl', 'submissions') * submit_response = ret.content.decode('utf-8').replace('
', '\n') */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_err); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Submission_failed, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Submission_failed, __pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 733, __pyx_L1_error) + __PYX_ERR(0, 783, __pyx_L1_error) - /* "ktlib.pyx":726 + /* "src/ktlib.pyx":776 * ret = requests.post(submit_url, data=data, files=files, * cookies=self.cookies, headers=_HEADERS) * if ret.status_code != 200: # <<<<<<<<<<<<<< * if ret.status_code == 403: - * err = b'Access denied (403)' + * err = 'Access denied (403)' */ } - /* "ktlib.pyx":734 + /* "src/ktlib.pyx":784 * err = f'Status code: {ret.status_code}' * raise RuntimeError(f'Submission failed: {err}') - * submissions_url = self.get_url(b'submissionsurl', b'submissions') # <<<<<<<<<<<<<< + * submissions_url = self.get_url('submissionsurl', 'submissions') # <<<<<<<<<<<<<< * submit_response = ret.content.decode('utf-8').replace('
', '\n') * self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) */ - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_submissions); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 734, __pyx_L1_error) - __pyx_t_15.__pyx_n = 1; - __pyx_t_15.__pyx_default = __pyx_t_14; - __pyx_t_13 = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_url(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self), __pyx_k_submissionsurl, &__pyx_t_15); - __pyx_v_submissions_url = __pyx_t_13; + __pyx_t_13.__pyx_n = 1; + __pyx_t_13.__pyx_default = __pyx_n_u_submissions; + __pyx_t_5 = ((struct __pyx_vtabstruct_3src_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_url(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self), __pyx_n_u_submissionsurl, &__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_submissions_url = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "ktlib.pyx":735 + /* "src/ktlib.pyx":785 * raise RuntimeError(f'Submission failed: {err}') - * submissions_url = self.get_url(b'submissionsurl', b'submissions') + * submissions_url = self.get_url('submissionsurl', 'submissions') * submit_response = ret.content.decode('utf-8').replace('
', '\n') # <<<<<<<<<<<<<< * self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) - * print(color_green(b'Submission successful')) + * log(color_green('Submission successful')) */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_content); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_content); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_replace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_utf_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 735, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_replace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_submit_response = __pyx_t_13; + if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_v_submit_response = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "ktlib.pyx":736 - * submissions_url = self.get_url(b'submissionsurl', b'submissions') + /* "src/ktlib.pyx":786 + * submissions_url = self.get_url('submissionsurl', 'submissions') * submit_response = ret.content.decode('utf-8').replace('
', '\n') * self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) # <<<<<<<<<<<<<< - * print(color_green(b'Submission successful')) + * log(color_green('Submission successful')) * submission_url_ret = f'{submissions_url}/{self.submission_id}' */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_submit_response); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_16 = NULL; - __pyx_t_17 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_16)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_16); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_17 = 1; + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_kp_u_Submission_ID_d, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_Submission_ID_d, __pyx_v_submit_response}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_kp_u_Submission_ID_d, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_Submission_ID_d, __pyx_v_submit_response}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_4); } else #endif { - __pyx_t_18 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - if (__pyx_t_16) { - __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_16); __pyx_t_16 = NULL; + __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1); __pyx_t_1 = NULL; } __Pyx_INCREF(__pyx_kp_u_Submission_ID_d); __Pyx_GIVEREF(__pyx_kp_u_Submission_ID_d); - PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_17, __pyx_kp_u_Submission_ID_d); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_17, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_kp_u_Submission_ID_d); + __Pyx_INCREF(__pyx_v_submit_response); + __Pyx_GIVEREF(__pyx_v_submit_response); + PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_v_submit_response); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_group); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_group); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_1); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->submission_id = __pyx_t_13; + __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_v_self->submission_id); + __Pyx_DECREF(__pyx_v_self->submission_id); + __pyx_v_self->submission_id = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "ktlib.pyx":737 + /* "src/ktlib.pyx":787 * submit_response = ret.content.decode('utf-8').replace('
', '\n') * self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) - * print(color_green(b'Submission successful')) # <<<<<<<<<<<<<< + * log(color_green('Submission successful')) # <<<<<<<<<<<<<< * submission_url_ret = f'{submissions_url}/{self.submission_id}' * self._render_result(submission_url_ret) */ - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_Submission_successful, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 737, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_Submission_successful, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_5 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_15, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "ktlib.pyx":738 + /* "src/ktlib.pyx":788 * self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) - * print(color_green(b'Submission successful')) + * log(color_green('Submission successful')) * submission_url_ret = f'{submissions_url}/{self.submission_id}' # <<<<<<<<<<<<<< * self._render_result(submission_url_ret) * */ - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_19 = 0; - __pyx_t_20 = 127; - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_submissions_url); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_20 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_20) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_20; - __pyx_t_19 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_19 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__6); - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->submission_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_20 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_20) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_20; - __pyx_t_19 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_19, __pyx_t_20); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_submission_url_ret = __pyx_t_13; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 788, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_16 = 0; + __pyx_t_17 = 127; + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_submissions_url); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_17; + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__4); + __pyx_t_16 += 1; + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_u__4); + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_self->submission_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_17; + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_submission_url_ret = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "ktlib.pyx":739 - * print(color_green(b'Submission successful')) + /* "src/ktlib.pyx":789 + * log(color_green('Submission successful')) * submission_url_ret = f'{submissions_url}/{self.submission_id}' * self._render_result(submission_url_ret) # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5ktlib_Submit *)__pyx_v_self->__pyx_base.__pyx_vtab)->_render_result(__pyx_v_self, __pyx_v_submission_url_ret); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_f_3src_5ktlib_6Submit__render_result(__pyx_v_self, __pyx_v_submission_url_ret); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L1_error) - /* "ktlib.pyx":699 + /* "src/ktlib.pyx":748 * * - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * '''Submit the code file for kattis judge''' * cdef: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_AddTraceback("ktlib.Submit._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("src.ktlib.Submit._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_err); + __Pyx_XDECREF(__pyx_v_submissions_url); + __Pyx_XDECREF(__pyx_v_submission_url_ret); + __Pyx_XDECREF(__pyx_v_submit_response); + __Pyx_XDECREF(__pyx_v_problem_id); __Pyx_XDECREF(__pyx_v_files); + __Pyx_XDECREF(__pyx_v_data); __Pyx_XDECREF(__pyx_v_sub_file); + __Pyx_XDECREF(__pyx_v_submit_url); __Pyx_XDECREF(__pyx_v_ret); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "(tree fragment)":1 @@ -14862,19 +15538,19 @@ static PyObject *__pyx_f_5ktlib_6Submit__act(struct __pyx_obj_5ktlib_Submit *__p */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Submit_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Submit_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_6Submit_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Submit_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Submit_2__reduce_cython__(((struct __pyx_obj_5ktlib_Submit *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_6Submit_2__reduce_cython__(((struct __pyx_obj_3src_5ktlib_Submit *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Submit_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Submit *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_6Submit_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -14901,7 +15577,7 @@ static PyObject *__pyx_pf_5ktlib_6Submit_2__reduce_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Submit.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Submit.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -14916,19 +15592,19 @@ static PyObject *__pyx_pf_5ktlib_6Submit_2__reduce_cython__(CYTHON_UNUSED struct */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Submit_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Submit_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_6Submit_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Submit_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Submit_4__setstate_cython__(((struct __pyx_obj_5ktlib_Submit *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_6Submit_4__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Submit *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Submit_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Submit *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_6Submit_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Submit *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -14955,28 +15631,28 @@ static PyObject *__pyx_pf_5ktlib_6Submit_4__setstate_cython__(CYTHON_UNUSED stru /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Submit.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Submit.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":743 +/* "src/ktlib.pyx":793 * * cdef class Config(Action): * cdef add_template(self): # <<<<<<<<<<<<<< * cdef: - * string question = b'Which template would you like to add:\n' + * str question = 'Which template would you like to add:\n' */ -static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Config *__pyx_v_self) { - std::string __pyx_v_question; - std::string __pyx_v_temp; +static PyObject *__pyx_f_3src_5ktlib_6Config_add_template(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self) { + PyObject *__pyx_v_question = 0; + PyObject *__pyx_v_temp = 0; PyObject *__pyx_v_selectable_lang = 0; int __pyx_v_idx; PyObject *__pyx_v_existed_templates = 0; - std::string __pyx_v_res; + PyObject *__pyx_v_res = 0; int __pyx_v_ret; PyObject *__pyx_v_options = 0; PyObject *__pyx_v_f = NULL; @@ -14986,7 +15662,7 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con PyObject *__pyx_v_kt_config = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - std::string __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; @@ -14995,101 +15671,128 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; + int __pyx_t_10; int __pyx_t_11; - int __pyx_t_12; + Py_ssize_t __pyx_t_12; Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; + int __pyx_t_14; int __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_UCS4 __pyx_t_18; - std::string __pyx_t_19; - std::string __pyx_t_20; - struct __pyx_opt_args_5ktlib_ask_with_default __pyx_t_21; + Py_ssize_t __pyx_t_16; + Py_UCS4 __pyx_t_17; + struct __pyx_opt_args_3src_5ktlib_ask_with_default __pyx_t_18; __Pyx_RefNannySetupContext("add_template", 0); - /* "ktlib.pyx":745 + /* "src/ktlib.pyx":795 * cdef add_template(self): * cdef: - * string question = b'Which template would you like to add:\n' # <<<<<<<<<<<<<< - * string temp - * object selectable_lang = {} + * str question = 'Which template would you like to add:\n' # <<<<<<<<<<<<<< + * str temp + * dict selectable_lang = {} */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Which_template_would_you_like_to); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 745, __pyx_L1_error) - __pyx_v_question = __pyx_t_1; + __Pyx_INCREF(__pyx_kp_u_Which_template_would_you_like_to); + __pyx_v_question = __pyx_kp_u_Which_template_would_you_like_to; - /* "ktlib.pyx":747 - * string question = b'Which template would you like to add:\n' - * string temp - * object selectable_lang = {} # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":797 + * str question = 'Which template would you like to add:\n' + * str temp + * dict selectable_lang = {} # <<<<<<<<<<<<<< * int idx = 1 - * object existed_templates = {} + * dict existed_templates = {} */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_selectable_lang = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_selectable_lang = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":748 - * string temp - * object selectable_lang = {} + /* "src/ktlib.pyx":798 + * str temp + * dict selectable_lang = {} * int idx = 1 # <<<<<<<<<<<<<< - * object existed_templates = {} - * string res + * dict existed_templates = {} + * str res */ __pyx_v_idx = 1; - /* "ktlib.pyx":749 - * object selectable_lang = {} + /* "src/ktlib.pyx":799 + * dict selectable_lang = {} * int idx = 1 - * object existed_templates = {} # <<<<<<<<<<<<<< - * string res + * dict existed_templates = {} # <<<<<<<<<<<<<< + * str res * int ret */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_existed_templates = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_existed_templates = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":752 - * string res + /* "src/ktlib.pyx":802 + * str res * int ret - * object options = {} # <<<<<<<<<<<<<< + * dict options = {} # <<<<<<<<<<<<<< * - * print(color_green(b'Adapted from xalanq\'s cf tool')) + * log(color_green('Adapted from xalanq\'s cf tool')) */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_options = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_options = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":754 - * object options = {} + /* "src/ktlib.pyx":804 + * dict options = {} * - * print(color_green(b'Adapted from xalanq\'s cf tool')) # <<<<<<<<<<<<<< - * print(''' + * log(color_green('Adapted from xalanq\'s cf tool')) # <<<<<<<<<<<<<< + * log(''' * Template will run 3 scripts in sequence when you run "kt test": */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_Adapted_from_xalanq_s_cf_tool, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_t_3 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_Adapted_from_xalanq_s_cf_tool, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":755 + /* "src/ktlib.pyx":805 * - * print(color_green(b'Adapted from xalanq\'s cf tool')) - * print(''' # <<<<<<<<<<<<<< + * log(color_green('Adapted from xalanq\'s cf tool')) + * log(''' # <<<<<<<<<<<<<< * Template will run 3 scripts in sequence when you run "kt test": * - before_script (execute once) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_Template_will_run_3_scripts_in) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Template_will_run_3_scripts_in); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":773 + /* "src/ktlib.pyx":823 * * * with open(self.kt_config) as f: # <<<<<<<<<<<<<< @@ -15097,76 +15800,74 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con * */ /*with:*/ { - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 773, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - __pyx_v_f = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; - /* "ktlib.pyx":774 + /* "src/ktlib.pyx":824 * * with open(self.kt_config) as f: * existed_templates = json.load(f) # <<<<<<<<<<<<<< * * for template_type, lang in map_template_to_plang.items(): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_json); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_f); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_existed_templates, __pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_f); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 824, __pyx_L7_error) + __Pyx_DECREF_SET(__pyx_v_existed_templates, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "ktlib.pyx":773 + /* "src/ktlib.pyx":823 * * * with open(self.kt_config) as f: # <<<<<<<<<<<<<< @@ -15174,67 +15875,67 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con * */ } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L12_try_end; __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Config.add_template", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 773, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_AddTraceback("src.ktlib.Config.add_template", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 823, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 773, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 773, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 773, __pyx_L9_except_error) - __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_5); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 823, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_10 < 0) __PYX_ERR(0, 823, __pyx_L9_except_error) + __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0); + if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_3, __pyx_t_2); - __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 773, __pyx_L9_except_error) + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 823, __pyx_L9_except_error) } - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L8_exception_handled; } __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L12_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_4) { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_5) { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } goto __pyx_L6; } @@ -15242,134 +15943,142 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con } goto __pyx_L16; __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L1_error; __pyx_L16:; } - /* "ktlib.pyx":776 + /* "src/ktlib.pyx":826 * existed_templates = json.load(f) * * for template_type, lang in map_template_to_plang.items(): # <<<<<<<<<<<<<< * if template_type not in existed_templates: * temp = f'{idx} ({lang.extension}): {lang.full_name}\n' */ - __pyx_t_13 = 0; - if (unlikely(__pyx_v_5ktlib_map_template_to_plang == Py_None)) { + __pyx_t_12 = 0; + if (unlikely(__pyx_v_3src_5ktlib_map_template_to_plang == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 776, __pyx_L1_error) + __PYX_ERR(0, 826, __pyx_L1_error) } - __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_5ktlib_map_template_to_plang, 0, __pyx_n_s_items, (&__pyx_t_14), (&__pyx_t_15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_3src_5ktlib_map_template_to_plang, 1, __pyx_n_s_items, (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; while (1) { - __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_14, &__pyx_t_13, &__pyx_t_3, &__pyx_t_5, NULL, __pyx_t_15); - if (unlikely(__pyx_t_16 == 0)) break; - if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_13, &__pyx_t_12, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_14); + if (unlikely(__pyx_t_15 == 0)) break; + if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_template_type, __pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_template_type, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_lang, __pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_lang, __pyx_t_5); - __pyx_t_5 = 0; - /* "ktlib.pyx":777 + /* "src/ktlib.pyx":827 * * for template_type, lang in map_template_to_plang.items(): * if template_type not in existed_templates: # <<<<<<<<<<<<<< * temp = f'{idx} ({lang.extension}): {lang.full_name}\n' * question.append(temp) */ - __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_v_template_type, __pyx_v_existed_templates, Py_NE)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 777, __pyx_L1_error) - __pyx_t_11 = (__pyx_t_12 != 0); - if (__pyx_t_11) { + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 827, __pyx_L1_error) + } + __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_v_template_type, __pyx_v_existed_templates, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 827, __pyx_L1_error) + __pyx_t_10 = (__pyx_t_11 != 0); + if (__pyx_t_10) { - /* "ktlib.pyx":778 + /* "src/ktlib.pyx":828 * for template_type, lang in map_template_to_plang.items(): * if template_type not in existed_templates: * temp = f'{idx} ({lang.extension}): {lang.full_name}\n' # <<<<<<<<<<<<<< * question.append(temp) * selectable_lang[idx] = (template_type, lang) */ - __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_17 = 0; - __pyx_t_18 = 127; - __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_17 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_16 = 0; + __pyx_t_17 = 127; + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_kp_u__37); + __pyx_t_16 += 2; + __Pyx_GIVEREF(__pyx_kp_u__37); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u__37); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_lang, __pyx_n_s_extension); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_17; + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); + __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u__38); - __pyx_t_17 += 2; + __pyx_t_16 += 3; __Pyx_GIVEREF(__pyx_kp_u__38); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_u__38); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_lang, __pyx_n_s_extension); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_18; - __pyx_t_17 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u__39); - __pyx_t_17 += 3; - __Pyx_GIVEREF(__pyx_kp_u__39); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_kp_u__39); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_lang, __pyx_n_s_full_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_18 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_18) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_18; - __pyx_t_17 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_3); - __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_kp_u__38); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_lang, __pyx_n_s_full_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_17; + __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2); + __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u__2); - __pyx_t_17 += 1; + __pyx_t_16 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); - PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_kp_u__2); - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 6, __pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_kp_u__2); + __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 6, __pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_temp = __pyx_t_1; + __Pyx_XDECREF_SET(__pyx_v_temp, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "ktlib.pyx":779 + /* "src/ktlib.pyx":829 * if template_type not in existed_templates: * temp = f'{idx} ({lang.extension}): {lang.full_name}\n' * question.append(temp) # <<<<<<<<<<<<<< * selectable_lang[idx] = (template_type, lang) * idx += 1 */ - (void)(__pyx_v_question.append(__pyx_v_temp)); + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyUnicode_Type_append, __pyx_v_question, __pyx_v_temp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":780 + /* "src/ktlib.pyx":830 * temp = f'{idx} ({lang.extension}): {lang.full_name}\n' * question.append(temp) * selectable_lang[idx] = (template_type, lang) # <<<<<<<<<<<<<< * idx += 1 * */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_template_type); __Pyx_GIVEREF(__pyx_v_template_type); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_template_type); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_template_type); __Pyx_INCREF(__pyx_v_lang); __Pyx_GIVEREF(__pyx_v_lang); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lang); - if (unlikely(__Pyx_SetItemInt(__pyx_v_selectable_lang, __pyx_v_idx, __pyx_t_3, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 780, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_lang); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyDict_SetItem(__pyx_v_selectable_lang, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 830, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":781 + /* "src/ktlib.pyx":831 * question.append(temp) * selectable_lang[idx] = (template_type, lang) * idx += 1 # <<<<<<<<<<<<<< @@ -15378,7 +16087,7 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "ktlib.pyx":777 + /* "src/ktlib.pyx":827 * * for template_type, lang in map_template_to_plang.items(): * if template_type not in existed_templates: # <<<<<<<<<<<<<< @@ -15387,41 +16096,35 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con */ } } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":783 + /* "src/ktlib.pyx":833 * idx += 1 * * res = input(question) # <<<<<<<<<<<<<< * ret = int(res) * assert 1 <= ret < idx, 'Invalid input' */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_question); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 783, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_input, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 783, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_res = __pyx_t_1; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_input, __pyx_v_question); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 833, __pyx_L1_error) + __pyx_v_res = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":784 + /* "src/ktlib.pyx":834 * * res = input(question) * ret = int(res) # <<<<<<<<<<<<<< * assert 1 <= ret < idx, 'Invalid input' * */ - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_res); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_ret = __pyx_t_15; + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_ret = __pyx_t_14; - /* "ktlib.pyx":785 + /* "src/ktlib.pyx":835 * res = input(question) * ret = int(res) * assert 1 <= ret < idx, 'Invalid input' # <<<<<<<<<<<<<< @@ -15430,302 +16133,298 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_11 = (1 <= __pyx_v_ret); - if (__pyx_t_11) { - __pyx_t_11 = (__pyx_v_ret < __pyx_v_idx); + __pyx_t_10 = (1 <= __pyx_v_ret); + if (__pyx_t_10) { + __pyx_t_10 = (__pyx_v_ret < __pyx_v_idx); } - if (unlikely(!(__pyx_t_11 != 0))) { + if (unlikely(!(__pyx_t_10 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Invalid_input); - __PYX_ERR(0, 785, __pyx_L1_error) + __PYX_ERR(0, 835, __pyx_L1_error) } } #endif - /* "ktlib.pyx":787 + /* "src/ktlib.pyx":837 * assert 1 <= ret < idx, 'Invalid input' * * selected_lang = selectable_lang[ret][1] # <<<<<<<<<<<<<< - * options['path'] = ask_with_default(b'Template path', f'~/template.{selected_lang.extension}') - * options['pre_script'] = ask_with_default(b'Pre-script', selected_lang.pre_script) + * options['path'] = ask_with_default('Template path', f'~/template.{selected_lang.extension}') + * options['pre_script'] = ask_with_default('Pre-script', selected_lang.pre_script) */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_selectable_lang, __pyx_v_ret, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 787, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_selectable_lang, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 837, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 787, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_selected_lang = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_selected_lang = __pyx_t_1; + __pyx_t_1 = 0; - /* "ktlib.pyx":788 + /* "src/ktlib.pyx":838 * * selected_lang = selectable_lang[ret][1] - * options['path'] = ask_with_default(b'Template path', f'~/template.{selected_lang.extension}') # <<<<<<<<<<<<<< - * options['pre_script'] = ask_with_default(b'Pre-script', selected_lang.pre_script) - * options['script'] = ask_with_default(b'Script', selected_lang.script) + * options['path'] = ask_with_default('Template path', f'~/template.{selected_lang.extension}') # <<<<<<<<<<<<<< + * options['pre_script'] = ask_with_default('Pre-script', selected_lang.pre_script) + * options['script'] = ask_with_default('Script', selected_lang.script) */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Template_path); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_extension); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_extension); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_template, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_template, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_18.__pyx_n = 1; + __pyx_t_18.default_val = ((PyObject*)__pyx_t_1); + __pyx_t_2 = __pyx_f_3src_5ktlib_ask_with_default(__pyx_kp_u_Template_path, &__pyx_t_18); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_options, __pyx_n_u_path, __pyx_t_2) < 0)) __PYX_ERR(0, 838, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_21.__pyx_n = 1; - __pyx_t_21.default_val = __pyx_t_19; - __pyx_t_20 = __pyx_f_5ktlib_ask_with_default(__pyx_t_1, &__pyx_t_21); - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_path, __pyx_t_3) < 0)) __PYX_ERR(0, 788, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":789 + /* "src/ktlib.pyx":839 * selected_lang = selectable_lang[ret][1] - * options['path'] = ask_with_default(b'Template path', f'~/template.{selected_lang.extension}') - * options['pre_script'] = ask_with_default(b'Pre-script', selected_lang.pre_script) # <<<<<<<<<<<<<< - * options['script'] = ask_with_default(b'Script', selected_lang.script) - * options['post_script'] = ask_with_default(b'Post-script', selected_lang.post_script) + * options['path'] = ask_with_default('Template path', f'~/template.{selected_lang.extension}') + * options['pre_script'] = ask_with_default('Pre-script', selected_lang.pre_script) # <<<<<<<<<<<<<< + * options['script'] = ask_with_default('Script', selected_lang.script) + * options['post_script'] = ask_with_default('Post-script', selected_lang.post_script) */ - __pyx_t_20 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Pre_script); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_pre_script); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_21.__pyx_n = 1; - __pyx_t_21.default_val = __pyx_t_19; - __pyx_t_1 = __pyx_f_5ktlib_ask_with_default(__pyx_t_20, &__pyx_t_21); - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_pre_script, __pyx_t_3) < 0)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_pre_script); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_18.__pyx_n = 1; + __pyx_t_18.default_val = ((PyObject*)__pyx_t_2); + __pyx_t_1 = __pyx_f_3src_5ktlib_ask_with_default(__pyx_kp_u_Pre_script, &__pyx_t_18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_options, __pyx_n_u_pre_script, __pyx_t_1) < 0)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":790 - * options['path'] = ask_with_default(b'Template path', f'~/template.{selected_lang.extension}') - * options['pre_script'] = ask_with_default(b'Pre-script', selected_lang.pre_script) - * options['script'] = ask_with_default(b'Script', selected_lang.script) # <<<<<<<<<<<<<< - * options['post_script'] = ask_with_default(b'Post-script', selected_lang.post_script) + /* "src/ktlib.pyx":840 + * options['path'] = ask_with_default('Template path', f'~/template.{selected_lang.extension}') + * options['pre_script'] = ask_with_default('Pre-script', selected_lang.pre_script) + * options['script'] = ask_with_default('Script', selected_lang.script) # <<<<<<<<<<<<<< + * options['post_script'] = ask_with_default('Post-script', selected_lang.post_script) * options['default'] = False if existed_templates else True */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_Script); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_script); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_21.__pyx_n = 1; - __pyx_t_21.default_val = __pyx_t_19; - __pyx_t_20 = __pyx_f_5ktlib_ask_with_default(__pyx_t_1, &__pyx_t_21); - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_script, __pyx_t_3) < 0)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_script); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_18.__pyx_n = 1; + __pyx_t_18.default_val = ((PyObject*)__pyx_t_1); + __pyx_t_2 = __pyx_f_3src_5ktlib_ask_with_default(__pyx_n_u_Script, &__pyx_t_18); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_options, __pyx_n_u_script, __pyx_t_2) < 0)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":791 - * options['pre_script'] = ask_with_default(b'Pre-script', selected_lang.pre_script) - * options['script'] = ask_with_default(b'Script', selected_lang.script) - * options['post_script'] = ask_with_default(b'Post-script', selected_lang.post_script) # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":841 + * options['pre_script'] = ask_with_default('Pre-script', selected_lang.pre_script) + * options['script'] = ask_with_default('Script', selected_lang.script) + * options['post_script'] = ask_with_default('Post-script', selected_lang.post_script) # <<<<<<<<<<<<<< * options['default'] = False if existed_templates else True * */ - __pyx_t_20 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_Post_script); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_post_script); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_21.__pyx_n = 1; - __pyx_t_21.default_val = __pyx_t_19; - __pyx_t_1 = __pyx_f_5ktlib_ask_with_default(__pyx_t_20, &__pyx_t_21); - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_post_script, __pyx_t_3) < 0)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_post_script); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 841, __pyx_L1_error) + __pyx_t_18.__pyx_n = 1; + __pyx_t_18.default_val = ((PyObject*)__pyx_t_2); + __pyx_t_1 = __pyx_f_3src_5ktlib_ask_with_default(__pyx_kp_u_Post_script, &__pyx_t_18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_options, __pyx_n_u_post_script, __pyx_t_1) < 0)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":792 - * options['script'] = ask_with_default(b'Script', selected_lang.script) - * options['post_script'] = ask_with_default(b'Post-script', selected_lang.post_script) + /* "src/ktlib.pyx":842 + * options['script'] = ask_with_default('Script', selected_lang.script) + * options['post_script'] = ask_with_default('Post-script', selected_lang.post_script) * options['default'] = False if existed_templates else True # <<<<<<<<<<<<<< * * existed_templates[selected_lang.alias] = options */ - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_existed_templates); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 792, __pyx_L1_error) - if (__pyx_t_11) { + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_existed_templates); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 842, __pyx_L1_error) + if (__pyx_t_10) { __Pyx_INCREF(Py_False); - __pyx_t_3 = Py_False; + __pyx_t_1 = Py_False; } else { __Pyx_INCREF(Py_True); - __pyx_t_3 = Py_True; + __pyx_t_1 = Py_True; } - if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_default, __pyx_t_3) < 0)) __PYX_ERR(0, 792, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_options, __pyx_n_u_default, __pyx_t_1) < 0)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":794 + /* "src/ktlib.pyx":844 * options['default'] = False if existed_templates else True * * existed_templates[selected_lang.alias] = options # <<<<<<<<<<<<<< * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_alias); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 794, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_v_existed_templates, __pyx_t_3, __pyx_v_options) < 0)) __PYX_ERR(0, 794, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 844, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_lang, __pyx_n_s_alias); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_existed_templates, __pyx_t_1, __pyx_v_options) < 0)) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":795 + /* "src/ktlib.pyx":845 * * existed_templates[selected_lang.alias] = options * with open(self.kt_config, 'w') as kt_config: # <<<<<<<<<<<<<< * json.dump(existed_templates, kt_config, indent=2) - * print(color_green(b'Yosh, your configuration has been saved')) + * log(color_green('Yosh, your configuration has been saved')) */ /*with:*/ { - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->__pyx_base.kt_config); + __Pyx_GIVEREF(__pyx_v_self->__pyx_base.kt_config); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->__pyx_base.kt_config); __Pyx_INCREF(__pyx_n_u_w); __Pyx_GIVEREF(__pyx_n_u_w); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_w); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 795, __pyx_L20_error) + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_w); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 845, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L20_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L20_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L20_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_9); + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { - __pyx_v_kt_config = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_kt_config = __pyx_t_3; + __pyx_t_3 = 0; - /* "ktlib.pyx":796 + /* "src/ktlib.pyx":846 * existed_templates[selected_lang.alias] = options * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) # <<<<<<<<<<<<<< - * print(color_green(b'Yosh, your configuration has been saved')) + * log(color_green('Yosh, your configuration has been saved')) * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_json); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 796, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dump); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L24_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dump); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 846, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L24_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 796, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_existed_templates); __Pyx_GIVEREF(__pyx_v_existed_templates); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_existed_templates); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_existed_templates); __Pyx_INCREF(__pyx_v_kt_config); __Pyx_GIVEREF(__pyx_v_kt_config); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_kt_config); - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_indent, __pyx_int_2) < 0) __PYX_ERR(0, 796, __pyx_L24_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 796, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_kt_config); + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_indent, __pyx_int_2) < 0) __PYX_ERR(0, 846, __pyx_L24_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 846, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":795 + /* "src/ktlib.pyx":845 * * existed_templates[selected_lang.alias] = options * with open(self.kt_config, 'w') as kt_config: # <<<<<<<<<<<<<< * json.dump(existed_templates, kt_config, indent=2) - * print(color_green(b'Yosh, your configuration has been saved')) + * log(color_green('Yosh, your configuration has been saved')) */ } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L29_try_end; __pyx_L24_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Config.add_template", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 795, __pyx_L26_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L26_except_error) + __Pyx_AddTraceback("src.ktlib.Config.add_template", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 845, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 795, __pyx_L26_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 795, __pyx_L26_except_error) - __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_2, __pyx_t_5); - __pyx_t_6 = 0; __pyx_t_2 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 795, __pyx_L26_except_error) + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 845, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_10 < 0) __PYX_ERR(0, 845, __pyx_L26_except_error) + __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_3); + __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; + __PYX_ERR(0, 845, __pyx_L26_except_error) } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L25_exception_handled; } __pyx_L26_except_error:; - __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6); goto __pyx_L1_error; __pyx_L25_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6); __pyx_L29_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_4) { - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_5) { + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } goto __pyx_L23; } @@ -15733,46 +16432,64 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con } goto __pyx_L33; __pyx_L20_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L1_error; __pyx_L33:; } - /* "ktlib.pyx":797 + /* "src/ktlib.pyx":847 * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) - * print(color_green(b'Yosh, your configuration has been saved')) # <<<<<<<<<<<<<< + * log(color_green('Yosh, your configuration has been saved')) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_Yosh_your_configuration_has_been, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 797, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_Yosh_your_configuration_has_been, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":743 + /* "src/ktlib.pyx":793 * * cdef class Config(Action): * cdef add_template(self): # <<<<<<<<<<<<<< * cdef: - * string question = b'Which template would you like to add:\n' + * str question = 'Which template would you like to add:\n' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("ktlib.Config.add_template", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.Config.add_template", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_question); + __Pyx_XDECREF(__pyx_v_temp); __Pyx_XDECREF(__pyx_v_selectable_lang); __Pyx_XDECREF(__pyx_v_existed_templates); + __Pyx_XDECREF(__pyx_v_res); __Pyx_XDECREF(__pyx_v_options); __Pyx_XDECREF(__pyx_v_f); __Pyx_XDECREF(__pyx_v_template_type); @@ -15784,7 +16501,7 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con return __pyx_r; } -/* "ktlib.pyx":800 +/* "src/ktlib.pyx":850 * * * cdef remove_template(self): # <<<<<<<<<<<<<< @@ -15792,10 +16509,10 @@ static PyObject *__pyx_f_5ktlib_6Config_add_template(struct __pyx_obj_5ktlib_Con * cdef: */ -static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_Config *__pyx_v_self) { +static PyObject *__pyx_f_3src_5ktlib_6Config_remove_template(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self) { PyObject *__pyx_v_existed_templates = 0; PyObject *__pyx_v_res = 0; - bool __pyx_v_move_default; + int __pyx_v_move_default; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_k = NULL; CYTHON_UNUSED PyObject *__pyx_v_v = NULL; @@ -15815,40 +16532,37 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ int __pyx_t_11; Py_ssize_t __pyx_t_12; Py_UCS4 __pyx_t_13; - Py_ssize_t __pyx_t_14; - int __pyx_t_15; + PyObject *__pyx_t_14 = NULL; + Py_ssize_t __pyx_t_15; int __pyx_t_16; - bool __pyx_t_17; + int __pyx_t_17; __Pyx_RefNannySetupContext("remove_template", 0); - /* "ktlib.pyx":803 + /* "src/ktlib.pyx":853 * ''' Remove a template from ktconfig file''' * cdef: - * object existed_templates = {} # <<<<<<<<<<<<<< + * dict existed_templates = {} # <<<<<<<<<<<<<< * str res - * bool_t move_default + * bint move_default */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_existed_templates = __pyx_t_1; + __pyx_v_existed_templates = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":807 - * bool_t move_default + /* "src/ktlib.pyx":857 + * bint move_default * * with open(self.kt_config) as f: # <<<<<<<<<<<<<< * existed_templates = json.load(f) * */ /*with:*/ { - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 857, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -15860,14 +16574,14 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare @@ -15880,38 +16594,39 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ __pyx_v_f = __pyx_t_4; __pyx_t_4 = 0; - /* "ktlib.pyx":808 + /* "src/ktlib.pyx":858 * * with open(self.kt_config) as f: * existed_templates = json.load(f) # <<<<<<<<<<<<<< * - * print(f'Which template would you like to {color_red(b"delete")} ? For eg cpp, cc, ...') + * log(f'Which template would you like to {color_red("delete")} ? For eg cpp, cc, ...') */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 808, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_json); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 858, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_f); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L7_error) + __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_f); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 858, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_existed_templates, __pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 858, __pyx_L7_error) + __Pyx_DECREF_SET(__pyx_v_existed_templates, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "ktlib.pyx":807 - * bool_t move_default + /* "src/ktlib.pyx":857 + * bint move_default * * with open(self.kt_config) as f: # <<<<<<<<<<<<<< * existed_templates = json.load(f) @@ -15924,37 +16639,37 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ goto __pyx_L12_try_end; __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Config.remove_template", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 807, __pyx_L9_except_error) + __Pyx_AddTraceback("src.ktlib.Config.remove_template", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 857, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L9_except_error) + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 857, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 807, __pyx_L9_except_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 857, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_10 < 0) __PYX_ERR(0, 807, __pyx_L9_except_error) + if (__pyx_t_10 < 0) __PYX_ERR(0, 857, __pyx_L9_except_error) __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_2); - __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 807, __pyx_L9_except_error) + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_3, __pyx_t_1); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 857, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L8_exception_handled; } __pyx_L9_except_error:; @@ -15973,10 +16688,10 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_3) { - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 807, __pyx_L1_error) + if (__pyx_t_2) { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -15986,100 +16701,133 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ } goto __pyx_L16; __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L1_error; __pyx_L16:; } - /* "ktlib.pyx":810 + /* "src/ktlib.pyx":860 * existed_templates = json.load(f) * - * print(f'Which template would you like to {color_red(b"delete")} ? For eg cpp, cc, ...') # <<<<<<<<<<<<<< + * log(f'Which template would you like to {color_red("delete")} ? For eg cpp, cc, ...') # <<<<<<<<<<<<<< * for k, v in existed_templates.items(): - * print(k) + * log(k) */ - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = 0; __pyx_t_13 = 127; __Pyx_INCREF(__pyx_kp_u_Which_template_would_you_like_to_2); __pyx_t_12 += 33; __Pyx_GIVEREF(__pyx_kp_u_Which_template_would_you_like_to_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Which_template_would_you_like_to_2); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_k_delete, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_13; - __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Which_template_would_you_like_to_2); + __pyx_t_5 = __pyx_f_3src_5ktlib_color_red(__pyx_n_u_delete, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_13; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_14); + __pyx_t_14 = 0; __Pyx_INCREF(__pyx_kp_u_For_eg_cpp_cc); __pyx_t_12 += 22; __Pyx_GIVEREF(__pyx_kp_u_For_eg_cpp_cc); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_For_eg_cpp_cc); - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_For_eg_cpp_cc); + __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 860, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_14); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":811 + /* "src/ktlib.pyx":861 * - * print(f'Which template would you like to {color_red(b"delete")} ? For eg cpp, cc, ...') + * log(f'Which template would you like to {color_red("delete")} ? For eg cpp, cc, ...') * for k, v in existed_templates.items(): # <<<<<<<<<<<<<< - * print(k) + * log(k) * res = input() */ __pyx_t_12 = 0; if (unlikely(__pyx_v_existed_templates == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 811, __pyx_L1_error) + __PYX_ERR(0, 861, __pyx_L1_error) } - __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_existed_templates, 0, __pyx_n_s_items, (&__pyx_t_14), (&__pyx_t_15)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_existed_templates, 1, __pyx_n_s_items, (&__pyx_t_15), (&__pyx_t_16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; while (1) { - __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_14, &__pyx_t_12, &__pyx_t_1, &__pyx_t_4, NULL, __pyx_t_15); - if (unlikely(__pyx_t_16 == 0)) break; - if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_15, &__pyx_t_12, &__pyx_t_3, &__pyx_t_14, NULL, __pyx_t_16); + if (unlikely(__pyx_t_17 == 0)) break; + if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_14); + __pyx_t_14 = 0; - /* "ktlib.pyx":812 - * print(f'Which template would you like to {color_red(b"delete")} ? For eg cpp, cc, ...') + /* "src/ktlib.pyx":862 + * log(f'Which template would you like to {color_red("delete")} ? For eg cpp, cc, ...') * for k, v in existed_templates.items(): - * print(k) # <<<<<<<<<<<<<< + * log(k) # <<<<<<<<<<<<<< * res = input() * */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_14 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_k) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_k); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":813 + /* "src/ktlib.pyx":863 * for k, v in existed_templates.items(): - * print(k) + * log(k) * res = input() # <<<<<<<<<<<<<< * * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 813, __pyx_L1_error) - __pyx_v_res = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 863, __pyx_L1_error) + __pyx_v_res = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":815 + /* "src/ktlib.pyx":865 * res = input() * * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' # <<<<<<<<<<<<<< @@ -16088,117 +16836,84 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_res, __pyx_v_existed_templates, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 815, __pyx_L1_error) + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 865, __pyx_L1_error) + } + __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_v_res, __pyx_v_existed_templates, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 865, __pyx_L1_error) if (unlikely(!(__pyx_t_11 != 0))) { - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = 0; __pyx_t_13 = 127; __Pyx_INCREF(__pyx_kp_u_Invalid_template_chosen_Template); - __pyx_t_14 += 34; + __pyx_t_15 += 34; __Pyx_GIVEREF(__pyx_kp_u_Invalid_template_chosen_Template); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Invalid_template_chosen_Template); - __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_res); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_13; - __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_template_chosen_Template); + __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_res); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_13; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14); + __pyx_t_14 = 0; __Pyx_INCREF(__pyx_kp_u_is_not_in_ur_config_file); - __pyx_t_14 += 25; + __pyx_t_15 += 25; __Pyx_GIVEREF(__pyx_kp_u_is_not_in_ur_config_file); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_is_not_in_ur_config_file); - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyErr_SetObject(PyExc_AssertionError, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 815, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_is_not_in_ur_config_file); + __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_15, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetObject(PyExc_AssertionError, __pyx_t_14); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __PYX_ERR(0, 865, __pyx_L1_error) } } #endif - /* "ktlib.pyx":817 + /* "src/ktlib.pyx":867 * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' * * move_default = existed_templates[res]['default'] # <<<<<<<<<<<<<< * existed_templates.pop(res, None) * if existed_templates and move_default: # move default to the first key of template */ - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_existed_templates, __pyx_v_res); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_17 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_move_default = __pyx_t_17; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 867, __pyx_L1_error) + } + __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_existed_templates, __pyx_v_res); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_14, __pyx_n_u_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_move_default = __pyx_t_11; - /* "ktlib.pyx":818 + /* "src/ktlib.pyx":868 * * move_default = existed_templates[res]['default'] * existed_templates.pop(res, None) # <<<<<<<<<<<<<< * if existed_templates and move_default: # move default to the first key of template * existed_templates[next(iter(existed_templates))] = True */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_existed_templates, __pyx_n_s_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = NULL; - __pyx_t_15 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_15 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_res, Py_None}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_res, Py_None}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_res); - __Pyx_GIVEREF(__pyx_v_res); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_15, __pyx_v_res); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_15, Py_None); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop"); + __PYX_ERR(0, 868, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_existed_templates, __pyx_v_res, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":819 + /* "src/ktlib.pyx":869 * move_default = existed_templates[res]['default'] * existed_templates.pop(res, None) * if existed_templates and move_default: # move default to the first key of template # <<<<<<<<<<<<<< * existed_templates[next(iter(existed_templates))] = True * with open(self.kt_config, 'w') as kt_config: */ - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_existed_templates); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 819, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_existed_templates); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 869, __pyx_L1_error) if (__pyx_t_10) { } else { __pyx_t_11 = __pyx_t_10; @@ -16209,22 +16924,26 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ __pyx_L20_bool_binop_done:; if (__pyx_t_11) { - /* "ktlib.pyx":820 + /* "src/ktlib.pyx":870 * existed_templates.pop(res, None) * if existed_templates and move_default: # move default to the first key of template * existed_templates[next(iter(existed_templates))] = True # <<<<<<<<<<<<<< * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) */ - __pyx_t_2 = PyObject_GetIter(__pyx_v_existed_templates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyIter_Next(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 820, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_existed_templates, __pyx_t_4, Py_True) < 0)) __PYX_ERR(0, 820, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 870, __pyx_L1_error) + } + __pyx_t_1 = PyObject_GetIter(__pyx_v_existed_templates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 870, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_existed_templates, __pyx_t_14, Py_True) < 0)) __PYX_ERR(0, 870, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "ktlib.pyx":819 + /* "src/ktlib.pyx":869 * move_default = existed_templates[res]['default'] * existed_templates.pop(res, None) * if existed_templates and move_default: # move default to the first key of template # <<<<<<<<<<<<<< @@ -16233,7 +16952,7 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ */ } - /* "ktlib.pyx":821 + /* "src/ktlib.pyx":871 * if existed_templates and move_default: # move default to the first key of template * existed_templates[next(iter(existed_templates))] = True * with open(self.kt_config, 'w') as kt_config: # <<<<<<<<<<<<<< @@ -16241,41 +16960,39 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ * */ /*with:*/ { - __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_v_self->__pyx_base.kt_config); + __Pyx_GIVEREF(__pyx_v_self->__pyx_base.kt_config); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_self->__pyx_base.kt_config); __Pyx_INCREF(__pyx_n_u_w); __Pyx_GIVEREF(__pyx_n_u_w); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_w); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_u_w); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 821, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_14 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 871, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_14; + __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare @@ -16285,40 +17002,40 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { - __pyx_v_kt_config = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_kt_config = __pyx_t_3; + __pyx_t_3 = 0; - /* "ktlib.pyx":822 + /* "src/ktlib.pyx":872 * existed_templates[next(iter(existed_templates))] = True * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) # <<<<<<<<<<<<<< * - * cdef update_default(self): + * cdef void update_default(self) except *: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_json); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L26_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dump); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 822, __pyx_L26_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L26_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dump); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_existed_templates); __Pyx_GIVEREF(__pyx_v_existed_templates); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_existed_templates); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_existed_templates); __Pyx_INCREF(__pyx_v_kt_config); __Pyx_GIVEREF(__pyx_v_kt_config); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_kt_config); - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L26_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_indent, __pyx_int_2) < 0) __PYX_ERR(0, 822, __pyx_L26_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L26_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_kt_config); + __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 872, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_indent, __pyx_int_2) < 0) __PYX_ERR(0, 872, __pyx_L26_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":821 + /* "src/ktlib.pyx":871 * if existed_templates and move_default: # move default to the first key of template * existed_templates[next(iter(existed_templates))] = True * with open(self.kt_config, 'w') as kt_config: # <<<<<<<<<<<<<< @@ -16332,37 +17049,38 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ goto __pyx_L31_try_end; __pyx_L26_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Config.remove_template", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 821, __pyx_L28_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L28_except_error) + __Pyx_AddTraceback("src.ktlib.Config.remove_template", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_14, &__pyx_t_3) < 0) __PYX_ERR(0, 871, __pyx_L28_except_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 821, __pyx_L28_except_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L28_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 871, __pyx_L28_except_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 821, __pyx_L28_except_error) + if (__pyx_t_11 < 0) __PYX_ERR(0, 871, __pyx_L28_except_error) __pyx_t_10 = ((!(__pyx_t_11 != 0)) != 0); if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_5); - __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 821, __pyx_L28_except_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_14, __pyx_t_3); + __pyx_t_4 = 0; __pyx_t_14 = 0; __pyx_t_3 = 0; + __PYX_ERR(0, 871, __pyx_L28_except_error) } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L27_exception_handled; } __pyx_L28_except_error:; @@ -16381,10 +17099,10 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_3) { - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 821, __pyx_L1_error) + if (__pyx_t_2) { + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -16394,12 +17112,12 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ } goto __pyx_L35; __pyx_L22_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L1_error; __pyx_L35:; } - /* "ktlib.pyx":800 + /* "src/ktlib.pyx":850 * * * cdef remove_template(self): # <<<<<<<<<<<<<< @@ -16412,10 +17130,11 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("ktlib.Config.remove_template", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("src.ktlib.Config.remove_template", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_existed_templates); @@ -16429,26 +17148,25 @@ static PyObject *__pyx_f_5ktlib_6Config_remove_template(struct __pyx_obj_5ktlib_ return __pyx_r; } -/* "ktlib.pyx":824 +/* "src/ktlib.pyx":874 * json.dump(existed_templates, kt_config, indent=2) * - * cdef update_default(self): # <<<<<<<<<<<<<< + * cdef void update_default(self) except *: # <<<<<<<<<<<<<< * cdef: - * object existed_templates = {} + * dict existed_templates = {} */ -static PyObject *__pyx_f_5ktlib_6Config_update_default(struct __pyx_obj_5ktlib_Config *__pyx_v_self) { +static void __pyx_f_3src_5ktlib_6Config_update_default(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self) { PyObject *__pyx_v_existed_templates = 0; PyObject *__pyx_v_res = 0; - std::string __pyx_v_default_key; + PyObject *__pyx_v_default_key = 0; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_k = NULL; PyObject *__pyx_v_v = NULL; PyObject *__pyx_v_kt_config = NULL; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - std::string __pyx_t_2; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; @@ -16456,185 +17174,184 @@ static PyObject *__pyx_f_5ktlib_6Config_update_default(struct __pyx_obj_5ktlib_C PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; + int __pyx_t_10; int __pyx_t_11; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_UCS4 __pyx_t_14; + Py_ssize_t __pyx_t_12; + Py_UCS4 __pyx_t_13; + PyObject *__pyx_t_14 = NULL; Py_ssize_t __pyx_t_15; int __pyx_t_16; int __pyx_t_17; Py_ssize_t __pyx_t_18; + PyObject *__pyx_t_19 = NULL; __Pyx_RefNannySetupContext("update_default", 0); - /* "ktlib.pyx":826 - * cdef update_default(self): + /* "src/ktlib.pyx":876 + * cdef void update_default(self) except *: * cdef: - * object existed_templates = {} # <<<<<<<<<<<<<< + * dict existed_templates = {} # <<<<<<<<<<<<<< * str res - * string default_key = b'' + * str default_key = '' */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_existed_templates = __pyx_t_1; + __pyx_v_existed_templates = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":828 - * object existed_templates = {} + /* "src/ktlib.pyx":878 + * dict existed_templates = {} * str res - * string default_key = b'' # <<<<<<<<<<<<<< + * str default_key = '' # <<<<<<<<<<<<<< * * with open(self.kt_config) as f: */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__33); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 828, __pyx_L1_error) - __pyx_v_default_key = __pyx_t_2; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_v_default_key = __pyx_kp_u_; - /* "ktlib.pyx":830 - * string default_key = b'' + /* "src/ktlib.pyx":880 + * str default_key = '' * * with open(self.kt_config) as f: # <<<<<<<<<<<<<< * existed_templates = json.load(f) - * print(f'Which template would you like to gen as {color_cyan(b"default")} ? For eg cpp, cc, ...') + * log(f'Which template would you like to gen as {color_cyan("default")} ? For eg cpp, cc, ...') */ /*with:*/ { - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 830, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - __pyx_v_f = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_f = __pyx_t_4; + __pyx_t_4 = 0; - /* "ktlib.pyx":831 + /* "src/ktlib.pyx":881 * * with open(self.kt_config) as f: * existed_templates = json.load(f) # <<<<<<<<<<<<<< - * print(f'Which template would you like to gen as {color_cyan(b"default")} ? For eg cpp, cc, ...') + * log(f'Which template would you like to gen as {color_cyan("default")} ? For eg cpp, cc, ...') * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 831, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_json); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 881, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_f); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_existed_templates, __pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_f); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 881, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 881, __pyx_L7_error) + __Pyx_DECREF_SET(__pyx_v_existed_templates, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; - /* "ktlib.pyx":830 - * string default_key = b'' + /* "src/ktlib.pyx":880 + * str default_key = '' * * with open(self.kt_config) as f: # <<<<<<<<<<<<<< * existed_templates = json.load(f) - * print(f'Which template would you like to gen as {color_cyan(b"default")} ? For eg cpp, cc, ...') + * log(f'Which template would you like to gen as {color_cyan("default")} ? For eg cpp, cc, ...') */ } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L12_try_end; __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Config.update_default", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 830, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + __Pyx_AddTraceback("src.ktlib.Config.update_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 880, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 830, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __PYX_ERR(0, 830, __pyx_L9_except_error) - __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_1, __pyx_t_3); - __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; - __PYX_ERR(0, 830, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 880, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 880, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_10 < 0) __PYX_ERR(0, 880, __pyx_L9_except_error) + __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_3, __pyx_t_1); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 880, __pyx_L9_except_error) } - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L8_exception_handled; } __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L12_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_4) { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_2) { + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } goto __pyx_L6; } @@ -16642,172 +17359,208 @@ static PyObject *__pyx_f_5ktlib_6Config_update_default(struct __pyx_obj_5ktlib_C } goto __pyx_L16; __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L1_error; __pyx_L16:; } - /* "ktlib.pyx":832 + /* "src/ktlib.pyx":882 * with open(self.kt_config) as f: * existed_templates = json.load(f) - * print(f'Which template would you like to gen as {color_cyan(b"default")} ? For eg cpp, cc, ...') # <<<<<<<<<<<<<< + * log(f'Which template would you like to gen as {color_cyan("default")} ? For eg cpp, cc, ...') # <<<<<<<<<<<<<< * * for k, v in existed_templates.items(): */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = 0; - __pyx_t_14 = 127; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = 0; + __pyx_t_13 = 127; __Pyx_INCREF(__pyx_kp_u_Which_template_would_you_like_to_3); - __pyx_t_13 += 40; + __pyx_t_12 += 40; __Pyx_GIVEREF(__pyx_kp_u_Which_template_would_you_like_to_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Which_template_would_you_like_to_3); - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_k_default, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_14; - __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u_For_eg_cpp_cc); - __pyx_t_13 += 22; + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Which_template_would_you_like_to_3); + __pyx_t_5 = __pyx_f_3src_5ktlib_color_cyan(__pyx_n_u_default, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_13; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_14); + __pyx_t_14 = 0; + __Pyx_INCREF(__pyx_kp_u_For_eg_cpp_cc); + __pyx_t_12 += 22; __Pyx_GIVEREF(__pyx_kp_u_For_eg_cpp_cc); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_For_eg_cpp_cc); - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_For_eg_cpp_cc); + __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_14); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":834 - * print(f'Which template would you like to gen as {color_cyan(b"default")} ? For eg cpp, cc, ...') + /* "src/ktlib.pyx":884 + * log(f'Which template would you like to gen as {color_cyan("default")} ? For eg cpp, cc, ...') * * for k, v in existed_templates.items(): # <<<<<<<<<<<<<< - * print(f'{k} {color_green(b"(default)") if v["default"] else ""}') + * log(f'{k} {color_green("(default)") if v["default"] else ""}') * if v["default"]: */ - __pyx_t_13 = 0; + __pyx_t_12 = 0; if (unlikely(__pyx_v_existed_templates == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 834, __pyx_L1_error) + __PYX_ERR(0, 884, __pyx_L1_error) } - __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_existed_templates, 0, __pyx_n_s_items, (&__pyx_t_15), (&__pyx_t_16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_existed_templates, 1, __pyx_n_s_items, (&__pyx_t_15), (&__pyx_t_16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 884, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; while (1) { - __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_15, &__pyx_t_13, &__pyx_t_1, &__pyx_t_5, NULL, __pyx_t_16); + __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_15, &__pyx_t_12, &__pyx_t_3, &__pyx_t_14, NULL, __pyx_t_16); if (unlikely(__pyx_t_17 == 0)) break; - if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5); - __pyx_t_5 = 0; + if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 884, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_14); + __pyx_t_14 = 0; - /* "ktlib.pyx":835 + /* "src/ktlib.pyx":885 * * for k, v in existed_templates.items(): - * print(f'{k} {color_green(b"(default)") if v["default"] else ""}') # <<<<<<<<<<<<<< + * log(f'{k} {color_green("(default)") if v["default"] else ""}') # <<<<<<<<<<<<<< * if v["default"]: * default_key = k */ - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __pyx_t_18 = 0; - __pyx_t_14 = 127; - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_14; - __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u__24); + __pyx_t_13 = 127; + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_13; + __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__18); __pyx_t_18 += 1; - __Pyx_GIVEREF(__pyx_kp_u__24); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_u__24); - __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_v, __pyx_n_u_default); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_12) { - __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_default_2, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_GIVEREF(__pyx_kp_u__18); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u__18); + __pyx_t_19 = __Pyx_PyObject_Dict_GetItem(__pyx_v_v, __pyx_n_u_default); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (__pyx_t_11) { + __pyx_t_19 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_default_2, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_5 = __pyx_t_19; + __pyx_t_19 = 0; } else { - __Pyx_INCREF(__pyx_kp_u__33); - __pyx_t_1 = __pyx_kp_u__33; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_5 = __pyx_kp_u_; } - __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_14; - __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_18, __pyx_t_14); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_19 = __Pyx_PyUnicode_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) : __pyx_t_13; + __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_19); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_19); + __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_18, __pyx_t_13); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_14 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_19) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_19); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "ktlib.pyx":836 + /* "src/ktlib.pyx":886 * for k, v in existed_templates.items(): - * print(f'{k} {color_green(b"(default)") if v["default"] else ""}') + * log(f'{k} {color_green("(default)") if v["default"] else ""}') * if v["default"]: # <<<<<<<<<<<<<< * default_key = k * res = input() */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_v, __pyx_n_u_default); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_12) { + __pyx_t_14 = __Pyx_PyObject_Dict_GetItem(__pyx_v_v, __pyx_n_u_default); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (__pyx_t_11) { - /* "ktlib.pyx":837 - * print(f'{k} {color_green(b"(default)") if v["default"] else ""}') + /* "src/ktlib.pyx":887 + * log(f'{k} {color_green("(default)") if v["default"] else ""}') * if v["default"]: * default_key = k # <<<<<<<<<<<<<< * res = input() * */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_k); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L1_error) - __pyx_v_default_key = __pyx_t_2; + if (!(likely(PyUnicode_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_k)->tp_name), 0))) __PYX_ERR(0, 887, __pyx_L1_error) + __pyx_t_14 = __pyx_v_k; + __Pyx_INCREF(__pyx_t_14); + __Pyx_DECREF_SET(__pyx_v_default_key, ((PyObject*)__pyx_t_14)); + __pyx_t_14 = 0; - /* "ktlib.pyx":836 + /* "src/ktlib.pyx":886 * for k, v in existed_templates.items(): - * print(f'{k} {color_green(b"(default)") if v["default"] else ""}') + * log(f'{k} {color_green("(default)") if v["default"] else ""}') * if v["default"]: # <<<<<<<<<<<<<< * default_key = k * res = input() */ } } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":838 + /* "src/ktlib.pyx":888 * if v["default"]: * default_key = k * res = input() # <<<<<<<<<<<<<< * * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' */ - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 838, __pyx_L1_error) - __pyx_v_res = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 888, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 888, __pyx_L1_error) + __pyx_v_res = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":840 + /* "src/ktlib.pyx":890 * res = input() * * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' # <<<<<<<<<<<<<< @@ -16816,218 +17569,227 @@ static PyObject *__pyx_f_5ktlib_6Config_update_default(struct __pyx_obj_5ktlib_C */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_v_res, __pyx_v_existed_templates, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 840, __pyx_L1_error) - if (unlikely(!(__pyx_t_12 != 0))) { - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 890, __pyx_L1_error) + } + __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_v_res, __pyx_v_existed_templates, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 890, __pyx_L1_error) + if (unlikely(!(__pyx_t_11 != 0))) { + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_15 = 0; - __pyx_t_14 = 127; + __pyx_t_13 = 127; __Pyx_INCREF(__pyx_kp_u_Invalid_template_chosen_Template); __pyx_t_15 += 34; __Pyx_GIVEREF(__pyx_kp_u_Invalid_template_chosen_Template); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Invalid_template_chosen_Template); - __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_14; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_5 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_template_chosen_Template); + __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_res); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_13; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14); + __pyx_t_14 = 0; __Pyx_INCREF(__pyx_kp_u_is_not_in_ur_config_file); __pyx_t_15 += 25; __Pyx_GIVEREF(__pyx_kp_u_is_not_in_ur_config_file); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_is_not_in_ur_config_file); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - PyErr_SetObject(PyExc_AssertionError, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 840, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_is_not_in_ur_config_file); + __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_15, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetObject(PyExc_AssertionError, __pyx_t_14); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __PYX_ERR(0, 890, __pyx_L1_error) } } #endif - /* "ktlib.pyx":841 + /* "src/ktlib.pyx":891 * * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' * existed_templates[default_key]["default"] = False # <<<<<<<<<<<<<< * existed_templates[res]["default"] = True * with open(self.kt_config, 'w') as kt_config: */ - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_default_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_existed_templates, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_u_default, Py_False) < 0)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 891, __pyx_L1_error) + } + __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_existed_templates, __pyx_v_default_key); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_n_u_default, Py_False) < 0)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "ktlib.pyx":842 + /* "src/ktlib.pyx":892 * assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' * existed_templates[default_key]["default"] = False * existed_templates[res]["default"] = True # <<<<<<<<<<<<<< * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) */ - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_existed_templates, __pyx_v_res); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_u_default, Py_True) < 0)) __PYX_ERR(0, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_v_existed_templates == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 892, __pyx_L1_error) + } + __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_existed_templates, __pyx_v_res); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_n_u_default, Py_True) < 0)) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "ktlib.pyx":843 + /* "src/ktlib.pyx":893 * existed_templates[default_key]["default"] = False * existed_templates[res]["default"] = True * with open(self.kt_config, 'w') as kt_config: # <<<<<<<<<<<<<< * json.dump(existed_templates, kt_config, indent=2) - * print(color_green(b'Yosh, your configuration has been saved')) + * log(color_green('Yosh, your configuration has been saved')) */ /*with:*/ { - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->__pyx_base.kt_config); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_v_self->__pyx_base.kt_config); + __Pyx_GIVEREF(__pyx_v_self->__pyx_base.kt_config); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_self->__pyx_base.kt_config); __Pyx_INCREF(__pyx_n_u_w); __Pyx_GIVEREF(__pyx_n_u_w); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_u_w); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_u_w); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L20_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 843, __pyx_L20_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L20_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_14 = (__pyx_t_19) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_19) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 893, __pyx_L20_error) + __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_14; + __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_9); + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { - __pyx_v_kt_config = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_kt_config = __pyx_t_3; + __pyx_t_3 = 0; - /* "ktlib.pyx":844 + /* "src/ktlib.pyx":894 * existed_templates[res]["default"] = True * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) # <<<<<<<<<<<<<< - * print(color_green(b'Yosh, your configuration has been saved')) + * log(color_green('Yosh, your configuration has been saved')) * */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_json); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_dump); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L24_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dump); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L24_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_existed_templates); __Pyx_GIVEREF(__pyx_v_existed_templates); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_existed_templates); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_existed_templates); __Pyx_INCREF(__pyx_v_kt_config); __Pyx_GIVEREF(__pyx_v_kt_config); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_kt_config); - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 844, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_indent, __pyx_int_2) < 0) __PYX_ERR(0, 844, __pyx_L24_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_kt_config); + __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 894, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_indent, __pyx_int_2) < 0) __PYX_ERR(0, 894, __pyx_L24_error) + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 894, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - /* "ktlib.pyx":843 + /* "src/ktlib.pyx":893 * existed_templates[default_key]["default"] = False * existed_templates[res]["default"] = True * with open(self.kt_config, 'w') as kt_config: # <<<<<<<<<<<<<< * json.dump(existed_templates, kt_config, indent=2) - * print(color_green(b'Yosh, your configuration has been saved')) + * log(color_green('Yosh, your configuration has been saved')) */ } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L29_try_end; __pyx_L24_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /*except:*/ { - __Pyx_AddTraceback("ktlib.Config.update_default", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 843, __pyx_L26_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L26_except_error) + __Pyx_AddTraceback("src.ktlib.Config.update_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_14, &__pyx_t_3) < 0) __PYX_ERR(0, 893, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_GOTREF(__pyx_t_14); __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 843, __pyx_L26_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_12 < 0) __PYX_ERR(0, 843, __pyx_L26_except_error) - __pyx_t_11 = ((!(__pyx_t_12 != 0)) != 0); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_5, __pyx_t_6); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - __PYX_ERR(0, 843, __pyx_L26_except_error) + __pyx_t_1 = PyTuple_Pack(3, __pyx_t_19, __pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 893, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 893, __pyx_L26_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_11 < 0) __PYX_ERR(0, 893, __pyx_L26_except_error) + __pyx_t_10 = ((!(__pyx_t_11 != 0)) != 0); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_19); + __Pyx_GIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ErrRestoreWithState(__pyx_t_19, __pyx_t_14, __pyx_t_3); + __pyx_t_19 = 0; __pyx_t_14 = 0; __pyx_t_3 = 0; + __PYX_ERR(0, 893, __pyx_L26_except_error) } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L25_exception_handled; } __pyx_L26_except_error:; - __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6); goto __pyx_L1_error; __pyx_L25_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6); __pyx_L29_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_4) { - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 843, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_2) { + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } goto __pyx_L23; } @@ -17035,126 +17797,136 @@ static PyObject *__pyx_f_5ktlib_6Config_update_default(struct __pyx_obj_5ktlib_C } goto __pyx_L33; __pyx_L20_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L1_error; __pyx_L33:; } - /* "ktlib.pyx":845 + /* "src/ktlib.pyx":895 * with open(self.kt_config, 'w') as kt_config: * json.dump(existed_templates, kt_config, indent=2) - * print(color_green(b'Yosh, your configuration has been saved')) # <<<<<<<<<<<<<< + * log(color_green('Yosh, your configuration has been saved')) # <<<<<<<<<<<<<< * - * cdef _act(self): + * cdef void _act(self): */ - __pyx_t_6 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_Yosh_your_configuration_has_been, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_log); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_19 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_Yosh_your_configuration_has_been, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_14, function); + } + } + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_t_19) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_19); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":824 + /* "src/ktlib.pyx":874 * json.dump(existed_templates, kt_config, indent=2) * - * cdef update_default(self): # <<<<<<<<<<<<<< + * cdef void update_default(self) except *: # <<<<<<<<<<<<<< * cdef: - * object existed_templates = {} + * dict existed_templates = {} */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("ktlib.Config.update_default", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_AddTraceback("src.ktlib.Config.update_default", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_existed_templates); __Pyx_XDECREF(__pyx_v_res); + __Pyx_XDECREF(__pyx_v_default_key); __Pyx_XDECREF(__pyx_v_f); __Pyx_XDECREF(__pyx_v_k); __Pyx_XDECREF(__pyx_v_v); __Pyx_XDECREF(__pyx_v_kt_config); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "ktlib.pyx":847 - * print(color_green(b'Yosh, your configuration has been saved')) +/* "src/ktlib.pyx":897 + * log(color_green('Yosh, your configuration has been saved')) * - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self): # <<<<<<<<<<<<<< * cdef: - * string question = color_cyan(b'Select an option:\n') + * str question = color_cyan('Select an option:\n') */ -static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__pyx_v_self) { - std::string __pyx_v_question; - std::string __pyx_v_res; +void __pyx_f_3src_5ktlib_6Config__act(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self) { + PyObject *__pyx_v_question = 0; + PyObject *__pyx_v_res = 0; int __pyx_v_opt; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - std::string __pyx_t_3; - int __pyx_t_4; + int __pyx_t_2; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":849 - * cdef _act(self): + /* "src/ktlib.pyx":899 + * cdef void _act(self): * cdef: - * string question = color_cyan(b'Select an option:\n') # <<<<<<<<<<<<<< - * string res + * str question = color_cyan('Select an option:\n') # <<<<<<<<<<<<<< + * str res * int opt */ - __pyx_v_question = __pyx_f_5ktlib_color_cyan(__pyx_k_Select_an_option, 0); + __pyx_t_1 = __pyx_f_3src_5ktlib_color_cyan(__pyx_kp_u_Select_an_option, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_question = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":852 - * string res + /* "src/ktlib.pyx":902 + * str res * int opt - * question.append(b"""1: Add a template # <<<<<<<<<<<<<< + * question.append("""1: Add a template # <<<<<<<<<<<<<< * 2: Remove a template * 3: Select a default template */ - (void)(__pyx_v_question.append(((char const *)"1: Add a template\n2: Remove a template\n3: Select a default template\n"))); + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyUnicode_Type_append, __pyx_v_question, __pyx_kp_u_1_Add_a_template_2_Remove_a_temp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":856 + /* "src/ktlib.pyx":906 * 3: Select a default template * """) * res = input(question) # <<<<<<<<<<<<<< * opt = int(res) * if opt == 1: */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_question); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_input, __pyx_v_question); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_input, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_res = __pyx_t_3; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 906, __pyx_L1_error) + __pyx_v_res = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":857 + /* "src/ktlib.pyx":907 * """) * res = input(question) * opt = int(res) # <<<<<<<<<<<<<< * if opt == 1: * self.add_template() */ - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_opt = __pyx_t_4; + __pyx_v_opt = __pyx_t_2; - /* "ktlib.pyx":858 + /* "src/ktlib.pyx":908 * res = input(question) * opt = int(res) * if opt == 1: # <<<<<<<<<<<<<< @@ -17164,18 +17936,18 @@ static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__p switch (__pyx_v_opt) { case 1: - /* "ktlib.pyx":859 + /* "src/ktlib.pyx":909 * opt = int(res) * if opt == 1: * self.add_template() # <<<<<<<<<<<<<< * elif opt == 2: * self.remove_template() */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Config *)__pyx_v_self->__pyx_base.__pyx_vtab)->add_template(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Config *)__pyx_v_self->__pyx_base.__pyx_vtab)->add_template(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":858 + /* "src/ktlib.pyx":908 * res = input(question) * opt = int(res) * if opt == 1: # <<<<<<<<<<<<<< @@ -17185,18 +17957,18 @@ static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__p break; case 2: - /* "ktlib.pyx":861 + /* "src/ktlib.pyx":911 * self.add_template() * elif opt == 2: * self.remove_template() # <<<<<<<<<<<<<< * elif opt == 3: * self.update_default() */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Config *)__pyx_v_self->__pyx_base.__pyx_vtab)->remove_template(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_3src_5ktlib_Config *)__pyx_v_self->__pyx_base.__pyx_vtab)->remove_template(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":860 + /* "src/ktlib.pyx":910 * if opt == 1: * self.add_template() * elif opt == 2: # <<<<<<<<<<<<<< @@ -17206,18 +17978,16 @@ static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__p break; case 3: - /* "ktlib.pyx":863 + /* "src/ktlib.pyx":913 * self.remove_template() * elif opt == 3: * self.update_default() # <<<<<<<<<<<<<< * else: * raise ValueError('Invalid option') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Config *)__pyx_v_self->__pyx_base.__pyx_vtab)->update_default(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_vtabstruct_3src_5ktlib_Config *)__pyx_v_self->__pyx_base.__pyx_vtab)->update_default(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 913, __pyx_L1_error) - /* "ktlib.pyx":862 + /* "src/ktlib.pyx":912 * elif opt == 2: * self.remove_template() * elif opt == 3: # <<<<<<<<<<<<<< @@ -17227,41 +17997,42 @@ static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__p break; default: - /* "ktlib.pyx":865 + /* "src/ktlib.pyx":915 * self.update_default() * else: * raise ValueError('Invalid option') # <<<<<<<<<<<<<< * * cdef class Open(Action): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 865, __pyx_L1_error) + __PYX_ERR(0, 915, __pyx_L1_error) break; } - /* "ktlib.pyx":847 - * print(color_green(b'Yosh, your configuration has been saved')) + /* "src/ktlib.pyx":897 + * log(color_green('Yosh, your configuration has been saved')) * - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self): # <<<<<<<<<<<<<< * cdef: - * string question = color_cyan(b'Select an option:\n') + * str question = color_cyan('Select an option:\n') */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("ktlib.Config._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_WriteUnraisable("src.ktlib.Config._act", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_question); + __Pyx_XDECREF(__pyx_v_res); __Pyx_RefNannyFinishContext(); - return __pyx_r; +} + +void __pyx_f_3src_5ktlib_6Config__act__pyx_wrap_1(struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self) { + __pyx_f_3src_5ktlib_6Config__act(__pyx_v_self); } /* "(tree fragment)":1 @@ -17271,19 +18042,19 @@ static PyObject *__pyx_f_5ktlib_6Config__act(struct __pyx_obj_5ktlib_Config *__p */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Config_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Config_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_6Config_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Config_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Config___reduce_cython__(((struct __pyx_obj_5ktlib_Config *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_6Config___reduce_cython__(((struct __pyx_obj_3src_5ktlib_Config *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Config *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17295,7 +18066,7 @@ static PyObject *__pyx_pf_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17310,7 +18081,7 @@ static PyObject *__pyx_pf_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Config.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Config.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -17325,19 +18096,19 @@ static PyObject *__pyx_pf_5ktlib_6Config___reduce_cython__(CYTHON_UNUSED struct */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Config_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Config_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_6Config_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Config_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Config_2__setstate_cython__(((struct __pyx_obj_5ktlib_Config *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_6Config_2__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Config *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Config_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Config *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_6Config_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Config *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17348,7 +18119,7 @@ static PyObject *__pyx_pf_5ktlib_6Config_2__setstate_cython__(CYTHON_UNUSED stru * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17364,23 +18135,22 @@ static PyObject *__pyx_pf_5ktlib_6Config_2__setstate_cython__(CYTHON_UNUSED stru /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Config.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Config.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":868 +/* "src/ktlib.pyx":918 * * cdef class Open(Action): - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * webbrowser.open(self.get_problem_url()) * */ -static PyObject *__pyx_f_5ktlib_4Open__act(struct __pyx_obj_5ktlib_Open *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_f_3src_5ktlib_4Open__act(struct __pyx_obj_3src_5ktlib_Open *__pyx_v_self) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -17388,19 +18158,19 @@ static PyObject *__pyx_f_5ktlib_4Open__act(struct __pyx_obj_5ktlib_Open *__pyx_v PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":869 + /* "src/ktlib.pyx":919 * cdef class Open(Action): - * cdef _act(self): + * cdef void _act(self) except *: * webbrowser.open(self.get_problem_url()) # <<<<<<<<<<<<<< * * cdef class Version(Action): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_webbrowser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 869, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_webbrowser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_open); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 869, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_open); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_5ktlib_Open *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_url(((struct __pyx_obj_5ktlib_Action *)__pyx_v_self))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 869, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_3src_5ktlib_Open *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_problem_url(((struct __pyx_obj_3src_5ktlib_Action *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -17415,33 +18185,29 @@ static PyObject *__pyx_f_5ktlib_4Open__act(struct __pyx_obj_5ktlib_Open *__pyx_v __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 869, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":868 + /* "src/ktlib.pyx":918 * * cdef class Open(Action): - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * webbrowser.open(self.get_problem_url()) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("ktlib.Open._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("src.ktlib.Open._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "(tree fragment)":1 @@ -17451,19 +18217,19 @@ static PyObject *__pyx_f_5ktlib_4Open__act(struct __pyx_obj_5ktlib_Open *__pyx_v */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_4Open_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_4Open_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_4Open_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_4Open_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_4Open___reduce_cython__(((struct __pyx_obj_5ktlib_Open *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_4Open___reduce_cython__(((struct __pyx_obj_3src_5ktlib_Open *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Open *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Open *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17475,7 +18241,7 @@ static PyObject *__pyx_pf_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __ * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17490,7 +18256,7 @@ static PyObject *__pyx_pf_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Open.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Open.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -17505,19 +18271,19 @@ static PyObject *__pyx_pf_5ktlib_4Open___reduce_cython__(CYTHON_UNUSED struct __ */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_4Open_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_4Open_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_4Open_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_4Open_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_4Open_2__setstate_cython__(((struct __pyx_obj_5ktlib_Open *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_4Open_2__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Open *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_4Open_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_4Open_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17528,7 +18294,7 @@ static PyObject *__pyx_pf_5ktlib_4Open_2__setstate_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17544,65 +18310,86 @@ static PyObject *__pyx_pf_5ktlib_4Open_2__setstate_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Open.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Open.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":872 +/* "src/ktlib.pyx":922 * * cdef class Version(Action): - * cdef _act(self): # <<<<<<<<<<<<<< - * print(f'Current version: {color_cyan(_VERSION)}') + * cdef void _act(self) except *: # <<<<<<<<<<<<<< + * log(f'Current version: {color_cyan(version)}') * */ -static PyObject *__pyx_f_5ktlib_7Version__act(CYTHON_UNUSED struct __pyx_obj_5ktlib_Version *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_f_3src_5ktlib_7Version__act(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Version *__pyx_v_self) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":873 + /* "src/ktlib.pyx":923 * cdef class Version(Action): - * cdef _act(self): - * print(f'Current version: {color_cyan(_VERSION)}') # <<<<<<<<<<<<<< + * cdef void _act(self) except *: + * log(f'Current version: {color_cyan(version)}') # <<<<<<<<<<<<<< * * cdef class Update(Action): */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_v_5ktlib__VERSION, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Current_version, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 923, __pyx_L1_error) + __pyx_t_4 = __pyx_f_3src_5ktlib_color_cyan(((PyObject*)__pyx_t_3), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Current_version, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":872 + /* "src/ktlib.pyx":922 * * cdef class Version(Action): - * cdef _act(self): # <<<<<<<<<<<<<< - * print(f'Current version: {color_cyan(_VERSION)}') + * cdef void _act(self) except *: # <<<<<<<<<<<<<< + * log(f'Current version: {color_cyan(version)}') * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("ktlib.Version._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("src.ktlib.Version._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "(tree fragment)":1 @@ -17612,19 +18399,19 @@ static PyObject *__pyx_f_5ktlib_7Version__act(CYTHON_UNUSED struct __pyx_obj_5kt */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_7Version_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_7Version_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_7Version_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_7Version_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_7Version___reduce_cython__(((struct __pyx_obj_5ktlib_Version *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_7Version___reduce_cython__(((struct __pyx_obj_3src_5ktlib_Version *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Version *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Version *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17636,7 +18423,7 @@ static PyObject *__pyx_pf_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17651,7 +18438,7 @@ static PyObject *__pyx_pf_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Version.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Version.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -17666,19 +18453,19 @@ static PyObject *__pyx_pf_5ktlib_7Version___reduce_cython__(CYTHON_UNUSED struct */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_7Version_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_7Version_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_7Version_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_7Version_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_7Version_2__setstate_cython__(((struct __pyx_obj_5ktlib_Version *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_7Version_2__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Version *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_7Version_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Version *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_7Version_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Version *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17689,7 +18476,7 @@ static PyObject *__pyx_pf_5ktlib_7Version_2__setstate_cython__(CYTHON_UNUSED str * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17705,79 +18492,74 @@ static PyObject *__pyx_pf_5ktlib_7Version_2__setstate_cython__(CYTHON_UNUSED str /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Version.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Version.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":876 +/* "src/ktlib.pyx":926 * * cdef class Update(Action): - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * cdef: * object pypi_info */ -static PyObject *__pyx_f_5ktlib_6Update__act(CYTHON_UNUSED struct __pyx_obj_5ktlib_Update *__pyx_v_self) { +static void __pyx_f_3src_5ktlib_6Update__act(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Update *__pyx_v_self) { PyObject *__pyx_v_pypi_info = 0; - std::vector __pyx_v_releases; - std::string __pyx_v_current_latest_version; - PyObject *__pyx_r = NULL; + PyObject *__pyx_v_releases = 0; + PyObject *__pyx_v_current_latest_version = 0; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::vector __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_UCS4 __pyx_t_9; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_UCS4 __pyx_t_8; __Pyx_RefNannySetupContext("_act", 0); - /* "ktlib.pyx":882 - * string current_latest_version + /* "src/ktlib.pyx":932 + * str current_latest_version * * pypi_info = requests.get(_PYPI_PACKAGE_INFO) # <<<<<<<<<<<<<< * releases = list(pypi_info.json()['releases']) * if len(releases) == 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_requests); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_requests); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_FromString(__pyx_v_5ktlib__PYPI_PACKAGE_INFO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; + __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_u_https_pypi_org_pypi_kttool_json) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_https_pypi_org_pypi_kttool_json); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pypi_info = __pyx_t_1; __pyx_t_1 = 0; - /* "ktlib.pyx":883 + /* "src/ktlib.pyx":933 * * pypi_info = requests.get(_PYPI_PACKAGE_INFO) * releases = list(pypi_info.json()['releases']) # <<<<<<<<<<<<<< * if len(releases) == 0: - * print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) + * log(color_red('Hmm seems like there is currently no pypi releases :-?')) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pypi_info, __pyx_n_s_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pypi_info, __pyx_n_s_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -17791,254 +18573,304 @@ static PyObject *__pyx_f_5ktlib_6Update__act(CYTHON_UNUSED struct __pyx_obj_5ktl } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_releases); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_releases); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_releases = __pyx_t_5; + __pyx_v_releases = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":884 + /* "src/ktlib.pyx":934 * pypi_info = requests.get(_PYPI_PACKAGE_INFO) * releases = list(pypi_info.json()['releases']) * if len(releases) == 0: # <<<<<<<<<<<<<< - * print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) + * log(color_red('Hmm seems like there is currently no pypi releases :-?')) * return */ - __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_releases); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = ((__pyx_t_6 == 0) != 0); - if (__pyx_t_7) { + __pyx_t_4 = PyList_GET_SIZE(__pyx_v_releases); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 934, __pyx_L1_error) + __pyx_t_5 = ((__pyx_t_4 == 0) != 0); + if (__pyx_t_5) { - /* "ktlib.pyx":885 + /* "src/ktlib.pyx":935 * releases = list(pypi_info.json()['releases']) * if len(releases) == 0: - * print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) # <<<<<<<<<<<<<< + * log(color_red('Hmm seems like there is currently no pypi releases :-?')) # <<<<<<<<<<<<<< * return * current_latest_version = releases.back() */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_k_Hmm_seems_like_there_is_currentl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_3src_5ktlib_color_red(__pyx_kp_u_Hmm_seems_like_there_is_currentl, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":886 + /* "src/ktlib.pyx":936 * if len(releases) == 0: - * print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) + * log(color_red('Hmm seems like there is currently no pypi releases :-?')) * return # <<<<<<<<<<<<<< * current_latest_version = releases.back() - * if current_latest_version != _VERSION: + * if current_latest_version != VERSION: */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "ktlib.pyx":884 + /* "src/ktlib.pyx":934 * pypi_info = requests.get(_PYPI_PACKAGE_INFO) * releases = list(pypi_info.json()['releases']) * if len(releases) == 0: # <<<<<<<<<<<<<< - * print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) + * log(color_red('Hmm seems like there is currently no pypi releases :-?')) * return */ } - /* "ktlib.pyx":887 - * print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) + /* "src/ktlib.pyx":937 + * log(color_red('Hmm seems like there is currently no pypi releases :-?')) * return * current_latest_version = releases.back() # <<<<<<<<<<<<<< - * if current_latest_version != _VERSION: + * if current_latest_version != VERSION: * subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--no-cache-dir", f"kttool=={current_latest_version}"]) */ - __pyx_v_current_latest_version = __pyx_v_releases.back(); + __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_back, __pyx_v_releases); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 937, __pyx_L1_error) + __pyx_v_current_latest_version = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "ktlib.pyx":888 + /* "src/ktlib.pyx":938 * return * current_latest_version = releases.back() - * if current_latest_version != _VERSION: # <<<<<<<<<<<<<< + * if current_latest_version != VERSION: # <<<<<<<<<<<<<< * subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--no-cache-dir", f"kttool=={current_latest_version}"]) - * print(f'Installed version {color_green(current_latest_version)} successfully!') + * log(f'Installed version {color_green(current_latest_version)} successfully!') */ - __pyx_t_7 = ((__pyx_v_current_latest_version != __pyx_v_5ktlib__VERSION) != 0); - if (__pyx_t_7) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_current_latest_version, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 938, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { - /* "ktlib.pyx":889 + /* "src/ktlib.pyx":939 * current_latest_version = releases.back() - * if current_latest_version != _VERSION: + * if current_latest_version != VERSION: * subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--no-cache-dir", f"kttool=={current_latest_version}"]) # <<<<<<<<<<<<<< - * print(f'Installed version {color_green(current_latest_version)} successfully!') + * log(f'Installed version {color_green(current_latest_version)} successfully!') * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_check_call); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_check_call); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_executable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_current_latest_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_kp_u_kttool, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_executable); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_current_latest_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_kttool, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_INCREF(__pyx_kp_u_m); __Pyx_GIVEREF(__pyx_kp_u_m); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_m); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_m); __Pyx_INCREF(__pyx_n_u_pip); __Pyx_GIVEREF(__pyx_n_u_pip); - PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_pip); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_u_pip); __Pyx_INCREF(__pyx_n_u_install); __Pyx_GIVEREF(__pyx_n_u_install); - PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_install); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_u_install); __Pyx_INCREF(__pyx_kp_u_upgrade); __Pyx_GIVEREF(__pyx_kp_u_upgrade); - PyList_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_upgrade); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_upgrade); __Pyx_INCREF(__pyx_kp_u_no_cache_dir); __Pyx_GIVEREF(__pyx_kp_u_no_cache_dir); - PyList_SET_ITEM(__pyx_t_1, 5, __pyx_kp_u_no_cache_dir); - __Pyx_GIVEREF(__pyx_t_8); - PyList_SET_ITEM(__pyx_t_1, 6, __pyx_t_8); - __pyx_t_4 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; + PyList_SET_ITEM(__pyx_t_3, 5, __pyx_kp_u_no_cache_dir); + __Pyx_GIVEREF(__pyx_t_7); + PyList_SET_ITEM(__pyx_t_3, 6, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_8)) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":890 - * if current_latest_version != _VERSION: + /* "src/ktlib.pyx":940 + * if current_latest_version != VERSION: * subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--no-cache-dir", f"kttool=={current_latest_version}"]) - * print(f'Installed version {color_green(current_latest_version)} successfully!') # <<<<<<<<<<<<<< + * log(f'Installed version {color_green(current_latest_version)} successfully!') # <<<<<<<<<<<<<< * else: - * print(f'You already have the {color_green(b"latest")} version!') + * log(f'You already have the {color_green("latest")} version!') */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 940, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = 0; - __pyx_t_9 = 127; + __pyx_t_4 = 0; + __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_Installed_version); - __pyx_t_6 += 18; + __pyx_t_4 += 18; __Pyx_GIVEREF(__pyx_kp_u_Installed_version); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Installed_version); - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_v_current_latest_version, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_9; - __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_7 = __pyx_f_3src_5ktlib_color_green(__pyx_v_current_latest_version, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 940, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 940, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_8; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6); + __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u_successfully); - __pyx_t_6 += 14; + __pyx_t_4 += 14; __Pyx_GIVEREF(__pyx_kp_u_successfully); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_successfully); - __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 940, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":888 + /* "src/ktlib.pyx":938 * return * current_latest_version = releases.back() - * if current_latest_version != _VERSION: # <<<<<<<<<<<<<< + * if current_latest_version != VERSION: # <<<<<<<<<<<<<< * subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--no-cache-dir", f"kttool=={current_latest_version}"]) - * print(f'Installed version {color_green(current_latest_version)} successfully!') + * log(f'Installed version {color_green(current_latest_version)} successfully!') */ goto __pyx_L4; } - /* "ktlib.pyx":892 - * print(f'Installed version {color_green(current_latest_version)} successfully!') + /* "src/ktlib.pyx":942 + * log(f'Installed version {color_green(current_latest_version)} successfully!') * else: - * print(f'You already have the {color_green(b"latest")} version!') # <<<<<<<<<<<<<< + * log(f'You already have the {color_green("latest")} version!') # <<<<<<<<<<<<<< * * */ /*else*/ { - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = 0; - __pyx_t_9 = 127; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = 0; + __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_You_already_have_the); - __pyx_t_6 += 21; + __pyx_t_4 += 21; __Pyx_GIVEREF(__pyx_kp_u_You_already_have_the); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_You_already_have_the); - __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_latest, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_9; - __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_kp_u_version); - __pyx_t_6 += 9; - __Pyx_GIVEREF(__pyx_kp_u_version); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_version); - __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_You_already_have_the); + __pyx_t_3 = __pyx_f_3src_5ktlib_color_green(__pyx_n_u_latest, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_8; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u_version_2); + __pyx_t_4 += 9; + __Pyx_GIVEREF(__pyx_kp_u_version_2); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_version_2); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L4:; - /* "ktlib.pyx":876 + /* "src/ktlib.pyx":926 * * cdef class Update(Action): - * cdef _act(self): # <<<<<<<<<<<<<< + * cdef void _act(self) except *: # <<<<<<<<<<<<<< * cdef: * object pypi_info */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("ktlib.Update._act", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("src.ktlib.Update._act", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_pypi_info); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_releases); + __Pyx_XDECREF(__pyx_v_current_latest_version); __Pyx_RefNannyFinishContext(); - return __pyx_r; } /* "(tree fragment)":1 @@ -18048,19 +18880,19 @@ static PyObject *__pyx_f_5ktlib_6Update__act(CYTHON_UNUSED struct __pyx_obj_5ktl */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Update_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Update_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3src_5ktlib_6Update_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Update_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Update___reduce_cython__(((struct __pyx_obj_5ktlib_Update *)__pyx_v_self)); + __pyx_r = __pyx_pf_3src_5ktlib_6Update___reduce_cython__(((struct __pyx_obj_3src_5ktlib_Update *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Update *__pyx_v_self) { +static PyObject *__pyx_pf_3src_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Update *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -18072,7 +18904,7 @@ static PyObject *__pyx_pf_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18087,7 +18919,7 @@ static PyObject *__pyx_pf_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Update.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Update.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -18102,19 +18934,19 @@ static PyObject *__pyx_pf_5ktlib_6Update___reduce_cython__(CYTHON_UNUSED struct */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_6Update_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5ktlib_6Update_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_3src_5ktlib_6Update_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_6Update_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5ktlib_6Update_2__setstate_cython__(((struct __pyx_obj_5ktlib_Update *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_3src_5ktlib_6Update_2__setstate_cython__(((struct __pyx_obj_3src_5ktlib_Update *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5ktlib_Update *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3src_5ktlib_Update *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -18125,7 +18957,7 @@ static PyObject *__pyx_pf_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED stru * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18141,14 +18973,14 @@ static PyObject *__pyx_pf_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED stru /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.Update.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.Update.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "ktlib.pyx":905 +/* "src/ktlib.pyx":955 * } * * cpdef Action arg_parse(list args): # <<<<<<<<<<<<<< @@ -18156,9 +18988,9 @@ static PyObject *__pyx_pf_5ktlib_6Update_2__setstate_cython__(CYTHON_UNUSED stru * if len(args) == 0: */ -static PyObject *__pyx_pw_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ -static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_v_args, CYTHON_UNUSED int __pyx_skip_dispatch) { - struct __pyx_obj_5ktlib_Action *__pyx_r = NULL; +static PyObject *__pyx_pw_3src_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ +static struct __pyx_obj_3src_5ktlib_Action *__pyx_f_3src_5ktlib_arg_parse(PyObject *__pyx_v_args, CYTHON_UNUSED int __pyx_skip_dispatch) { + struct __pyx_obj_3src_5ktlib_Action *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; @@ -18168,7 +19000,7 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("arg_parse", 0); - /* "ktlib.pyx":907 + /* "src/ktlib.pyx":957 * cpdef Action arg_parse(list args): * ''' Generate an appropriate command class based on user command stirng ''' * if len(args) == 0: # <<<<<<<<<<<<<< @@ -18177,26 +19009,26 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ */ if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 907, __pyx_L1_error) + __PYX_ERR(0, 957, __pyx_L1_error) } - __pyx_t_1 = PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 907, __pyx_L1_error) + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 957, __pyx_L1_error) __pyx_t_2 = ((__pyx_t_1 == 0) != 0); if (unlikely(__pyx_t_2)) { - /* "ktlib.pyx":908 + /* "src/ktlib.pyx":958 * ''' Generate an appropriate command class based on user command stirng ''' * if len(args) == 0: * raise ValueError(f'No command provided to kt') # <<<<<<<<<<<<<< * if args[0] not in map_key_to_class: * raise ValueError(f'First argument should be one of {list(map_key_to_class.keys())}') */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 908, __pyx_L1_error) + __PYX_ERR(0, 958, __pyx_L1_error) - /* "ktlib.pyx":907 + /* "src/ktlib.pyx":957 * cpdef Action arg_parse(list args): * ''' Generate an appropriate command class based on user command stirng ''' * if len(args) == 0: # <<<<<<<<<<<<<< @@ -18205,7 +19037,7 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ */ } - /* "ktlib.pyx":909 + /* "src/ktlib.pyx":959 * if len(args) == 0: * raise ValueError(f'No command provided to kt') * if args[0] not in map_key_to_class: # <<<<<<<<<<<<<< @@ -18214,53 +19046,46 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ */ if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 909, __pyx_L1_error) + __PYX_ERR(0, 959, __pyx_L1_error) + } + if (unlikely(__pyx_v_3src_5ktlib_map_key_to_class == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 959, __pyx_L1_error) } - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(PyList_GET_ITEM(__pyx_v_args, 0), __pyx_v_5ktlib_map_key_to_class, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 909, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(PyList_GET_ITEM(__pyx_v_args, 0), __pyx_v_3src_5ktlib_map_key_to_class, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 959, __pyx_L1_error) __pyx_t_4 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_4)) { - /* "ktlib.pyx":910 + /* "src/ktlib.pyx":960 * raise ValueError(f'No command provided to kt') * if args[0] not in map_key_to_class: * raise ValueError(f'First argument should be one of {list(map_key_to_class.keys())}') # <<<<<<<<<<<<<< * return map_key_to_class[args[0]](*args[1:]) * */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_5ktlib_map_key_to_class, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } + if (unlikely(__pyx_v_3src_5ktlib_map_key_to_class == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys"); + __PYX_ERR(0, 960, __pyx_L1_error) } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 910, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_Keys(__pyx_v_3src_5ktlib_map_key_to_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 910, __pyx_L1_error) + __pyx_t_5 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 910, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_First_argument_should_be_one_of, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 910, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_First_argument_should_be_one_of, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 910, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 910, __pyx_L1_error) + __PYX_ERR(0, 960, __pyx_L1_error) - /* "ktlib.pyx":909 + /* "src/ktlib.pyx":959 * if len(args) == 0: * raise ValueError(f'No command provided to kt') * if args[0] not in map_key_to_class: # <<<<<<<<<<<<<< @@ -18269,7 +19094,7 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ */ } - /* "ktlib.pyx":911 + /* "src/ktlib.pyx":961 * if args[0] not in map_key_to_class: * raise ValueError(f'First argument should be one of {list(map_key_to_class.keys())}') * return map_key_to_class[args[0]](*args[1:]) # <<<<<<<<<<<<<< @@ -18277,31 +19102,35 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ * */ __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(__pyx_v_3src_5ktlib_map_key_to_class == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 961, __pyx_L1_error) + } if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 911, __pyx_L1_error) + __PYX_ERR(0, 961, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_5ktlib_map_key_to_class, PyList_GET_ITEM(__pyx_v_args, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 911, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_3src_5ktlib_map_key_to_class, PyList_GET_ITEM(__pyx_v_args, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 911, __pyx_L1_error) + __PYX_ERR(0, 961, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyList_GetSlice(__pyx_v_args, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 911, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyList_GetSlice(__pyx_v_args, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 911, __pyx_L1_error) + __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 911, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5ktlib_Action))))) __PYX_ERR(0, 911, __pyx_L1_error) - __pyx_r = ((struct __pyx_obj_5ktlib_Action *)__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_3src_5ktlib_Action))))) __PYX_ERR(0, 961, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_3src_5ktlib_Action *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; - /* "ktlib.pyx":905 + /* "src/ktlib.pyx":955 * } * * cpdef Action arg_parse(list args): # <<<<<<<<<<<<<< @@ -18314,7 +19143,7 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("ktlib.arg_parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.arg_parse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -18323,14 +19152,14 @@ static struct __pyx_obj_5ktlib_Action *__pyx_f_5ktlib_arg_parse(PyObject *__pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ -static char __pyx_doc_5ktlib_8arg_parse[] = " Generate an appropriate command class based on user command stirng "; -static PyObject *__pyx_pw_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__pyx_v_args) { +static PyObject *__pyx_pw_3src_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ +static char __pyx_doc_3src_5ktlib_8arg_parse[] = " Generate an appropriate command class based on user command stirng "; +static PyObject *__pyx_pw_3src_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__pyx_v_args) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("arg_parse (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyList_Type), 1, "args", 1))) __PYX_ERR(0, 905, __pyx_L1_error) - __pyx_r = __pyx_pf_5ktlib_8arg_parse(__pyx_self, ((PyObject*)__pyx_v_args)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyList_Type), 1, "args", 1))) __PYX_ERR(0, 955, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_5ktlib_8arg_parse(__pyx_self, ((PyObject*)__pyx_v_args)); /* function exit code */ goto __pyx_L0; @@ -18341,13 +19170,13 @@ static PyObject *__pyx_pw_5ktlib_9arg_parse(PyObject *__pyx_self, PyObject *__py return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args) { +static PyObject *__pyx_pf_3src_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("arg_parse", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_5ktlib_arg_parse(__pyx_v_args, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error) + __pyx_t_1 = ((PyObject *)__pyx_f_3src_5ktlib_arg_parse(__pyx_v_args, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -18356,7 +19185,7 @@ static PyObject *__pyx_pf_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.arg_parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.arg_parse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18364,7 +19193,7 @@ static PyObject *__pyx_pf_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "ktlib.pyx":914 +/* "src/ktlib.pyx":964 * * * cpdef exit_gracefully(signum, frame): # <<<<<<<<<<<<<< @@ -18372,8 +19201,8 @@ static PyObject *__pyx_pf_5ktlib_8arg_parse(CYTHON_UNUSED PyObject *__pyx_self, * # restore the original signal handler as otherwise evil things will happen */ -static PyObject *__pyx_pw_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_signum, CYTHON_UNUSED PyObject *__pyx_v_frame, CYTHON_UNUSED int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_3src_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_3src_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_signum, CYTHON_UNUSED PyObject *__pyx_v_frame, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_v_original_sigint = NULL; PyObject *__pyx_v_sp = NULL; PyObject *__pyx_r = NULL; @@ -18390,21 +19219,21 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ PyObject *__pyx_t_10 = NULL; __Pyx_RefNannySetupContext("exit_gracefully", 0); - /* "ktlib.pyx":915 + /* "src/ktlib.pyx":965 * * cpdef exit_gracefully(signum, frame): * original_sigint = signal.getsignal(signal.SIGINT) # <<<<<<<<<<<<<< * # restore the original signal handler as otherwise evil things will happen * # in raw_input when CTRL+C is pressed, and our signal handler is not re-entrant */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_signal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_signal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getsignal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 915, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getsignal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_signal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_signal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SIGINT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 915, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SIGINT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -18420,27 +19249,27 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_original_sigint = __pyx_t_1; __pyx_t_1 = 0; - /* "ktlib.pyx":918 + /* "src/ktlib.pyx":968 * # restore the original signal handler as otherwise evil things will happen * # in raw_input when CTRL+C is pressed, and our signal handler is not re-entrant * signal.signal(signal.SIGINT, original_sigint) # <<<<<<<<<<<<<< * for sp in test_subprocesses: * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_signal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_signal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_signal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_signal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_signal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_signal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SIGINT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SIGINT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -18458,7 +19287,7 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_v_original_sigint}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -18467,14 +19296,14 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_v_original_sigint}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -18485,37 +19314,37 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ __Pyx_GIVEREF(__pyx_v_original_sigint); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_original_sigint); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":919 + /* "src/ktlib.pyx":969 * # in raw_input when CTRL+C is pressed, and our signal handler is not re-entrant * signal.signal(signal.SIGINT, original_sigint) * for sp in test_subprocesses: # <<<<<<<<<<<<<< * try: * sp.kill() */ - if (unlikely(__pyx_v_5ktlib_test_subprocesses == Py_None)) { + if (unlikely(__pyx_v_3src_5ktlib_test_subprocesses == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 919, __pyx_L1_error) + __PYX_ERR(0, 969, __pyx_L1_error) } - __pyx_t_1 = __pyx_v_5ktlib_test_subprocesses; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; + __pyx_t_1 = __pyx_v_3src_5ktlib_test_subprocesses; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; for (;;) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 919, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 969, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_XDECREF_SET(__pyx_v_sp, __pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":920 + /* "src/ktlib.pyx":970 * signal.signal(signal.SIGINT, original_sigint) * for sp in test_subprocesses: * try: # <<<<<<<<<<<<<< @@ -18531,14 +19360,14 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ __Pyx_XGOTREF(__pyx_t_10); /*try:*/ { - /* "ktlib.pyx":921 + /* "src/ktlib.pyx":971 * for sp in test_subprocesses: * try: * sp.kill() # <<<<<<<<<<<<<< * except: * pass */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sp, __pyx_n_s_kill); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 921, __pyx_L5_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sp, __pyx_n_s_kill); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 971, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -18552,12 +19381,12 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ } __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 921, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 971, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ktlib.pyx":920 + /* "src/ktlib.pyx":970 * signal.signal(signal.SIGINT, original_sigint) * for sp in test_subprocesses: * try: # <<<<<<<<<<<<<< @@ -18575,12 +19404,12 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "ktlib.pyx":922 + /* "src/ktlib.pyx":972 * try: * sp.kill() * except: # <<<<<<<<<<<<<< * pass - * print(color_green(b'Great is the art of beginning, but greater is the art of ending.')) + * log(color_green('Great is the art of beginning, but greater is the art of ending.')) */ /*except:*/ { __Pyx_ErrRestore(0,0,0); @@ -18594,7 +19423,7 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ __pyx_L12_try_end:; } - /* "ktlib.pyx":919 + /* "src/ktlib.pyx":969 * # in raw_input when CTRL+C is pressed, and our signal handler is not re-entrant * signal.signal(signal.SIGINT, original_sigint) * for sp in test_subprocesses: # <<<<<<<<<<<<<< @@ -18604,50 +19433,65 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":924 + /* "src/ktlib.pyx":974 * except: * pass - * print(color_green(b'Great is the art of beginning, but greater is the art of ending.')) # <<<<<<<<<<<<<< + * log(color_green('Great is the art of beginning, but greater is the art of ending.')) # <<<<<<<<<<<<<< * sys.exit(1) * */ - __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_Great_is_the_art_of_beginning_bu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_f_3src_5ktlib_color_green(__pyx_kp_u_Great_is_the_art_of_beginning_bu, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 974, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":925 + /* "src/ktlib.pyx":975 * pass - * print(color_green(b'Great is the art of beginning, but greater is the art of ending.')) + * log(color_green('Great is the art of beginning, but greater is the art of ending.')) * sys.exit(1) # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_1)) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_1); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 925, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_1); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 975, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":914 + /* "src/ktlib.pyx":964 * * * cpdef exit_gracefully(signum, frame): # <<<<<<<<<<<<<< @@ -18664,7 +19508,7 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("ktlib.exit_gracefully", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.exit_gracefully", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_original_sigint); @@ -18675,8 +19519,8 @@ static PyObject *__pyx_f_5ktlib_exit_gracefully(CYTHON_UNUSED PyObject *__pyx_v_ } /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3src_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3src_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_signum = 0; PyObject *__pyx_v_frame = 0; PyObject *__pyx_r = 0; @@ -18705,11 +19549,11 @@ static PyObject *__pyx_pw_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObjec case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("exit_gracefully", 1, 2, 2, 1); __PYX_ERR(0, 914, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("exit_gracefully", 1, 2, 2, 1); __PYX_ERR(0, 964, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "exit_gracefully") < 0)) __PYX_ERR(0, 914, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "exit_gracefully") < 0)) __PYX_ERR(0, 964, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -18722,26 +19566,26 @@ static PyObject *__pyx_pw_5ktlib_11exit_gracefully(PyObject *__pyx_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("exit_gracefully", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 914, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("exit_gracefully", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 964, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("ktlib.exit_gracefully", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.exit_gracefully", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5ktlib_10exit_gracefully(__pyx_self, __pyx_v_signum, __pyx_v_frame); + __pyx_r = __pyx_pf_3src_5ktlib_10exit_gracefully(__pyx_self, __pyx_v_signum, __pyx_v_frame); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_10exit_gracefully(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signum, PyObject *__pyx_v_frame) { +static PyObject *__pyx_pf_3src_5ktlib_10exit_gracefully(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signum, PyObject *__pyx_v_frame) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("exit_gracefully", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5ktlib_exit_gracefully(__pyx_v_signum, __pyx_v_frame, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_5ktlib_exit_gracefully(__pyx_v_signum, __pyx_v_frame, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -18750,7 +19594,7 @@ static PyObject *__pyx_pf_5ktlib_10exit_gracefully(CYTHON_UNUSED PyObject *__pyx /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("ktlib.exit_gracefully", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.exit_gracefully", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18765,9 +19609,9 @@ static PyObject *__pyx_pf_5ktlib_10exit_gracefully(CYTHON_UNUSED PyObject *__pyx */ /* Python wrapper */ -static PyObject *__pyx_pw_5ktlib_13__pyx_unpickle_ConfigError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5ktlib_13__pyx_unpickle_ConfigError = {"__pyx_unpickle_ConfigError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5ktlib_13__pyx_unpickle_ConfigError, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5ktlib_13__pyx_unpickle_ConfigError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3src_5ktlib_13__pyx_unpickle_ConfigError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_3src_5ktlib_13__pyx_unpickle_ConfigError = {"__pyx_unpickle_ConfigError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3src_5ktlib_13__pyx_unpickle_ConfigError, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_3src_5ktlib_13__pyx_unpickle_ConfigError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; @@ -18826,18 +19670,18 @@ static PyObject *__pyx_pw_5ktlib_13__pyx_unpickle_ConfigError(PyObject *__pyx_se __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ConfigError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("ktlib.__pyx_unpickle_ConfigError", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.__pyx_unpickle_ConfigError", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __pyx_r = __pyx_pf_3src_5ktlib_12__pyx_unpickle_ConfigError(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_3src_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_v___pyx_PickleError = 0; PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; @@ -18931,7 +19775,7 @@ static PyObject *__pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyOb * if __pyx_state is not None: * __pyx_unpickle_ConfigError__set_state( __pyx_result, __pyx_state) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5ktlib_ConfigError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_3src_5ktlib_ConfigError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -18970,7 +19814,7 @@ static PyObject *__pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyOb * cdef __pyx_unpickle_ConfigError__set_state(ConfigError __pyx_result, tuple __pyx_state): */ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_3 = __pyx_f_5ktlib___pyx_unpickle_ConfigError__set_state(((struct __pyx_obj_5ktlib_ConfigError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_3 = __pyx_f_3src_5ktlib___pyx_unpickle_ConfigError__set_state(((struct __pyx_obj_3src_5ktlib_ConfigError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -19007,7 +19851,7 @@ static PyObject *__pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyOb __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("ktlib.__pyx_unpickle_ConfigError", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.__pyx_unpickle_ConfigError", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v___pyx_PickleError); @@ -19025,7 +19869,7 @@ static PyObject *__pyx_pf_5ktlib_12__pyx_unpickle_ConfigError(CYTHON_UNUSED PyOb * __pyx_result.__dict__.update(__pyx_state[0]) */ -static PyObject *__pyx_f_5ktlib___pyx_unpickle_ConfigError__set_state(struct __pyx_obj_5ktlib_ConfigError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_f_3src_5ktlib___pyx_unpickle_ConfigError__set_state(struct __pyx_obj_3src_5ktlib_ConfigError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19114,7 +19958,7 @@ static PyObject *__pyx_f_5ktlib___pyx_unpickle_ConfigError__set_state(struct __p __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("ktlib.__pyx_unpickle_ConfigError__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib.__pyx_unpickle_ConfigError__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19122,558 +19966,295 @@ static PyObject *__pyx_f_5ktlib___pyx_unpickle_ConfigError__set_state(struct __p return __pyx_r; } -/* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { - Py_ssize_t __pyx_v_length; - char const *__pyx_v_data; - std::string __pyx_r; - __Pyx_RefNannyDeclarations - char const *__pyx_t_1; - __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); +static PyObject *__pyx_tp_new_3src_5ktlib_ConfigError(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (&((PyTypeObject*)PyExc_Exception)[0])->tp_new(t, a, k); + if (unlikely(!o)) return 0; + return o; +} - /* "string.from_py":14 - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length = 0 # <<<<<<<<<<<<<< - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) - */ - __pyx_v_length = 0; +static void __pyx_tp_dealloc_3src_5ktlib_ConfigError(PyObject *o) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + PyObject_GC_Track(o); + (&((PyTypeObject*)PyExc_Exception)[0])->tp_dealloc(o); +} - /* "string.from_py":15 - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< - * return string(data, length) - * - */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) - __pyx_v_data = __pyx_t_1; +static int __pyx_tp_traverse_3src_5ktlib_ConfigError(PyObject *o, visitproc v, void *a) { + int e; + if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse); else { e = (&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse(o,v,a); if (e) return e; } + return 0; +} - /* "string.from_py":16 - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = std::string(__pyx_v_data, __pyx_v_length); - goto __pyx_L0; +static int __pyx_tp_clear_3src_5ktlib_ConfigError(PyObject *o) { + if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_clear); else (&((PyTypeObject*)PyExc_Exception)[0])->tp_clear(o); + return 0; +} - /* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ +static PyMethodDef __pyx_methods_3src_5ktlib_ConfigError[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_11ConfigError_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_11ConfigError_3__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); - - /* "string.to_py":32 - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ +static PyTypeObject __pyx_type_3src_5ktlib_ConfigError = { + PyVarObject_HEAD_INIT(0, 0) + "src.ktlib.ConfigError", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_ConfigError), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3src_5ktlib_ConfigError, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3src_5ktlib_ConfigError, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_ConfigError, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3src_5ktlib_ConfigError, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3src_5ktlib_ConfigError, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif +}; +static struct __pyx_vtabstruct_3src_5ktlib_Action __pyx_vtable_3src_5ktlib_Action; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; +static PyObject *__pyx_tp_new_3src_5ktlib_Action(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3src_5ktlib_Action *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_3src_5ktlib_Action *)o); + p->__pyx_vtab = __pyx_vtabptr_3src_5ktlib_Action; + p->config_path = Py_None; Py_INCREF(Py_None); + p->cfg = Py_None; Py_INCREF(Py_None); + p->cookies = Py_None; Py_INCREF(Py_None); + p->kt_config = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_3src_5ktlib_6Action_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; } -/* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); - - /* "string.to_py":38 - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ +static void __pyx_tp_dealloc_3src_5ktlib_Action(PyObject *o) { + struct __pyx_obj_3src_5ktlib_Action *p = (struct __pyx_obj_3src_5ktlib_Action *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->config_path); + Py_CLEAR(p->cfg); + Py_CLEAR(p->cookies); + Py_CLEAR(p->kt_config); + (*Py_TYPE(o)->tp_free)(o); +} - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; +static int __pyx_tp_traverse_3src_5ktlib_Action(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3src_5ktlib_Action *p = (struct __pyx_obj_3src_5ktlib_Action *)o; + if (p->config_path) { + e = (*v)(p->config_path, a); if (e) return e; + } + if (p->cfg) { + e = (*v)(p->cfg, a); if (e) return e; + } + if (p->cookies) { + e = (*v)(p->cookies, a); if (e) return e; + } + if (p->kt_config) { + e = (*v)(p->kt_config, a); if (e) return e; + } + return 0; } -/* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ +static int __pyx_tp_clear_3src_5ktlib_Action(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_3src_5ktlib_Action *p = (struct __pyx_obj_3src_5ktlib_Action *)o; + tmp = ((PyObject*)p->config_path); + p->config_path = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cfg); + p->cfg = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cookies); + p->cookies = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->kt_config); + p->kt_config = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); +static PyMethodDef __pyx_methods_3src_5ktlib_Action[] = { + {"act", (PyCFunction)__pyx_pw_3src_5ktlib_6Action_3act, METH_NOARGS, __pyx_doc_3src_5ktlib_6Action_2act}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Action_5__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Action_7__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; - /* "string.to_py":44 - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; +static PyTypeObject __pyx_type_3src_5ktlib_Action = { + PyVarObject_HEAD_INIT(0, 0) + "src.ktlib.Action", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Action), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3src_5ktlib_Action, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3src_5ktlib_Action, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3src_5ktlib_Action, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif +}; - /* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ +static PyObject *__pyx_tp_new_3src_5ktlib_SampleData(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_SampleData *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_3src_5ktlib_SampleData *)o); + p->problem_id = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->sample_id = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->data = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_3src_5ktlib_10SampleData_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; +static void __pyx_tp_dealloc_3src_5ktlib_SampleData(PyObject *o) { + struct __pyx_obj_3src_5ktlib_SampleData *p = (struct __pyx_obj_3src_5ktlib_SampleData *)o; + Py_CLEAR(p->problem_id); + Py_CLEAR(p->sample_id); + Py_CLEAR(p->data); + (*Py_TYPE(o)->tp_free)(o); } -/* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ +static PyMethodDef __pyx_methods_3src_5ktlib_SampleData[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_10SampleData_3__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_10SampleData_5__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); - - /* "string.to_py":50 - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); - - /* "string.to_py":56 - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: - */ - -static std::vector __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; - PyObject *__pyx_v_item = NULL; - std::vector __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v - */ - if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { - __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 47, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); - __pyx_t_4 = 0; - - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v - * - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) - __pyx_v_v.push_back(((std::string)__pyx_t_5)); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_v; - goto __pyx_L0; - - /* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_std_3a__3a_string") - * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] - * - */ - -static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_string", 0); - - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_std_3a__3a_string") - * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_v.size(); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_std_3a__3a_string") - * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_5ktlib_Action __pyx_vtable_5ktlib_Action; - -static PyObject *__pyx_tp_new_5ktlib_Action(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5ktlib_Action *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Action *)o); - p->__pyx_vtab = __pyx_vtabptr_5ktlib_Action; - new((void*)&(p->config_path)) std::string(); - new((void*)&(p->kt_config)) std::string(); - p->cfg = Py_None; Py_INCREF(Py_None); - p->cookies = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5ktlib_6Action_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_5ktlib_Action(PyObject *o) { - struct __pyx_obj_5ktlib_Action *p = (struct __pyx_obj_5ktlib_Action *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - __Pyx_call_destructor(p->config_path); - __Pyx_call_destructor(p->kt_config); - Py_CLEAR(p->cfg); - Py_CLEAR(p->cookies); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5ktlib_Action(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5ktlib_Action *p = (struct __pyx_obj_5ktlib_Action *)o; - if (p->cfg) { - e = (*v)(p->cfg, a); if (e) return e; - } - if (p->cookies) { - e = (*v)(p->cookies, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5ktlib_Action(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5ktlib_Action *p = (struct __pyx_obj_5ktlib_Action *)o; - tmp = ((PyObject*)p->cfg); - p->cfg = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->cookies); - p->cookies = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_5ktlib_Action[] = { - {"act", (PyCFunction)__pyx_pw_5ktlib_6Action_3act, METH_NOARGS, __pyx_doc_5ktlib_6Action_2act}, - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_6Action_5__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_6Action_7__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5ktlib_Action = { +static PyTypeObject __pyx_type_3src_5ktlib_SampleData = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Action", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Action), /*tp_basicsize*/ + "src.ktlib.SampleData", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_SampleData), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Action, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_SampleData, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -19698,15 +20279,15 @@ static PyTypeObject __pyx_type_5ktlib_Action = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - " Base class for handle general command.\n Handle loading up .kattisrc config file\n ", /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Action, /*tp_methods*/ + __pyx_methods_3src_5ktlib_SampleData, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -19716,7 +20297,7 @@ static PyTypeObject __pyx_type_5ktlib_Action = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Action, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_SampleData, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -19736,49 +20317,44 @@ static PyTypeObject __pyx_type_5ktlib_Action = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Gen __pyx_vtable_5ktlib_Gen; +static struct __pyx_vtabstruct_3src_5ktlib_Gen __pyx_vtable_3src_5ktlib_Gen; -static PyObject *__pyx_tp_new_5ktlib_Gen(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Gen *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Gen(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Gen *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Gen *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Gen; - new((void*)&(p->_problem_id)) std::string(); - new((void*)&(p->_url)) std::string(); - if (unlikely(__pyx_pw_5ktlib_3Gen_1__cinit__(o, a, k) < 0)) goto bad; + p = ((struct __pyx_obj_3src_5ktlib_Gen *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Gen; + p->_problem_id = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_url = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_3src_5ktlib_3Gen_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } -static void __pyx_tp_dealloc_5ktlib_Gen(PyObject *o) { - struct __pyx_obj_5ktlib_Gen *p = (struct __pyx_obj_5ktlib_Gen *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif +static void __pyx_tp_dealloc_3src_5ktlib_Gen(PyObject *o) { + struct __pyx_obj_3src_5ktlib_Gen *p = (struct __pyx_obj_3src_5ktlib_Gen *)o; PyObject_GC_UnTrack(o); - __Pyx_call_destructor(p->_problem_id); - __Pyx_call_destructor(p->_url); + Py_CLEAR(p->_problem_id); + Py_CLEAR(p->_url); PyObject_GC_Track(o); - __pyx_tp_dealloc_5ktlib_Action(o); + __pyx_tp_dealloc_3src_5ktlib_Action(o); } -static PyMethodDef __pyx_methods_5ktlib_Gen[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_3Gen_3__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_3Gen_5__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Gen[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_3Gen_3__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_3Gen_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Gen = { +static PyTypeObject __pyx_type_3src_5ktlib_Gen = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Gen", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Gen), /*tp_basicsize*/ + "src.ktlib.Gen", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Gen), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Gen, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Gen, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -19803,15 +20379,15 @@ static PyTypeObject __pyx_type_5ktlib_Gen = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ " Handle `gen` command for kt_tool ", /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Gen, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Gen, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -19821,7 +20397,7 @@ static PyTypeObject __pyx_type_5ktlib_Gen = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Gen, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Gen, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -19841,51 +20417,43 @@ static PyTypeObject __pyx_type_5ktlib_Gen = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Test __pyx_vtable_5ktlib_Test; -static PyObject *__pyx_tp_new_5ktlib_Test(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Test *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_RunnableFile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_RunnableFile *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Test *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Test; - new((void*)&(p->file_name)) std::string(); - new((void*)&(p->pre_script)) std::string(); - new((void*)&(p->script)) std::string(); - new((void*)&(p->post_script)) std::string(); - new((void*)&(p->lang)) std::string(); + p = ((struct __pyx_obj_3src_5ktlib_RunnableFile *)o); + p->ext = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->problem_id = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->file_name = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_3src_5ktlib_12RunnableFile_1__cinit__(o, a, k) < 0)) goto bad; return o; + bad: + Py_DECREF(o); o = 0; + return NULL; } -static void __pyx_tp_dealloc_5ktlib_Test(PyObject *o) { - struct __pyx_obj_5ktlib_Test *p = (struct __pyx_obj_5ktlib_Test *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - __Pyx_call_destructor(p->file_name); - __Pyx_call_destructor(p->pre_script); - __Pyx_call_destructor(p->script); - __Pyx_call_destructor(p->post_script); - __Pyx_call_destructor(p->lang); - PyObject_GC_Track(o); - __pyx_tp_dealloc_5ktlib_Action(o); +static void __pyx_tp_dealloc_3src_5ktlib_RunnableFile(PyObject *o) { + struct __pyx_obj_3src_5ktlib_RunnableFile *p = (struct __pyx_obj_3src_5ktlib_RunnableFile *)o; + Py_CLEAR(p->ext); + Py_CLEAR(p->problem_id); + Py_CLEAR(p->file_name); + (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_5ktlib_Test[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_4Test_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_4Test_3__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_RunnableFile[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_12RunnableFile_3__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_12RunnableFile_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Test = { +static PyTypeObject __pyx_type_3src_5ktlib_RunnableFile = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Test", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Test), /*tp_basicsize*/ + "src.ktlib.RunnableFile", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_RunnableFile), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Test, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_RunnableFile, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -19910,15 +20478,15 @@ static PyTypeObject __pyx_type_5ktlib_Test = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Test, /*tp_methods*/ + __pyx_methods_3src_5ktlib_RunnableFile, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -19928,7 +20496,7 @@ static PyTypeObject __pyx_type_5ktlib_Test = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Test, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_RunnableFile, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -19948,47 +20516,46 @@ static PyTypeObject __pyx_type_5ktlib_Test = { 0, /*tp_print*/ #endif }; +static struct __pyx_vtabstruct_3src_5ktlib_Test __pyx_vtable_3src_5ktlib_Test; -static PyObject *__pyx_tp_new_5ktlib_ConfigError(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (&((PyTypeObject*)PyExc_Exception)[0])->tp_new(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Test(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Test *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_3src_5ktlib_Test *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Test; + p->file_name = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->pre_script = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->script = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->post_script = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->lang = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_5ktlib_ConfigError(PyObject *o) { - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif +static void __pyx_tp_dealloc_3src_5ktlib_Test(PyObject *o) { + struct __pyx_obj_3src_5ktlib_Test *p = (struct __pyx_obj_3src_5ktlib_Test *)o; PyObject_GC_UnTrack(o); + Py_CLEAR(p->file_name); + Py_CLEAR(p->pre_script); + Py_CLEAR(p->script); + Py_CLEAR(p->post_script); + Py_CLEAR(p->lang); PyObject_GC_Track(o); - (&((PyTypeObject*)PyExc_Exception)[0])->tp_dealloc(o); -} - -static int __pyx_tp_traverse_5ktlib_ConfigError(PyObject *o, visitproc v, void *a) { - int e; - if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse); else { e = (&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse(o,v,a); if (e) return e; } - return 0; -} - -static int __pyx_tp_clear_5ktlib_ConfigError(PyObject *o) { - if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_clear); else (&((PyTypeObject*)PyExc_Exception)[0])->tp_clear(o); - return 0; + __pyx_tp_dealloc_3src_5ktlib_Action(o); } -static PyMethodDef __pyx_methods_5ktlib_ConfigError[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_11ConfigError_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_11ConfigError_3__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Test[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_4Test_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_4Test_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_ConfigError = { +static PyTypeObject __pyx_type_3src_5ktlib_Test = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.ConfigError", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_ConfigError), /*tp_basicsize*/ + "src.ktlib.Test", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Test), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_ConfigError, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Test, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -20013,15 +20580,15 @@ static PyTypeObject __pyx_type_5ktlib_ConfigError = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5ktlib_ConfigError, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_ConfigError, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_ConfigError, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Test, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20031,7 +20598,7 @@ static PyTypeObject __pyx_type_5ktlib_ConfigError = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_ConfigError, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Test, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20051,59 +20618,54 @@ static PyTypeObject __pyx_type_5ktlib_ConfigError = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Submit __pyx_vtable_5ktlib_Submit; +static struct __pyx_vtabstruct_3src_5ktlib_Submit __pyx_vtable_3src_5ktlib_Submit; -static PyObject *__pyx_tp_new_5ktlib_Submit(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Submit *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Submit(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Submit *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Submit *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Submit; - new((void*)&(p->ac_icon)) std::string(); - new((void*)&(p->rj_icon)) std::string(); - new((void*)&(p->sk_icon)) std::string(); - new((void*)&(p->file_name)) std::string(); - new((void*)&(p->lang)) std::string(); - new((void*)&(p->submission_id)) std::string(); - new((void*)&(p->problem_id)) std::string(); - if (unlikely(__pyx_pw_5ktlib_6Submit_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; + p = ((struct __pyx_obj_3src_5ktlib_Submit *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Submit; + p->ac_icon = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->rj_icon = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->sk_icon = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->file_name = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->lang = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->submission_id = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->problem_id = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_3src_5ktlib_6Submit_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } -static void __pyx_tp_dealloc_5ktlib_Submit(PyObject *o) { - struct __pyx_obj_5ktlib_Submit *p = (struct __pyx_obj_5ktlib_Submit *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif +static void __pyx_tp_dealloc_3src_5ktlib_Submit(PyObject *o) { + struct __pyx_obj_3src_5ktlib_Submit *p = (struct __pyx_obj_3src_5ktlib_Submit *)o; PyObject_GC_UnTrack(o); - __Pyx_call_destructor(p->ac_icon); - __Pyx_call_destructor(p->rj_icon); - __Pyx_call_destructor(p->sk_icon); - __Pyx_call_destructor(p->file_name); - __Pyx_call_destructor(p->lang); - __Pyx_call_destructor(p->submission_id); - __Pyx_call_destructor(p->problem_id); + Py_CLEAR(p->ac_icon); + Py_CLEAR(p->rj_icon); + Py_CLEAR(p->sk_icon); + Py_CLEAR(p->file_name); + Py_CLEAR(p->lang); + Py_CLEAR(p->submission_id); + Py_CLEAR(p->problem_id); PyObject_GC_Track(o); - __pyx_tp_dealloc_5ktlib_Action(o); + __pyx_tp_dealloc_3src_5ktlib_Action(o); } -static PyMethodDef __pyx_methods_5ktlib_Submit[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_6Submit_3__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_6Submit_5__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Submit[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Submit_3__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Submit_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Submit = { +static PyTypeObject __pyx_type_3src_5ktlib_Submit = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Submit", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Submit), /*tp_basicsize*/ + "src.ktlib.Submit", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Submit), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Submit, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Submit, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -20128,15 +20690,15 @@ static PyTypeObject __pyx_type_5ktlib_Submit = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "Handle kt submit action to push the file to kattis website", /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Submit, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Submit, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20146,7 +20708,7 @@ static PyTypeObject __pyx_type_5ktlib_Submit = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Submit, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Submit, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20166,29 +20728,29 @@ static PyTypeObject __pyx_type_5ktlib_Submit = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Config __pyx_vtable_5ktlib_Config; +static struct __pyx_vtabstruct_3src_5ktlib_Config __pyx_vtable_3src_5ktlib_Config; -static PyObject *__pyx_tp_new_5ktlib_Config(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Config *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Config(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Config *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Config *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Config; + p = ((struct __pyx_obj_3src_5ktlib_Config *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Config; return o; } -static PyMethodDef __pyx_methods_5ktlib_Config[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_6Config_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_6Config_3__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Config[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Config_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Config_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Config = { +static PyTypeObject __pyx_type_3src_5ktlib_Config = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Config", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Config), /*tp_basicsize*/ + "src.ktlib.Config", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Config), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Action, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Action, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -20215,13 +20777,13 @@ static PyTypeObject __pyx_type_5ktlib_Config = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Config, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Config, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20231,7 +20793,7 @@ static PyTypeObject __pyx_type_5ktlib_Config = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Config, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Config, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20251,29 +20813,29 @@ static PyTypeObject __pyx_type_5ktlib_Config = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Open __pyx_vtable_5ktlib_Open; +static struct __pyx_vtabstruct_3src_5ktlib_Open __pyx_vtable_3src_5ktlib_Open; -static PyObject *__pyx_tp_new_5ktlib_Open(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Open *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Open(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Open *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Open *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Open; + p = ((struct __pyx_obj_3src_5ktlib_Open *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Open; return o; } -static PyMethodDef __pyx_methods_5ktlib_Open[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_4Open_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_4Open_3__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Open[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_4Open_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_4Open_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Open = { +static PyTypeObject __pyx_type_3src_5ktlib_Open = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Open", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Open), /*tp_basicsize*/ + "src.ktlib.Open", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Open), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Action, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Action, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -20300,13 +20862,13 @@ static PyTypeObject __pyx_type_5ktlib_Open = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Open, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Open, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20316,7 +20878,7 @@ static PyTypeObject __pyx_type_5ktlib_Open = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Open, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Open, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20336,29 +20898,29 @@ static PyTypeObject __pyx_type_5ktlib_Open = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Version __pyx_vtable_5ktlib_Version; +static struct __pyx_vtabstruct_3src_5ktlib_Version __pyx_vtable_3src_5ktlib_Version; -static PyObject *__pyx_tp_new_5ktlib_Version(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Version *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Version(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Version *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Version *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Version; + p = ((struct __pyx_obj_3src_5ktlib_Version *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Version; return o; } -static PyMethodDef __pyx_methods_5ktlib_Version[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_7Version_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_7Version_3__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Version[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_7Version_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_7Version_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Version = { +static PyTypeObject __pyx_type_3src_5ktlib_Version = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Version", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Version), /*tp_basicsize*/ + "src.ktlib.Version", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Version), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Action, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Action, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -20385,13 +20947,13 @@ static PyTypeObject __pyx_type_5ktlib_Version = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Version, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Version, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20401,7 +20963,7 @@ static PyTypeObject __pyx_type_5ktlib_Version = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Version, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Version, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20421,29 +20983,29 @@ static PyTypeObject __pyx_type_5ktlib_Version = { 0, /*tp_print*/ #endif }; -static struct __pyx_vtabstruct_5ktlib_Update __pyx_vtable_5ktlib_Update; +static struct __pyx_vtabstruct_3src_5ktlib_Update __pyx_vtable_3src_5ktlib_Update; -static PyObject *__pyx_tp_new_5ktlib_Update(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5ktlib_Update *p; - PyObject *o = __pyx_tp_new_5ktlib_Action(t, a, k); +static PyObject *__pyx_tp_new_3src_5ktlib_Update(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3src_5ktlib_Update *p; + PyObject *o = __pyx_tp_new_3src_5ktlib_Action(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5ktlib_Update *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5ktlib_Action*)__pyx_vtabptr_5ktlib_Update; + p = ((struct __pyx_obj_3src_5ktlib_Update *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_3src_5ktlib_Action*)__pyx_vtabptr_3src_5ktlib_Update; return o; } -static PyMethodDef __pyx_methods_5ktlib_Update[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_5ktlib_6Update_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5ktlib_6Update_3__setstate_cython__, METH_O, 0}, +static PyMethodDef __pyx_methods_3src_5ktlib_Update[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Update_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_3src_5ktlib_6Update_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5ktlib_Update = { +static PyTypeObject __pyx_type_3src_5ktlib_Update = { PyVarObject_HEAD_INIT(0, 0) - "ktlib.Update", /*tp_name*/ - sizeof(struct __pyx_obj_5ktlib_Update), /*tp_basicsize*/ + "src.ktlib.Update", /*tp_name*/ + sizeof(struct __pyx_obj_3src_5ktlib_Update), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5ktlib_Action, /*tp_dealloc*/ + __pyx_tp_dealloc_3src_5ktlib_Action, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -20470,13 +21032,13 @@ static PyTypeObject __pyx_type_5ktlib_Update = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5ktlib_Action, /*tp_traverse*/ - __pyx_tp_clear_5ktlib_Action, /*tp_clear*/ + __pyx_tp_traverse_3src_5ktlib_Action, /*tp_traverse*/ + __pyx_tp_clear_3src_5ktlib_Action, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5ktlib_Update, /*tp_methods*/ + __pyx_methods_3src_5ktlib_Update, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20486,7 +21048,7 @@ static PyTypeObject __pyx_type_5ktlib_Update = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5ktlib_Update, /*tp_new*/ + __pyx_tp_new_3src_5ktlib_Update, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20508,12 +21070,12 @@ static PyTypeObject __pyx_type_5ktlib_Update = { }; static PyMethodDef __pyx_methods[] = { - {"color_cyan", (PyCFunction)__pyx_pw_5ktlib_1color_cyan, METH_O, 0}, - {"color_green", (PyCFunction)__pyx_pw_5ktlib_3color_green, METH_O, 0}, - {"color_red", (PyCFunction)__pyx_pw_5ktlib_5color_red, METH_O, 0}, - {"write_samples", (PyCFunction)__pyx_pw_5ktlib_7write_samples, METH_O, __pyx_doc_5ktlib_6write_samples}, - {"arg_parse", (PyCFunction)__pyx_pw_5ktlib_9arg_parse, METH_O, __pyx_doc_5ktlib_8arg_parse}, - {"exit_gracefully", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5ktlib_11exit_gracefully, METH_VARARGS|METH_KEYWORDS, 0}, + {"color_cyan", (PyCFunction)__pyx_pw_3src_5ktlib_1color_cyan, METH_O, 0}, + {"color_green", (PyCFunction)__pyx_pw_3src_5ktlib_3color_green, METH_O, 0}, + {"color_red", (PyCFunction)__pyx_pw_3src_5ktlib_5color_red, METH_O, 0}, + {"write_samples", (PyCFunction)__pyx_pw_3src_5ktlib_7write_samples, METH_O, __pyx_doc_3src_5ktlib_6write_samples}, + {"arg_parse", (PyCFunction)__pyx_pw_3src_5ktlib_9arg_parse, METH_O, __pyx_doc_3src_5ktlib_8arg_parse}, + {"exit_gracefully", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3src_5ktlib_11exit_gracefully, METH_VARARGS|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -20522,34 +21084,25 @@ static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) { "Action", "Config", "ConfigError", + "FILE", "Gen", "Open", + "RunnableFile", + "SampleData", "Submit", "Test", "Update", "Version", - "X", "__pyx_ctuple_Py_ssize_t", "__pyx_ctuple_Py_ssize_t_struct", - "__pyx_ctuple_char__space_const__ptr", - "__pyx_ctuple_char__space_const__ptr_struct", "__pyx_ctuple_double", "__pyx_ctuple_double_struct", "__pyx_ctuple_long", "__pyx_ctuple_long_struct", - "__pyx_ctuple_size_t", - "__pyx_ctuple_size_t_struct", - "__pyx_ctuple_std__in_string", - "__pyx_ctuple_std__in_string__ref", - "__pyx_ctuple_std__in_string__ref_struct", - "__pyx_ctuple_std__in_string_struct", - "__pyx_ctuple_std__in_vector__lAngstd__in_string__rAng__in_size_type", - "__pyx_ctuple_std__in_vector__lAngstd__in_string__rAng__in_size_type_struct", - "__pyx_opt_args_5ktlib_6Action_get_url", - "__pyx_opt_args_5ktlib_ask_with_default", - "__pyx_opt_args_5ktlib_make_list_equal", + "__pyx_opt_args_3src_5ktlib_6Action_get_url", + "__pyx_opt_args_3src_5ktlib_ask_with_default", + "__pyx_opt_args_3src_5ktlib_make_list_equal", "bool_t", - "string", "vector", 0 }; @@ -20562,72 +21115,35 @@ static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) { type_name++; } if (0); - else if (__Pyx_StrEq(name, "BLACK")) { - __pyx_v_5ktlib_BLACK = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "BLUE")) { - __pyx_v_5ktlib_BLUE = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "BOLD_SEQ")) { - __pyx_v_5ktlib_BOLD_SEQ = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "CYAN")) { - __pyx_v_5ktlib_CYAN = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "GREEN")) { - __pyx_v_5ktlib_GREEN = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "MAGENTA")) { - __pyx_v_5ktlib_MAGENTA = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "RED")) { - __pyx_v_5ktlib_RED = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "RESET_SEQ")) { - __pyx_v_5ktlib_RESET_SEQ = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "WHITE")) { - __pyx_v_5ktlib_WHITE = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "YELLOW")) { - __pyx_v_5ktlib_YELLOW = __pyx_convert_string_from_py_std__in_string(o); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L2_error) - } else if (__Pyx_StrEq(name, "_HEADERS")) { Py_INCREF(o); - Py_DECREF(__pyx_v_5ktlib__HEADERS); - __pyx_v_5ktlib__HEADERS = o; - } - else if (__Pyx_StrEq(name, "_KATTIS_RC_URL")) { - __pyx_v_5ktlib__KATTIS_RC_URL = __Pyx_PyObject_AsString(o); if (unlikely((!__pyx_v_5ktlib__KATTIS_RC_URL) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "_PYPI_PACKAGE_INFO")) { - __pyx_v_5ktlib__PYPI_PACKAGE_INFO = __Pyx_PyObject_AsString(o); if (unlikely((!__pyx_v_5ktlib__PYPI_PACKAGE_INFO) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L2_error) - } - else if (__Pyx_StrEq(name, "_VERSION")) { - __pyx_v_5ktlib__VERSION = __Pyx_PyObject_AsString(o); if (unlikely((!__pyx_v_5ktlib__VERSION) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L2_error) + Py_DECREF(__pyx_v_3src_5ktlib__HEADERS); + __pyx_v_3src_5ktlib__HEADERS = o; } else if (__Pyx_StrEq(name, "map_key_to_class")) { + if (!(likely(PyDict_CheckExact(o))||((o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(o)->tp_name), 0))) __PYX_ERR(0, 945, __pyx_L2_error); Py_INCREF(o); - Py_DECREF(__pyx_v_5ktlib_map_key_to_class); - __pyx_v_5ktlib_map_key_to_class = o; + Py_DECREF(__pyx_v_3src_5ktlib_map_key_to_class); + __pyx_v_3src_5ktlib_map_key_to_class = ((PyObject*)o); } else if (__Pyx_StrEq(name, "map_template_to_plang")) { + if (!(likely(PyDict_CheckExact(o))||((o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(o)->tp_name), 0))) __PYX_ERR(0, 53, __pyx_L2_error); Py_INCREF(o); - Py_DECREF(__pyx_v_5ktlib_map_template_to_plang); - __pyx_v_5ktlib_map_template_to_plang = o; + Py_DECREF(__pyx_v_3src_5ktlib_map_template_to_plang); + __pyx_v_3src_5ktlib_map_template_to_plang = ((PyObject*)o); } else if (__Pyx_StrEq(name, "test_subprocesses")) { - if (!(likely(PyList_CheckExact(o))||((o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(o)->tp_name), 0))) __PYX_ERR(0, 41, __pyx_L2_error); + if (!(likely(PyList_CheckExact(o))||((o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(o)->tp_name), 0))) __PYX_ERR(0, 44, __pyx_L2_error); Py_INCREF(o); - Py_DECREF(__pyx_v_5ktlib_test_subprocesses); - __pyx_v_5ktlib_test_subprocesses = ((PyObject*)o); + Py_DECREF(__pyx_v_3src_5ktlib_test_subprocesses); + __pyx_v_3src_5ktlib_test_subprocesses = ((PyObject*)o); } else { if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad; } return 0; __pyx_L2_error:; - __Pyx_AddTraceback("ktlib", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("src.ktlib", __pyx_clineno, __pyx_lineno, __pyx_filename); bad: return -1; } @@ -20780,41 +21296,45 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, {&__pyx_kp_u_02l_M_p_Z_on_b_d_Y, __pyx_k_02l_M_p_Z_on_b_d_Y, sizeof(__pyx_k_02l_M_p_Z_on_b_d_Y), 0, 1, 0, 0}, - {&__pyx_kp_b_0m, __pyx_k_0m, sizeof(__pyx_k_0m), 0, 0, 0, 0}, - {&__pyx_kp_b_1m, __pyx_k_1m, sizeof(__pyx_k_1m), 0, 0, 0, 0}, + {&__pyx_kp_u_0m, __pyx_k_0m, sizeof(__pyx_k_0m), 0, 1, 0, 0}, + {&__pyx_kp_u_1_Add_a_template_2_Remove_a_temp, __pyx_k_1_Add_a_template_2_Remove_a_temp, sizeof(__pyx_k_1_Add_a_template_2_Remove_a_temp), 0, 1, 0, 0}, {&__pyx_kp_u_2f, __pyx_k_2f, sizeof(__pyx_k_2f), 0, 1, 0, 0}, {&__pyx_kp_u_3f, __pyx_k_3f, sizeof(__pyx_k_3f), 0, 1, 0, 0}, - {&__pyx_kp_b_6_90m, __pyx_k_6_90m, sizeof(__pyx_k_6_90m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_91m, __pyx_k_6_91m, sizeof(__pyx_k_6_91m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_92m, __pyx_k_6_92m, sizeof(__pyx_k_6_92m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_93m, __pyx_k_6_93m, sizeof(__pyx_k_6_93m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_94m, __pyx_k_6_94m, sizeof(__pyx_k_6_94m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_95m, __pyx_k_6_95m, sizeof(__pyx_k_6_95m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_96m, __pyx_k_6_96m, sizeof(__pyx_k_6_96m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_97m, __pyx_k_6_97m, sizeof(__pyx_k_6_97m), 0, 0, 0, 0}, + {&__pyx_kp_u_6_91m, __pyx_k_6_91m, sizeof(__pyx_k_6_91m), 0, 1, 0, 0}, + {&__pyx_kp_u_6_92m, __pyx_k_6_92m, sizeof(__pyx_k_6_92m), 0, 1, 0, 0}, + {&__pyx_kp_u_6_96m, __pyx_k_6_96m, sizeof(__pyx_k_6_96m), 0, 1, 0, 0}, {&__pyx_n_u_Accepted, __pyx_k_Accepted, sizeof(__pyx_k_Accepted), 0, 1, 0, 1}, - {&__pyx_kp_b_Access_denied_403, __pyx_k_Access_denied_403, sizeof(__pyx_k_Access_denied_403), 0, 0, 0, 0}, + {&__pyx_kp_u_Access_denied_403, __pyx_k_Access_denied_403, sizeof(__pyx_k_Access_denied_403), 0, 1, 0, 0}, {&__pyx_n_s_Action, __pyx_k_Action, sizeof(__pyx_k_Action), 0, 0, 1, 1}, + {&__pyx_kp_u_Adapted_from_xalanq_s_cf_tool, __pyx_k_Adapted_from_xalanq_s_cf_tool, sizeof(__pyx_k_Adapted_from_xalanq_s_cf_tool), 0, 1, 0, 0}, {&__pyx_n_s_BeautifulSoup, __pyx_k_BeautifulSoup, sizeof(__pyx_k_BeautifulSoup), 0, 0, 1, 1}, {&__pyx_n_u_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 1, 0, 1}, {&__pyx_kp_u_C_2, __pyx_k_C_2, sizeof(__pyx_k_C_2), 0, 1, 0, 0}, + {&__pyx_kp_u_Choose_a_file, __pyx_k_Choose_a_file, sizeof(__pyx_k_Choose_a_file), 0, 1, 0, 0}, + {&__pyx_kp_u_Choose_a_file_to_run, __pyx_k_Choose_a_file_to_run, sizeof(__pyx_k_Choose_a_file_to_run), 0, 1, 0, 0}, + {&__pyx_kp_u_Compile_Error, __pyx_k_Compile_Error, sizeof(__pyx_k_Compile_Error), 0, 1, 0, 0}, + {&__pyx_n_u_Compiling, __pyx_k_Compiling, sizeof(__pyx_k_Compiling), 0, 1, 0, 1}, {&__pyx_n_s_Config, __pyx_k_Config, sizeof(__pyx_k_Config), 0, 0, 1, 1}, {&__pyx_n_s_ConfigError, __pyx_k_ConfigError, sizeof(__pyx_k_ConfigError), 0, 0, 1, 1}, {&__pyx_n_s_ConfigParser, __pyx_k_ConfigParser, sizeof(__pyx_k_ConfigParser), 0, 0, 1, 1}, {&__pyx_kp_u_Current_version, __pyx_k_Current_version, sizeof(__pyx_k_Current_version), 0, 1, 0, 0}, {&__pyx_kp_u_Default_value, __pyx_k_Default_value, sizeof(__pyx_k_Default_value), 0, 1, 0, 0}, + {&__pyx_kp_u_Diff, __pyx_k_Diff, sizeof(__pyx_k_Diff), 0, 1, 0, 0}, {&__pyx_kp_u_First_argument_should_be_one_of, __pyx_k_First_argument_should_be_one_of, sizeof(__pyx_k_First_argument_should_be_one_of), 0, 1, 0, 0}, {&__pyx_kp_u_For_eg_cpp_cc, __pyx_k_For_eg_cpp_cc, sizeof(__pyx_k_For_eg_cpp_cc), 0, 1, 0, 0}, {&__pyx_n_s_Gen, __pyx_k_Gen, sizeof(__pyx_k_Gen), 0, 0, 1, 1}, {&__pyx_kp_u_Generate, __pyx_k_Generate, sizeof(__pyx_k_Generate), 0, 1, 0, 0}, {&__pyx_n_u_Go, __pyx_k_Go, sizeof(__pyx_k_Go), 0, 1, 0, 1}, - {&__pyx_n_u_HOME, __pyx_k_HOME, sizeof(__pyx_k_HOME), 0, 1, 0, 1}, + {&__pyx_kp_u_Great_is_the_art_of_beginning_bu, __pyx_k_Great_is_the_art_of_beginning_bu, sizeof(__pyx_k_Great_is_the_art_of_beginning_bu), 0, 1, 0, 0}, {&__pyx_n_s_HTMLParser, __pyx_k_HTMLParser, sizeof(__pyx_k_HTMLParser), 0, 0, 1, 1}, + {&__pyx_kp_u_Hmm_seems_like_there_is_currentl, __pyx_k_Hmm_seems_like_there_is_currentl, sizeof(__pyx_k_Hmm_seems_like_there_is_currentl), 0, 1, 0, 0}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0}, - {&__pyx_kp_b_Incorrect_login_URL_404, __pyx_k_Incorrect_login_URL_404, sizeof(__pyx_k_Incorrect_login_URL_404), 0, 0, 0, 0}, - {&__pyx_kp_b_Incorrect_submit_URL_404, __pyx_k_Incorrect_submit_URL_404, sizeof(__pyx_k_Incorrect_submit_URL_404), 0, 0, 0, 0}, - {&__pyx_kp_b_Incorrect_username_or_password_t, __pyx_k_Incorrect_username_or_password_t, sizeof(__pyx_k_Incorrect_username_or_password_t), 0, 0, 0, 0}, + {&__pyx_kp_u_Incorrect_login_URL_404, __pyx_k_Incorrect_login_URL_404, sizeof(__pyx_k_Incorrect_login_URL_404), 0, 1, 0, 0}, + {&__pyx_kp_u_Incorrect_submit_URL_404, __pyx_k_Incorrect_submit_URL_404, sizeof(__pyx_k_Incorrect_submit_URL_404), 0, 1, 0, 0}, + {&__pyx_kp_u_Incorrect_username_or_password_t, __pyx_k_Incorrect_username_or_password_t, sizeof(__pyx_k_Incorrect_username_or_password_t), 0, 1, 0, 0}, + {&__pyx_kp_u_Input, __pyx_k_Input, sizeof(__pyx_k_Input), 0, 1, 0, 0}, {&__pyx_kp_u_Installed_version, __pyx_k_Installed_version, sizeof(__pyx_k_Installed_version), 0, 1, 0, 0}, {&__pyx_kp_u_Internal_error, __pyx_k_Internal_error, sizeof(__pyx_k_Internal_error), 0, 1, 0, 0}, {&__pyx_kp_u_Internal_error_Number_of_sample, __pyx_k_Internal_error_Number_of_sample, sizeof(__pyx_k_Internal_error_Number_of_sample), 0, 1, 0, 0}, @@ -20826,7 +21346,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_u_JavaScript, __pyx_k_JavaScript, sizeof(__pyx_k_JavaScript), 0, 1, 0, 1}, {&__pyx_kp_u_Lanuage, __pyx_k_Lanuage, sizeof(__pyx_k_Lanuage), 0, 1, 0, 0}, {&__pyx_kp_u_Login_failed, __pyx_k_Login_failed, sizeof(__pyx_k_Login_failed), 0, 1, 0, 0}, - {&__pyx_kp_u_Mb, __pyx_k_Mb, sizeof(__pyx_k_Mb), 0, 1, 0, 0}, + {&__pyx_kp_u_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 1, 0, 0}, {&__pyx_n_s_NoOptionError, __pyx_k_NoOptionError, sizeof(__pyx_k_NoOptionError), 0, 0, 1, 1}, {&__pyx_kp_u_No_command_provided_to_kt, __pyx_k_No_command_provided_to_kt, sizeof(__pyx_k_No_command_provided_to_kt), 0, 1, 0, 0}, {&__pyx_kp_u_No_default_template_detected_in, __pyx_k_No_default_template_detected_in, sizeof(__pyx_k_No_default_template_detected_in), 0, 1, 0, 0}, @@ -20837,12 +21357,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_Open, __pyx_k_Open, sizeof(__pyx_k_Open), 0, 0, 1, 1}, {&__pyx_n_s_PIPE, __pyx_k_PIPE, sizeof(__pyx_k_PIPE), 0, 0, 1, 1}, {&__pyx_n_s_PLanguage, __pyx_k_PLanguage, sizeof(__pyx_k_PLanguage), 0, 0, 1, 1}, + {&__pyx_n_s_Path, __pyx_k_Path, sizeof(__pyx_k_Path), 0, 0, 1, 1}, {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_kp_u_Please_download_it_at, __pyx_k_Please_download_it_at, sizeof(__pyx_k_Please_download_it_at), 0, 1, 0, 0}, + {&__pyx_kp_u_Please_download_it_at_https_ope, __pyx_k_Please_download_it_at_https_ope, sizeof(__pyx_k_Please_download_it_at_https_ope), 0, 1, 0, 0}, {&__pyx_kp_u_Please_enter, __pyx_k_Please_enter, sizeof(__pyx_k_Please_enter), 0, 1, 0, 0}, {&__pyx_n_s_Popen, __pyx_k_Popen, sizeof(__pyx_k_Popen), 0, 0, 1, 1}, - {&__pyx_kp_b_Post_script, __pyx_k_Post_script, sizeof(__pyx_k_Post_script), 0, 0, 0, 0}, - {&__pyx_kp_b_Pre_script, __pyx_k_Pre_script, sizeof(__pyx_k_Pre_script), 0, 0, 0, 0}, + {&__pyx_kp_u_Post_script, __pyx_k_Post_script, sizeof(__pyx_k_Post_script), 0, 1, 0, 0}, + {&__pyx_kp_u_Pre_script, __pyx_k_Pre_script, sizeof(__pyx_k_Pre_script), 0, 1, 0, 0}, {&__pyx_kp_u_Problem_ID, __pyx_k_Problem_ID, sizeof(__pyx_k_Problem_ID), 0, 1, 0, 0}, {&__pyx_kp_u_Problem_is, __pyx_k_Problem_is, sizeof(__pyx_k_Problem_is), 0, 1, 0, 0}, {&__pyx_n_s_Process, __pyx_k_Process, sizeof(__pyx_k_Process), 0, 0, 1, 1}, @@ -20851,18 +21372,24 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Python, __pyx_k_Python, sizeof(__pyx_k_Python), 0, 1, 0, 0}, {&__pyx_kp_u_Python_2, __pyx_k_Python_2, sizeof(__pyx_k_Python_2), 0, 1, 0, 0}, {&__pyx_kp_u_Python_3, __pyx_k_Python_3, sizeof(__pyx_k_Python_3), 0, 1, 0, 0}, + {&__pyx_n_s_RunnableFile, __pyx_k_RunnableFile, sizeof(__pyx_k_RunnableFile), 0, 0, 1, 1}, {&__pyx_n_u_RunnableFile, __pyx_k_RunnableFile, sizeof(__pyx_k_RunnableFile), 0, 1, 0, 1}, + {&__pyx_n_u_Running, __pyx_k_Running, sizeof(__pyx_k_Running), 0, 1, 0, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_kp_u_Runtime_Error, __pyx_k_Runtime_Error, sizeof(__pyx_k_Runtime_Error), 0, 1, 0, 0}, {&__pyx_n_u_Rust, __pyx_k_Rust, sizeof(__pyx_k_Rust), 0, 1, 0, 1}, {&__pyx_n_s_SIGINT, __pyx_k_SIGINT, sizeof(__pyx_k_SIGINT), 0, 0, 1, 1}, {&__pyx_n_u_Sample, __pyx_k_Sample, sizeof(__pyx_k_Sample), 0, 1, 0, 1}, - {&__pyx_n_b_Script, __pyx_k_Script, sizeof(__pyx_k_Script), 0, 0, 0, 1}, + {&__pyx_n_s_SampleData, __pyx_k_SampleData, sizeof(__pyx_k_SampleData), 0, 0, 1, 1}, + {&__pyx_n_u_Script, __pyx_k_Script, sizeof(__pyx_k_Script), 0, 1, 0, 1}, + {&__pyx_kp_u_Select_an_option, __pyx_k_Select_an_option, sizeof(__pyx_k_Select_an_option), 0, 1, 0, 0}, {&__pyx_kp_u_Status_code, __pyx_k_Status_code, sizeof(__pyx_k_Status_code), 0, 1, 0, 0}, {&__pyx_kp_u_Submission_ID_d, __pyx_k_Submission_ID_d, sizeof(__pyx_k_Submission_ID_d), 0, 1, 0, 0}, {&__pyx_kp_u_Submission_failed, __pyx_k_Submission_failed, sizeof(__pyx_k_Submission_failed), 0, 1, 0, 0}, + {&__pyx_kp_u_Submission_successful, __pyx_k_Submission_successful, sizeof(__pyx_k_Submission_successful), 0, 1, 0, 0}, {&__pyx_n_s_Submit, __pyx_k_Submit, sizeof(__pyx_k_Submit), 0, 0, 1, 1}, - {&__pyx_kp_b_Template_path, __pyx_k_Template_path, sizeof(__pyx_k_Template_path), 0, 0, 0, 0}, + {&__pyx_kp_u_Template_file_has_been_generated, __pyx_k_Template_file_has_been_generated, sizeof(__pyx_k_Template_file_has_been_generated), 0, 1, 0, 0}, + {&__pyx_kp_u_Template_path, __pyx_k_Template_path, sizeof(__pyx_k_Template_path), 0, 1, 0, 0}, {&__pyx_kp_u_Template_will_run_3_scripts_in, __pyx_k_Template_will_run_3_scripts_in, sizeof(__pyx_k_Template_will_run_3_scripts_in), 0, 1, 0, 0}, {&__pyx_n_s_Test, __pyx_k_Test, sizeof(__pyx_k_Test), 0, 0, 1, 1}, {&__pyx_kp_u_Test_Case, __pyx_k_Test_Case, sizeof(__pyx_k_Test_Case), 0, 1, 0, 0}, @@ -20872,40 +21399,41 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_Update, __pyx_k_Update, sizeof(__pyx_k_Update), 0, 0, 1, 1}, {&__pyx_kp_u_User_Agent, __pyx_k_User_Agent, sizeof(__pyx_k_User_Agent), 0, 1, 0, 0}, {&__pyx_kp_u_Username, __pyx_k_Username, sizeof(__pyx_k_Username), 0, 1, 0, 0}, + {&__pyx_n_s_VERSION, __pyx_k_VERSION, sizeof(__pyx_k_VERSION), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_Version, __pyx_k_Version, sizeof(__pyx_k_Version), 0, 0, 1, 1}, {&__pyx_kp_u_Which_python_version_you_want_to, __pyx_k_Which_python_version_you_want_to, sizeof(__pyx_k_Which_python_version_you_want_to), 0, 1, 0, 0}, - {&__pyx_kp_b_Which_template_would_you_like_to, __pyx_k_Which_template_would_you_like_to, sizeof(__pyx_k_Which_template_would_you_like_to), 0, 0, 0, 0}, + {&__pyx_kp_u_Which_template_would_you_like_to, __pyx_k_Which_template_would_you_like_to, sizeof(__pyx_k_Which_template_would_you_like_to), 0, 1, 0, 0}, {&__pyx_kp_u_Which_template_would_you_like_to_2, __pyx_k_Which_template_would_you_like_to_2, sizeof(__pyx_k_Which_template_would_you_like_to_2), 0, 1, 0, 0}, {&__pyx_kp_u_Which_template_would_you_like_to_3, __pyx_k_Which_template_would_you_like_to_3, sizeof(__pyx_k_Which_template_would_you_like_to_3), 0, 1, 0, 0}, {&__pyx_kp_u_Wrong_Answer, __pyx_k_Wrong_Answer, sizeof(__pyx_k_Wrong_Answer), 0, 1, 0, 0}, + {&__pyx_kp_u_Yosh_your_configuration_has_been, __pyx_k_Yosh_your_configuration_has_been, sizeof(__pyx_k_Yosh_your_configuration_has_been), 0, 1, 0, 0}, {&__pyx_kp_u_You_already_have_the, __pyx_k_You_already_have_the, sizeof(__pyx_k_You_already_have_the), 0, 1, 0, 0}, {&__pyx_kp_u_Your_kattisrc_file_appears_corr, __pyx_k_Your_kattisrc_file_appears_corr, sizeof(__pyx_k_Your_kattisrc_file_appears_corr), 0, 1, 0, 0}, - {&__pyx_kp_u__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 1, 0, 0}, + {&__pyx_kp_u__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 1, 0, 0}, + {&__pyx_kp_u__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 1, 0, 0}, {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, - {&__pyx_kp_u__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 1, 0, 0}, - {&__pyx_kp_u__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 1, 0, 0}, {&__pyx_kp_u__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 1, 0, 0}, {&__pyx_kp_u__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 1, 0, 0}, {&__pyx_kp_u__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 1, 0, 0}, - {&__pyx_kp_u__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 1, 0, 0}, - {&__pyx_kp_b__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 0, 0}, - {&__pyx_kp_u__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 1, 0, 0}, + {&__pyx_kp_u__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 1, 0, 0}, + {&__pyx_kp_u__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 1, 0, 0}, + {&__pyx_kp_u__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 1, 0, 0}, {&__pyx_kp_u__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 1, 0, 0}, - {&__pyx_kp_u__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 1, 0, 0}, - {&__pyx_n_s__50, __pyx_k__50, sizeof(__pyx_k__50), 0, 0, 1, 1}, - {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, - {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, + {&__pyx_n_s__49, __pyx_k__49, sizeof(__pyx_k__49), 0, 0, 1, 1}, + {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0}, {&__pyx_n_s_abspath, __pyx_k_abspath, sizeof(__pyx_k_abspath), 0, 0, 1, 1}, {&__pyx_n_u_accepted, __pyx_k_accepted, sizeof(__pyx_k_accepted), 0, 1, 0, 1}, + {&__pyx_n_s_act, __pyx_k_act, sizeof(__pyx_k_act), 0, 0, 1, 1}, {&__pyx_n_s_alias, __pyx_k_alias, sizeof(__pyx_k_alias), 0, 0, 1, 1}, {&__pyx_n_u_alias, __pyx_k_alias, sizeof(__pyx_k_alias), 0, 1, 0, 1}, {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, - {&__pyx_n_b_ans, __pyx_k_ans, sizeof(__pyx_k_ans), 0, 0, 0, 1}, {&__pyx_n_u_ans, __pyx_k_ans, sizeof(__pyx_k_ans), 0, 1, 0, 1}, {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, {&__pyx_kp_u_application_octet_stream, __pyx_k_application_octet_stream, sizeof(__pyx_k_application_octet_stream), 0, 1, 0, 0}, {&__pyx_n_u_arg_parse, __pyx_k_arg_parse, sizeof(__pyx_k_arg_parse), 0, 1, 0, 1}, + {&__pyx_n_s_back, __pyx_k_back, sizeof(__pyx_k_back), 0, 0, 1, 1}, {&__pyx_n_s_basename, __pyx_k_basename, sizeof(__pyx_k_basename), 0, 0, 1, 1}, {&__pyx_kp_u_br, __pyx_k_br, sizeof(__pyx_k_br), 0, 1, 0, 0}, {&__pyx_n_s_bs4, __pyx_k_bs4, sizeof(__pyx_k_bs4), 0, 0, 1, 1}, @@ -20914,6 +21442,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_check_call, __pyx_k_check_call, sizeof(__pyx_k_check_call), 0, 0, 1, 1}, {&__pyx_n_u_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 1, 0, 1}, {&__pyx_n_s_class_2, __pyx_k_class_2, sizeof(__pyx_k_class_2), 0, 0, 1, 1}, + {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, {&__pyx_n_u_color_green, __pyx_k_color_green, sizeof(__pyx_k_color_green), 0, 1, 0, 1}, @@ -20929,10 +21458,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_copyfile, __pyx_k_copyfile, sizeof(__pyx_k_copyfile), 0, 0, 1, 1}, {&__pyx_n_u_cpp, __pyx_k_cpp, sizeof(__pyx_k_cpp), 0, 1, 0, 1}, {&__pyx_kp_u_current_time, __pyx_k_current_time, sizeof(__pyx_k_current_time), 0, 1, 0, 0}, + {&__pyx_n_s_cwd, __pyx_k_cwd, sizeof(__pyx_k_cwd), 0, 0, 1, 1}, {&__pyx_kp_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 0}, {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, {&__pyx_n_u_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 1, 0, 1}, + {&__pyx_kp_u_default_2, __pyx_k_default_2, sizeof(__pyx_k_default_2), 0, 1, 0, 0}, + {&__pyx_n_u_delete, __pyx_k_delete, sizeof(__pyx_k_delete), 0, 1, 0, 1}, {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, {&__pyx_n_u_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 1, 0, 1}, {&__pyx_n_u_div, __pyx_k_div, sizeof(__pyx_k_div), 0, 1, 0, 1}, @@ -20967,8 +21499,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_gcc_file_c_o_file_out, __pyx_k_gcc_file_c_o_file_out, sizeof(__pyx_k_gcc_file_c_o_file_out), 0, 1, 0, 0}, {&__pyx_n_u_gen, __pyx_k_gen, sizeof(__pyx_k_gen), 0, 1, 0, 1}, {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getcwd, __pyx_k_getcwd, sizeof(__pyx_k_getcwd), 0, 0, 1, 1}, - {&__pyx_n_s_getenv, __pyx_k_getenv, sizeof(__pyx_k_getenv), 0, 0, 1, 1}, {&__pyx_n_s_getsignal, __pyx_k_getsignal, sizeof(__pyx_k_getsignal), 0, 0, 1, 1}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_n_u_go, __pyx_k_go, sizeof(__pyx_k_go), 0, 1, 0, 1}, @@ -20976,14 +21506,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1}, {&__pyx_n_s_has_option, __pyx_k_has_option, sizeof(__pyx_k_has_option), 0, 0, 1, 1}, {&__pyx_n_s_headers, __pyx_k_headers, sizeof(__pyx_k_headers), 0, 0, 1, 1}, - {&__pyx_kp_b_heavy_check_mark, __pyx_k_heavy_check_mark, sizeof(__pyx_k_heavy_check_mark), 0, 0, 0, 0}, - {&__pyx_kp_b_heavy_multiplication_x, __pyx_k_heavy_multiplication_x, sizeof(__pyx_k_heavy_multiplication_x), 0, 0, 0, 0}, + {&__pyx_kp_u_heavy_check_mark, __pyx_k_heavy_check_mark, sizeof(__pyx_k_heavy_check_mark), 0, 1, 0, 0}, + {&__pyx_kp_u_heavy_multiplication_x, __pyx_k_heavy_multiplication_x, sizeof(__pyx_k_heavy_multiplication_x), 0, 1, 0, 0}, + {&__pyx_n_s_home, __pyx_k_home, sizeof(__pyx_k_home), 0, 0, 1, 1}, {&__pyx_n_u_hostname, __pyx_k_hostname, sizeof(__pyx_k_hostname), 0, 1, 0, 1}, {&__pyx_n_s_html_parser, __pyx_k_html_parser, sizeof(__pyx_k_html_parser), 0, 0, 1, 1}, {&__pyx_kp_u_html_parser, __pyx_k_html_parser, sizeof(__pyx_k_html_parser), 0, 1, 0, 0}, {&__pyx_kp_u_https, __pyx_k_https, sizeof(__pyx_k_https), 0, 1, 0, 0}, + {&__pyx_kp_u_https_pypi_org_pypi_kttool_json, __pyx_k_https_pypi_org_pypi_kttool_json, sizeof(__pyx_k_https_pypi_org_pypi_kttool_json), 0, 1, 0, 0}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_b_in, __pyx_k_in, sizeof(__pyx_k_in), 0, 0, 0, 1}, {&__pyx_n_u_in, __pyx_k_in, sizeof(__pyx_k_in), 0, 1, 0, 1}, {&__pyx_n_s_indent, __pyx_k_indent, sizeof(__pyx_k_indent), 0, 0, 1, 1}, {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, @@ -20992,9 +21523,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_input_file, __pyx_k_input_file, sizeof(__pyx_k_input_file), 0, 0, 1, 1}, {&__pyx_n_u_input_file, __pyx_k_input_file, sizeof(__pyx_k_input_file), 0, 1, 0, 1}, {&__pyx_n_u_install, __pyx_k_install, sizeof(__pyx_k_install), 0, 1, 0, 1}, + {&__pyx_n_s_is_file, __pyx_k_is_file, sizeof(__pyx_k_is_file), 0, 0, 1, 1}, + {&__pyx_n_s_is_in, __pyx_k_is_in, sizeof(__pyx_k_is_in), 0, 0, 1, 1}, {&__pyx_kp_u_is_not_in_ur_config_file, __pyx_k_is_not_in_ur_config_file, sizeof(__pyx_k_is_not_in_ur_config_file), 0, 1, 0, 0}, - {&__pyx_n_s_isfile, __pyx_k_isfile, sizeof(__pyx_k_isfile), 0, 0, 1, 1}, {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_iterdir, __pyx_k_iterdir, sizeof(__pyx_k_iterdir), 0, 0, 1, 1}, {&__pyx_n_u_java, __pyx_k_java, sizeof(__pyx_k_java), 0, 1, 0, 1}, {&__pyx_kp_u_javac_java, __pyx_k_javac_java, sizeof(__pyx_k_javac_java), 0, 1, 0, 0}, {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, @@ -21007,23 +21540,26 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_kill, __pyx_k_kill, sizeof(__pyx_k_kill), 0, 0, 1, 1}, {&__pyx_n_u_kt, __pyx_k_kt, sizeof(__pyx_k_kt), 0, 1, 0, 1}, {&__pyx_kp_u_ktconfig, __pyx_k_ktconfig, sizeof(__pyx_k_ktconfig), 0, 1, 0, 0}, - {&__pyx_n_s_ktlib, __pyx_k_ktlib, sizeof(__pyx_k_ktlib), 0, 0, 1, 1}, + {&__pyx_kp_u_ktconfig_file_has_not_been_set, __pyx_k_ktconfig_file_has_not_been_set, sizeof(__pyx_k_ktconfig_file_has_not_been_set), 0, 1, 0, 0}, {&__pyx_kp_u_kttool, __pyx_k_kttool, sizeof(__pyx_k_kttool), 0, 1, 0, 0}, {&__pyx_kp_u_language, __pyx_k_language, sizeof(__pyx_k_language), 0, 1, 0, 0}, {&__pyx_n_u_language_2, __pyx_k_language_2, sizeof(__pyx_k_language_2), 0, 1, 0, 1}, - {&__pyx_n_s_listdir, __pyx_k_listdir, sizeof(__pyx_k_listdir), 0, 0, 1, 1}, + {&__pyx_n_u_latest, __pyx_k_latest, sizeof(__pyx_k_latest), 0, 1, 0, 1}, {&__pyx_n_s_ljust, __pyx_k_ljust, sizeof(__pyx_k_ljust), 0, 0, 1, 1}, {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1}, - {&__pyx_n_b_login, __pyx_k_login, sizeof(__pyx_k_login), 0, 0, 0, 1}, + {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1}, + {&__pyx_n_u_login, __pyx_k_login, sizeof(__pyx_k_login), 0, 1, 0, 1}, + {&__pyx_n_u_loginurl, __pyx_k_loginurl, sizeof(__pyx_k_loginurl), 0, 1, 0, 1}, {&__pyx_kp_u_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 1, 0, 0}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_u_mainclass, __pyx_k_mainclass, sizeof(__pyx_k_mainclass), 0, 1, 0, 1}, - {&__pyx_n_s_makedirs, __pyx_k_makedirs, sizeof(__pyx_k_makedirs), 0, 0, 1, 1}, {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1}, {&__pyx_n_s_max_workers, __pyx_k_max_workers, sizeof(__pyx_k_max_workers), 0, 0, 1, 1}, {&__pyx_n_s_memory_info, __pyx_k_memory_info, sizeof(__pyx_k_memory_info), 0, 0, 1, 1}, + {&__pyx_n_s_mkdir, __pyx_k_mkdir, sizeof(__pyx_k_mkdir), 0, 0, 1, 1}, {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1}, {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, {&__pyx_kp_u_no_cache_dir, __pyx_k_no_cache_dir, sizeof(__pyx_k_no_cache_dir), 0, 1, 0, 0}, @@ -21036,9 +21572,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_output_file, __pyx_k_output_file, sizeof(__pyx_k_output_file), 0, 0, 1, 1}, {&__pyx_n_u_output_file, __pyx_k_output_file, sizeof(__pyx_k_output_file), 0, 1, 0, 1}, {&__pyx_n_s_output_type, __pyx_k_output_type, sizeof(__pyx_k_output_type), 0, 0, 1, 1}, + {&__pyx_n_s_parents, __pyx_k_parents, sizeof(__pyx_k_parents), 0, 0, 1, 1}, {&__pyx_n_u_password, __pyx_k_password, sizeof(__pyx_k_password), 0, 1, 0, 1}, {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, {&__pyx_n_u_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 1, 0, 1}, + {&__pyx_n_s_pathlib, __pyx_k_pathlib, sizeof(__pyx_k_pathlib), 0, 0, 1, 1}, {&__pyx_n_s_perf_counter, __pyx_k_perf_counter, sizeof(__pyx_k_perf_counter), 0, 0, 1, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, {&__pyx_n_s_pid, __pyx_k_pid, sizeof(__pyx_k_pid), 0, 0, 1, 1}, @@ -21091,6 +21629,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_runtime_middle, __pyx_k_runtime_middle, sizeof(__pyx_k_runtime_middle), 0, 1, 0, 0}, {&__pyx_kp_u_rustc_file_rs, __pyx_k_rustc_file_rs, sizeof(__pyx_k_rustc_file_rs), 0, 1, 0, 0}, {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0}, + {&__pyx_n_s_sample_id, __pyx_k_sample_id, sizeof(__pyx_k_sample_id), 0, 0, 1, 1}, {&__pyx_kp_u_sample_s_to, __pyx_k_sample_s_to, sizeof(__pyx_k_sample_s_to), 0, 1, 0, 0}, {&__pyx_n_s_script, __pyx_k_script, sizeof(__pyx_k_script), 0, 0, 1, 1}, {&__pyx_n_u_script, __pyx_k_script, sizeof(__pyx_k_script), 0, 1, 0, 1}, @@ -21107,7 +21646,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_sorted, __pyx_k_sorted, sizeof(__pyx_k_sorted), 0, 0, 1, 1}, {&__pyx_n_u_span, __pyx_k_span, sizeof(__pyx_k_span), 0, 1, 0, 1}, {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, - {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1}, + {&__pyx_n_s_src_ktlib, __pyx_k_src_ktlib, sizeof(__pyx_k_src_ktlib), 0, 0, 1, 1}, {&__pyx_n_s_status_code, __pyx_k_status_code, sizeof(__pyx_k_status_code), 0, 0, 1, 1}, {&__pyx_kp_u_status_middle, __pyx_k_status_middle, sizeof(__pyx_k_status_middle), 0, 1, 0, 0}, {&__pyx_n_s_stdin, __pyx_k_stdin, sizeof(__pyx_k_stdin), 0, 0, 1, 1}, @@ -21118,8 +21657,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_sub_file, __pyx_k_sub_file, sizeof(__pyx_k_sub_file), 0, 1, 0, 0}, {&__pyx_kp_u_submission_id, __pyx_k_submission_id, sizeof(__pyx_k_submission_id), 0, 1, 0, 0}, {&__pyx_kp_u_submission_result, __pyx_k_submission_result, sizeof(__pyx_k_submission_result), 0, 1, 0, 0}, - {&__pyx_n_b_submissions, __pyx_k_submissions, sizeof(__pyx_k_submissions), 0, 0, 0, 1}, - {&__pyx_n_b_submit, __pyx_k_submit, sizeof(__pyx_k_submit), 0, 0, 0, 1}, + {&__pyx_n_u_submissions, __pyx_k_submissions, sizeof(__pyx_k_submissions), 0, 1, 0, 1}, + {&__pyx_n_u_submissionsurl, __pyx_k_submissionsurl, sizeof(__pyx_k_submissionsurl), 0, 1, 0, 1}, + {&__pyx_n_u_submissionurl, __pyx_k_submissionurl, sizeof(__pyx_k_submissionurl), 0, 1, 0, 1}, {&__pyx_n_u_submit, __pyx_k_submit, sizeof(__pyx_k_submit), 0, 1, 0, 1}, {&__pyx_n_u_submit_ctr, __pyx_k_submit_ctr, sizeof(__pyx_k_submit_ctr), 0, 1, 0, 1}, {&__pyx_n_s_subprocess, __pyx_k_subprocess, sizeof(__pyx_k_subprocess), 0, 0, 1, 1}, @@ -21143,26 +21683,28 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_u_user, __pyx_k_user, sizeof(__pyx_k_user), 0, 1, 0, 1}, {&__pyx_n_u_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 1, 0, 1}, {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0}, - {&__pyx_kp_u_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 1, 0, 0}, - {&__pyx_n_u_version_2, __pyx_k_version_2, sizeof(__pyx_k_version_2), 0, 1, 0, 1}, + {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, + {&__pyx_n_u_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 1, 0, 1}, + {&__pyx_kp_u_version_2, __pyx_k_version_2, sizeof(__pyx_k_version_2), 0, 1, 0, 0}, {&__pyx_n_u_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 1, 0, 1}, + {&__pyx_kp_u_w_2, __pyx_k_w_2, sizeof(__pyx_k_w_2), 0, 1, 0, 0}, {&__pyx_n_s_wait, __pyx_k_wait, sizeof(__pyx_k_wait), 0, 0, 1, 1}, {&__pyx_n_s_webbrowser, __pyx_k_webbrowser, sizeof(__pyx_k_webbrowser), 0, 0, 1, 1}, - {&__pyx_kp_b_white_medium_square, __pyx_k_white_medium_square, sizeof(__pyx_k_white_medium_square), 0, 0, 0, 0}, + {&__pyx_kp_u_white_medium_square, __pyx_k_white_medium_square, sizeof(__pyx_k_white_medium_square), 0, 1, 0, 0}, {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, {&__pyx_n_s_write_samples, __pyx_k_write_samples, sizeof(__pyx_k_write_samples), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_input = __Pyx_GetBuiltinName(__pyx_n_s_input); if (!__pyx_builtin_input) __PYX_ERR(0, 149, __pyx_L1_error) - __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 204, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 209, __pyx_L1_error) - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 228, __pyx_L1_error) - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_builtin_input = __Pyx_GetBuiltinName(__pyx_n_s_input); if (!__pyx_builtin_input) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 278, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 341, __pyx_L1_error) - __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(0, 477, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(0, 509, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 915, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -21172,69 +21714,88 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "ktlib.pyx":193 + /* "src/ktlib.pyx":186 * return self.cfg.get('kattis', option) - * else: - * kattis_host = self.cfg.get('kattis', 'hostname') # <<<<<<<<<<<<<< - * return f'https://{kattis_host}/{default}' + * + * kattis_host = self.cfg.get('kattis', 'hostname') # <<<<<<<<<<<<<< + * return f'https://{kattis_host}/{default}' * */ - __pyx_tuple__5 = PyTuple_Pack(2, __pyx_n_u_kattis, __pyx_n_u_hostname); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_u_kattis, __pyx_n_u_hostname); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); - /* "ktlib.pyx":204 + /* "src/ktlib.pyx":197 * # Initialize ktconfig file if file doesnt exist - * if not os.path.exists(self.kt_config): + * if not self.kt_config.is_file(): * with open(self.kt_config, 'w') as f: # <<<<<<<<<<<<<< * f.write('{}\n') * */ - __pyx_tuple__8 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__6 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "ktlib.pyx":213 + /* "src/ktlib.pyx":206 * * self.cfg.read(self.config_path) - * username = self.cfg.get('user', 'username') # <<<<<<<<<<<<<< + * cdef str username = self.cfg.get('user', 'username') # <<<<<<<<<<<<<< * password = token = None * try: */ - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_u_user, __pyx_n_u_username); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_u_user, __pyx_n_u_username); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "ktlib.pyx":216 + /* "src/ktlib.pyx":209 * password = token = None * try: * password = self.cfg.get('user', 'password') # <<<<<<<<<<<<<< * except configparser.NoOptionError: * pass */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_u_user, __pyx_n_u_password); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_u_user, __pyx_n_u_password); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "ktlib.pyx":220 + /* "src/ktlib.pyx":213 * pass * try: * token = self.cfg.get('user', 'token') # <<<<<<<<<<<<<< * except configparser.NoOptionError: * pass */ - __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_u_user, __pyx_n_u_token); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_u_user, __pyx_n_u_token); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "ktlib.pyx":224 + /* "src/ktlib.pyx":217 * pass * if password is None and token is None: * raise ConfigError('''\ # <<<<<<<<<<<<<< * Your .kattisrc file appears corrupted. It must provide a token (or a * KATTIS password). */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_Your_kattisrc_file_appears_corr); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Your_kattisrc_file_appears_corr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); @@ -21257,57 +21818,65 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - /* "ktlib.pyx":363 - * template_file = json.load(f) - * for k, template in template_file.items(): - * if template.get('default', False): # <<<<<<<<<<<<<< - * shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') - * print(color_green(b'Template file has been generated')) - */ - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_u_default, Py_False); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); - /* "ktlib.pyx":415 + /* "src/ktlib.pyx":459 * * if len(runnable_files) == 0: * raise RuntimeError('Not executable code file detected') # <<<<<<<<<<<<<< * * if len(runnable_files) > 1: */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_u_Not_executable_code_file_detecte); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_Not_executable_code_file_detecte); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); - /* "ktlib.pyx":525 - * diff.push_back(current_diff) + /* "src/ktlib.pyx":571 + * diff.append(current_diff) * if is_ac: - * print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) # <<<<<<<<<<<<<< + * log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) # <<<<<<<<<<<<<< * else: - * print(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + * log(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) */ - __pyx_tuple__25 = PyTuple_Pack(2, __pyx_int_13, __pyx_kp_u__24); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 525, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_tuple__26 = PyTuple_Pack(2, __pyx_int_13, __pyx_kp_u__18); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21315,71 +21884,71 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); - /* "ktlib.pyx":577 + /* "src/ktlib.pyx":624 * * for res in result: * _class = res.get('class', None) # <<<<<<<<<<<<<< * if _class: * if _class[0] == 'accepted': */ - __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_u_class, Py_None); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_u_class, Py_None); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); - /* "ktlib.pyx":641 + /* "src/ktlib.pyx":688 * page = requests.get(submission_url_ret, cookies=self.cookies, headers=_HEADERS) * soup = BeautifulSoup(page.content, 'html.parser') * submission_data = soup.find('div', class_='testcases') # <<<<<<<<<<<<<< * submission_ret = submission_data.find_all('span') * status_ret = soup.find('td', class_='status middle').find('span').text */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_u_div); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_u_div); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); - /* "ktlib.pyx":643 + /* "src/ktlib.pyx":690 * submission_data = soup.find('div', class_='testcases') * submission_ret = submission_data.find_all('span') * status_ret = soup.find('td', class_='status middle').find('span').text # <<<<<<<<<<<<<< * runtime_ret = soup.find('td', class_='runtime middle').text * done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_u_td); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_u_td); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); - /* "ktlib.pyx":691 + /* "src/ktlib.pyx":740 * self.file_name = os.path.abspath(runnable_files[opt].full_name) * if runnable_files[opt].ext == 'py': * res = input('Which python version you want to submit, 2 or 3?\n') # <<<<<<<<<<<<<< * res_int = int(res) * assert 2 <= res_int <= 3, "Invalid option" */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_Which_python_version_you_want_to); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_Which_python_version_you_want_to); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 740, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); - /* "ktlib.pyx":735 + /* "src/ktlib.pyx":785 * raise RuntimeError(f'Submission failed: {err}') - * submissions_url = self.get_url(b'submissionsurl', b'submissions') + * submissions_url = self.get_url('submissionsurl', 'submissions') * submit_response = ret.content.decode('utf-8').replace('
', '\n') # <<<<<<<<<<<<<< * self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) - * print(color_green(b'Submission successful')) + * log(color_green('Submission successful')) */ - __pyx_tuple__34 = PyTuple_Pack(2, __pyx_kp_u_br, __pyx_kp_u__2); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 735, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(2, __pyx_kp_u_br, __pyx_kp_u__2); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); @@ -21402,27 +21971,16 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); - /* "ktlib.pyx":755 - * - * print(color_green(b'Adapted from xalanq\'s cf tool')) - * print(''' # <<<<<<<<<<<<<< - * Template will run 3 scripts in sequence when you run "kt test": - * - before_script (execute once) - */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_u_Template_will_run_3_scripts_in); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - - /* "ktlib.pyx":865 + /* "src/ktlib.pyx":915 * self.update_default() * else: * raise ValueError('Invalid option') # <<<<<<<<<<<<<< * * cdef class Open(Action): */ - __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_u_Invalid_option); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_Invalid_option); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21430,18 +21988,18 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21449,18 +22007,18 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21468,18 +22026,18 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21487,138 +22045,138 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); - /* "ktlib.pyx":908 + /* "src/ktlib.pyx":958 * ''' Generate an appropriate command class based on user command stirng ''' * if len(args) == 0: * raise ValueError(f'No command provided to kt') # <<<<<<<<<<<<<< * if args[0] not in map_key_to_class: * raise ValueError(f'First argument should be one of {list(map_key_to_class.keys())}') */ - __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_u_No_command_provided_to_kt); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_u_No_command_provided_to_kt); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 958, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); - /* "ktlib.pyx":51 + /* "src/ktlib.pyx":54 * - * cdef object map_template_to_plang = { + * cdef dict map_template_to_plang = { * 'c': PLanguage('c', 'c','C', # <<<<<<<<<<<<<< * 'gcc $%file%$.c -o $%file%$.out', * './$%file%$.out', */ - __pyx_tuple__51 = PyTuple_Pack(6, __pyx_n_u_c, __pyx_n_u_c, __pyx_n_u_C, __pyx_kp_u_gcc_file_c_o_file_out, __pyx_kp_u_file_out, __pyx_kp_u_rm_file_out); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); + __pyx_tuple__50 = PyTuple_Pack(6, __pyx_n_u_c, __pyx_n_u_c, __pyx_n_u_C, __pyx_kp_u_gcc_file_c_o_file_out, __pyx_kp_u_file_out, __pyx_kp_u_rm_file_out); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); - /* "ktlib.pyx":56 + /* "src/ktlib.pyx":59 * 'rm $%file%$.out' * ), * 'cpp': PLanguage('cpp', 'cpp', 'C++', # <<<<<<<<<<<<<< * 'g++ -std=c++14 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -O3 $%file%$.cpp -o $%file%$.out', * './$%file%$.out', */ - __pyx_tuple__52 = PyTuple_Pack(6, __pyx_n_u_cpp, __pyx_n_u_cpp, __pyx_kp_u_C_2, __pyx_kp_u_g_std_c_14_D_GLIBCXX_DEBUG_D_GLI, __pyx_kp_u_file_out, __pyx_kp_u_rm_file_out); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_tuple__51 = PyTuple_Pack(6, __pyx_n_u_cpp, __pyx_n_u_cpp, __pyx_kp_u_C_2, __pyx_kp_u_g_std_c_14_D_GLIBCXX_DEBUG_D_GLI, __pyx_kp_u_file_out, __pyx_kp_u_rm_file_out); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); - /* "ktlib.pyx":61 + /* "src/ktlib.pyx":64 * 'rm $%file%$.out' * ), * 'cc': PLanguage('cc', 'cc', 'C++', # <<<<<<<<<<<<<< * 'g++ -std=c++14 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -O3 $%file%$.cc -o $%file%$.out', * './$%file%$.out', */ - __pyx_tuple__53 = PyTuple_Pack(6, __pyx_n_u_cc, __pyx_n_u_cc, __pyx_kp_u_C_2, __pyx_kp_u_g_std_c_14_D_GLIBCXX_DEBUG_D_GLI_2, __pyx_kp_u_file_out, __pyx_kp_u_rm_file_out); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__53); - __Pyx_GIVEREF(__pyx_tuple__53); + __pyx_tuple__52 = PyTuple_Pack(6, __pyx_n_u_cc, __pyx_n_u_cc, __pyx_kp_u_C_2, __pyx_kp_u_g_std_c_14_D_GLIBCXX_DEBUG_D_GLI_2, __pyx_kp_u_file_out, __pyx_kp_u_rm_file_out); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); - /* "ktlib.pyx":66 + /* "src/ktlib.pyx":69 * 'rm $%file%$.out' * ), * 'go': PLanguage('go', 'go', 'Go', # <<<<<<<<<<<<<< * 'go build -o $%file%$', * './$%file%$', */ - __pyx_tuple__54 = PyTuple_Pack(6, __pyx_n_u_go, __pyx_n_u_go, __pyx_n_u_Go, __pyx_kp_u_go_build_o_file, __pyx_kp_u_file_2, __pyx_kp_u_rm_file); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_tuple__53 = PyTuple_Pack(6, __pyx_n_u_go, __pyx_n_u_go, __pyx_n_u_Go, __pyx_kp_u_go_build_o_file, __pyx_kp_u_file_2, __pyx_kp_u_rm_file); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__53); + __Pyx_GIVEREF(__pyx_tuple__53); - /* "ktlib.pyx":71 + /* "src/ktlib.pyx":74 * 'rm $%file%$' * ), * 'java': PLanguage('java', 'java', 'Java', # <<<<<<<<<<<<<< * 'javac *.java', * './$%file%$', */ - __pyx_tuple__55 = PyTuple_Pack(6, __pyx_n_u_java, __pyx_n_u_java, __pyx_n_u_Java, __pyx_kp_u_javac_java, __pyx_kp_u_file_2, __pyx_kp_u_rm_file); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); + __pyx_tuple__54 = PyTuple_Pack(6, __pyx_n_u_java, __pyx_n_u_java, __pyx_n_u_Java, __pyx_kp_u_javac_java, __pyx_kp_u_file_2, __pyx_kp_u_rm_file); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); - /* "ktlib.pyx":76 + /* "src/ktlib.pyx":79 * 'rm $%file%$' * ), * 'js': PLanguage('js', 'js', 'JavaScript', # <<<<<<<<<<<<<< * '', * 'node $%file%$.js', */ - __pyx_tuple__56 = PyTuple_Pack(6, __pyx_n_u_js, __pyx_n_u_js, __pyx_n_u_JavaScript, __pyx_kp_u__33, __pyx_kp_u_node_file_js, __pyx_kp_u__33); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_tuple__55 = PyTuple_Pack(6, __pyx_n_u_js, __pyx_n_u_js, __pyx_n_u_JavaScript, __pyx_kp_u_, __pyx_kp_u_node_file_js, __pyx_kp_u_); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); - /* "ktlib.pyx":81 + /* "src/ktlib.pyx":84 * '' * ), * 'rs': PLanguage('rs', 'rs', 'Rust', # <<<<<<<<<<<<<< * 'rustc $%file%$.rs', * './$%file%$', */ - __pyx_tuple__57 = PyTuple_Pack(6, __pyx_n_u_rs, __pyx_n_u_rs, __pyx_n_u_Rust, __pyx_kp_u_rustc_file_rs, __pyx_kp_u_file_2, __pyx_kp_u_rm_file); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_tuple__56 = PyTuple_Pack(6, __pyx_n_u_rs, __pyx_n_u_rs, __pyx_n_u_Rust, __pyx_kp_u_rustc_file_rs, __pyx_kp_u_file_2, __pyx_kp_u_rm_file); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); - /* "ktlib.pyx":86 + /* "src/ktlib.pyx":89 * 'rm $%file%$' * ), * 'py2': PLanguage('py2', 'py', 'Python 2', # <<<<<<<<<<<<<< * '', * 'python2 $%file%$.py', */ - __pyx_tuple__58 = PyTuple_Pack(6, __pyx_n_u_py2, __pyx_n_u_py, __pyx_kp_u_Python_2, __pyx_kp_u__33, __pyx_kp_u_python2_file_py, __pyx_kp_u__33); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_tuple__57 = PyTuple_Pack(6, __pyx_n_u_py2, __pyx_n_u_py, __pyx_kp_u_Python_2, __pyx_kp_u_, __pyx_kp_u_python2_file_py, __pyx_kp_u_); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); - /* "ktlib.pyx":91 + /* "src/ktlib.pyx":94 * '' * ), * 'py3': PLanguage('py3', 'py', 'Python 3', # <<<<<<<<<<<<<< * '', * 'python3 $%file%$.py', */ - __pyx_tuple__59 = PyTuple_Pack(6, __pyx_n_u_py3, __pyx_n_u_py, __pyx_kp_u_Python_3, __pyx_kp_u__33, __pyx_kp_u_python3_file_py, __pyx_kp_u__33); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_tuple__58 = PyTuple_Pack(6, __pyx_n_u_py3, __pyx_n_u_py, __pyx_kp_u_Python_3, __pyx_kp_u_, __pyx_kp_u_python3_file_py, __pyx_kp_u_); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); /* "(tree fragment)":1 * def __pyx_unpickle_ConfigError(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_tuple__60 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ConfigError, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ConfigError, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -21627,6 +22185,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { } static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyList_Type_back.type = (PyObject*)&PyList_Type; + __pyx_umethod_PyList_Type_clear.type = (PyObject*)&PyList_Type; + __pyx_umethod_PyUnicode_Type_append.type = (PyObject*)&PyUnicode_Type; if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_float_0_4 = PyFloat_FromDouble(0.4); if (unlikely(!__pyx_float_0_4)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -21655,10 +22219,10 @@ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ - __pyx_v_5ktlib__HEADERS = Py_None; Py_INCREF(Py_None); - __pyx_v_5ktlib_test_subprocesses = ((PyObject*)Py_None); Py_INCREF(Py_None); - __pyx_v_5ktlib_map_template_to_plang = Py_None; Py_INCREF(Py_None); - __pyx_v_5ktlib_map_key_to_class = Py_None; Py_INCREF(Py_None); + __pyx_v_3src_5ktlib__HEADERS = Py_None; Py_INCREF(Py_None); + __pyx_v_3src_5ktlib_test_subprocesses = ((PyObject*)Py_None); Py_INCREF(Py_None); + __pyx_v_3src_5ktlib_map_template_to_plang = ((PyObject*)Py_None); Py_INCREF(Py_None); + __pyx_v_3src_5ktlib_map_key_to_class = ((PyObject*)Py_None); Py_INCREF(Py_None); __Pyx_RefNannyFinishContext(); return 0; } @@ -21675,165 +22239,178 @@ static int __Pyx_modinit_function_export_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ - if (__Pyx_ExportFunction("color_cyan", (void (*)(void))__pyx_f_5ktlib_color_cyan, "std::string (std::string const &, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("color_green", (void (*)(void))__pyx_f_5ktlib_color_green, "std::string (std::string const &, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("color_red", (void (*)(void))__pyx_f_5ktlib_color_red, "std::string (std::string const &, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("make_list_equal", (void (*)(void))__pyx_f_5ktlib_make_list_equal, "void (std::vector &, std::vector &, struct __pyx_opt_args_5ktlib_make_list_equal *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("write_samples", (void (*)(void))__pyx_f_5ktlib_write_samples, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("compare_entity", (void (*)(void))__pyx_f_5ktlib_compare_entity, "bool (std::string const &, std::string const &, std::string &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; } static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - __pyx_vtabptr_5ktlib_Action = &__pyx_vtable_5ktlib_Action; - __pyx_vtable_5ktlib_Action.read_config_from_file = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Action_read_config_from_file; - __pyx_vtable_5ktlib_Action.login = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Action_login; - __pyx_vtable_5ktlib_Action.get_problem_url = (std::string (*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Action_get_problem_url; - __pyx_vtable_5ktlib_Action.get_problem_id = (std::string (*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Action_get_problem_id; - __pyx_vtable_5ktlib_Action.get_url = (std::string (*)(struct __pyx_obj_5ktlib_Action *, std::string const &, struct __pyx_opt_args_5ktlib_6Action_get_url *__pyx_optional_args))__pyx_f_5ktlib_6Action_get_url; - __pyx_vtable_5ktlib_Action._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Action__act; - if (PyType_Ready(&__pyx_type_5ktlib_Action) < 0) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_type_3src_5ktlib_ConfigError.tp_base = (&((PyTypeObject*)PyExc_Exception)[0]); + if (PyType_Ready(&__pyx_type_3src_5ktlib_ConfigError) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_3src_5ktlib_ConfigError.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_ConfigError.tp_dictoffset && __pyx_type_3src_5ktlib_ConfigError.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_ConfigError.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ConfigError, (PyObject *)&__pyx_type_3src_5ktlib_ConfigError) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_ConfigError) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_ConfigError = &__pyx_type_3src_5ktlib_ConfigError; + __pyx_vtabptr_3src_5ktlib_Action = &__pyx_vtable_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Action.get_url = (PyObject *(*)(struct __pyx_obj_3src_5ktlib_Action *, PyObject *, struct __pyx_opt_args_3src_5ktlib_6Action_get_url *__pyx_optional_args))__pyx_f_3src_5ktlib_6Action_get_url; + __pyx_vtable_3src_5ktlib_Action.read_config_from_file = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Action_read_config_from_file; + __pyx_vtable_3src_5ktlib_Action.login = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Action_login; + __pyx_vtable_3src_5ktlib_Action.get_problem_id = (PyObject *(*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Action_get_problem_id; + __pyx_vtable_3src_5ktlib_Action.get_problem_url = (PyObject *(*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Action_get_problem_url; + __pyx_vtable_3src_5ktlib_Action._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Action__act; + __pyx_vtable_3src_5ktlib_Action.act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *, int __pyx_skip_dispatch))__pyx_f_3src_5ktlib_6Action_act; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Action) < 0) __PYX_ERR(0, 160, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_3src_5ktlib_Action.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Action.tp_dictoffset && __pyx_type_3src_5ktlib_Action.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Action.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Action.tp_dict, __pyx_vtabptr_3src_5ktlib_Action) < 0) __PYX_ERR(0, 160, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Action, (PyObject *)&__pyx_type_3src_5ktlib_Action) < 0) __PYX_ERR(0, 160, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Action) < 0) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Action = &__pyx_type_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_SampleData) < 0) __PYX_ERR(0, 287, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Action.tp_print = 0; + __pyx_type_3src_5ktlib_SampleData.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Action.tp_dictoffset && __pyx_type_5ktlib_Action.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Action.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_SampleData.tp_dictoffset && __pyx_type_3src_5ktlib_SampleData.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_SampleData.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Action.tp_dict, __pyx_vtabptr_5ktlib_Action) < 0) __PYX_ERR(0, 172, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Action, (PyObject *)&__pyx_type_5ktlib_Action) < 0) __PYX_ERR(0, 172, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Action) < 0) __PYX_ERR(0, 172, __pyx_L1_error) - __pyx_ptype_5ktlib_Action = &__pyx_type_5ktlib_Action; - __pyx_vtabptr_5ktlib_Gen = &__pyx_vtable_5ktlib_Gen; - __pyx_vtable_5ktlib_Gen.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Gen.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_3Gen__act; - __pyx_vtable_5ktlib_Gen._gen_samples = (PyObject *(*)(struct __pyx_obj_5ktlib_Gen *))__pyx_f_5ktlib_3Gen__gen_samples; - __pyx_type_5ktlib_Gen.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Gen) < 0) __PYX_ERR(0, 306, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SampleData, (PyObject *)&__pyx_type_3src_5ktlib_SampleData) < 0) __PYX_ERR(0, 287, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_SampleData) < 0) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_SampleData = &__pyx_type_3src_5ktlib_SampleData; + __pyx_vtabptr_3src_5ktlib_Gen = &__pyx_vtable_3src_5ktlib_Gen; + __pyx_vtable_3src_5ktlib_Gen.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Gen.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_3Gen__act; + __pyx_vtable_3src_5ktlib_Gen._gen_samples = (void (*)(struct __pyx_obj_3src_5ktlib_Gen *))__pyx_f_3src_5ktlib_3Gen__gen_samples; + __pyx_type_3src_5ktlib_Gen.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Gen) < 0) __PYX_ERR(0, 316, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Gen.tp_print = 0; + __pyx_type_3src_5ktlib_Gen.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Gen.tp_dictoffset && __pyx_type_5ktlib_Gen.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Gen.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Gen.tp_dictoffset && __pyx_type_3src_5ktlib_Gen.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Gen.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Gen.tp_dict, __pyx_vtabptr_5ktlib_Gen) < 0) __PYX_ERR(0, 306, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Gen, (PyObject *)&__pyx_type_5ktlib_Gen) < 0) __PYX_ERR(0, 306, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Gen) < 0) __PYX_ERR(0, 306, __pyx_L1_error) - __pyx_ptype_5ktlib_Gen = &__pyx_type_5ktlib_Gen; - __pyx_vtabptr_5ktlib_Test = &__pyx_vtable_5ktlib_Test; - __pyx_vtable_5ktlib_Test.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Test.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_4Test__act; - __pyx_vtable_5ktlib_Test.detect_file_name = (PyObject *(*)(struct __pyx_obj_5ktlib_Test *))__pyx_f_5ktlib_4Test_detect_file_name; - __pyx_type_5ktlib_Test.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Test) < 0) __PYX_ERR(0, 388, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Gen.tp_dict, __pyx_vtabptr_3src_5ktlib_Gen) < 0) __PYX_ERR(0, 316, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Gen, (PyObject *)&__pyx_type_3src_5ktlib_Gen) < 0) __PYX_ERR(0, 316, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Gen) < 0) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Gen = &__pyx_type_3src_5ktlib_Gen; + if (PyType_Ready(&__pyx_type_3src_5ktlib_RunnableFile) < 0) __PYX_ERR(0, 402, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Test.tp_print = 0; + __pyx_type_3src_5ktlib_RunnableFile.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Test.tp_dictoffset && __pyx_type_5ktlib_Test.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Test.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_RunnableFile.tp_dictoffset && __pyx_type_3src_5ktlib_RunnableFile.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_RunnableFile.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Test.tp_dict, __pyx_vtabptr_5ktlib_Test) < 0) __PYX_ERR(0, 388, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Test, (PyObject *)&__pyx_type_5ktlib_Test) < 0) __PYX_ERR(0, 388, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Test) < 0) __PYX_ERR(0, 388, __pyx_L1_error) - __pyx_ptype_5ktlib_Test = &__pyx_type_5ktlib_Test; - __pyx_type_5ktlib_ConfigError.tp_base = (&((PyTypeObject*)PyExc_Exception)[0]); - if (PyType_Ready(&__pyx_type_5ktlib_ConfigError) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RunnableFile, (PyObject *)&__pyx_type_3src_5ktlib_RunnableFile) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_RunnableFile) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_RunnableFile = &__pyx_type_3src_5ktlib_RunnableFile; + __pyx_vtabptr_3src_5ktlib_Test = &__pyx_vtable_3src_5ktlib_Test; + __pyx_vtable_3src_5ktlib_Test.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Test.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_4Test__act; + __pyx_vtable_3src_5ktlib_Test.detect_file_name = (void (*)(struct __pyx_obj_3src_5ktlib_Test *))__pyx_f_3src_5ktlib_4Test_detect_file_name; + __pyx_type_3src_5ktlib_Test.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Test) < 0) __PYX_ERR(0, 415, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_ConfigError.tp_print = 0; + __pyx_type_3src_5ktlib_Test.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_ConfigError.tp_dictoffset && __pyx_type_5ktlib_ConfigError.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_ConfigError.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Test.tp_dictoffset && __pyx_type_3src_5ktlib_Test.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Test.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ConfigError, (PyObject *)&__pyx_type_5ktlib_ConfigError) < 0) __PYX_ERR(0, 47, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_ConfigError) < 0) __PYX_ERR(0, 47, __pyx_L1_error) - __pyx_ptype_5ktlib_ConfigError = &__pyx_type_5ktlib_ConfigError; - __pyx_vtabptr_5ktlib_Submit = &__pyx_vtable_5ktlib_Submit; - __pyx_vtable_5ktlib_Submit.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Submit.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Submit__act; - __pyx_vtable_5ktlib_Submit.is_finished = (bool (*)(struct __pyx_obj_5ktlib_Submit *, PyObject *, PyObject *, std::string &, std::string))__pyx_f_5ktlib_6Submit_is_finished; - __pyx_vtable_5ktlib_Submit._render_result = (PyObject *(*)(struct __pyx_obj_5ktlib_Submit *, std::string))__pyx_f_5ktlib_6Submit__render_result; - __pyx_vtable_5ktlib_Submit.detect_file_name = (PyObject *(*)(struct __pyx_obj_5ktlib_Submit *))__pyx_f_5ktlib_6Submit_detect_file_name; - __pyx_type_5ktlib_Submit.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Submit) < 0) __PYX_ERR(0, 540, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Test.tp_dict, __pyx_vtabptr_3src_5ktlib_Test) < 0) __PYX_ERR(0, 415, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Test, (PyObject *)&__pyx_type_3src_5ktlib_Test) < 0) __PYX_ERR(0, 415, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Test) < 0) __PYX_ERR(0, 415, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Test = &__pyx_type_3src_5ktlib_Test; + __pyx_vtabptr_3src_5ktlib_Submit = &__pyx_vtable_3src_5ktlib_Submit; + __pyx_vtable_3src_5ktlib_Submit.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Submit.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Submit__act; + __pyx_vtable_3src_5ktlib_Submit.is_finished = (int (*)(struct __pyx_obj_3src_5ktlib_Submit *, PyObject *, PyObject *, PyObject *, PyObject *))__pyx_f_3src_5ktlib_6Submit_is_finished; + __pyx_vtable_3src_5ktlib_Submit._render_result = (void (*)(struct __pyx_obj_3src_5ktlib_Submit *, PyObject *))__pyx_f_3src_5ktlib_6Submit__render_result; + __pyx_vtable_3src_5ktlib_Submit.detect_file_name = (PyObject *(*)(struct __pyx_obj_3src_5ktlib_Submit *))__pyx_f_3src_5ktlib_6Submit_detect_file_name; + __pyx_type_3src_5ktlib_Submit.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Submit) < 0) __PYX_ERR(0, 587, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Submit.tp_print = 0; + __pyx_type_3src_5ktlib_Submit.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Submit.tp_dictoffset && __pyx_type_5ktlib_Submit.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Submit.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Submit.tp_dictoffset && __pyx_type_3src_5ktlib_Submit.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Submit.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Submit.tp_dict, __pyx_vtabptr_5ktlib_Submit) < 0) __PYX_ERR(0, 540, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Submit, (PyObject *)&__pyx_type_5ktlib_Submit) < 0) __PYX_ERR(0, 540, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Submit) < 0) __PYX_ERR(0, 540, __pyx_L1_error) - __pyx_ptype_5ktlib_Submit = &__pyx_type_5ktlib_Submit; - __pyx_vtabptr_5ktlib_Config = &__pyx_vtable_5ktlib_Config; - __pyx_vtable_5ktlib_Config.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Config.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Config__act; - __pyx_vtable_5ktlib_Config.add_template = (PyObject *(*)(struct __pyx_obj_5ktlib_Config *))__pyx_f_5ktlib_6Config_add_template; - __pyx_vtable_5ktlib_Config.remove_template = (PyObject *(*)(struct __pyx_obj_5ktlib_Config *))__pyx_f_5ktlib_6Config_remove_template; - __pyx_vtable_5ktlib_Config.update_default = (PyObject *(*)(struct __pyx_obj_5ktlib_Config *))__pyx_f_5ktlib_6Config_update_default; - __pyx_type_5ktlib_Config.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Config) < 0) __PYX_ERR(0, 742, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Submit.tp_dict, __pyx_vtabptr_3src_5ktlib_Submit) < 0) __PYX_ERR(0, 587, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Submit, (PyObject *)&__pyx_type_3src_5ktlib_Submit) < 0) __PYX_ERR(0, 587, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Submit) < 0) __PYX_ERR(0, 587, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Submit = &__pyx_type_3src_5ktlib_Submit; + __pyx_vtabptr_3src_5ktlib_Config = &__pyx_vtable_3src_5ktlib_Config; + __pyx_vtable_3src_5ktlib_Config.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Config.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Config__act__pyx_wrap_1; + __pyx_vtable_3src_5ktlib_Config.add_template = (PyObject *(*)(struct __pyx_obj_3src_5ktlib_Config *))__pyx_f_3src_5ktlib_6Config_add_template; + __pyx_vtable_3src_5ktlib_Config.remove_template = (PyObject *(*)(struct __pyx_obj_3src_5ktlib_Config *))__pyx_f_3src_5ktlib_6Config_remove_template; + __pyx_vtable_3src_5ktlib_Config.update_default = (void (*)(struct __pyx_obj_3src_5ktlib_Config *))__pyx_f_3src_5ktlib_6Config_update_default; + __pyx_vtable_3src_5ktlib_Config._act = (void (*)(struct __pyx_obj_3src_5ktlib_Config *))__pyx_f_3src_5ktlib_6Config__act; + __pyx_type_3src_5ktlib_Config.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Config) < 0) __PYX_ERR(0, 792, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Config.tp_print = 0; + __pyx_type_3src_5ktlib_Config.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Config.tp_dictoffset && __pyx_type_5ktlib_Config.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Config.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Config.tp_dictoffset && __pyx_type_3src_5ktlib_Config.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Config.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Config.tp_dict, __pyx_vtabptr_5ktlib_Config) < 0) __PYX_ERR(0, 742, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Config, (PyObject *)&__pyx_type_5ktlib_Config) < 0) __PYX_ERR(0, 742, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Config) < 0) __PYX_ERR(0, 742, __pyx_L1_error) - __pyx_ptype_5ktlib_Config = &__pyx_type_5ktlib_Config; - __pyx_vtabptr_5ktlib_Open = &__pyx_vtable_5ktlib_Open; - __pyx_vtable_5ktlib_Open.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Open.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_4Open__act; - __pyx_type_5ktlib_Open.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Open) < 0) __PYX_ERR(0, 867, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Config.tp_dict, __pyx_vtabptr_3src_5ktlib_Config) < 0) __PYX_ERR(0, 792, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Config, (PyObject *)&__pyx_type_3src_5ktlib_Config) < 0) __PYX_ERR(0, 792, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Config) < 0) __PYX_ERR(0, 792, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Config = &__pyx_type_3src_5ktlib_Config; + __pyx_vtabptr_3src_5ktlib_Open = &__pyx_vtable_3src_5ktlib_Open; + __pyx_vtable_3src_5ktlib_Open.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Open.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_4Open__act; + __pyx_type_3src_5ktlib_Open.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Open) < 0) __PYX_ERR(0, 917, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Open.tp_print = 0; + __pyx_type_3src_5ktlib_Open.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Open.tp_dictoffset && __pyx_type_5ktlib_Open.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Open.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Open.tp_dictoffset && __pyx_type_3src_5ktlib_Open.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Open.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Open.tp_dict, __pyx_vtabptr_5ktlib_Open) < 0) __PYX_ERR(0, 867, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Open, (PyObject *)&__pyx_type_5ktlib_Open) < 0) __PYX_ERR(0, 867, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Open) < 0) __PYX_ERR(0, 867, __pyx_L1_error) - __pyx_ptype_5ktlib_Open = &__pyx_type_5ktlib_Open; - __pyx_vtabptr_5ktlib_Version = &__pyx_vtable_5ktlib_Version; - __pyx_vtable_5ktlib_Version.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Version.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_7Version__act; - __pyx_type_5ktlib_Version.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Version) < 0) __PYX_ERR(0, 871, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Open.tp_dict, __pyx_vtabptr_3src_5ktlib_Open) < 0) __PYX_ERR(0, 917, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Open, (PyObject *)&__pyx_type_3src_5ktlib_Open) < 0) __PYX_ERR(0, 917, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Open) < 0) __PYX_ERR(0, 917, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Open = &__pyx_type_3src_5ktlib_Open; + __pyx_vtabptr_3src_5ktlib_Version = &__pyx_vtable_3src_5ktlib_Version; + __pyx_vtable_3src_5ktlib_Version.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Version.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_7Version__act; + __pyx_type_3src_5ktlib_Version.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Version) < 0) __PYX_ERR(0, 921, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Version.tp_print = 0; + __pyx_type_3src_5ktlib_Version.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Version.tp_dictoffset && __pyx_type_5ktlib_Version.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Version.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Version.tp_dictoffset && __pyx_type_3src_5ktlib_Version.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Version.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Version.tp_dict, __pyx_vtabptr_5ktlib_Version) < 0) __PYX_ERR(0, 871, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Version, (PyObject *)&__pyx_type_5ktlib_Version) < 0) __PYX_ERR(0, 871, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Version) < 0) __PYX_ERR(0, 871, __pyx_L1_error) - __pyx_ptype_5ktlib_Version = &__pyx_type_5ktlib_Version; - __pyx_vtabptr_5ktlib_Update = &__pyx_vtable_5ktlib_Update; - __pyx_vtable_5ktlib_Update.__pyx_base = *__pyx_vtabptr_5ktlib_Action; - __pyx_vtable_5ktlib_Update.__pyx_base._act = (PyObject *(*)(struct __pyx_obj_5ktlib_Action *))__pyx_f_5ktlib_6Update__act; - __pyx_type_5ktlib_Update.tp_base = __pyx_ptype_5ktlib_Action; - if (PyType_Ready(&__pyx_type_5ktlib_Update) < 0) __PYX_ERR(0, 875, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Version.tp_dict, __pyx_vtabptr_3src_5ktlib_Version) < 0) __PYX_ERR(0, 921, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Version, (PyObject *)&__pyx_type_3src_5ktlib_Version) < 0) __PYX_ERR(0, 921, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Version) < 0) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Version = &__pyx_type_3src_5ktlib_Version; + __pyx_vtabptr_3src_5ktlib_Update = &__pyx_vtable_3src_5ktlib_Update; + __pyx_vtable_3src_5ktlib_Update.__pyx_base = *__pyx_vtabptr_3src_5ktlib_Action; + __pyx_vtable_3src_5ktlib_Update.__pyx_base._act = (void (*)(struct __pyx_obj_3src_5ktlib_Action *))__pyx_f_3src_5ktlib_6Update__act; + __pyx_type_3src_5ktlib_Update.tp_base = __pyx_ptype_3src_5ktlib_Action; + if (PyType_Ready(&__pyx_type_3src_5ktlib_Update) < 0) __PYX_ERR(0, 925, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5ktlib_Update.tp_print = 0; + __pyx_type_3src_5ktlib_Update.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5ktlib_Update.tp_dictoffset && __pyx_type_5ktlib_Update.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5ktlib_Update.tp_getattro = __Pyx_PyObject_GenericGetAttr; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3src_5ktlib_Update.tp_dictoffset && __pyx_type_3src_5ktlib_Update.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_3src_5ktlib_Update.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5ktlib_Update.tp_dict, __pyx_vtabptr_5ktlib_Update) < 0) __PYX_ERR(0, 875, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Update, (PyObject *)&__pyx_type_5ktlib_Update) < 0) __PYX_ERR(0, 875, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5ktlib_Update) < 0) __PYX_ERR(0, 875, __pyx_L1_error) - __pyx_ptype_5ktlib_Update = &__pyx_type_5ktlib_Update; + if (__Pyx_SetVtable(__pyx_type_3src_5ktlib_Update.tp_dict, __pyx_vtabptr_3src_5ktlib_Update) < 0) __PYX_ERR(0, 925, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Update, (PyObject *)&__pyx_type_3src_5ktlib_Update) < 0) __PYX_ERR(0, 925, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3src_5ktlib_Update) < 0) __PYX_ERR(0, 925, __pyx_L1_error) + __pyx_ptype_3src_5ktlib_Update = &__pyx_type_3src_5ktlib_Update; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -21960,7 +22537,6 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_ktlib(PyObject *__pyx_pyinit_modul PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - std::string __pyx_t_4; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { @@ -22037,14 +22613,14 @@ if (!__Pyx_RefNanny) { #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - if (__pyx_module_is_main_ktlib) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_src__ktlib) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "ktlib")) { - if (unlikely(PyDict_SetItemString(modules, "ktlib", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "src.ktlib")) { + if (unlikely(PyDict_SetItemString(modules, "src.ktlib", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -22055,7 +22631,7 @@ if (!__Pyx_RefNanny) { /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); - if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error; + (void)__Pyx_modinit_function_export_code(); if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; (void)__Pyx_modinit_type_import_code(); (void)__Pyx_modinit_variable_import_code(); @@ -22065,336 +22641,378 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "ktlib.pyx":3 - * #cython: language_level=3, c_string_type=unicode, c_string_encoding=utf8, boundscheck=False, cdivision=True, wraparound=False + /* "src/ktlib.pyx":3 + * # cython: language_level=3, boundscheck=False, cdivision=True, wraparound=False * # distutils: language=c++ * import sys # <<<<<<<<<<<<<< - * from libcpp.string cimport string - * from libcpp.vector cimport vector + * from pathlib import Path + * import requests */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":7 - * from libcpp.vector cimport vector - * from libcpp cimport bool as bool_t - * import requests # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":4 + * # distutils: language=c++ + * import sys + * from pathlib import Path # <<<<<<<<<<<<<< + * import requests * import os - * import re */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_requests, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_Path); + __Pyx_GIVEREF(__pyx_n_s_Path); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Path); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_pathlib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_requests, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Path, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":8 - * from libcpp cimport bool as bool_t + /* "src/ktlib.pyx":5 + * import sys + * from pathlib import Path + * import requests # <<<<<<<<<<<<<< + * import os + * import re + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_s_requests, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_requests, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "src/ktlib.pyx":6 + * from pathlib import Path * import requests * import os # <<<<<<<<<<<<<< * import re * import time */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":9 + /* "src/ktlib.pyx":7 * import requests * import os * import re # <<<<<<<<<<<<<< * import time * import shutil */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":10 + /* "src/ktlib.pyx":8 * import os * import re * import time # <<<<<<<<<<<<<< * import shutil * from bs4 import BeautifulSoup */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":11 + /* "src/ktlib.pyx":9 * import re * import time * import shutil # <<<<<<<<<<<<<< * from bs4 import BeautifulSoup * import multiprocessing */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_shutil, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shutil, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_shutil, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shutil, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":12 + /* "src/ktlib.pyx":10 * import time * import shutil * from bs4 import BeautifulSoup # <<<<<<<<<<<<<< * import multiprocessing * import concurrent.futures */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_BeautifulSoup); __Pyx_GIVEREF(__pyx_n_s_BeautifulSoup); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_BeautifulSoup); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_bs4, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BeautifulSoup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_BeautifulSoup); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_bs4, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_BeautifulSoup, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BeautifulSoup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BeautifulSoup, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":13 + /* "src/ktlib.pyx":11 * import shutil * from bs4 import BeautifulSoup * import multiprocessing # <<<<<<<<<<<<<< * import concurrent.futures * from reprint import output */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":14 + /* "src/ktlib.pyx":12 * from bs4 import BeautifulSoup * import multiprocessing * import concurrent.futures # <<<<<<<<<<<<<< * from reprint import output - * from html.parser import HTMLParser - */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_concurrent_futures, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_concurrent, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "ktlib.pyx":15 - * import multiprocessing - * import concurrent.futures - * from reprint import output # <<<<<<<<<<<<<< - * from html.parser import HTMLParser * import emoji */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_output); - __Pyx_GIVEREF(__pyx_n_s_output); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_output); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_reprint, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_concurrent_futures, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_output); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_output, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_concurrent, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":16 + /* "src/ktlib.pyx":13 + * import multiprocessing * import concurrent.futures - * from reprint import output - * from html.parser import HTMLParser # <<<<<<<<<<<<<< + * from reprint import output # <<<<<<<<<<<<<< * import emoji - * from collections import namedtuple + * from html.parser import HTMLParser */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_HTMLParser); - __Pyx_GIVEREF(__pyx_n_s_HTMLParser); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_HTMLParser); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_html_parser, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_output); + __Pyx_GIVEREF(__pyx_n_s_output); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_output); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_reprint, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_HTMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTMLParser, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_output, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":17 + /* "src/ktlib.pyx":14 + * import concurrent.futures * from reprint import output - * from html.parser import HTMLParser * import emoji # <<<<<<<<<<<<<< + * from html.parser import HTMLParser * from collections import namedtuple - * import subprocess */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_emoji, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_emoji, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_emoji, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_emoji, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":18 - * from html.parser import HTMLParser + /* "src/ktlib.pyx":15 + * from reprint import output * import emoji - * from collections import namedtuple # <<<<<<<<<<<<<< - * import subprocess + * from html.parser import HTMLParser # <<<<<<<<<<<<<< + * from collections import namedtuple * from subprocess import Popen, PIPE */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_namedtuple); - __Pyx_GIVEREF(__pyx_n_s_namedtuple); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_namedtuple); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_HTMLParser); + __Pyx_GIVEREF(__pyx_n_s_HTMLParser); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_HTMLParser); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_html_parser, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_HTMLParser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTMLParser, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":19 + /* "src/ktlib.pyx":16 * import emoji - * from collections import namedtuple - * import subprocess # <<<<<<<<<<<<<< + * from html.parser import HTMLParser + * from collections import namedtuple # <<<<<<<<<<<<<< * from subprocess import Popen, PIPE - * import json + * import subprocess */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_subprocess, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_namedtuple); + __Pyx_GIVEREF(__pyx_n_s_namedtuple); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_namedtuple); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_subprocess, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":20 + /* "src/ktlib.pyx":17 + * from html.parser import HTMLParser * from collections import namedtuple - * import subprocess * from subprocess import Popen, PIPE # <<<<<<<<<<<<<< + * import subprocess * import json - * import shlex */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_Popen); __Pyx_GIVEREF(__pyx_n_s_Popen); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Popen); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Popen); __Pyx_INCREF(__pyx_n_s_PIPE); __Pyx_GIVEREF(__pyx_n_s_PIPE); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_PIPE); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_subprocess, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Popen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_PIPE); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_subprocess, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Popen, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Popen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Popen, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PIPE, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PIPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + + /* "src/ktlib.pyx":18 + * from collections import namedtuple + * from subprocess import Popen, PIPE + * import subprocess # <<<<<<<<<<<<<< + * import json + * import shlex + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_subprocess, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PIPE, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_subprocess, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":21 - * import subprocess + /* "src/ktlib.pyx":19 * from subprocess import Popen, PIPE + * import subprocess * import json # <<<<<<<<<<<<<< * import shlex * from resource import * */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_json, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_json, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_json, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":22 - * from subprocess import Popen, PIPE + /* "src/ktlib.pyx":20 + * import subprocess * import json * import shlex # <<<<<<<<<<<<<< * from resource import * * import psutil */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_shlex, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shlex, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_Import(__pyx_n_s_shlex, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shlex, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":23 + /* "src/ktlib.pyx":21 * import json * import shlex * from resource import * # <<<<<<<<<<<<<< * import psutil * import configparser */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s__50); - __Pyx_GIVEREF(__pyx_n_s__50); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__50); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_resource, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_import_star(__pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s__49); + __Pyx_GIVEREF(__pyx_n_s__49); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__49); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_resource, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_import_star(__pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":24 + /* "src/ktlib.pyx":22 * import shlex * from resource import * * import psutil # <<<<<<<<<<<<<< * import configparser * import webbrowser */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_psutil, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_psutil, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_psutil, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_psutil, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":25 + /* "src/ktlib.pyx":23 * from resource import * * import psutil * import configparser # <<<<<<<<<<<<<< * import webbrowser * import signal */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_configparser, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_configparser, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_configparser, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_configparser, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":26 + /* "src/ktlib.pyx":24 * import psutil * import configparser * import webbrowser # <<<<<<<<<<<<<< * import signal * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_webbrowser, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_webbrowser, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_n_s_webbrowser, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_webbrowser, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":27 + /* "src/ktlib.pyx":25 * import configparser * import webbrowser * import signal # <<<<<<<<<<<<<< * + * cimport cython + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_s_signal, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_signal, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "src/ktlib.pyx":31 + * from libcpp cimport bool as bool_t + * from libc.stdio cimport FILE, fopen, fclose, fflush + * from .version import version # <<<<<<<<<<<<<< * __all__ = [ + * 'arg_parse', */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_signal, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_version); + __Pyx_GIVEREF(__pyx_n_s_version); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_version); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_version, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_signal, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":29 - * import signal - * + /* "src/ktlib.pyx":32 + * from libc.stdio cimport FILE, fopen, fclose, fflush + * from .version import version * __all__ = [ # <<<<<<<<<<<<<< * 'arg_parse', * 'color_red', */ - __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_u_arg_parse); __Pyx_GIVEREF(__pyx_n_u_arg_parse); @@ -22408,83 +23026,56 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_u_exit_gracefully); __Pyx_GIVEREF(__pyx_n_u_exit_gracefully); PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_exit_gracefully); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":37 - * - * # -------------- Global varible ---------------- - * cdef const char* _KATTIS_RC_URL = 'https://open.kattis.com/download/kattisrc' # <<<<<<<<<<<<<< - * cdef object _HEADERS = {'User-Agent': 'kt'} - * cdef const char* _VERSION = '0.0.4' - */ - __pyx_v_5ktlib__KATTIS_RC_URL = ((char const *)"https://open.kattis.com/download/kattisrc"); - - /* "ktlib.pyx":38 + /* "src/ktlib.pyx":41 * # -------------- Global varible ---------------- - * cdef const char* _KATTIS_RC_URL = 'https://open.kattis.com/download/kattisrc' + * DEF _KATTIS_RC_URL = 'https://open.kattis.com/download/kattisrc' * cdef object _HEADERS = {'User-Agent': 'kt'} # <<<<<<<<<<<<<< - * cdef const char* _VERSION = '0.0.4' - * cdef const char* _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' + * + * DEF _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_User_Agent, __pyx_n_u_kt) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_v_5ktlib__HEADERS); - __Pyx_DECREF_SET(__pyx_v_5ktlib__HEADERS, __pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_User_Agent, __pyx_n_u_kt) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_v_3src_5ktlib__HEADERS); + __Pyx_DECREF_SET(__pyx_v_3src_5ktlib__HEADERS, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":39 - * cdef const char* _KATTIS_RC_URL = 'https://open.kattis.com/download/kattisrc' - * cdef object _HEADERS = {'User-Agent': 'kt'} - * cdef const char* _VERSION = '0.0.4' # <<<<<<<<<<<<<< - * cdef const char* _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' - * cdef list test_subprocesses = [] - */ - __pyx_v_5ktlib__VERSION = ((char const *)"0.0.4"); - - /* "ktlib.pyx":40 - * cdef object _HEADERS = {'User-Agent': 'kt'} - * cdef const char* _VERSION = '0.0.4' - * cdef const char* _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' # <<<<<<<<<<<<<< - * cdef list test_subprocesses = [] - * # global structs - */ - __pyx_v_5ktlib__PYPI_PACKAGE_INFO = ((char const *)"https://pypi.org/pypi/kttool/json"); - - /* "ktlib.pyx":41 - * cdef const char* _VERSION = '0.0.4' - * cdef const char* _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' + /* "src/ktlib.pyx":44 + * + * DEF _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' * cdef list test_subprocesses = [] # <<<<<<<<<<<<<< * # global structs * PLanguage = namedtuple('ProgrammingLanguage', */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_v_5ktlib_test_subprocesses); - __Pyx_DECREF_SET(__pyx_v_5ktlib_test_subprocesses, ((PyObject*)__pyx_t_1)); + __Pyx_XGOTREF(__pyx_v_3src_5ktlib_test_subprocesses); + __Pyx_DECREF_SET(__pyx_v_3src_5ktlib_test_subprocesses, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":43 + /* "src/ktlib.pyx":46 * cdef list test_subprocesses = [] * # global structs * PLanguage = namedtuple('ProgrammingLanguage', # <<<<<<<<<<<<<< * ['alias', 'extension', 'full_name', 'pre_script', 'script', 'post_script'] * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "ktlib.pyx":44 + /* "src/ktlib.pyx":47 * # global structs * PLanguage = namedtuple('ProgrammingLanguage', * ['alias', 'extension', 'full_name', 'pre_script', 'script', 'post_script'] # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_alias); __Pyx_GIVEREF(__pyx_n_u_alias); @@ -22505,14 +23096,14 @@ if (!__Pyx_RefNanny) { __Pyx_GIVEREF(__pyx_n_u_post_script); PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_u_post_script); - /* "ktlib.pyx":43 + /* "src/ktlib.pyx":46 * cdef list test_subprocesses = [] * # global structs * PLanguage = namedtuple('ProgrammingLanguage', # <<<<<<<<<<<<<< * ['alias', 'extension', 'full_name', 'pre_script', 'script', 'post_script'] * ) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_u_ProgrammingLanguage); __Pyx_GIVEREF(__pyx_n_u_ProgrammingLanguage); @@ -22520,350 +23111,229 @@ if (!__Pyx_RefNanny) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PLanguage, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PLanguage, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":51 + /* "src/ktlib.pyx":54 * - * cdef object map_template_to_plang = { + * cdef dict map_template_to_plang = { * 'c': PLanguage('c', 'c','C', # <<<<<<<<<<<<<< * 'gcc $%file%$.c -o $%file%$.out', * './$%file%$.out', */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_c, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_c, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":56 + /* "src/ktlib.pyx":59 * 'rm $%file%$.out' * ), * 'cpp': PLanguage('cpp', 'cpp', 'C++', # <<<<<<<<<<<<<< * 'g++ -std=c++14 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -O3 $%file%$.cpp -o $%file%$.out', * './$%file%$.out', */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_cpp, __pyx_t_3) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_cpp, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":61 + /* "src/ktlib.pyx":64 * 'rm $%file%$.out' * ), * 'cc': PLanguage('cc', 'cc', 'C++', # <<<<<<<<<<<<<< * 'g++ -std=c++14 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -O3 $%file%$.cc -o $%file%$.out', * './$%file%$.out', */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_cc, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_cc, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":66 + /* "src/ktlib.pyx":69 * 'rm $%file%$.out' * ), * 'go': PLanguage('go', 'go', 'Go', # <<<<<<<<<<<<<< * 'go build -o $%file%$', * './$%file%$', */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_go, __pyx_t_3) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_go, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":71 + /* "src/ktlib.pyx":74 * 'rm $%file%$' * ), * 'java': PLanguage('java', 'java', 'Java', # <<<<<<<<<<<<<< * 'javac *.java', * './$%file%$', */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_java, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_java, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":76 + /* "src/ktlib.pyx":79 * 'rm $%file%$' * ), * 'js': PLanguage('js', 'js', 'JavaScript', # <<<<<<<<<<<<<< * '', * 'node $%file%$.js', */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_js, __pyx_t_3) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_js, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":81 + /* "src/ktlib.pyx":84 * '' * ), * 'rs': PLanguage('rs', 'rs', 'Rust', # <<<<<<<<<<<<<< * 'rustc $%file%$.rs', * './$%file%$', */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_rs, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_rs, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ktlib.pyx":86 + /* "src/ktlib.pyx":89 * 'rm $%file%$' * ), * 'py2': PLanguage('py2', 'py', 'Python 2', # <<<<<<<<<<<<<< * '', * 'python2 $%file%$.py', */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_py2, __pyx_t_3) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_py2, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ktlib.pyx":91 + /* "src/ktlib.pyx":94 * '' * ), * 'py3': PLanguage('py3', 'py', 'Python 3', # <<<<<<<<<<<<<< * '', * 'python3 $%file%$.py', */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PLanguage); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_py3, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_py3, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_v_5ktlib_map_template_to_plang); - __Pyx_DECREF_SET(__pyx_v_5ktlib_map_template_to_plang, __pyx_t_2); + __Pyx_XGOTREF(__pyx_v_3src_5ktlib_map_template_to_plang); + __Pyx_DECREF_SET(__pyx_v_3src_5ktlib_map_template_to_plang, ((PyObject*)__pyx_t_2)); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":101 - * # -------------- Color for formatting ---------------- - * cdef: - * string BOLD_SEQ = b'\033[1m' # <<<<<<<<<<<<<< - * string RESET_SEQ = b'\033[0m' - * string BLACK = b'\033[6;90m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_1m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) - __pyx_v_5ktlib_BOLD_SEQ = __pyx_t_4; - - /* "ktlib.pyx":102 - * cdef: - * string BOLD_SEQ = b'\033[1m' - * string RESET_SEQ = b'\033[0m' # <<<<<<<<<<<<<< - * string BLACK = b'\033[6;90m' - * string RED = b'\033[6;91m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_0m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_v_5ktlib_RESET_SEQ = __pyx_t_4; - - /* "ktlib.pyx":103 - * string BOLD_SEQ = b'\033[1m' - * string RESET_SEQ = b'\033[0m' - * string BLACK = b'\033[6;90m' # <<<<<<<<<<<<<< - * string RED = b'\033[6;91m' - * string GREEN = b'\033[6;92m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_90m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error) - __pyx_v_5ktlib_BLACK = __pyx_t_4; - - /* "ktlib.pyx":104 - * string RESET_SEQ = b'\033[0m' - * string BLACK = b'\033[6;90m' - * string RED = b'\033[6;91m' # <<<<<<<<<<<<<< - * string GREEN = b'\033[6;92m' - * string YELLOW = b'\033[6;93m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_91m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) - __pyx_v_5ktlib_RED = __pyx_t_4; - - /* "ktlib.pyx":105 - * string BLACK = b'\033[6;90m' - * string RED = b'\033[6;91m' - * string GREEN = b'\033[6;92m' # <<<<<<<<<<<<<< - * string YELLOW = b'\033[6;93m' - * string BLUE = b'\033[6;94m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_92m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error) - __pyx_v_5ktlib_GREEN = __pyx_t_4; - - /* "ktlib.pyx":106 - * string RED = b'\033[6;91m' - * string GREEN = b'\033[6;92m' - * string YELLOW = b'\033[6;93m' # <<<<<<<<<<<<<< - * string BLUE = b'\033[6;94m' - * string MAGENTA = b'\033[6;95m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_93m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error) - __pyx_v_5ktlib_YELLOW = __pyx_t_4; - - /* "ktlib.pyx":107 - * string GREEN = b'\033[6;92m' - * string YELLOW = b'\033[6;93m' - * string BLUE = b'\033[6;94m' # <<<<<<<<<<<<<< - * string MAGENTA = b'\033[6;95m' - * string CYAN = b'\033[6;96m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_94m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) - __pyx_v_5ktlib_BLUE = __pyx_t_4; - - /* "ktlib.pyx":108 - * string YELLOW = b'\033[6;93m' - * string BLUE = b'\033[6;94m' - * string MAGENTA = b'\033[6;95m' # <<<<<<<<<<<<<< - * string CYAN = b'\033[6;96m' - * string WHITE = b'\033[6;97m' - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_95m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error) - __pyx_v_5ktlib_MAGENTA = __pyx_t_4; - - /* "ktlib.pyx":109 - * string BLUE = b'\033[6;94m' - * string MAGENTA = b'\033[6;95m' - * string CYAN = b'\033[6;96m' # <<<<<<<<<<<<<< - * string WHITE = b'\033[6;97m' - * - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_96m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_v_5ktlib_CYAN = __pyx_t_4; - - /* "ktlib.pyx":110 - * string MAGENTA = b'\033[6;95m' - * string CYAN = b'\033[6;96m' - * string WHITE = b'\033[6;97m' # <<<<<<<<<<<<<< - * - * cpdef string color_cyan(const string& text) nogil: - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_6_97m); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) - __pyx_v_5ktlib_WHITE = __pyx_t_4; - - /* "ktlib.pyx":135 + /* "src/ktlib.pyx":123 + * return f'{RED}{text}{RESET_SEQ}' * + * log = print # <<<<<<<<<<<<<< * # -------------- Utility functions ---------------- - * cdef string ask_with_default(string qu, string default_val=b''): # <<<<<<<<<<<<<< - * ''' Print out `qu` to console and ask for input value from user - * If no input was provided by user, `default_val` will be returned instead - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__33); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error) - __pyx_k_ = __pyx_t_4; - - /* "ktlib.pyx":157 - * vector[string]& lhs, - * vector[string]& rhs, - * string pad_element = b'' # <<<<<<<<<<<<<< - * ) nogil: - * ''' Make two vector of string equation in length by padding with `pad_element` - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__33); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error) - __pyx_k__3 = __pyx_t_4; - - /* "ktlib.pyx":180 - * self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file - * - * cdef string get_url(self, const string& option, string default = b''): # <<<<<<<<<<<<<< - * ''' Get appropriate urls from kattisrc file - * Args: + * cdef str ask_with_default(str qu, str default_val=''): */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__33); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) - __pyx_k__4 = __pyx_t_4; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_builtin_print) < 0) __PYX_ERR(0, 123, __pyx_L1_error) - /* "ktlib.pyx":896 + /* "src/ktlib.pyx":946 * - * cdef object map_key_to_class = { + * cdef dict map_key_to_class = { * 'gen': Gen, # <<<<<<<<<<<<<< * 'test': Test, * 'submit': Submit, */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_gen, ((PyObject *)__pyx_ptype_5ktlib_Gen)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_gen, ((PyObject *)__pyx_ptype_3src_5ktlib_Gen)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) - /* "ktlib.pyx":897 - * cdef object map_key_to_class = { + /* "src/ktlib.pyx":947 + * cdef dict map_key_to_class = { * 'gen': Gen, * 'test': Test, # <<<<<<<<<<<<<< * 'submit': Submit, * 'config': Config, */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_test, ((PyObject *)__pyx_ptype_5ktlib_Test)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_test, ((PyObject *)__pyx_ptype_3src_5ktlib_Test)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) - /* "ktlib.pyx":898 + /* "src/ktlib.pyx":948 * 'gen': Gen, * 'test': Test, * 'submit': Submit, # <<<<<<<<<<<<<< * 'config': Config, * 'open': Open, */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_submit, ((PyObject *)__pyx_ptype_5ktlib_Submit)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_submit, ((PyObject *)__pyx_ptype_3src_5ktlib_Submit)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) - /* "ktlib.pyx":899 + /* "src/ktlib.pyx":949 * 'test': Test, * 'submit': Submit, * 'config': Config, # <<<<<<<<<<<<<< * 'open': Open, * 'version': Version, */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_config, ((PyObject *)__pyx_ptype_5ktlib_Config)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_config, ((PyObject *)__pyx_ptype_3src_5ktlib_Config)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) - /* "ktlib.pyx":900 + /* "src/ktlib.pyx":950 * 'submit': Submit, * 'config': Config, * 'open': Open, # <<<<<<<<<<<<<< * 'version': Version, * 'update': Update */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_open, ((PyObject *)__pyx_ptype_5ktlib_Open)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_open, ((PyObject *)__pyx_ptype_3src_5ktlib_Open)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) - /* "ktlib.pyx":901 + /* "src/ktlib.pyx":951 * 'config': Config, * 'open': Open, * 'version': Version, # <<<<<<<<<<<<<< * 'update': Update * } */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_version_2, ((PyObject *)__pyx_ptype_5ktlib_Version)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_version, ((PyObject *)__pyx_ptype_3src_5ktlib_Version)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) - /* "ktlib.pyx":902 + /* "src/ktlib.pyx":952 * 'open': Open, * 'version': Version, * 'update': Update # <<<<<<<<<<<<<< * } * */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_update, ((PyObject *)__pyx_ptype_5ktlib_Update)) < 0) __PYX_ERR(0, 896, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_v_5ktlib_map_key_to_class); - __Pyx_DECREF_SET(__pyx_v_5ktlib_map_key_to_class, __pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_update, ((PyObject *)__pyx_ptype_3src_5ktlib_Update)) < 0) __PYX_ERR(0, 946, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_v_3src_5ktlib_map_key_to_class); + __Pyx_DECREF_SET(__pyx_v_3src_5ktlib_map_key_to_class, ((PyObject*)__pyx_t_2)); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -22872,13 +23342,13 @@ if (!__Pyx_RefNanny) { * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5ktlib_13__pyx_unpickle_ConfigError, NULL, __pyx_n_s_ktlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3src_5ktlib_13__pyx_unpickle_ConfigError, NULL, __pyx_n_s_src_ktlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ConfigError, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ktlib.pyx":1 - * #cython: language_level=3, c_string_type=unicode, c_string_encoding=utf8, boundscheck=False, cdivision=True, wraparound=False # <<<<<<<<<<<<<< + /* "src/ktlib.pyx":1 + * # cython: language_level=3, boundscheck=False, cdivision=True, wraparound=False # <<<<<<<<<<<<<< * # distutils: language=c++ * import sys */ @@ -22887,14 +23357,6 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_std_3a__3a_string") - * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] - * - */ - /*--- Wrapped vars code ---*/ goto __pyx_L0; @@ -22904,11 +23366,11 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init ktlib", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init src.ktlib", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init ktlib"); + PyErr_SetString(PyExc_ImportError, "init src.ktlib"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -23105,6 +23567,13 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) return __Pyx_GetBuiltinName(name); } +/* PyUnicode_Unicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { + if (unlikely(obj == Py_None)) + obj = __pyx_kp_u_None; + return __Pyx_NewRef(obj); +} + /* JoinPyUnicode */ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, CYTHON_UNUSED Py_UCS4 max_char) { @@ -23167,6 +23636,27 @@ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_co #endif } +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { @@ -23389,47 +23879,25 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } #endif -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); +/* py_abs */ +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) { + if (likely(Py_SIZE(n) == -1)) { + return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]); } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); +#if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *copy = _PyLong_Copy((PyLongObject*)n); + if (likely(copy)) { + Py_SIZE(copy) = -(Py_SIZE(copy)); + } + return copy; } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); +#else + return PyNumber_Negative(n); #endif } +#endif /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( @@ -23497,6 +23965,28 @@ static int __Pyx_CheckKeywordStrings( return 0; } +/* PyObjectCallNoArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#else + if (likely(PyCFunction_Check(func))) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; @@ -23526,28 +24016,6 @@ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb return result; } -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) -#else - if (likely(PyCFunction_Check(func))) -#endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * @@ -24004,27 +24472,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, PyObject_RichCompare(op1, op2, Py_EQ)); } -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, @@ -24141,398 +24588,21 @@ static int __Pyx_ParseOptionalKeywords( return -1; } -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - return PyInt_FromLong(a & b); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_and(op1, op2); - } - } - x = a & b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla & llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2); -} -#endif - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS -#define __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(operand)\ - if (unlikely(zerodivision_check && ((operand) == 0))) {\ - PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\ - return NULL;\ - } -#endif -static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(b) - if (unlikely(b == -1 && ((unsigned long)a) == 0-(unsigned long)a)) - return PyInt_Type.tp_as_number->nb_floor_divide(op1, op2); - else { - long q, r; - q = a / b; - r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - x = q; - } - return PyInt_FromLong(x); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_floor_divide(op1, op2); - } - } - __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(b) - { - long q, r; - q = a / b; - r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - x = q; - } - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - { - PY_LONG_LONG q, r; - q = lla / llb; - r = lla - q*llb; - q -= ((r != 0) & ((r ^ llb) < 0)); - llx = q; - } - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2); -} -#endif - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); @@ -24605,35 +24675,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); -} -#endif - /* CIntToDigits */ static const char DIGIT_PAIRS_10[2*10*10+1] = { "00010203040506070809" @@ -25165,49 +25206,467 @@ static CYTHON_INLINE int __Pyx_dict_iter_next( return __Pyx_IterFinish(); } } - if (pitem) { - *pitem = next_item; - } else if (pkey && pvalue) { - if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) - return -1; - } else if (pkey) { - *pkey = next_item; - } else { - *pvalue = next_item; + if (pitem) { + *pitem = next_item; + } else if (pkey && pvalue) { + if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) + return -1; + } else if (pkey) { + *pkey = next_item; + } else { + *pvalue = next_item; + } + return 1; +} + +/* UnpackUnboundCMethod */ +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } +#endif + return 0; +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + if (likely(cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return (*(cfunc->func))(self, arg); + } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { + if (PY_VERSION_HEX >= 0x030700A0) { + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); + } else { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } + return __Pyx__CallUnboundCMethod1(cfunc, self, arg); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(2, self, arg); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + if (likely(cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + #if PY_VERSION_HEX >= 0x030700A0 + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(3); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 1, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 2, arg2); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(3, self, arg1, arg2); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* CIntToPyUnicode */ +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned short uint16_t; + #else + typedef unsigned __int16 uint16_t; + #endif + #endif +#else + #include +#endif +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define GCC_DIAGNOSTIC +#endif +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(size_t)*3+2]; + char *dpos, *end = digits + sizeof(size_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + size_t remaining; +#ifdef GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (size_t) (remaining / (8*8)); + dpos -= 2; + *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_8)[digit_pos]; + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (size_t) (remaining / (10*10)); + dpos -= 2; + *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_10)[digit_pos]; + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (size_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + if (last_one_off) { + assert(*dpos == '0'); + dpos++; + } + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; } - return 1; -} - -/* PyObjectCallMethod1 */ -static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { - PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); - Py_DECREF(method); - return result; -} -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method = NULL, *result; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_Call2Args(method, obj, arg); - Py_DECREF(method); - return result; + if (width > ulength) { + ulength = width; } - if (unlikely(!method)) return NULL; - return __Pyx__PyObject_CallMethod1(method, arg); + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); } -/* append */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); +/* unicode_tailmatch */ +static int __Pyx_PyUnicode_TailmatchTuple(PyObject* s, PyObject* substrings, + Py_ssize_t start, Py_ssize_t end, int direction) { + Py_ssize_t i, count = PyTuple_GET_SIZE(substrings); + for (i = 0; i < count; i++) { + Py_ssize_t result; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substrings, i), + start, end, direction); +#else + PyObject* sub = PySequence_ITEM(substrings, i); + if (unlikely(!sub)) return -1; + result = PyUnicode_Tailmatch(s, sub, start, end, direction); + Py_DECREF(sub); +#endif + if (result) { + return (int) result; + } } return 0; } +static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr, + Py_ssize_t start, Py_ssize_t end, int direction) { + if (unlikely(PyTuple_Check(substr))) { + return __Pyx_PyUnicode_TailmatchTuple(s, substr, start, end, direction); + } + return (int) PyUnicode_Tailmatch(s, substr, start, end, direction); +} /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { @@ -25863,6 +26322,25 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } +/* CallUnboundCMethod0 */ +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *args, *result = NULL; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_ASSUME_SAFE_MACROS + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); +#else + args = PyTuple_Pack(1, self); + if (unlikely(!args)) goto bad; +#endif + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + Py_DECREF(args); +bad: + return result; +} + /* None */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); @@ -25880,212 +26358,94 @@ static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { _PyUnicodeWriter_Init(&writer); #endif ret = _PyFloat_FormatAdvancedWriter( - &writer, - obj, - format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); - } else if (likely(PyLong_CheckExact(obj))) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 - _PyUnicodeWriter_Init(&writer, 0); -#else - _PyUnicodeWriter_Init(&writer); -#endif - ret = _PyLong_FormatAdvancedWriter( - &writer, - obj, - format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); - } else { - return PyObject_Format(obj, format_spec); - } - if (unlikely(ret == -1)) { - _PyUnicodeWriter_Dealloc(&writer); - return NULL; - } - return _PyUnicodeWriter_Finish(&writer); -} -#endif - -/* SwapException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 + _PyUnicodeWriter_Init(&writer, 0); +#else + _PyUnicodeWriter_Init(&writer); +#endif + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + return PyObject_Format(obj, format_spec); } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; #endif - return (equals == Py_NE); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #endif + +/* PyObjectCallMethod1 */ +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +} + +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; } /* CIntToPyUnicode */ @@ -26244,85 +26604,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, PyObject_RichCompare(op1, op2, Py_NE)); } -/* SetItemInt */ -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) -#else - if (is_list || PySequence_Check(o)) -#endif - { - return PySequence_SetItem(o, i, v); - } +/* py_dict_pop */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3 + if ((1)) { + return _PyDict_Pop(d, key, default_value); + } else #endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -/* PyUnicode_Unicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { - if (unlikely(obj == Py_None)) - obj = __pyx_kp_u_None; - return __Pyx_NewRef(obj); -} - -/* DictGetItem */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } - } - return NULL; + if (default_value) { + return __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_pop, d, key, default_value); + } else { + return __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_pop, d, key); } - Py_INCREF(value); - return value; } -#endif /* IterNext */ static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { @@ -26379,6 +26673,56 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* return __Pyx_PyIter_Next2Default(defval); } +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* py_dict_keys */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) { + if (PY_MAJOR_VERSION >= 3) + return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d); + else + return PyDict_Keys(d); +} + /* SliceTupleAndList */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { @@ -26598,24 +26942,6 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } #endif -/* SetVTable */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - /* PyObjectGetAttrStrNoError */ static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { __Pyx_PyThreadState_declare @@ -26642,7 +26968,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, P static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); + name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -26722,6 +27048,24 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { return ret; } +/* SetVTable */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { @@ -27602,43 +27946,6 @@ static int __Pyx_check_binary_version(void) { return 0; } -/* FunctionExport */ -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); - if (!d) { - PyErr_Clear(); - d = PyDict_New(); - if (!d) - goto bad; - Py_INCREF(d); - if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) - goto bad; - } - tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif - if (!cobj) - goto bad; - if (PyDict_SetItemString(d, name, cobj) < 0) - goto bad; - Py_DECREF(cobj); - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(cobj); - Py_XDECREF(d); - return -1; -} - /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { diff --git a/ktlib.pyx b/src/ktlib.pyx similarity index 64% rename from ktlib.pyx rename to src/ktlib.pyx index 517b3ce..92e348a 100644 --- a/ktlib.pyx +++ b/src/ktlib.pyx @@ -1,9 +1,7 @@ -#cython: language_level=3, c_string_type=unicode, c_string_encoding=utf8, boundscheck=False, cdivision=True, wraparound=False +# cython: language_level=3, boundscheck=False, cdivision=True, wraparound=False # distutils: language=c++ import sys -from libcpp.string cimport string -from libcpp.vector cimport vector -from libcpp cimport bool as bool_t +from pathlib import Path import requests import os import re @@ -13,11 +11,11 @@ from bs4 import BeautifulSoup import multiprocessing import concurrent.futures from reprint import output -from html.parser import HTMLParser import emoji +from html.parser import HTMLParser from collections import namedtuple -import subprocess from subprocess import Popen, PIPE +import subprocess import json import shlex from resource import * @@ -26,6 +24,11 @@ import configparser import webbrowser import signal +cimport cython +from libcpp.vector cimport vector +from libcpp cimport bool as bool_t +from libc.stdio cimport FILE, fopen, fclose, fflush +from .version import version __all__ = [ 'arg_parse', 'color_red', @@ -34,10 +37,10 @@ __all__ = [ ] # -------------- Global varible ---------------- -cdef const char* _KATTIS_RC_URL = 'https://open.kattis.com/download/kattisrc' +DEF _KATTIS_RC_URL = 'https://open.kattis.com/download/kattisrc' cdef object _HEADERS = {'User-Agent': 'kt'} -cdef const char* _VERSION = '0.0.4' -cdef const char* _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' + +DEF _PYPI_PACKAGE_INFO = 'https://pypi.org/pypi/kttool/json' cdef list test_subprocesses = [] # global structs PLanguage = namedtuple('ProgrammingLanguage', @@ -47,7 +50,7 @@ PLanguage = namedtuple('ProgrammingLanguage', cdef class ConfigError(Exception): pass -cdef object map_template_to_plang = { +cdef dict map_template_to_plang = { 'c': PLanguage('c', 'c','C', 'gcc $%file%$.c -o $%file%$.out', './$%file%$.out', @@ -94,45 +97,32 @@ cdef object map_template_to_plang = { '' ) } +# -------------- Color for formatting ---------------- +DEF BOLD_SEQ = '\033[1m' +DEF RESET_SEQ = '\033[0m' +DEF BLACK = '\033[6;90m' +DEF RED = '\033[6;91m' +DEF GREEN = '\033[6;92m' +DEF YELLOW = '\033[6;93m' +DEF BLUE = '\033[6;94m' +DEF MAGENTA = '\033[6;95m' +DEF CYAN = '\033[6;96m' +DEF WHITE = '\033[6;97m' +cpdef str color_cyan(str text): + return f'{CYAN}{text}{RESET_SEQ}' -# -------------- Color for formatting ---------------- -cdef: - string BOLD_SEQ = b'\033[1m' - string RESET_SEQ = b'\033[0m' - string BLACK = b'\033[6;90m' - string RED = b'\033[6;91m' - string GREEN = b'\033[6;92m' - string YELLOW = b'\033[6;93m' - string BLUE = b'\033[6;94m' - string MAGENTA = b'\033[6;95m' - string CYAN = b'\033[6;96m' - string WHITE = b'\033[6;97m' - -cpdef string color_cyan(const string& text) nogil: - cdef: - string res = CYAN - res.append(text) - res.append(RESET_SEQ) - return res -cpdef string color_green(const string& text) nogil: - cdef: - string res = GREEN - res.append(text) - res.append(RESET_SEQ) - return res +cpdef str color_green(str text): + return f'{GREEN}{text}{RESET_SEQ}' -cpdef string color_red(const string& text) nogil: - cdef: - string res = RED - res.append(text) - res.append(RESET_SEQ) - return res +cpdef str color_red(str text): + return f'{RED}{text}{RESET_SEQ}' +log = print # -------------- Utility functions ---------------- -cdef string ask_with_default(string qu, string default_val=b''): +cdef str ask_with_default(str qu, str default_val=''): ''' Print out `qu` to console and ask for input value from user If no input was provided by user, `default_val` will be returned instead Args: @@ -141,43 +131,47 @@ cdef string ask_with_default(string qu, string default_val=b''): Returns: - string value as the response ''' - cdef: - string ret qu = f'Please enter {color_cyan(qu)}' - if default_val.size() > 0: + if default_val: qu = f'{qu} | Default value: {default_val}\n' - ret = input(qu) - if ret.size() == 0: + cdef str ret = input(qu) + if not ret: return default_val return ret cdef void make_list_equal( - vector[string]& lhs, - vector[string]& rhs, - string pad_element = b'' -) nogil: + list lhs, + list rhs, + str pad_element = '' +) except *: ''' Make two vector of string equation in length by padding with `pad_element` Args: - lhs, rhs: 2 vectors of string to be made equal in length - pad_element: string to fill the shorter vector ''' - while lhs.size() < rhs.size(): - lhs.push_back(pad_element) - while rhs.size() < lhs.size(): - rhs.push_back(pad_element) - - + cdef int delta_size = abs(len(lhs) - len(rhs)) + cdef list delta_list = [ pad_element ] * delta_size + if len(lhs) < len(rhs): + lhs.extend(delta_list) + else: + rhs.extend(delta_list) # -------------- Core functions/classes ---------------- -cdef class Action(object): +cdef class Action: + cdef: + object config_path + object cfg + object cookies + object kt_config ''' Base class for handle general command. Handle loading up .kattisrc config file ''' def __cinit__(self): - self.config_path = os.path.join(os.getenv('HOME'), '.kattisrc') # kattis config file - self.kt_config = os.path.join(os.getenv('HOME'), '.ktconfig') # kt tool file + self.config_path = Path.home() / '.kattisrc' # kattis config file + self.kt_config = Path.home() / '.ktconfig' # kt tool file + self.cfg = None - cdef string get_url(self, const string& option, string default = b''): + cdef str get_url(self, str option, str default = '') : ''' Get appropriate urls from kattisrc file Args: - option: parameter to get from katticrc config file @@ -185,32 +179,31 @@ cdef class Action(object): Returns: - Full url path to the required attr ''' - cdef: - string kattis_host + cdef str kattis_host if self.cfg.has_option('kattis', option): return self.cfg.get('kattis', option) - else: - kattis_host = self.cfg.get('kattis', 'hostname') - return f'https://{kattis_host}/{default}' + + kattis_host = self.cfg.get('kattis', 'hostname') + return f'https://{kattis_host}/{default}' - cdef read_config_from_file(self): + cdef void read_config_from_file(self) except *: ''' kttool deals with 2 config files: - kattisrc: provided by official kattis website, provide domain name and general urls - ktconfig: handle templates by kttool ''' # Initialize ktconfig file if file doesnt exist - if not os.path.exists(self.kt_config): + if not self.kt_config.is_file(): with open(self.kt_config, 'w') as f: f.write('{}\n') self.cfg = configparser.ConfigParser() - if not os.path.exists(self.config_path): + if not self.config_path.is_file(): raise RuntimeError(f'No valid config file at {self.config_path}. ' f'Please download it at {_KATTIS_RC_URL}') self.cfg.read(self.config_path) - username = self.cfg.get('user', 'username') + cdef str username = self.cfg.get('user', 'username') password = token = None try: password = self.cfg.get('user', 'password') @@ -228,14 +221,17 @@ cdef class Action(object): print(f'Username: {color_green(username)}') - cdef login(self): + cdef void login(self) except *: ''' Try to login and obtain cookies from succesful signin ''' cdef: - string login_url - string err + str login_url + str err + str username + str password + username = self.cfg.get('user', 'username') - password = token = None + password = token = '' try: password = self.cfg.get('user', 'password') except configparser.NoOptionError: @@ -244,7 +240,7 @@ cdef class Action(object): token = self.cfg.get('user', 'token') except configparser.NoOptionError: pass - login_url = self.get_url(b'loginurl', b'login') + login_url = self.get_url('loginurl', 'login') login_args = {'user': username, 'script': 'true'} if password: login_args['password'] = password @@ -254,22 +250,22 @@ cdef class Action(object): if not login_reply.status_code == 200: if login_reply.status_code == 403: - err = b'Incorrect username or password/token (403)' + err = 'Incorrect username or password/token (403)' elif login_reply.status_code == 404: - err = b'Incorrect login URL (404)' + err = 'Incorrect login URL (404)' else: err = f'Status code: {login_reply.status_code}' raise RuntimeError(f'Login failed. {err}') self.cookies = login_reply.cookies - cdef string get_problem_id(self): - # ASsuming user is in the folder with the name of the problem id - return os.path.basename(os.getcwd()) + cdef str get_problem_id(self): + # Assuming user is in the folder with the name of the problem id + return Path.cwd().name - cdef string get_problem_url(self): + cdef str get_problem_url(self): cdef: - string domain = f"https://{self.get_url(b'hostname')}" - string problem_id = self.get_problem_id() + str domain = f"https://{self.get_url('hostname')}" + str problem_id = self.get_problem_id() return os.path.join( domain, @@ -278,38 +274,57 @@ cdef class Action(object): ) - cdef _act(self): - raise NotImplementedError + cdef void _act(self) except *: + raise NotImplementedError() - def act(self): + cpdef void act(self) except *: ''' Python wrapper function to call cython private method _act ''' self.read_config_from_file() self._act() +@cython.final +cdef class SampleData: + cdef: + str problem_id + bint is_in + str sample_id + str data + + def __cinit__(self, str problem_id='', str data='', bint is_in=True, str sample_id=''): + self.problem_id = problem_id + self.is_in = is_in + self.sample_id = sample_id + self.data = data - -cpdef void write_samples(tuple sample_data): +cpdef void write_samples(SampleData sample_data) except *: ''' Write input/output sample to file. This is used for multiprocess pool to generate input/output files Args: - sample_data: a tuple representing index, string data, problem id and a boolean declaring whether current file is input (False if the file is output) ''' cdef: - string file_name_prefix = b'in' if sample_data[3] else b'ans' - string file_name = f'{sample_data[2]}/{file_name_prefix}{sample_data[0]}.txt' - - with open(file_name, 'w') as f: - f.write(sample_data[1]) + str file_name_prefix = 'in' if sample_data.is_in else 'ans' + str file_name = f'{sample_data.problem_id}/{file_name_prefix}{sample_data.sample_id}.txt' + + with open(file_name, 'w+') as f: + f.write(sample_data.data) + +@cython.final cdef class Gen(Action): ''' Handle `gen` command for kt_tool ''' - def __cinit__(self, string problem_id): - self._problem_id = problem_id + cdef: + str _problem_id + str _url - - cdef _gen_samples(self): + ''' Handle `gen` command for kt_tool ''' + def __cinit__(self, str problem_id): + self._problem_id = problem_id + self._url = '' + + cdef void _gen_samples(self) except *: ''' Generate sample input file for `self._problem_id` The basic flow is to scrape the problem task page and retrieve the relevent fields Generate the sample files to problem id folder @@ -324,142 +339,155 @@ cdef class Gen(Action): - Generate a template file (distinctivecharacter.cpp) if a template file is provided in the .ktconfig file ''' cdef: - string domain = f"https://{self.get_url(b'hostname')}" - object template_file = {} + str domain = f"https://{self.get_url('hostname')}" + dict template_file = {} list sample_data = [] - + object data + object soup + object page + size_t i = 0 + str k + dict template + + self.login() - self._url = os.path.join( - domain, - 'problems', - self._problem_id - ) + self._url = self.get_problem_url() page = requests.get(self._url, cookies=self.cookies, headers=_HEADERS) soup = BeautifulSoup(page.content, 'html.parser') data = soup.find_all('pre') for i in range(len(data)): if i & 1: - sample_data.append((i // 2 + 1, data[i].text, self._problem_id, False)) + sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=False)) else: - sample_data.append((i // 2 + 1, data[i].text, self._problem_id, True)) + sample_data.append(SampleData(sample_id=i // 2 + 1, data=data[i].text, problem_id=self._problem_id, is_in=True)) - assert(len(data) % 2 == 0, 'Internal error: Number of sample input ' - ' is not equal to number of sample output') + assert len(data) % 2 == 0, 'Internal error: Number of sample input '\ + ' is not equal to number of sample output' with concurrent.futures.ProcessPoolExecutor(max_workers=4) as executor: executor.map(write_samples, sample_data) - print(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) + log(color_green(f'Generate {len(sample_data) // 2} sample(s) to {self._problem_id}')) if not os.path.exists(self.kt_config): - print(color_red(b'.ktconfig file has not been set up so no template was generated. ' - b'Please use `kt config` to set up a template file')) + log(color_red('.ktconfig file has not been set up so no template was generated. ' + 'Please use `kt config` to set up a template file')) return with open(self.kt_config, 'r') as f: template_file = json.load(f) + for k, template in template_file.items(): if template.get('default', False): shutil.copyfile(template.get('path'), f'{self._problem_id}/{self._problem_id}.{map_template_to_plang[k].extension}') - print(color_green(b'Template file has been generated')) + log(color_green('Template file has been generated')) return - print(color_red(f'No default template detected in {self.kt_config}')) + log(color_red(f'No default template detected in {self.kt_config}')) - - - cdef _act(self): - print(f'Problem is {self._problem_id}') - os.makedirs(self._problem_id, exist_ok=True) + cdef void _act(self) except *: + log(f'Problem is {self._problem_id}') + cdef object problem_dir = Path.cwd() / self._problem_id + problem_dir.mkdir(parents=True, exist_ok=True) self._gen_samples() -cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil: +cdef tuple compare_entity(str lhs, str rhs): if lhs == rhs: - diff.append(lhs) - diff.push_back(b' ') - return True - diff.append(color_red(lhs)) - diff.append(color_green(rhs)) - diff.push_back(b' ') - return False + return True, f'{lhs} ' + return False, f'{color_red(lhs)}{color_green(rhs)} ' + + +@cython.final +cdef class RunnableFile: + cdef: + str ext + str problem_id + str file_name #Path + def __cinit__(self, str problem_id, str ext, object file_name): + self.problem_id = problem_id + self.ext = ext + self.file_name = file_name + +@cython.final cdef class Test(Action): - cdef detect_file_name(self): + cdef: + str file_name + str pre_script + str script + str post_script + str lang + + cdef void detect_file_name(self) except *: ''' Confirm the executable file if there is multiple files that are runnable in current folder ''' cdef: - object existed_templates = {} - object acceptable_file_ext = {} - string alias - string res + dict existed_templates = {} + dict acceptable_file_ext = {} + str alias + str res int opt = 0 + list parts + list runnable_files + list files + size_t i = 0 + str k + object x, f with open(self.kt_config) as f: existed_templates = json.load(f) - for k, v in existed_templates.items(): + for k in existed_templates.keys(): acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] - files = [f for f in os.listdir('.') if os.path.isfile(f)] + files = [x for x in Path('.').iterdir() if x.is_file()] runnable_files = [] for f in files: - parts = f.split('.') + parts = str(f).split('.') if len(parts) <= 1: continue - if parts[1] in acceptable_file_ext: - runnable_files.append((parts[0], f, parts[1])) + if parts[1] in acceptable_file_ext: + runnable_files.append(RunnableFile( + problem_id=parts[0], + ext=parts[1], + file_name=str(f) + )) if len(runnable_files) == 0: raise RuntimeError('Not executable code file detected') if len(runnable_files) > 1: - print(color_cyan(b'Choose a file to run')) + log(color_cyan('Choose a file to run')) for i in range(len(runnable_files)): - print(f' {i}: {runnable_files[i][1]}') - res = input() - opt = int(res) + log(f' {i}: {runnable_files[i].file_name}') + opt = int(input()) assert 0 <= opt < len(runnable_files), 'Invalid option chosen' - self.file_name = runnable_files[opt][0] - alias = acceptable_file_ext[runnable_files[opt][2]].alias - self.lang = acceptable_file_ext[runnable_files[opt][2]].full_name + self.file_name = runnable_files[opt].problem_id + alias = acceptable_file_ext[runnable_files[opt].ext].alias + self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name self.pre_script = existed_templates.get(alias, {}).get('pre_script').replace('$%file%$', self.file_name) self.script = existed_templates.get(alias, {}).get('script').replace('$%file%$', self.file_name) self.post_script = existed_templates.get(alias, {}).get('post_script').replace('$%file%$', self.file_name) - cdef _act(self): + cdef void _act(self) except *: ''' Run the executable file against sample input and output files present in the folder The sample files will only be recognized if the conditions hold: - Naming style should be in{idx}.txt and ans{txt}.txt - for in{idx}.txt, there must exist a ans{idx}.txt with the same `idx` ''' cdef: - int idx - float start_time - float taken - vector[string] actual - vector[string] expected - vector[string] diff - vector[string] ith_line_exp - vector[string] ith_line_actual - string current_diff - bool_t is_ac - string raw_output - string stderr_data - string lhs - string rhs - string temp - float mem_used - long rusage_denom = 1 << 20 - object p + list input_files, output_files, usable_samples + object x, input_file, output_file + self.detect_file_name() - input_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('in')] - output_files = [f for f in os.listdir('.') if os.path.isfile(f) and f.startswith('ans')] + input_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('in')] + output_files = [x for x in Path('.').iterdir() if x.is_file() and str(x).startswith('ans')] usable_samples = [] # Get sample files that match the condition @@ -468,19 +496,37 @@ cdef class Test(Action): ) pattern = re.compile(r"\d+") for input_file in input_files: - idx = int(pattern.search(input_file).group(0)) + idx = int(pattern.search(str(input_file)).group(0)) for output_file in output_files: - if idx == int(pattern.search(output_file).group(0)): - usable_samples.append(Sample(idx, input_file, output_file)) + if idx == int(pattern.search(str(output_file)).group(0)): + usable_samples.append(Sample( + index=idx, + input_file=input_file, + output_file=output_file) + ) break # run test from ascending number of file index usable_samples = sorted(usable_samples, key=lambda x: x.index) # run test - print(f'Problem ID : {color_cyan(self.get_problem_id())}') - print(f'Lanuage : {self.lang}') - if self.pre_script.size() > 0: + log(f'Problem ID : {color_cyan(self.get_problem_id())}') + log(f'Lanuage : {self.lang}') + if self.pre_script: subprocess.check_call(shlex.split(self.pre_script)) + + cdef: + double mem_used + long rusage_denom = 1 << 20 + bint is_ac, is_good + list actual = [], expected = [], diff = [] + list raw_input + object proc # process + double start_time, taken + str raw_output + list ith_line_exp, ith_line_actual + int i, j + str current_diff, now_diff + for sample in usable_samples: is_ac = True actual.clear() @@ -489,7 +535,7 @@ cdef class Test(Action): try: with open(sample.output_file, 'r') as f: expected = [l.strip(" \n") for l in f.readlines()] - with open(sample.input_file, 'rb') as f: + with open(sample.input_file, 'rb') as f: raw_input = f.read() p = Popen([self.script, '-'], stdin=PIPE, stdout=PIPE, shell=False, @@ -498,13 +544,11 @@ cdef class Test(Action): proc = psutil.Process(p.pid) mem_used = proc.memory_info().rss / rusage_denom start_time = time.perf_counter() - raw_output = p.communicate(raw_input)[0] + raw_output = p.communicate(raw_input)[0].decode() p.wait() taken = time.perf_counter() - start_time - actual = [z.strip(" \n") for z in raw_output.split('\n')] make_list_equal(actual, expected) - diff.clear() for i in range(len(expected)): ''' Compare the values line by line @@ -514,48 +558,51 @@ cdef class Test(Action): ith_line_actual = [z for z in actual[i].split(' ')] make_list_equal(ith_line_exp, ith_line_actual) - current_diff.clear() + current_diff = '' for j in range(len(ith_line_exp)): lhs = ith_line_exp[j] rhs = ith_line_actual[j] - is_ac &= compare_entity(rhs,lhs, current_diff) + is_good, now_diff = compare_entity(rhs,lhs) + is_ac &= is_good + current_diff += now_diff - diff.push_back(current_diff) + diff.append(current_diff) if is_ac: - print(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) + log(color_green(f'Test Case #{sample.index}: {"Accepted".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) else: - print(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} Mb')) - print(color_cyan(b'--- Input ---')) - print(raw_input.decode('utf-8')) - print(color_cyan(b'--- Diff ---')) - for i in range(diff.size()): - print(diff[i]) + log(color_red(f'Test Case #{sample.index}: {"Wrong Answer".ljust(13, " ")} ... {taken:.3f} s {mem_used:.2f} M')) + log(color_cyan('--- Input ---')) + log(raw_input) + log(color_cyan('--- Diff ---')) + for i in range(len(diff)): + log(diff[i]) except Exception as e: - print(color_red(f'Test case #{sample.index}: Runtime Error {e}')) - if self.post_script.size() > 0: - subprocess.check_call(shlex.split(self.post_script)) + log(color_red(f'Test case #{sample.index}: Runtime Error {e}')) + if self.post_script: + subprocess.check_call(shlex.split(self.post_script)) +@cython.final cdef class Submit(Action): '''Handle kt submit action to push the file to kattis website''' cdef: - string ac_icon - string rj_icon - string sk_icon + str ac_icon + str rj_icon + str sk_icon - string file_name - string lang - string submission_id - string problem_id + str file_name + str lang + str submission_id + str problem_id def __cinit__(self): - self.ac_icon = b':heavy_check_mark:' - self.rj_icon = b':heavy_multiplication_x:' - self.sk_icon = b':white_medium_square:' + self.ac_icon = ':heavy_check_mark:' + self.rj_icon = ':heavy_multiplication_x:' + self.sk_icon = ':white_medium_square:' - cdef bool_t is_finished(self, object output_lines, object result, string& status, string run_time): + cdef bint is_finished(self, object output_lines, object result, str status, str run_time) except? -1: ''' Judge whether the result and status obtained from kattis submission page has indicated whether the solution judgement has been done Args: @@ -568,10 +615,10 @@ cdef class Submit(Action): cdef: int tot_res = len(result) int ac_ct = 0 - bool_t is_ac = True - bool_t rejected = False - bool_t finished = False - string _status = status + bint is_ac = True + bint rejected = False + bint finished = False + str _status = status for res in result: _class = res.get('class', None) @@ -594,14 +641,14 @@ cdef class Submit(Action): else: finished = ac_ct == tot_res - if status == b'Compiling': + if status == 'Compiling': finished = False - elif status == b'Compile Error': + elif status == 'Compile Error': _status = color_red(status) elif not finished: _status = color_cyan(status) else: - if status == b'Running': # status text not updated, lets try again + if status == 'Running': # status text not updated, lets try again finished = False elif is_ac: _status = color_green(status) @@ -619,17 +666,17 @@ cdef class Submit(Action): - cdef _render_result(self, string submission_url_ret): + cdef void _render_result(self, str submission_url_ret) except *: ''' Continuously polling for result from `submission_url_ret` Args: - submission_url_ret: url for the submission to be checked ''' cdef: int time_out = 20 - float cur_time = 0 - string status_ret - string runtime_ret - bool_t done = False + double cur_time = 0 + str status_ret + str runtime_ret + bint done = False with output(output_type='dict') as output_lines: @@ -644,26 +691,28 @@ cdef class Submit(Action): runtime_ret = soup.find('td', class_='runtime middle').text done = self.is_finished(output_lines, submission_ret, status_ret, runtime_ret) except Exception as e: - print(color_red(f'Internal error: {e}')) + log(color_red(f'Internal error: {e}')) time.sleep(0.4) cur_time += 0.4 - cdef detect_file_name(self): + cdef str detect_file_name(self): ''' Detect executable file to submit for kattis judge if there are multiple files that are executable based on user ktconfig file ''' cdef: - object acceptable_file_ext = {} - string alias - int opt = 0 + dict acceptable_file_ext = {} + str alias + int opt = 0, i int res_int - string res + str res + list files, runnable_files + object f - for k, v in map_template_to_plang.items(): + for k in map_template_to_plang.keys(): acceptable_file_ext[map_template_to_plang[k].extension] = map_template_to_plang[k] - files = [f for f in os.listdir('.') if os.path.isfile(f)] + files = [f for f in Path().iterdir() if f.is_file()] runnable_files = [] RunnableFile = namedtuple('RunnableFile', ['file_name', 'full_name', 'ext'] @@ -679,7 +728,7 @@ cdef class Submit(Action): raise RuntimeError('Not executable code file detected') if len(runnable_files) > 1: - print(color_cyan(b'Choose a file:')) + log(color_cyan('Choose a file:')) for i in range(len(runnable_files)): print(f' {i}: {runnable_files[i].full_name}') res = input() @@ -696,14 +745,15 @@ cdef class Submit(Action): self.lang = acceptable_file_ext[runnable_files[opt].ext].full_name - cdef _act(self): + cdef void _act(self) except *: '''Submit the code file for kattis judge''' cdef: - string err - string submissions_url - string submission_url_ret - string submit_response - string problem_id = self.get_problem_id() + str err + str submissions_url + str submission_url_ret + str submit_response + str problem_id = self.get_problem_id() + list files self.detect_file_name() data = {'submit': 'true', @@ -719,22 +769,22 @@ cdef class Submit(Action): (os.path.basename(self.file_name), sub_file.read(), 'application/octet-stream'))) - submit_url = self.get_url(b'submissionurl', b'submit') + submit_url = self.get_url('submissionurl', 'submit') self.login() ret = requests.post(submit_url, data=data, files=files, cookies=self.cookies, headers=_HEADERS) if ret.status_code != 200: if ret.status_code == 403: - err = b'Access denied (403)' + err = 'Access denied (403)' elif ret.status_code == 404: - err = b'Incorrect submit URL (404)' + err = 'Incorrect submit URL (404)' else: err = f'Status code: {ret.status_code}' raise RuntimeError(f'Submission failed: {err}') - submissions_url = self.get_url(b'submissionsurl', b'submissions') + submissions_url = self.get_url('submissionsurl', 'submissions') submit_response = ret.content.decode('utf-8').replace('
', '\n') self.submission_id = re.search(r'Submission ID: (\d+)', submit_response).group(1) - print(color_green(b'Submission successful')) + log(color_green('Submission successful')) submission_url_ret = f'{submissions_url}/{self.submission_id}' self._render_result(submission_url_ret) @@ -742,17 +792,17 @@ cdef class Submit(Action): cdef class Config(Action): cdef add_template(self): cdef: - string question = b'Which template would you like to add:\n' - string temp - object selectable_lang = {} + str question = 'Which template would you like to add:\n' + str temp + dict selectable_lang = {} int idx = 1 - object existed_templates = {} - string res + dict existed_templates = {} + str res int ret - object options = {} + dict options = {} - print(color_green(b'Adapted from xalanq\'s cf tool')) - print(''' + log(color_green('Adapted from xalanq\'s cf tool')) + log(''' Template will run 3 scripts in sequence when you run "kt test": - before_script (execute once) - script (execute the number of samples times) @@ -785,31 +835,31 @@ $%rand%$ Random string with 8 character (including "a-z" "0-9") assert 1 <= ret < idx, 'Invalid input' selected_lang = selectable_lang[ret][1] - options['path'] = ask_with_default(b'Template path', f'~/template.{selected_lang.extension}') - options['pre_script'] = ask_with_default(b'Pre-script', selected_lang.pre_script) - options['script'] = ask_with_default(b'Script', selected_lang.script) - options['post_script'] = ask_with_default(b'Post-script', selected_lang.post_script) + options['path'] = ask_with_default('Template path', f'~/template.{selected_lang.extension}') + options['pre_script'] = ask_with_default('Pre-script', selected_lang.pre_script) + options['script'] = ask_with_default('Script', selected_lang.script) + options['post_script'] = ask_with_default('Post-script', selected_lang.post_script) options['default'] = False if existed_templates else True existed_templates[selected_lang.alias] = options with open(self.kt_config, 'w') as kt_config: json.dump(existed_templates, kt_config, indent=2) - print(color_green(b'Yosh, your configuration has been saved')) + log(color_green('Yosh, your configuration has been saved')) cdef remove_template(self): ''' Remove a template from ktconfig file''' cdef: - object existed_templates = {} + dict existed_templates = {} str res - bool_t move_default + bint move_default with open(self.kt_config) as f: existed_templates = json.load(f) - print(f'Which template would you like to {color_red(b"delete")} ? For eg cpp, cc, ...') + log(f'Which template would you like to {color_red("delete")} ? For eg cpp, cc, ...') for k, v in existed_templates.items(): - print(k) + log(k) res = input() assert res in existed_templates, f'Invalid template chosen. Template {res} is not in ur config file' @@ -821,18 +871,18 @@ $%rand%$ Random string with 8 character (including "a-z" "0-9") with open(self.kt_config, 'w') as kt_config: json.dump(existed_templates, kt_config, indent=2) - cdef update_default(self): + cdef void update_default(self) except *: cdef: - object existed_templates = {} + dict existed_templates = {} str res - string default_key = b'' + str default_key = '' with open(self.kt_config) as f: existed_templates = json.load(f) - print(f'Which template would you like to gen as {color_cyan(b"default")} ? For eg cpp, cc, ...') + log(f'Which template would you like to gen as {color_cyan("default")} ? For eg cpp, cc, ...') for k, v in existed_templates.items(): - print(f'{k} {color_green(b"(default)") if v["default"] else ""}') + log(f'{k} {color_green("(default)") if v["default"] else ""}') if v["default"]: default_key = k res = input() @@ -842,14 +892,14 @@ $%rand%$ Random string with 8 character (including "a-z" "0-9") existed_templates[res]["default"] = True with open(self.kt_config, 'w') as kt_config: json.dump(existed_templates, kt_config, indent=2) - print(color_green(b'Yosh, your configuration has been saved')) + log(color_green('Yosh, your configuration has been saved')) - cdef _act(self): + cdef void _act(self): cdef: - string question = color_cyan(b'Select an option:\n') - string res + str question = color_cyan('Select an option:\n') + str res int opt - question.append(b"""1: Add a template + question.append("""1: Add a template 2: Remove a template 3: Select a default template """) @@ -865,34 +915,34 @@ $%rand%$ Random string with 8 character (including "a-z" "0-9") raise ValueError('Invalid option') cdef class Open(Action): - cdef _act(self): + cdef void _act(self) except *: webbrowser.open(self.get_problem_url()) cdef class Version(Action): - cdef _act(self): - print(f'Current version: {color_cyan(_VERSION)}') + cdef void _act(self) except *: + log(f'Current version: {color_cyan(version)}') cdef class Update(Action): - cdef _act(self): + cdef void _act(self) except *: cdef: object pypi_info - vector[string] releases - string current_latest_version + list releases + str current_latest_version pypi_info = requests.get(_PYPI_PACKAGE_INFO) releases = list(pypi_info.json()['releases']) if len(releases) == 0: - print(color_red(b'Hmm seems like there is currently no pypi releases :-?')) + log(color_red('Hmm seems like there is currently no pypi releases :-?')) return current_latest_version = releases.back() - if current_latest_version != _VERSION: + if current_latest_version != VERSION: subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--no-cache-dir", f"kttool=={current_latest_version}"]) - print(f'Installed version {color_green(current_latest_version)} successfully!') + log(f'Installed version {color_green(current_latest_version)} successfully!') else: - print(f'You already have the {color_green(b"latest")} version!') + log(f'You already have the {color_green("latest")} version!') -cdef object map_key_to_class = { +cdef dict map_key_to_class = { 'gen': Gen, 'test': Test, 'submit': Submit, @@ -911,7 +961,7 @@ cpdef Action arg_parse(list args): return map_key_to_class[args[0]](*args[1:]) -cpdef exit_gracefully(signum, frame): +def exit_gracefully(signum, frame): original_sigint = signal.getsignal(signal.SIGINT) # restore the original signal handler as otherwise evil things will happen # in raw_input when CTRL+C is pressed, and our signal handler is not re-entrant @@ -921,7 +971,7 @@ cpdef exit_gracefully(signum, frame): sp.kill() except: pass - print(color_green(b'Great is the art of beginning, but greater is the art of ending.')) + log(color_green('Great is the art of beginning, but greater is the art of ending.')) sys.exit(1) diff --git a/src/version.py b/src/version.py new file mode 100644 index 0000000..791897b --- /dev/null +++ b/src/version.py @@ -0,0 +1 @@ +version = '0.0.7' \ No newline at end of file diff --git a/test.py b/test.py deleted file mode 100644 index 95eb9a4..0000000 --- a/test.py +++ /dev/null @@ -1 +0,0 @@ -from test_ktlib import * \ No newline at end of file diff --git a/test/run_unittest.py b/test/run_unittest.py new file mode 100644 index 0000000..674b45b --- /dev/null +++ b/test/run_unittest.py @@ -0,0 +1,73 @@ +from src.ktlib import * +import unittest +import unittest.mock as mock +import os +import shutil + + +class Tester(unittest.TestCase): + def test_color(self): + self.assertEqual(color_cyan('hi'), '\x1b[6;96mhi\x1b[0m') + self.assertEqual(color_green('universe'), '\x1b[6;92muniverse\x1b[0m') + self.assertEqual(color_red('cosmo'), '\x1b[6;91mcosmo\x1b[0m') + + def test_make_list_equal(self): + lhs = ['first', 'second', 'third'] + rhs = ['fourth'] + make_list_equal(lhs, rhs) + self.assertEqual(lhs.size(), rhs.size()) + self.assertEqual('fourth', rhs.front()) + self.assertEqual('', rhs.back()) + + rhs.push_back('fifth') + make_list_equal(lhs, rhs, 'sixth') + self.assertEqual(lhs.size(), rhs.size()) + self.assertEqual('sixth', lhs.back()) + + def test_base_action (self): + action = Action() + action.read_config_from_file() + res = action.get_url('kattis', 'hostname') + self.assertEqual(res, 'https://open.kattis.com/hostname') + + def test_write_sample (self): + data_in = (1, '104', 'biggest', True) + data_out = (1, '1 24 52', 'biggest', False) + os.makedirs('biggest', exist_ok=True) + + write_samples(data_in) + self.assertTrue(os.path.exists('./biggest/in1.txt')) + with open('./biggest/in1.txt', 'r') as f: + self.assertEqual(f.read(), '104') + + write_samples(data_out) + self.assertTrue(os.path.exists('./biggest/ans1.txt')) + with open('./biggest/ans1.txt', 'r') as f: + self.assertEqual(f.read(), '1 24 52') + shutil.rmtree('biggest') + + def test_gen_action (self): + action = Gen('oddmanout') + action.act() + self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) + self.assertTrue(os.path.exists('./oddmanout/in1.txt')) + with open('./oddmanout/in1.txt', 'r') as f: + self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") + with open('./oddmanout/ans1.txt', 'r') as f: + self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") + shutil.rmtree('oddmanout') + + def test_compare_entity(self): + lhs = 'Marrie' + rhs = 'Maria' + res, diff = compare_entity(lhs, rhs, diff) + self.assertEqual(res, False) + self.assertEqual(diff, '\x1b[6;91mMarrie\x1b[0m\x1b[6;92mMaria\x1b[0m') + + lhs = 'Tesla' + rhs = 'Tesla' + res, diff = compare_entity(lhs, rhs, diff) + self.assertEqual(res, True) + self.assertEqual(diff, 'Tesla ') + + diff --git a/test_ktlib.cpp b/test_ktlib.cpp deleted file mode 100644 index c5977e0..0000000 --- a/test_ktlib.cpp +++ /dev/null @@ -1,7933 +0,0 @@ -/* Generated by Cython 0.29.17 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [], - "language": "c++", - "name": "test_ktlib", - "sources": [ - "/home/heiseish/Projects/kt/test_ktlib.pyx" - ] - }, - "module_name": "test_ktlib" -} -END: Cython Metadata */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. -#else -#define CYTHON_ABI "0_29_17" -#define CYTHON_HEX_VERSION 0x001D11F0 -#define CYTHON_FUTURE_DIVISION 1 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) - #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) - #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -#ifndef __cplusplus - #error "Cython files generated with the C++ option must be compiled with a C++ compiler." -#endif -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #else - #define CYTHON_INLINE inline - #endif -#endif -template -void __Pyx_call_destructor(T& x) { - x.~T(); -} -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } - T *operator->() { return ptr; } - T *operator&() { return ptr; } - operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } - private: - T *ptr; -}; - -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -#else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__test_ktlib -#define __PYX_HAVE_API__test_ktlib -/* Early includes */ -#include -#include "ios" -#include "new" -#include "stdexcept" -#include "typeinfo" -#include -#include -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "test_ktlib.pyx", - "stringsource", - "ktlib.pxd", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_5ktlib_Action; -struct __pyx_obj_5ktlib_Gen; -struct __pyx_obj_5ktlib_Test; -struct __pyx_opt_args_5ktlib_make_list_equal; -struct __pyx_opt_args_5ktlib_6Action_get_url; - -/* "ktlib.pxd":11 - * cpdef string color_red(const string& text) nogil - * - * cdef void make_list_equal(vector[string]& lhs, vector[string]& rhs, string pad_element=*) nogil # <<<<<<<<<<<<<< - * - * cdef class Action: - */ -struct __pyx_opt_args_5ktlib_make_list_equal { - int __pyx_n; - std::string pad_element; -}; - -/* "ktlib.pxd":24 - * cdef string get_problem_url(self) - * cdef string get_problem_id(self) - * cdef string get_url(self, const string& option, string default = *) # <<<<<<<<<<<<<< - * cdef _act(self) - * - */ -struct __pyx_opt_args_5ktlib_6Action_get_url { - int __pyx_n; - std::string __pyx_default; -}; - -/* "ktlib.pxd":13 - * cdef void make_list_equal(vector[string]& lhs, vector[string]& rhs, string pad_element=*) nogil - * - * cdef class Action: # <<<<<<<<<<<<<< - * cdef: - * string config_path - */ -struct __pyx_obj_5ktlib_Action { - PyObject_HEAD - struct __pyx_vtabstruct_5ktlib_Action *__pyx_vtab; - std::string config_path; - PyObject *cfg; - PyObject *cookies; - std::string kt_config; -}; - - -/* "ktlib.pxd":29 - * cpdef void write_samples(tuple sample_data) - * - * cdef class Gen(Action): # <<<<<<<<<<<<<< - * ''' Handle `gen` command for kt_tool ''' - * cdef: - */ -struct __pyx_obj_5ktlib_Gen { - struct __pyx_obj_5ktlib_Action __pyx_base; - std::string _problem_id; - std::string _url; -}; - - -/* "ktlib.pxd":40 - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil - * - * cdef class Test(Action): # <<<<<<<<<<<<<< - * cdef: - * string file_name - */ -struct __pyx_obj_5ktlib_Test { - struct __pyx_obj_5ktlib_Action __pyx_base; - std::string file_name; - std::string pre_script; - std::string script; - std::string post_script; - std::string lang; -}; - - - -/* "ktlib.pxd":13 - * cdef void make_list_equal(vector[string]& lhs, vector[string]& rhs, string pad_element=*) nogil - * - * cdef class Action: # <<<<<<<<<<<<<< - * cdef: - * string config_path - */ - -struct __pyx_vtabstruct_5ktlib_Action { - PyObject *(*read_config_from_file)(struct __pyx_obj_5ktlib_Action *); - PyObject *(*login)(struct __pyx_obj_5ktlib_Action *); - std::string (*get_problem_url)(struct __pyx_obj_5ktlib_Action *); - std::string (*get_problem_id)(struct __pyx_obj_5ktlib_Action *); - std::string (*get_url)(struct __pyx_obj_5ktlib_Action *, std::string const &, struct __pyx_opt_args_5ktlib_6Action_get_url *__pyx_optional_args); - PyObject *(*_act)(struct __pyx_obj_5ktlib_Action *); -}; -static struct __pyx_vtabstruct_5ktlib_Action *__pyx_vtabptr_5ktlib_Action; - - -/* "ktlib.pxd":29 - * cpdef void write_samples(tuple sample_data) - * - * cdef class Gen(Action): # <<<<<<<<<<<<<< - * ''' Handle `gen` command for kt_tool ''' - * cdef: - */ - -struct __pyx_vtabstruct_5ktlib_Gen { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; - PyObject *(*_gen_samples)(struct __pyx_obj_5ktlib_Gen *); -}; -static struct __pyx_vtabstruct_5ktlib_Gen *__pyx_vtabptr_5ktlib_Gen; - - -/* "ktlib.pxd":40 - * cdef bool_t compare_entity(const string& lhs, const string& rhs, string& diff) nogil - * - * cdef class Test(Action): # <<<<<<<<<<<<<< - * cdef: - * string file_name - */ - -struct __pyx_vtabstruct_5ktlib_Test { - struct __pyx_vtabstruct_5ktlib_Action __pyx_base; - PyObject *(*detect_file_name)(struct __pyx_obj_5ktlib_Test *); -}; -static struct __pyx_vtabstruct_5ktlib_Test *__pyx_vtabptr_5ktlib_Test; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectLookupSpecial.proto */ -#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { - PyObject *res; - PyTypeObject *tp = Py_TYPE(obj); -#if PY_MAJOR_VERSION < 3 - if (unlikely(PyInstance_Check(obj))) - return __Pyx_PyObject_GetAttrStr(obj, attr_name); -#endif - res = _PyType_Lookup(tp, attr_name); - if (likely(res)) { - descrgetfunc f = Py_TYPE(res)->tp_descr_get; - if (!f) { - Py_INCREF(res); - } else { - res = f(res, obj, (PyObject *)tp); - } - } else { - PyErr_SetObject(PyExc_AttributeError, attr_name); - } - return res; -} -#else -#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) -#endif - -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 -}; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); -#endif - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyObject *dict); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* CalculateMetaclass.proto */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - size_t defaults_size; // used by FusedFunction for copying defaults - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - -/* CythonFunction.proto */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); - -/* SetNameInClass.proto */ -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 -#define __Pyx_SetNameInClass(ns, name, value)\ - (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) -#elif CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_SetNameInClass(ns, name, value)\ - (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) -#else -#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) -#endif - -/* Py3ClassCreate.proto */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, - PyObject *mkw, PyObject *modname, PyObject *doc); -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, - PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CppExceptionConversion.proto */ -#ifndef __Pyx_CppExn2PyErr -#include -#include -#include -#include -static void __Pyx_CppExn2PyErr() { - try { - if (PyErr_Occurred()) - ; // let the latest Python exn pass through and ignore the current one - else - throw; - } catch (const std::bad_alloc& exn) { - PyErr_SetString(PyExc_MemoryError, exn.what()); - } catch (const std::bad_cast& exn) { - PyErr_SetString(PyExc_TypeError, exn.what()); - } catch (const std::bad_typeid& exn) { - PyErr_SetString(PyExc_TypeError, exn.what()); - } catch (const std::domain_error& exn) { - PyErr_SetString(PyExc_ValueError, exn.what()); - } catch (const std::invalid_argument& exn) { - PyErr_SetString(PyExc_ValueError, exn.what()); - } catch (const std::ios_base::failure& exn) { - PyErr_SetString(PyExc_IOError, exn.what()); - } catch (const std::out_of_range& exn) { - PyErr_SetString(PyExc_IndexError, exn.what()); - } catch (const std::overflow_error& exn) { - PyErr_SetString(PyExc_OverflowError, exn.what()); - } catch (const std::range_error& exn) { - PyErr_SetString(PyExc_ArithmeticError, exn.what()); - } catch (const std::underflow_error& exn) { - PyErr_SetString(PyExc_ArithmeticError, exn.what()); - } catch (const std::exception& exn) { - PyErr_SetString(PyExc_RuntimeError, exn.what()); - } - catch (...) - { - PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); - } -} -#endif - -/* None.proto */ -#include - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libcpp.string' */ - -/* Module declarations from 'libcpp.vector' */ - -/* Module declarations from 'libcpp' */ - -/* Module declarations from 'ktlib' */ -static PyTypeObject *__pyx_ptype_5ktlib_Action = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Gen = 0; -static PyTypeObject *__pyx_ptype_5ktlib_Test = 0; -static std::string (*__pyx_f_5ktlib_color_cyan)(std::string const &, int __pyx_skip_dispatch); /*proto*/ -static std::string (*__pyx_f_5ktlib_color_green)(std::string const &, int __pyx_skip_dispatch); /*proto*/ -static std::string (*__pyx_f_5ktlib_color_red)(std::string const &, int __pyx_skip_dispatch); /*proto*/ -static void (*__pyx_f_5ktlib_make_list_equal)(std::vector &, std::vector &, struct __pyx_opt_args_5ktlib_make_list_equal *__pyx_optional_args); /*proto*/ -static void (*__pyx_f_5ktlib_write_samples)(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static bool (*__pyx_f_5ktlib_compare_entity)(std::string const &, std::string const &, std::string &); /*proto*/ - -/* Module declarations from 'test_ktlib' */ -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ -static std::vector __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/ -#define __Pyx_MODULE_NAME "test_ktlib" -extern int __pyx_module_is_main_test_ktlib; -int __pyx_module_is_main_test_ktlib = 0; - -/* Implementation of 'test_ktlib' */ -static PyObject *__pyx_builtin_open; -static const char __pyx_k_[] = ""; -static const char __pyx_k_f[] = "f"; -static const char __pyx_k_r[] = "r"; -static const char __pyx_k_hi[] = "hi"; -static const char __pyx_k_os[] = "os"; -static const char __pyx_k_104[] = "104"; -static const char __pyx_k__11[] = "*"; -static const char __pyx_k_act[] = "act"; -static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_lhs[] = "lhs"; -static const char __pyx_k_res[] = "res"; -static const char __pyx_k_rhs[] = "rhs"; -static const char __pyx_k_diff[] = "diff"; -static const char __pyx_k_exit[] = "__exit__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_mock[] = "mock"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_open[] = "open"; -static const char __pyx_k_path[] = "path"; -static const char __pyx_k_read[] = "read"; -static const char __pyx_k_self[] = "self"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_Maria[] = "Maria"; -static const char __pyx_k_Tesla[] = "Tesla"; -static const char __pyx_k_cosmo[] = "cosmo"; -static const char __pyx_k_enter[] = "__enter__"; -static const char __pyx_k_fifth[] = "fifth"; -static const char __pyx_k_first[] = "first"; -static const char __pyx_k_sixth[] = "sixth"; -static const char __pyx_k_third[] = "third"; -static const char __pyx_k_Marrie[] = "Marrie"; -static const char __pyx_k_action[] = "action"; -static const char __pyx_k_exists[] = "exists"; -static const char __pyx_k_fourth[] = "fourth"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_kattis[] = "kattis"; -static const char __pyx_k_module[] = "__module__"; -static const char __pyx_k_rmtree[] = "rmtree"; -static const char __pyx_k_second[] = "second"; -static const char __pyx_k_shutil[] = "shutil"; -static const char __pyx_k_1_24_52[] = "1 24 52"; -static const char __pyx_k_Tesla_2[] = "Tesla "; -static const char __pyx_k_biggest[] = "biggest"; -static const char __pyx_k_data_in[] = "data_in"; -static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_CyTester[] = "CyTester"; -static const char __pyx_k_TestCase[] = "TestCase"; -static const char __pyx_k_data_out[] = "data_out"; -static const char __pyx_k_exist_ok[] = "exist_ok"; -static const char __pyx_k_hostname[] = "hostname"; -static const char __pyx_k_makedirs[] = "makedirs"; -static const char __pyx_k_qualname[] = "__qualname__"; -static const char __pyx_k_unittest[] = "unittest"; -static const char __pyx_k_universe[] = "universe"; -static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_oddmanout[] = "oddmanout"; -static const char __pyx_k_6_96mhi_0m[] = "\033[6;96mhi\033[0m"; -static const char __pyx_k_assertTrue[] = "assertTrue"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_test_color[] = "test_color"; -static const char __pyx_k_test_ktlib[] = "test_ktlib"; -static const char __pyx_k_assertEqual[] = "assertEqual"; -static const char __pyx_k_6_91mcosmo_0m[] = "\033[6;91mcosmo\033[0m"; -static const char __pyx_k_unittest_mock[] = "unittest.mock"; -static const char __pyx_k_test_ktlib_pyx[] = "test_ktlib.pyx"; -static const char __pyx_k_biggest_in1_txt[] = "./biggest/in1.txt"; -static const char __pyx_k_test_gen_action[] = "test_gen_action"; -static const char __pyx_k_6_92muniverse_0m[] = "\033[6;92muniverse\033[0m"; -static const char __pyx_k_biggest_ans1_txt[] = "./biggest/ans1.txt"; -static const char __pyx_k_test_base_action[] = "test_base_action"; -static const char __pyx_k_oddmanout_in1_txt[] = "./oddmanout/in1.txt"; -static const char __pyx_k_test_write_sample[] = "test_write_sample"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_oddmanout_ans1_txt[] = "./oddmanout/ans1.txt"; -static const char __pyx_k_CyTester_test_color[] = "CyTester.test_color"; -static const char __pyx_k_test_compare_entity[] = "test_compare_entity"; -static const char __pyx_k_test_make_list_equal[] = "test_make_list_equal"; -static const char __pyx_k_CyTester_test_gen_action[] = "CyTester.test_gen_action"; -static const char __pyx_k_CyTester_test_base_action[] = "CyTester.test_base_action"; -static const char __pyx_k_Case_1_1_Case_2_7_Case_3_5[] = "Case #1: 1\nCase #2: 7\nCase #3: 5\n"; -static const char __pyx_k_CyTester_test_write_sample[] = "CyTester.test_write_sample"; -static const char __pyx_k_6_91mMarrie_0m_6_92mMaria_0m[] = "\033[6;91mMarrie\033[0m\033[6;92mMaria\033[0m"; -static const char __pyx_k_CyTester_test_compare_entity[] = "CyTester.test_compare_entity"; -static const char __pyx_k_CyTester_test_make_list_equal[] = "CyTester.test_make_list_equal"; -static const char __pyx_k_https_open_kattis_com_hostname[] = "https://open.kattis.com/hostname"; -static const char __pyx_k_3_3_1_2147483647_2147483647_5_3[] = "3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n"; -static PyObject *__pyx_kp_b_; -static PyObject *__pyx_kp_s_104; -static PyObject *__pyx_kp_s_1_24_52; -static PyObject *__pyx_kp_s_3_3_1_2147483647_2147483647_5_3; -static PyObject *__pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m; -static PyObject *__pyx_kp_b_6_91mcosmo_0m; -static PyObject *__pyx_kp_b_6_92muniverse_0m; -static PyObject *__pyx_kp_b_6_96mhi_0m; -static PyObject *__pyx_kp_s_Case_1_1_Case_2_7_Case_3_5; -static PyObject *__pyx_n_s_CyTester; -static PyObject *__pyx_n_s_CyTester_test_base_action; -static PyObject *__pyx_n_s_CyTester_test_color; -static PyObject *__pyx_n_s_CyTester_test_compare_entity; -static PyObject *__pyx_n_s_CyTester_test_gen_action; -static PyObject *__pyx_n_s_CyTester_test_make_list_equal; -static PyObject *__pyx_n_s_CyTester_test_write_sample; -static PyObject *__pyx_n_b_Maria; -static PyObject *__pyx_n_b_Marrie; -static PyObject *__pyx_n_b_Tesla; -static PyObject *__pyx_kp_b_Tesla_2; -static PyObject *__pyx_n_s_TestCase; -static PyObject *__pyx_n_s__11; -static PyObject *__pyx_n_s_act; -static PyObject *__pyx_n_s_action; -static PyObject *__pyx_n_s_assertEqual; -static PyObject *__pyx_n_s_assertTrue; -static PyObject *__pyx_n_s_biggest; -static PyObject *__pyx_kp_s_biggest_ans1_txt; -static PyObject *__pyx_kp_s_biggest_in1_txt; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_data_in; -static PyObject *__pyx_n_s_data_out; -static PyObject *__pyx_n_s_diff; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_enter; -static PyObject *__pyx_n_s_exist_ok; -static PyObject *__pyx_n_s_exists; -static PyObject *__pyx_n_s_exit; -static PyObject *__pyx_n_s_f; -static PyObject *__pyx_n_b_fifth; -static PyObject *__pyx_n_b_first; -static PyObject *__pyx_n_b_fourth; -static PyObject *__pyx_n_b_hostname; -static PyObject *__pyx_kp_b_https_open_kattis_com_hostname; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_lhs; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_makedirs; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_mock; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_oddmanout; -static PyObject *__pyx_kp_s_oddmanout_ans1_txt; -static PyObject *__pyx_kp_s_oddmanout_in1_txt; -static PyObject *__pyx_n_s_open; -static PyObject *__pyx_n_s_os; -static PyObject *__pyx_n_s_path; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_r; -static PyObject *__pyx_n_s_read; -static PyObject *__pyx_n_s_res; -static PyObject *__pyx_n_s_rhs; -static PyObject *__pyx_n_s_rmtree; -static PyObject *__pyx_n_b_second; -static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_shutil; -static PyObject *__pyx_n_b_sixth; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_test_base_action; -static PyObject *__pyx_n_s_test_color; -static PyObject *__pyx_n_s_test_compare_entity; -static PyObject *__pyx_n_s_test_gen_action; -static PyObject *__pyx_n_s_test_ktlib; -static PyObject *__pyx_kp_s_test_ktlib_pyx; -static PyObject *__pyx_n_s_test_make_list_equal; -static PyObject *__pyx_n_s_test_write_sample; -static PyObject *__pyx_n_b_third; -static PyObject *__pyx_n_s_unittest; -static PyObject *__pyx_n_s_unittest_mock; -static PyObject *__pyx_pf_10test_ktlib_8CyTester_test_color(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10test_ktlib_8CyTester_2test_make_list_equal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10test_ktlib_8CyTester_4test_base_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10test_ktlib_8CyTester_6test_write_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10test_ktlib_8CyTester_8test_gen_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10test_ktlib_8CyTester_10test_compare_entity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_int_1; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_codeobj__13; -static PyObject *__pyx_codeobj__15; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__21; -static PyObject *__pyx_codeobj__23; -/* Late includes */ - -/* "test_ktlib.pyx":13 - * - * class CyTester(unittest.TestCase): - * def test_color(self): # <<<<<<<<<<<<<< - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10test_ktlib_8CyTester_1test_color(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10test_ktlib_8CyTester_1test_color = {"test_color", (PyCFunction)__pyx_pw_10test_ktlib_8CyTester_1test_color, METH_O, 0}; -static PyObject *__pyx_pw_10test_ktlib_8CyTester_1test_color(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("test_color (wrapper)", 0); - __pyx_r = __pyx_pf_10test_ktlib_8CyTester_test_color(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10test_ktlib_8CyTester_test_color(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("test_color", 0); - - /* "test_ktlib.pyx":14 - * class CyTester(unittest.TestCase): - * def test_color(self): - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') # <<<<<<<<<<<<<< - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_f_5ktlib_color_cyan(__pyx_k_hi, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_kp_b_6_96mhi_0m}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_kp_b_6_96mhi_0m}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3); - __Pyx_INCREF(__pyx_kp_b_6_96mhi_0m); - __Pyx_GIVEREF(__pyx_kp_b_6_96mhi_0m); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_kp_b_6_96mhi_0m); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":15 - * def test_color(self): - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') # <<<<<<<<<<<<<< - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_f_5ktlib_color_green(__pyx_k_universe, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_6, __pyx_kp_b_6_92muniverse_0m}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_6, __pyx_kp_b_6_92muniverse_0m}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_t_6); - __Pyx_INCREF(__pyx_kp_b_6_92muniverse_0m); - __Pyx_GIVEREF(__pyx_kp_b_6_92muniverse_0m); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_kp_b_6_92muniverse_0m); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":16 - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') # <<<<<<<<<<<<<< - * - * def test_make_list_equal(self): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_f_5ktlib_color_red(__pyx_k_cosmo, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_kp_b_6_91mcosmo_0m}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_kp_b_6_91mcosmo_0m}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_t_4); - __Pyx_INCREF(__pyx_kp_b_6_91mcosmo_0m); - __Pyx_GIVEREF(__pyx_kp_b_6_91mcosmo_0m); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_kp_b_6_91mcosmo_0m); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":13 - * - * class CyTester(unittest.TestCase): - * def test_color(self): # <<<<<<<<<<<<<< - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("test_ktlib.CyTester.test_color", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test_ktlib.pyx":18 - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - * - * def test_make_list_equal(self): # <<<<<<<<<<<<<< - * cdef: - * vector[string] lhs = [b'first', b'second', b'third'] - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10test_ktlib_8CyTester_3test_make_list_equal(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10test_ktlib_8CyTester_3test_make_list_equal = {"test_make_list_equal", (PyCFunction)__pyx_pw_10test_ktlib_8CyTester_3test_make_list_equal, METH_O, 0}; -static PyObject *__pyx_pw_10test_ktlib_8CyTester_3test_make_list_equal(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("test_make_list_equal (wrapper)", 0); - __pyx_r = __pyx_pf_10test_ktlib_8CyTester_2test_make_list_equal(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10test_ktlib_8CyTester_2test_make_list_equal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - std::vector __pyx_v_lhs; - std::vector __pyx_v_rhs; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - std::vector __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - std::string __pyx_t_9; - struct __pyx_opt_args_5ktlib_make_list_equal __pyx_t_10; - __Pyx_RefNannySetupContext("test_make_list_equal", 0); - - /* "test_ktlib.pyx":20 - * def test_make_list_equal(self): - * cdef: - * vector[string] lhs = [b'first', b'second', b'third'] # <<<<<<<<<<<<<< - * vector[string] rhs = [b'fourth'] - * ktlib.make_list_equal(lhs, rhs) - */ - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_b_first); - __Pyx_GIVEREF(__pyx_n_b_first); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_b_first); - __Pyx_INCREF(__pyx_n_b_second); - __Pyx_GIVEREF(__pyx_n_b_second); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_b_second); - __Pyx_INCREF(__pyx_n_b_third); - __Pyx_GIVEREF(__pyx_n_b_third); - PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_b_third); - __pyx_t_2 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_lhs = __pyx_t_2; - - /* "test_ktlib.pyx":21 - * cdef: - * vector[string] lhs = [b'first', b'second', b'third'] - * vector[string] rhs = [b'fourth'] # <<<<<<<<<<<<<< - * ktlib.make_list_equal(lhs, rhs) - * self.assertEqual(lhs.size(), rhs.size()) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_b_fourth); - __Pyx_GIVEREF(__pyx_n_b_fourth); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_b_fourth); - __pyx_t_2 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rhs = __pyx_t_2; - - /* "test_ktlib.pyx":22 - * vector[string] lhs = [b'first', b'second', b'third'] - * vector[string] rhs = [b'fourth'] - * ktlib.make_list_equal(lhs, rhs) # <<<<<<<<<<<<<< - * self.assertEqual(lhs.size(), rhs.size()) - * self.assertEqual(b'fourth', rhs.front()) - */ - __pyx_f_5ktlib_make_list_equal(__pyx_v_lhs, __pyx_v_rhs, NULL); - - /* "test_ktlib.pyx":23 - * vector[string] rhs = [b'fourth'] - * ktlib.make_list_equal(lhs, rhs) - * self.assertEqual(lhs.size(), rhs.size()) # <<<<<<<<<<<<<< - * self.assertEqual(b'fourth', rhs.front()) - * self.assertEqual(b'', rhs.back()) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_lhs.size()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_rhs.size()); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":24 - * ktlib.make_list_equal(lhs, rhs) - * self.assertEqual(lhs.size(), rhs.size()) - * self.assertEqual(b'fourth', rhs.front()) # <<<<<<<<<<<<<< - * self.assertEqual(b'', rhs.back()) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_rhs.front()); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_b_fourth, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_b_fourth, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_n_b_fourth); - __Pyx_GIVEREF(__pyx_n_b_fourth); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_n_b_fourth); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":25 - * self.assertEqual(lhs.size(), rhs.size()) - * self.assertEqual(b'fourth', rhs.front()) - * self.assertEqual(b'', rhs.back()) # <<<<<<<<<<<<<< - * - * rhs.push_back(b'fifth') - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_rhs.back()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_b_, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_b_, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_INCREF(__pyx_kp_b_); - __Pyx_GIVEREF(__pyx_kp_b_); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_kp_b_); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":27 - * self.assertEqual(b'', rhs.back()) - * - * rhs.push_back(b'fifth') # <<<<<<<<<<<<<< - * ktlib.make_list_equal(lhs, rhs, b'sixth') - * self.assertEqual(lhs.size(), rhs.size()) - */ - __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_fifth); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error) - try { - __pyx_v_rhs.push_back(__pyx_t_9); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 27, __pyx_L1_error) - } - - /* "test_ktlib.pyx":28 - * - * rhs.push_back(b'fifth') - * ktlib.make_list_equal(lhs, rhs, b'sixth') # <<<<<<<<<<<<<< - * self.assertEqual(lhs.size(), rhs.size()) - * self.assertEqual(b'sixth', lhs.back()) - */ - __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_sixth); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_t_10.__pyx_n = 1; - __pyx_t_10.pad_element = __pyx_t_9; - __pyx_f_5ktlib_make_list_equal(__pyx_v_lhs, __pyx_v_rhs, &__pyx_t_10); - - /* "test_ktlib.pyx":29 - * rhs.push_back(b'fifth') - * ktlib.make_list_equal(lhs, rhs, b'sixth') - * self.assertEqual(lhs.size(), rhs.size()) # <<<<<<<<<<<<<< - * self.assertEqual(b'sixth', lhs.back()) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_lhs.size()); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_rhs.size()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":30 - * ktlib.make_list_equal(lhs, rhs, b'sixth') - * self.assertEqual(lhs.size(), rhs.size()) - * self.assertEqual(b'sixth', lhs.back()) # <<<<<<<<<<<<<< - * - * def test_base_action (self): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_lhs.back()); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_b_sixth, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_b_sixth, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_n_b_sixth); - __Pyx_GIVEREF(__pyx_n_b_sixth); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_n_b_sixth); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":18 - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - * - * def test_make_list_equal(self): # <<<<<<<<<<<<<< - * cdef: - * vector[string] lhs = [b'first', b'second', b'third'] - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("test_ktlib.CyTester.test_make_list_equal", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test_ktlib.pyx":32 - * self.assertEqual(b'sixth', lhs.back()) - * - * def test_base_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Action action = ktlib.Action() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10test_ktlib_8CyTester_5test_base_action(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10test_ktlib_8CyTester_5test_base_action = {"test_base_action", (PyCFunction)__pyx_pw_10test_ktlib_8CyTester_5test_base_action, METH_O, 0}; -static PyObject *__pyx_pw_10test_ktlib_8CyTester_5test_base_action(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("test_base_action (wrapper)", 0); - __pyx_r = __pyx_pf_10test_ktlib_8CyTester_4test_base_action(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10test_ktlib_8CyTester_4test_base_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - struct __pyx_obj_5ktlib_Action *__pyx_v_action = 0; - std::string __pyx_v_res; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - std::string __pyx_t_2; - std::string __pyx_t_3; - struct __pyx_opt_args_5ktlib_6Action_get_url __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("test_base_action", 0); - - /* "test_ktlib.pyx":34 - * def test_base_action (self): - * cdef: - * ktlib.Action action = ktlib.Action() # <<<<<<<<<<<<<< - * string res - * - */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5ktlib_Action)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_action = ((struct __pyx_obj_5ktlib_Action *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "test_ktlib.pyx":37 - * string res - * - * action.read_config_from_file() # <<<<<<<<<<<<<< - * res = action.get_url(b'kattis', b'hostname') - * self.assertEqual(res, b'https://open.kattis.com/hostname') - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_action->__pyx_vtab)->read_config_from_file(__pyx_v_action); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":38 - * - * action.read_config_from_file() - * res = action.get_url(b'kattis', b'hostname') # <<<<<<<<<<<<<< - * self.assertEqual(res, b'https://open.kattis.com/hostname') - * - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_hostname); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_4.__pyx_n = 1; - __pyx_t_4.__pyx_default = __pyx_t_2; - __pyx_t_3 = ((struct __pyx_vtabstruct_5ktlib_Action *)__pyx_v_action->__pyx_vtab)->get_url(__pyx_v_action, __pyx_k_kattis, &__pyx_t_4); - __pyx_v_res = __pyx_t_3; - - /* "test_ktlib.pyx":39 - * action.read_config_from_file() - * res = action.get_url(b'kattis', b'hostname') - * self.assertEqual(res, b'https://open.kattis.com/hostname') # <<<<<<<<<<<<<< - * - * def test_write_sample (self): - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_res); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_kp_b_https_open_kattis_com_hostname}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_kp_b_https_open_kattis_com_hostname}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_kp_b_https_open_kattis_com_hostname); - __Pyx_GIVEREF(__pyx_kp_b_https_open_kattis_com_hostname); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_kp_b_https_open_kattis_com_hostname); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":32 - * self.assertEqual(b'sixth', lhs.back()) - * - * def test_base_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Action action = ktlib.Action() - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("test_ktlib.CyTester.test_base_action", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_action); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test_ktlib.pyx":41 - * self.assertEqual(res, b'https://open.kattis.com/hostname') - * - * def test_write_sample (self): # <<<<<<<<<<<<<< - * cdef: - * tuple data_in = (1, '104', 'biggest', True) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10test_ktlib_8CyTester_7test_write_sample(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10test_ktlib_8CyTester_7test_write_sample = {"test_write_sample", (PyCFunction)__pyx_pw_10test_ktlib_8CyTester_7test_write_sample, METH_O, 0}; -static PyObject *__pyx_pw_10test_ktlib_8CyTester_7test_write_sample(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("test_write_sample (wrapper)", 0); - __pyx_r = __pyx_pf_10test_ktlib_8CyTester_6test_write_sample(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10test_ktlib_8CyTester_6test_write_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_data_in = 0; - PyObject *__pyx_v_data_out = 0; - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - __Pyx_RefNannySetupContext("test_write_sample", 0); - - /* "test_ktlib.pyx":43 - * def test_write_sample (self): - * cdef: - * tuple data_in = (1, '104', 'biggest', True) # <<<<<<<<<<<<<< - * tuple data_out = (1, '1 24 52', 'biggest', False) - * os.makedirs('biggest', exist_ok=True) - */ - __Pyx_INCREF(__pyx_tuple__2); - __pyx_v_data_in = __pyx_tuple__2; - - /* "test_ktlib.pyx":44 - * cdef: - * tuple data_in = (1, '104', 'biggest', True) - * tuple data_out = (1, '1 24 52', 'biggest', False) # <<<<<<<<<<<<<< - * os.makedirs('biggest', exist_ok=True) - * - */ - __Pyx_INCREF(__pyx_tuple__3); - __pyx_v_data_out = __pyx_tuple__3; - - /* "test_ktlib.pyx":45 - * tuple data_in = (1, '104', 'biggest', True) - * tuple data_out = (1, '1 24 52', 'biggest', False) - * os.makedirs('biggest', exist_ok=True) # <<<<<<<<<<<<<< - * - * ktlib.write_samples(data_in) - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_makedirs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exist_ok, Py_True) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test_ktlib.pyx":47 - * os.makedirs('biggest', exist_ok=True) - * - * ktlib.write_samples(data_in) # <<<<<<<<<<<<<< - * self.assertTrue(os.path.exists('./biggest/in1.txt')) - * with open('./biggest/in1.txt', 'r') as f: - */ - __pyx_f_5ktlib_write_samples(__pyx_v_data_in, 0); - - /* "test_ktlib.pyx":48 - * - * ktlib.write_samples(data_in) - * self.assertTrue(os.path.exists('./biggest/in1.txt')) # <<<<<<<<<<<<<< - * with open('./biggest/in1.txt', 'r') as f: - * self.assertEqual(f.read(), '104') - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertTrue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_biggest_in1_txt) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_biggest_in1_txt); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test_ktlib.pyx":49 - * ktlib.write_samples(data_in) - * self.assertTrue(os.path.exists('./biggest/in1.txt')) - * with open('./biggest/in1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), '104') - * - */ - /*with:*/ { - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { - __pyx_v_f = __pyx_t_2; - __pyx_t_2 = 0; - - /* "test_ktlib.pyx":50 - * self.assertTrue(os.path.exists('./biggest/in1.txt')) - * with open('./biggest/in1.txt', 'r') as f: - * self.assertEqual(f.read(), '104') # <<<<<<<<<<<<<< - * - * ktlib.write_samples(data_out) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_kp_s_104}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_kp_s_104}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_t_1); - __Pyx_INCREF(__pyx_kp_s_104); - __Pyx_GIVEREF(__pyx_kp_s_104); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_kp_s_104); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":49 - * ktlib.write_samples(data_in) - * self.assertTrue(os.path.exists('./biggest/in1.txt')) - * with open('./biggest/in1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), '104') - * - */ - } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L12_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /*except:*/ { - __Pyx_AddTraceback("test_ktlib.CyTester.test_write_sample", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 49, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 49, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_12 < 0) __PYX_ERR(0, 49, __pyx_L9_except_error) - __pyx_t_13 = ((!(__pyx_t_12 != 0)) != 0); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_5); - __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 49, __pyx_L9_except_error) - } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L8_exception_handled; - } - __pyx_L9_except_error:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L1_error; - __pyx_L8_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_L12_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_6) { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__6, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - goto __pyx_L6; - } - __pyx_L6:; - } - goto __pyx_L16; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L1_error; - __pyx_L16:; - } - - /* "test_ktlib.pyx":52 - * self.assertEqual(f.read(), '104') - * - * ktlib.write_samples(data_out) # <<<<<<<<<<<<<< - * self.assertTrue(os.path.exists('./biggest/ans1.txt')) - * with open('./biggest/ans1.txt', 'r') as f: - */ - __pyx_f_5ktlib_write_samples(__pyx_v_data_out, 0); - - /* "test_ktlib.pyx":53 - * - * ktlib.write_samples(data_out) - * self.assertTrue(os.path.exists('./biggest/ans1.txt')) # <<<<<<<<<<<<<< - * with open('./biggest/ans1.txt', 'r') as f: - * self.assertEqual(f.read(), '1 24 52') - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertTrue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_biggest_ans1_txt) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_biggest_ans1_txt); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test_ktlib.pyx":54 - * ktlib.write_samples(data_out) - * self.assertTrue(os.path.exists('./biggest/ans1.txt')) - * with open('./biggest/ans1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), '1 24 52') - * shutil.rmtree('biggest') - */ - /*with:*/ { - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_2); - __pyx_t_2 = 0; - - /* "test_ktlib.pyx":55 - * self.assertTrue(os.path.exists('./biggest/ans1.txt')) - * with open('./biggest/ans1.txt', 'r') as f: - * self.assertEqual(f.read(), '1 24 52') # <<<<<<<<<<<<<< - * shutil.rmtree('biggest') - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_3, __pyx_kp_s_1_24_52}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_3, __pyx_kp_s_1_24_52}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_10, __pyx_t_3); - __Pyx_INCREF(__pyx_kp_s_1_24_52); - __Pyx_GIVEREF(__pyx_kp_s_1_24_52); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_10, __pyx_kp_s_1_24_52); - __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":54 - * ktlib.write_samples(data_out) - * self.assertTrue(os.path.exists('./biggest/ans1.txt')) - * with open('./biggest/ans1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), '1 24 52') - * shutil.rmtree('biggest') - */ - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L26_try_end; - __pyx_L21_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /*except:*/ { - __Pyx_AddTraceback("test_ktlib.CyTester.test_write_sample", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 54, __pyx_L23_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L23_except_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 54, __pyx_L23_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_13 < 0) __PYX_ERR(0, 54, __pyx_L23_except_error) - __pyx_t_12 = ((!(__pyx_t_13 != 0)) != 0); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_5, __pyx_t_4); - __pyx_t_2 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 54, __pyx_L23_except_error) - } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L22_exception_handled; - } - __pyx_L23_except_error:; - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); - goto __pyx_L1_error; - __pyx_L22_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); - __pyx_L26_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_6) { - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__6, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - goto __pyx_L20; - } - __pyx_L20:; - } - goto __pyx_L30; - __pyx_L17_error:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L1_error; - __pyx_L30:; - } - - /* "test_ktlib.pyx":56 - * with open('./biggest/ans1.txt', 'r') as f: - * self.assertEqual(f.read(), '1 24 52') - * shutil.rmtree('biggest') # <<<<<<<<<<<<<< - * - * def test_gen_action (self): - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_shutil); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rmtree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_s_biggest) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_biggest); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":41 - * self.assertEqual(res, b'https://open.kattis.com/hostname') - * - * def test_write_sample (self): # <<<<<<<<<<<<<< - * cdef: - * tuple data_in = (1, '104', 'biggest', True) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("test_ktlib.CyTester.test_write_sample", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_data_in); - __Pyx_XDECREF(__pyx_v_data_out); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test_ktlib.pyx":58 - * shutil.rmtree('biggest') - * - * def test_gen_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10test_ktlib_8CyTester_9test_gen_action(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10test_ktlib_8CyTester_9test_gen_action = {"test_gen_action", (PyCFunction)__pyx_pw_10test_ktlib_8CyTester_9test_gen_action, METH_O, 0}; -static PyObject *__pyx_pw_10test_ktlib_8CyTester_9test_gen_action(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("test_gen_action (wrapper)", 0); - __pyx_r = __pyx_pf_10test_ktlib_8CyTester_8test_gen_action(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10test_ktlib_8CyTester_8test_gen_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - struct __pyx_obj_5ktlib_Gen *__pyx_v_action = 0; - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - __Pyx_RefNannySetupContext("test_gen_action", 0); - - /* "test_ktlib.pyx":60 - * def test_gen_action (self): - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') # <<<<<<<<<<<<<< - * action.act() - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5ktlib_Gen), __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_action = ((struct __pyx_obj_5ktlib_Gen *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "test_ktlib.pyx":61 - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') - * action.act() # <<<<<<<<<<<<<< - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_action), __pyx_n_s_act); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":62 - * ktlib.Gen action = ktlib.Gen('oddmanout') - * action.act() - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) # <<<<<<<<<<<<<< - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - * with open('./oddmanout/in1.txt', 'r') as f: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertTrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_oddmanout_ans1_txt) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_oddmanout_ans1_txt); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":63 - * action.act() - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) # <<<<<<<<<<<<<< - * with open('./oddmanout/in1.txt', 'r') as f: - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertTrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_oddmanout_in1_txt) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_oddmanout_in1_txt); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":64 - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - * with open('./oddmanout/in1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: - */ - /*with:*/ { - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { - __pyx_v_f = __pyx_t_3; - __pyx_t_3 = 0; - - /* "test_ktlib.pyx":65 - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - * with open('./oddmanout/in1.txt', 'r') as f: - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") # <<<<<<<<<<<<<< - * with open('./oddmanout/ans1.txt', 'r') as f: - * self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_kp_s_3_3_1_2147483647_2147483647_5_3}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_kp_s_3_3_1_2147483647_2147483647_5_3}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_t_2); - __Pyx_INCREF(__pyx_kp_s_3_3_1_2147483647_2147483647_5_3); - __Pyx_GIVEREF(__pyx_kp_s_3_3_1_2147483647_2147483647_5_3); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_kp_s_3_3_1_2147483647_2147483647_5_3); - __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test_ktlib.pyx":64 - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - * with open('./oddmanout/in1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: - */ - } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L12_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /*except:*/ { - __Pyx_AddTraceback("test_ktlib.CyTester.test_gen_action", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 64, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_12 < 0) __PYX_ERR(0, 64, __pyx_L9_except_error) - __pyx_t_13 = ((!(__pyx_t_12 != 0)) != 0); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_5); - __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 64, __pyx_L9_except_error) - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L8_exception_handled; - } - __pyx_L9_except_error:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L1_error; - __pyx_L8_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_L12_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_6) { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__6, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - goto __pyx_L6; - } - __pyx_L6:; - } - goto __pyx_L16; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L1_error; - __pyx_L16:; - } - - /* "test_ktlib.pyx":66 - * with open('./oddmanout/in1.txt', 'r') as f: - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") - * shutil.rmtree('oddmanout') - */ - /*with:*/ { - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_3); - __pyx_t_3 = 0; - - /* "test_ktlib.pyx":67 - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: - * self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") # <<<<<<<<<<<<<< - * shutil.rmtree('oddmanout') - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_s_Case_1_1_Case_2_7_Case_3_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_s_Case_1_1_Case_2_7_Case_3_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_10, __pyx_t_1); - __Pyx_INCREF(__pyx_kp_s_Case_1_1_Case_2_7_Case_3_5); - __Pyx_GIVEREF(__pyx_kp_s_Case_1_1_Case_2_7_Case_3_5); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_10, __pyx_kp_s_Case_1_1_Case_2_7_Case_3_5); - __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L21_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test_ktlib.pyx":66 - * with open('./oddmanout/in1.txt', 'r') as f: - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") - * shutil.rmtree('oddmanout') - */ - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L26_try_end; - __pyx_L21_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /*except:*/ { - __Pyx_AddTraceback("test_ktlib.CyTester.test_gen_action", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 66, __pyx_L23_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L23_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 66, __pyx_L23_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_13 < 0) __PYX_ERR(0, 66, __pyx_L23_except_error) - __pyx_t_12 = ((!(__pyx_t_13 != 0)) != 0); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_4); - __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 66, __pyx_L23_except_error) - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L22_exception_handled; - } - __pyx_L23_except_error:; - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); - goto __pyx_L1_error; - __pyx_L22_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7); - __pyx_L26_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_6) { - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__6, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - goto __pyx_L20; - } - __pyx_L20:; - } - goto __pyx_L30; - __pyx_L17_error:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L1_error; - __pyx_L30:; - } - - /* "test_ktlib.pyx":68 - * with open('./oddmanout/ans1.txt', 'r') as f: - * self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") - * shutil.rmtree('oddmanout') # <<<<<<<<<<<<<< - * - * def test_compare_entity(self): - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_shutil); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rmtree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_n_s_oddmanout) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_oddmanout); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":58 - * shutil.rmtree('biggest') - * - * def test_gen_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("test_ktlib.CyTester.test_gen_action", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_action); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test_ktlib.pyx":70 - * shutil.rmtree('oddmanout') - * - * def test_compare_entity(self): # <<<<<<<<<<<<<< - * cdef: - * string lhs = b'Marrie' - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10test_ktlib_8CyTester_11test_compare_entity(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10test_ktlib_8CyTester_11test_compare_entity = {"test_compare_entity", (PyCFunction)__pyx_pw_10test_ktlib_8CyTester_11test_compare_entity, METH_O, 0}; -static PyObject *__pyx_pw_10test_ktlib_8CyTester_11test_compare_entity(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("test_compare_entity (wrapper)", 0); - __pyx_r = __pyx_pf_10test_ktlib_8CyTester_10test_compare_entity(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10test_ktlib_8CyTester_10test_compare_entity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - std::string __pyx_v_lhs; - std::string __pyx_v_rhs; - std::string __pyx_v_diff; - bool __pyx_v_res; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("test_compare_entity", 0); - - /* "test_ktlib.pyx":72 - * def test_compare_entity(self): - * cdef: - * string lhs = b'Marrie' # <<<<<<<<<<<<<< - * string rhs = b'Maria' - * string diff = b'' - */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_Marrie); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error) - __pyx_v_lhs = __pyx_t_1; - - /* "test_ktlib.pyx":73 - * cdef: - * string lhs = b'Marrie' - * string rhs = b'Maria' # <<<<<<<<<<<<<< - * string diff = b'' - * bool_t res - */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_Maria); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_v_rhs = __pyx_t_1; - - /* "test_ktlib.pyx":74 - * string lhs = b'Marrie' - * string rhs = b'Maria' - * string diff = b'' # <<<<<<<<<<<<<< - * bool_t res - * res = ktlib.compare_entity(lhs, rhs, diff) - */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error) - __pyx_v_diff = __pyx_t_1; - - /* "test_ktlib.pyx":76 - * string diff = b'' - * bool_t res - * res = ktlib.compare_entity(lhs, rhs, diff) # <<<<<<<<<<<<<< - * self.assertEqual(res, False) - * self.assertEqual(diff, b'\x1b[6;91mMarrie\x1b[0m\x1b[6;92mMaria\x1b[0m') - */ - __pyx_v_res = __pyx_f_5ktlib_compare_entity(__pyx_v_lhs, __pyx_v_rhs, __pyx_v_diff); - - /* "test_ktlib.pyx":77 - * bool_t res - * res = ktlib.compare_entity(lhs, rhs, diff) - * self.assertEqual(res, False) # <<<<<<<<<<<<<< - * self.assertEqual(diff, b'\x1b[6;91mMarrie\x1b[0m\x1b[6;92mMaria\x1b[0m') - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_res); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, Py_False}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, Py_False}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4); - __Pyx_INCREF(Py_False); - __Pyx_GIVEREF(Py_False); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, Py_False); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":78 - * res = ktlib.compare_entity(lhs, rhs, diff) - * self.assertEqual(res, False) - * self.assertEqual(diff, b'\x1b[6;91mMarrie\x1b[0m\x1b[6;92mMaria\x1b[0m') # <<<<<<<<<<<<<< - * - * lhs = b'Tesla' - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_diff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7); - __Pyx_INCREF(__pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m); - __Pyx_GIVEREF(__pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m); - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":80 - * self.assertEqual(diff, b'\x1b[6;91mMarrie\x1b[0m\x1b[6;92mMaria\x1b[0m') - * - * lhs = b'Tesla' # <<<<<<<<<<<<<< - * rhs = b'Tesla' - * diff.clear() - */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_Tesla); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) - __pyx_v_lhs = __pyx_t_1; - - /* "test_ktlib.pyx":81 - * - * lhs = b'Tesla' - * rhs = b'Tesla' # <<<<<<<<<<<<<< - * diff.clear() - * res = ktlib.compare_entity(lhs, rhs, diff) - */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_Tesla); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) - __pyx_v_rhs = __pyx_t_1; - - /* "test_ktlib.pyx":82 - * lhs = b'Tesla' - * rhs = b'Tesla' - * diff.clear() # <<<<<<<<<<<<<< - * res = ktlib.compare_entity(lhs, rhs, diff) - * self.assertEqual(res, True) - */ - __pyx_v_diff.clear(); - - /* "test_ktlib.pyx":83 - * rhs = b'Tesla' - * diff.clear() - * res = ktlib.compare_entity(lhs, rhs, diff) # <<<<<<<<<<<<<< - * self.assertEqual(res, True) - * self.assertEqual(diff, b'Tesla ') - */ - __pyx_v_res = __pyx_f_5ktlib_compare_entity(__pyx_v_lhs, __pyx_v_rhs, __pyx_v_diff); - - /* "test_ktlib.pyx":84 - * diff.clear() - * res = ktlib.compare_entity(lhs, rhs, diff) - * self.assertEqual(res, True) # <<<<<<<<<<<<<< - * self.assertEqual(diff, b'Tesla ') - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, Py_True}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, Py_True}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_t_5); - __Pyx_INCREF(Py_True); - __Pyx_GIVEREF(Py_True); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, Py_True); - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":85 - * res = ktlib.compare_entity(lhs, rhs, diff) - * self.assertEqual(res, True) - * self.assertEqual(diff, b'Tesla ') # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_assertEqual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_diff); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_kp_b_Tesla_2}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_kp_b_Tesla_2}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4); - __Pyx_INCREF(__pyx_kp_b_Tesla_2); - __Pyx_GIVEREF(__pyx_kp_b_Tesla_2); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_kp_b_Tesla_2); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":70 - * shutil.rmtree('oddmanout') - * - * def test_compare_entity(self): # <<<<<<<<<<<<<< - * cdef: - * string lhs = b'Marrie' - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("test_ktlib.CyTester.test_compare_entity", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); - - /* "string.to_py":32 - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); - - /* "string.to_py":38 - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); - - /* "string.to_py":44 - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); - - /* "string.to_py":50 - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); - - /* "string.to_py":56 - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { - Py_ssize_t __pyx_v_length; - char const *__pyx_v_data; - std::string __pyx_r; - __Pyx_RefNannyDeclarations - char const *__pyx_t_1; - __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); - - /* "string.from_py":14 - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length = 0 # <<<<<<<<<<<<<< - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) - */ - __pyx_v_length = 0; - - /* "string.from_py":15 - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< - * return string(data, length) - * - */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) - __pyx_v_data = __pyx_t_1; - - /* "string.from_py":16 - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = std::string(__pyx_v_data, __pyx_v_length); - goto __pyx_L0; - - /* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: - */ - -static std::vector __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; - PyObject *__pyx_v_item = NULL; - std::vector __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v - */ - if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { - __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 47, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); - __pyx_t_4 = 0; - - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v - * - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) - __pyx_v_v.push_back(((std::string)__pyx_t_5)); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_v; - goto __pyx_L0; - - /* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_test_ktlib(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_test_ktlib}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "test_ktlib", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0}, - {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0}, - {&__pyx_kp_s_1_24_52, __pyx_k_1_24_52, sizeof(__pyx_k_1_24_52), 0, 0, 1, 0}, - {&__pyx_kp_s_3_3_1_2147483647_2147483647_5_3, __pyx_k_3_3_1_2147483647_2147483647_5_3, sizeof(__pyx_k_3_3_1_2147483647_2147483647_5_3), 0, 0, 1, 0}, - {&__pyx_kp_b_6_91mMarrie_0m_6_92mMaria_0m, __pyx_k_6_91mMarrie_0m_6_92mMaria_0m, sizeof(__pyx_k_6_91mMarrie_0m_6_92mMaria_0m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_91mcosmo_0m, __pyx_k_6_91mcosmo_0m, sizeof(__pyx_k_6_91mcosmo_0m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_92muniverse_0m, __pyx_k_6_92muniverse_0m, sizeof(__pyx_k_6_92muniverse_0m), 0, 0, 0, 0}, - {&__pyx_kp_b_6_96mhi_0m, __pyx_k_6_96mhi_0m, sizeof(__pyx_k_6_96mhi_0m), 0, 0, 0, 0}, - {&__pyx_kp_s_Case_1_1_Case_2_7_Case_3_5, __pyx_k_Case_1_1_Case_2_7_Case_3_5, sizeof(__pyx_k_Case_1_1_Case_2_7_Case_3_5), 0, 0, 1, 0}, - {&__pyx_n_s_CyTester, __pyx_k_CyTester, sizeof(__pyx_k_CyTester), 0, 0, 1, 1}, - {&__pyx_n_s_CyTester_test_base_action, __pyx_k_CyTester_test_base_action, sizeof(__pyx_k_CyTester_test_base_action), 0, 0, 1, 1}, - {&__pyx_n_s_CyTester_test_color, __pyx_k_CyTester_test_color, sizeof(__pyx_k_CyTester_test_color), 0, 0, 1, 1}, - {&__pyx_n_s_CyTester_test_compare_entity, __pyx_k_CyTester_test_compare_entity, sizeof(__pyx_k_CyTester_test_compare_entity), 0, 0, 1, 1}, - {&__pyx_n_s_CyTester_test_gen_action, __pyx_k_CyTester_test_gen_action, sizeof(__pyx_k_CyTester_test_gen_action), 0, 0, 1, 1}, - {&__pyx_n_s_CyTester_test_make_list_equal, __pyx_k_CyTester_test_make_list_equal, sizeof(__pyx_k_CyTester_test_make_list_equal), 0, 0, 1, 1}, - {&__pyx_n_s_CyTester_test_write_sample, __pyx_k_CyTester_test_write_sample, sizeof(__pyx_k_CyTester_test_write_sample), 0, 0, 1, 1}, - {&__pyx_n_b_Maria, __pyx_k_Maria, sizeof(__pyx_k_Maria), 0, 0, 0, 1}, - {&__pyx_n_b_Marrie, __pyx_k_Marrie, sizeof(__pyx_k_Marrie), 0, 0, 0, 1}, - {&__pyx_n_b_Tesla, __pyx_k_Tesla, sizeof(__pyx_k_Tesla), 0, 0, 0, 1}, - {&__pyx_kp_b_Tesla_2, __pyx_k_Tesla_2, sizeof(__pyx_k_Tesla_2), 0, 0, 0, 0}, - {&__pyx_n_s_TestCase, __pyx_k_TestCase, sizeof(__pyx_k_TestCase), 0, 0, 1, 1}, - {&__pyx_n_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 1}, - {&__pyx_n_s_act, __pyx_k_act, sizeof(__pyx_k_act), 0, 0, 1, 1}, - {&__pyx_n_s_action, __pyx_k_action, sizeof(__pyx_k_action), 0, 0, 1, 1}, - {&__pyx_n_s_assertEqual, __pyx_k_assertEqual, sizeof(__pyx_k_assertEqual), 0, 0, 1, 1}, - {&__pyx_n_s_assertTrue, __pyx_k_assertTrue, sizeof(__pyx_k_assertTrue), 0, 0, 1, 1}, - {&__pyx_n_s_biggest, __pyx_k_biggest, sizeof(__pyx_k_biggest), 0, 0, 1, 1}, - {&__pyx_kp_s_biggest_ans1_txt, __pyx_k_biggest_ans1_txt, sizeof(__pyx_k_biggest_ans1_txt), 0, 0, 1, 0}, - {&__pyx_kp_s_biggest_in1_txt, __pyx_k_biggest_in1_txt, sizeof(__pyx_k_biggest_in1_txt), 0, 0, 1, 0}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_data_in, __pyx_k_data_in, sizeof(__pyx_k_data_in), 0, 0, 1, 1}, - {&__pyx_n_s_data_out, __pyx_k_data_out, sizeof(__pyx_k_data_out), 0, 0, 1, 1}, - {&__pyx_n_s_diff, __pyx_k_diff, sizeof(__pyx_k_diff), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, - {&__pyx_n_s_exist_ok, __pyx_k_exist_ok, sizeof(__pyx_k_exist_ok), 0, 0, 1, 1}, - {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1}, - {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, - {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, - {&__pyx_n_b_fifth, __pyx_k_fifth, sizeof(__pyx_k_fifth), 0, 0, 0, 1}, - {&__pyx_n_b_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 0, 1}, - {&__pyx_n_b_fourth, __pyx_k_fourth, sizeof(__pyx_k_fourth), 0, 0, 0, 1}, - {&__pyx_n_b_hostname, __pyx_k_hostname, sizeof(__pyx_k_hostname), 0, 0, 0, 1}, - {&__pyx_kp_b_https_open_kattis_com_hostname, __pyx_k_https_open_kattis_com_hostname, sizeof(__pyx_k_https_open_kattis_com_hostname), 0, 0, 0, 0}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_lhs, __pyx_k_lhs, sizeof(__pyx_k_lhs), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_makedirs, __pyx_k_makedirs, sizeof(__pyx_k_makedirs), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_mock, __pyx_k_mock, sizeof(__pyx_k_mock), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_oddmanout, __pyx_k_oddmanout, sizeof(__pyx_k_oddmanout), 0, 0, 1, 1}, - {&__pyx_kp_s_oddmanout_ans1_txt, __pyx_k_oddmanout_ans1_txt, sizeof(__pyx_k_oddmanout_ans1_txt), 0, 0, 1, 0}, - {&__pyx_kp_s_oddmanout_in1_txt, __pyx_k_oddmanout_in1_txt, sizeof(__pyx_k_oddmanout_in1_txt), 0, 0, 1, 0}, - {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, - {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, - {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, - {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, - {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1}, - {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1}, - {&__pyx_n_s_rmtree, __pyx_k_rmtree, sizeof(__pyx_k_rmtree), 0, 0, 1, 1}, - {&__pyx_n_b_second, __pyx_k_second, sizeof(__pyx_k_second), 0, 0, 0, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_shutil, __pyx_k_shutil, sizeof(__pyx_k_shutil), 0, 0, 1, 1}, - {&__pyx_n_b_sixth, __pyx_k_sixth, sizeof(__pyx_k_sixth), 0, 0, 0, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_test_base_action, __pyx_k_test_base_action, sizeof(__pyx_k_test_base_action), 0, 0, 1, 1}, - {&__pyx_n_s_test_color, __pyx_k_test_color, sizeof(__pyx_k_test_color), 0, 0, 1, 1}, - {&__pyx_n_s_test_compare_entity, __pyx_k_test_compare_entity, sizeof(__pyx_k_test_compare_entity), 0, 0, 1, 1}, - {&__pyx_n_s_test_gen_action, __pyx_k_test_gen_action, sizeof(__pyx_k_test_gen_action), 0, 0, 1, 1}, - {&__pyx_n_s_test_ktlib, __pyx_k_test_ktlib, sizeof(__pyx_k_test_ktlib), 0, 0, 1, 1}, - {&__pyx_kp_s_test_ktlib_pyx, __pyx_k_test_ktlib_pyx, sizeof(__pyx_k_test_ktlib_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_test_make_list_equal, __pyx_k_test_make_list_equal, sizeof(__pyx_k_test_make_list_equal), 0, 0, 1, 1}, - {&__pyx_n_s_test_write_sample, __pyx_k_test_write_sample, sizeof(__pyx_k_test_write_sample), 0, 0, 1, 1}, - {&__pyx_n_b_third, __pyx_k_third, sizeof(__pyx_k_third), 0, 0, 0, 1}, - {&__pyx_n_s_unittest, __pyx_k_unittest, sizeof(__pyx_k_unittest), 0, 0, 1, 1}, - {&__pyx_n_s_unittest_mock, __pyx_k_unittest_mock, sizeof(__pyx_k_unittest_mock), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 49, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "test_ktlib.pyx":43 - * def test_write_sample (self): - * cdef: - * tuple data_in = (1, '104', 'biggest', True) # <<<<<<<<<<<<<< - * tuple data_out = (1, '1 24 52', 'biggest', False) - * os.makedirs('biggest', exist_ok=True) - */ - __pyx_tuple__2 = PyTuple_Pack(4, __pyx_int_1, __pyx_kp_s_104, __pyx_n_s_biggest, Py_True); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "test_ktlib.pyx":44 - * cdef: - * tuple data_in = (1, '104', 'biggest', True) - * tuple data_out = (1, '1 24 52', 'biggest', False) # <<<<<<<<<<<<<< - * os.makedirs('biggest', exist_ok=True) - * - */ - __pyx_tuple__3 = PyTuple_Pack(4, __pyx_int_1, __pyx_kp_s_1_24_52, __pyx_n_s_biggest, Py_False); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "test_ktlib.pyx":45 - * tuple data_in = (1, '104', 'biggest', True) - * tuple data_out = (1, '1 24 52', 'biggest', False) - * os.makedirs('biggest', exist_ok=True) # <<<<<<<<<<<<<< - * - * ktlib.write_samples(data_in) - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_biggest); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "test_ktlib.pyx":49 - * ktlib.write_samples(data_in) - * self.assertTrue(os.path.exists('./biggest/in1.txt')) - * with open('./biggest/in1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), '104') - * - */ - __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_s_biggest_in1_txt, __pyx_n_s_r); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_tuple__6 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "test_ktlib.pyx":54 - * ktlib.write_samples(data_out) - * self.assertTrue(os.path.exists('./biggest/ans1.txt')) - * with open('./biggest/ans1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), '1 24 52') - * shutil.rmtree('biggest') - */ - __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s_biggest_ans1_txt, __pyx_n_s_r); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "test_ktlib.pyx":60 - * def test_gen_action (self): - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') # <<<<<<<<<<<<<< - * action.act() - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_oddmanout); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "test_ktlib.pyx":64 - * self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - * self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - * with open('./oddmanout/in1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: - */ - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_s_oddmanout_in1_txt, __pyx_n_s_r); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "test_ktlib.pyx":66 - * with open('./oddmanout/in1.txt', 'r') as f: - * self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - * with open('./oddmanout/ans1.txt', 'r') as f: # <<<<<<<<<<<<<< - * self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") - * shutil.rmtree('oddmanout') - */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_kp_s_oddmanout_ans1_txt, __pyx_n_s_r); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "test_ktlib.pyx":13 - * - * class CyTester(unittest.TestCase): - * def test_color(self): # <<<<<<<<<<<<<< - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_ktlib_pyx, __pyx_n_s_test_color, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 13, __pyx_L1_error) - - /* "test_ktlib.pyx":18 - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - * - * def test_make_list_equal(self): # <<<<<<<<<<<<<< - * cdef: - * vector[string] lhs = [b'first', b'second', b'third'] - */ - __pyx_tuple__14 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_lhs, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_ktlib_pyx, __pyx_n_s_test_make_list_equal, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 18, __pyx_L1_error) - - /* "test_ktlib.pyx":32 - * self.assertEqual(b'sixth', lhs.back()) - * - * def test_base_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Action action = ktlib.Action() - */ - __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_action, __pyx_n_s_res); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_ktlib_pyx, __pyx_n_s_test_base_action, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 32, __pyx_L1_error) - - /* "test_ktlib.pyx":41 - * self.assertEqual(res, b'https://open.kattis.com/hostname') - * - * def test_write_sample (self): # <<<<<<<<<<<<<< - * cdef: - * tuple data_in = (1, '104', 'biggest', True) - */ - __pyx_tuple__18 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_data_in, __pyx_n_s_data_out, __pyx_n_s_f); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_ktlib_pyx, __pyx_n_s_test_write_sample, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 41, __pyx_L1_error) - - /* "test_ktlib.pyx":58 - * shutil.rmtree('biggest') - * - * def test_gen_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') - */ - __pyx_tuple__20 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_action, __pyx_n_s_f); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_ktlib_pyx, __pyx_n_s_test_gen_action, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 58, __pyx_L1_error) - - /* "test_ktlib.pyx":70 - * shutil.rmtree('oddmanout') - * - * def test_compare_entity(self): # <<<<<<<<<<<<<< - * cdef: - * string lhs = b'Marrie' - */ - __pyx_tuple__22 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_lhs, __pyx_n_s_rhs, __pyx_n_s_diff, __pyx_n_s_res); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_ktlib_pyx, __pyx_n_s_test_compare_entity, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule("ktlib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5ktlib_Action = __Pyx_ImportType(__pyx_t_1, "ktlib", "Action", sizeof(struct __pyx_obj_5ktlib_Action), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5ktlib_Action) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_vtabptr_5ktlib_Action = (struct __pyx_vtabstruct_5ktlib_Action*)__Pyx_GetVtable(__pyx_ptype_5ktlib_Action->tp_dict); if (unlikely(!__pyx_vtabptr_5ktlib_Action)) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_ptype_5ktlib_Gen = __Pyx_ImportType(__pyx_t_1, "ktlib", "Gen", sizeof(struct __pyx_obj_5ktlib_Gen), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5ktlib_Gen) __PYX_ERR(2, 29, __pyx_L1_error) - __pyx_vtabptr_5ktlib_Gen = (struct __pyx_vtabstruct_5ktlib_Gen*)__Pyx_GetVtable(__pyx_ptype_5ktlib_Gen->tp_dict); if (unlikely(!__pyx_vtabptr_5ktlib_Gen)) __PYX_ERR(2, 29, __pyx_L1_error) - __pyx_ptype_5ktlib_Test = __Pyx_ImportType(__pyx_t_1, "ktlib", "Test", sizeof(struct __pyx_obj_5ktlib_Test), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5ktlib_Test) __PYX_ERR(2, 40, __pyx_L1_error) - __pyx_vtabptr_5ktlib_Test = (struct __pyx_vtabstruct_5ktlib_Test*)__Pyx_GetVtable(__pyx_ptype_5ktlib_Test->tp_dict); if (unlikely(!__pyx_vtabptr_5ktlib_Test)) __PYX_ERR(2, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __pyx_t_1 = PyImport_ImportModule("ktlib"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "color_cyan", (void (**)(void))&__pyx_f_5ktlib_color_cyan, "std::string (std::string const &, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "color_green", (void (**)(void))&__pyx_f_5ktlib_color_green, "std::string (std::string const &, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "color_red", (void (**)(void))&__pyx_f_5ktlib_color_red, "std::string (std::string const &, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "make_list_equal", (void (**)(void))&__pyx_f_5ktlib_make_list_equal, "void (std::vector &, std::vector &, struct __pyx_opt_args_5ktlib_make_list_equal *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "write_samples", (void (**)(void))&__pyx_f_5ktlib_write_samples, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_1, "compare_entity", (void (**)(void))&__pyx_f_5ktlib_compare_entity, "bool (std::string const &, std::string const &, std::string &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - - -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC inittest_ktlib(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC inittest_ktlib(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_test_ktlib(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_test_ktlib(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_test_ktlib(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'test_ktlib' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_test_ktlib(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("test_ktlib", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_test_ktlib) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "test_ktlib")) { - if (unlikely(PyDict_SetItemString(modules, "test_ktlib", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error; - (void)__Pyx_modinit_variable_import_code(); - if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "test_ktlib.pyx":6 - * - * cimport ktlib - * import unittest # <<<<<<<<<<<<<< - * import unittest.mock as mock - * import os - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_unittest, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unittest, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test_ktlib.pyx":7 - * cimport ktlib - * import unittest - * import unittest.mock as mock # <<<<<<<<<<<<<< - * import os - * import shutil - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s__11); - __Pyx_GIVEREF(__pyx_n_s__11); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__11); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_unittest_mock, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mock, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":8 - * import unittest - * import unittest.mock as mock - * import os # <<<<<<<<<<<<<< - * import shutil - * - */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":9 - * import unittest.mock as mock - * import os - * import shutil # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_shutil, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shutil, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":12 - * - * - * class CyTester(unittest.TestCase): # <<<<<<<<<<<<<< - * def test_color(self): - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unittest); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TestCase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_CyTester, __pyx_n_s_CyTester, (PyObject *) NULL, __pyx_n_s_test_ktlib, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "test_ktlib.pyx":13 - * - * class CyTester(unittest.TestCase): - * def test_color(self): # <<<<<<<<<<<<<< - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - * self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10test_ktlib_8CyTester_1test_color, 0, __pyx_n_s_CyTester_test_color, NULL, __pyx_n_s_test_ktlib, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_test_color, __pyx_t_4) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":18 - * self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - * - * def test_make_list_equal(self): # <<<<<<<<<<<<<< - * cdef: - * vector[string] lhs = [b'first', b'second', b'third'] - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10test_ktlib_8CyTester_3test_make_list_equal, 0, __pyx_n_s_CyTester_test_make_list_equal, NULL, __pyx_n_s_test_ktlib, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_test_make_list_equal, __pyx_t_4) < 0) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":32 - * self.assertEqual(b'sixth', lhs.back()) - * - * def test_base_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Action action = ktlib.Action() - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10test_ktlib_8CyTester_5test_base_action, 0, __pyx_n_s_CyTester_test_base_action, NULL, __pyx_n_s_test_ktlib, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_test_base_action, __pyx_t_4) < 0) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":41 - * self.assertEqual(res, b'https://open.kattis.com/hostname') - * - * def test_write_sample (self): # <<<<<<<<<<<<<< - * cdef: - * tuple data_in = (1, '104', 'biggest', True) - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10test_ktlib_8CyTester_7test_write_sample, 0, __pyx_n_s_CyTester_test_write_sample, NULL, __pyx_n_s_test_ktlib, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_test_write_sample, __pyx_t_4) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":58 - * shutil.rmtree('biggest') - * - * def test_gen_action (self): # <<<<<<<<<<<<<< - * cdef: - * ktlib.Gen action = ktlib.Gen('oddmanout') - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10test_ktlib_8CyTester_9test_gen_action, 0, __pyx_n_s_CyTester_test_gen_action, NULL, __pyx_n_s_test_ktlib, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_test_gen_action, __pyx_t_4) < 0) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":70 - * shutil.rmtree('oddmanout') - * - * def test_compare_entity(self): # <<<<<<<<<<<<<< - * cdef: - * string lhs = b'Marrie' - */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10test_ktlib_8CyTester_11test_compare_entity, 0, __pyx_n_s_CyTester_test_compare_entity, NULL, __pyx_n_s_test_ktlib, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_test_compare_entity, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "test_ktlib.pyx":12 - * - * - * class CyTester(unittest.TestCase): # <<<<<<<<<<<<<< - * def test_color(self): - * self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_CyTester, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_CyTester, __pyx_t_4) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test_ktlib.pyx":1 - * from libcpp.string cimport string # <<<<<<<<<<<<<< - * from libcpp.vector cimport vector - * from libcpp cimport bool as bool_t - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") - * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init test_ktlib", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init test_ktlib"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) -#else - if (likely(PyCFunction_Check(func))) -#endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) -{ - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if ((size_t)basicsize < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; -} -#endif - -/* GetVTable */ -static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* CalculateMetaclass */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; -#endif - if (!metaclass) { - metaclass = tmptype; - continue; - } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; -#else - metaclass = &PyType_Type; -#endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; -} - -/* FetchCommonType */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunctionShared */ -#include -static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - if (unlikely(op == NULL)) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults_size = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - __Pyx__CyFunction_dealloc(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - m->defaults_size = size; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); - } - return op; -} - -/* Py3ClassCreate */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, - PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { - PyObject *ns; - if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); - if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); - Py_DECREF(prep); - Py_DECREF(pargs); - } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - PyErr_Clear(); - ns = PyDict_New(); - } - } else { - ns = PyDict_New(); - } - if (unlikely(!ns)) - return NULL; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; - if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; - return ns; -bad: - Py_DECREF(ns); - return NULL; -} -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, - PyObject *dict, PyObject *mkw, - int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; - PyObject *owned_metaclass = NULL; - if (allow_py2_metaclass) { - owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); - if (owned_metaclass) { - metaclass = owned_metaclass; - } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { - PyErr_Clear(); - } else { - return NULL; - } - } - if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { - metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); - Py_XDECREF(owned_metaclass); - if (unlikely(!metaclass)) - return NULL; - owned_metaclass = metaclass; - } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); - } - Py_XDECREF(owned_metaclass); - return result; -} - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { - Py_DECREF(result); - return NULL; - } - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/test_ktlib.pyx b/test_ktlib.pyx deleted file mode 100644 index 8410fe4..0000000 --- a/test_ktlib.pyx +++ /dev/null @@ -1,87 +0,0 @@ -from libcpp.string cimport string -from libcpp.vector cimport vector -from libcpp cimport bool as bool_t - -cimport ktlib -import unittest -import unittest.mock as mock -import os -import shutil - - -class CyTester(unittest.TestCase): - def test_color(self): - self.assertEqual(ktlib.color_cyan(b'hi'), b'\x1b[6;96mhi\x1b[0m') - self.assertEqual(ktlib.color_green(b'universe'), b'\x1b[6;92muniverse\x1b[0m') - self.assertEqual(ktlib.color_red(b'cosmo'), b'\x1b[6;91mcosmo\x1b[0m') - - def test_make_list_equal(self): - cdef: - vector[string] lhs = [b'first', b'second', b'third'] - vector[string] rhs = [b'fourth'] - ktlib.make_list_equal(lhs, rhs) - self.assertEqual(lhs.size(), rhs.size()) - self.assertEqual(b'fourth', rhs.front()) - self.assertEqual(b'', rhs.back()) - - rhs.push_back(b'fifth') - ktlib.make_list_equal(lhs, rhs, b'sixth') - self.assertEqual(lhs.size(), rhs.size()) - self.assertEqual(b'sixth', lhs.back()) - - def test_base_action (self): - cdef: - ktlib.Action action = ktlib.Action() - string res - - action.read_config_from_file() - res = action.get_url(b'kattis', b'hostname') - self.assertEqual(res, b'https://open.kattis.com/hostname') - - def test_write_sample (self): - cdef: - tuple data_in = (1, '104', 'biggest', True) - tuple data_out = (1, '1 24 52', 'biggest', False) - os.makedirs('biggest', exist_ok=True) - - ktlib.write_samples(data_in) - self.assertTrue(os.path.exists('./biggest/in1.txt')) - with open('./biggest/in1.txt', 'r') as f: - self.assertEqual(f.read(), '104') - - ktlib.write_samples(data_out) - self.assertTrue(os.path.exists('./biggest/ans1.txt')) - with open('./biggest/ans1.txt', 'r') as f: - self.assertEqual(f.read(), '1 24 52') - shutil.rmtree('biggest') - - def test_gen_action (self): - cdef: - ktlib.Gen action = ktlib.Gen('oddmanout') - action.act() - self.assertTrue(os.path.exists('./oddmanout/ans1.txt')) - self.assertTrue(os.path.exists('./oddmanout/in1.txt')) - with open('./oddmanout/in1.txt', 'r') as f: - self.assertEqual(f.read(), """3\n3\n1 2147483647 2147483647\n5\n3 4 7 4 3\n5\n2 10 2 10 5\n""") - with open('./oddmanout/ans1.txt', 'r') as f: - self.assertEqual(f.read(), """Case #1: 1\nCase #2: 7\nCase #3: 5\n""") - shutil.rmtree('oddmanout') - - def test_compare_entity(self): - cdef: - string lhs = b'Marrie' - string rhs = b'Maria' - string diff = b'' - bool_t res - res = ktlib.compare_entity(lhs, rhs, diff) - self.assertEqual(res, False) - self.assertEqual(diff, b'\x1b[6;91mMarrie\x1b[0m\x1b[6;92mMaria\x1b[0m') - - lhs = b'Tesla' - rhs = b'Tesla' - diff.clear() - res = ktlib.compare_entity(lhs, rhs, diff) - self.assertEqual(res, True) - self.assertEqual(diff, b'Tesla ') - -