diff --git a/Pipfile b/Pipfile index 711dffc6..3059c264 100644 --- a/Pipfile +++ b/Pipfile @@ -5,7 +5,7 @@ name = "pypi" [packages] arxiv-auth = "==0.2.7" -arxiv-base = "==0.14.3" +arxiv-base = "==0.15.2" boto = "==2.48.0" "boto3" = "==1.6.6" botocore = "==1.9.6" @@ -28,7 +28,7 @@ jsonschema = "==2.6.0" markupsafe = "==1.0" mccabe = "==0.6.1" mock = "==2.0.0" -mypy = "==0.560" +mypy = "==0.670" "nose2" = "==0.7.3" pbr = "==3.1.1" psutil = "==5.4.3" @@ -43,7 +43,6 @@ requests = "==2.20.0" snowballstemmer = "==1.2.1" thrift = "==0.11.0" thrift-connector = "==0.23" -typed-ast = "==1.1.0" "urllib3" = "==1.22" werkzeug = "==0.14.1" wtforms = "==2.1" diff --git a/Pipfile.lock b/Pipfile.lock index 04744ba5..651fadc2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "8da6ed86a8730616858c16cc719edab981aac16cd3369fabd9082e6bb8e86d28" + "sha256": "6072c8a0a2ff9f76ff7f46f802420339d62e91090f1aa8740d7a5cb4b65ac9b4" }, "pipfile-spec": 6, "requires": {}, @@ -23,10 +23,10 @@ }, "arxiv-base": { "hashes": [ - "sha256:4c2ca540aeed0a06394e6eea12364562e2e4733d4803812f5d7542475dd55d09" + "sha256:a5c159a937d2d4304440e661ea14ff81bf32950e19765a14bc9efcb7750bbfb3" ], "index": "pypi", - "version": "==0.14.3" + "version": "==0.15.2" }, "bleach": { "hashes": [ @@ -219,35 +219,35 @@ }, "lxml": { "hashes": [ - "sha256:0537eee4902e8bf4f41bfee8133f7edf96533dd175930a12086d6a40d62376b2", - "sha256:0562ec748abd230ab87d73384e08fa784f9b9cee89e28696087d2d22c052cc27", - "sha256:09e91831e749fbf0f24608694e4573be0ef51430229450c39c83176cc2e2d353", - "sha256:1ae4c0722fc70c0d4fba43ae33c2885f705e96dce1db41f75ae14a2d2749b428", - "sha256:1c630c083d782cbaf1f7f37f6cac87bda9cff643cf2803a5f180f30d97955cef", - "sha256:2fe74e3836bd8c0fa7467ffae05545233c7f37de1eb765cacfda15ad20c6574a", - "sha256:37af783c2667ead34a811037bda56a0b142ac8438f7ed29ae93f82ddb812fbd6", - "sha256:3f2d9eafbb0b24a33f56acd16f39fc935756524dcb3172892721c54713964c70", - "sha256:47d8365a8ef14097aa4c65730689be51851b4ade677285a3b2daa03b37893e26", - "sha256:510e904079bc56ea784677348e151e1156040dbfb736f1d8ea4b9e6d0ab2d9f4", - "sha256:58d0851da422bba31c7f652a7e9335313cf94a641aa6d73b8f3c67602f75b593", - "sha256:7940d5c2185ffb989203dacbb28e6ae88b4f1bb25d04e17f94b0edd82232bcbd", - "sha256:7cf39bb3a905579836f7a8f3a45320d9eb22f16ab0c1e112efb940ced4d057a5", - "sha256:9563a23c1456c0ab550c087833bc13fcc61013a66c6420921d5b70550ea312bf", - "sha256:95b392952935947e0786a90b75cc33388549dcb19af716b525dae65b186138fc", - "sha256:983129f3fd3cef5c3cf067adcca56e30a169656c00fcc6c648629dbb850b27fa", - "sha256:a0b75b1f1854771844c647c464533def3e0a899dd094a85d1d4ed72ecaaee93d", - "sha256:b5db89cc0ef624f3a81214b7961a99f443b8c91e88188376b6b322fd10d5b118", - "sha256:c0a7751ba1a4bfbe7831920d98cee3ce748007eab8dfda74593d44079568219a", - "sha256:c0c5a7d4aafcc30c9b6d8613a362567e32e5f5b708dc41bc3a81dac56f8af8bb", - "sha256:d4d63d85eacc6cb37b459b16061e1f100d154bee89dc8d8f9a6128a5a538e92e", - "sha256:da5e7e941d6e71c9c9a717c93725cda0708c2474f532e3680ac5e39ec57d224d", - "sha256:dccad2b3c583f036f43f80ac99ee212c2fa9a45151358d55f13004d095e683b2", - "sha256:df46307d39f2aeaafa1d25309b8a8d11738b73e9861f72d4d0a092528f498baa", - "sha256:e70b5e1cb48828ddd2818f99b1662cb9226dc6f57d07fc75485405c77da17436", - "sha256:ea825562b8cd057cbc9810d496b8b5dec37a1e2fc7b27bc7c1e72ce94462a09a" - ], - "index": "pypi", - "version": "==4.3.1" + "sha256:0358b9e9642bc7d39aac5cffe9884a99a5ca68e5e2c1b89e570ed60da9139908", + "sha256:091a359c4dafebbecd3959d9013f1b896b5371859165e4e50b01607a98d9e3e2", + "sha256:1998e4e60603c64bcc35af61b4331ab3af087457900d3980e18d190e17c3a697", + "sha256:2000b4088dee9a41f459fddaf6609bba48a435ce6374bb254c5ccdaa8928c5ba", + "sha256:2afb0064780d8aaf165875be5898c1866766e56175714fa5f9d055433e92d41d", + "sha256:2d8f1d9334a4e3ff176d096c14ded3100547d73440683567d85b8842a53180bb", + "sha256:2e38db22f6a3199fd63675e1b4bd795d676d906869047398f29f38ca55cb453a", + "sha256:3181f84649c1a1ca62b19ddf28436b1b2cb05ae6c7d2628f33872e713994c364", + "sha256:37462170dfd88af8431d04de6b236e6e9c06cda71e2ca26d88ef2332fd2a5237", + "sha256:3a9d8521c89bf6f2a929c3d12ad3ad7392c774c327ea809fd08a13be6b3bc05f", + "sha256:3d0bbd2e1a28b4429f24fd63a122a450ce9edb7a8063d070790092d7343a1aa4", + "sha256:483d60585ce3ee71929cea70949059f83850fa5e12deb9c094ed1c8c2ec73cbd", + "sha256:4888be27d5cba55ce94209baef5bcd7bbd7314a3d17021a5fc10000b3a5f737d", + "sha256:64b0d62e4209170a2a0c404c446ab83b941a0003e96604d2e4f4cb735f8a2254", + "sha256:68010900898fdf139ac08549c4dba8206c584070a960ffc530aebf0c6f2794ef", + "sha256:872ecb066de602a0099db98bd9e57f4cfc1d62f6093d94460c787737aa08f39e", + "sha256:88a32b03f2e4cd0e63f154cac76724709f40b3fc2f30139eb5d6f900521b44ed", + "sha256:b1dc7683da4e67ab2bebf266afa68098d681ae02ce570f0d1117312273d2b2ac", + "sha256:b29e27ce9371810250cb1528a771d047a9c7b0f79630dc7dc5815ff828f4273b", + "sha256:ce197559596370d985f1ce6b7051b52126849d8159040293bf8b98cb2b3e1f78", + "sha256:d45cf6daaf22584eff2175f48f82c4aa24d8e72a44913c5aff801819bb73d11f", + "sha256:e2ff9496322b2ce947ba4a7a5eb048158de9d6f3fe9efce29f1e8dd6878561e6", + "sha256:f7b979518ec1f294a41a707c007d54d0f3b3e1fd15d5b26b7e99b62b10d9a72e", + "sha256:f9c7268e9d16e34e50f8246c4f24cf7353764affd2bc971f0379514c246e3f6b", + "sha256:f9c839806089d79de588ee1dde2dae05dc1156d3355dfeb2b51fde84d9c960ad", + "sha256:ff962953e2389226adc4d355e34a98b0b800984399153c6678f2367b11b4d4b8" + ], + "index": "pypi", + "version": "==4.3.2" }, "markupsafe": { "hashes": [ @@ -274,11 +274,18 @@ }, "mypy": { "hashes": [ - "sha256:aa668809ae0dbec5e9feb8929f4b5e1f9318a0a397447fa2f38c382a2ed6a036", - "sha256:bd0c9a2fcf0c4f7a54a2b625f466fcc000d415f371298d96fa5d2acc69074aca" + "sha256:308c274eb8482fbf16006f549137ddc0d69e5a589465e37b99c4564414363ca7", + "sha256:e80fd6af34614a0e898a57f14296d0dacb584648f0339c2e000ddbf0f4cc2f8d" ], "index": "pypi", - "version": "==0.560" + "version": "==0.670" + }, + "mypy-extensions": { + "hashes": [ + "sha256:37e0e956f41369209a3d5f34580150bcacfabaa57b33a15c0b25f4b5725e0812", + "sha256:b16cabe759f55e3409a7d231ebd2841378fb0c27a5d1994719e340e4f429ac3e" + ], + "version": "==0.4.1" }, "mysqlclient": { "hashes": [ @@ -427,9 +434,9 @@ }, "sqlalchemy": { "hashes": [ - "sha256:8027fa183f5be466030617a497b2d64e0e16c8d615e5a34bdf9fab6f66bf4723" + "sha256:11ead7047ff3f394ed0d4b62aded6c5d970a9b718e1dc6add9f5e79442cc5b14" ], - "version": "==1.2.18" + "version": "==1.3.0" }, "thrift": { "hashes": [ @@ -448,32 +455,27 @@ }, "typed-ast": { "hashes": [ - "sha256:0948004fa228ae071054f5208840a1e88747a357ec1101c17217bfe99b299d58", - "sha256:10703d3cec8dcd9eef5a630a04056bbc898abc19bac5691612acba7d1325b66d", - "sha256:1f6c4bd0bdc0f14246fd41262df7dfc018d65bb05f6e16390b7ea26ca454a291", - "sha256:25d8feefe27eb0303b73545416b13d108c6067b846b543738a25ff304824ed9a", - "sha256:29464a177d56e4e055b5f7b629935af7f49c196be47528cc94e0a7bf83fbc2b9", - "sha256:2e214b72168ea0275efd6c884b114ab42e316de3ffa125b267e732ed2abda892", - "sha256:3e0d5e48e3a23e9a4d1a9f698e32a542a4a288c871d33ed8df1b092a40f3a0f9", - "sha256:519425deca5c2b2bdac49f77b2c5625781abbaf9a809d727d3a5596b30bb4ded", - "sha256:57fe287f0cdd9ceaf69e7b71a2e94a24b5d268b35df251a88fef5cc241bf73aa", - "sha256:668d0cec391d9aed1c6a388b0d5b97cd22e6073eaa5fbaa6d2946603b4871efe", - "sha256:68ba70684990f59497680ff90d18e756a47bf4863c604098f10de9716b2c0bdd", - "sha256:6de012d2b166fe7a4cdf505eee3aaa12192f7ba365beeefaca4ec10e31241a85", - "sha256:79b91ebe5a28d349b6d0d323023350133e927b4de5b651a8aa2db69c761420c6", - "sha256:8550177fa5d4c1f09b5e5f524411c44633c80ec69b24e0e98906dd761941ca46", - "sha256:898f818399cafcdb93cbbe15fc83a33d05f18e29fb498ddc09b0214cdfc7cd51", - "sha256:94b091dc0f19291adcb279a108f5d38de2430411068b219f41b343c03b28fb1f", - "sha256:a26863198902cda15ab4503991e8cf1ca874219e0118cbf07c126bce7c4db129", - "sha256:a8034021801bc0440f2e027c354b4eafd95891b573e12ff0418dec385c76785c", - "sha256:bc978ac17468fe868ee589c795d06777f75496b1ed576d308002c8a5756fb9ea", - "sha256:c05b41bc1deade9f90ddc5d988fe506208019ebba9f2578c622516fd201f5863", - "sha256:c9b060bd1e5a26ab6e8267fd46fc9e02b54eb15fffb16d112d4c7b1c12987559", - "sha256:edb04bdd45bfd76c8292c4d9654568efaedf76fe78eb246dde69bdb13b2dad87", - "sha256:f19f2a4f547505fe9072e15f6f4ae714af51b5a681a97f187971f50c283193b6" - ], - "index": "pypi", - "version": "==1.1.0" + "sha256:035a54ede6ce1380599b2ce57844c6554666522e376bd111eb940fbc7c3dad23", + "sha256:037c35f2741ce3a9ac0d55abfcd119133cbd821fffa4461397718287092d9d15", + "sha256:049feae7e9f180b64efacbdc36b3af64a00393a47be22fa9cb6794e68d4e73d3", + "sha256:19228f7940beafc1ba21a6e8e070e0b0bfd1457902a3a81709762b8b9039b88d", + "sha256:2ea681e91e3550a30c2265d2916f40a5f5d89b59469a20f3bad7d07adee0f7a6", + "sha256:3a6b0a78af298d82323660df5497bcea0f0a4a25a0b003afd0ce5af049bd1f60", + "sha256:5385da8f3b801014504df0852bf83524599df890387a3c2b17b7caa3d78b1773", + "sha256:606d8afa07eef77280c2bf84335e24390055b478392e1975f96286d99d0cb424", + "sha256:69245b5b23bbf7fb242c9f8f08493e9ecd7711f063259aefffaeb90595d62287", + "sha256:6f6d839ab09830d59b7fa8fb6917023d8cb5498ee1f1dbd82d37db78eb76bc99", + "sha256:730888475f5ac0e37c1de4bd05eeb799fdb742697867f524dc8a4cd74bcecc23", + "sha256:9819b5162ffc121b9e334923c685b0d0826154e41dfe70b2ede2ce29034c71d8", + "sha256:9e60ef9426efab601dd9aa120e4ff560f4461cf8442e9c0a2b92548d52800699", + "sha256:af5fbdde0690c7da68e841d7fc2632345d570768ea7406a9434446d7b33b0ee1", + "sha256:b64efdbdf3bbb1377562c179f167f3bf301251411eb5ac77dec6b7d32bcda463", + "sha256:bac5f444c118aeb456fac1b0b5d14c6a71ea2a42069b09c176f75e9bd4c186f6", + "sha256:bda9068aafb73859491e13b99b682bd299c1b5fd50644d697533775828a28ee0", + "sha256:d659517ca116e6750101a1326107d3479028c5191f0ecee3c7203c50f5b915b0", + "sha256:eddd3fb1f3e0f82e5915a899285a39ee34ce18fd25d89582bc89fc9fb16cd2c6" + ], + "version": "==1.3.1" }, "urllib3": { "hashes": [ diff --git a/lintstats.sh b/lintstats.sh index 06d9e4e7..81a6379e 100755 --- a/lintstats.sh +++ b/lintstats.sh @@ -14,7 +14,7 @@ curl -u $USERNAME:$GITHUB_TOKEN \ # Check mypy integration -MYPY_STATUS=$( pipenv run mypy -p search | grep -v "test.*" | grep -v "defined here" | wc -l | tr -d '[:space:]' ) +MYPY_STATUS=$( pipenv run mypy -p search | grep -v "test.*" | grep -v "defined here" | tee /dev/tty | wc -l | tr -d '[:space:]' ) if [ $MYPY_STATUS -ne 0 ]; then MYPY_STATE="failure" && echo "mypy failed"; else MYPY_STATE="success" && echo "mypy passed"; fi curl -u $USERNAME:$GITHUB_TOKEN \ diff --git a/schema/search.yaml b/schema/search.yaml index 8f6d3306..0e8fc087 100644 --- a/schema/search.yaml +++ b/schema/search.yaml @@ -399,6 +399,26 @@ paths: - submitted_date - announced_date_first example: submitted_date_first + + - name: start + in: query + description: | + Defines the index of the first returned result, using 0-based indexing. + required: false + schema: + type: integer + example: 0 + + - name: size + in: query + description: | + The number of results returned by the query. Used in conjunction with "start" for + pagination. Size is limited to 30000, in slices of 2000. + required: false + schema: + type: integer + example: 10 + responses: '200': diff --git a/search/context.py b/search/context.py index 67fd2f38..cf7b5169 100644 --- a/search/context.py +++ b/search/context.py @@ -7,7 +7,7 @@ import werkzeug -def get_application_config(app: Flask = None) -> Union[dict, os._Environ]: +def get_application_config(app: Optional[Union[Flask, object]] = None) -> Union[dict, os._Environ]: """ Get a configuration from the current app, or fall back to env. diff --git a/search/controllers/advanced/__init__.py b/search/controllers/advanced/__init__.py index dbca1b23..f3425874 100644 --- a/search/controllers/advanced/__init__.py +++ b/search/controllers/advanced/__init__.py @@ -79,8 +79,8 @@ def search(request_params: MultiDict) -> Response: has_classic = False for key in request_params.keys(): if key.startswith('terms-') and key.endswith('-term'): - value = request_params.get(key) - i = re.search('terms-([0-9])+-term', key).group(1) + value: str = request_params.get(key) # type: ignore + i = re.search('terms-([0-9])+-term', key).group(1) # type: ignore field = request_params.get(f'terms-{i}-field') # We are only looking for this syntax in the author search, or # in an all-fields search. diff --git a/search/controllers/api/__init__.py b/search/controllers/api/__init__.py index d689f4e7..7a15995f 100644 --- a/search/controllers/api/__init__.py +++ b/search/controllers/api/__init__.py @@ -151,11 +151,11 @@ def _get_date_params(params: MultiDict, query_terms: List) \ dt = pytz.utc.localize(dt) dt = dt.replace(tzinfo=EASTERN) except ValueError: - raise BadRequest({'field': field, 'reason': 'invalid datetime'}) + raise BadRequest(f'Invalid datetime in {field}') date_params[field] = dt query_terms.append({'parameter': field, 'value': dt}) if 'date_type' in params: - date_params['date_type'] = params.get('date_type') + date_params['date_type'] = params.get('date_type') # type: ignore query_terms.append({'parameter': 'date_type', 'value': date_params['date_type']}) if date_params: @@ -192,9 +192,6 @@ def _get_classification(value: str, field: str, query_terms: List) \ try: clsns = _to_classification(value, query_terms) except ValueError: - raise BadRequest({ - 'field': field, - 'reason': 'not a valid classification term' - }) + raise BadRequest(f'Not a valid classification term: {field}={value}') query_terms.append({'parameter': field, 'value': value}) return clsns diff --git a/search/domain/base.py b/search/domain/base.py index 57a203fe..fc074941 100644 --- a/search/domain/base.py +++ b/search/domain/base.py @@ -196,7 +196,7 @@ def __str__(self) -> str: class Query: """Represents a search query originating from the UI or API.""" - MAXIMUM_size = 500 + MAXIMUM_size = 2000 """The maximum number of records that can be retrieved.""" SUPPORTED_FIELDS = [ diff --git a/search/factory.py b/search/factory.py index da1a6231..4d9c84c4 100644 --- a/search/factory.py +++ b/search/factory.py @@ -24,7 +24,7 @@ def create_ui_web_app() -> Flask: logging.getLogger('botocore').setLevel(logging.ERROR) app = Flask('search') - app.config.from_pyfile('config.py') + app.config.from_pyfile('config.py') # type: ignore app.url_map.converters['archive'] = ArchiveConverter index.init_app(app) @@ -47,7 +47,7 @@ def create_api_web_app() -> Flask: app = Flask('search') app.json_encoder = ISO8601JSONEncoder - app.config.from_pyfile('config.py') + app.config.from_pyfile('config.py') # type: ignore index.init_app(app) @@ -62,3 +62,4 @@ def create_api_web_app() -> Flask: app.errorhandler(error)(handler) return app + diff --git a/search/routes/api/__init__.py b/search/routes/api/__init__.py index a2dc6fb5..581b9d04 100644 --- a/search/routes/api/__init__.py +++ b/search/routes/api/__init__.py @@ -39,7 +39,7 @@ def search() -> Response: # if requested == ATOM_XML: # return serialize.as_atom(data), status, headers response_data = serialize.as_json(data['results'], query=data['query']) - return response_data, status_code, headers + return response_data, status_code, headers # type: ignore @blueprint.route('v', methods=['GET']) @@ -47,4 +47,4 @@ def search() -> Response: def paper(paper_id: str, version: str) -> Response: """Document metadata endpoint.""" data, status_code, headers = api.paper(f'{paper_id}v{version}') - return serialize.as_json(data['results']), status_code, headers + return serialize.as_json(data['results']), status_code, headers # type: ignore diff --git a/search/routes/api/exceptions.py b/search/routes/api/exceptions.py index bdf9db84..e3cf397a 100644 --- a/search/routes/api/exceptions.py +++ b/search/routes/api/exceptions.py @@ -45,7 +45,7 @@ def get_handlers() -> List[Tuple[type, Callable]]: def handle_not_found(error: NotFound) -> Response: """Render the base 404 error page.""" rendered = jsonify({'code': error.code, 'error': error.description}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_404_NOT_FOUND return response @@ -54,7 +54,7 @@ def handle_not_found(error: NotFound) -> Response: def handle_forbidden(error: Forbidden) -> Response: """Render the base 403 error page.""" rendered = jsonify({'code': error.code, 'error': error.description}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_403_FORBIDDEN return response @@ -63,7 +63,7 @@ def handle_forbidden(error: Forbidden) -> Response: def handle_unauthorized(error: Unauthorized) -> Response: """Render the base 401 error page.""" rendered = jsonify({'code': error.code, 'error': error.description}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_401_UNAUTHORIZED return response @@ -72,7 +72,7 @@ def handle_unauthorized(error: Unauthorized) -> Response: def handle_method_not_allowed(error: MethodNotAllowed) -> Response: """Render the base 405 error page.""" rendered = jsonify({'code': error.code, 'error': error.description}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_405_METHOD_NOT_ALLOWED return response @@ -81,7 +81,7 @@ def handle_method_not_allowed(error: MethodNotAllowed) -> Response: def handle_request_entity_too_large(error: RequestEntityTooLarge) -> Response: """Render the base 413 error page.""" rendered = jsonify({'code': error.code, 'error': error.description}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_413_REQUEST_ENTITY_TOO_LARGE return response @@ -90,7 +90,7 @@ def handle_request_entity_too_large(error: RequestEntityTooLarge) -> Response: def handle_bad_request(error: BadRequest) -> Response: """Render the base 400 error page.""" rendered = jsonify({'code': error.code, 'error': error.description}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_400_BAD_REQUEST return response @@ -104,6 +104,6 @@ def handle_internal_server_error(error: InternalServerError) -> Response: logger.error('Caught unhandled exception: %s', error) rendered = jsonify({'code': status.HTTP_500_INTERNAL_SERVER_ERROR, 'error': 'Unexpected error'}) - response = make_response(rendered) + response: Response = make_response(rendered) response.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR return response diff --git a/search/routes/ui.py b/search/routes/ui.py index efe8341d..9e38d712 100644 --- a/search/routes/ui.py +++ b/search/routes/ui.py @@ -40,7 +40,7 @@ def get_parameters_from_cookie() -> None: return # We need the request args to be mutable. - request.args = MultiDict(request.args.items(multi=True)) + request.args = MultiDict(request.args.items(multi=True)) # type: ignore data = json.loads(request.cookies[PARAMS_COOKIE_NAME]) for param in PARAMS_TO_PERSIST: # Don't clobber the user's explicit request. @@ -75,11 +75,11 @@ def search(archives: Optional[List[str]] = None) -> Union[str, Response]: response, code, headers = simple.search(request.args, archives) logger.debug(f"controller returned code: {code}") if code == status.HTTP_200_OK: - return render_template("search/search.html", pagetitle="Search", + return render_template("search/search.html", pagetitle="Search", # type: ignore archives=archives, **response) elif (code == status.HTTP_301_MOVED_PERMANENTLY or code == status.HTTP_303_SEE_OTHER): - return redirect(headers['Location'], code=code) + return redirect(headers['Location'], code=code) # type: ignore raise InternalServerError('Unexpected error') @@ -87,7 +87,7 @@ def search(archives: Optional[List[str]] = None) -> Union[str, Response]: def advanced_search() -> Union[str, Response]: """Advanced search interface.""" response, code, headers = advanced.search(request.args) - return render_template( + return render_template( # type: ignore "search/advanced_search.html", pagetitle="Advanced Search", **response @@ -103,7 +103,7 @@ def group_search(groups_or_archives: str) -> Union[str, Response]: interface. Anything else will result in a 404. """ response, code, _ = advanced.group_search(request.args, groups_or_archives) - return render_template( + return render_template( # type: ignore "search/advanced_search.html", pagetitle="Advanced Search", **response @@ -117,7 +117,7 @@ def service_status() -> Union[str, Response]: Exercises the search index connection with a real query. """ - return health_check() + return health_check() # type: ignore def _browse_url(name: str, **parameters: Any) -> Optional[str]: @@ -154,7 +154,7 @@ def url_for_page_builder() -> Dict[str, Callable]: def url_for_page(page: int, size: int) -> str: """Build an URL to for a search result page.""" rule = request.url_rule - parts = url_parse(url_for(rule.endpoint)) + parts = url_parse(url_for(rule.endpoint)) # type: ignore args = request.args.copy() args['start'] = (page - 1) * size parts = parts.replace(query=url_encode(args)) @@ -179,7 +179,7 @@ def current_url_sans_parameters_builder() -> Dict[str, Callable]: def current_url_sans_parameters(*params_to_remove: str) -> str: """Get the current URL with ``param`` removed from GET parameters.""" rule = request.url_rule - parts = url_parse(url_for(rule.endpoint)) + parts = url_parse(url_for(rule.endpoint)) # type: ignore args = request.args.copy() for param in params_to_remove: args.pop(param, None)