Coverage for /usr/local/lib/python2.7/dist-packages/certstream/__init__.py : 27 | 100% 28 |
29 | 30 |
├── CodeSmell ├── _root_bin_PoorOpsSec_indicators_py.html ├── _root_bin_PoorOpsSec_pooropssec_py.html ├── _usr_local_lib_python2_7_dist-packages_certstream___init___py.html ├── _usr_local_lib_python2_7_dist-packages_certstream_core_py.html ├── _usr_local_lib_python2_7_dist-packages_requests___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_adapters_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_api_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_auth_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_certs_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_compat_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_cookies_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_hooks_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_models_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_chardet___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3__collections_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_connection_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_connectionpool_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib_pyopenssl_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib_socks_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_fields_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_filepost_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_ordered_dict_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_six_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_ssl_match_hostname___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_poolmanager_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_request_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_response_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_connection_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_request_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_response_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_retry_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_ssl__py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_timeout_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_url_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_sessions_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_status_codes_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_structures_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_utils_py.html ├── _usr_local_lib_python2_7_dist-packages_six_py.html ├── _usr_local_lib_python2_7_dist-packages_tld___init___py.html ├── _usr_local_lib_python2_7_dist-packages_tld_conf_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_defaults_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_helpers_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_utils_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm___init___py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__main_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__tqdm_gui_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__tqdm_pandas_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__tqdm_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__utils_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__version_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket___init___py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__abnf_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__app_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__cookiejar_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__core_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__handshake_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__http_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__logging_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__socket_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__ssl_compat_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__url_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__utils_py.html ├── coverage_html.js ├── index.html ├── jquery.debounce.min.js ├── jquery.hotkeys.js ├── jquery.isonscreen.js ├── jquery.min.js ├── jquery.tablesorter.min.js ├── keybd_closed.png ├── keybd_open.png ├── lint_results.txt ├── status.json └── style.css ├── Dockerfile ├── NeedSpecialAttention.log ├── README.md ├── VERSION ├── Vagrantfile ├── docker-compose.yml ├── indicators.py ├── pooropssec.py ├── requirements.txt ├── setup.py └── test └── scoring.py /CodeSmell/_usr_local_lib_python2_7_dist-packages_certstream___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 |Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | | 73 | 71 | 72 |74 | | 77 | 75 | 76 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | | 97 |
98 | #!/usr/bin/env python 99 |# -*- coding: utf-8 -*- 100 |101 | 102 | requests.certs 103 |~~~~~~~~~~~~~~ 104 |105 | This module returns the preferred default CA certificate bundle. 106 |107 | If you are packaging Requests, e.g., for a Linux distribution or a managed 108 |environment, you can change the definition of where() to return a separately 109 |packaged CA bundle. 110 |""" 111 | 112 |113 | 114 | 115 | except ImportError: 116 |def where(): 117 |"""Return the preferred certificate bundle.""" 118 |# vendored bundle inside Requests 119 |return os.path.join(os.path.dirname(__file__), 'cacert.pem') 120 |121 | 122 | print(where()) 123 | 124 | |
125 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | | 106 |
107 | # -*- coding: utf-8 -*- 108 |109 | 110 | requests.hooks 111 |~~~~~~~~~~~~~~ 112 |113 | This module provides the capabilities for the Requests hooks system. 114 |115 | Available hooks: 116 |117 | ``response``: 118 |The response generated from a Request. 119 |""" 120 | 121 |122 | 123 | 124 | 125 | 126 | # TODO: response is the only one 127 |128 | 129 | 130 | """Dispatches a hook dictionary on a given piece of data.""" 131 | 132 | 133 | 134 |if hasattr(hooks, '__call__'): 135 |hooks = [hooks] 136 |for hook in hooks: 137 |_hook_data = hook(hook_data, **kwargs) 138 |if _hook_data is not None: 139 |hook_data = _hook_data 140 | 141 | 142 | |
143 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | | 108 |
109 | ''' 110 |Debian and other distributions "unbundle" requests' vendored dependencies, and 111 |rewrite all imports to use the global versions of ``urllib3`` and ``chardet``. 112 |The problem with this is that not only requests itself imports those 113 |dependencies, but third-party code outside of the distros' control too. 114 |115 | In reaction to these problems, the distro maintainers replaced 116 |``requests.packages`` with a magical "stub module" that imports the correct 117 |modules. The implementations were varying in quality and all had severe 118 |problems. For example, a symlink (or hardlink) that links the correct modules 119 |into place introduces problems regarding object identity, since you now have 120 |two modules in `sys.modules` with the same API, but different identities:: 121 |122 | requests.packages.urllib3 is not urllib3 123 |124 | With version ``2.5.2``, requests started to maintain its own stub, so that 125 |distro-specific breakage would be reduced to a minimum, even though the whole 126 |issue is not requests' fault in the first place. See 127 |https://github.com/kennethreitz/requests/pull/2375 for the corresponding pull 128 |request. 129 |''' 130 |131 | 132 | 133 | 134 | 135 | 136 | except ImportError: 137 |import urllib3 138 |sys.modules['%s.urllib3' % __name__] = urllib3 139 |140 | 141 | 142 | except ImportError: 143 |import chardet 144 |sys.modules['%s.chardet' % __name__] = chardet 145 | 146 | |
147 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | | 104 |
105 | ######################## BEGIN LICENSE BLOCK ######################## 106 |# This library is free software; you can redistribute it and/or 107 |# modify it under the terms of the GNU Lesser General Public 108 |# License as published by the Free Software Foundation; either 109 |# version 2.1 of the License, or (at your option) any later version. 110 |# 111 |# This library is distributed in the hope that it will be useful, 112 |# but WITHOUT ANY WARRANTY; without even the implied warranty of 113 |# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 114 |# Lesser General Public License for more details. 115 |# 116 |# You should have received a copy of the GNU Lesser General Public 117 |# License along with this library; if not, write to the Free Software 118 |# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 119 |# 02110-1301 USA 120 |######################### END LICENSE BLOCK ######################### 121 |122 | 123 | 124 | 125 | 126 | 127 | if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or 128 |(version_info >= (3, 0) and not isinstance(aBuf, bytes))): 129 |raise ValueError('Expected a bytes object, not a unicode object') 130 |131 | from . import universaldetector 132 |u = universaldetector.UniversalDetector() 133 |u.reset() 134 |u.feed(aBuf) 135 |u.close() 136 |return u.result 137 | 138 | |
139 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | | 72 |73 | 74 | | 75 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | | 77 | 71 |
78 | 80 | 81 | 82 | 83 | 84 | |
85 |
79 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | | 85 | 71 |
86 | # Python 3.2+ 88 | 89 |except ImportError: 90 |try: 91 |# Backport of the function from a pypi module 92 |from backports.ssl_match_hostname import CertificateError, match_hostname 93 |except ImportError: 94 |# Our vendored copy 95 |from ._implementation import CertificateError, match_hostname 96 |97 | # Not needed, but documenting what we provide. 98 | 99 | 100 | |
101 |
87 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | | 118 | 71 |
119 | # For backwards compatibility, provide imports that used to be here. 121 | 122 | 123 | 124 | 125 |SSLContext, 126 |HAS_SNI, 127 |IS_PYOPENSSL, 128 |assert_fingerprint, 129 |resolve_cert_reqs, 130 |resolve_ssl_version, 131 |ssl_wrap_socket, 132 |) 133 | 134 |current_time, 135 |Timeout, 136 |) 137 |138 | 139 | 140 | get_host, 141 |parse_url, 142 |split_first, 143 |Url, 144 |) 145 |146 | 147 | 'HAS_SNI', 148 |'IS_PYOPENSSL', 149 |'SSLContext', 150 |'Retry', 151 |'Timeout', 152 |'Url', 153 |'assert_fingerprint', 154 |'current_time', 155 |'is_connection_dropped', 156 |'is_fp_closed', 157 |'get_host', 158 |'parse_url', 159 |'make_headers', 160 |'resolve_cert_reqs', 161 |'resolve_ssl_version', 162 |'split_first', 163 |'ssl_wrap_socket', 164 |) 165 | 166 | |
167 |
120 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | | 91 | 71 |
92 | get_tld, 94 |get_tld_names, 95 |Result, 96 |update_tld_names, 97 |) 98 |99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 'get_tld', 107 |'get_tld_names', 108 |'Result', 109 |'update_tld_names', 110 |) 111 | 112 | |
113 |
93 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | | 121 | 71 |
122 | 124 | 125 | 126 | 127 | 128 | 129 | 'get_setting', 130 |'set_setting', 131 |'settings', 132 |) 133 |134 | 135 | 136 | """Settings registry.""" 137 |138 | 139 | 140 | 141 | 142 | """ 143 |Override default settings. 144 |145 | :param str name: 146 |:param mixed value: 147 |""" 148 |self._settings[name] = value 149 |150 | 151 | """ 152 |Gets a variable from local settings. 153 |154 | :param str name: 155 |:param mixed default: Default value. 156 |:return mixed: 157 |""" 158 | 159 |return self._settings.get(name, default) 160 | 161 | 162 |else: 163 |return default 164 |165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | |
173 |
123 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | | 96 | 71 |
97 | 99 | 100 | 101 | 102 | 103 | 104 | 'NAMES_SOURCE_URL', 105 |'NAMES_LOCAL_PATH', 106 |'NAMES_LOCAL_PATH_PARENT', 107 |'DEBUG' 108 |) 109 |110 | # Source path of Mozilla's effective TLD names file. 111 | 112 |'effective_tld_names.dat?raw=1' 113 |114 | # Relative path to store the local copy of Mozilla's effective TLD names file. 115 | 116 |117 | # Absolute base path that is prepended to NAMES_LOCAL_PATH 118 | 119 |120 | 121 | 122 | |
123 |
98 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | | 116 | 71 |
117 | 119 | 120 | 121 | 122 | 123 | 124 | 'TldIOError', 125 |'TldDomainNotFound', 126 |'TldBadUrl' 127 |) 128 |129 | 130 | 131 | """TldIOError. 132 |133 | Supposed to be thrown when problems with reading/writing occur.""" 134 | 135 |TLD_NAMES_LOCAL_PATH = get_setting('NAMES_LOCAL_PATH') 136 |if msg is None: 137 |msg = "Can't read from or write to the %s " \ 138 |"file!" % TLD_NAMES_LOCAL_PATH 139 |super(TldIOError, self).__init__(msg) 140 |141 | 142 | 143 | """TldDomainNotFound. 144 |145 | Supposed to be thrown when domain name is not found (didn't match) the 146 |local TLD policy. 147 |""" 148 | 149 |super(TldDomainNotFound, self).__init__( 150 |"Domain %s didn't match any existing TLD name!" % domain_name 151 |) 152 |153 | 154 | 155 | """TldBadUrl. 156 |157 | Supposed to be thrown when bad URL is given. 158 |""" 159 | 160 |super(TldBadUrl, self).__init__("Is not a valid URL %s!" % url) 161 | 162 | |
163 |
118 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | | 95 | 71 |
96 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 'project_dir', 106 |'PROJECT_DIR', 107 |) 108 |109 | 110 | 111 | """Project dir.""" 112 | 113 | 114 |os.path.join(TLD_NAMES_LOCAL_PATH_PARENT, base).replace('\\', '/') 115 |) 116 |117 | 118 | 119 | 120 | |
121 |
97 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | | 100 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
101 | 110 | 111 | 'tqdm_notebook', 'tnrange', 'main', 112 |'TqdmTypeError', 'TqdmKeyError', 'TqdmDeprecationWarning', 113 |'__version__'] 114 |115 | 116 | def tqdm_notebook(*args, **kwargs): # pragma: no cover 117 |"""See tqdm._tqdm_notebook.tqdm_notebook for full documentation""" 118 |from ._tqdm_notebook import tqdm_notebook as _tqdm_notebook 119 |return _tqdm_notebook(*args, **kwargs) 120 |121 | 122 | def tnrange(*args, **kwargs): # pragma: no cover 123 |""" 124 |A shortcut for tqdm_notebook(xrange(*args), **kwargs). 125 |On Python3+ range is used instead of xrange. 126 |""" 127 |from ._tqdm_notebook import tnrange as _tnrange 128 |return _tnrange(*args, **kwargs) 129 | 130 | |
131 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | | 118 | 71 |
119 | 121 | 122 | 123 | 124 | 125 | 126 | """ 127 |Registers the given `tqdm` instance with 128 |`pandas.core.groupby.DataFrameGroupBy.progress_apply`. 129 |It will even close() the `tqdm` instance upon completion. 130 |131 | Parameters 132 |---------- 133 |tclass : tqdm class you want to use (eg, tqdm, tqdm_notebook, etc) 134 |targs and tkwargs : arguments for the tqdm instance 135 |136 | Examples 137 |-------- 138 |>>> import pandas as pd 139 |>>> import numpy as np 140 |>>> from tqdm import tqdm, tqdm_pandas 141 |>>> 142 |>>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) 143 |>>> tqdm_pandas(tqdm, leave=True) # can use tqdm_gui, optional kwargs, etc 144 |>>> # Now you can use `progress_apply` instead of `apply` 145 |>>> df.groupby(0).progress_apply(lambda x: x**2) 146 |147 | References 148 |---------- 149 |https://stackoverflow.com/questions/18603270/ 150 |progress-indicator-during-pandas-operations-python 151 |""" 152 |from tqdm import TqdmDeprecationWarning 153 |154 | if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith( 155 |'tqdm_')): # delayed adapter case 156 |TqdmDeprecationWarning("""\ 157 |Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`. 158 |""", fp_write=getattr(tkwargs.get('file', None), 'write', sys.stderr.write)) 159 |tclass.pandas(*targs, **tkwargs) 160 |else: 161 |TqdmDeprecationWarning("""\ 162 |Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`. 163 |""", fp_write=getattr(tclass.fp, 'write', sys.stderr.write)) 164 |type(tclass).pandas(deprecated_t=tclass) 165 | 166 | |
167 |
120 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | | 101 |
102 | """ 103 |websocket - WebSocket client library for Python 104 |105 | Copyright (C) 2010 Hiroki Ohtani(liris) 106 |107 | This library is free software; you can redistribute it and/or 108 |modify it under the terms of the GNU Lesser General Public 109 |License as published by the Free Software Foundation; either 110 |version 2.1 of the License, or (at your option) any later version. 111 |112 | This library is distributed in the hope that it will be useful, 113 |but WITHOUT ANY WARRANTY; without even the implied warranty of 114 |MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 115 |Lesser General Public License for more details. 116 |117 | You should have received a copy of the GNU Lesser General Public 118 |License along with this library; if not, write to the Free Software 119 |Foundation, Inc., 51 Franklin Street, Fifth Floor, 120 |Boston, MA 02110-1335 USA 121 |122 | """ 123 | 124 | 125 | 126 | 127 | 128 | 129 |130 | 131 | 132 | |
133 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | | 152 |
153 | """ 154 |websocket - WebSocket client library for Python 155 |156 | Copyright (C) 2010 Hiroki Ohtani(liris) 157 |158 | This library is free software; you can redistribute it and/or 159 |modify it under the terms of the GNU Lesser General Public 160 |License as published by the Free Software Foundation; either 161 |version 2.1 of the License, or (at your option) any later version. 162 |163 | This library is distributed in the hope that it will be useful, 164 |but WITHOUT ANY WARRANTY; without even the implied warranty of 165 |MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 166 |Lesser General Public License for more details. 167 |168 | You should have received a copy of the GNU Lesser General Public 169 |License along with this library; if not, write to the Free Software 170 |Foundation, Inc., 51 Franklin Street, Fifth Floor, 171 |Boston, MA 02110-1335 USA 172 |173 | """ 174 |175 | 176 | """ 177 |define websocket exceptions 178 |""" 179 |180 | 181 | 182 | """ 183 |websocket exception class. 184 |""" 185 | 186 |187 | 188 | 189 | """ 190 |If the websocket protocol is invalid, this exception will be raised. 191 |""" 192 | 193 |194 | 195 | 196 | """ 197 |If the websocket payload is invalid, this exception will be raised. 198 |""" 199 | 200 |201 | 202 | 203 | """ 204 |If remote host closed the connection or some network error happened, 205 |this exception will be raised. 206 |""" 207 | 208 |209 | 210 | 211 | """ 212 |WebSocketTimeoutException will be raised at socket timeout during read/write data. 213 |""" 214 | 215 |216 | 217 | 218 | """ 219 |WebSocketProxyException will be raised when proxy error occurred. 220 |""" 221 | 222 |223 | 224 | 225 | """ 226 |WebSocketBadStatusException will be raised when we get bad handshake status code. 227 |""" 228 |229 | 230 | super(WebSocketBadStatusException, self).__init__( 231 |message % status_code) 232 |self.status_code = status_code 233 | 234 | |
235 |
Hot-keys on this page
46 |48 | r 49 | m 50 | x 51 | p toggle line displays 52 |
53 |54 | j 55 | k next/prev highlighted chunk 56 |
57 |58 | 0 (zero) top of page 59 |
60 |61 | 1 (one) first highlighted chunk 62 |
63 |70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | | 116 |
117 | """ 118 |websocket - WebSocket client library for Python 119 |120 | Copyright (C) 2010 Hiroki Ohtani(liris) 121 |122 | This library is free software; you can redistribute it and/or 123 |modify it under the terms of the GNU Lesser General Public 124 |License as published by the Free Software Foundation; either 125 |version 2.1 of the License, or (at your option) any later version. 126 |127 | This library is distributed in the hope that it will be useful, 128 |but WITHOUT ANY WARRANTY; without even the implied warranty of 129 |MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 130 |Lesser General Public License for more details. 131 |132 | You should have received a copy of the GNU Lesser General Public 133 |License along with this library; if not, write to the Free Software 134 |Foundation, Inc., 51 Franklin Street, Fifth Floor, 135 |Boston, MA 02110-1335 USA 136 |137 | """ 138 | 139 |140 | 141 | 142 | 143 | 144 | 145 | else: 146 |HAVE_CONTEXT_CHECK_HOSTNAME = False 147 |if hasattr(ssl, "match_hostname"): 148 |from ssl import match_hostname 149 |else: 150 |from backports.ssl_match_hostname import match_hostname 151 |__all__.append("match_hostname") 152 | 153 |154 | 155 | except ImportError: 156 |# dummy class of SSLError for ssl none-support environment. 157 |class SSLError(Exception): 158 |pass 159 |160 | HAVE_SSL = False 161 | 162 | |
163 |