Check-in [1956886c24]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | pylint whitespace etc. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1956886c24348ac1c1ed84fc79a471fc |
User & Date: | mario 2022-10-14 12:56:59 |
Context
2022-10-14
| ||
15:07 | more pylint pleasing, update deep-translator bindings, add LibreTranslate (might have a builtin version) check-in: e816f87f6f user: mario tags: trunk | |
12:56 | pylint whitespace etc. check-in: 1956886c24 user: mario tags: trunk | |
12:56 | pylint fixes (whitespace), class-wise loggers, regex r"" strings check-in: eab7fe59b3 user: mario tags: trunk | |
Changes
Changes to pythonpath/httprequests.py.
1 2 | # encoding: utf-8 # api: python | | > < | | | > | | | > > > > | | > | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # encoding: utf-8 # api: python ##type: classes # category: http # title: request/fallback # description: loads requests, or similuates API via urllib # version: 0.5 # state: beta # depends: python:requests (>= 2.5) # config: - # pylint: disable=invalid-name # # Wraps requests or fakes a http.get() implementation. # __all__ = ["http", "urllib", "urlencode", "quote", "quote_plus"] # http preparations import logging as log import urllib try: from urllib.parse import urlencode, quote, quote_plus from urllib.request import urlopen, Request except ImportError: from urllib import urlencode, quote, quote_plus from urllib2 import urlopen, Request #else: # from six.moves.urllib import urlencode, quote, quote_plus # from six.moves.urllib.request import urlopen, Request try: import requests http = requests.Session() except ImportError: log.error( "Missing library: `pip install requests` (system-wide, or into libreoffice program/ dir)" ) class FakeRequests: """ GET only """ content = "" ssl_args = {} headers = {} def __init__(self): """ optional ssl """ import ssl if not hasattr(ssl, "create_default_context"): return context = ssl.create_default_context() context.check_hostname = False context.verify_mode = ssl.CERT_NONE self.ssl_args["context"] = context def get(self, url): """ urlopen """ self.content = urlopen( Request(url, headers=self.headers), **self.ssl_args ).read() return self http = FakeRequests() log.info("using fake_requests() for now") # headers http.headers.update({ "User-Agent": "Mozilla/5.0 (X11; Linux; LibreOffice/7.2), PageTranslate/1.9", "Accept-Language": "*; q=1.0", "Accept-Encoding": "utf-8" }) |
Changes to pythonpath/unocompat.py.
1 2 | # encoding: utf-8 # api: uno | | | 1 2 3 4 5 6 7 8 9 10 | # encoding: utf-8 # api: uno ##type: functions # version: 0.2 # title: UNO helper # description: compatibility between LO and AOO # # Just the shorter `PropertyValue` for now. # And a convenience wrapper for TextFrames, to match the iterator interface. # |
︙ | ︙ |