diff --git a/__init__.py b/__init__.py index 9885a30..ea08822 100644 --- a/__init__.py +++ b/__init__.py @@ -18,71 +18,70 @@ class Code: self.description = description self.match = f"{code} {name}" -def build_code_list(): - return [ - Code(100, "Continue", "The client should continue the request."), - Code(101, "Switching Protocols", "The transmission protocol is changed according to the client's request."), - Code(102, "Processing", "A time-consuming request is being processed."), - Code(200, "OK", "The request was successful."), - Code(201, "Created", "A new resource was created."), - Code(202, "Accepted", "The request has been accepted but not yet processed."), - Code(203, "Non-Authoritative Information", "Meta information from a cache rather than the origin server."), - Code(204, "No Content", "The request was successful but there is no content."), - Code(205, "Reset Content", "The request was successful and the document should be reset."), - Code(206, "Partial Content", "Partial resource delivered successfully."), - Code(207, "Multi-Status", "Multiple operations performed; statuses in body."), - Code(208, "Already Reported", "Some WebDAV members were already reported."), - Code(301, "Moved Permanently", "The resource has a new permanent URL."), - Code(302, "Found", "The resource is temporarily under a different URL."), - Code(305, "Use Proxy", "Client should retrieve resource via proxy (deprecated)."), - Code(307, "Temporary Redirect", "Temporary location, same method must be used."), - Code(308, "Permanent Redirect", "Permanent redirect; same method used for future."), - Code(400, "Bad Request", "The request is invalid."), - Code(401, "Unauthorized", "Authentication is required."), - Code(402, "Payment Required", "Payment is required."), - Code(403, "Forbidden", "The request is forbidden."), - Code(404, "Not Found", "The server could not find the requested resource."), - Code(405, "Method Not Allowed", "The method is known but not allowed."), - Code(406, "Not Acceptable", "No acceptable representation available."), - Code(407, "Proxy Authentication Required", "Proxy authentication needed."), - Code(408, "Request Timeout", "Server timed out waiting for full request."), - Code(409, "Conflict", "Request conflicts with current state."), - Code(410, "Gone", "The resource is no longer available."), - Code(411, "Length Required", "Content-Length header required."), - Code(412, "Precondition Failed", "A precondition failed."), - Code(413, "Payload Too Large", "Payload is too large."), - Code(414, "URI Too Long", "Request-URI is too long."), - Code(415, "Unsupported Media Type", "Media type not supported."), - Code(416, "Range Not Satisfiable", "Requested range not satisfiable."), - Code(417, "Expectation Failed", "Expectation given in headers could not be met."), - Code(418, "I'm a teapot", "Teapot refuses to brew coffee."), - Code(420, "Enhance Your Calm", "Connection limit per user exceeded."), - Code(421, "Misdirected Request", "Request directed at incapable server."), - Code(422, "Unprocessable Entity", "Semantic errors prevent processing."), - Code(423, "Locked", "Resource is currently locked."), - Code(424, "Failed Dependency", "Request failed due to previous failure."), - Code(426, "Upgrade Required", "Protocol upgrade required."), - Code(428, "Precondition Required", "Precondition required for processing."), - Code(429, "Too Many Requests", "Too many requests from the client."), - Code(431, "Request Header Fields Too Large", "Header fields too large."), - Code(444, "Connection Closed Without Response", "Server closed connection without response."), - Code(451, "Unavailable For Legal Reasons", "Resource unavailable for legal reasons."), - Code(499, "Client Closed Request", "Client closed connection before response."), - Code(500, "Internal Server Error", "Server encountered an internal error."), - Code(501, "Not Implemented", "Server does not support the functionality."), - Code(502, "Bad Gateway", "Upstream server returned an invalid response."), - Code(503, "Service Unavailable", "Service is unavailable."), - Code(504, "Gateway Timeout", "Upstream server did not respond in time."), - Code(505, "HTTP Version Not Supported", "HTTP version is not supported."), - Code(506, "Variant Also Negotiates", "Negotiation error."), - Code(507, "Insufficient Storage", "Insufficient storage for the request."), - Code(508, "Loop Detected", "Infinite loop detected."), - Code(510, "Not Extended", "Further extensions required."), - Code(511, "Network Authentication Required", "Network authentication required."), - Code(599, "Network Connect Timeout Error", "Network connection timeout error."), - ] +codes = [ + Code(100, "Continue", "The client should continue the request."), + Code(101, "Switching Protocols", "The transmission protocol is changed according to the client's request."), + Code(102, "Processing", "A time-consuming request is being processed."), + Code(200, "OK", "The request was successful."), + Code(201, "Created", "A new resource was created."), + Code(202, "Accepted", "The request has been accepted but not yet processed."), + Code(203, "Non-Authoritative Information", "Meta information from a cache rather than the origin server."), + Code(204, "No Content", "The request was successful but there is no content."), + Code(205, "Reset Content", "The request was successful and the document should be reset."), + Code(206, "Partial Content", "Partial resource delivered successfully."), + Code(207, "Multi-Status", "Multiple operations performed; statuses in body."), + Code(208, "Already Reported", "Some WebDAV members were already reported."), + Code(301, "Moved Permanently", "The resource has a new permanent URL."), + Code(302, "Found", "The resource is temporarily under a different URL."), + Code(305, "Use Proxy", "Client should retrieve resource via proxy (deprecated)."), + Code(307, "Temporary Redirect", "Temporary location, same method must be used."), + Code(308, "Permanent Redirect", "Permanent redirect; same method used for future."), + Code(400, "Bad Request", "The request is invalid."), + Code(401, "Unauthorized", "Authentication is required."), + Code(402, "Payment Required", "Payment is required."), + Code(403, "Forbidden", "The request is forbidden."), + Code(404, "Not Found", "The server could not find the requested resource."), + Code(405, "Method Not Allowed", "The method is known but not allowed."), + Code(406, "Not Acceptable", "No acceptable representation available."), + Code(407, "Proxy Authentication Required", "Proxy authentication needed."), + Code(408, "Request Timeout", "Server timed out waiting for full request."), + Code(409, "Conflict", "Request conflicts with current state."), + Code(410, "Gone", "The resource is no longer available."), + Code(411, "Length Required", "Content-Length header required."), + Code(412, "Precondition Failed", "A precondition failed."), + Code(413, "Payload Too Large", "Payload is too large."), + Code(414, "URI Too Long", "Request-URI is too long."), + Code(415, "Unsupported Media Type", "Media type not supported."), + Code(416, "Range Not Satisfiable", "Requested range not satisfiable."), + Code(417, "Expectation Failed", "Expectation given in headers could not be met."), + Code(418, "I'm a teapot", "Teapot refuses to brew coffee."), + Code(420, "Enhance Your Calm", "Connection limit per user exceeded."), + Code(421, "Misdirected Request", "Request directed at incapable server."), + Code(422, "Unprocessable Entity", "Semantic errors prevent processing."), + Code(423, "Locked", "Resource is currently locked."), + Code(424, "Failed Dependency", "Request failed due to previous failure."), + Code(426, "Upgrade Required", "Protocol upgrade required."), + Code(428, "Precondition Required", "Precondition required for processing."), + Code(429, "Too Many Requests", "Too many requests from the client."), + Code(431, "Request Header Fields Too Large", "Header fields too large."), + Code(444, "Connection Closed Without Response", "Server closed connection without response."), + Code(451, "Unavailable For Legal Reasons", "Resource unavailable for legal reasons."), + Code(499, "Client Closed Request", "Client closed connection before response."), + Code(500, "Internal Server Error", "Server encountered an internal error."), + Code(501, "Not Implemented", "Server does not support the functionality."), + Code(502, "Bad Gateway", "Upstream server returned an invalid response."), + Code(503, "Service Unavailable", "Service is unavailable."), + Code(504, "Gateway Timeout", "Upstream server did not respond in time."), + Code(505, "HTTP Version Not Supported", "HTTP version is not supported."), + Code(506, "Variant Also Negotiates", "Negotiation error."), + Code(507, "Insufficient Storage", "Insufficient storage for the request."), + Code(508, "Loop Detected", "Infinite loop detected."), + Code(510, "Not Extended", "Further extensions required."), + Code(511, "Network Authentication Required", "Network authentication required."), + Code(599, "Network Connect Timeout Error", "Network connection timeout error."), +] -def build_query_items(query, codes: List[Code]): +def build_query_items(query): results = [] for code in codes: if query.string.casefold() in code.match.casefold(): @@ -110,5 +109,4 @@ class Plugin(albert.PluginInstance, albert.TriggerQueryHandler): if not query.isValid: return - codes = build_code_list() - query.add(build_query_items(query, codes)) \ No newline at end of file + query.add(build_query_items(query)) \ No newline at end of file