content
stringlengths
21
24.2k
avg_line_length
float64
10.4
231
max_line_length
int64
20
8.17k
alphanum_fraction
float64
0.25
0.82
licenses
sequence
repository_name
stringlengths
11
51
path
stringlengths
7
121
size
int64
21
24.2k
lang
stringclasses
1 value
nl_text
stringlengths
19
20.6k
nl_size
int64
19
20.6k
nl_ratio
float64
0.8
1.07
#----------------------------------------------------------------------------- # Copyright (c) 2015-2017, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with exception # for distributing bootloader. # # The full license is in the file COPYING.txt, distributed with this software. #----------------------------------------------------------------------------- # netCDF4 (tested with v.1.1.9) has some hidden imports hiddenimports = ['netCDF4.utils', 'netcdftime']
39.538462
78
0.529183
[ "MIT" ]
JohnWJackson/arcadePython
venv/Lib/site-packages/PyInstaller/hooks/hook-netCDF4.py
514
Python
----------------------------------------------------------------------------- Copyright (c) 2015-2017, PyInstaller Development Team. Distributed under the terms of the GNU General Public License with exception for distributing bootloader. The full license is in the file COPYING.txt, distributed with this software.----------------------------------------------------------------------------- netCDF4 (tested with v.1.1.9) has some hidden imports
446
0.867704
# The MIT License (MIT) # # Copyright (c) 2015, Nicolas Sebrecht & contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import os import sys def testingPath(): return os.path.join( os.path.abspath(sys.modules['imapfw'].__path__[0]), 'testing')
41.419355
79
0.759346
[ "MIT" ]
Deepanshu2017/imapfw
imapfw/testing/libcore.py
1,284
Python
The MIT License (MIT) Copyright (c) 2015, Nicolas Sebrecht & contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1,094
0.852025
# -*- coding: utf-8 -*- """ Authors: Tim Hessels Module: Collect/SRTM Description: This module downloads DEM data from http://earlywarning.usgs.gov/hydrodata/. Use the DEM functions to download and create DEM images in Gtiff format. Examples: from pyWAPOR.Collect import SRTM SRTM.DEM(Dir='C:/TempDEM4/', latlim=[29, 32], lonlim=[-113, -109]) """ from .DEM import main as DEM __all__ = ['DEM'] __version__ = '0.1'
20.95
76
0.711217
[ "Apache-2.0" ]
DHI-GRAS/wapor-et-look
pyWAPOR/Collect/SRTM/__init__.py
419
Python
Authors: Tim Hessels Module: Collect/SRTM Description: This module downloads DEM data from http://earlywarning.usgs.gov/hydrodata/. Use the DEM functions to download and create DEM images in Gtiff format. Examples: from pyWAPOR.Collect import SRTM SRTM.DEM(Dir='C:/TempDEM4/', latlim=[29, 32], lonlim=[-113, -109]) -*- coding: utf-8 -*-
341
0.813842
"""Plot graphs from human-readable file formats."""
26
51
0.730769
[ "MIT" ]
Sean1708/uniplot
uniplot/__init__.py
52
Python
Plot graphs from human-readable file formats.
45
0.865385
# Configuration file for jupyter-notebook. #------------------------------------------------------------------------------ # Configurable configuration #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # SingletonConfigurable configuration #------------------------------------------------------------------------------ # A configurable that only allows one instance. # # This class is for classes that should only have one instance of itself or # *any* subclass. To create and retrieve such a class use the # :meth:`SingletonConfigurable.instance` method. #------------------------------------------------------------------------------ # Application configuration #------------------------------------------------------------------------------ # This is an application. # The date format used by logging formatters for %(asctime)s # c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' # The Logging format template # c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' # Set the log level by value or name. # c.Application.log_level = 30 #------------------------------------------------------------------------------ # JupyterApp configuration #------------------------------------------------------------------------------ # Base class for Jupyter applications # Answer yes to any prompts. c.JupyterApp.answer_yes = True # Full path of a config file. # c.JupyterApp.config_file = u'' # Generate default config file. # c.JupyterApp.generate_config = False # Specify a config file to load. # c.JupyterApp.config_file_name = u'' #------------------------------------------------------------------------------ # NotebookApp configuration #------------------------------------------------------------------------------ # The number of additional ports to try if the specified port is not available. c.NotebookApp.port_retries = 0 # Extra variables to supply to jinja templates when rendering. # c.NotebookApp.jinja_template_vars = traitlets.Undefined # The url for MathJax.js. # c.NotebookApp.mathjax_url = '' # Supply extra arguments that will be passed to Jinja environment. # c.NotebookApp.jinja_environment_options = traitlets.Undefined # The IP address the notebook server will listen on. c.NotebookApp.ip = '*' # DEPRECATED use base_url # c.NotebookApp.base_project_url = '/' # Python modules to load as notebook server extensions. This is an experimental # API, and may change in future releases. # c.NotebookApp.server_extensions = traitlets.Undefined # Note: These extensions require the ~/.jupyter path to exist otherwise, errors will occur on startup c.NotebookApp.server_extensions=['ipyparallel.nbextension'] # The random bytes used to secure cookies. By default this is a new random # number every time you start the Notebook. Set it to a value in a config file # to enable logins to persist across server sessions. # # Note: Cookie secrets should be kept private, do not share config files with # cookie_secret stored in plaintext (you can read the value from a file). # c.NotebookApp.cookie_secret = '' # The default URL to redirect to from `/` # c.NotebookApp.default_url = '/tree' # The port the notebook server will listen on. c.NotebookApp.port = 8754 # The kernel spec manager class to use. Should be a subclass of # `jupyter_client.kernelspec.KernelSpecManager`. # # The Api of KernelSpecManager is provisional and might change without warning # between this version of IPython and the next stable one. # c.NotebookApp.kernel_spec_manager_class = <class 'jupyter_client.kernelspec.KernelSpecManager'> # Set the Access-Control-Allow-Origin header # # Use '*' to allow any origin to access your server. # # Takes precedence over allow_origin_pat. c.NotebookApp.allow_origin = '*' # The notebook manager class to use. # c.NotebookApp.contents_manager_class = <class 'notebook.services.contents.filemanager.FileContentsManager'> # Use a regular expression for the Access-Control-Allow-Origin header # # Requests from an origin matching the expression will get replies with: # # Access-Control-Allow-Origin: origin # # where `origin` is the origin of the request. # # Ignored if allow_origin is set. # c.NotebookApp.allow_origin_pat = '' # The full path to an SSL/TLS certificate file. # c.NotebookApp.certfile = u'' # The logout handler class to use. # c.NotebookApp.logout_handler_class = <class 'notebook.auth.logout.LogoutHandler'> # The base URL for the notebook server. # # Leading and trailing slashes can be omitted, and will automatically be added. c.NotebookApp.base_url = '/' # The session manager class to use. # c.NotebookApp.session_manager_class = <class 'notebook.services.sessions.sessionmanager.SessionManager'> # Supply overrides for the tornado.web.Application that the IPython notebook # uses. # c.NotebookApp.tornado_settings = traitlets.Undefined # The directory to use for notebooks and kernels. c.NotebookApp.notebook_dir = u'/root/pipeline/myapps/jupyter/' # The kernel manager class to use. # c.NotebookApp.kernel_manager_class = <class 'notebook.services.kernels.kernelmanager.MappingKernelManager'> # The file where the cookie secret is stored. # c.NotebookApp.cookie_secret_file = u'' # Supply SSL options for the tornado HTTPServer. See the tornado docs for # details. # c.NotebookApp.ssl_options = traitlets.Undefined # # c.NotebookApp.file_to_run = '' # DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. # c.NotebookApp.pylab = 'disabled' # Whether to enable MathJax for typesetting math/TeX # # MathJax is the javascript library IPython uses to render math/LaTeX. It is # very large, so you may want to disable it if you have a slow internet # connection, or for offline use of the notebook. # # When disabled, equations etc. will appear as their untransformed TeX source. # c.NotebookApp.enable_mathjax = True # Reraise exceptions encountered loading server extensions? # c.NotebookApp.reraise_server_extension_failures = False # The base URL for websockets, if it differs from the HTTP server (hint: it # almost certainly doesn't). # # Should be in the form of an HTTP origin: ws[s]://hostname[:port] # c.NotebookApp.websocket_url = '' # Whether to open in a browser after starting. The specific browser used is # platform dependent and determined by the python standard library `webbrowser` # module, unless it is overridden using the --browser (NotebookApp.browser) # configuration option. c.NotebookApp.open_browser = False # Hashed password to use for web authentication. # # To generate, type in a python/IPython shell: # # from notebook.auth import passwd; passwd() # # The string should be of the form type:salt:hashed-password. # c.NotebookApp.password = u'' # extra paths to look for Javascript notebook extensions # c.NotebookApp.extra_nbextensions_path = traitlets.Undefined # Set the Access-Control-Allow-Credentials: true header # c.NotebookApp.allow_credentials = False # Extra paths to search for serving static files. # # This allows adding javascript/css to be available from the notebook server # machine, or overriding individual files in the IPython # c.NotebookApp.extra_static_paths = traitlets.Undefined # The login handler class to use. # c.NotebookApp.login_handler_class = <class 'notebook.auth.login.LoginHandler'> # Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- # For headerssent by the upstream reverse proxy. Necessary if the proxy handles # SSL # c.NotebookApp.trust_xheaders = False # Extra paths to search for serving jinja templates. # # Can be used to override templates from notebook.templates. # c.NotebookApp.extra_template_paths = traitlets.Undefined # The config manager class to use # c.NotebookApp.config_manager_class = <class 'notebook.services.config.manager.ConfigManager'> # The full path to a private key file for usage with SSL/TLS. # c.NotebookApp.keyfile = u'' # DEPRECATED, use tornado_settings # c.NotebookApp.webapp_settings = traitlets.Undefined # Specify what command to use to invoke a web browser when opening the notebook. # If not specified, the default browser will be determined by the `webbrowser` # standard library module, which allows setting of the BROWSER environment # variable to override it. # c.NotebookApp.browser = u'' #------------------------------------------------------------------------------ # LoggingConfigurable configuration #------------------------------------------------------------------------------ # A parent class for Configurables that log. # # Subclasses have a log trait, and the default behavior is to get the logger # from the currently running Application. #------------------------------------------------------------------------------ # ConnectionFileMixin configuration #------------------------------------------------------------------------------ # Mixin for configurable classes that work with connection files # set the stdin (ROUTER) port [default: random] # c.ConnectionFileMixin.stdin_port = 0 # Set the kernel's IP address [default localhost]. If the IP address is # something other than localhost, then Consoles on other machines will be able # to connect to the Kernel, so be careful! # c.ConnectionFileMixin.ip = u'' # JSON file in which to store connection info [default: kernel-<pid>.json] # # This file will contain the IP, ports, and authentication key needed to connect # clients to this kernel. By default, this file will be created in the security # dir of the current profile, but can be specified by absolute path. # c.ConnectionFileMixin.connection_file = '' # set the control (ROUTER) port [default: random] # c.ConnectionFileMixin.control_port = 0 # set the heartbeat port [default: random] # c.ConnectionFileMixin.hb_port = 0 # set the shell (ROUTER) port [default: random] # c.ConnectionFileMixin.shell_port = 0 # # c.ConnectionFileMixin.transport = 'tcp' # set the iopub (PUB) port [default: random] # c.ConnectionFileMixin.iopub_port = 0 #------------------------------------------------------------------------------ # KernelManager configuration #------------------------------------------------------------------------------ # Manages a single kernel in a subprocess on this host. # # This version starts kernels with Popen. # DEPRECATED: Use kernel_name instead. # # The Popen Command to launch the kernel. Override this if you have a custom # kernel. If kernel_cmd is specified in a configuration file, Jupyter does not # pass any arguments to the kernel, because it cannot make any assumptions about # the arguments that the kernel understands. In particular, this means that the # kernel does not receive the option --debug if it given on the Jupyter command # line. # c.KernelManager.kernel_cmd = traitlets.Undefined # Should we autorestart the kernel if it dies. # c.KernelManager.autorestart = False #------------------------------------------------------------------------------ # Session configuration #------------------------------------------------------------------------------ # Object for handling serialization and sending of messages. # # The Session object handles building messages and sending them with ZMQ sockets # or ZMQStream objects. Objects can communicate with each other over the # network via Session objects, and only need to work with the dict-based IPython # message spec. The Session will handle serialization/deserialization, security, # and metadata. # # Sessions support configurable serialization via packer/unpacker traits, and # signing with HMAC digests via the key/keyfile traits. # # Parameters ---------- # # debug : bool # whether to trigger extra debugging statements # packer/unpacker : str : 'json', 'pickle' or import_string # importstrings for methods to serialize message parts. If just # 'json' or 'pickle', predefined JSON and pickle packers will be used. # Otherwise, the entire importstring must be used. # # The functions must accept at least valid JSON input, and output *bytes*. # # For example, to use msgpack: # packer = 'msgpack.packb', unpacker='msgpack.unpackb' # pack/unpack : callables # You can also set the pack/unpack callables for serialization directly. # session : bytes # the ID of this Session object. The default is to generate a new UUID. # username : unicode # username added to message headers. The default is to ask the OS. # key : bytes # The key used to initialize an HMAC signature. If unset, messages # will not be signed or checked. # keyfile : filepath # The file containing a key. If this is set, `key` will be initialized # to the contents of the file. # Username for the Session. Default is your system username. # c.Session.username = u'username' # Threshold (in bytes) beyond which a buffer should be sent without copying. # c.Session.copy_threshold = 65536 # The name of the packer for serializing messages. Should be one of 'json', # 'pickle', or an import name for a custom callable serializer. # c.Session.packer = 'json' # Metadata dictionary, which serves as the default top-level metadata dict for # each message. # c.Session.metadata = traitlets.Undefined # The maximum number of digests to remember. # # The digest history will be culled when it exceeds this value. # c.Session.digest_history_size = 65536 # The UUID identifying this session. # c.Session.session = u'' # The digest scheme used to construct the message signatures. Must have the form # 'hmac-HASH'. # c.Session.signature_scheme = 'hmac-sha256' # execution key, for signing messages. # c.Session.key = '' # Debug output in the Session # c.Session.debug = False # The name of the unpacker for unserializing messages. Only used with custom # functions for `packer`. # c.Session.unpacker = 'json' # path to file containing execution key. # c.Session.keyfile = '' # Threshold (in bytes) beyond which an object's buffer should be extracted to # avoid pickling. # c.Session.buffer_threshold = 1024 # The maximum number of items for a container to be introspected for custom # serialization. Containers larger than this are pickled outright. # c.Session.item_threshold = 64 #------------------------------------------------------------------------------ # MultiKernelManager configuration #------------------------------------------------------------------------------ # A class for managing multiple kernels. # The name of the default kernel to start # c.MultiKernelManager.default_kernel_name = 'python2' # The kernel manager class. This is configurable to allow subclassing of the # KernelManager for customized behavior. # c.MultiKernelManager.kernel_manager_class = 'jupyter_client.ioloop.IOLoopKernelManager' #------------------------------------------------------------------------------ # MappingKernelManager configuration #------------------------------------------------------------------------------ # A KernelManager that handles notebook mapping and HTTP error handling # # c.MappingKernelManager.root_dir = u'' #------------------------------------------------------------------------------ # ContentsManager configuration #------------------------------------------------------------------------------ # Base class for serving files and directories. # # This serves any text or binary file, as well as directories, with special # handling for JSON notebook documents. # # Most APIs take a path argument, which is always an API-style unicode path, and # always refers to a directory. # # - unicode, not url-escaped # - '/'-separated # - leading and trailing '/' will be stripped # - if unspecified, path defaults to '', # indicating the root path. # The base name used when creating untitled files. # c.ContentsManager.untitled_file = 'untitled' # Python callable or importstring thereof # # To be called on a contents model prior to save. # # This can be used to process the structure, such as removing notebook outputs # or other side effects that should not be saved. # # It will be called as (all arguments passed by keyword):: # # hook(path=path, model=model, contents_manager=self) # # - model: the model to be saved. Includes file contents. # Modifying this dict will affect the file that is stored. # - path: the API path of the save destination # - contents_manager: this ContentsManager instance # c.ContentsManager.pre_save_hook = None # # c.ContentsManager.checkpoints_class = <class 'notebook.services.contents.checkpoints.Checkpoints'> # Glob patterns to hide in file and directory listings. # c.ContentsManager.hide_globs = traitlets.Undefined # The base name used when creating untitled notebooks. # c.ContentsManager.untitled_notebook = 'Untitled' # The base name used when creating untitled directories. # c.ContentsManager.untitled_directory = 'Untitled Folder' # # c.ContentsManager.checkpoints = traitlets.Undefined # # c.ContentsManager.checkpoints_kwargs = traitlets.Undefined #------------------------------------------------------------------------------ # FileContentsManager configuration #------------------------------------------------------------------------------ # DEPRECATED, use post_save_hook # c.FileContentsManager.save_script = False # # c.FileContentsManager.root_dir = u'' # Python callable or importstring thereof # # to be called on the path of a file just saved. # # This can be used to process the file on disk, such as converting the notebook # to a script or HTML via nbconvert. # # It will be called as (all arguments passed by keyword):: # # hook(os_path=os_path, model=model, contents_manager=instance) # # - path: the filesystem path to the file just written - model: the model # representing the file - contents_manager: this ContentsManager instance # c.FileContentsManager.post_save_hook = None #------------------------------------------------------------------------------ # NotebookNotary configuration #------------------------------------------------------------------------------ # A class for computing and verifying notebook signatures. # The number of notebook signatures to cache. When the number of signatures # exceeds this value, the oldest 25% of signatures will be culled. # c.NotebookNotary.cache_size = 65535 # The secret key with which notebooks are signed. # c.NotebookNotary.secret = '' # The sqlite file in which to store notebook signatures. By default, this will # be in your Jupyter runtime directory. You can set it to ':memory:' to disable # sqlite writing to the filesystem. # c.NotebookNotary.db_file = u'' # The hashing algorithm used to sign notebooks. # c.NotebookNotary.algorithm = 'sha256' # The file where the secret key is stored. # c.NotebookNotary.secret_file = u'' #------------------------------------------------------------------------------ # KernelSpecManager configuration #------------------------------------------------------------------------------ # Whitelist of allowed kernel names. # # By default, all installed kernels are allowed. # c.KernelSpecManager.whitelist = traitlets.Undefined
36.942197
109
0.668388
[ "Apache-2.0" ]
TrinathY/pipeline
config/jupyter/jupyter_notebook_config.py
19,173
Python
Configuration file for jupyter-notebook.------------------------------------------------------------------------------ Configurable configuration------------------------------------------------------------------------------------------------------------------------------------------------------------ SingletonConfigurable configuration------------------------------------------------------------------------------ A configurable that only allows one instance. This class is for classes that should only have one instance of itself or *any* subclass. To create and retrieve such a class use the :meth:`SingletonConfigurable.instance` method.------------------------------------------------------------------------------ Application configuration------------------------------------------------------------------------------ This is an application. The date format used by logging formatters for %(asctime)s c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' The Logging format template c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' Set the log level by value or name. c.Application.log_level = 30------------------------------------------------------------------------------ JupyterApp configuration------------------------------------------------------------------------------ Base class for Jupyter applications Answer yes to any prompts. Full path of a config file. c.JupyterApp.config_file = u'' Generate default config file. c.JupyterApp.generate_config = False Specify a config file to load. c.JupyterApp.config_file_name = u''------------------------------------------------------------------------------ NotebookApp configuration------------------------------------------------------------------------------ The number of additional ports to try if the specified port is not available. Extra variables to supply to jinja templates when rendering. c.NotebookApp.jinja_template_vars = traitlets.Undefined The url for MathJax.js. c.NotebookApp.mathjax_url = '' Supply extra arguments that will be passed to Jinja environment. c.NotebookApp.jinja_environment_options = traitlets.Undefined The IP address the notebook server will listen on. DEPRECATED use base_url c.NotebookApp.base_project_url = '/' Python modules to load as notebook server extensions. This is an experimental API, and may change in future releases. c.NotebookApp.server_extensions = traitlets.Undefined Note: These extensions require the ~/.jupyter path to exist otherwise, errors will occur on startup The random bytes used to secure cookies. By default this is a new random number every time you start the Notebook. Set it to a value in a config file to enable logins to persist across server sessions. Note: Cookie secrets should be kept private, do not share config files with cookie_secret stored in plaintext (you can read the value from a file). c.NotebookApp.cookie_secret = '' The default URL to redirect to from `/` c.NotebookApp.default_url = '/tree' The port the notebook server will listen on. The kernel spec manager class to use. Should be a subclass of `jupyter_client.kernelspec.KernelSpecManager`. The Api of KernelSpecManager is provisional and might change without warning between this version of IPython and the next stable one. c.NotebookApp.kernel_spec_manager_class = <class 'jupyter_client.kernelspec.KernelSpecManager'> Set the Access-Control-Allow-Origin header Use '*' to allow any origin to access your server. Takes precedence over allow_origin_pat. The notebook manager class to use. c.NotebookApp.contents_manager_class = <class 'notebook.services.contents.filemanager.FileContentsManager'> Use a regular expression for the Access-Control-Allow-Origin header Requests from an origin matching the expression will get replies with: Access-Control-Allow-Origin: origin where `origin` is the origin of the request. Ignored if allow_origin is set. c.NotebookApp.allow_origin_pat = '' The full path to an SSL/TLS certificate file. c.NotebookApp.certfile = u'' The logout handler class to use. c.NotebookApp.logout_handler_class = <class 'notebook.auth.logout.LogoutHandler'> The base URL for the notebook server. Leading and trailing slashes can be omitted, and will automatically be added. The session manager class to use. c.NotebookApp.session_manager_class = <class 'notebook.services.sessions.sessionmanager.SessionManager'> Supply overrides for the tornado.web.Application that the IPython notebook uses. c.NotebookApp.tornado_settings = traitlets.Undefined The directory to use for notebooks and kernels. The kernel manager class to use. c.NotebookApp.kernel_manager_class = <class 'notebook.services.kernels.kernelmanager.MappingKernelManager'> The file where the cookie secret is stored. c.NotebookApp.cookie_secret_file = u'' Supply SSL options for the tornado HTTPServer. See the tornado docs for details. c.NotebookApp.ssl_options = traitlets.Undefined c.NotebookApp.file_to_run = '' DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. c.NotebookApp.pylab = 'disabled' Whether to enable MathJax for typesetting math/TeX MathJax is the javascript library IPython uses to render math/LaTeX. It is very large, so you may want to disable it if you have a slow internet connection, or for offline use of the notebook. When disabled, equations etc. will appear as their untransformed TeX source. c.NotebookApp.enable_mathjax = True Reraise exceptions encountered loading server extensions? c.NotebookApp.reraise_server_extension_failures = False The base URL for websockets, if it differs from the HTTP server (hint: it almost certainly doesn't). Should be in the form of an HTTP origin: ws[s]://hostname[:port] c.NotebookApp.websocket_url = '' Whether to open in a browser after starting. The specific browser used is platform dependent and determined by the python standard library `webbrowser` module, unless it is overridden using the --browser (NotebookApp.browser) configuration option. Hashed password to use for web authentication. To generate, type in a python/IPython shell: from notebook.auth import passwd; passwd() The string should be of the form type:salt:hashed-password. c.NotebookApp.password = u'' extra paths to look for Javascript notebook extensions c.NotebookApp.extra_nbextensions_path = traitlets.Undefined Set the Access-Control-Allow-Credentials: true header c.NotebookApp.allow_credentials = False Extra paths to search for serving static files. This allows adding javascript/css to be available from the notebook server machine, or overriding individual files in the IPython c.NotebookApp.extra_static_paths = traitlets.Undefined The login handler class to use. c.NotebookApp.login_handler_class = <class 'notebook.auth.login.LoginHandler'> Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- For headerssent by the upstream reverse proxy. Necessary if the proxy handles SSL c.NotebookApp.trust_xheaders = False Extra paths to search for serving jinja templates. Can be used to override templates from notebook.templates. c.NotebookApp.extra_template_paths = traitlets.Undefined The config manager class to use c.NotebookApp.config_manager_class = <class 'notebook.services.config.manager.ConfigManager'> The full path to a private key file for usage with SSL/TLS. c.NotebookApp.keyfile = u'' DEPRECATED, use tornado_settings c.NotebookApp.webapp_settings = traitlets.Undefined Specify what command to use to invoke a web browser when opening the notebook. If not specified, the default browser will be determined by the `webbrowser` standard library module, which allows setting of the BROWSER environment variable to override it. c.NotebookApp.browser = u''------------------------------------------------------------------------------ LoggingConfigurable configuration------------------------------------------------------------------------------ A parent class for Configurables that log. Subclasses have a log trait, and the default behavior is to get the logger from the currently running Application.------------------------------------------------------------------------------ ConnectionFileMixin configuration------------------------------------------------------------------------------ Mixin for configurable classes that work with connection files set the stdin (ROUTER) port [default: random] c.ConnectionFileMixin.stdin_port = 0 Set the kernel's IP address [default localhost]. If the IP address is something other than localhost, then Consoles on other machines will be able to connect to the Kernel, so be careful! c.ConnectionFileMixin.ip = u'' JSON file in which to store connection info [default: kernel-<pid>.json] This file will contain the IP, ports, and authentication key needed to connect clients to this kernel. By default, this file will be created in the security dir of the current profile, but can be specified by absolute path. c.ConnectionFileMixin.connection_file = '' set the control (ROUTER) port [default: random] c.ConnectionFileMixin.control_port = 0 set the heartbeat port [default: random] c.ConnectionFileMixin.hb_port = 0 set the shell (ROUTER) port [default: random] c.ConnectionFileMixin.shell_port = 0 c.ConnectionFileMixin.transport = 'tcp' set the iopub (PUB) port [default: random] c.ConnectionFileMixin.iopub_port = 0------------------------------------------------------------------------------ KernelManager configuration------------------------------------------------------------------------------ Manages a single kernel in a subprocess on this host. This version starts kernels with Popen. DEPRECATED: Use kernel_name instead. The Popen Command to launch the kernel. Override this if you have a custom kernel. If kernel_cmd is specified in a configuration file, Jupyter does not pass any arguments to the kernel, because it cannot make any assumptions about the arguments that the kernel understands. In particular, this means that the kernel does not receive the option --debug if it given on the Jupyter command line. c.KernelManager.kernel_cmd = traitlets.Undefined Should we autorestart the kernel if it dies. c.KernelManager.autorestart = False------------------------------------------------------------------------------ Session configuration------------------------------------------------------------------------------ Object for handling serialization and sending of messages. The Session object handles building messages and sending them with ZMQ sockets or ZMQStream objects. Objects can communicate with each other over the network via Session objects, and only need to work with the dict-based IPython message spec. The Session will handle serialization/deserialization, security, and metadata. Sessions support configurable serialization via packer/unpacker traits, and signing with HMAC digests via the key/keyfile traits. Parameters ---------- debug : bool whether to trigger extra debugging statements packer/unpacker : str : 'json', 'pickle' or import_string importstrings for methods to serialize message parts. If just 'json' or 'pickle', predefined JSON and pickle packers will be used. Otherwise, the entire importstring must be used. The functions must accept at least valid JSON input, and output *bytes*. For example, to use msgpack: packer = 'msgpack.packb', unpacker='msgpack.unpackb' pack/unpack : callables You can also set the pack/unpack callables for serialization directly. session : bytes the ID of this Session object. The default is to generate a new UUID. username : unicode username added to message headers. The default is to ask the OS. key : bytes The key used to initialize an HMAC signature. If unset, messages will not be signed or checked. keyfile : filepath The file containing a key. If this is set, `key` will be initialized to the contents of the file. Username for the Session. Default is your system username. c.Session.username = u'username' Threshold (in bytes) beyond which a buffer should be sent without copying. c.Session.copy_threshold = 65536 The name of the packer for serializing messages. Should be one of 'json', 'pickle', or an import name for a custom callable serializer. c.Session.packer = 'json' Metadata dictionary, which serves as the default top-level metadata dict for each message. c.Session.metadata = traitlets.Undefined The maximum number of digests to remember. The digest history will be culled when it exceeds this value. c.Session.digest_history_size = 65536 The UUID identifying this session. c.Session.session = u'' The digest scheme used to construct the message signatures. Must have the form 'hmac-HASH'. c.Session.signature_scheme = 'hmac-sha256' execution key, for signing messages. c.Session.key = '' Debug output in the Session c.Session.debug = False The name of the unpacker for unserializing messages. Only used with custom functions for `packer`. c.Session.unpacker = 'json' path to file containing execution key. c.Session.keyfile = '' Threshold (in bytes) beyond which an object's buffer should be extracted to avoid pickling. c.Session.buffer_threshold = 1024 The maximum number of items for a container to be introspected for custom serialization. Containers larger than this are pickled outright. c.Session.item_threshold = 64------------------------------------------------------------------------------ MultiKernelManager configuration------------------------------------------------------------------------------ A class for managing multiple kernels. The name of the default kernel to start c.MultiKernelManager.default_kernel_name = 'python2' The kernel manager class. This is configurable to allow subclassing of the KernelManager for customized behavior. c.MultiKernelManager.kernel_manager_class = 'jupyter_client.ioloop.IOLoopKernelManager'------------------------------------------------------------------------------ MappingKernelManager configuration------------------------------------------------------------------------------ A KernelManager that handles notebook mapping and HTTP error handling c.MappingKernelManager.root_dir = u''------------------------------------------------------------------------------ ContentsManager configuration------------------------------------------------------------------------------ Base class for serving files and directories. This serves any text or binary file, as well as directories, with special handling for JSON notebook documents. Most APIs take a path argument, which is always an API-style unicode path, and always refers to a directory. - unicode, not url-escaped - '/'-separated - leading and trailing '/' will be stripped - if unspecified, path defaults to '', indicating the root path. The base name used when creating untitled files. c.ContentsManager.untitled_file = 'untitled' Python callable or importstring thereof To be called on a contents model prior to save. This can be used to process the structure, such as removing notebook outputs or other side effects that should not be saved. It will be called as (all arguments passed by keyword):: hook(path=path, model=model, contents_manager=self) - model: the model to be saved. Includes file contents. Modifying this dict will affect the file that is stored. - path: the API path of the save destination - contents_manager: this ContentsManager instance c.ContentsManager.pre_save_hook = None c.ContentsManager.checkpoints_class = <class 'notebook.services.contents.checkpoints.Checkpoints'> Glob patterns to hide in file and directory listings. c.ContentsManager.hide_globs = traitlets.Undefined The base name used when creating untitled notebooks. c.ContentsManager.untitled_notebook = 'Untitled' The base name used when creating untitled directories. c.ContentsManager.untitled_directory = 'Untitled Folder' c.ContentsManager.checkpoints = traitlets.Undefined c.ContentsManager.checkpoints_kwargs = traitlets.Undefined------------------------------------------------------------------------------ FileContentsManager configuration------------------------------------------------------------------------------ DEPRECATED, use post_save_hook c.FileContentsManager.save_script = False c.FileContentsManager.root_dir = u'' Python callable or importstring thereof to be called on the path of a file just saved. This can be used to process the file on disk, such as converting the notebook to a script or HTML via nbconvert. It will be called as (all arguments passed by keyword):: hook(os_path=os_path, model=model, contents_manager=instance) - path: the filesystem path to the file just written - model: the model representing the file - contents_manager: this ContentsManager instance c.FileContentsManager.post_save_hook = None------------------------------------------------------------------------------ NotebookNotary configuration------------------------------------------------------------------------------ A class for computing and verifying notebook signatures. The number of notebook signatures to cache. When the number of signatures exceeds this value, the oldest 25% of signatures will be culled. c.NotebookNotary.cache_size = 65535 The secret key with which notebooks are signed. c.NotebookNotary.secret = '' The sqlite file in which to store notebook signatures. By default, this will be in your Jupyter runtime directory. You can set it to ':memory:' to disable sqlite writing to the filesystem. c.NotebookNotary.db_file = u'' The hashing algorithm used to sign notebooks. c.NotebookNotary.algorithm = 'sha256' The file where the secret key is stored. c.NotebookNotary.secret_file = u''------------------------------------------------------------------------------ KernelSpecManager configuration------------------------------------------------------------------------------ Whitelist of allowed kernel names. By default, all installed kernels are allowed. c.KernelSpecManager.whitelist = traitlets.Undefined
17,935
0.93543
# # Tencent is pleased to support the open source community by making Angel available. # # Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law or agreed to in writing, software distributed under the License is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, # either express or implied. See the License for the specific language governing permissions and # from enum import Enum, unique @unique class RunningMode(Enum): """ Enum for running mode """ # Run ParameterServer & ParameterServerAgent ANGEL_PS_PSAGENT = 0 # Only Run ParameterServer ANGEL_PS = 1 # Run ParameterServer & Worker(embedded ParameterServerAgent) ANGEL_PS_WORKER = 2
31.967742
102
0.744702
[ "Apache-2.0", "BSD-3-Clause" ]
20100507/angel
angel-ps/python/build/lib/pyangel/running_mode.py
991
Python
Enum for running mode Tencent is pleased to support the open source community by making Angel available. Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://opensource.org/licenses/BSD-3-Clause Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and Run ParameterServer & ParameterServerAgent Only Run ParameterServer Run ParameterServer & Worker(embedded ParameterServerAgent)
793
0.800202
# MIT License # # Copyright (c) 2019 Red Hat, Inc. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE.
50.318182
80
0.775971
[ "MIT" ]
FilipSchad/packit
packit/cli/__init__.py
1,107
Python
MIT License Copyright (c) 2019 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1,065
0.96206
# inclass/mongo_queries.py import pymongo import os from dotenv import load_dotenv import sqlite3 load_dotenv() DB_USER = os.getenv("MONGO_USER", default="OOPS") DB_PASSWORD = os.getenv("MONGO_PASSWORD", default="OOPS") CLUSTER_NAME = os.getenv("MONGO_CLUSTER_NAME", default="OOPS") connection_uri = f"mongodb+srv://{DB_USER}:{DB_PASSWORD}@{CLUSTER_NAME}.mongodb.net/test?retryWrites=true&w=majority&ssl=true&ssl_cert_reqs=CERT_NONE" print("----------------") print("URI:", connection_uri) client = pymongo.MongoClient(connection_uri) print("----------------") print("CLIENT:", type(client), client) # print(dir(client)) # print("DB NAMES:", client.list_database_names()) #> ['admin', 'local'] db = client.ds14_db # "ds14_db" or whatever you want to call it # print("----------------") # print("DB:", type(db), db) # collection = db.ds14_pokemon_collection # "ds14_collection" or whatever you want to call it # print("----------------") # print("COLLECTION:", type(collection), collection) # print("----------------") # # print("COLLECTIONS:") # # print(db.list_collection_names()) # print("--------------------------------------") ################## ASSIGNMENT III ############################# # INSERT RPG DATA INTO MONGODB INSTANCE # Create RPG database db = client.rpg_data_db # Establish sqlite3 connection to access rpg data sl_conn = sqlite3.connect("data/rpg_db_original.sqlite3") sl_curs = sl_conn.cursor() ################# CHARACTERS ########################### # ## Create new collection for RPG data # col_characters = db.character_collection # ## Establish SQL syntax for query # rpg_characters = 'SELECT * FROM charactercreator_character' # # Function to loop through characters and return list of dictionaries # def all_chars(): # query = rpg_characters # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "character_id": row[0], # "name": row[1], # "level": row[2], # "exp": row[3], # "hp": row[4], # "strength": row[5], # "intelligence": row[6], # "dexterity": row[7], # "wisdom": row[8] # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # # print(character_dict_list) # col_characters.insert_many(character_dict_list) # print("DOCS(Num Characters):", col_characters.count_documents({})) # # SELECT count(distinct id) from characters ################# MAGES ########################### # col_mage = db.mage_collection # mages = 'SELECT * FROM charactercreator_mage' # def all_chars(): # query = mages # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "character_ptr_id": row[0], # "has_pet": row[1], # "mana": row[2], # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_mage.insert_many(character_dict_list) # print("DOCS:", col_mage.count_documents({})) ################# THIEVES ########################### # col_thief = db.thief_collection # thieves = 'SELECT * FROM charactercreator_thief' # def all_chars(): # query = thieves # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "character_ptr_id": row[0], # "is_sneaking": row[1], # "energy": row[2], # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_thief.insert_many(character_dict_list) # print("DOCS:", col_thief.count_documents({})) ################# CLERICS ########################### # col_cleric = db.cleric_collection # clerics = 'SELECT * FROM charactercreator_cleric' # def all_chars(): # query = clerics # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "character_ptr_id": row[0], # "using_shield": row[1], # "mana": row[2], # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_cleric.insert_many(character_dict_list) # print("DOCS:", col_cleric.count_documents({})) ################# FIGHTERS ########################### # col_fighter = db.fighter_collection # fighters = 'SELECT * FROM charactercreator_fighter' # def all_chars(): # query = fighters # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "character_ptr_id": row[0], # "using_shield": row[1], # "rage": row[2], # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_fighter.insert_many(character_dict_list) # print("DOCS:", col_fighter.count_documents({})) ################# NECROMANCERS ########################### # col_mancer = db.mancer_collection # mancers = 'SELECT * FROM charactercreator_necromancer' # def all_chars(): # query = mancers # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "mage_ptr_id": row[0], # "talisman_charged": row[1], # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_mancer.insert_many(character_dict_list) # print("DOCS:", col_mancer.count_documents({})) ################# ITEMS ########################### # col_items = db.items_collection # items = 'SELECT * FROM armory_item' # def all_chars(): # query = items # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "item_id": row[0], # "name": row[1], # "value": row[2], # "weight": row[3] # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_items.insert_many(character_dict_list) # print("DOCS:", col_items.count_documents({})) ################# WEAPONS ########################### # col_weapons = db.weapons_collection # weapons = 'SELECT * FROM armory_weapon' # def all_chars(): # query = weapons # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "item_ptr_id": row[0], # "power": row[1] # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_weapons.insert_many(character_dict_list) # print("DOCS:", col_weapons.count_documents({})) ################# INVENTORY ########################### # col_inventory = db.inventory_collection # records = 'SELECT * FROM charactercreator_character_inventory' # def all_chars(): # query = records # chars = sl_curs.execute(query) # char_data = [] # for row in chars: # character = { # "id": row[0], # "character_id": row[1], # "item_id": row[2] # } # char_data.append(character) # result = char_data # return result # character_dict_list = all_chars() # col_inventory.insert_many(character_dict_list) # print("DOCS:", col_inventory.count_documents({})) # print("COLLECTIONS:") # print(db.list_collection_names()) #################### IN-CLASS POKEMON INSERTS ############################# # collection.insert_one({ # "name": "Pikachu", # "level": 30, # "exp": 76000000000, # "hp": 400, # "fav_icecream_flavors":["vanila_bean", "choc"], # "stats":{"a":1,"b":2,"c":[1,2,3]} # }) # print("DOCS:", collection.count_documents({})) # SELECT count(distinct id) from pokemon # print(collection.count_documents({"name": "Pikachu"})) # SELECT # count(distinct id) from pokemon WHERE name = "Pikachu" # mewtwo = { # "name": "Mewtwo", # "level": 100, # "exp": 76000000000, # "hp": 450, # "strength": 550, # "intelligence": 450, # "dexterity": 300, # "wisdom": 575 # } # blastoise = { # "name": "Blastoise", # "lvl": 70, # OOPS we made a mistake with the structure of this dict # } # charmander = { # "nameeeeeee": "Charmander", # "level": 70, # "random_stat": {"a":2} # } # skarmory = { # "name": "Skarmory", # "level": 22, # "exp": 42000, # "hp": 85, # "strength": 750, # "intelligence": 8, # "dexterity": 57 # } # cubone = { # "name": "Cubone", # "level": 20, # "exp": 35000, # "hp": 80, # "strength": 600, # "intelligence": 60, # "dexterity": 200, # "wisdom": 200 # } # scyther = { # "name": "Scyther", # "level": 99, # "exp": 7000, # "hp": 40, # "strength": 50, # "intelligence": 40, # "dexterity": 30, # "wisdom": 57 # } # slowpoke = { # "name": "Slowpoke", # "level": 1, # "exp": 100, # "hp": 80, # "strength": 100, # "intelligence": 10, # "dexterity": 50, # "wisdom": 200 # } # pokemon_team = [mewtwo, blastoise, skarmory, cubone, scyther, slowpoke, charmander] # collection.insert_many(pokemon_team) # print("DOCS:", collection.count_documents({})) # SELECT count(distinct id) from pokemon # #collection.insert_one({"_id": "OURVAL", "name":"TEST"}) # # can overwrite the _id but not insert duplicate _id values # #breakpoint() # pikas = list(collection.find({"name": "Pikachu"})) # SELECT * FROM pokemon WHERE name = "Pikachu" # # print(len(pikas), "PIKAS") # # print(pikas[0]["_id"]) #> ObjectId('5ebc31c79c171e43bb5ed469') # # print(pikas[0]["name"]) # # strong = list(collection.find({"level": {"$gte": 60}} $or {"lvl": {"$gte": 60}})) # # strong = list(collection.find({"level": {"$gte": 60}, "$or" "lvl": {"$gte": 60}})) # strong = list(collection.find({"$or": [{"level": {"$gte": 60}}, {"lvl": {"$gte": 60}}]})) # # TODO: also try to account for our mistakes "lvl" vs "level" # breakpoint() # print(strong)
26.685864
150
0.566314
[ "MIT" ]
ekselan/DS-Unit-3-Sprint-2-SQL-and-Databases
assignment3/a3_mongo_queries_abw.py
10,194
Python
inclass/mongo_queries.py print(dir(client)) print("DB NAMES:", client.list_database_names()) > ['admin', 'local'] "ds14_db" or whatever you want to call it print("----------------") print("DB:", type(db), db) collection = db.ds14_pokemon_collection "ds14_collection" or whatever you want to call it print("----------------") print("COLLECTION:", type(collection), collection) print("----------------") print("COLLECTIONS:") print(db.list_collection_names()) print("--------------------------------------") ASSIGNMENT III INSERT RPG DATA INTO MONGODB INSTANCE Create RPG database Establish sqlite3 connection to access rpg data CHARACTERS Create new collection for RPG data col_characters = db.character_collection Establish SQL syntax for query rpg_characters = 'SELECT * FROM charactercreator_character' Function to loop through characters and return list of dictionaries def all_chars(): query = rpg_characters chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "character_id": row[0], "name": row[1], "level": row[2], "exp": row[3], "hp": row[4], "strength": row[5], "intelligence": row[6], "dexterity": row[7], "wisdom": row[8] } char_data.append(character) result = char_data return result character_dict_list = all_chars() print(character_dict_list) col_characters.insert_many(character_dict_list) print("DOCS(Num Characters):", col_characters.count_documents({})) SELECT count(distinct id) from characters MAGES col_mage = db.mage_collection mages = 'SELECT * FROM charactercreator_mage' def all_chars(): query = mages chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "character_ptr_id": row[0], "has_pet": row[1], "mana": row[2], } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_mage.insert_many(character_dict_list) print("DOCS:", col_mage.count_documents({})) THIEVES col_thief = db.thief_collection thieves = 'SELECT * FROM charactercreator_thief' def all_chars(): query = thieves chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "character_ptr_id": row[0], "is_sneaking": row[1], "energy": row[2], } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_thief.insert_many(character_dict_list) print("DOCS:", col_thief.count_documents({})) CLERICS col_cleric = db.cleric_collection clerics = 'SELECT * FROM charactercreator_cleric' def all_chars(): query = clerics chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "character_ptr_id": row[0], "using_shield": row[1], "mana": row[2], } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_cleric.insert_many(character_dict_list) print("DOCS:", col_cleric.count_documents({})) FIGHTERS col_fighter = db.fighter_collection fighters = 'SELECT * FROM charactercreator_fighter' def all_chars(): query = fighters chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "character_ptr_id": row[0], "using_shield": row[1], "rage": row[2], } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_fighter.insert_many(character_dict_list) print("DOCS:", col_fighter.count_documents({})) NECROMANCERS col_mancer = db.mancer_collection mancers = 'SELECT * FROM charactercreator_necromancer' def all_chars(): query = mancers chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "mage_ptr_id": row[0], "talisman_charged": row[1], } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_mancer.insert_many(character_dict_list) print("DOCS:", col_mancer.count_documents({})) ITEMS col_items = db.items_collection items = 'SELECT * FROM armory_item' def all_chars(): query = items chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "item_id": row[0], "name": row[1], "value": row[2], "weight": row[3] } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_items.insert_many(character_dict_list) print("DOCS:", col_items.count_documents({})) WEAPONS col_weapons = db.weapons_collection weapons = 'SELECT * FROM armory_weapon' def all_chars(): query = weapons chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "item_ptr_id": row[0], "power": row[1] } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_weapons.insert_many(character_dict_list) print("DOCS:", col_weapons.count_documents({})) INVENTORY col_inventory = db.inventory_collection records = 'SELECT * FROM charactercreator_character_inventory' def all_chars(): query = records chars = sl_curs.execute(query) char_data = [] for row in chars: character = { "id": row[0], "character_id": row[1], "item_id": row[2] } char_data.append(character) result = char_data return result character_dict_list = all_chars() col_inventory.insert_many(character_dict_list) print("DOCS:", col_inventory.count_documents({})) print("COLLECTIONS:") print(db.list_collection_names()) IN-CLASS POKEMON INSERTS collection.insert_one({ "name": "Pikachu", "level": 30, "exp": 76000000000, "hp": 400, "fav_icecream_flavors":["vanila_bean", "choc"], "stats":{"a":1,"b":2,"c":[1,2,3]} }) print("DOCS:", collection.count_documents({})) SELECT count(distinct id) from pokemon print(collection.count_documents({"name": "Pikachu"})) SELECT count(distinct id) from pokemon WHERE name = "Pikachu" mewtwo = { "name": "Mewtwo", "level": 100, "exp": 76000000000, "hp": 450, "strength": 550, "intelligence": 450, "dexterity": 300, "wisdom": 575 } blastoise = { "name": "Blastoise", "lvl": 70, OOPS we made a mistake with the structure of this dict } charmander = { "nameeeeeee": "Charmander", "level": 70, "random_stat": {"a":2} } skarmory = { "name": "Skarmory", "level": 22, "exp": 42000, "hp": 85, "strength": 750, "intelligence": 8, "dexterity": 57 } cubone = { "name": "Cubone", "level": 20, "exp": 35000, "hp": 80, "strength": 600, "intelligence": 60, "dexterity": 200, "wisdom": 200 } scyther = { "name": "Scyther", "level": 99, "exp": 7000, "hp": 40, "strength": 50, "intelligence": 40, "dexterity": 30, "wisdom": 57 } slowpoke = { "name": "Slowpoke", "level": 1, "exp": 100, "hp": 80, "strength": 100, "intelligence": 10, "dexterity": 50, "wisdom": 200 } pokemon_team = [mewtwo, blastoise, skarmory, cubone, scyther, slowpoke, charmander] collection.insert_many(pokemon_team) print("DOCS:", collection.count_documents({})) SELECT count(distinct id) from pokemon collection.insert_one({"_id": "OURVAL", "name":"TEST"}) can overwrite the _id but not insert duplicate _id values breakpoint() pikas = list(collection.find({"name": "Pikachu"})) SELECT * FROM pokemon WHERE name = "Pikachu" print(len(pikas), "PIKAS") print(pikas[0]["_id"]) > ObjectId('5ebc31c79c171e43bb5ed469') print(pikas[0]["name"]) strong = list(collection.find({"level": {"$gte": 60}} $or {"lvl": {"$gte": 60}})) strong = list(collection.find({"level": {"$gte": 60}, "$or" "lvl": {"$gte": 60}})) strong = list(collection.find({"$or": [{"level": {"$gte": 60}}, {"lvl": {"$gte": 60}}]})) TODO: also try to account for our mistakes "lvl" vs "level" breakpoint() print(strong)
8,333
0.817442
# -*- coding: utf-8 -*- # # Python Github documentation build configuration file, created by # sphinx-quickstart on Tue Feb 3 23:23:15 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.viewcode', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Python Github' copyright = u'2015, Nicolas Mendoza' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.1.0' # The full version, including alpha/beta/rc tags. release = '0.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'PythonGithubdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'PythonGithub.tex', u'Python Github Documentation', u'Nicolas Mendoza', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pythongithub', u'Python Github Documentation', [u'Nicolas Mendoza'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'PythonGithub', u'Python Github Documentation', u'Nicolas Mendoza', 'PythonGithub', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None}
31.524164
79
0.71816
[ "MIT" ]
nicchub/PythonGithub
docs/conf.py
8,480
Python
-*- coding: utf-8 -*- Python Github documentation build configuration file, created by sphinx-quickstart on Tue Feb 3 23:23:15 2015. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages.language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents.keep_warnings = False -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation.html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu.texinfo_no_detailmenu = False Example configuration for intersphinx: refer to the Python standard library.
7,108
0.838208
''' TRIES Trie support search, insert, and deletion in O(L) time where L is length of the key why Trie? * With Trie, we can insert and find strings in O(L) time where L represent the length of a single word. This is obviously faster than BST. This is also faster than Hashing because of the ways it is implemented. We do not need to compute any hash function. No collision handling is required (like we do in open addressing and separate chaining) * Another advantage of Trie is, we can easily print all words in alphabetical order which is not easily possible with hashing. * We can efficiently do prefix search (or auto-complete) with Trie. Issues with Trie Faster but require HUGE memory for storing the strings NOTE: Trie node class struct TrieNode { struct TrieNode *children[ALPHABET_SIZE]; // isEndOfWord is true if the node // represents end of a word bool isEndOfWord; }; ''' class TrieNode: # Trie node class def __init__(self): self.children = [None]*26 # isEndOfWord is True if node represent the end of the word self.isEndOfWord = False
28.925
147
0.703544
[ "MIT" ]
Wmeng98/Leetcode
CTCI/Data Structures/Trees/tries.py
1,157
Python
TRIES Trie support search, insert, and deletion in O(L) time where L is length of the key why Trie? * With Trie, we can insert and find strings in O(L) time where L represent the length of a single word. This is obviously faster than BST. This is also faster than Hashing because of the ways it is implemented. We do not need to compute any hash function. No collision handling is required (like we do in open addressing and separate chaining) * Another advantage of Trie is, we can easily print all words in alphabetical order which is not easily possible with hashing. * We can efficiently do prefix search (or auto-complete) with Trie. Issues with Trie Faster but require HUGE memory for storing the strings NOTE: Trie node class struct TrieNode { struct TrieNode *children[ALPHABET_SIZE]; // isEndOfWord is true if the node // represents end of a word bool isEndOfWord; }; Trie node class isEndOfWord is True if node represent the end of the word
1,015
0.877269
# Configuration file with default options, # There are four main sections: General, Features, LQP and Learning corresponding to different # functionalities. You can disable any of the Features or Learning section (by commenting it out) according to your requirement. [General] # general options idir=/home/hussain/datasets/LFW/lfwa # images directory path odir=/scratch/testing/new-experiments/ # path where cropped_images, learned model and computed features will be stored dataset=LFW # name of dataset to use; it can be either LFW or FERET [currently not supported] width=80 # width of cropped images height=150 # height of cropped images padding=10 # (same as cellsize) use a padding of one cell on each side. This value must be same as the option cell-size has in the features section xoffset=1 # offsets to be added (from the center position) to the crop window placed over the original aligned images yoffset=-4 cbdataset=train-val # complete # This option is used only with LQP Features. It is used to choose subset of dataset for codebook learning e.g. in case of LFW it can be either view1 training validation ('train-val') subset or complete view1 set('complete') ftype=LQP # Feature types. Choice can be LBP, LTP, LBP+LTP or LQP usergb=False # if color images, use color information during feature computations. [Features] # options for feature computation listfile="" # a list file containing list of cropped images to compute features cellsize=10 # cellsize for the histogram grid tol=5 # [5,7] # tolerance values used for LTP or LQP features (can pass a list, i.e. tol=[5, 7]) [LQP] #LQP Options lqptype=2 # LQP type represent LQP geometric structure. # Choices can be either Disk (2) or Hor+Ver+Diag+ADiag (9) strip. lqpsize=7 # LQP size represent radius (length of strip) # of LQP disk (HVDA strip) (can pass a list i.e. lqpsize=[5,7]) coding=4 # LQP encoding type can be: Binary (0), Ternary (1) or Split-Ternary (4) cbsize=150 # Codebook size (number of visual words) used for # LQP computation (can pass a list, i.e. cbsize=[100, 150] cbfile="" # [Optional] A list file containing list of images for learning the codebook [Learning] # options for model learning view=complete # view2 # complete # Choice of the dataset, options cans be view1: used for # parameter tuning purposes; view2: used only for model # evaluation; complete: a model parameters will be first # tuned on view1 and results will be reported on view2 ttype=with-pca # Choice of Training with or without PCA (for feature # evaluation) Available options are with-pca or without- # (a pca model is learned and features are compared in the pca space) # or without-pca (features are compared in there original space) featdir="" # Directory path where computed features have been stored, used if # learning is being done without feature computation cycle. dist=cosine # Distance metric for comparing features. Choices are cosine, chi-square and L2. # For optimal results use cosine metric for comparing PCA reduced features and # chi-squared for comparing non-reduced ones. pcadim=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000] # Number of PCA components. You can pass a scalar or list, i.e. # pcadim= 500. In case of a list, all the dimensions will be used # for model learning (on view1) and finally only the best performing one will be # kept. Note that a single model with max(pcadim) is learned in this case # but evaluation is done using all the dimensions. # Caution: providing a much higher dimension makes the learning slow and memory # intensive
68.241379
256
0.698585
[ "BSD-3-Clause" ]
csgcmai/lqp_face
face-rec/config.py
3,958
Python
Configuration file with default options, There are four main sections: General, Features, LQP and Learning corresponding to different functionalities. You can disable any of the Features or Learning section (by commenting it out) according to your requirement. general options images directory path path where cropped_images, learned model and computed features will be stored name of dataset to use; it can be either LFW or FERET [currently not supported] width of cropped images height of cropped images (same as cellsize) use a padding of one cell on each side. This value must be same as the option cell-size has in the features section offsets to be added (from the center position) to the crop window placed over the original aligned images complete This option is used only with LQP Features. It is used to choose subset of dataset for codebook learning e.g. in case of LFW it can be either view1 training validation ('train-val') subset or complete view1 set('complete') Feature types. Choice can be LBP, LTP, LBP+LTP or LQP if color images, use color information during feature computations. options for feature computation a list file containing list of cropped images to compute features cellsize for the histogram grid [5,7] tolerance values used for LTP or LQP features (can pass a list, i.e. tol=[5, 7])LQP Options LQP type represent LQP geometric structure. Choices can be either Disk (2) or Hor+Ver+Diag+ADiag (9) strip. LQP size represent radius (length of strip) of LQP disk (HVDA strip) (can pass a list i.e. lqpsize=[5,7]) LQP encoding type can be: Binary (0), Ternary (1) or Split-Ternary (4) Codebook size (number of visual words) used for LQP computation (can pass a list, i.e. cbsize=[100, 150] [Optional] A list file containing list of images for learning the codebook options for model learning view2 complete Choice of the dataset, options cans be view1: used for parameter tuning purposes; view2: used only for model evaluation; complete: a model parameters will be first tuned on view1 and results will be reported on view2 Choice of Training with or without PCA (for feature evaluation) Available options are with-pca or without- (a pca model is learned and features are compared in the pca space) or without-pca (features are compared in there original space) Directory path where computed features have been stored, used if learning is being done without feature computation cycle. Distance metric for comparing features. Choices are cosine, chi-square and L2. For optimal results use cosine metric for comparing PCA reduced features and chi-squared for comparing non-reduced ones. Number of PCA components. You can pass a scalar or list, i.e. pcadim= 500. In case of a list, all the dimensions will be used for model learning (on view1) and finally only the best performing one will be kept. Note that a single model with max(pcadim) is learned in this case but evaluation is done using all the dimensions. Caution: providing a much higher dimension makes the learning slow and memory intensive
3,347
0.845629
# -*- coding: utf-8 -*- # # python_exameple documentation build configuration file, created by # sphinx-quickstart on Fri Feb 26 00:29:33 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.autosummary', 'sphinx.ext.napoleon', ] autosummary_generate = True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'pyBAScloudAPI' copyright = u'2021, ProFM Facility & Project Management GmbH' author = u'ProFM Facility & Project Management GmbH' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = u'0.2.0' # The full version, including alpha/beta/rc tags. release = u'0.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' #html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value #html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. #html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'pyBAScloudAPIdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', # Latex figure (float) alignment #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'pyBAScloudAPI.tex', u'pyBAScloudAPI Documentation', u'ProFM Facility & Project Management GmbH', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'pyBAScloudAPI', u'pyBAScloudAPI Documentation', [author], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'pyBAScloudAPI', u'pyBAScloudAPI Documentation', author, 'pyBAScloudAPI', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'https://docs.python.org/': None}
32.511864
79
0.719737
[ "MIT" ]
bascloud/BASCloudAPI
pyBAScloudAPI/docs/conf.py
9,591
Python
-*- coding: utf-8 -*- python_exameple documentation build configuration file, created by sphinx-quickstart on Fri Feb 26 00:29:33 2016. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix(es) of source filenames. You can specify multiple suffix as a list of string: source_suffix = ['.rst', '.md'] The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. This is also used if you do content translation via gettext catalogs. Usually you set "language" from the command line for these cases. There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents.keep_warnings = False If true, `todo` and `todoList` produce output, else they produce nothing. -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation.html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Language to be used for generating the HTML full-text search index. Sphinx supports the following languages: 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'html_search_language = 'en' A dictionary with options for the search language support, empty by default. Now only 'ja' uses this config valuehtml_search_options = {'type': 'default'} The name of a javascript file (relative to the configuration directory) that implements a search results scorer. If empty, the default will be used.html_search_scorer = 'scorer.js' Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Latex figure (float) alignment'figure_align': 'htbp', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu.texinfo_no_detailmenu = False Example configuration for intersphinx: refer to the Python standard library.
8,018
0.835992
# Demo Python Datetime - The strftime() Method ''' The strftime() Method The datetime object has a method for formatting date objects into readable strings. The method is called strftime(), and takes one parameter, format, to specify the format of the returned string. Directive Description Example %a Weekday, short version Wed %A Weekday, full version Wednesday %w Weekday as a number 0-6, 0 is Sunday 3 %d Day of month 01-31 31 %b Month name, short version Dec %B Month name, full version December %m Month as a number 01-12 12 %y Year, short version, without century 18 %Y Year, full version 2018 %H Hour 00-23 17 %I Hour 00-12 05 %p AM/PM PM %M Minute 00-59 41 %S Second 00-59 08 %f Microsecond 000000-999999 548513 %z UTC offset +0100 %Z Timezone CST %j Day number of year 001-366 365 %U Week number of year, Sunday as the first day of week, 00-53 52 %W Week number of year, Monday as the first day of week, 00-53 52 %c Local version of date and time Mon Dec 31 17:41:00 2018 %x Local version of date 12/31/18 %X Local version of time 17:41:00 %% A % character % ''' import datetime x = datetime.datetime.now() print(x) print(x.strftime("%z"))
57.333333
111
0.354236
[ "MIT" ]
luis2ra/py3-00-w3schools
0-python-tutorial/25-dates05_strftime23_z.py
2,408
Python
The strftime() Method The datetime object has a method for formatting date objects into readable strings. The method is called strftime(), and takes one parameter, format, to specify the format of the returned string. Directive Description Example %a Weekday, short version Wed %A Weekday, full version Wednesday %w Weekday as a number 0-6, 0 is Sunday 3 %d Day of month 01-31 31 %b Month name, short version Dec %B Month name, full version December %m Month as a number 01-12 12 %y Year, short version, without century 18 %Y Year, full version 2018 %H Hour 00-23 17 %I Hour 00-12 05 %p AM/PM PM %M Minute 00-59 41 %S Second 00-59 08 %f Microsecond 000000-999999 548513 %z UTC offset +0100 %Z Timezone CST %j Day number of year 001-366 365 %U Week number of year, Sunday as the first day of week, 00-53 52 %W Week number of year, Monday as the first day of week, 00-53 52 %c Local version of date and time Mon Dec 31 17:41:00 2018 %x Local version of date 12/31/18 %X Local version of time 17:41:00 %% A % character % Demo Python Datetime - The strftime() Method
2,588
1.074751
#!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: Shijie Qin @license: Apache Licence @contact: qsj4work@gmail.com @site: https://shijieqin.github.io @software: PyCharm @file: __init__.py.py @time: 2018/11/8 3:13 PM """
17.928571
35
0.669323
[ "Apache-2.0" ]
shijieqin/flatfish
core/__init__.py
251
Python
@version: v1.0 @author: Shijie Qin @license: Apache Licence @contact: qsj4work@gmail.com @site: https://shijieqin.github.io @software: PyCharm @file: __init__.py.py @time: 2018/11/8 3:13 PM !/usr/bin/env python encoding: utf-8
237
0.944223
""" Listas Listas em Python funcionam como vetores/matrizes (arrays) em outras linguagens, com a diferença de serem DINÂMICO e também de podermos colocar QUALQUER tipo de dado. Linguagens C/Java: Arrays - Possuem tamanho e tipo de dado fixo; Ou seja, nestas linguagens se você criar um array do tipo int e com tamanho 5, este array sera SEMPRE do tipo inteiro e poderá ter SEMPRE no máximo 5 valores. Já em Python: - Dinâmico: Não possui tamanho fixo; Ou seja, podemos criar a lista e simplesmente ir adicionando elementos; - Qualquer tipo de dado; Não possuem tipo de dado fixo; Ou seja, podemos colocar qualquer tipo de dado; As listas são mutáveis! As listas em Python são representadas por colchetes: [] type([]) lista1 = [1, 99, 4, 27, 15, 22, 3, 1, 44, 42, 27] lista2 = ['G', 'e', 'e', 'k', ' ', 'U', 'n', 'i', 'v', 'e', 'r', 's', 'i', 't', 'y'] lista3 = [] lista4 = list(range(11)) lista5 = list('Geek University') # Podemos facilmente checar se determinado valor está contido na lista num = 18 if num in lista4: print(f'Encontrei o número {num}') else: print(f'Não encontrei o número {num}') # Podemos facilmente ordenar uma lista print(lista1) lista1.sort() print(lista1) # Podemos facilmente contar o número de ocorrências de um valor em uma lista print(lista1) print(lista1.count(1)) print(lista5) print(lista5.count('e')) # Adicionar elementos em listas # Para adicionar elementos em listas, utilizamos a função append print(lista1) lista1.append(42) print(lista1) # OBS: Com append, nós só conseguimos adicionar um (1) elementos por vez # lista1.append(12, 14, 56) # Erro lista1.append([8, 3, 1]) # Coloca a lista como elemento único (sublista) print(lista1) if [8, 3, 1] in lista1: print('Encontrei a lista') else: print('Nao encontrei a lista') lista1.extend([123, 44, 67]) # Coloca cada elemento da lista como valor adicional á lista print(lista1) # Podemos inserir um novo elemento na lista informando a posição do índice # Isso nao substitui o valor inicial. O mesmo será deslocado para a direita da lista. lista1.insert(2, 'Novo Valor') print(lista1) # Podemos facilmente juntar duas listas lista1 = lista1 + lista2 # lista1.extend(lista2) print(lista1) # Podemos facilmente inverter uma lista # Forma 1 lista1.reverse() lista2.reverse() print(lista1) print(lista2) # Forma 2 print(lista1[::-1]) print(lista2[::-1]) # Copiar uma lista lista6 = lista2.copy() print(lista6) # Podemos contar quantos elementos existem dentro da lista print(len(lista1)) # Podemos remover facilmente o último elemento de uma lista # O pop não somente remove o último elemento, mas também o retorna print(lista5) lista5.pop() print(lista5) # Podemos remover um elemento pelo índice # OBS: Os elementos á direita deste índice serão deslocados para a esquerda. # OBS: Se não houver elemento no índice informado, teremos o erro IndexError lista5.pop(2) print(lista5) # Podemos remover todos os elementos (Zerar a lista) print(lista5) lista5.clear() print(lista5) # Podemos facilmente repetir elementos em uma lista nova = [1, 2, 3] print(nova) nova = nova * 3 print(nova) # Podemos facilmente converter uma string para uma lista # Exemplo 1 curso = 'Programação em Python Essencial' print(curso) curso = curso.split() print(curso) # OBS: Por padrão, o split separa os elementos da lista pelo espaço entre elas. # Exemplo 2 curso = 'Programação,em,Python, Essencial' print(curso) curso = curso.split(',') print(curso) # Convertendo uma lista em uma string lista6 = ['Programação', 'em', 'Python', 'Essencial'] print(lista6) # Abaixo estamos falando: Pega a lista6, coloca o cifrão entre cada elemento e transforma em uma string curso = ' '.join(lista6) print(curso) curso = '$'.join(lista6) print(curso) # Podemos realmente colocar qualquer tipo de dado em uma lista, inclusive misturando esses dados lista6 = [1, 2.34, True, 'Geek', 'd', [1, 2, 3], 45345345345] print(lista6) print(type(lista6)) # Iterando sobre listas # Exemplo 1 - Utilizando for soma = 0 for elemento in lista1: print(elemento) soma = soma + elemento print(soma) # Exemplo 2 - Utlizando while carrinho = [] produto = '' while produto != 'sair': print("Adicione um produto na lista ou digite 'sair' para sair: ") produto = input() if produto != 'sair': carrinho.append(produto) for produto in carrinho: print(produto) # Utilizando variáveis em listas numeros = [1, 2, 3, 4, 5] print(numeros) num1 = 1 num2 = 2 num3 = 3 num4 = 4 num5 = 5 numeros = [num1, num2, num3, num4, num5] print(numeros) # Fazemos acessos aos elementos de forma indexada cores = ['verde', 'amarelo', 'azul', 'branco'] print(cores[0]) # verde print(cores[1]) # amarelo print(cores[2]) # azul print(cores[3]) # branco # Fazer acesso aos elementos de forma indexada inversa # Para entender melhor o índice negativo, pense na lista como um círculo, onde # o final de um elemento está ligado ao início da lista print(cores[-1]) # branco print(cores[-2]) # azul print(cores[-3]) # amarelo print(cores[-4]) # verde for cor in cores: print(cor) indice = 0 while indice < len(cores): print(cores[indice]) indice = indice + 1 cores = ['verde', 'amarelo', 'azul', 'branco'] # Gerar índice em um for for indice, cor in enumerate(cores): print(indice, cor) # Listas aceitam valores repetidos lista = [] lista.append(42) lista.append(42) lista.append(33) lista.append(33) lista.append(42) # Outros métodos não tão importantes mas também úteis # Encontrar o índice de um elemento na lista numeros = [5, 6, 7, 5, 8, 9, 10] # Em qual índice da lista está o valor 6? print(numeros.index(6)) # Em qual índice da lista está o valor 9?? print(numeros.index(9)) # print(numeros.index(19)) # Gera ValueError # OBS: Caso não tenha este elemento na lista, será apresentado erro ValueError # OBS: Retorna o índice do primeiro elemento encontrado print(numeros.index(5)) # Podemos fazer busca dentro de um range, ou seja, qual índice começar a buscar print(numeros.index(5, 1)) # Buscando a partir do índice 1 print(numeros.index(5, 2)) # Buscando a partir do índice 2 print(numeros.index(5, 3)) # Buscando a partir do índice 3 # print(numeros.index(5, 4)) # Buscando a partir do índice 4 # OBS: Caso não tenha este elemento na lista, será apresentado erro ValueError # Podemos fazer busca dentro de um range, início/fim print(numeros.index(8, 3, 6)) # Buscar o índice do valor 8, entre os índices 3 a 6 # Revisão do slicing # lista[inicio:fim:passo] # range(inicio:fim:passo) # Trabalhando com slice de listas com o parâmetro 'início' lista = [1, 2, 3, 4] print(lista[1:]) # Iniciando no índice 1 e pegando todos os elementos restantes # Trabalhando com slice de listas com o parâmetro 'fim' print(lista[:2]) # Começa em 0, pega até o índice 2 - 1 print(lista[:4]) # Começa em 0, pega até o índice 4 - 1 print(lista[1:3]) # Começa em 1, pega até o índice 3 - 1 # Trabalhando com slice de listas com o parâmetro 'passo' print(lista[1::2]) # Começa em 1, vai até o final, de 2 em 2 print(lista[::2]) # Começa em 0, vai até o final, de 2 em 2 # Invertendo valores em uma lista nomes = ['Geek', 'University'] nomes[0], nomes[1] = nomes[1], nomes[0] print(nomes) nomes = ['Geek', 'University'] nomes.reverse() print(nomes) # Soma*, Valor Máximo*, Valor Mínimo*, Tamanho # * Se os valores forem todos inteiros ou reais lista = [1, 2, 3, 4, 5, 6] print(sum(lista)) # Soma print(max(lista)) # Máximo Valor print(min(lista)) # Mínimo Valor print(len(lista)) # Tamanho da Lista # Transformar uma lista em tupla lista = [1, 2, 3, 4, 5, 6] print(lista) print(type(lista)) tupla = tuple(lista) print(tupla) print(type(tupla)) # Desempacotamento de listas listas = [1, 2, 3] num1, num2, num3 = lista print(num1) print(num2) print(num3) # OBS: Se tivermos um número diferente de elementos na lista ou variáveis para receber os dados, teremos ValueError # Copiando uma lista para outra (Shallow Copy e Deep Copy) # Forma 1 - Deep Copy lista = [1, 2, 3] e print(lista) nova = lista.copy() # Cópia print(nova) nova.append(4) print(lista) print(nova) # Veja que ao utilizarmos lista.copy() copiamos os dados da lista para uma nova lista, mas elas # ficaram totalmente independentes, ou seja, modificando uma lista, não afeta a outra. Isso em Python # é chamado de Deep Copy (Cópia Profunda) # Forma 2 - Shallow Copy lista = [1, 2, 3] print(lista) nova = lista # Cópia print(nova) nova.append(4) print(lista) print(nova) # Veja que utilizamos a cópia via atribuição e copiamos os dados da lista para a nova lista, mas # após realizar modificação em uma das listas, essa modificação se refletiu em ambas as listas. # Isso em Python é chamado de Shallow Copy. """
25.703812
116
0.712949
[ "MIT" ]
vdonoladev/aprendendo-programacao
Python/Programação_em_Python_Essencial/5- Coleções/listas.py
8,882
Python
Listas Listas em Python funcionam como vetores/matrizes (arrays) em outras linguagens, com a diferença de serem DINÂMICO e também de podermos colocar QUALQUER tipo de dado. Linguagens C/Java: Arrays - Possuem tamanho e tipo de dado fixo; Ou seja, nestas linguagens se você criar um array do tipo int e com tamanho 5, este array sera SEMPRE do tipo inteiro e poderá ter SEMPRE no máximo 5 valores. Já em Python: - Dinâmico: Não possui tamanho fixo; Ou seja, podemos criar a lista e simplesmente ir adicionando elementos; - Qualquer tipo de dado; Não possuem tipo de dado fixo; Ou seja, podemos colocar qualquer tipo de dado; As listas são mutáveis! As listas em Python são representadas por colchetes: [] type([]) lista1 = [1, 99, 4, 27, 15, 22, 3, 1, 44, 42, 27] lista2 = ['G', 'e', 'e', 'k', ' ', 'U', 'n', 'i', 'v', 'e', 'r', 's', 'i', 't', 'y'] lista3 = [] lista4 = list(range(11)) lista5 = list('Geek University') # Podemos facilmente checar se determinado valor está contido na lista num = 18 if num in lista4: print(f'Encontrei o número {num}') else: print(f'Não encontrei o número {num}') # Podemos facilmente ordenar uma lista print(lista1) lista1.sort() print(lista1) # Podemos facilmente contar o número de ocorrências de um valor em uma lista print(lista1) print(lista1.count(1)) print(lista5) print(lista5.count('e')) # Adicionar elementos em listas # Para adicionar elementos em listas, utilizamos a função append print(lista1) lista1.append(42) print(lista1) # OBS: Com append, nós só conseguimos adicionar um (1) elementos por vez # lista1.append(12, 14, 56) # Erro lista1.append([8, 3, 1]) # Coloca a lista como elemento único (sublista) print(lista1) if [8, 3, 1] in lista1: print('Encontrei a lista') else: print('Nao encontrei a lista') lista1.extend([123, 44, 67]) # Coloca cada elemento da lista como valor adicional á lista print(lista1) # Podemos inserir um novo elemento na lista informando a posição do índice # Isso nao substitui o valor inicial. O mesmo será deslocado para a direita da lista. lista1.insert(2, 'Novo Valor') print(lista1) # Podemos facilmente juntar duas listas lista1 = lista1 + lista2 # lista1.extend(lista2) print(lista1) # Podemos facilmente inverter uma lista # Forma 1 lista1.reverse() lista2.reverse() print(lista1) print(lista2) # Forma 2 print(lista1[::-1]) print(lista2[::-1]) # Copiar uma lista lista6 = lista2.copy() print(lista6) # Podemos contar quantos elementos existem dentro da lista print(len(lista1)) # Podemos remover facilmente o último elemento de uma lista # O pop não somente remove o último elemento, mas também o retorna print(lista5) lista5.pop() print(lista5) # Podemos remover um elemento pelo índice # OBS: Os elementos á direita deste índice serão deslocados para a esquerda. # OBS: Se não houver elemento no índice informado, teremos o erro IndexError lista5.pop(2) print(lista5) # Podemos remover todos os elementos (Zerar a lista) print(lista5) lista5.clear() print(lista5) # Podemos facilmente repetir elementos em uma lista nova = [1, 2, 3] print(nova) nova = nova * 3 print(nova) # Podemos facilmente converter uma string para uma lista # Exemplo 1 curso = 'Programação em Python Essencial' print(curso) curso = curso.split() print(curso) # OBS: Por padrão, o split separa os elementos da lista pelo espaço entre elas. # Exemplo 2 curso = 'Programação,em,Python, Essencial' print(curso) curso = curso.split(',') print(curso) # Convertendo uma lista em uma string lista6 = ['Programação', 'em', 'Python', 'Essencial'] print(lista6) # Abaixo estamos falando: Pega a lista6, coloca o cifrão entre cada elemento e transforma em uma string curso = ' '.join(lista6) print(curso) curso = '$'.join(lista6) print(curso) # Podemos realmente colocar qualquer tipo de dado em uma lista, inclusive misturando esses dados lista6 = [1, 2.34, True, 'Geek', 'd', [1, 2, 3], 45345345345] print(lista6) print(type(lista6)) # Iterando sobre listas # Exemplo 1 - Utilizando for soma = 0 for elemento in lista1: print(elemento) soma = soma + elemento print(soma) # Exemplo 2 - Utlizando while carrinho = [] produto = '' while produto != 'sair': print("Adicione um produto na lista ou digite 'sair' para sair: ") produto = input() if produto != 'sair': carrinho.append(produto) for produto in carrinho: print(produto) # Utilizando variáveis em listas numeros = [1, 2, 3, 4, 5] print(numeros) num1 = 1 num2 = 2 num3 = 3 num4 = 4 num5 = 5 numeros = [num1, num2, num3, num4, num5] print(numeros) # Fazemos acessos aos elementos de forma indexada cores = ['verde', 'amarelo', 'azul', 'branco'] print(cores[0]) # verde print(cores[1]) # amarelo print(cores[2]) # azul print(cores[3]) # branco # Fazer acesso aos elementos de forma indexada inversa # Para entender melhor o índice negativo, pense na lista como um círculo, onde # o final de um elemento está ligado ao início da lista print(cores[-1]) # branco print(cores[-2]) # azul print(cores[-3]) # amarelo print(cores[-4]) # verde for cor in cores: print(cor) indice = 0 while indice < len(cores): print(cores[indice]) indice = indice + 1 cores = ['verde', 'amarelo', 'azul', 'branco'] # Gerar índice em um for for indice, cor in enumerate(cores): print(indice, cor) # Listas aceitam valores repetidos lista = [] lista.append(42) lista.append(42) lista.append(33) lista.append(33) lista.append(42) # Outros métodos não tão importantes mas também úteis # Encontrar o índice de um elemento na lista numeros = [5, 6, 7, 5, 8, 9, 10] # Em qual índice da lista está o valor 6? print(numeros.index(6)) # Em qual índice da lista está o valor 9?? print(numeros.index(9)) # print(numeros.index(19)) # Gera ValueError # OBS: Caso não tenha este elemento na lista, será apresentado erro ValueError # OBS: Retorna o índice do primeiro elemento encontrado print(numeros.index(5)) # Podemos fazer busca dentro de um range, ou seja, qual índice começar a buscar print(numeros.index(5, 1)) # Buscando a partir do índice 1 print(numeros.index(5, 2)) # Buscando a partir do índice 2 print(numeros.index(5, 3)) # Buscando a partir do índice 3 # print(numeros.index(5, 4)) # Buscando a partir do índice 4 # OBS: Caso não tenha este elemento na lista, será apresentado erro ValueError # Podemos fazer busca dentro de um range, início/fim print(numeros.index(8, 3, 6)) # Buscar o índice do valor 8, entre os índices 3 a 6 # Revisão do slicing # lista[inicio:fim:passo] # range(inicio:fim:passo) # Trabalhando com slice de listas com o parâmetro 'início' lista = [1, 2, 3, 4] print(lista[1:]) # Iniciando no índice 1 e pegando todos os elementos restantes # Trabalhando com slice de listas com o parâmetro 'fim' print(lista[:2]) # Começa em 0, pega até o índice 2 - 1 print(lista[:4]) # Começa em 0, pega até o índice 4 - 1 print(lista[1:3]) # Começa em 1, pega até o índice 3 - 1 # Trabalhando com slice de listas com o parâmetro 'passo' print(lista[1::2]) # Começa em 1, vai até o final, de 2 em 2 print(lista[::2]) # Começa em 0, vai até o final, de 2 em 2 # Invertendo valores em uma lista nomes = ['Geek', 'University'] nomes[0], nomes[1] = nomes[1], nomes[0] print(nomes) nomes = ['Geek', 'University'] nomes.reverse() print(nomes) # Soma*, Valor Máximo*, Valor Mínimo*, Tamanho # * Se os valores forem todos inteiros ou reais lista = [1, 2, 3, 4, 5, 6] print(sum(lista)) # Soma print(max(lista)) # Máximo Valor print(min(lista)) # Mínimo Valor print(len(lista)) # Tamanho da Lista # Transformar uma lista em tupla lista = [1, 2, 3, 4, 5, 6] print(lista) print(type(lista)) tupla = tuple(lista) print(tupla) print(type(tupla)) # Desempacotamento de listas listas = [1, 2, 3] num1, num2, num3 = lista print(num1) print(num2) print(num3) # OBS: Se tivermos um número diferente de elementos na lista ou variáveis para receber os dados, teremos ValueError # Copiando uma lista para outra (Shallow Copy e Deep Copy) # Forma 1 - Deep Copy lista = [1, 2, 3] e print(lista) nova = lista.copy() # Cópia print(nova) nova.append(4) print(lista) print(nova) # Veja que ao utilizarmos lista.copy() copiamos os dados da lista para uma nova lista, mas elas # ficaram totalmente independentes, ou seja, modificando uma lista, não afeta a outra. Isso em Python # é chamado de Deep Copy (Cópia Profunda) # Forma 2 - Shallow Copy lista = [1, 2, 3] print(lista) nova = lista # Cópia print(nova) nova.append(4) print(lista) print(nova) # Veja que utilizamos a cópia via atribuição e copiamos os dados da lista para a nova lista, mas # após realizar modificação em uma das listas, essa modificação se refletiu em ambas as listas. # Isso em Python é chamado de Shallow Copy.
8,938
1.019738
import re from pygbif.gbifutils import gbif_baseurl, bool2str, requests_argset, gbif_GET def search( taxonKey=None, repatriated=None, kingdomKey=None, phylumKey=None, classKey=None, orderKey=None, familyKey=None, genusKey=None, subgenusKey=None, scientificName=None, country=None, publishingCountry=None, hasCoordinate=None, typeStatus=None, recordNumber=None, lastInterpreted=None, continent=None, geometry=None, recordedBy=None, recordedByID=None, identifiedByID=None, basisOfRecord=None, datasetKey=None, eventDate=None, catalogNumber=None, year=None, month=None, decimalLatitude=None, decimalLongitude=None, elevation=None, depth=None, institutionCode=None, collectionCode=None, hasGeospatialIssue=None, issue=None, q=None, spellCheck=None, mediatype=None, limit=300, offset=0, establishmentMeans=None, facet=None, facetMincount=None, facetMultiselect=None, timeout=60, **kwargs ): """ Search GBIF occurrences :param taxonKey: [int] A GBIF occurrence identifier :param q: [str] Simple search parameter. The value for this parameter can be a simple word or a phrase. :param spellCheck: [bool] If ``True`` ask GBIF to check your spelling of the value passed to the ``search`` parameter. IMPORTANT: This only checks the input to the ``search`` parameter, and no others. Default: ``False`` :param repatriated: [str] Searches for records whose publishing country is different to the country where the record was recorded in :param kingdomKey: [int] Kingdom classification key :param phylumKey: [int] Phylum classification key :param classKey: [int] Class classification key :param orderKey: [int] Order classification key :param familyKey: [int] Family classification key :param genusKey: [int] Genus classification key :param subgenusKey: [int] Subgenus classification key :param scientificName: [str] A scientific name from the GBIF backbone. All included and synonym taxa are included in the search. :param datasetKey: [str] The occurrence dataset key (a uuid) :param catalogNumber: [str] An identifier of any form assigned by the source within a physical collection or digital dataset for the record which may not unique, but should be fairly unique in combination with the institution and collection code. :param recordedBy: [str] The person who recorded the occurrence. :param recordedByID: [str] Identifier (e.g. ORCID) for the person who recorded the occurrence :param identifiedByID: [str] Identifier (e.g. ORCID) for the person who provided the taxonomic identification of the occurrence. :param collectionCode: [str] An identifier of any form assigned by the source to identify the physical collection or digital dataset uniquely within the text of an institution. :param institutionCode: [str] An identifier of any form assigned by the source to identify the institution the record belongs to. Not guaranteed to be que. :param country: [str] The 2-letter country code (as per ISO-3166-1) of the country in which the occurrence was recorded. See here http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 :param basisOfRecord: [str] Basis of record, as defined in our BasisOfRecord enum here http://gbif.github.io/gbif-api/apidocs/org/gbif/api/vocabulary/BasisOfRecord.html Acceptable values are: - ``FOSSIL_SPECIMEN`` An occurrence record describing a fossilized specimen. - ``HUMAN_OBSERVATION`` An occurrence record describing an observation made by one or more people. - ``LIVING_SPECIMEN`` An occurrence record describing a living specimen. - ``MACHINE_OBSERVATION`` An occurrence record describing an observation made by a machine. - ``MATERIAL_CITATION`` An occurrence record based on a reference to a scholarly publication. - ``OBSERVATION`` An occurrence record describing an observation. - ``OCCURRENCE`` An existence of an organism at a particular place and time. No more specific basis. - ``PRESERVED_SPECIMEN`` An occurrence record describing a preserved specimen. :param eventDate: [date] Occurrence date in ISO 8601 format: yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Supports range queries, smaller,larger (e.g., ``1990,1991``, whereas ``1991,1990`` wouldn't work) :param year: [int] The 4 digit year. A year of 98 will be interpreted as AD 98. Supports range queries, smaller,larger (e.g., ``1990,1991``, whereas ``1991,1990`` wouldn't work) :param month: [int] The month of the year, starting with 1 for January. Supports range queries, smaller,larger (e.g., ``1,2``, whereas ``2,1`` wouldn't work) :param decimalLatitude: [float] Latitude in decimals between -90 and 90 based on WGS 84. Supports range queries, smaller,larger (e.g., ``25,30``, whereas ``30,25`` wouldn't work) :param decimalLongitude: [float] Longitude in decimals between -180 and 180 based on WGS 84. Supports range queries (e.g., ``-0.4,-0.2``, whereas ``-0.2,-0.4`` wouldn't work). :param publishingCountry: [str] The 2-letter country code (as per ISO-3166-1) of the country in which the occurrence was recorded. :param elevation: [int/str] Elevation in meters above sea level. Supports range queries, smaller,larger (e.g., ``5,30``, whereas ``30,5`` wouldn't work) :param depth: [int/str] Depth in meters relative to elevation. For example 10 meters below a lake surface with given elevation. Supports range queries, smaller,larger (e.g., ``5,30``, whereas ``30,5`` wouldn't work) :param geometry: [str] Searches for occurrences inside a polygon described in Well Known Text (WKT) format. A WKT shape written as either POINT, LINESTRING, LINEARRING POLYGON, or MULTIPOLYGON. Example of a polygon: ``((30.1 10.1, 20, 20 40, 40 40, 30.1 10.1))`` would be queried as http://bit.ly/1BzNwDq. Polygons must have counter-clockwise ordering of points. :param hasGeospatialIssue: [bool] Includes/excludes occurrence records which contain spatial issues (as determined in our record interpretation), i.e. ``hasGeospatialIssue=TRUE`` returns only those records with spatial issues while ``hasGeospatialIssue=FALSE`` includes only records without spatial issues. The absence of this parameter returns any record with or without spatial issues. :param issue: [str] One or more of many possible issues with each occurrence record. See Details. Issues passed to this parameter filter results by the issue. :param hasCoordinate: [bool] Return only occurence records with lat/long data (``True``) or all records (``False``, default). :param typeStatus: [str] Type status of the specimen. One of many options. See ?typestatus :param recordNumber: [int] Number recorded by collector of the data, different from GBIF record number. See http://rs.tdwg.org/dwc/terms/#recordNumber} for more info :param lastInterpreted: [date] Date the record was last modified in GBIF, in ISO 8601 format: yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Supports range queries, smaller,larger (e.g., ``1990,1991``, whereas ``1991,1990`` wouldn't work) :param continent: [str] Continent. One of ``africa``, ``antarctica``, ``asia``, ``europe``, ``north_america`` (North America includes the Caribbean and reachies down and includes Panama), ``oceania``, or ``south_america`` :param fields: [str] Default (``all``) returns all fields. ``minimal`` returns just taxon name, key, latitude, and longitude. Or specify each field you want returned by name, e.g. ``fields = c('name','latitude','elevation')``. :param mediatype: [str] Media type. Default is ``NULL``, so no filtering on mediatype. Options: ``NULL``, ``MovingImage``, ``Sound``, and ``StillImage`` :param limit: [int] Number of results to return. Default: ``300`` :param offset: [int] Record to start at. Default: ``0`` :param facet: [str] a character vector of length 1 or greater :param establishmentMeans: [str] EstablishmentMeans, possible values include: INTRODUCED, INVASIVE, MANAGED, NATIVE, NATURALISED, UNCERTAIN :param facetMincount: [int] minimum number of records to be included in the faceting results :param facetMultiselect: [bool] Set to ``True`` to still return counts for values that are not currently filtered. See examples. Default: ``False`` :return: A dictionary Usage:: from pygbif import occurrences occurrences.search(taxonKey = 3329049) # Return 2 results, this is the default by the way occurrences.search(taxonKey=3329049, limit=2) # Instead of getting a taxon key first, you can search for a name directly # However, note that using this approach (with `scientificName="..."`) # you are getting synonyms too. The results for using `scientifcName` and # `taxonKey` parameters are the same in this case, but I wouldn't be surprised if for some # names they return different results occurrences.search(scientificName = 'Ursus americanus') from pygbif import species key = species.name_backbone(name = 'Ursus americanus', rank='species')['usageKey'] occurrences.search(taxonKey = key) # Search by dataset key occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a', limit=20) # Search by catalog number occurrences.search(catalogNumber="49366", limit=20) # occurrences.search(catalogNumber=["49366","Bird.27847588"], limit=20) # Use paging parameters (limit and offset) to page. Note the different results # for the two queries below. occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a', offset=10, limit=5) occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a', offset=20, limit=5) # Many dataset keys # occurrences.search(datasetKey=["50c9509d-22c7-4a22-a47d-8c48425ef4a7", "7b5d6a48-f762-11e1-a439-00145eb45e9a"], limit=20) # Search by collector name res = occurrences.search(recordedBy="smith", limit=20) [ x['recordedBy'] for x in res['results'] ] # Many collector names # occurrences.search(recordedBy=["smith","BJ Stacey"], limit=20) # recordedByID occurrences.search(recordedByID="https://orcid.org/0000-0003-1691-239X", limit = 3) # identifiedByID occurrences.search(identifiedByID="https://orcid.org/0000-0003-1691-239X", limit = 3) # Search for many species splist = ['Cyanocitta stelleri', 'Junco hyemalis', 'Aix sponsa'] keys = [ species.name_suggest(x)[0]['key'] for x in splist ] out = [ occurrences.search(taxonKey = x, limit=1) for x in keys ] [ x['results'][0]['speciesKey'] for x in out ] # Search - q parameter occurrences.search(q = "kingfisher", limit=20) ## spell check - only works with the `search` parameter ### spelled correctly - same result as above call occurrences.search(q = "kingfisher", limit=20, spellCheck = True) ### spelled incorrectly - stops with suggested spelling occurrences.search(q = "kajsdkla", limit=20, spellCheck = True) ### spelled incorrectly - stops with many suggested spellings ### and number of results for each occurrences.search(q = "helir", limit=20, spellCheck = True) # Search on latitidue and longitude occurrences.search(decimalLatitude=50, decimalLongitude=10, limit=2) # Search on a bounding box ## in well known text format occurrences.search(geometry='POLYGON((30.1 10.1, 10 20, 20 40, 40 40, 30.1 10.1))', limit=20) from pygbif import species key = species.name_suggest(q='Aesculus hippocastanum')[0]['key'] occurrences.search(taxonKey=key, geometry='POLYGON((30.1 10.1, 10 20, 20 40, 40 40, 30.1 10.1))', limit=20) ## multipolygon wkt = 'MULTIPOLYGON(((-123 38, -123 43, -116 43, -116 38, -123 38)),((-97 41, -97 45, -93 45, -93 41, -97 41)))' occurrences.search(geometry = wkt, limit = 20) # Search on country occurrences.search(country='US', limit=20) occurrences.search(country='FR', limit=20) occurrences.search(country='DE', limit=20) # Get only occurrences with lat/long data occurrences.search(taxonKey=key, hasCoordinate=True, limit=20) # Get only occurrences that were recorded as living specimens occurrences.search(taxonKey=key, basisOfRecord="LIVING_SPECIMEN", hasCoordinate=True, limit=20) # Get occurrences for a particular eventDate occurrences.search(taxonKey=key, eventDate="2013", limit=20) occurrences.search(taxonKey=key, year="2013", limit=20) occurrences.search(taxonKey=key, month="6", limit=20) # Get occurrences based on depth key = species.name_backbone(name='Salmo salar', kingdom='animals')['usageKey'] occurrences.search(taxonKey=key, depth="5", limit=20) # Get occurrences based on elevation key = species.name_backbone(name='Puma concolor', kingdom='animals')['usageKey'] occurrences.search(taxonKey=key, elevation=50, hasCoordinate=True, limit=20) # Get occurrences based on institutionCode occurrences.search(institutionCode="TLMF", limit=20) # Get occurrences based on collectionCode occurrences.search(collectionCode="Floristic Databases MV - Higher Plants", limit=20) # Get only those occurrences with spatial issues occurrences.search(taxonKey=key, hasGeospatialIssue=True, limit=20) # Search using a query string occurrences.search(q="kingfisher", limit=20) # Range queries ## See Detail for parameters that support range queries ### this is a range depth, with lower/upper limits in character string occurrences.search(depth='50,100') ## Range search with year occurrences.search(year='1999,2000', limit=20) ## Range search with latitude occurrences.search(decimalLatitude='29.59,29.6') # Search by specimen type status ## Look for possible values of the typeStatus parameter looking at the typestatus dataset occurrences.search(typeStatus = 'allotype') # Search by specimen record number ## This is the record number of the person/group that submitted the data, not GBIF's numbers ## You can see that many different groups have record number 1, so not super helpful occurrences.search(recordNumber = 1) # Search by last time interpreted: Date the record was last modified in GBIF ## The lastInterpreted parameter accepts ISO 8601 format dates, including ## yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Range queries are accepted for lastInterpreted occurrences.search(lastInterpreted = '2014-04-01') # Search by continent ## One of africa, antarctica, asia, europe, north_america, oceania, or south_america occurrences.search(continent = 'south_america') occurrences.search(continent = 'africa') occurrences.search(continent = 'oceania') occurrences.search(continent = 'antarctica') # Search for occurrences with images occurrences.search(mediatype = 'StillImage') occurrences.search(mediatype = 'MovingImage') x = occurrences.search(mediatype = 'Sound') [z['media'] for z in x['results']] # Query based on issues occurrences.search(taxonKey=1, issue='DEPTH_UNLIKELY') occurrences.search(taxonKey=1, issue=['DEPTH_UNLIKELY','COORDINATE_ROUNDED']) # Show all records in the Arizona State Lichen Collection that cant be matched to the GBIF # backbone properly: occurrences.search(datasetKey='84c0e1a0-f762-11e1-a439-00145eb45e9a', issue=['TAXON_MATCH_NONE','TAXON_MATCH_HIGHERRANK']) # If you pass in an invalid polygon you get hopefully informative errors ### the WKT string is fine, but GBIF says bad polygon wkt = 'POLYGON((-178.59375 64.83258989321493,-165.9375 59.24622380205539, -147.3046875 59.065977905449806,-130.78125 51.04484764446178,-125.859375 36.70806354647625, -112.1484375 23.367471303759686,-105.1171875 16.093320185359257,-86.8359375 9.23767076398516, -82.96875 2.9485268155066175,-82.6171875 -14.812060061226388,-74.8828125 -18.849111862023985, -77.34375 -47.661687803329166,-84.375 -49.975955187343295,174.7265625 -50.649460483096114, 179.296875 -42.19189902447192,-176.8359375 -35.634976650677295,176.8359375 -31.835565983656227, 163.4765625 -6.528187613695323,152.578125 1.894796132058301,135.703125 4.702353722559447, 127.96875 15.077427674847987,127.96875 23.689804541429606,139.921875 32.06861069132688, 149.4140625 42.65416193033991,159.2578125 48.3160811030533,168.3984375 57.019804336633165, 178.2421875 59.95776046458139,-179.6484375 61.16708631440347,-178.59375 64.83258989321493))' occurrences.search(geometry = wkt) # Faceting ## return no occurrence records with limit=0 x = occurrences.search(facet = "country", limit = 0) x['facets'] ## also return occurrence records x = occurrences.search(facet = "establishmentMeans", limit = 10) x['facets'] x['results'] ## multiple facet variables x = occurrences.search(facet = ["country", "basisOfRecord"], limit = 10) x['results'] x['facets'] x['facets']['country'] x['facets']['basisOfRecord'] x['facets']['basisOfRecord']['count'] ## set a minimum facet count x = occurrences.search(facet = "country", facetMincount = 30000000L, limit = 0) x['facets'] ## paging per each faceted variable ### do so by passing in variables like "country" + "_facetLimit" = "country_facetLimit" ### or "country" + "_facetOffset" = "country_facetOffset" x = occurrences.search( facet = ["country", "basisOfRecord", "hasCoordinate"], country_facetLimit = 3, basisOfRecord_facetLimit = 6, limit = 0 ) x['facets'] # requests package options ## There's an acceptable set of requests options (['timeout', 'cookies', 'auth', ## 'allow_redirects', 'proxies', 'verify', 'stream', 'cert']) you can pass ## in via **kwargs, e.g., set a timeout. Default timeout set to 60 seconds. x = occurrences.search(timeout = 1) """ url = gbif_baseurl + "occurrence/search" args = { "taxonKey": taxonKey, "repatriated": repatriated, "kingdomKey": kingdomKey, "phylumKey": phylumKey, "classKey": classKey, "orderKey": orderKey, "familyKey": familyKey, "genusKey": genusKey, "subgenusKey": subgenusKey, "scientificName": scientificName, "country": country, "publishingCountry": publishingCountry, "hasCoordinate": bool2str(hasCoordinate), "typeStatus": typeStatus, "recordNumber": recordNumber, "lastInterpreted": lastInterpreted, "continent": continent, "geometry": geometry, "recordedBy": recordedBy, "recordedByID": recordedByID, "identifiedByID": identifiedByID, "basisOfRecord": basisOfRecord, "datasetKey": datasetKey, "eventDate": eventDate, "catalogNumber": catalogNumber, "year": year, "month": month, "decimalLatitude": decimalLatitude, "decimalLongitude": decimalLongitude, "elevation": elevation, "depth": depth, "institutionCode": institutionCode, "collectionCode": collectionCode, "hasGeospatialIssue": bool2str(hasGeospatialIssue), "issue": issue, "q": q, "spellCheck": bool2str(spellCheck), "mediatype": mediatype, "limit": limit, "offset": offset, "establishmentMeans": establishmentMeans, "facetMincount": facetMincount, "facet": facet, "facetMultiselect": bool2str(facetMultiselect), } gbif_kwargs = {key: kwargs[key] for key in kwargs if key not in requests_argset} if gbif_kwargs is not None: xx = dict( zip([re.sub("_", ".", x) for x in gbif_kwargs.keys()], gbif_kwargs.values()) ) args.update(xx) kwargs = {key: kwargs[key] for key in kwargs if key in requests_argset} out = gbif_GET(url, args, **kwargs) return out
50.844282
250
0.676748
[ "MIT" ]
livatras/pygbif
pygbif/occurrences/search.py
20,897
Python
Search GBIF occurrences :param taxonKey: [int] A GBIF occurrence identifier :param q: [str] Simple search parameter. The value for this parameter can be a simple word or a phrase. :param spellCheck: [bool] If ``True`` ask GBIF to check your spelling of the value passed to the ``search`` parameter. IMPORTANT: This only checks the input to the ``search`` parameter, and no others. Default: ``False`` :param repatriated: [str] Searches for records whose publishing country is different to the country where the record was recorded in :param kingdomKey: [int] Kingdom classification key :param phylumKey: [int] Phylum classification key :param classKey: [int] Class classification key :param orderKey: [int] Order classification key :param familyKey: [int] Family classification key :param genusKey: [int] Genus classification key :param subgenusKey: [int] Subgenus classification key :param scientificName: [str] A scientific name from the GBIF backbone. All included and synonym taxa are included in the search. :param datasetKey: [str] The occurrence dataset key (a uuid) :param catalogNumber: [str] An identifier of any form assigned by the source within a physical collection or digital dataset for the record which may not unique, but should be fairly unique in combination with the institution and collection code. :param recordedBy: [str] The person who recorded the occurrence. :param recordedByID: [str] Identifier (e.g. ORCID) for the person who recorded the occurrence :param identifiedByID: [str] Identifier (e.g. ORCID) for the person who provided the taxonomic identification of the occurrence. :param collectionCode: [str] An identifier of any form assigned by the source to identify the physical collection or digital dataset uniquely within the text of an institution. :param institutionCode: [str] An identifier of any form assigned by the source to identify the institution the record belongs to. Not guaranteed to be que. :param country: [str] The 2-letter country code (as per ISO-3166-1) of the country in which the occurrence was recorded. See here http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 :param basisOfRecord: [str] Basis of record, as defined in our BasisOfRecord enum here http://gbif.github.io/gbif-api/apidocs/org/gbif/api/vocabulary/BasisOfRecord.html Acceptable values are: - ``FOSSIL_SPECIMEN`` An occurrence record describing a fossilized specimen. - ``HUMAN_OBSERVATION`` An occurrence record describing an observation made by one or more people. - ``LIVING_SPECIMEN`` An occurrence record describing a living specimen. - ``MACHINE_OBSERVATION`` An occurrence record describing an observation made by a machine. - ``MATERIAL_CITATION`` An occurrence record based on a reference to a scholarly publication. - ``OBSERVATION`` An occurrence record describing an observation. - ``OCCURRENCE`` An existence of an organism at a particular place and time. No more specific basis. - ``PRESERVED_SPECIMEN`` An occurrence record describing a preserved specimen. :param eventDate: [date] Occurrence date in ISO 8601 format: yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Supports range queries, smaller,larger (e.g., ``1990,1991``, whereas ``1991,1990`` wouldn't work) :param year: [int] The 4 digit year. A year of 98 will be interpreted as AD 98. Supports range queries, smaller,larger (e.g., ``1990,1991``, whereas ``1991,1990`` wouldn't work) :param month: [int] The month of the year, starting with 1 for January. Supports range queries, smaller,larger (e.g., ``1,2``, whereas ``2,1`` wouldn't work) :param decimalLatitude: [float] Latitude in decimals between -90 and 90 based on WGS 84. Supports range queries, smaller,larger (e.g., ``25,30``, whereas ``30,25`` wouldn't work) :param decimalLongitude: [float] Longitude in decimals between -180 and 180 based on WGS 84. Supports range queries (e.g., ``-0.4,-0.2``, whereas ``-0.2,-0.4`` wouldn't work). :param publishingCountry: [str] The 2-letter country code (as per ISO-3166-1) of the country in which the occurrence was recorded. :param elevation: [int/str] Elevation in meters above sea level. Supports range queries, smaller,larger (e.g., ``5,30``, whereas ``30,5`` wouldn't work) :param depth: [int/str] Depth in meters relative to elevation. For example 10 meters below a lake surface with given elevation. Supports range queries, smaller,larger (e.g., ``5,30``, whereas ``30,5`` wouldn't work) :param geometry: [str] Searches for occurrences inside a polygon described in Well Known Text (WKT) format. A WKT shape written as either POINT, LINESTRING, LINEARRING POLYGON, or MULTIPOLYGON. Example of a polygon: ``((30.1 10.1, 20, 20 40, 40 40, 30.1 10.1))`` would be queried as http://bit.ly/1BzNwDq. Polygons must have counter-clockwise ordering of points. :param hasGeospatialIssue: [bool] Includes/excludes occurrence records which contain spatial issues (as determined in our record interpretation), i.e. ``hasGeospatialIssue=TRUE`` returns only those records with spatial issues while ``hasGeospatialIssue=FALSE`` includes only records without spatial issues. The absence of this parameter returns any record with or without spatial issues. :param issue: [str] One or more of many possible issues with each occurrence record. See Details. Issues passed to this parameter filter results by the issue. :param hasCoordinate: [bool] Return only occurence records with lat/long data (``True``) or all records (``False``, default). :param typeStatus: [str] Type status of the specimen. One of many options. See ?typestatus :param recordNumber: [int] Number recorded by collector of the data, different from GBIF record number. See http://rs.tdwg.org/dwc/terms/#recordNumber} for more info :param lastInterpreted: [date] Date the record was last modified in GBIF, in ISO 8601 format: yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Supports range queries, smaller,larger (e.g., ``1990,1991``, whereas ``1991,1990`` wouldn't work) :param continent: [str] Continent. One of ``africa``, ``antarctica``, ``asia``, ``europe``, ``north_america`` (North America includes the Caribbean and reachies down and includes Panama), ``oceania``, or ``south_america`` :param fields: [str] Default (``all``) returns all fields. ``minimal`` returns just taxon name, key, latitude, and longitude. Or specify each field you want returned by name, e.g. ``fields = c('name','latitude','elevation')``. :param mediatype: [str] Media type. Default is ``NULL``, so no filtering on mediatype. Options: ``NULL``, ``MovingImage``, ``Sound``, and ``StillImage`` :param limit: [int] Number of results to return. Default: ``300`` :param offset: [int] Record to start at. Default: ``0`` :param facet: [str] a character vector of length 1 or greater :param establishmentMeans: [str] EstablishmentMeans, possible values include: INTRODUCED, INVASIVE, MANAGED, NATIVE, NATURALISED, UNCERTAIN :param facetMincount: [int] minimum number of records to be included in the faceting results :param facetMultiselect: [bool] Set to ``True`` to still return counts for values that are not currently filtered. See examples. Default: ``False`` :return: A dictionary Usage:: from pygbif import occurrences occurrences.search(taxonKey = 3329049) # Return 2 results, this is the default by the way occurrences.search(taxonKey=3329049, limit=2) # Instead of getting a taxon key first, you can search for a name directly # However, note that using this approach (with `scientificName="..."`) # you are getting synonyms too. The results for using `scientifcName` and # `taxonKey` parameters are the same in this case, but I wouldn't be surprised if for some # names they return different results occurrences.search(scientificName = 'Ursus americanus') from pygbif import species key = species.name_backbone(name = 'Ursus americanus', rank='species')['usageKey'] occurrences.search(taxonKey = key) # Search by dataset key occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a', limit=20) # Search by catalog number occurrences.search(catalogNumber="49366", limit=20) # occurrences.search(catalogNumber=["49366","Bird.27847588"], limit=20) # Use paging parameters (limit and offset) to page. Note the different results # for the two queries below. occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a', offset=10, limit=5) occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a', offset=20, limit=5) # Many dataset keys # occurrences.search(datasetKey=["50c9509d-22c7-4a22-a47d-8c48425ef4a7", "7b5d6a48-f762-11e1-a439-00145eb45e9a"], limit=20) # Search by collector name res = occurrences.search(recordedBy="smith", limit=20) [ x['recordedBy'] for x in res['results'] ] # Many collector names # occurrences.search(recordedBy=["smith","BJ Stacey"], limit=20) # recordedByID occurrences.search(recordedByID="https://orcid.org/0000-0003-1691-239X", limit = 3) # identifiedByID occurrences.search(identifiedByID="https://orcid.org/0000-0003-1691-239X", limit = 3) # Search for many species splist = ['Cyanocitta stelleri', 'Junco hyemalis', 'Aix sponsa'] keys = [ species.name_suggest(x)[0]['key'] for x in splist ] out = [ occurrences.search(taxonKey = x, limit=1) for x in keys ] [ x['results'][0]['speciesKey'] for x in out ] # Search - q parameter occurrences.search(q = "kingfisher", limit=20) ## spell check - only works with the `search` parameter ### spelled correctly - same result as above call occurrences.search(q = "kingfisher", limit=20, spellCheck = True) ### spelled incorrectly - stops with suggested spelling occurrences.search(q = "kajsdkla", limit=20, spellCheck = True) ### spelled incorrectly - stops with many suggested spellings ### and number of results for each occurrences.search(q = "helir", limit=20, spellCheck = True) # Search on latitidue and longitude occurrences.search(decimalLatitude=50, decimalLongitude=10, limit=2) # Search on a bounding box ## in well known text format occurrences.search(geometry='POLYGON((30.1 10.1, 10 20, 20 40, 40 40, 30.1 10.1))', limit=20) from pygbif import species key = species.name_suggest(q='Aesculus hippocastanum')[0]['key'] occurrences.search(taxonKey=key, geometry='POLYGON((30.1 10.1, 10 20, 20 40, 40 40, 30.1 10.1))', limit=20) ## multipolygon wkt = 'MULTIPOLYGON(((-123 38, -123 43, -116 43, -116 38, -123 38)),((-97 41, -97 45, -93 45, -93 41, -97 41)))' occurrences.search(geometry = wkt, limit = 20) # Search on country occurrences.search(country='US', limit=20) occurrences.search(country='FR', limit=20) occurrences.search(country='DE', limit=20) # Get only occurrences with lat/long data occurrences.search(taxonKey=key, hasCoordinate=True, limit=20) # Get only occurrences that were recorded as living specimens occurrences.search(taxonKey=key, basisOfRecord="LIVING_SPECIMEN", hasCoordinate=True, limit=20) # Get occurrences for a particular eventDate occurrences.search(taxonKey=key, eventDate="2013", limit=20) occurrences.search(taxonKey=key, year="2013", limit=20) occurrences.search(taxonKey=key, month="6", limit=20) # Get occurrences based on depth key = species.name_backbone(name='Salmo salar', kingdom='animals')['usageKey'] occurrences.search(taxonKey=key, depth="5", limit=20) # Get occurrences based on elevation key = species.name_backbone(name='Puma concolor', kingdom='animals')['usageKey'] occurrences.search(taxonKey=key, elevation=50, hasCoordinate=True, limit=20) # Get occurrences based on institutionCode occurrences.search(institutionCode="TLMF", limit=20) # Get occurrences based on collectionCode occurrences.search(collectionCode="Floristic Databases MV - Higher Plants", limit=20) # Get only those occurrences with spatial issues occurrences.search(taxonKey=key, hasGeospatialIssue=True, limit=20) # Search using a query string occurrences.search(q="kingfisher", limit=20) # Range queries ## See Detail for parameters that support range queries ### this is a range depth, with lower/upper limits in character string occurrences.search(depth='50,100') ## Range search with year occurrences.search(year='1999,2000', limit=20) ## Range search with latitude occurrences.search(decimalLatitude='29.59,29.6') # Search by specimen type status ## Look for possible values of the typeStatus parameter looking at the typestatus dataset occurrences.search(typeStatus = 'allotype') # Search by specimen record number ## This is the record number of the person/group that submitted the data, not GBIF's numbers ## You can see that many different groups have record number 1, so not super helpful occurrences.search(recordNumber = 1) # Search by last time interpreted: Date the record was last modified in GBIF ## The lastInterpreted parameter accepts ISO 8601 format dates, including ## yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Range queries are accepted for lastInterpreted occurrences.search(lastInterpreted = '2014-04-01') # Search by continent ## One of africa, antarctica, asia, europe, north_america, oceania, or south_america occurrences.search(continent = 'south_america') occurrences.search(continent = 'africa') occurrences.search(continent = 'oceania') occurrences.search(continent = 'antarctica') # Search for occurrences with images occurrences.search(mediatype = 'StillImage') occurrences.search(mediatype = 'MovingImage') x = occurrences.search(mediatype = 'Sound') [z['media'] for z in x['results']] # Query based on issues occurrences.search(taxonKey=1, issue='DEPTH_UNLIKELY') occurrences.search(taxonKey=1, issue=['DEPTH_UNLIKELY','COORDINATE_ROUNDED']) # Show all records in the Arizona State Lichen Collection that cant be matched to the GBIF # backbone properly: occurrences.search(datasetKey='84c0e1a0-f762-11e1-a439-00145eb45e9a', issue=['TAXON_MATCH_NONE','TAXON_MATCH_HIGHERRANK']) # If you pass in an invalid polygon you get hopefully informative errors ### the WKT string is fine, but GBIF says bad polygon wkt = 'POLYGON((-178.59375 64.83258989321493,-165.9375 59.24622380205539, -147.3046875 59.065977905449806,-130.78125 51.04484764446178,-125.859375 36.70806354647625, -112.1484375 23.367471303759686,-105.1171875 16.093320185359257,-86.8359375 9.23767076398516, -82.96875 2.9485268155066175,-82.6171875 -14.812060061226388,-74.8828125 -18.849111862023985, -77.34375 -47.661687803329166,-84.375 -49.975955187343295,174.7265625 -50.649460483096114, 179.296875 -42.19189902447192,-176.8359375 -35.634976650677295,176.8359375 -31.835565983656227, 163.4765625 -6.528187613695323,152.578125 1.894796132058301,135.703125 4.702353722559447, 127.96875 15.077427674847987,127.96875 23.689804541429606,139.921875 32.06861069132688, 149.4140625 42.65416193033991,159.2578125 48.3160811030533,168.3984375 57.019804336633165, 178.2421875 59.95776046458139,-179.6484375 61.16708631440347,-178.59375 64.83258989321493))' occurrences.search(geometry = wkt) # Faceting ## return no occurrence records with limit=0 x = occurrences.search(facet = "country", limit = 0) x['facets'] ## also return occurrence records x = occurrences.search(facet = "establishmentMeans", limit = 10) x['facets'] x['results'] ## multiple facet variables x = occurrences.search(facet = ["country", "basisOfRecord"], limit = 10) x['results'] x['facets'] x['facets']['country'] x['facets']['basisOfRecord'] x['facets']['basisOfRecord']['count'] ## set a minimum facet count x = occurrences.search(facet = "country", facetMincount = 30000000L, limit = 0) x['facets'] ## paging per each faceted variable ### do so by passing in variables like "country" + "_facetLimit" = "country_facetLimit" ### or "country" + "_facetOffset" = "country_facetOffset" x = occurrences.search( facet = ["country", "basisOfRecord", "hasCoordinate"], country_facetLimit = 3, basisOfRecord_facetLimit = 6, limit = 0 ) x['facets'] # requests package options ## There's an acceptable set of requests options (['timeout', 'cookies', 'auth', ## 'allow_redirects', 'proxies', 'verify', 'stream', 'cert']) you can pass ## in via **kwargs, e.g., set a timeout. Default timeout set to 60 seconds. x = occurrences.search(timeout = 1)
16,767
0.802364
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft and contributors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from .feature_client import FeatureClient from .version import VERSION __all__ = ['FeatureClient'] __version__ = VERSION
36.172414
76
0.656816
[ "Apache-2.0" ]
HydAu/AzureSDKForPython
azure-mgmt-resource/azure/mgmt/resource/features/__init__.py
1,049
Python
coding=utf-8 -------------------------------------------------------------------------- Copyright (c) Microsoft and contributors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Code generated by Microsoft (R) AutoRest Code Generator. Changes may cause incorrect behavior and will be lost if the code is regenerated. --------------------------------------------------------------------------
883
0.841754
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- project = 'sample' copyright = '2020, Sample Author' author = 'Sample Author' # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'alabaster' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static']
35.711538
79
0.661282
[ "MIT" ]
keathmilligan/flask-jwt-refresh
docs/conf.py
1,857
Python
Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html -- Path setup -------------------------------------------------------------- If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. import os import sys sys.path.insert(0, os.path.abspath('.')) -- Project information ----------------------------------------------------- -- General configuration --------------------------------------------------- Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. This pattern also affects html_static_path and html_extra_path. -- Options for HTML output ------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css".
1,546
0.832526
# partesanato/__init__.py
13.5
26
0.777778
[ "MIT" ]
edgarbs1998/partesanato-server
src/partesanato/__init__.py
27
Python
partesanato/__init__.py
23
0.851852
# Copyright 2015 Ciara Kamahele-Sanfratello # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Planner is a generic interface used by Simulators to choose the next action to take class Planner: def __init__(self): pass def next_action(self, initial_state, goal_state, prev_obs): pass
36.727273
85
0.75
[ "Apache-2.0" ]
ciarakamahele/sasy
simulator/Planners/Planner.py
808
Python
Copyright 2015 Ciara Kamahele-Sanfratello Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Planner is a generic interface used by Simulators to choose the next action to take
648
0.80198
#!/usr/bin/python # coding: utf-8 # This file is execfile()d with the current directory set to its containing # dir. Note that not all possible configuration values are present in this # autogenerated file. All configuration values have a default; values that are # commented out serve to show the default. import sys import os import sphinx_rtd_theme # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath(os.path.join('..'))) import pageit # noqa # -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.doctest', 'sphinx.ext.autodoc', 'sphinxcontrib.napoleon'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'pageit' copyright = u'2013, Metaist' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = pageit.__version__ # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'default' html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'pageitdoc' # -- Options for LaTeX output ------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', 'pageit.tex', u'pageit Documentation', u'The Metaist', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pageit', u'pageit Documentation', [u'The Metaist'], 1) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ----------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'pageit', u'pageit Documentation', u'The Metaist', 'pageit', pageit.__doc__.split('\n')[0], 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote'
32.072874
79
0.709038
[ "MIT" ]
metaist/pageit
docs/conf.py
7,922
Python
!/usr/bin/python coding: utf-8 This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. noqa -- General configuration ---------------------------------------------------- If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files. source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used: today = '' Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents. default_role = None If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::). add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default. show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting. modindex_common_prefix = [] -- Options for HTML output -------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. html_theme = 'default' Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation. html_theme_options = {} Add any paths that contain custom themes here, relative to this directory. html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation". html_title = None A shorter title for the navigation bar. Default is the same as html_title. html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar. html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large. html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format. html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities. html_use_smartypants = True Custom sidebar templates, maps document names to template names. html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names. html_additional_pages = {} If false, no module index is generated. html_domain_indices = True If false, no index is generated. html_use_index = True If true, the index is split into individual pages for each letter. html_split_index = False If true, links to the reST sources are added to the pages. html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served. html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml"). html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output ------------------------------------------------- The paper size ('letterpaper' or 'a4paper'). 'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt'). 'pointsize': '10pt', Additional stuff for the LaTeX preamble. 'preamble': '', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto/manual]). The name of an image file (relative to this directory) to place at the top of the title page. latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters. latex_use_parts = False If true, show page references after internal links. latex_show_pagerefs = False If true, show URL addresses after external links. latex_show_urls = False Documents to append as an appendix to all manuals. latex_appendices = [] If false, no module index is generated. latex_domain_indices = True -- Options for manual page output ------------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links. man_show_urls = False -- Options for Texinfo output ----------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals. texinfo_appendices = [] If false, no module index is generated. texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'. texinfo_show_urls = 'footnote'
6,568
0.829084
# Scrapy settings for amzASINScrapper project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/latest/topics/downloader-middleware.html # https://docs.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'amzASINScrapper' SPIDER_MODULES = ['amzASINScrapper.spiders'] NEWSPIDER_MODULE = 'amzASINScrapper.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'amzASINScrapper (+http://www.yourdomain.com)' # Obey robots.txt rules ROBOTSTXT_OBEY = True # Configure maximum concurrent requests performed by Scrapy (default: 16) #CONCURRENT_REQUESTS = 32 # Configure a delay for requests for the same website (default: 0) # See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay # See also autothrottle settings and docs #DOWNLOAD_DELAY = 3 # The download delay setting will honor only one of: #CONCURRENT_REQUESTS_PER_DOMAIN = 16 #CONCURRENT_REQUESTS_PER_IP = 16 # Disable cookies (enabled by default) #COOKIES_ENABLED = False # Disable Telnet Console (enabled by default) #TELNETCONSOLE_ENABLED = False # Override the default request headers: #DEFAULT_REQUEST_HEADERS = { # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', # 'Accept-Language': 'en', #} # Enable or disable spider middlewares # See https://docs.scrapy.org/en/latest/topics/spider-middleware.html #SPIDER_MIDDLEWARES = { # 'amzASINScrapper.middlewares.AmzasinscrapperSpiderMiddleware': 543, #} # Enable or disable downloader middlewares # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html #DOWNLOADER_MIDDLEWARES = { # 'amzASINScrapper.middlewares.AmzasinscrapperDownloaderMiddleware': 543, #} # Enable or disable extensions # See https://docs.scrapy.org/en/latest/topics/extensions.html #EXTENSIONS = { # 'scrapy.extensions.telnet.TelnetConsole': None, #} # Configure item pipelines # See https://docs.scrapy.org/en/latest/topics/item-pipeline.html #ITEM_PIPELINES = { # 'amzASINScrapper.pipelines.AmzasinscrapperPipeline': 300, #} # Enable and configure the AutoThrottle extension (disabled by default) # See https://docs.scrapy.org/en/latest/topics/autothrottle.html #AUTOTHROTTLE_ENABLED = True # The initial download delay #AUTOTHROTTLE_START_DELAY = 5 # The maximum download delay to be set in case of high latencies #AUTOTHROTTLE_MAX_DELAY = 60 # The average number of requests Scrapy should be sending in parallel to # each remote server #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 # Enable showing throttling stats for every response received: #AUTOTHROTTLE_DEBUG = False # Enable and configure HTTP caching (disabled by default) # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings #HTTPCACHE_ENABLED = True #HTTPCACHE_EXPIRATION_SECS = 0 #HTTPCACHE_DIR = 'httpcache' #HTTPCACHE_IGNORE_HTTP_CODES = [] #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
35.460674
103
0.78327
[ "MIT" ]
sunil-dhaka/python-webScrappers
amzASINScrapper/amzASINScrapper/settings.py
3,156
Python
Scrapy settings for amzASINScrapper project For simplicity, this file contains only settings considered important or commonly used. You can find more settings consulting the documentation: https://docs.scrapy.org/en/latest/topics/settings.html https://docs.scrapy.org/en/latest/topics/downloader-middleware.html https://docs.scrapy.org/en/latest/topics/spider-middleware.html Crawl responsibly by identifying yourself (and your website) on the user-agentUSER_AGENT = 'amzASINScrapper (+http://www.yourdomain.com)' Obey robots.txt rules Configure maximum concurrent requests performed by Scrapy (default: 16)CONCURRENT_REQUESTS = 32 Configure a delay for requests for the same website (default: 0) See https://docs.scrapy.org/en/latest/topics/settings.htmldownload-delay See also autothrottle settings and docsDOWNLOAD_DELAY = 3 The download delay setting will honor only one of:CONCURRENT_REQUESTS_PER_DOMAIN = 16CONCURRENT_REQUESTS_PER_IP = 16 Disable cookies (enabled by default)COOKIES_ENABLED = False Disable Telnet Console (enabled by default)TELNETCONSOLE_ENABLED = False Override the default request headers:DEFAULT_REQUEST_HEADERS = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en',} Enable or disable spider middlewares See https://docs.scrapy.org/en/latest/topics/spider-middleware.htmlSPIDER_MIDDLEWARES = { 'amzASINScrapper.middlewares.AmzasinscrapperSpiderMiddleware': 543,} Enable or disable downloader middlewares See https://docs.scrapy.org/en/latest/topics/downloader-middleware.htmlDOWNLOADER_MIDDLEWARES = { 'amzASINScrapper.middlewares.AmzasinscrapperDownloaderMiddleware': 543,} Enable or disable extensions See https://docs.scrapy.org/en/latest/topics/extensions.htmlEXTENSIONS = { 'scrapy.extensions.telnet.TelnetConsole': None,} Configure item pipelines See https://docs.scrapy.org/en/latest/topics/item-pipeline.htmlITEM_PIPELINES = { 'amzASINScrapper.pipelines.AmzasinscrapperPipeline': 300,} Enable and configure the AutoThrottle extension (disabled by default) See https://docs.scrapy.org/en/latest/topics/autothrottle.htmlAUTOTHROTTLE_ENABLED = True The initial download delayAUTOTHROTTLE_START_DELAY = 5 The maximum download delay to be set in case of high latenciesAUTOTHROTTLE_MAX_DELAY = 60 The average number of requests Scrapy should be sending in parallel to each remote serverAUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 Enable showing throttling stats for every response received:AUTOTHROTTLE_DEBUG = False Enable and configure HTTP caching (disabled by default) See https://docs.scrapy.org/en/latest/topics/downloader-middleware.htmlhttpcache-middleware-settingsHTTPCACHE_ENABLED = TrueHTTPCACHE_EXPIRATION_SECS = 0HTTPCACHE_DIR = 'httpcache'HTTPCACHE_IGNORE_HTTP_CODES = []HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
2,860
0.90621
"""Archive Tests Copyright 2015 Archive Analytics Solutions - University of Liverpool Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from django.test import TestCase # Create your tests here.
32.047619
72
0.793462
[ "Apache-2.0" ]
pericles-project/ERMR
indigo-web/archive/tests.py
673
Python
Archive Tests Copyright 2015 Archive Analytics Solutions - University of Liverpool Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Create your tests here.
630
0.936107
# Copyright Bruno da Silva de Oliveira 2003. Use, modification and # distribution is subject to the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt)
34.142857
70
0.74477
[ "MIT" ]
DD-L/deel.boost.python
origin/libs/python/pyste/src/Pyste/__init__.py
239
Python
Copyright Bruno da Silva de Oliveira 2003. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
222
0.92887
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- project = 'rend' copyright = '2020, Thomas S Hatch' author = 'Thomas S Hatch' # The full version, including alpha/beta/rc tags release = '4.1' # -- General configuration --------------------------------------------------- master_doc = 'index' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'alabaster' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static']
33.551724
79
0.661871
[ "Apache-2.0" ]
saltstack/rend
docs/conf.py
1,946
Python
Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html -- Path setup -------------------------------------------------------------- If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. import os import sys sys.path.insert(0, os.path.abspath('.')) -- Project information ----------------------------------------------------- The full version, including alpha/beta/rc tags -- General configuration --------------------------------------------------- Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. This pattern also affects html_static_path and html_extra_path. -- Options for HTML output ------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css".
1,593
0.818602
# Copyright 2016-2021 The Van Valen Lab at the California Institute of # Technology (Caltech), with support from the Paul Allen Family Foundation, # Google, & National Institutes of Health (NIH) under Grant U24CA224309-01. # All rights reserved. # # Licensed under a modified Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.github.com/vanvalenlab/deepcell-tf/LICENSE # # The Work provided may be used for non-commercial academic purposes only. # For any other use of the Work, including commercial use, please contact: # vanvalenlab@gmail.com # # Neither the name of Caltech nor the names of its contributors may be used # to endorse or promote products derived from this software without specific # prior written permission. # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Multiplex segmentation application. Deprecated in favor of ``deepcell.applications.Mesmer`` instead. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from deepcell.applications.mesmer import Mesmer as MultiplexSegmentation
42.861111
80
0.747894
[ "Apache-2.0" ]
GuillaumeMougeot/deepcell-tf
deepcell/applications/multiplex_segmentation.py
1,543
Python
Multiplex segmentation application. Deprecated in favor of ``deepcell.applications.Mesmer`` instead. Copyright 2016-2021 The Van Valen Lab at the California Institute of Technology (Caltech), with support from the Paul Allen Family Foundation, Google, & National Institutes of Health (NIH) under Grant U24CA224309-01. All rights reserved. Licensed under a modified Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.github.com/vanvalenlab/deepcell-tf/LICENSE The Work provided may be used for non-commercial academic purposes only. For any other use of the Work, including commercial use, please contact: vanvalenlab@gmail.com Neither the name of Caltech nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================
1,303
0.844459
# -*- coding: utf-8 -*- """ Indices library =============== This module describes climate indicator functions. Functions are listed in alphabetical order and describe the raw computation performed over xarray.DataArrays. DataArrays should carry unit information to allow for any needed unit conversions. The output's attributes (CF-Convention) are not modified. Validation checks and output attributes are handled by indicator classes described in files named by the physical variable (temperature, precip, streamflow). Notes for docstring ------------------- The docstrings adhere to the `NumPy`_ style convention and is meant as a way to store CF-Convention metadata as well as information relevant to third party libraries (such as a WPS server). The first line of the docstring (the short summary), will be assigned to the output's `long_name` attribute. The `long_name` attribute is defined by the NetCDF User Guide to contain a long descriptive name which may, for example, be used for labeling plots The second paragraph will be considered as the "*abstract*", or the CF global "*comment*" (miscellaneous information about the data or methods used to produce it). The third and fourth sections are the **Parameters** and **Returns** sections describing the input and output values respectively. .. code-block:: python Parameters ---------- <standard_name> : xarray.DataArray <Long_name> of variable [acceptable units]. threshold : string Description of the threshold / units. e.g. The 10th percentile of historical temperature [K]. freq : str, optional Resampling frequency. Returns ------- xarray.DataArray Output's <long_name> [units] The next sections would be **Notes** and **References**: .. code-block:: python Notes ----- This is where the mathematical equation is described. At the end of the description, convention suggests to add a reference [example]_: .. math:: 3987^12 + 4365^12 = 4472^12 References ---------- .. [example] Smith, T.J. and Huard, D. (2018). "CF Docstrings: A manifesto on conventions and the metaphysical nature of ontological python documentation." Climate Aesthetics, vol. 1, pp. 121-155. Indice descriptions =================== .. _`NumPy`: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard """ from ._simple import * from ._threshold import * from ._multivariate import * # TODO: Define a unit conversion system for temperature [K, C, F] and precipitation [mm h-1, Kg m-2 s-1] metrics # TODO: Move utility functions to another file. # TODO: Should we reference the standard vocabulary we're using ? # E.g. http://vocab.nerc.ac.uk/collection/P07/current/BHMHISG2/
35.088608
117
0.712843
[ "Apache-2.0" ]
gacou54/xclim
xclim/indices/__init__.py
2,772
Python
Indices library =============== This module describes climate indicator functions. Functions are listed in alphabetical order and describe the raw computation performed over xarray.DataArrays. DataArrays should carry unit information to allow for any needed unit conversions. The output's attributes (CF-Convention) are not modified. Validation checks and output attributes are handled by indicator classes described in files named by the physical variable (temperature, precip, streamflow). Notes for docstring ------------------- The docstrings adhere to the `NumPy`_ style convention and is meant as a way to store CF-Convention metadata as well as information relevant to third party libraries (such as a WPS server). The first line of the docstring (the short summary), will be assigned to the output's `long_name` attribute. The `long_name` attribute is defined by the NetCDF User Guide to contain a long descriptive name which may, for example, be used for labeling plots The second paragraph will be considered as the "*abstract*", or the CF global "*comment*" (miscellaneous information about the data or methods used to produce it). The third and fourth sections are the **Parameters** and **Returns** sections describing the input and output values respectively. .. code-block:: python Parameters ---------- <standard_name> : xarray.DataArray <Long_name> of variable [acceptable units]. threshold : string Description of the threshold / units. e.g. The 10th percentile of historical temperature [K]. freq : str, optional Resampling frequency. Returns ------- xarray.DataArray Output's <long_name> [units] The next sections would be **Notes** and **References**: .. code-block:: python Notes ----- This is where the mathematical equation is described. At the end of the description, convention suggests to add a reference [example]_: .. math:: 3987^12 + 4365^12 = 4472^12 References ---------- .. [example] Smith, T.J. and Huard, D. (2018). "CF Docstrings: A manifesto on conventions and the metaphysical nature of ontological python documentation." Climate Aesthetics, vol. 1, pp. 121-155. Indice descriptions =================== .. _`NumPy`: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard -*- coding: utf-8 -*- TODO: Define a unit conversion system for temperature [K, C, F] and precipitation [mm h-1, Kg m-2 s-1] metrics TODO: Move utility functions to another file. TODO: Should we reference the standard vocabulary we're using ? E.g. http://vocab.nerc.ac.uk/collection/P07/current/BHMHISG2/
2,674
0.964646
"""On-premise Gitlab clients """ # from .v4 import *
13.25
28
0.641509
[ "BSD-3-Clause" ]
shwetagopaul92/tapis-cli-ng
tapis_cli/clients/services/gitlab/__init__.py
53
Python
On-premise Gitlab clients from .v4 import *
45
0.849057
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Service Class # this is a auto generated file generated by Cheetah # Libre Office Version: 7.3 # Namespace: com.sun.star.configuration.backend from ....lo.configuration.backend.multi_layer_stratum import MultiLayerStratum as MultiLayerStratum __all__ = ['MultiLayerStratum']
34.192308
99
0.767154
[ "Apache-2.0" ]
Amourspirit/ooo_uno_tmpl
ooobuild/dyn/configuration/backend/multi_layer_stratum.py
889
Python
coding: utf-8 Copyright 2022 :Barry-Thomas-Paul: Moss Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License. You may obtain a copy of the License at http: // www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Service Class this is a auto generated file generated by Cheetah Libre Office Version: 7.3 Namespace: com.sun.star.configuration.backend
713
0.802025
"""hackernews URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ]
35.136364
78
0.690815
[ "MIT" ]
Saltiest-Hacker-News-Trolls-2/DS
hackernews/hackernews/urls.py
773
Python
hackernews URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
626
0.809832
############################################################################ # examples/multi_webcamera/host/test_module/__init__.py # # Copyright 2019, 2020 Sony Semiconductor Solutions Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. Neither the name NuttX nor the names of its contributors may be # used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ from TestServer import TestServer
49.777778
76
0.717634
[ "Apache-2.0" ]
Curly386/spresense
examples/multi_webcamera/host/test_module/__init__.py
1,792
Python
examples/multi_webcamera/host/test_module/__init__.py Copyright 2019, 2020 Sony Semiconductor Solutions Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name NuttX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1,540
0.859375
import os import sys __all__ = [ 'lexsort','sort', 'argsort','argmin', 'argmax', 'searchsorted'] from pnumpy._pnumpy import getitem, lexsort32, lexsort64 import numpy as np from numpy import asarray, array, asanyarray from numpy import concatenate #array_function_dispatch = functools.partial( # overrides.array_function_dispatch, module='numpy') # functions that are now methods def _wrapit(obj, method, *args, **kwds): try: wrap = obj.__array_wrap__ except AttributeError: wrap = None result = getattr(asarray(obj), method)(*args, **kwds) if wrap: if not isinstance(result, mu.ndarray): result = asarray(result) result = wrap(result) return result def _wrapfunc(obj, method, *args, **kwds): bound = getattr(obj, method, None) if bound is None: return _wrapit(obj, method, *args, **kwds) try: return bound(*args, **kwds) except TypeError: # A TypeError occurs if the object does have such a method in its # class, but its signature is not identical to that of NumPy's. This # situation has occurred in the case of a downstream library like # 'pandas'. # # Call _wrapit from within the except clause to ensure a potential # exception has a traceback chain. return _wrapit(obj, method, *args, **kwds) def sort(a, axis=-1, kind=None, order=None): """ Return a sorted copy of an array. Parameters ---------- a : array_like Array to be sorted. axis : int or None, optional Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis. kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional Sorting algorithm. The default is 'quicksort'. Note that both 'stable' and 'mergesort' use timsort or radix sort under the covers and, in general, the actual implementation will vary with data type. The 'mergesort' option is retained for backwards compatibility. .. versionchanged:: 1.15.0. The 'stable' option was added. order : str or list of str, optional When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. A single field can be specified as a string, and not all fields need be specified, but unspecified fields will still be used, in the order in which they come up in the dtype, to break ties. Returns ------- sorted_array : ndarray Array of the same type and shape as `a`. Threading --------- Up to 8 threads See Also -------- ndarray.sort : Method to sort an array in-place. argsort : Indirect sort. lexsort : Indirect stable sort on multiple keys. searchsorted : Find elements in a sorted array. partition : Partial sort. Notes ----- The various sorting algorithms are characterized by their average speed, worst case performance, work space size, and whether they are stable. A stable sort keeps items with the same key in the same relative order. The four algorithms implemented in NumPy have the following properties: =========== ======= ============= ============ ======== kind speed worst case work space stable =========== ======= ============= ============ ======== 'quicksort' 1 O(n^2) 0 no 'heapsort' 3 O(n*log(n)) 0 no 'mergesort' 2 O(n*log(n)) ~n/2 yes 'timsort' 2 O(n*log(n)) ~n/2 yes =========== ======= ============= ============ ======== .. note:: The datatype determines which of 'mergesort' or 'timsort' is actually used, even if 'mergesort' is specified. User selection at a finer scale is not currently available. All the sort algorithms make temporary copies of the data when sorting along any but the last axis. Consequently, sorting along the last axis is faster and uses less space than sorting along any other axis. The sort order for complex numbers is lexicographic. If both the real and imaginary parts are non-nan then the order is determined by the real parts except when they are equal, in which case the order is determined by the imaginary parts. Previous to numpy 1.4.0 sorting real and complex arrays containing nan values led to undefined behaviour. In numpy versions >= 1.4.0 nan values are sorted to the end. The extended sort order is: * Real: [R, nan] * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] where R is a non-nan real value. Complex values with the same nan placements are sorted according to the non-nan part if it exists. Non-nan values are sorted as before. .. versionadded:: 1.12.0 quicksort has been changed to `introsort <https://en.wikipedia.org/wiki/Introsort>`_. When sorting does not make enough progress it switches to `heapsort <https://en.wikipedia.org/wiki/Heapsort>`_. This implementation makes quicksort O(n*log(n)) in the worst case. 'stable' automatically chooses the best stable sorting algorithm for the data type being sorted. It, along with 'mergesort' is currently mapped to `timsort <https://en.wikipedia.org/wiki/Timsort>`_ or `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ depending on the data type. API forward compatibility currently limits the ability to select the implementation and it is hardwired for the different data types. .. versionadded:: 1.17.0 Timsort is added for better performance on already or nearly sorted data. On random data timsort is almost identical to mergesort. It is now used for stable sort while quicksort is still the default sort if none is chosen. For timsort details, refer to `CPython listsort.txt <https://github.com/python/cpython/blob/3.7/Objects/listsort.txt>`_. 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an O(n) sort instead of O(n log n). .. versionchanged:: 1.18.0 NaT now sorts to the end of arrays for consistency with NaN. Examples -------- >>> a = np.array([[1,4],[3,1]]) >>> np.sort(a) # sort along the last axis array([[1, 4], [1, 3]]) >>> np.sort(a, axis=None) # sort the flattened array array([1, 1, 3, 4]) >>> np.sort(a, axis=0) # sort along the first axis array([[1, 1], [3, 4]]) Use the `order` keyword to specify a field to use when sorting a structured array: >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), ... ('Galahad', 1.7, 38)] >>> a = np.array(values, dtype=dtype) # create a structured array >>> np.sort(a, order='height') # doctest: +SKIP array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), ('Lancelot', 1.8999999999999999, 38)], dtype=[('name', '|S10'), ('height', '<f8'), ('age', '<i4')]) Sort by age, then height if ages are equal: >>> np.sort(a, order=['age', 'height']) # doctest: +SKIP array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), ('Arthur', 1.8, 41)], dtype=[('name', '|S10'), ('height', '<f8'), ('age', '<i4')]) """ if axis is None: # flatten returns (1, N) for np.matrix, so always use the last axis a = asanyarray(a).flatten() axis = -1 try: # attempt a parallel sort sort(a, kind=kind) return a except Exception: pass else: a = asanyarray(a).copy(order="K") # normal numpy code a.sort(axis=axis, kind=kind, order=order) return a def lexsort(*args, **kwargs): """ Perform an indirect stable sort using a sequence of keys. Given multiple sorting keys, which can be interpreted as columns in a spreadsheet, lexsort returns an array of integer indices that describes the sort order by multiple columns. The last key in the sequence is used for the primary sort order, the second-to-last key for the secondary sort order, and so on. The keys argument must be a sequence of objects that can be converted to arrays of the same shape. If a 2D array is provided for the keys argument, it's rows are interpreted as the sorting keys and sorting is according to the last row, second last row etc. Parameters ---------- keys : (k, N) array or tuple containing k (N,)-shaped sequences The `k` different "columns" to be sorted. The last column (or row if `keys` is a 2D array) is the primary sort key. axis : int, optional Axis to be indirectly sorted. By default, sort over the last axis. Returns ------- indices : (N,) ndarray of ints Array of indices that sort the keys along the specified axis. Threading --------- Up to 8 threads See Also -------- argsort : Indirect sort. ndarray.sort : In-place sort. sort : Return a sorted copy of an array. Examples -------- Sort names: first by surname, then by name. >>> surnames = ('Hertz', 'Galilei', 'Hertz') >>> first_names = ('Heinrich', 'Galileo', 'Gustav') >>> ind = np.lexsort((first_names, surnames)) >>> ind array([1, 2, 0]) >>> [surnames[i] + ", " + first_names[i] for i in ind] ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] Sort two columns of numbers: >>> a = [1,5,1,4,3,4,4] # First column >>> b = [9,4,0,4,0,2,1] # Second column >>> ind = np.lexsort((b,a)) # Sort by a, then by b >>> ind array([2, 0, 4, 6, 5, 3, 1]) >>> [(a[i],b[i]) for i in ind] [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] Note that sorting is first according to the elements of ``a``. Secondary sorting is according to the elements of ``b``. A normal ``argsort`` would have yielded: >>> [(a[i],b[i]) for i in np.argsort(a)] [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] Structured arrays are sorted lexically by ``argsort``: >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], ... dtype=np.dtype([('x', int), ('y', int)])) >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) array([2, 0, 4, 6, 5, 3, 1]) """ try: return lexsort32(*args, **kwargs) except Exception: return np.lexsort(*args, **kwargs) def argsort(a, axis=-1, kind=None, order=None): """ Returns the indices that would sort an array. Perform an indirect sort along the given axis using the algorithm specified by the `kind` keyword. It returns an array of indices of the same shape as `a` that index data along the given axis in sorted order. Parameters ---------- a : array_like Array to sort. axis : int or None, optional Axis along which to sort. The default is -1 (the last axis). If None, the flattened array is used. kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional Sorting algorithm. The default is 'quicksort'. Note that both 'stable' and 'mergesort' use timsort under the covers and, in general, the actual implementation will vary with data type. The 'mergesort' option is retained for backwards compatibility. .. versionchanged:: 1.15.0. The 'stable' option was added. order : str or list of str, optional When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. A single field can be specified as a string, and not all fields need be specified, but unspecified fields will still be used, in the order in which they come up in the dtype, to break ties. Returns ------- index_array : ndarray, int Array of indices that sort `a` along the specified `axis`. If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. More generally, ``np.take_along_axis(a, index_array, axis=axis)`` always yields the sorted `a`, irrespective of dimensionality. See Also -------- sort : Describes sorting algorithms used. lexsort : Indirect stable sort with multiple keys. ndarray.sort : Inplace sort. argpartition : Indirect partial sort. take_along_axis : Apply ``index_array`` from argsort to an array as if by calling sort. Notes ----- See `sort` for notes on the different sorting algorithms. As of NumPy 1.4.0 `argsort` works with real/complex arrays containing nan values. The enhanced sort order is documented in `sort`. Examples -------- One dimensional array: >>> x = np.array([3, 1, 2]) >>> np.argsort(x) array([1, 2, 0]) Two-dimensional array: >>> x = np.array([[0, 3], [2, 2]]) >>> x array([[0, 3], [2, 2]]) >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) >>> ind array([[0, 1], [1, 0]]) >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) array([[0, 2], [2, 3]]) >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) >>> ind array([[0, 1], [0, 1]]) >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) array([[0, 3], [2, 2]]) Indices of the sorted elements of a N-dimensional array: >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) >>> ind (array([0, 1, 1, 0]), array([0, 0, 1, 1])) >>> x[ind] # same as np.sort(x, axis=None) array([0, 2, 2, 3]) Sorting with keys: >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '<i4'), ('y', '<i4')]) >>> x array([(1, 0), (0, 1)], dtype=[('x', '<i4'), ('y', '<i4')]) >>> np.argsort(x, order=('x','y')) array([1, 0]) >>> np.argsort(x, order=('y','x')) array([0, 1]) """ return _wrapfunc(a, 'argsort', axis=axis, kind=kind, order=order) def _argmax_dispatcher(a, axis=None, out=None): return (a, out) def argmax(a, axis=None, out=None): """ Returns the indices of the maximum values along an axis. Parameters ---------- a : array_like Input array. axis : int, optional By default, the index is into the flattened array, otherwise along the specified axis. out : array, optional If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype. Returns ------- index_array : ndarray of ints Array of indices into the array. It has the same shape as `a.shape` with the dimension along `axis` removed. See Also -------- ndarray.argmax, argmin amax : The maximum value along a given axis. unravel_index : Convert a flat index into an index tuple. take_along_axis : Apply ``np.expand_dims(index_array, axis)`` from argmax to an array as if by calling max. Notes ----- In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned. Examples -------- >>> a = np.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> np.argmax(a) 5 >>> np.argmax(a, axis=0) array([1, 1, 1]) >>> np.argmax(a, axis=1) array([2, 2]) Indexes of the maximal elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) >>> ind (1, 2) >>> a[ind] 15 >>> b = np.arange(6) >>> b[1] = 5 >>> b array([0, 5, 2, 3, 4, 5]) >>> np.argmax(b) # Only the first occurrence is returned. 1 >>> x = np.array([[4,2,3], [1,0,3]]) >>> index_array = np.argmax(x, axis=-1) >>> # Same as np.max(x, axis=-1, keepdims=True) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) array([[4], [3]]) >>> # Same as np.max(x, axis=-1) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) array([4, 3]) """ return _wrapfunc(a, 'argmax', axis=axis, out=out) def _argmin_dispatcher(a, axis=None, out=None): return (a, out) def argmin(a, axis=None, out=None): """ Returns the indices of the minimum values along an axis. Parameters ---------- a : array_like Input array. axis : int, optional By default, the index is into the flattened array, otherwise along the specified axis. out : array, optional If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype. Returns ------- index_array : ndarray of ints Array of indices into the array. It has the same shape as `a.shape` with the dimension along `axis` removed. See Also -------- ndarray.argmin, argmax amin : The minimum value along a given axis. unravel_index : Convert a flat index into an index tuple. take_along_axis : Apply ``np.expand_dims(index_array, axis)`` from argmin to an array as if by calling min. Notes ----- In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned. Examples -------- >>> a = np.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> np.argmin(a) 0 >>> np.argmin(a, axis=0) array([0, 0, 0]) >>> np.argmin(a, axis=1) array([0, 0]) Indices of the minimum elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) >>> ind (0, 0) >>> a[ind] 10 >>> b = np.arange(6) + 10 >>> b[4] = 10 >>> b array([10, 11, 12, 13, 10, 15]) >>> np.argmin(b) # Only the first occurrence is returned. 0 >>> x = np.array([[4,2,3], [1,0,3]]) >>> index_array = np.argmin(x, axis=-1) >>> # Same as np.min(x, axis=-1, keepdims=True) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) array([[2], [0]]) >>> # Same as np.max(x, axis=-1) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) array([2, 0]) """ return _wrapfunc(a, 'argmin', axis=axis, out=out) def _searchsorted_dispatcher(a, v, side=None, sorter=None): return (a, v, sorter) def searchsorted(a, v, side='left', sorter=None): """ Find indices where elements should be inserted to maintain order. Find the indices into a sorted array `a` such that, if the corresponding elements in `v` were inserted before the indices, the order of `a` would be preserved. Assuming that `a` is sorted: ====== ============================ `side` returned index `i` satisfies ====== ============================ left ``a[i-1] < v <= a[i]`` right ``a[i-1] <= v < a[i]`` ====== ============================ Parameters ---------- a : 1-D array_like Input array. If `sorter` is None, then it must be sorted in ascending order, otherwise `sorter` must be an array of indices that sort it. v : array_like Values to insert into `a`. side : {'left', 'right'}, optional If 'left', the index of the first suitable location found is given. If 'right', return the last such index. If there is no suitable index, return either 0 or N (where N is the length of `a`). sorter : 1-D array_like, optional Optional array of integer indices that sort array a into ascending order. They are typically the result of argsort. .. versionadded:: 1.7.0 Returns ------- indices : array of ints Array of insertion points with the same shape as `v`. See Also -------- sort : Return a sorted copy of an array. histogram : Produce histogram from 1-D data. Notes ----- Binary search is used to find the required insertion points. As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing `nan` values. The enhanced sort order is documented in `sort`. This function uses the same algorithm as the builtin python `bisect.bisect_left` (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, which is also vectorized in the `v` argument. Examples -------- >>> np.searchsorted([1,2,3,4,5], 3) 2 >>> np.searchsorted([1,2,3,4,5], 3, side='right') 3 >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) array([0, 5, 1, 2]) """ return _wrapfunc(a, 'searchsorted', v, side=side, sorter=sorter)
33.043887
94
0.591737
[ "MIT" ]
Quansight/numpy-threading-extensions
src/pnumpy/sort.py
21,082
Python
Returns the indices of the maximum values along an axis. Parameters ---------- a : array_like Input array. axis : int, optional By default, the index is into the flattened array, otherwise along the specified axis. out : array, optional If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype. Returns ------- index_array : ndarray of ints Array of indices into the array. It has the same shape as `a.shape` with the dimension along `axis` removed. See Also -------- ndarray.argmax, argmin amax : The maximum value along a given axis. unravel_index : Convert a flat index into an index tuple. take_along_axis : Apply ``np.expand_dims(index_array, axis)`` from argmax to an array as if by calling max. Notes ----- In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned. Examples -------- >>> a = np.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> np.argmax(a) 5 >>> np.argmax(a, axis=0) array([1, 1, 1]) >>> np.argmax(a, axis=1) array([2, 2]) Indexes of the maximal elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) >>> ind (1, 2) >>> a[ind] 15 >>> b = np.arange(6) >>> b[1] = 5 >>> b array([0, 5, 2, 3, 4, 5]) >>> np.argmax(b) # Only the first occurrence is returned. 1 >>> x = np.array([[4,2,3], [1,0,3]]) >>> index_array = np.argmax(x, axis=-1) >>> # Same as np.max(x, axis=-1, keepdims=True) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) array([[4], [3]]) >>> # Same as np.max(x, axis=-1) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) array([4, 3]) Returns the indices of the minimum values along an axis. Parameters ---------- a : array_like Input array. axis : int, optional By default, the index is into the flattened array, otherwise along the specified axis. out : array, optional If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype. Returns ------- index_array : ndarray of ints Array of indices into the array. It has the same shape as `a.shape` with the dimension along `axis` removed. See Also -------- ndarray.argmin, argmax amin : The minimum value along a given axis. unravel_index : Convert a flat index into an index tuple. take_along_axis : Apply ``np.expand_dims(index_array, axis)`` from argmin to an array as if by calling min. Notes ----- In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned. Examples -------- >>> a = np.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> np.argmin(a) 0 >>> np.argmin(a, axis=0) array([0, 0, 0]) >>> np.argmin(a, axis=1) array([0, 0]) Indices of the minimum elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmin(a, axis=None), a.shape) >>> ind (0, 0) >>> a[ind] 10 >>> b = np.arange(6) + 10 >>> b[4] = 10 >>> b array([10, 11, 12, 13, 10, 15]) >>> np.argmin(b) # Only the first occurrence is returned. 0 >>> x = np.array([[4,2,3], [1,0,3]]) >>> index_array = np.argmin(x, axis=-1) >>> # Same as np.min(x, axis=-1, keepdims=True) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) array([[2], [0]]) >>> # Same as np.max(x, axis=-1) >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) array([2, 0]) Returns the indices that would sort an array. Perform an indirect sort along the given axis using the algorithm specified by the `kind` keyword. It returns an array of indices of the same shape as `a` that index data along the given axis in sorted order. Parameters ---------- a : array_like Array to sort. axis : int or None, optional Axis along which to sort. The default is -1 (the last axis). If None, the flattened array is used. kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional Sorting algorithm. The default is 'quicksort'. Note that both 'stable' and 'mergesort' use timsort under the covers and, in general, the actual implementation will vary with data type. The 'mergesort' option is retained for backwards compatibility. .. versionchanged:: 1.15.0. The 'stable' option was added. order : str or list of str, optional When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. A single field can be specified as a string, and not all fields need be specified, but unspecified fields will still be used, in the order in which they come up in the dtype, to break ties. Returns ------- index_array : ndarray, int Array of indices that sort `a` along the specified `axis`. If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. More generally, ``np.take_along_axis(a, index_array, axis=axis)`` always yields the sorted `a`, irrespective of dimensionality. See Also -------- sort : Describes sorting algorithms used. lexsort : Indirect stable sort with multiple keys. ndarray.sort : Inplace sort. argpartition : Indirect partial sort. take_along_axis : Apply ``index_array`` from argsort to an array as if by calling sort. Notes ----- See `sort` for notes on the different sorting algorithms. As of NumPy 1.4.0 `argsort` works with real/complex arrays containing nan values. The enhanced sort order is documented in `sort`. Examples -------- One dimensional array: >>> x = np.array([3, 1, 2]) >>> np.argsort(x) array([1, 2, 0]) Two-dimensional array: >>> x = np.array([[0, 3], [2, 2]]) >>> x array([[0, 3], [2, 2]]) >>> ind = np.argsort(x, axis=0) # sorts along first axis (down) >>> ind array([[0, 1], [1, 0]]) >>> np.take_along_axis(x, ind, axis=0) # same as np.sort(x, axis=0) array([[0, 2], [2, 3]]) >>> ind = np.argsort(x, axis=1) # sorts along last axis (across) >>> ind array([[0, 1], [0, 1]]) >>> np.take_along_axis(x, ind, axis=1) # same as np.sort(x, axis=1) array([[0, 3], [2, 2]]) Indices of the sorted elements of a N-dimensional array: >>> ind = np.unravel_index(np.argsort(x, axis=None), x.shape) >>> ind (array([0, 1, 1, 0]), array([0, 0, 1, 1])) >>> x[ind] # same as np.sort(x, axis=None) array([0, 2, 2, 3]) Sorting with keys: >>> x = np.array([(1, 0), (0, 1)], dtype=[('x', '<i4'), ('y', '<i4')]) >>> x array([(1, 0), (0, 1)], dtype=[('x', '<i4'), ('y', '<i4')]) >>> np.argsort(x, order=('x','y')) array([1, 0]) >>> np.argsort(x, order=('y','x')) array([0, 1]) Perform an indirect stable sort using a sequence of keys. Given multiple sorting keys, which can be interpreted as columns in a spreadsheet, lexsort returns an array of integer indices that describes the sort order by multiple columns. The last key in the sequence is used for the primary sort order, the second-to-last key for the secondary sort order, and so on. The keys argument must be a sequence of objects that can be converted to arrays of the same shape. If a 2D array is provided for the keys argument, it's rows are interpreted as the sorting keys and sorting is according to the last row, second last row etc. Parameters ---------- keys : (k, N) array or tuple containing k (N,)-shaped sequences The `k` different "columns" to be sorted. The last column (or row if `keys` is a 2D array) is the primary sort key. axis : int, optional Axis to be indirectly sorted. By default, sort over the last axis. Returns ------- indices : (N,) ndarray of ints Array of indices that sort the keys along the specified axis. Threading --------- Up to 8 threads See Also -------- argsort : Indirect sort. ndarray.sort : In-place sort. sort : Return a sorted copy of an array. Examples -------- Sort names: first by surname, then by name. >>> surnames = ('Hertz', 'Galilei', 'Hertz') >>> first_names = ('Heinrich', 'Galileo', 'Gustav') >>> ind = np.lexsort((first_names, surnames)) >>> ind array([1, 2, 0]) >>> [surnames[i] + ", " + first_names[i] for i in ind] ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich'] Sort two columns of numbers: >>> a = [1,5,1,4,3,4,4] # First column >>> b = [9,4,0,4,0,2,1] # Second column >>> ind = np.lexsort((b,a)) # Sort by a, then by b >>> ind array([2, 0, 4, 6, 5, 3, 1]) >>> [(a[i],b[i]) for i in ind] [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)] Note that sorting is first according to the elements of ``a``. Secondary sorting is according to the elements of ``b``. A normal ``argsort`` would have yielded: >>> [(a[i],b[i]) for i in np.argsort(a)] [(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)] Structured arrays are sorted lexically by ``argsort``: >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)], ... dtype=np.dtype([('x', int), ('y', int)])) >>> np.argsort(x) # or np.argsort(x, order=('x', 'y')) array([2, 0, 4, 6, 5, 3, 1]) Find indices where elements should be inserted to maintain order. Find the indices into a sorted array `a` such that, if the corresponding elements in `v` were inserted before the indices, the order of `a` would be preserved. Assuming that `a` is sorted: ====== ============================ `side` returned index `i` satisfies ====== ============================ left ``a[i-1] < v <= a[i]`` right ``a[i-1] <= v < a[i]`` ====== ============================ Parameters ---------- a : 1-D array_like Input array. If `sorter` is None, then it must be sorted in ascending order, otherwise `sorter` must be an array of indices that sort it. v : array_like Values to insert into `a`. side : {'left', 'right'}, optional If 'left', the index of the first suitable location found is given. If 'right', return the last such index. If there is no suitable index, return either 0 or N (where N is the length of `a`). sorter : 1-D array_like, optional Optional array of integer indices that sort array a into ascending order. They are typically the result of argsort. .. versionadded:: 1.7.0 Returns ------- indices : array of ints Array of insertion points with the same shape as `v`. See Also -------- sort : Return a sorted copy of an array. histogram : Produce histogram from 1-D data. Notes ----- Binary search is used to find the required insertion points. As of NumPy 1.4.0 `searchsorted` works with real/complex arrays containing `nan` values. The enhanced sort order is documented in `sort`. This function uses the same algorithm as the builtin python `bisect.bisect_left` (``side='left'``) and `bisect.bisect_right` (``side='right'``) functions, which is also vectorized in the `v` argument. Examples -------- >>> np.searchsorted([1,2,3,4,5], 3) 2 >>> np.searchsorted([1,2,3,4,5], 3, side='right') 3 >>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3]) array([0, 5, 1, 2]) Return a sorted copy of an array. Parameters ---------- a : array_like Array to be sorted. axis : int or None, optional Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis. kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional Sorting algorithm. The default is 'quicksort'. Note that both 'stable' and 'mergesort' use timsort or radix sort under the covers and, in general, the actual implementation will vary with data type. The 'mergesort' option is retained for backwards compatibility. .. versionchanged:: 1.15.0. The 'stable' option was added. order : str or list of str, optional When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. A single field can be specified as a string, and not all fields need be specified, but unspecified fields will still be used, in the order in which they come up in the dtype, to break ties. Returns ------- sorted_array : ndarray Array of the same type and shape as `a`. Threading --------- Up to 8 threads See Also -------- ndarray.sort : Method to sort an array in-place. argsort : Indirect sort. lexsort : Indirect stable sort on multiple keys. searchsorted : Find elements in a sorted array. partition : Partial sort. Notes ----- The various sorting algorithms are characterized by their average speed, worst case performance, work space size, and whether they are stable. A stable sort keeps items with the same key in the same relative order. The four algorithms implemented in NumPy have the following properties: =========== ======= ============= ============ ======== kind speed worst case work space stable =========== ======= ============= ============ ======== 'quicksort' 1 O(n^2) 0 no 'heapsort' 3 O(n*log(n)) 0 no 'mergesort' 2 O(n*log(n)) ~n/2 yes 'timsort' 2 O(n*log(n)) ~n/2 yes =========== ======= ============= ============ ======== .. note:: The datatype determines which of 'mergesort' or 'timsort' is actually used, even if 'mergesort' is specified. User selection at a finer scale is not currently available. All the sort algorithms make temporary copies of the data when sorting along any but the last axis. Consequently, sorting along the last axis is faster and uses less space than sorting along any other axis. The sort order for complex numbers is lexicographic. If both the real and imaginary parts are non-nan then the order is determined by the real parts except when they are equal, in which case the order is determined by the imaginary parts. Previous to numpy 1.4.0 sorting real and complex arrays containing nan values led to undefined behaviour. In numpy versions >= 1.4.0 nan values are sorted to the end. The extended sort order is: * Real: [R, nan] * Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj] where R is a non-nan real value. Complex values with the same nan placements are sorted according to the non-nan part if it exists. Non-nan values are sorted as before. .. versionadded:: 1.12.0 quicksort has been changed to `introsort <https://en.wikipedia.org/wiki/Introsort>`_. When sorting does not make enough progress it switches to `heapsort <https://en.wikipedia.org/wiki/Heapsort>`_. This implementation makes quicksort O(n*log(n)) in the worst case. 'stable' automatically chooses the best stable sorting algorithm for the data type being sorted. It, along with 'mergesort' is currently mapped to `timsort <https://en.wikipedia.org/wiki/Timsort>`_ or `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ depending on the data type. API forward compatibility currently limits the ability to select the implementation and it is hardwired for the different data types. .. versionadded:: 1.17.0 Timsort is added for better performance on already or nearly sorted data. On random data timsort is almost identical to mergesort. It is now used for stable sort while quicksort is still the default sort if none is chosen. For timsort details, refer to `CPython listsort.txt <https://github.com/python/cpython/blob/3.7/Objects/listsort.txt>`_. 'mergesort' and 'stable' are mapped to radix sort for integer data types. Radix sort is an O(n) sort instead of O(n log n). .. versionchanged:: 1.18.0 NaT now sorts to the end of arrays for consistency with NaN. Examples -------- >>> a = np.array([[1,4],[3,1]]) >>> np.sort(a) # sort along the last axis array([[1, 4], [1, 3]]) >>> np.sort(a, axis=None) # sort the flattened array array([1, 1, 3, 4]) >>> np.sort(a, axis=0) # sort along the first axis array([[1, 1], [3, 4]]) Use the `order` keyword to specify a field to use when sorting a structured array: >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), ... ('Galahad', 1.7, 38)] >>> a = np.array(values, dtype=dtype) # create a structured array >>> np.sort(a, order='height') # doctest: +SKIP array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), ('Lancelot', 1.8999999999999999, 38)], dtype=[('name', '|S10'), ('height', '<f8'), ('age', '<i4')]) Sort by age, then height if ages are equal: >>> np.sort(a, order=['age', 'height']) # doctest: +SKIP array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), ('Arthur', 1.8, 41)], dtype=[('name', '|S10'), ('height', '<f8'), ('age', '<i4')]) array_function_dispatch = functools.partial( overrides.array_function_dispatch, module='numpy') functions that are now methods A TypeError occurs if the object does have such a method in its class, but its signature is not identical to that of NumPy's. This situation has occurred in the case of a downstream library like 'pandas'. Call _wrapit from within the except clause to ensure a potential exception has a traceback chain. flatten returns (1, N) for np.matrix, so always use the last axis attempt a parallel sort normal numpy code
17,146
0.8133
# -*- coding: utf-8 -*- # # This document is free and open-source software, subject to the OSI-approved # BSD license below. # # Copyright (c) 2011 - 2013 Alexis Petrounias <www.petrounias.org>, # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the name of the author nor the names of its contributors may be used # to endorse or promote products derived from this software without specific # prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ Django CTE Trees - an experimental PostgreSQL Common Table Expressions (CTE) implementation of of Adjacency-Linked trees. """ VERSION = (0, 2, 2) __version__ = ".".join(map(str, VERSION))
46.925
80
0.773042
[ "BSD-3-Clause" ]
kordian-kowalski/django-cte-forest
cte_forest/__init__.py
1,877
Python
Django CTE Trees - an experimental PostgreSQL Common Table Expressions (CTE) implementation of of Adjacency-Linked trees. -*- coding: utf-8 -*- This document is free and open-source software, subject to the OSI-approved BSD license below. Copyright (c) 2011 - 2013 Alexis Petrounias <www.petrounias.org>, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1,738
0.925946
# -*- coding: utf-8 -*- # # Submittable API Client documentation build configuration file, created by # sphinx-quickstart on Mon Jun 9 15:21:21 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os dirname = os.path.dirname # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.join(dirname(dirname(dirname(os.path.abspath(__file__)))), 'submittable_api_client')) print sys.path # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Submittable API Client' copyright = u'2014, Shawn Rider' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.1' # The full version, including alpha/beta/rc tags. release = '0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'SubmittableAPIClientdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'SubmittableAPIClient.tex', u'Submittable API Client Documentation', u'Shawn Rider', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'submittableapiclient', u'Submittable API Client Documentation', [u'Shawn Rider'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'SubmittableAPIClient', u'Submittable API Client Documentation', u'Shawn Rider', 'SubmittableAPIClient', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False
31.961977
112
0.721865
[ "MIT" ]
shawnr/submittable-api-client
docs/source/conf.py
8,406
Python
-*- coding: utf-8 -*- Submittable API Client documentation build configuration file, created by sphinx-quickstart on Mon Jun 9 15:21:21 2014. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages.language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents.keep_warnings = False -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation.html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu.texinfo_no_detailmenu = False
7,000
0.832739
# -*- coding: utf-8 -*- # # github-cli documentation build configuration file, created by # sphinx-quickstart on Tue May 5 17:40:34 2009. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'github-cli' copyright = u'2009-2012, Sander Smits' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '1.0' # The full version, including alpha/beta/rc tags. release = '1.0.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'sphinxdoc' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'github-clidoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'github-cli.tex', u'github-cli Documentation', u'Sander Smits', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True
32.34359
80
0.722531
[ "BSD-3-Clause" ]
jsmits/github-cli
docs/source/conf.py
6,307
Python
-*- coding: utf-8 -*- github-cli documentation build configuration file, created by sphinx-quickstart on Tue May 5 17:40:34 2009. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.append(os.path.abspath('.')) -- General configuration ----------------------------------------------------- Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files.source_encoding = 'utf-8' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages.language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of documents that shouldn't be included in the build.unused_docs = [] List of directories, relative to source directory, that shouldn't be searched for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] -- Options for HTML output --------------------------------------------------- The theme to use for HTML and HTML Help pages. Major themes that come with Sphinx are currently 'default' and 'sphinxdoc'. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_use_modindex = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = '' Output file base name for HTML help builder. -- Options for LaTeX output -------------------------------------------------- The paper size ('letter' or 'a4').latex_paper_size = 'letter' The font size ('10pt', '11pt' or '12pt').latex_font_size = '10pt' Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto/manual]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False Additional stuff for the LaTeX preamble.latex_preamble = '' Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_use_modindex = True
5,552
0.880292
# -*- coding: utf-8 -*- # # Political Dynamics documentation build configuration file, created by # sphinx-quickstart. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Political Dynamics' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.1' # The full version, including alpha/beta/rc tags. release = '0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'political-dynamicsdoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'political-dynamics.tex', u'Political Dynamics Documentation', u"Arya D. McCarthy", 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'political-dynamics', u'Political Dynamics Documentation', [u"Arya D. McCarthy"], 1) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'political-dynamics', u'Political Dynamics Documentation', u"Arya D. McCarthy", 'Political Dynamics', 'A differential equations perspective on American National Election Studies (ANES) over time.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote'
32.420408
127
0.709178
[ "MIT" ]
aryamccarthy/ANES
docs/conf.py
7,943
Python
-*- coding: utf-8 -*- Political Dynamics documentation build configuration file, created by sphinx-quickstart. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('.')) -- General configuration ----------------------------------------------------- If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files. source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used: today = '' Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents. default_role = None If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::). add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default. show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting. modindex_common_prefix = [] -- Options for HTML output --------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation. html_theme_options = {} Add any paths that contain custom themes here, relative to this directory. html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation". html_title = None A shorter title for the navigation bar. Default is the same as html_title. html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar. html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large. html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format. html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities. html_use_smartypants = True Custom sidebar templates, maps document names to template names. html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names. html_additional_pages = {} If false, no module index is generated. html_domain_indices = True If false, no index is generated. html_use_index = True If true, the index is split into individual pages for each letter. html_split_index = False If true, links to the reST sources are added to the pages. html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served. html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml"). html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output -------------------------------------------------- The paper size ('letterpaper' or 'a4paper'). 'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt'). 'pointsize': '10pt', Additional stuff for the LaTeX preamble. 'preamble': '', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto/manual]). The name of an image file (relative to this directory) to place at the top of the title page. latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters. latex_use_parts = False If true, show page references after internal links. latex_show_pagerefs = False If true, show URL addresses after external links. latex_show_urls = False Documents to append as an appendix to all manuals. latex_appendices = [] If false, no module index is generated. latex_domain_indices = True -- Options for manual page output -------------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links. man_show_urls = False -- Options for Texinfo output ------------------------------------------------ Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals. texinfo_appendices = [] If false, no module index is generated. texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'. texinfo_show_urls = 'footnote'
6,666
0.83923
"""This module contains wunderkafka producer's boilerplate."""
31.5
62
0.777778
[ "Apache-2.0" ]
severstal-digital/wunderkafka
wunderkafka/producers/__init__.py
63
Python
This module contains wunderkafka producer's boilerplate.
56
0.888889
#for fixture loading
10.5
20
0.809524
[ "BSD-2-Clause" ]
chalkchisel/django-rest-framework
examples/permissionsexample/models.py
21
Python
for fixture loading
19
0.904762
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # ============================================================================ # # Project : Airbnb # # Version : 0.1.0 # # File : split_names.py # # Python : 3.8.0 # # ---------------------------------------------------------------------------- # # Author : John James # # Company: DecisionScients # # Email : jjames@decisionscients.com # # ---------------------------------------------------------------------------- # # Created : Tuesday, 7th January 2020 10:22:44 am # # Last Modified: Tuesday, 7th January 2020 10:22:44 am # # Modified By : John James (jjames@decisionscients.com>) # # ---------------------------------------------------------------------------- # # License: BSD # # Copyright (c) 2020 DecisionScients # # ============================================================================ # #%% import os directory = "./data/raw/" filenames = os.listdir(directory) for filename in filenames: name = filename.split(".")[0] print(name) # %%
52.7
80
0.253004
[ "BSD-3-Clause" ]
decisionscients/Airbnb
src/lab/split_names.py
1,581
Python
!/usr/bin/env python3 -*- coding:utf-8 -*- ============================================================================ Project : Airbnb Version : 0.1.0 File : split_names.py Python : 3.8.0 ---------------------------------------------------------------------------- Author : John James Company: DecisionScients Email : jjames@decisionscients.com ---------------------------------------------------------------------------- Created : Tuesday, 7th January 2020 10:22:44 am Last Modified: Tuesday, 7th January 2020 10:22:44 am Modified By : John James (jjames@decisionscients.com>) ---------------------------------------------------------------------------- License: BSD Copyright (c) 2020 DecisionScients ============================================================================ %% %%
1,373
0.868438
# Copyright 2021 Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # (MIT License) from bos.operators.utils import PROTOCOL API_VERSION = 'v1' SERVICE_NAME = 'cray-bos' ENDPOINT = "%s://%s/%s" % (PROTOCOL, SERVICE_NAME, API_VERSION)
47.62963
76
0.773717
[ "MIT" ]
Cray-HPE/bos
src/bos/operators/utils/clients/bos/__init__.py
1,286
Python
Copyright 2021 Hewlett Packard Enterprise Development LP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. (MIT License)
1,092
0.849145
"""BackPACK extensions/hooks for computing low-rank factors of the GGN."""
37.5
74
0.76
[ "MIT" ]
PwLo3K46/vivit
vivit/extensions/secondorder/__init__.py
75
Python
BackPACK extensions/hooks for computing low-rank factors of the GGN.
68
0.906667
# Character field ID when accessed: 100000201 # ParentID: 32226 # ObjectID: 0
19.5
45
0.75641
[ "MIT" ]
doriyan13/doristory
scripts/quest/autogen_q32226s.py
78
Python
Character field ID when accessed: 100000201 ParentID: 32226 ObjectID: 0
71
0.910256
""" Conjuntos são chamados de set's - Set não possui duplicidade - Set não possui valor ordenado - Não são acessados via indice, ou seja, não são indexados Bons para armazenar elementos são ordenação, sem se preocupar com chaves, valores e itens duplicados. Set's são referenciados por {} Diferença de set e dict - Dict tem chave:valor - Set tem apenas valor --------------------------------------------------------------------------------------------------------------------- # DEFENINDO SET # Forma 1 s = set ({1, 2, 3, 4, 5, 4, 5, 2, 1}) # valores duplicados print(type(s)) print(s) # OBS.: Ao criar um set, se uma valor estiver repetido, ele é ignorado, sem gerar erro. # Forma 2 - Mais comum set = {1, 2, 3, 4, 5, 4, 5, 2, 1} # valores duplicados print(type(set)) print(set) # Sem valores duplicados e sem ordenação entre eles # Pode-se colocar todos os tipos de dados --------------------------------------------------------------------------------------------------------------------- # PODE-SE ITERAR SOBRE UM SET set = {1, 2, 3, 4, 5, 4, 5, 2, 1} for valor in set: print(valor) --------------------------------------------------------------------------------------------------------------------- # USOS INTERESSANTES COM SET'S # Imagine que fizemos um formulario de cadastro de visitantes em um museu, onde as pessoas informam manualmente # sua cidade de origem # Nos adicionamos cada cidade em uma lista Python, ja que em lista pode-se adicionar novos elementos e ter repetição cidade = ['Lavras', 'Bagé', 'Caçapava', 'Lavras', 'Bagé'] print(type(cidade)) print(cidade) print(len(cidade)) # para saber quantos visitantes teve print(len(set(cidade))) # para saber quantas cidades distintas foram visitar --------------------------------------------------------------------------------------------------------------------- # ADICIONANDO ELEMENTOS EM UM SET s = {1, 2, 3} s.add(4) print(s) --------------------------------------------------------------------------------------------------------------------- # REMOVANDO ELEMENTOS DE UM SET # Forma 1 conj = {1, 2, 3} conj.remove(3) # se tentar remover um valor que não existe, gera um erro. print(conj) # Forma 2 conj.discard(2) # se o elemento não existir, não vai gerar erro print(conj) --------------------------------------------------------------------------------------------------------------------- # COPIANDO UM SET PARA OUTRO conj = {1, 2, 3} # Forma 1 - Deep Copy (o novo conjunto fica independente) novo = conj.copy() print(novo) novo.add(4) print(conj, novo) # Forma 2 - Shallow Copy (o novo conjunto fica interligado ao primeiro) novo2 = conj print(novo2) novo2.add(5) print(conj, novo2) --------------------------------------------------------------------------------------------------------------------- # REMOVER TODOS OS DADOS DE UM SET conj = {1, 2, 3} conj.clear() print(conj) --------------------------------------------------------------------------------------------------------------------- # METODOS MATEMÁTICOS DE CONJUNTOS # Dois conjuntos de estudantes, Python e Java. python = {'Paulo', 'Luis', 'Marcos', 'Camila', 'Ana'} java = {'Paulo', 'Fernando', 'Antonio', 'Joao', 'Ana'} # Precisamos juntar em um set, os alunos dos dois cursos, mas apenas nomes únicos # Forma 1 - usando union unicos = python.union(java) print(unicos) # Forma 2 - Usando o caracter pipe "|" unicos2 = python|java print(unicos2) --------------------------------------------------------------------------------------------------------------------- # GERANDO SET DE ESTUDANTES QUE ESTÃO NOS DOIS CURSOS python = {'Paulo', 'Luis', 'Marcos', 'Camila', 'Ana'} java = {'Paulo', 'Fernando', 'Antonio', 'Joao', 'Ana'} # Forma 1 - usando intersection ambos = python.intersection(java) print(ambos) # Forma 2 - usando & ambos2 = python & java print(ambos2) --------------------------------------------------------------------------------------------------------------------- # GERAR SET DE ESTUDANTES QUE ESTÃ EM UM CURSO, MAS QUE NÃO ESTÃO NO OUTRO python = {'Paulo', 'Luis', 'Marcos', 'Camila', 'Ana'} java = {'Paulo', 'Fernando', 'Antonio', 'Joao', 'Ana'} so_python = python.difference(java) print(so_python) --------------------------------------------------------------------------------------------------------------------- # SOMA*, MÁXIMO*, MÍNIMO*, TAMANHO. # * -> somente valores inteiros ou float conj = {1, 2, 3, 4, 5} print(sum(conj)) print(max(conj)) print(min(conj)) print(len(conj)) --------------------------------------------------------------------------------------------------------------------- """
31.863014
117
0.479364
[ "MIT" ]
PauloFTeixeira/curso_python
Secao7_ColecoesPython/Conjutos.py
4,683
Python
Conjuntos são chamados de set's - Set não possui duplicidade - Set não possui valor ordenado - Não são acessados via indice, ou seja, não são indexados Bons para armazenar elementos são ordenação, sem se preocupar com chaves, valores e itens duplicados. Set's são referenciados por {} Diferença de set e dict - Dict tem chave:valor - Set tem apenas valor --------------------------------------------------------------------------------------------------------------------- # DEFENINDO SET # Forma 1 s = set ({1, 2, 3, 4, 5, 4, 5, 2, 1}) # valores duplicados print(type(s)) print(s) # OBS.: Ao criar um set, se uma valor estiver repetido, ele é ignorado, sem gerar erro. # Forma 2 - Mais comum set = {1, 2, 3, 4, 5, 4, 5, 2, 1} # valores duplicados print(type(set)) print(set) # Sem valores duplicados e sem ordenação entre eles # Pode-se colocar todos os tipos de dados --------------------------------------------------------------------------------------------------------------------- # PODE-SE ITERAR SOBRE UM SET set = {1, 2, 3, 4, 5, 4, 5, 2, 1} for valor in set: print(valor) --------------------------------------------------------------------------------------------------------------------- # USOS INTERESSANTES COM SET'S # Imagine que fizemos um formulario de cadastro de visitantes em um museu, onde as pessoas informam manualmente # sua cidade de origem # Nos adicionamos cada cidade em uma lista Python, ja que em lista pode-se adicionar novos elementos e ter repetição cidade = ['Lavras', 'Bagé', 'Caçapava', 'Lavras', 'Bagé'] print(type(cidade)) print(cidade) print(len(cidade)) # para saber quantos visitantes teve print(len(set(cidade))) # para saber quantas cidades distintas foram visitar --------------------------------------------------------------------------------------------------------------------- # ADICIONANDO ELEMENTOS EM UM SET s = {1, 2, 3} s.add(4) print(s) --------------------------------------------------------------------------------------------------------------------- # REMOVANDO ELEMENTOS DE UM SET # Forma 1 conj = {1, 2, 3} conj.remove(3) # se tentar remover um valor que não existe, gera um erro. print(conj) # Forma 2 conj.discard(2) # se o elemento não existir, não vai gerar erro print(conj) --------------------------------------------------------------------------------------------------------------------- # COPIANDO UM SET PARA OUTRO conj = {1, 2, 3} # Forma 1 - Deep Copy (o novo conjunto fica independente) novo = conj.copy() print(novo) novo.add(4) print(conj, novo) # Forma 2 - Shallow Copy (o novo conjunto fica interligado ao primeiro) novo2 = conj print(novo2) novo2.add(5) print(conj, novo2) --------------------------------------------------------------------------------------------------------------------- # REMOVER TODOS OS DADOS DE UM SET conj = {1, 2, 3} conj.clear() print(conj) --------------------------------------------------------------------------------------------------------------------- # METODOS MATEMÁTICOS DE CONJUNTOS # Dois conjuntos de estudantes, Python e Java. python = {'Paulo', 'Luis', 'Marcos', 'Camila', 'Ana'} java = {'Paulo', 'Fernando', 'Antonio', 'Joao', 'Ana'} # Precisamos juntar em um set, os alunos dos dois cursos, mas apenas nomes únicos # Forma 1 - usando union unicos = python.union(java) print(unicos) # Forma 2 - Usando o caracter pipe "|" unicos2 = python|java print(unicos2) --------------------------------------------------------------------------------------------------------------------- # GERANDO SET DE ESTUDANTES QUE ESTÃO NOS DOIS CURSOS python = {'Paulo', 'Luis', 'Marcos', 'Camila', 'Ana'} java = {'Paulo', 'Fernando', 'Antonio', 'Joao', 'Ana'} # Forma 1 - usando intersection ambos = python.intersection(java) print(ambos) # Forma 2 - usando & ambos2 = python & java print(ambos2) --------------------------------------------------------------------------------------------------------------------- # GERAR SET DE ESTUDANTES QUE ESTÃ EM UM CURSO, MAS QUE NÃO ESTÃO NO OUTRO python = {'Paulo', 'Luis', 'Marcos', 'Camila', 'Ana'} java = {'Paulo', 'Fernando', 'Antonio', 'Joao', 'Ana'} so_python = python.difference(java) print(so_python) --------------------------------------------------------------------------------------------------------------------- # SOMA*, MÁXIMO*, MÍNIMO*, TAMANHO. # * -> somente valores inteiros ou float conj = {1, 2, 3, 4, 5} print(sum(conj)) print(max(conj)) print(min(conj)) print(len(conj)) ---------------------------------------------------------------------------------------------------------------------
4,643
0.998065
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- project = 'monetdbe' copyright = '2021, MonetDB Solutions' author = 'Niels Nes' # The full version, including alpha/beta/rc tags release = '0.1' # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] # This is needed to keep readthedocs happy master_doc = 'index' # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'alabaster' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static']
33.169492
79
0.666326
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
MonetDB/MonetDB
documentation/monetdbe/conf.py
1,957
Python
Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html -- Path setup -------------------------------------------------------------- If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. import os import sys sys.path.insert(0, os.path.abspath('.')) -- Project information ----------------------------------------------------- The full version, including alpha/beta/rc tags -- General configuration --------------------------------------------------- Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. This pattern also affects html_static_path and html_extra_path. This is needed to keep readthedocs happy -- Options for HTML output ------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css".
1,634
0.834951
from abaqusConstants import * from .BoundaryConditionState import BoundaryConditionState class DisplacementBaseMotionBCState(BoundaryConditionState): """The DisplacementBaseMotionBCState object stores the propagating data for a velocity base motion boundary condition in a step. One instance of this object is created internally by the DisplacementBaseMotionBC object for each step. The instance is also deleted internally by the DisplacementBaseMotionBC object. The DisplacementBaseMotionBCState object has no constructor or methods. The DisplacementBaseMotionBCState object is derived from the BoundaryConditionState object. Attributes ---------- amplitudeState: SymbolicConstant A SymbolicConstant specifying the propagation state of the amplitude reference. Possible values are UNSET, SET, UNCHANGED, FREED, and MODIFIED. status: SymbolicConstant A SymbolicConstant specifying the propagation state of the :py:class:`~abaqus.BoundaryCondition.BoundaryConditionState.BoundaryConditionState` object. Possible values are: NOT_YET_ACTIVE CREATED PROPAGATED MODIFIED DEACTIVATED NO_LONGER_ACTIVE TYPE_NOT_APPLICABLE INSTANCE_NOT_APPLICABLE PROPAGATED_FROM_BASE_STATE MODIFIED_FROM_BASE_STATE DEACTIVATED_FROM_BASE_STATE BUILT_INTO_MODES amplitude: str A String specifying the name of the amplitude reference. The String is empty if the boundary condition has no amplitude reference. Notes ----- This object can be accessed by: .. code-block:: python import load mdb.models[name].steps[name].boundaryConditionStates[name] The corresponding analysis keywords are: - BASE MOTION """ # A SymbolicConstant specifying the propagation state of the amplitude reference. Possible # values are UNSET, SET, UNCHANGED, FREED, and MODIFIED. amplitudeState: SymbolicConstant = None # A SymbolicConstant specifying the propagation state of the BoundaryConditionState object. Possible values are: # NOT_YET_ACTIVE # CREATED # PROPAGATED # MODIFIED # DEACTIVATED # NO_LONGER_ACTIVE # TYPE_NOT_APPLICABLE # INSTANCE_NOT_APPLICABLE # PROPAGATED_FROM_BASE_STATE # MODIFIED_FROM_BASE_STATE # DEACTIVATED_FROM_BASE_STATE # BUILT_INTO_MODES status: SymbolicConstant = None # A String specifying the name of the amplitude reference. The String is empty if the # boundary condition has no amplitude reference. amplitude: str = ''
35.756757
179
0.733182
[ "MIT" ]
Haiiliin/PyAbaqus
src/abaqus/BoundaryCondition/DisplacementBaseMotionBCState.py
2,646
Python
The DisplacementBaseMotionBCState object stores the propagating data for a velocity base motion boundary condition in a step. One instance of this object is created internally by the DisplacementBaseMotionBC object for each step. The instance is also deleted internally by the DisplacementBaseMotionBC object. The DisplacementBaseMotionBCState object has no constructor or methods. The DisplacementBaseMotionBCState object is derived from the BoundaryConditionState object. Attributes ---------- amplitudeState: SymbolicConstant A SymbolicConstant specifying the propagation state of the amplitude reference. Possible values are UNSET, SET, UNCHANGED, FREED, and MODIFIED. status: SymbolicConstant A SymbolicConstant specifying the propagation state of the :py:class:`~abaqus.BoundaryCondition.BoundaryConditionState.BoundaryConditionState` object. Possible values are: NOT_YET_ACTIVE CREATED PROPAGATED MODIFIED DEACTIVATED NO_LONGER_ACTIVE TYPE_NOT_APPLICABLE INSTANCE_NOT_APPLICABLE PROPAGATED_FROM_BASE_STATE MODIFIED_FROM_BASE_STATE DEACTIVATED_FROM_BASE_STATE BUILT_INTO_MODES amplitude: str A String specifying the name of the amplitude reference. The String is empty if the boundary condition has no amplitude reference. Notes ----- This object can be accessed by: .. code-block:: python import load mdb.models[name].steps[name].boundaryConditionStates[name] The corresponding analysis keywords are: - BASE MOTION A SymbolicConstant specifying the propagation state of the amplitude reference. Possible values are UNSET, SET, UNCHANGED, FREED, and MODIFIED. A SymbolicConstant specifying the propagation state of the BoundaryConditionState object. Possible values are: NOT_YET_ACTIVE CREATED PROPAGATED MODIFIED DEACTIVATED NO_LONGER_ACTIVE TYPE_NOT_APPLICABLE INSTANCE_NOT_APPLICABLE PROPAGATED_FROM_BASE_STATE MODIFIED_FROM_BASE_STATE DEACTIVATED_FROM_BASE_STATE BUILT_INTO_MODES A String specifying the name of the amplitude reference. The String is empty if the boundary condition has no amplitude reference.
2,117
0.800076
''' This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de). PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PM4Py is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>. ''' from pm4py.visualization.decisiontree import variants, visualizer
43.555556
76
0.741071
[ "MIT" ]
Malekhy/ws2122-lspm
ws2122-lspm/Lib/site-packages/pm4py/visualization/decisiontree/__init__.py
784
Python
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de). PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PM4Py is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
665
0.848214
# -*- coding: utf-8 -*- # # ns-3 documentation build configuration file, created by # sphinx-quickstart on Tue Dec 14 09:00:39 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.pngmath'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'ns-3' copyright = u'2011, ns-3 project' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = 'ns-3-dev' # The full version, including alpha/beta/rc tags. release = 'ns-3-dev' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'ns-3doc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'ns-3-model-library.tex', u'ns-3 Model Library', u'ns-3 project', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'ns-3-model-library', u'ns-3 Model Library', [u'ns-3 project'], 1) ]
32.267281
80
0.716938
[ "BSD-3-Clause" ]
maxvonhippel/snake
ns-3-dev/doc/models/source/conf.py
7,002
Python
-*- coding: utf-8 -*- ns-3 documentation build configuration file, created by sphinx-quickstart on Tue Dec 14 09:00:39 2010. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ----------------------------------------------------- If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages.language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] -- Options for HTML output --------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output -------------------------------------------------- The paper size ('letter' or 'a4').latex_paper_size = 'letter' The font size ('10pt', '11pt' or '12pt').latex_font_size = '10pt' Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto/manual]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Additional stuff for the LaTeX preamble.latex_preamble = '' Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output -------------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section).
6,102
0.871465
#coding:utf-8 # # id: bugs.core_5275 # title: CORE-5275: Expression index may become inconsistent if CREATE INDEX was interrupted after b-tree creation but before commiting # decription: # This test (and CORE- ticket) has been created after wrong initial implementation of test for CORE-1746. # Scenario: # 1. ISQL_1 is launched as child async. process, inserts 1000 rows and then falls in pause (delay) ~10 seconds; # 2. ISQL_2 is launched as child async. process in Tx = WAIT, tries to create index on the table which is handled # by ISQL_1 and immediatelly falls in pause because of waiting for table lock. # 3. ISQL_3 is launched in SYNC mode and does 'DELETE FROM MON$ATTACHMENTS' thus forcing other attachments to be # closed with raising 00803/connection shutdown. # 4. Repeat step 1. On WI-T4.0.0.258 this step lead to: # "invalid SEND request (167), file: JrdStatement.cpp line: 325", 100% reproducilbe. # # Checked on WI-V2.5.6.27017 (SC), WI-V3.0.1.32539 (SS/SC/CS), WI-T4.0.0.262 (SS) - works fine. # # Beside above mentioned steps, we also: # 1) compare content of old/new firebird.log (difference): it should NOT contain line "consistency check"; # 2) run database online validation: it should NOT report any error in the database. # # :::::::::::::::::::::::::::::::::::::::: NB :::::::::::::::::::::::::::::::::::: # 18.08.2020. FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020): # statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus next call # gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1. # See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d # :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt # # Because of this, it was decided to replace 'alter sequence restart...' with subtraction of two gen values: # c = gen_id(<g>, -gen_id(<g>, 0)) -- see procedure sp_restart_sequences. # # Checked on: # 4.0.0.2164 SS: 15.932s. # 4.0.0.2119 SS: 16.141s. # 4.0.0.2164 CS: 17.549s. # 3.0.7.33356 SS: 17.446s. # 3.0.7.33356 CS: 18.321s. # 2.5.9.27150 SC: 13.768s. # # tracker_id: CORE-5275 # min_versions: ['2.5.6'] # versions: 2.5.6 # qmid: None import pytest from firebird.qa import db_factory, isql_act, Action # version: 2.5.6 # resources: None substitutions_1 = [('0: CREATE INDEX LOG: RDB_EXPR_BLOB.*', '0: CREATE INDEX LOG: RDB_EXPR_BLOB'), ('BULK_INSERT_START.*', 'BULK_INSERT_START'), ('.*KILLED BY DATABASE ADMINISTRATOR.*', ''), ('BULK_INSERT_FINISH.*', 'BULK_INSERT_FINISH'), ('CREATE_INDX_START.*', 'CREATE_INDX_START'), ('AFTER LINE.*', 'AFTER LINE'), ('RECORDS AFFECTED:.*', 'RECORDS AFFECTED:'), ('[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9]', ''), ('RELATION [0-9]{3,4}', 'RELATION')] init_script_1 = """""" db_1 = db_factory(sql_dialect=3, init=init_script_1) # test_script_1 #--- # import os # import time # import difflib # import subprocess # # os.environ["ISC_USER"] = user_name # os.environ["ISC_PASSWORD"] = user_password # db_file=db_conn.database_name # engine =str(db_conn.engine_version) # # db_conn.close() # # #-------------------------------------------- # # def flush_and_close(file_handle): # # https://docs.python.org/2/library/os.html#os.fsync # # If you're starting with a Python file object f, # # first do f.flush(), and # # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk. # global os # # file_handle.flush() # if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull: # # otherwise: "OSError: [Errno 9] Bad file descriptor"! # os.fsync(file_handle.fileno()) # file_handle.close() # # #-------------------------------------------- # # def cleanup( f_names_list ): # global os # for i in range(len( f_names_list )): # if type(f_names_list[i]) == file: # del_name = f_names_list[i].name # elif type(f_names_list[i]) == str: # del_name = f_names_list[i] # else: # print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.') # del_name = None # # if del_name and os.path.isfile( del_name ): # os.remove( del_name ) # # #-------------------------------------------- # # def svc_get_fb_log( engine, f_fb_log ): # # import subprocess # # if engine.startswith('2.5'): # get_firebird_log_key='action_get_ib_log' # else: # get_firebird_log_key='action_get_fb_log' # # # C:\\MIX # irebird\\oldfb251in # bsvcmgr localhost:service_mgr -user sysdba -password masterkey action_get_ib_log # subprocess.call([ context['fbsvcmgr_path'], # "localhost:service_mgr", # get_firebird_log_key # ], # stdout=f_fb_log, stderr=subprocess.STDOUT # ) # # return # # sql_ddl=''' # create or alter procedure sp_ins(n int) as begin end; # # recreate table test(x int unique using index test_x, s varchar(10) default 'qwerty' ); # # set term ^; # execute block as # begin # execute statement 'drop sequence g'; # when any do begin end # end # ^ # set term ;^ # commit; # create sequence g; # commit; # # set term ^; # create or alter procedure sp_ins(n int) as # begin # while (n>0) do # begin # insert into test( x ) values( gen_id(g,1) ); # n = n - 1; # end # end # ^ # set term ;^ # commit; # ''' # runProgram('isql',[dsn],sql_ddl) # # f_fblog_before=open( os.path.join(context['temp_directory'],'tmp_5275_fblog_before.txt'), 'w') # svc_get_fb_log( engine, f_fblog_before ) # flush_and_close( f_fblog_before ) # # ######################################################### # # rows_to_add=1000 # # sql_bulk_insert=''' set bail on; # set list on; # # -- DISABLED 19.08.2020: alter sequence g restart with 0; # # delete from test; # commit; # set transaction lock timeout 10; -- THIS LOCK TIMEOUT SERVES ONLY FOR DELAY, see below auton Tx start. # # select current_timestamp as bulk_insert_start from rdb$database; # set term ^; # execute block as # declare i int; # begin # i = gen_id(g, -gen_id(g, 0)); -- restart sequence, since 19.08.2020 # execute procedure sp_ins( %(rows_to_add)s ); # begin # -- ######################################################### # -- ####################### D E L A Y ##################### # -- ######################################################### # in autonomous transaction do # insert into test( x ) values( %(rows_to_add)s ); -- this will cause delay because of duplicate in index # when any do # begin # i = gen_id(g,1); # end # end # end # ^ # set term ;^ # commit; # select current_timestamp as bulk_insert_finish from rdb$database; # ''' # # sql_create_indx=''' set bail on; # set list on; # set blob all; # select # iif( gen_id(g,0) > 0 and gen_id(g,0) < 1 + %(rows_to_add)s, # 'OK, IS RUNNING', # iif( gen_id(g,0) <=0, # 'WRONG: not yet started, current gen_id='||gen_id(g,0), # 'WRONG: already finished, rows_to_add='||%(rows_to_add)s ||', current gen_id='||gen_id(g,0) # ) # ) as inserts_state, # current_timestamp as create_indx_start # from rdb$database; # set autoddl off; # commit; # # set echo on; # set transaction %(tx_decl)s; # # create index test_%(idx_name)s on test computed by( %(idx_expr)s ); # set echo off; # commit; # # select # iif( gen_id(g,0) >= 1 + %(rows_to_add)s, # 'OK, FINISHED', # 'SOMETHING WRONG: current gen_id=' || gen_id(g,0)||', rows_to_add='||%(rows_to_add)s # ) as inserts_state # from rdb$database; # # set count on; # select # rdb$index_name # ,coalesce(rdb$unique_flag,0) as rdb$unique_flag # ,coalesce(rdb$index_inactive,0) as rdb$index_inactive # ,rdb$expression_source as rdb_expr_blob # from rdb$indices ri # where ri.rdb$index_name = upper( 'test_%(idx_name)s' ) # ; # set count off; # set echo on; # set plan on; # select 1 from test where %(idx_expr)s > '' rows 0; # set plan off; # set echo off; # commit; # drop index test_%(idx_name)s; # commit; # ''' # # sql_kill_att=''' set count on; # set list on; # commit; # delete from mon$attachments where mon$attachment_id<>current_connection; # ''' # # f_kill_att_sql = open( os.path.join(context['temp_directory'],'tmp_5275_kill_att.sql' ), 'w') # f_kill_att_sql.write( sql_kill_att ) # flush_and_close( f_kill_att_sql ) # # tx_param=['WAIT','WAIT'] # # for i in range(len(tx_param)): # # f_bulk_insert_sql = open( os.path.join(context['temp_directory'],'tmp_5275_ins.sql'), 'w') # f_bulk_insert_sql.write(sql_bulk_insert % locals() ) # flush_and_close( f_bulk_insert_sql ) # # tx_decl=tx_param[i] # idx_name=tx_decl.replace(' ','_') # idx_expr="'"+idx_name+"'|| s" # # f_create_indx_sql = open( os.path.join(context['temp_directory'],'tmp_5275_idx_%s.sql' % str(i) ), 'w') # f_create_indx_sql.write( sql_create_indx % locals() ) # flush_and_close( f_create_indx_sql ) # # f_bulk_insert_log = open( os.path.join(context['temp_directory'],'tmp_5275_ins_%s.log' % str(i) ), 'w') # f_create_indx_log = open( os.path.join(context['temp_directory'],'tmp_5275_idx_%s.log' % str(i) ), 'w') # # p_bulk_insert=subprocess.Popen( [context['isql_path'], dsn, "-q", "-i", f_bulk_insert_sql.name ], # stdout = f_bulk_insert_log, # stderr = subprocess.STDOUT # ) # # # 3.0 Classic: seems that it requires at least 2 seconds for ISQL be loaded into memory. # time.sleep(2) # # p_create_indx=subprocess.Popen( [context['isql_path'], dsn, "-q", "-i", f_create_indx_sql.name ], # stdout = f_create_indx_log, # stderr = subprocess.STDOUT # ) # time.sleep(2) # # f_kill_att_log = open( os.path.join(context['temp_directory'],'tmp_5275_kill_att.log' ), 'w') # # subprocess.call( [context['isql_path'], dsn, "-q", "-i", f_kill_att_sql.name ], # stdout = f_kill_att_log, # stderr = subprocess.STDOUT # ) # flush_and_close( f_kill_att_log ) # # # 11.05.2017, FB 4.0 only! # # Following messages can appear after 'connection shutdown' # # (letter from dimitr, 08-may-2017 20:41): # # isc_att_shut_killed: Killed by database administrator # # isc_att_shut_idle: Idle timeout expired # # isc_att_shut_db_down: Database is shutdown # # isc_att_shut_engine: Engine is shutdown # # # do NOT remove this delay, otherwise ISQL logs in 2.5.x will contain NO text with error message # # STATEMENT FAILED, SQLSTATE = 08003 / CONNECTION SHUTDOWN: # time.sleep(1) # # p_create_indx.terminate() # p_bulk_insert.terminate() # # flush_and_close( f_bulk_insert_log ) # flush_and_close( f_create_indx_log ) # # with open( f_bulk_insert_log.name,'r') as f: # for line in f: # if line.split(): # print( str(i)+': BULK INSERTS LOG: '+line.strip().upper() ) # # with open( f_create_indx_log.name,'r') as f: # for line in f: # if line.split(): # print( str(i)+': CREATE INDEX LOG: '+line.strip().upper() ) # # with open( f_kill_att_log.name,'r') as f: # for line in f: # if line.split(): # print( str(i)+': KILL ATTACH LOG: '+line.upper() ) # # # cleanup (nitermediate): # ######### # time.sleep(1) # cleanup( (f_bulk_insert_sql, f_create_indx_sql, f_bulk_insert_log, f_create_indx_log, f_kill_att_log) ) # # # ------------------------------------------------------------------------------------------ # # f_fblog_after=open( os.path.join(context['temp_directory'],'tmp_5275_fblog_after.txt'), 'w') # svc_get_fb_log( engine, f_fblog_after ) # flush_and_close( f_fblog_after ) # # # Now we can compare two versions of firebird.log and check their difference. # ################################# # # oldfb=open(f_fblog_before.name, 'r') # newfb=open(f_fblog_after.name, 'r') # # difftext = ''.join(difflib.unified_diff( # oldfb.readlines(), # newfb.readlines() # )) # oldfb.close() # newfb.close() # # f_diff_txt=open( os.path.join(context['temp_directory'],'tmp_5275_diff.txt'), 'w') # f_diff_txt.write(difftext) # flush_and_close( f_diff_txt ) # # # This should be empty: # ####################### # with open( f_diff_txt.name,'r') as f: # for line in f: # # internal Firebird consistency check (invalid SEND request (167), file: JrdStatement.cpp line: 325) # if 'consistency check' in line: # print('NEW IN FIREBIRD.LOG: '+line.upper()) # # # #-------------------------------------------------------------------------------------------- # # f_validate_log=open( os.path.join(context['temp_directory'],'tmp_5275_validate.log'), "w") # f_validate_err=open( os.path.join(context['temp_directory'],'tmp_5275_validate.err'), "w") # # subprocess.call([context['fbsvcmgr_path'],"localhost:service_mgr", # "action_validate", # "dbname", "$(DATABASE_LOCATION)bugs.core_5275.fdb" # ], # stdout=f_validate_log, # stderr=f_validate_err) # flush_and_close( f_validate_log ) # flush_and_close( f_validate_err ) # # with open( f_validate_log.name,'r') as f: # for line in f: # if line.split(): # print( 'VALIDATION STDOUT: '+line.upper() ) # # with open( f_validate_err.name,'r') as f: # for line in f: # if line.split(): # print( 'VALIDATION STDERR: '+line.upper() ) # # # cleanup # ######### # time.sleep(1) # cleanup( (f_validate_log, f_validate_err, f_kill_att_sql, f_fblog_before, f_fblog_after, f_diff_txt) ) # #--- #act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1) expected_stdout_1 = """ 0: BULK INSERTS LOG: BULK_INSERT_START 0: BULK INSERTS LOG: STATEMENT FAILED, SQLSTATE = 08003 0: BULK INSERTS LOG: CONNECTION SHUTDOWN 0: BULK INSERTS LOG: AFTER LINE 0: CREATE INDEX LOG: INSERTS_STATE OK, IS RUNNING 0: CREATE INDEX LOG: CREATE_INDX_START 0: CREATE INDEX LOG: SET TRANSACTION WAIT; 0: CREATE INDEX LOG: CREATE INDEX TEST_WAIT ON TEST COMPUTED BY( 'WAIT'|| S ); 0: CREATE INDEX LOG: SET ECHO OFF; 0: CREATE INDEX LOG: STATEMENT FAILED, SQLSTATE = 08003 0: CREATE INDEX LOG: CONNECTION SHUTDOWN 0: CREATE INDEX LOG: AFTER LINE 0: KILL ATTACH LOG: RECORDS AFFECTED: 1: BULK INSERTS LOG: BULK_INSERT_START 1: BULK INSERTS LOG: STATEMENT FAILED, SQLSTATE = 08003 1: BULK INSERTS LOG: CONNECTION SHUTDOWN 1: BULK INSERTS LOG: AFTER LINE 1: CREATE INDEX LOG: INSERTS_STATE OK, IS RUNNING 1: CREATE INDEX LOG: CREATE_INDX_START 1: CREATE INDEX LOG: SET TRANSACTION WAIT; 1: CREATE INDEX LOG: CREATE INDEX TEST_WAIT ON TEST COMPUTED BY( 'WAIT'|| S ); 1: CREATE INDEX LOG: SET ECHO OFF; 1: CREATE INDEX LOG: STATEMENT FAILED, SQLSTATE = 08003 1: CREATE INDEX LOG: CONNECTION SHUTDOWN 1: CREATE INDEX LOG: AFTER LINE 1: KILL ATTACH LOG: RECORDS AFFECTED: VALIDATION STDOUT: 20:05:26.86 VALIDATION STARTED VALIDATION STDOUT: 20:05:26.86 RELATION 128 (TEST) VALIDATION STDOUT: 20:05:26.86 PROCESS POINTER PAGE 0 OF 1 VALIDATION STDOUT: 20:05:26.86 INDEX 1 (TEST_X) VALIDATION STDOUT: 20:05:26.86 RELATION 128 (TEST) IS OK VALIDATION STDOUT: 20:05:26.86 VALIDATION FINISHED """ @pytest.mark.version('>=2.5.6') @pytest.mark.xfail def test_1(db_1): pytest.fail("Test not IMPLEMENTED")
39.711712
452
0.556148
[ "MIT" ]
artyom-smirnov/firebird-qa
tests/bugs/core_5275_test.py
17,632
Python
coding:utf-8 id: bugs.core_5275 title: CORE-5275: Expression index may become inconsistent if CREATE INDEX was interrupted after b-tree creation but before commiting decription: This test (and CORE- ticket) has been created after wrong initial implementation of test for CORE-1746. Scenario: 1. ISQL_1 is launched as child async. process, inserts 1000 rows and then falls in pause (delay) ~10 seconds; 2. ISQL_2 is launched as child async. process in Tx = WAIT, tries to create index on the table which is handled by ISQL_1 and immediatelly falls in pause because of waiting for table lock. 3. ISQL_3 is launched in SYNC mode and does 'DELETE FROM MON$ATTACHMENTS' thus forcing other attachments to be closed with raising 00803/connection shutdown. 4. Repeat step 1. On WI-T4.0.0.258 this step lead to: "invalid SEND request (167), file: JrdStatement.cpp line: 325", 100% reproducilbe. Checked on WI-V2.5.6.27017 (SC), WI-V3.0.1.32539 (SS/SC/CS), WI-T4.0.0.262 (SS) - works fine. Beside above mentioned steps, we also: 1) compare content of old/new firebird.log (difference): it should NOT contain line "consistency check"; 2) run database online validation: it should NOT report any error in the database. :::::::::::::::::::::::::::::::::::::::: NB :::::::::::::::::::::::::::::::::::: 18.08.2020. FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020): statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus next call gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1. See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt Because of this, it was decided to replace 'alter sequence restart...' with subtraction of two gen values: c = gen_id(<g>, -gen_id(<g>, 0)) -- see procedure sp_restart_sequences. Checked on: 4.0.0.2164 SS: 15.932s. 4.0.0.2119 SS: 16.141s. 4.0.0.2164 CS: 17.549s. 3.0.7.33356 SS: 17.446s. 3.0.7.33356 CS: 18.321s. 2.5.9.27150 SC: 13.768s. tracker_id: CORE-5275 min_versions: ['2.5.6'] versions: 2.5.6 qmid: None version: 2.5.6 resources: None test_script_1--- import os import time import difflib import subprocess os.environ["ISC_USER"] = user_name os.environ["ISC_PASSWORD"] = user_password db_file=db_conn.database_name engine =str(db_conn.engine_version) db_conn.close() -------------------------------------------- def flush_and_close(file_handle): https://docs.python.org/2/library/os.htmlos.fsync If you're starting with a Python file object f, first do f.flush(), and then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk. global os file_handle.flush() if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull: otherwise: "OSError: [Errno 9] Bad file descriptor"! os.fsync(file_handle.fileno()) file_handle.close() -------------------------------------------- def cleanup( f_names_list ): global os for i in range(len( f_names_list )): if type(f_names_list[i]) == file: del_name = f_names_list[i].name elif type(f_names_list[i]) == str: del_name = f_names_list[i] else: print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.') del_name = None if del_name and os.path.isfile( del_name ): os.remove( del_name ) -------------------------------------------- def svc_get_fb_log( engine, f_fb_log ): import subprocess if engine.startswith('2.5'): get_firebird_log_key='action_get_ib_log' else: get_firebird_log_key='action_get_fb_log' C:\\MIX irebird\\oldfb251in bsvcmgr localhost:service_mgr -user sysdba -password masterkey action_get_ib_log subprocess.call([ context['fbsvcmgr_path'], "localhost:service_mgr", get_firebird_log_key ], stdout=f_fb_log, stderr=subprocess.STDOUT ) return sql_ddl=''' create or alter procedure sp_ins(n int) as begin end; recreate table test(x int unique using index test_x, s varchar(10) default 'qwerty' ); set term ^; execute block as begin execute statement 'drop sequence g'; when any do begin end end ^ set term ;^ commit; create sequence g; commit; set term ^; create or alter procedure sp_ins(n int) as begin while (n>0) do begin insert into test( x ) values( gen_id(g,1) ); n = n - 1; end end ^ set term ;^ commit; ''' runProgram('isql',[dsn],sql_ddl) f_fblog_before=open( os.path.join(context['temp_directory'],'tmp_5275_fblog_before.txt'), 'w') svc_get_fb_log( engine, f_fblog_before ) flush_and_close( f_fblog_before ) rows_to_add=1000 sql_bulk_insert=''' set bail on; set list on; -- DISABLED 19.08.2020: alter sequence g restart with 0; delete from test; commit; set transaction lock timeout 10; -- THIS LOCK TIMEOUT SERVES ONLY FOR DELAY, see below auton Tx start. select current_timestamp as bulk_insert_start from rdb$database; set term ^; execute block as declare i int; begin i = gen_id(g, -gen_id(g, 0)); -- restart sequence, since 19.08.2020 execute procedure sp_ins( %(rows_to_add)s ); begin -- -- D E L A Y -- in autonomous transaction do insert into test( x ) values( %(rows_to_add)s ); -- this will cause delay because of duplicate in index when any do begin i = gen_id(g,1); end end end ^ set term ;^ commit; select current_timestamp as bulk_insert_finish from rdb$database; ''' sql_create_indx=''' set bail on; set list on; set blob all; select iif( gen_id(g,0) > 0 and gen_id(g,0) < 1 + %(rows_to_add)s, 'OK, IS RUNNING', iif( gen_id(g,0) <=0, 'WRONG: not yet started, current gen_id='||gen_id(g,0), 'WRONG: already finished, rows_to_add='||%(rows_to_add)s ||', current gen_id='||gen_id(g,0) ) ) as inserts_state, current_timestamp as create_indx_start from rdb$database; set autoddl off; commit; set echo on; set transaction %(tx_decl)s; create index test_%(idx_name)s on test computed by( %(idx_expr)s ); set echo off; commit; select iif( gen_id(g,0) >= 1 + %(rows_to_add)s, 'OK, FINISHED', 'SOMETHING WRONG: current gen_id=' || gen_id(g,0)||', rows_to_add='||%(rows_to_add)s ) as inserts_state from rdb$database; set count on; select rdb$index_name ,coalesce(rdb$unique_flag,0) as rdb$unique_flag ,coalesce(rdb$index_inactive,0) as rdb$index_inactive ,rdb$expression_source as rdb_expr_blob from rdb$indices ri where ri.rdb$index_name = upper( 'test_%(idx_name)s' ) ; set count off; set echo on; set plan on; select 1 from test where %(idx_expr)s > '' rows 0; set plan off; set echo off; commit; drop index test_%(idx_name)s; commit; ''' sql_kill_att=''' set count on; set list on; commit; delete from mon$attachments where mon$attachment_id<>current_connection; ''' f_kill_att_sql = open( os.path.join(context['temp_directory'],'tmp_5275_kill_att.sql' ), 'w') f_kill_att_sql.write( sql_kill_att ) flush_and_close( f_kill_att_sql ) tx_param=['WAIT','WAIT'] for i in range(len(tx_param)): f_bulk_insert_sql = open( os.path.join(context['temp_directory'],'tmp_5275_ins.sql'), 'w') f_bulk_insert_sql.write(sql_bulk_insert % locals() ) flush_and_close( f_bulk_insert_sql ) tx_decl=tx_param[i] idx_name=tx_decl.replace(' ','_') idx_expr="'"+idx_name+"'|| s" f_create_indx_sql = open( os.path.join(context['temp_directory'],'tmp_5275_idx_%s.sql' % str(i) ), 'w') f_create_indx_sql.write( sql_create_indx % locals() ) flush_and_close( f_create_indx_sql ) f_bulk_insert_log = open( os.path.join(context['temp_directory'],'tmp_5275_ins_%s.log' % str(i) ), 'w') f_create_indx_log = open( os.path.join(context['temp_directory'],'tmp_5275_idx_%s.log' % str(i) ), 'w') p_bulk_insert=subprocess.Popen( [context['isql_path'], dsn, "-q", "-i", f_bulk_insert_sql.name ], stdout = f_bulk_insert_log, stderr = subprocess.STDOUT ) 3.0 Classic: seems that it requires at least 2 seconds for ISQL be loaded into memory. time.sleep(2) p_create_indx=subprocess.Popen( [context['isql_path'], dsn, "-q", "-i", f_create_indx_sql.name ], stdout = f_create_indx_log, stderr = subprocess.STDOUT ) time.sleep(2) f_kill_att_log = open( os.path.join(context['temp_directory'],'tmp_5275_kill_att.log' ), 'w') subprocess.call( [context['isql_path'], dsn, "-q", "-i", f_kill_att_sql.name ], stdout = f_kill_att_log, stderr = subprocess.STDOUT ) flush_and_close( f_kill_att_log ) 11.05.2017, FB 4.0 only! Following messages can appear after 'connection shutdown' (letter from dimitr, 08-may-2017 20:41): isc_att_shut_killed: Killed by database administrator isc_att_shut_idle: Idle timeout expired isc_att_shut_db_down: Database is shutdown isc_att_shut_engine: Engine is shutdown do NOT remove this delay, otherwise ISQL logs in 2.5.x will contain NO text with error message STATEMENT FAILED, SQLSTATE = 08003 / CONNECTION SHUTDOWN: time.sleep(1) p_create_indx.terminate() p_bulk_insert.terminate() flush_and_close( f_bulk_insert_log ) flush_and_close( f_create_indx_log ) with open( f_bulk_insert_log.name,'r') as f: for line in f: if line.split(): print( str(i)+': BULK INSERTS LOG: '+line.strip().upper() ) with open( f_create_indx_log.name,'r') as f: for line in f: if line.split(): print( str(i)+': CREATE INDEX LOG: '+line.strip().upper() ) with open( f_kill_att_log.name,'r') as f: for line in f: if line.split(): print( str(i)+': KILL ATTACH LOG: '+line.upper() ) cleanup (nitermediate): time.sleep(1) cleanup( (f_bulk_insert_sql, f_create_indx_sql, f_bulk_insert_log, f_create_indx_log, f_kill_att_log) ) ------------------------------------------------------------------------------------------ f_fblog_after=open( os.path.join(context['temp_directory'],'tmp_5275_fblog_after.txt'), 'w') svc_get_fb_log( engine, f_fblog_after ) flush_and_close( f_fblog_after ) Now we can compare two versions of firebird.log and check their difference. oldfb=open(f_fblog_before.name, 'r') newfb=open(f_fblog_after.name, 'r') difftext = ''.join(difflib.unified_diff( oldfb.readlines(), newfb.readlines() )) oldfb.close() newfb.close() f_diff_txt=open( os.path.join(context['temp_directory'],'tmp_5275_diff.txt'), 'w') f_diff_txt.write(difftext) flush_and_close( f_diff_txt ) This should be empty: with open( f_diff_txt.name,'r') as f: for line in f: internal Firebird consistency check (invalid SEND request (167), file: JrdStatement.cpp line: 325) if 'consistency check' in line: print('NEW IN FIREBIRD.LOG: '+line.upper()) -------------------------------------------------------------------------------------------- f_validate_log=open( os.path.join(context['temp_directory'],'tmp_5275_validate.log'), "w") f_validate_err=open( os.path.join(context['temp_directory'],'tmp_5275_validate.err'), "w") subprocess.call([context['fbsvcmgr_path'],"localhost:service_mgr", "action_validate", "dbname", "$(DATABASE_LOCATION)bugs.core_5275.fdb" ], stdout=f_validate_log, stderr=f_validate_err) flush_and_close( f_validate_log ) flush_and_close( f_validate_err ) with open( f_validate_log.name,'r') as f: for line in f: if line.split(): print( 'VALIDATION STDOUT: '+line.upper() ) with open( f_validate_err.name,'r') as f: for line in f: if line.split(): print( 'VALIDATION STDERR: '+line.upper() ) cleanup time.sleep(1) cleanup( (f_validate_log, f_validate_err, f_kill_att_sql, f_fblog_before, f_fblog_after, f_diff_txt) ) ---act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
14,141
0.802008
"""This is a set of tools built up over time for working with Gaussian and QChem input and output.""" ######################################################################## # # # # # This script was written by Thomas Heavey in 2017. # # theavey@bu.edu thomasjheavey@gmail.com # # # # Copyright 2017 Thomas J. Heavey IV # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # # You may obtain a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # # implied. # # See the License for the specific language governing permissions and # # limitations under the License. # # # ######################################################################## pass
61.25
74
0.348105
[ "Apache-2.0" ]
theavey/QM-calc-scripts
gautools/__init__.py
1,715
Python
This is a set of tools built up over time for working with Gaussian and QChem input and output. This script was written by Thomas Heavey in 2017. theavey@bu.edu thomasjheavey@gmail.com Copyright 2017 Thomas J. Heavey IV Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
1,388
0.809329
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative works of this code must retain this # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals.
36.285714
77
0.740157
[ "Apache-2.0" ]
Aniruddha120/qiskit-aqua
test/aqua/operators/__init__.py
508
Python
-*- coding: utf-8 -*- This code is part of Qiskit. (C) Copyright IBM 2018, 2019. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license in the LICENSE.txt file in the root directory of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. Any modifications or derivative works of this code must retain this copyright notice, and modified files need to carry a notice indicating that they have been altered from the originals.
482
0.948819
### # Copyright (c) 2004, Daniel DiPaolo # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions, and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions, and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the author of this software nor the name of # contributors to this software may be used to endorse or promote products # derived from this software without specific prior written consent. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. ### """ Quotegrabs are like IRC sound bites. When someone says something funny, incriminating, stupid, outrageous, ... anything that might be worth remembering, you can grab that quote for that person. With this plugin, you can store many quotes per person and display their most recent quote, as well as see who "grabbed" the quote in the first place. """ import supybot import supybot.world as world # Use this for the version of this plugin. You may wish to put a CVS keyword # in here if you're keeping the plugin in CVS or some similar system. __version__ = "%%VERSION%%" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.authors.strike # This is a dictionary mapping supybot.Author instances to lists of # contributions. __contributors__ = {} from . import config from . import plugin from imp import reload reload(plugin) # In case we're being reloaded. if world.testing: from . import test Class = plugin.Class configure = config.configure # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
40.8
79
0.768854
[ "BSD-3-Clause" ]
Alcheri/Limnoria
plugins/QuoteGrabs/__init__.py
2,652
Python
Quotegrabs are like IRC sound bites. When someone says something funny, incriminating, stupid, outrageous, ... anything that might be worth remembering, you can grab that quote for that person. With this plugin, you can store many quotes per person and display their most recent quote, as well as see who "grabbed" the quote in the first place. Copyright (c) 2004, Daniel DiPaolo All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author of this software nor the name of contributors to this software may be used to endorse or promote products derived from this software without specific prior written consent. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Use this for the version of this plugin. You may wish to put a CVS keyword in here if you're keeping the plugin in CVS or some similar system. XXX Replace this with an appropriate author or supybot.Author instance. This is a dictionary mapping supybot.Author instances to lists of contributions. In case we're being reloaded. vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
2,255
0.850302
# coding: utf-8 """ Velo Payments APIs ## Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor. * **Payment.** A single transfer of funds from a payor to a payee. * **Payout.** A batch of Payments, typically used by a payor to logically group payments (e.g. by business day). Technically there need be no relationship between the payments in a payout - a single payout can contain payments to multiple payees and/or multiple payments to a single payee. * **Sandbox.** An integration environment provided by Velo Payments which offers a similar API experience to the production environment, but all funding and payment events are simulated, along with many other services such as OFAC sanctions list checking. ## Overview The Velo Payments API allows a payor to perform a number of operations. The following is a list of the main capabilities in a natural order of execution: * Authenticate with the Velo platform * Maintain a collection of payees * Query the payor’s current balance of funds within the platform and perform additional funding * Issue payments to payees * Query the platform for a history of those payments This document describes the main concepts and APIs required to get up and running with the Velo Payments platform. It is not an exhaustive API reference. For that, please see the separate Velo Payments API Reference. ## API Considerations The Velo Payments API is REST based and uses the JSON format for requests and responses. Most calls are secured using OAuth 2 security and require a valid authentication access token for successful operation. See the Authentication section for details. Where a dynamic value is required in the examples below, the {token} format is used, suggesting that the caller needs to supply the appropriate value of the token in question (without including the { or } characters). Where curl examples are given, the –d @filename.json approach is used, indicating that the request body should be placed into a file named filename.json in the current directory. Each of the curl examples in this document should be considered a single line on the command-line, regardless of how they appear in print. ## Authenticating with the Velo Platform Once Velo backoffice staff have added your organization as a payor within the Velo platform sandbox, they will create you a payor Id, an API key and an API secret and share these with you in a secure manner. You will need to use these values to authenticate with the Velo platform in order to gain access to the APIs. The steps to take are explained in the following: create a string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529 base64 encode this string. E.g.: NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== create an HTTP **Authorization** header with the value set to e.g. Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== perform the Velo authentication REST call using the HTTP header created above e.g. via curl: ``` curl -X POST \\ -H \"Content-Type: application/json\" \\ -H \"Authorization: Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==\" \\ 'https://api.sandbox.velopayments.com/v1/authenticate?grant_type=client_credentials' ``` If successful, this call will result in a **200** HTTP status code and a response body such as: ``` { \"access_token\":\"19f6bafd-93fd-4747-b229-00507bbc991f\", \"token_type\":\"bearer\", \"expires_in\":1799, \"scope\":\"...\" } ``` ## API access following authentication Following successful authentication, the value of the access_token field in the response (indicated in green above) should then be presented with all subsequent API calls to allow the Velo platform to validate that the caller is authenticated. This is achieved by setting the HTTP Authorization header with the value set to e.g. Bearer 19f6bafd-93fd-4747-b229-00507bbc991f such as the curl example below: ``` -H \"Authorization: Bearer 19f6bafd-93fd-4747-b229-00507bbc991f \" ``` If you make other Velo API calls which require authorization but the Authorization header is missing or invalid then you will get a **401** HTTP status response. # noqa: E501 The version of the OpenAPI document: 2.26.124 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import velo_payments from velo_payments.models.ping import Ping # noqa: E501 from velo_payments.rest import ApiException class TestPing(unittest.TestCase): """Ping unit test stubs""" def setUp(self): pass def tearDown(self): pass def testPing(self): """Test Ping""" # FIXME: construct object with mandatory attributes with example values # model = velo_payments.models.ping.Ping() # noqa: E501 pass if __name__ == '__main__': unittest.main()
134.475
4,651
0.770961
[ "Apache-2.0" ]
velopaymentsapi/velo-python
test/test_ping.py
5,383
Python
Ping unit test stubs Test Ping Velo Payments APIs ## Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor. * **Payment.** A single transfer of funds from a payor to a payee. * **Payout.** A batch of Payments, typically used by a payor to logically group payments (e.g. by business day). Technically there need be no relationship between the payments in a payout - a single payout can contain payments to multiple payees and/or multiple payments to a single payee. * **Sandbox.** An integration environment provided by Velo Payments which offers a similar API experience to the production environment, but all funding and payment events are simulated, along with many other services such as OFAC sanctions list checking. ## Overview The Velo Payments API allows a payor to perform a number of operations. The following is a list of the main capabilities in a natural order of execution: * Authenticate with the Velo platform * Maintain a collection of payees * Query the payor’s current balance of funds within the platform and perform additional funding * Issue payments to payees * Query the platform for a history of those payments This document describes the main concepts and APIs required to get up and running with the Velo Payments platform. It is not an exhaustive API reference. For that, please see the separate Velo Payments API Reference. ## API Considerations The Velo Payments API is REST based and uses the JSON format for requests and responses. Most calls are secured using OAuth 2 security and require a valid authentication access token for successful operation. See the Authentication section for details. Where a dynamic value is required in the examples below, the {token} format is used, suggesting that the caller needs to supply the appropriate value of the token in question (without including the { or } characters). Where curl examples are given, the –d @filename.json approach is used, indicating that the request body should be placed into a file named filename.json in the current directory. Each of the curl examples in this document should be considered a single line on the command-line, regardless of how they appear in print. ## Authenticating with the Velo Platform Once Velo backoffice staff have added your organization as a payor within the Velo platform sandbox, they will create you a payor Id, an API key and an API secret and share these with you in a secure manner. You will need to use these values to authenticate with the Velo platform in order to gain access to the APIs. The steps to take are explained in the following: create a string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529 base64 encode this string. E.g.: NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== create an HTTP **Authorization** header with the value set to e.g. Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== perform the Velo authentication REST call using the HTTP header created above e.g. via curl: ``` curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==" \ 'https://api.sandbox.velopayments.com/v1/authenticate?grant_type=client_credentials' ``` If successful, this call will result in a **200** HTTP status code and a response body such as: ``` { "access_token":"19f6bafd-93fd-4747-b229-00507bbc991f", "token_type":"bearer", "expires_in":1799, "scope":"..." } ``` ## API access following authentication Following successful authentication, the value of the access_token field in the response (indicated in green above) should then be presented with all subsequent API calls to allow the Velo platform to validate that the caller is authenticated. This is achieved by setting the HTTP Authorization header with the value set to e.g. Bearer 19f6bafd-93fd-4747-b229-00507bbc991f such as the curl example below: ``` -H "Authorization: Bearer 19f6bafd-93fd-4747-b229-00507bbc991f " ``` If you make other Velo API calls which require authorization but the Authorization header is missing or invalid then you will get a **401** HTTP status response. # noqa: E501 The version of the OpenAPI document: 2.26.124 Generated by: https://openapi-generator.tech coding: utf-8 noqa: E501 FIXME: construct object with mandatory attributes with example values model = velo_payments.models.ping.Ping() noqa: E501
4,918
0.914296
# The code for this extension is based on https://github.com/ulrobix/sphinxcontrib-contentui
46.5
92
0.806452
[ "Apache-2.0" ]
NivekNey/sparkling-water
doc/src/site/sphinx/extensions/contentui/__init__.py
93
Python
The code for this extension is based on https://github.com/ulrobix/sphinxcontrib-contentui
90
0.967742
# Solution of; # Project Euler Problem 564: Maximal polygons # https://projecteuler.net/problem=564 # # A line segment of length $2n-3$ is randomly split into $n$ segments of # integer length ($n \ge 3$). In the sequence given by this split, the # segments are then used as consecutive sides of a convex $n$-polygon, formed # in such a way that its area is maximal. All of the $\binom{2n-4} {n-1}$ # possibilities for splitting up the initial line segment occur with the same # probability. Let $E(n)$ be the expected value of the area that is obtained # by this procedure. For example, for $n=3$ the only possible split of the # line segment of length $3$ results in three line segments with length $1$, # that form an equilateral triangle with an area of $\frac 1 4 \sqrt{3}$. # Therefore $E(3)=0. 433013$, rounded to $6$ decimal places. For $n=4$ you can # find $4$ different possible splits, each of which is composed of three line # segments with length $1$ and one line segment with length $2$. All of these # splits lead to the same maximal quadrilateral with an area of $\frac 3 4 # \sqrt{3}$, thus $E(4)=1. 299038$, rounded to $6$ decimal places. Let # $S(k)=\displaystyle \sum_{n=3}^k E(n)$. For example, $S(3)=0. 433013$, # $S(4)=1. 732051$, $S(5)=4. 604767$ and $S(10)=66. 955511$, rounded to $6$ # decimal places each. Find $S(50)$, rounded to $6$ decimal places. # # by lcsm29 http://github.com/lcsm29/project-euler import timed def dummy(n): pass if __name__ == '__main__': n = 1000 i = 10000 prob_id = 564 timed.caller(dummy, n, i, prob_id)
44.416667
79
0.68793
[ "MIT" ]
lcsm29/project-euler
py/py_0564_maximal_polygons.py
1,599
Python
Solution of; Project Euler Problem 564: Maximal polygons https://projecteuler.net/problem=564 A line segment of length $2n-3$ is randomly split into $n$ segments of integer length ($n \ge 3$). In the sequence given by this split, the segments are then used as consecutive sides of a convex $n$-polygon, formed in such a way that its area is maximal. All of the $\binom{2n-4} {n-1}$ possibilities for splitting up the initial line segment occur with the same probability. Let $E(n)$ be the expected value of the area that is obtained by this procedure. For example, for $n=3$ the only possible split of the line segment of length $3$ results in three line segments with length $1$, that form an equilateral triangle with an area of $\frac 1 4 \sqrt{3}$. Therefore $E(3)=0. 433013$, rounded to $6$ decimal places. For $n=4$ you can find $4$ different possible splits, each of which is composed of three line segments with length $1$ and one line segment with length $2$. All of these splits lead to the same maximal quadrilateral with an area of $\frac 3 4 \sqrt{3}$, thus $E(4)=1. 299038$, rounded to $6$ decimal places. Let $S(k)=\displaystyle \sum_{n=3}^k E(n)$. For example, $S(3)=0. 433013$, $S(4)=1. 732051$, $S(5)=4. 604767$ and $S(10)=66. 955511$, rounded to $6$ decimal places each. Find $S(50)$, rounded to $6$ decimal places. by lcsm29 http://github.com/lcsm29/project-euler
1,401
0.876173
# -*- coding: utf-8 -*- # # Copyright © 2009-2010 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """ spyderlib.widgets ================= Widgets defined in this module may be used in any other Qt-based application They are also used in Spyder through the Plugin interface (see spyderlib.plugins) """
23.375
77
0.679144
[ "MIT" ]
MarlaJahari/Marve
spyderlib/widgets/__init__.py
375
Python
spyderlib.widgets ================= Widgets defined in this module may be used in any other Qt-based application They are also used in Spyder through the Plugin interface (see spyderlib.plugins) -*- coding: utf-8 -*- Copyright © 2009-2010 Pierre Raybaut Licensed under the terms of the MIT License (see spyderlib/__init__.py for details)
341
0.911765
# -*- coding: utf-8 -*- # Copyright (c) 2014, 2015 Mitch Garnaat # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. __version__ = '0.6.0'
37.294118
74
0.741325
[ "Apache-2.0" ]
BrunoCarrier/kappa
kappa/__init__.py
634
Python
-*- coding: utf-8 -*- Copyright (c) 2014, 2015 Mitch Garnaat Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
582
0.917981
"""FastAPI Project for CodeSpace. https://csdot.ml """
13.75
33
0.690909
[ "Apache-2.0" ]
codespacedot/CodeSpaceAPI
src/__init__.py
55
Python
FastAPI Project for CodeSpace. https://csdot.ml
47
0.854545
""" Global and local Scopes Scopes and Namespaces When an object is assigned to a variable # a = 10 that variable points to some object and we say that the variable (name) is bound to that object That object can be accessed using that name in various parts of our code # ### I can't reference that (a) just anywhere in my code! That variable name and it's binding (name and object) only "exist" in specific parts of our code The porton of code where that name/binding is defined, is called the lexical scope of the variable These bindings are stored in namespaces (each scope has its own namespace) The global scope The global scope is essentially the module scope It spans a single file only There is no concept of a truly global (across all the modules in our app) scope in Python The only exception to this are some of the built=in globally available objects, such as: True False None dict print The built-in global variables can be used anywhere inside our module including inside any function Global scopes are nested inside the built-in scope Built-in Scope Module 1 name spaces Scope name var1 0xA345E space func1 0xFF34A Module 2 Scope name space If I reference a variable name inside a scope and Python does ot find it in that scope's namespace Examples module1.py Python does not find True or print in the current (module/global) scope print(True) So, it looks for them in the enclosing scope -> build-in Finds them there -> True module2.py Python does not find a or print in the current (module/global) scope print(a) So """
29.707692
102
0.626618
[ "Unlicense" ]
minefarmer/deep-Dive-1
.history/my_classes/ScopesClosuresAndDecorators/GlobalLocalScopes_20210709212514.py
1,931
Python
Global and local Scopes Scopes and Namespaces When an object is assigned to a variable # a = 10 that variable points to some object and we say that the variable (name) is bound to that object That object can be accessed using that name in various parts of our code # ### I can't reference that (a) just anywhere in my code! That variable name and it's binding (name and object) only "exist" in specific parts of our code The porton of code where that name/binding is defined, is called the lexical scope of the variable These bindings are stored in namespaces (each scope has its own namespace) The global scope The global scope is essentially the module scope It spans a single file only There is no concept of a truly global (across all the modules in our app) scope in Python The only exception to this are some of the built=in globally available objects, such as: True False None dict print The built-in global variables can be used anywhere inside our module including inside any function Global scopes are nested inside the built-in scope Built-in Scope Module 1 name spaces Scope name var1 0xA345E space func1 0xFF34A Module 2 Scope name space If I reference a variable name inside a scope and Python does ot find it in that scope's namespace Examples module1.py Python does not find True or print in the current (module/global) scope print(True) So, it looks for them in the enclosing scope -> build-in Finds them there -> True module2.py Python does not find a or print in the current (module/global) scope print(a) So
1,902
0.984982
# The MIT License (MIT) # # Copyright (c) 2015-present, vn-crypto # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from .deribit_gateway import DeribitGateway import importlib_metadata __version__ = importlib_metadata.version("vnpy_deribit")
44.75
80
0.783719
[ "MIT" ]
NovelResearchInvestment/vnpy_deribit
vnpy_deribit/__init__.py
1,253
Python
The MIT License (MIT) Copyright (c) 2015-present, vn-crypto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1,080
0.861931
# Copyright (c) 2015 Yubico AB # All rights reserved. # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. import os with open( os.path.join( os.path.dirname(__file__), 'VERSION')) as version_file: version = version_file.read().strip() __version__ = version
40.605263
71
0.755023
[ "BSD-2-Clause" ]
1M15M3/yubikey-manager
ykman/__init__.py
1,543
Python
Copyright (c) 2015 Yubico AB All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1,318
0.85418
# -*- coding: utf-8 -*- # # Copyright (C) 2021 Northwestern University. # # invenio-subjects-mesh is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Version information for invenio-subjects-mesh. This file is imported by ``invenio_subjects_mesh.__init__``, and parsed by ``setup.py``. """ __version__ = '2021.7.13'
25.25
73
0.725248
[ "MIT" ]
fenekku/invenio-subjects-mesh
invenio_subjects_mesh/version.py
404
Python
Version information for invenio-subjects-mesh. This file is imported by ``invenio_subjects_mesh.__init__``, and parsed by ``setup.py``. -*- coding: utf-8 -*- Copyright (C) 2021 Northwestern University. invenio-subjects-mesh is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details.
356
0.881188
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # import os import sys extensions = [ 'otcdocstheme' ] html_theme = 'otcdocs' html_theme_options = { } otcdocs_auto_name = False otcdocs_auto_version = False project = 'Dummy Service' # FIXME otcdocs_repo_name = 'opentelekomcloud-docs/template' # FIXME # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../../')) sys.path.insert(0, os.path.abspath('../')) sys.path.insert(0, os.path.abspath('./')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # # source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. copyright = u'2022-present, Open Telekom Cloud' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # The reST default role (used for this markup: `text`) to use # for all documents. # default_role = None # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'native' # -- Options for man page output ---------------------------------------------- # Grouping the document tree for man pages. # List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". html_title = "Dummy UMN" # FIXME # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_use_modindex = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'dummydoc' # FIXME latex_documents = [ ('index', 'umn-dummy.tex', # FIXME u'%s User Manual Documentation' % project, u'OpenTelekomCloud', 'manual'), ]
32.696203
79
0.714092
[ "Apache-2.0" ]
kucerakk/template
umn/source/conf.py
5,166
Python
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. FIXME FIXME If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. -- General configuration ---------------------------------------------------- Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. The suffix of source filenames. The encoding of source files. source_encoding = 'utf-8' The master toctree document. General information about the project. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used: today = '' Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' The reST default role (used for this markup: `text`) to use for all documents. default_role = None If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default. The name of the Pygments (syntax highlighting) style to use. -- Options for man page output ---------------------------------------------- Grouping the document tree for man pages. List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' -- Options for HTML output -------------------------------------------------- The theme to use for HTML and HTML Help pages. Major themes that come with Sphinx are currently 'default' and 'sphinxdoc'. html_theme_path = ["."] html_theme = '_theme' Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation. html_theme_options = {} Add any paths that contain custom themes here, relative to this directory. html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation". FIXME A shorter title for the navigation bar. Default is the same as html_title. html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar. html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large. html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities. html_use_smartypants = True Custom sidebar templates, maps document names to template names. html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names. html_additional_pages = {} If false, no module index is generated. html_use_modindex = True If false, no index is generated. html_use_index = True If true, the index is split into individual pages for each letter. html_split_index = False If true, links to the reST sources are added to the pages. html_show_sourcelink = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served. html_use_opensearch = '' If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). html_file_suffix = '' Output file base name for HTML help builder. FIXME FIXME
4,222
0.817267
"""[Lambda Expressions] Lambda expressions are simply another way to create functions anonymous functions keyword \ parameter list optional \ \ the : is required, even for zero arguments \ \ / / this expression is evaluated and returned when the lambda function is called. (think of it as "the body" of the function) lambda [parameter list]: expression \ the expression returns a function object that evaluates and returns the expression when it is called Examples from tkinter import Y from unittest import FunctionTestCase lambda x: x**2 lambda x, y: x + y lambda : 'hello' lambda s: s[::-1].upper() type(lambda x: x**2) -> function Note that these expressions are function objects, but are not "named" -> anonymous Functions lambdas, or anonymous functions, are NOT equivalent to closures Assigning a Lambda to a Variable name my_func = lambda x: x**2 type(my_func) -> fuunction my_func(3) -> 9 my_func(4) -> 16 # identical to: def my_func(x): return x**2 type(my_func) -> function """
19.966102
161
0.633277
[ "Unlicense" ]
minefarmer/deep-Dive-1
.history/my_classes/FirstClassFunctions/LambdaExpressions_20210704152007.py
1,178
Python
[Lambda Expressions] Lambda expressions are simply another way to create functions anonymous functions keyword \ parameter list optional \ \ the : is required, even for zero arguments \ \ / / this expression is evaluated and returned when the lambda function is called. (think of it as "the body" of the function) lambda [parameter list]: expression the expression returns a function object that evaluates and returns the expression when it is called Examples from tkinter import Y from unittest import FunctionTestCase lambda x: x**2 lambda x, y: x + y lambda : 'hello' lambda s: s[::-1].upper() type(lambda x: x**2) -> function Note that these expressions are function objects, but are not "named" -> anonymous Functions lambdas, or anonymous functions, are NOT equivalent to closures Assigning a Lambda to a Variable name my_func = lambda x: x**2 type(my_func) -> fuunction my_func(3) -> 9 my_func(4) -> 16 # identical to: def my_func(x): return x**2 type(my_func) -> function
1,167
0.990662
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2020 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """Script to calculate sleet probability.""" from improver import cli @cli.clizefy @cli.with_output def process(snow: cli.inputcube, rain: cli.inputcube): """Calculate sleet probability. Calculates the sleet probability using the calculate_sleet_probability plugin. Args: snow (iris.cube.Cube): An iris Cube of the probability of snow. rain (iris.cube.Cube): An iris Cube of the probability of rain. Returns: iris.cube.Cube: Returns a cube with the probability of sleet. """ from improver.calculate_sleet_prob import calculate_sleet_probability result = calculate_sleet_probability(snow, rain) return result
39.933333
79
0.724958
[ "BSD-3-Clause" ]
BelligerG/improver
improver/cli/sleet_probability.py
2,396
Python
Calculate sleet probability. Calculates the sleet probability using the calculate_sleet_probability plugin. Args: snow (iris.cube.Cube): An iris Cube of the probability of snow. rain (iris.cube.Cube): An iris Cube of the probability of rain. Returns: iris.cube.Cube: Returns a cube with the probability of sleet. Script to calculate sleet probability. !/usr/bin/env python -*- coding: utf-8 -*- ----------------------------------------------------------------------------- (C) British Crown Copyright 2017-2020 Met Office. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2,014
0.840568
# Theory: Indexes # There are several types of collections to store data in Python. # Positionally ordered collections of elements are usually called # sequences, and both lists and strings belong to them. EAch # element in a list, as well as each character in a string, has an # index that corresponds to its position. Indexes are used to # access elements within a sequence. Indexing is zero-based, so if # you see a person who counts from zero, you must have met a # programmer.
40.333333
66
0.770661
[ "MIT" ]
chanchanchong/PYTHON-TRACK-IN-HYPERSKILL
Computer science/Programming languages/Python/Working with data/Collections/Lists/Indexes/topic.py
484
Python
Theory: Indexes There are several types of collections to store data in Python. Positionally ordered collections of elements are usually called sequences, and both lists and strings belong to them. EAch element in a list, as well as each character in a string, has an index that corresponds to its position. Indexes are used to access elements within a sequence. Indexing is zero-based, so if you see a person who counts from zero, you must have met a programmer.
463
0.956612
""" This is the UGaLi analysis sub-package. Classes related to higher-level data analysis live here. Modules objects : mask : """
13.454545
56
0.655405
[ "MIT" ]
DarkEnergySurvey/ugali
ugali/analysis/__init__.py
148
Python
This is the UGaLi analysis sub-package. Classes related to higher-level data analysis live here. Modules objects : mask :
138
0.932432
# -*- coding: utf-8 -*- # @Author: Yanqi Gu # @Date: 2019-04-20 16:30:52 # @Last Modified by: Yanqi Gu # @Last Modified time: 2019-04-20 16:57:49
25
42
0.613333
[ "MIT" ]
Guyanqi/DPC4.5
DPDecisionTree/__init__.py
150
Python
-*- coding: utf-8 -*- @Author: Yanqi Gu @Date: 2019-04-20 16:30:52 @Last Modified by: Yanqi Gu @Last Modified time: 2019-04-20 16:57:49
139
0.926667
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Boilerplate #----------------------------------------------------------------------------- import pytest ; pytest #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- # Standard library imports # External imports # Bokeh imports from bokeh._testing.util.api import verify_all # Module under test #import bokeh.sampledata.glucose as bsg #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- ALL = ( 'data', ) #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- Test___all__ = pytest.mark.sampledata(verify_all("bokeh.sampledata.glucose", ALL)) @pytest.mark.sampledata def test_data(pd): import bokeh.sampledata.glucose as bsg assert isinstance(bsg.data, pd.DataFrame) # don't check detail for external data #----------------------------------------------------------------------------- # Dev API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Private API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Code #-----------------------------------------------------------------------------
33.915254
82
0.270365
[ "BSD-3-Clause" ]
BiYandong110/bokeh
tests/unit/bokeh/sampledata/test_glucose.py
2,001
Python
----------------------------------------------------------------------------- Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors. All rights reserved. The full license is in the file LICENSE.txt, distributed with this software.---------------------------------------------------------------------------------------------------------------------------------------------------------- Boilerplate---------------------------------------------------------------------------------------------------------------------------------------------------------- Imports----------------------------------------------------------------------------- Standard library imports External imports Bokeh imports Module under testimport bokeh.sampledata.glucose as bsg----------------------------------------------------------------------------- Setup---------------------------------------------------------------------------------------------------------------------------------------------------------- General API----------------------------------------------------------------------------- don't check detail for external data----------------------------------------------------------------------------- Dev API---------------------------------------------------------------------------------------------------------------------------------------------------------- Private API---------------------------------------------------------------------------------------------------------------------------------------------------------- Code-----------------------------------------------------------------------------
1,609
0.804098
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC # Incremental Data Ingestion with Auto Loader # MAGIC # MAGIC Incremental ETL is important since it allows us to deal solely with new data that has been encountered since the last ingestion. Reliably processing only the new data reduces redundant processing and helps enterprises reliably scale data pipelines. # MAGIC # MAGIC The first step for any successful data lakehouse implementation is ingesting into a Delta Lake table from cloud storage. # MAGIC # MAGIC Historically, ingesting files from a data lake into a database has been a complicated process. # MAGIC # MAGIC Databricks Auto Loader provides an easy-to-use mechanism for incrementally and efficiently processing new data files as they arrive in cloud file storage. In this notebook, you'll see Auto Loader in action. # MAGIC # MAGIC Due to the benefits and scalability that Auto Loader delivers, Databricks recommends its use as general **best practice** when ingesting data from cloud object storage. # MAGIC # MAGIC ## Learning Objectives # MAGIC By the end of this lesson, you should be able to: # MAGIC * Execute Auto Loader code to incrementally ingest data from cloud storage to Delta Lake # MAGIC * Describe what happens when a new file arrives in a directory configured for Auto Loader # MAGIC * Query a table fed by a streaming Auto Loader query # MAGIC # MAGIC ## Dataset Used # MAGIC This demo uses simplified artificially generated medical data representing heart rate recordings delivered in the JSON format. # MAGIC # MAGIC | Field | Type | # MAGIC | --- | --- | # MAGIC | device_id | int | # MAGIC | mrn | long | # MAGIC | time | double | # MAGIC | heartrate | double | # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC # MAGIC ## Getting Started # MAGIC # MAGIC Run the following cell to reset the demo and configure required variables and help functions. # COMMAND ---------- # MAGIC %run ../Includes/Classroom-Setup-6.1 # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC ## Using Auto Loader # MAGIC # MAGIC In the cell below, a function is defined to demonstrate using Databricks Auto Loader with the PySpark API. This code includes both a Structured Streaming read and write. # MAGIC # MAGIC The following notebook will provide a more robust overview of Structured Streaming. If you wish to learn more about Auto Loader options, refer to the <a href="https://docs.databricks.com/spark/latest/structured-streaming/auto-loader.html" target="_blank">documentation</a>. # MAGIC # MAGIC Note that when using Auto Loader with automatic <a href="https://docs.databricks.com/spark/latest/structured-streaming/auto-loader-schema.html" target="_blank">schema inference and evolution</a>, the 4 arguments shown here should allow ingestion of most datasets. These arguments are explained below. # MAGIC # MAGIC | argument | what it is | how it's used | # MAGIC | --- | --- | --- | # MAGIC | **`data_source`** | The directory of the source data | Auto Loader will detect new files as they arrive in this location and queue them for ingestion; passed to the **`.load()`** method | # MAGIC | **`source_format`** | The format of the source data | While the format for all Auto Loader queries will be **`cloudFiles`**, the format of the source data should always be specified for the **`cloudFiles.format`** option | # MAGIC | **`table_name`** | The name of the target table | Spark Structured Streaming supports writing directly to Delta Lake tables by passing a table name as a string to the **`.table()`** method. Note that you can either append to an existing table or create a new table | # MAGIC | **`checkpoint_directory`** | The location for storing metadata about the stream | This argument is pass to the **`checkpointLocation`** and **`cloudFiles.schemaLocation`** options. Checkpoints keep track of streaming progress, while the schema location tracks updates to the fields in the source dataset | # MAGIC # MAGIC **NOTE**: The code below has been streamlined to demonstrate Auto Loader functionality. We'll see in later lessons that additional transformations can be applied to source data before saving them to Delta Lake. # COMMAND ---------- def autoload_to_table(data_source, source_format, table_name, checkpoint_directory): query = (spark.readStream .format("cloudFiles") .option("cloudFiles.format", source_format) .option("cloudFiles.schemaLocation", checkpoint_directory) .load(data_source) .writeStream .option("checkpointLocation", checkpoint_directory) .option("mergeSchema", "true") .table(table_name)) return query # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC In the following cell, we use the previously defined function and some path variables defined in the setup script to begin an Auto Loader stream. # MAGIC # MAGIC Here, we're reading from a source directory of JSON files. # COMMAND ---------- query = autoload_to_table(data_source = f"{DA.paths.working_dir}/tracker", source_format = "json", table_name = "target_table", checkpoint_directory = f"{DA.paths.checkpoints}/target_table") # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC Because Auto Loader uses Spark Structured Streaming to load data incrementally, the code above doesn't appear to finish executing. # MAGIC # MAGIC We can think of this as a **continuously active query**. This means that as soon as new data arrives in our data source, it will be processed through our logic and loaded into our target table. We'll explore this in just a second. # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC ## Helper Function for Streaming Lessons # MAGIC # MAGIC Our notebook-based lessons combine streaming functions with batch and streaming queries against the results of those operations. These notebooks are for instructional purposes and intended for interactive, cell-by-cell execution. This pattern is not intended for production. # MAGIC # MAGIC Below, we define a helper function that prevents our notebook from executing the next cell just long enough to ensure data has been written out by a given streaming query. This code should not be necessary in a production job. # COMMAND ---------- def block_until_stream_is_ready(query, min_batches=2): import time while len(query.recentProgress) < min_batches: time.sleep(5) # Give it a couple of seconds print(f"The stream has processed {len(query.recentProgress)} batchs") block_until_stream_is_ready(query) # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC ## Query Target Table # MAGIC # MAGIC Once data has been ingested to Delta Lake with Auto Loader, users can interact with it the same way they would any table. # COMMAND ---------- # MAGIC %sql # MAGIC SELECT * FROM target_table # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC Note that the **`_rescued_data`** column is added by Auto Loader automatically to capture any data that might be malformed and not fit into the table otherwise. # MAGIC # MAGIC While Auto Loader captured the field names for our data correctly, note that it encoded all fields as **`STRING`** type. Because JSON is a text-based format, this is the safest and most permissive type, ensuring that the least amount of data is dropped or ignored at ingestion due to type mismatch. # COMMAND ---------- # MAGIC %sql # MAGIC DESCRIBE TABLE target_table # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC Use the cell below to define a temporary view that summarizes the recordings in our target table. # MAGIC # MAGIC We'll use this view below to demonstrate how new data is automatically ingested with Auto Loader. # COMMAND ---------- # MAGIC %sql # MAGIC CREATE OR REPLACE TEMP VIEW device_counts AS # MAGIC SELECT device_id, count(*) total_recordings # MAGIC FROM target_table # MAGIC GROUP BY device_id; # MAGIC # MAGIC SELECT * FROM device_counts # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC ## Land New Data # MAGIC # MAGIC As mentioned previously, Auto Loader is configured to incrementally process files from a directory in cloud object storage into a Delta Lake table. # MAGIC # MAGIC We have configured and are currently executing a query to process JSON files from the location specified by **`source_path`** into a table named **`target_table`**. Let's review the contents of the **`source_path`** directory. # COMMAND ---------- files = dbutils.fs.ls(f"{DA.paths.working_dir}/tracker") display(files) # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC At present, you should see a single JSON file listed in this location. # MAGIC # MAGIC The method in the cell below was configured in our setup script to allow us to model an external system writing data to this directory. Each time you execute the cell below, a new file will land in the **`source_path`** directory. # COMMAND ---------- DA.data_factory.load() # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC List the contents of the **`source_path`** again using the cell below. You should see an additional JSON file for each time you ran the previous cell. # COMMAND ---------- files = dbutils.fs.ls(f"{DA.paths.working_dir}/tracker") display(files) # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC ## Tracking Ingestion Progress # MAGIC # MAGIC Historically, many systems have been configured to either reprocess all records in a source directory to calculate current results or require data engineers to implement custom logic to identify new data that's arrived since the last time a table was updated. # MAGIC # MAGIC With Auto Loader, your table has already been updated. # MAGIC # MAGIC Run the query below to confirm that new data has been ingested. # COMMAND ---------- # MAGIC %sql # MAGIC SELECT * FROM device_counts # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC The Auto Loader query we configured earlier automatically detects and processes records from the source directory into the target table. There is a slight delay as records are ingested, but an Auto Loader query executing with default streaming configuration should update results in near real time. # MAGIC # MAGIC The query below shows the table history. A new table version should be indicated for each **`STREAMING UPDATE`**. These update events coincide with new batches of data arriving at the source. # COMMAND ---------- # MAGIC %sql # MAGIC DESCRIBE HISTORY target_table # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # MAGIC ## Clean Up # MAGIC Feel free to continue landing new data and exploring the table results with the cells above. # MAGIC # MAGIC When you're finished, run the following cell to stop all active streams and remove created resources before continuing. # COMMAND ---------- DA.cleanup() # COMMAND ---------- # MAGIC %md-sandbox # MAGIC &copy; 2022 Databricks, Inc. All rights reserved.<br/> # MAGIC Apache, Apache Spark, Spark and the Spark logo are trademarks of the <a href="https://www.apache.org/">Apache Software Foundation</a>.<br/> # MAGIC <br/> # MAGIC <a href="https://databricks.com/privacy-policy">Privacy Policy</a> | <a href="https://databricks.com/terms-of-use">Terms of Use</a> | <a href="https://help.databricks.com/">Support</a>
42.167857
315
0.720505
[ "CC0-1.0" ]
databricks-academy/data-engineering-with-databricks
Data-Engineering-with-Databricks/06 - Incremental Data Processing/DE 6.1 - Incremental Data Ingestion with Auto Loader.py
11,807
Python
Databricks notebook source MAGIC %md-sandbox MAGIC MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> MAGIC </div> COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Incremental Data Ingestion with Auto Loader MAGIC MAGIC Incremental ETL is important since it allows us to deal solely with new data that has been encountered since the last ingestion. Reliably processing only the new data reduces redundant processing and helps enterprises reliably scale data pipelines. MAGIC MAGIC The first step for any successful data lakehouse implementation is ingesting into a Delta Lake table from cloud storage. MAGIC MAGIC Historically, ingesting files from a data lake into a database has been a complicated process. MAGIC MAGIC Databricks Auto Loader provides an easy-to-use mechanism for incrementally and efficiently processing new data files as they arrive in cloud file storage. In this notebook, you'll see Auto Loader in action. MAGIC MAGIC Due to the benefits and scalability that Auto Loader delivers, Databricks recommends its use as general **best practice** when ingesting data from cloud object storage. MAGIC MAGIC Learning Objectives MAGIC By the end of this lesson, you should be able to: MAGIC * Execute Auto Loader code to incrementally ingest data from cloud storage to Delta Lake MAGIC * Describe what happens when a new file arrives in a directory configured for Auto Loader MAGIC * Query a table fed by a streaming Auto Loader query MAGIC MAGIC Dataset Used MAGIC This demo uses simplified artificially generated medical data representing heart rate recordings delivered in the JSON format. MAGIC MAGIC | Field | Type | MAGIC | --- | --- | MAGIC | device_id | int | MAGIC | mrn | long | MAGIC | time | double | MAGIC | heartrate | double | COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC MAGIC Getting Started MAGIC MAGIC Run the following cell to reset the demo and configure required variables and help functions. COMMAND ---------- MAGIC %run ../Includes/Classroom-Setup-6.1 COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Using Auto Loader MAGIC MAGIC In the cell below, a function is defined to demonstrate using Databricks Auto Loader with the PySpark API. This code includes both a Structured Streaming read and write. MAGIC MAGIC The following notebook will provide a more robust overview of Structured Streaming. If you wish to learn more about Auto Loader options, refer to the <a href="https://docs.databricks.com/spark/latest/structured-streaming/auto-loader.html" target="_blank">documentation</a>. MAGIC MAGIC Note that when using Auto Loader with automatic <a href="https://docs.databricks.com/spark/latest/structured-streaming/auto-loader-schema.html" target="_blank">schema inference and evolution</a>, the 4 arguments shown here should allow ingestion of most datasets. These arguments are explained below. MAGIC MAGIC | argument | what it is | how it's used | MAGIC | --- | --- | --- | MAGIC | **`data_source`** | The directory of the source data | Auto Loader will detect new files as they arrive in this location and queue them for ingestion; passed to the **`.load()`** method | MAGIC | **`source_format`** | The format of the source data | While the format for all Auto Loader queries will be **`cloudFiles`**, the format of the source data should always be specified for the **`cloudFiles.format`** option | MAGIC | **`table_name`** | The name of the target table | Spark Structured Streaming supports writing directly to Delta Lake tables by passing a table name as a string to the **`.table()`** method. Note that you can either append to an existing table or create a new table | MAGIC | **`checkpoint_directory`** | The location for storing metadata about the stream | This argument is pass to the **`checkpointLocation`** and **`cloudFiles.schemaLocation`** options. Checkpoints keep track of streaming progress, while the schema location tracks updates to the fields in the source dataset | MAGIC MAGIC **NOTE**: The code below has been streamlined to demonstrate Auto Loader functionality. We'll see in later lessons that additional transformations can be applied to source data before saving them to Delta Lake. COMMAND ---------- COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC In the following cell, we use the previously defined function and some path variables defined in the setup script to begin an Auto Loader stream. MAGIC MAGIC Here, we're reading from a source directory of JSON files. COMMAND ---------- COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Because Auto Loader uses Spark Structured Streaming to load data incrementally, the code above doesn't appear to finish executing. MAGIC MAGIC We can think of this as a **continuously active query**. This means that as soon as new data arrives in our data source, it will be processed through our logic and loaded into our target table. We'll explore this in just a second. COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Helper Function for Streaming Lessons MAGIC MAGIC Our notebook-based lessons combine streaming functions with batch and streaming queries against the results of those operations. These notebooks are for instructional purposes and intended for interactive, cell-by-cell execution. This pattern is not intended for production. MAGIC MAGIC Below, we define a helper function that prevents our notebook from executing the next cell just long enough to ensure data has been written out by a given streaming query. This code should not be necessary in a production job. COMMAND ---------- Give it a couple of seconds COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Query Target Table MAGIC MAGIC Once data has been ingested to Delta Lake with Auto Loader, users can interact with it the same way they would any table. COMMAND ---------- MAGIC %sql MAGIC SELECT * FROM target_table COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Note that the **`_rescued_data`** column is added by Auto Loader automatically to capture any data that might be malformed and not fit into the table otherwise. MAGIC MAGIC While Auto Loader captured the field names for our data correctly, note that it encoded all fields as **`STRING`** type. Because JSON is a text-based format, this is the safest and most permissive type, ensuring that the least amount of data is dropped or ignored at ingestion due to type mismatch. COMMAND ---------- MAGIC %sql MAGIC DESCRIBE TABLE target_table COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Use the cell below to define a temporary view that summarizes the recordings in our target table. MAGIC MAGIC We'll use this view below to demonstrate how new data is automatically ingested with Auto Loader. COMMAND ---------- MAGIC %sql MAGIC CREATE OR REPLACE TEMP VIEW device_counts AS MAGIC SELECT device_id, count(*) total_recordings MAGIC FROM target_table MAGIC GROUP BY device_id; MAGIC MAGIC SELECT * FROM device_counts COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Land New Data MAGIC MAGIC As mentioned previously, Auto Loader is configured to incrementally process files from a directory in cloud object storage into a Delta Lake table. MAGIC MAGIC We have configured and are currently executing a query to process JSON files from the location specified by **`source_path`** into a table named **`target_table`**. Let's review the contents of the **`source_path`** directory. COMMAND ---------- COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC At present, you should see a single JSON file listed in this location. MAGIC MAGIC The method in the cell below was configured in our setup script to allow us to model an external system writing data to this directory. Each time you execute the cell below, a new file will land in the **`source_path`** directory. COMMAND ---------- COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC List the contents of the **`source_path`** again using the cell below. You should see an additional JSON file for each time you ran the previous cell. COMMAND ---------- COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Tracking Ingestion Progress MAGIC MAGIC Historically, many systems have been configured to either reprocess all records in a source directory to calculate current results or require data engineers to implement custom logic to identify new data that's arrived since the last time a table was updated. MAGIC MAGIC With Auto Loader, your table has already been updated. MAGIC MAGIC Run the query below to confirm that new data has been ingested. COMMAND ---------- MAGIC %sql MAGIC SELECT * FROM device_counts COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC The Auto Loader query we configured earlier automatically detects and processes records from the source directory into the target table. There is a slight delay as records are ingested, but an Auto Loader query executing with default streaming configuration should update results in near real time. MAGIC MAGIC The query below shows the table history. A new table version should be indicated for each **`STREAMING UPDATE`**. These update events coincide with new batches of data arriving at the source. COMMAND ---------- MAGIC %sql MAGIC DESCRIBE HISTORY target_table COMMAND ---------- MAGIC %md MAGIC MAGIC MAGIC Clean Up MAGIC Feel free to continue landing new data and exploring the table results with the cells above. MAGIC MAGIC When you're finished, run the following cell to stop all active streams and remove created resources before continuing. COMMAND ---------- COMMAND ---------- MAGIC %md-sandbox MAGIC &copy; 2022 Databricks, Inc. All rights reserved.<br/> MAGIC Apache, Apache Spark, Spark and the Spark logo are trademarks of the <a href="https://www.apache.org/">Apache Software Foundation</a>.<br/> MAGIC <br/> MAGIC <a href="https://databricks.com/privacy-policy">Privacy Policy</a> | <a href="https://databricks.com/terms-of-use">Terms of Use</a> | <a href="https://help.databricks.com/">Support</a>
10,104
0.855764
# Copyright 2018 Yegor Bitensky # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. def get_parameters(func): def wrap(self, values): return func(self, **values) return wrap
34.15
74
0.746706
[ "Apache-2.0" ]
YegorDB/THPoker
tests/utils.py
683
Python
Copyright 2018 Yegor Bitensky Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
551
0.806735
""" This module stores global variables that must be shared between all modules of envprobe. Please do not introduce a too large global state in this module. Please do not add dependencies of other modules to this module because almost all parts of envprobe refers this module. """ # This list contains the valid subcommands that exist. These are not mapped # as "get VARIABLE" when used in the short format `envprobe VARIABLE`. REGISTERED_COMMANDS = []
35.076923
78
0.785088
[ "MIT" ]
steakhal/envprobe
configuration/global_config.py
456
Python
This module stores global variables that must be shared between all modules of envprobe. Please do not introduce a too large global state in this module. Please do not add dependencies of other modules to this module because almost all parts of envprobe refers this module. This list contains the valid subcommands that exist. These are not mapped as "get VARIABLE" when used in the short format `envprobe VARIABLE`.
419
0.91886
# Solution to Problem 8 # Program outputs today's date and time in the format "Monday, January 10th 2019 at 1:15pm" # To start we import the Python datetime module as dt. from datetime import datetime as dt #now equals the date and time now. now = dt.now() # Copied verbatim initially from stacoverflow Reference 1 below but amended to fit my referenceing of time as now. # Suffix equals 'st' if the date now is 1,21 or 23 else it is 'nd' if the date noe is 2 or 22 else it is 'rd' if date now is 3 or23 for eveything else it is 'th. suffix = 'st' if now in [1,21,31] else 'nd' if now in [2, 22] else 'rd' if now in [3, 23] else 'th' # Display to the user the Heading "Todays Date and Time:" print("Todays Date and time:") # Below displays to the user a the date and time in a string in inverted commas todays date and time in the format Day, Month Date year at Current Time am/pm. # Used Reference 3 below to remove the leading 0 when desplaying the time. print(now.strftime('%A, %B %d%%s %Y at %#I:%M %p',) % suffix,) # Reference 1: https://stackoverflow.com/a/11645978 # Reference 2: https://www.saltycrane.com/blog/2008/06/how-to-get-current-date-and-time-in/ # Reference 3: https://stackoverflow.com/questions/904928/python-strftime-date-without-leading-0One problem is that '{dt.hour}' uses a 24 hour clock :(. Using the second option still brings you back to using '{%#I}' on Windows and '{%-I}' on Unix. – ubomb May 24 '16 at 22:47 # Used lecture from week 6 as a base for the problem also looked at the Python tutorial. # Laura Brogan 19/03/2019
67.869565
276
0.726457
[ "Apache-2.0" ]
LauraBrogan/pands-problem-set-2019
solution-8.py
1,563
Python
Solution to Problem 8 Program outputs today's date and time in the format "Monday, January 10th 2019 at 1:15pm" To start we import the Python datetime module as dt.now equals the date and time now. Copied verbatim initially from stacoverflow Reference 1 below but amended to fit my referenceing of time as now. Suffix equals 'st' if the date now is 1,21 or 23 else it is 'nd' if the date noe is 2 or 22 else it is 'rd' if date now is 3 or23 for eveything else it is 'th. Display to the user the Heading "Todays Date and Time:" Below displays to the user a the date and time in a string in inverted commas todays date and time in the format Day, Month Date year at Current Time am/pm. Used Reference 3 below to remove the leading 0 when desplaying the time. Reference 1: https://stackoverflow.com/a/11645978 Reference 2: https://www.saltycrane.com/blog/2008/06/how-to-get-current-date-and-time-in/ Reference 3: https://stackoverflow.com/questions/904928/python-strftime-date-without-leading-0One problem is that '{dt.hour}' uses a 24 hour clock :(. Using the second option still brings you back to using '{%I}' on Windows and '{%-I}' on Unix. – ubomb May 24 '16 at 22:47 Used lecture from week 6 as a base for the problem also looked at the Python tutorial. Laura Brogan 19/03/2019
1,282
0.821268
from ui import * startUI() # # - read the input data: # import MnistLoader # training_data, validation_data, test_data = MnistLoader.load_data_wrapper() # training_data = list(training_data) # # --------------------- # # - network.py example: # from Network import Network, vectorized_result # from NetworkLoader import save, load # # netPath = "E:\\ITMO University\\Интеллектуальные системы и технологии\\Lab5\Lab\\Models\\model_5epochs.json"; # # net = load(netPath) # # # imgPath = "E:\\ITMO University\\Интеллектуальные системы и технологии\\Lab5\\Lab\\HandTestImages\\0.png" # # # predict(imgPath, 7, net) # # # net = Network([784, 30, 10]) # # # net.run(training_data, 5, 10, 3.0, test_data=test_data, monitor_evaluation_cost=True, # # # monitor_evaluation_accuracy=True, # # # monitor_training_cost=True, # # # monitor_training_accuracy=True) # # imgPath = "E:\\ITMO University\\Интеллектуальные системы и технологии\\Lab5\\Lab\\HandTestImages\\0.png" # # #predict(imgPath, net) # # save(net, "E:\ITMO University\Интеллектуальные системы и технологии\Lab5\Lab\Models\model_5epochs.json") # from ui import * # net = "" # startUI() # # ---------------------- # # - network2.py example: # # import network2 # # net = network2.Network([784, 30, 10], cost=network2.CrossEntropyCost) # # #net.large_weight_initializer() # # net.SGD(training_data, 30, 10, 0.1, lmbda = 5.0,evaluation_data=validation_data, # # monitor_evaluation_accuracy=True)
10.374194
113
0.631219
[ "MIT" ]
YuriyAksenov/ImageRecognition
Test.py
1,744
Python
- read the input data: import MnistLoader training_data, validation_data, test_data = MnistLoader.load_data_wrapper() training_data = list(training_data) --------------------- - network.py example: from Network import Network, vectorized_result from NetworkLoader import save, load netPath = "E:\\ITMO University\\Интеллектуальные системы и технологии\\Lab5\Lab\\Models\\model_5epochs.json"; net = load(netPath) imgPath = "E:\\ITMO University\\Интеллектуальные системы и технологии\\Lab5\\Lab\\HandTestImages\\0.png" predict(imgPath, 7, net) net = Network([784, 30, 10]) net.run(training_data, 5, 10, 3.0, test_data=test_data, monitor_evaluation_cost=True, monitor_evaluation_accuracy=True, monitor_training_cost=True, monitor_training_accuracy=True) imgPath = "E:\\ITMO University\\Интеллектуальные системы и технологии\\Lab5\\Lab\\HandTestImages\\0.png" predict(imgPath, net) save(net, "E:\ITMO University\Интеллектуальные системы и технологии\Lab5\Lab\Models\model_5epochs.json") from ui import * net = "" startUI() ---------------------- - network2.py example: import network2 net = network2.Network([784, 30, 10], cost=network2.CrossEntropyCost) net.large_weight_initializer() net.SGD(training_data, 30, 10, 0.1, lmbda = 5.0,evaluation_data=validation_data, monitor_evaluation_accuracy=True)
1,365
0.848881
# Copyright 2021 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import sys from unittest import mock sys.modules["dnf"] = mock.Mock()
35.263158
77
0.731343
[ "Apache-2.0" ]
openstack/tripleo-repos
tests/unit/yum_config/mock_modules.py
670
Python
Copyright 2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
569
0.849254
# # # Needs to be expanded to accommodate the common occurrence of sparse.multiSparse objects in the geounitNode class vs pure numpy arrays # # import os import sys # If there is __init__.py in the directory where this file is, then Python adds das_decennial directory to sys.path # automatically. Not sure why and how it works, therefore, keeping the following line as a double sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))) import programs.engine.nodes as nodes import numpy as np def buildTestNode(): raw = np.array([0,1,2,3,4]) syn = np.array([6,7,8,9,5]) geocode = "0" geolevel = "National" node = nodes.geounitNode(geocode, geolevel=geolevel, raw=raw, syn=syn, geocodeDict={16: "Block", 12: "Block_Group", 11: "Tract", 5: "County", 2: "State", 1: "National"}) return node # NODES NO LONGER HAVE toJSON, as this is not needed # def test_slotsToJSON(): # node = buildTestNode() # # jsonStr = node.toJSON() # assert jsonStr == '{"geocode": "0", "geocodeDict": {"16": "Block", "12": "Block_Group", "11": "Tract", "5": "County", "2": "State", "1": "National"}, "geolevel": "National", "parentGeocode": "0", "raw": [0, 1, 2, 3, 4], "dp": null, "syn": [6, 7, 8, 9, 5], "syn_unrounded": null, "cons": null, "invar": null, "dp_queries": null, "congDistGeocode": null, "sldlGeocode": null, "slduGeocode": null, "minimalSchemaArray": null, "grbVars": null, "grbPenaltyVarsPos": null, "grbPenaltyVarsNeg": null, "ancestorsDP": null, "ancestorsRaw": null}' # # jsonStr = node.toJSON(keepAttrs=["raw", "syn"]) # assert jsonStr == '{"raw": [0, 1, 2, 3, 4], "syn": [6, 7, 8, 9, 5]}' # # jsontuple = node.toJSON(addClassName=True) # assert jsontuple == ('geounitNode', '{"geocode": "0", "geocodeDict": {"16": "Block", "12": "Block_Group", "11": "Tract", "5": "County", "2": "State", "1": "National"}, "geolevel": "National", "parentGeocode": "0", "raw": [0, 1, 2, 3, 4], "dp": null, "syn": [6, 7, 8, 9, 5], "syn_unrounded": null, "cons": null, "invar": null, "dp_queries": null, "congDistGeocode": null, "sldlGeocode": null, "slduGeocode": null, "minimalSchemaArray": null, "grbVars": null, "grbPenaltyVarsPos": null, "grbPenaltyVarsNeg": null, "ancestorsDP": null, "ancestorsRaw": null}') # # classname, jsonStr = jsontuple # assert classname == 'geounitNode' # assert jsonStr == '{"geocode": "0", "geocodeDict": {"16": "Block", "12": "Block_Group", "11": "Tract", "5": "County", "2": "State", "1": "National"}, "geolevel": "National", "parentGeocode": "0", "raw": [0, 1, 2, 3, 4], "dp": null, "syn": [6, 7, 8, 9, 5], "syn_unrounded": null, "cons": null, "invar": null, "dp_queries": null, "congDistGeocode": null, "sldlGeocode": null, "slduGeocode": null, "minimalSchemaArray": null, "grbVars": null, "grbPenaltyVarsPos": null, "grbPenaltyVarsNeg": null, "ancestorsDP": null, "ancestorsRaw": null}'
63.478261
562
0.642466
[ "CC0-1.0" ]
dkifer/census2020-das-e2e
programs/engine/unit_tests/json_nodes_test.py
2,920
Python
Needs to be expanded to accommodate the common occurrence of sparse.multiSparse objects in the geounitNode class vs pure numpy arrays If there is __init__.py in the directory where this file is, then Python adds das_decennial directory to sys.path automatically. Not sure why and how it works, therefore, keeping the following line as a double NODES NO LONGER HAVE toJSON, as this is not needed def test_slotsToJSON(): node = buildTestNode() jsonStr = node.toJSON() assert jsonStr == '{"geocode": "0", "geocodeDict": {"16": "Block", "12": "Block_Group", "11": "Tract", "5": "County", "2": "State", "1": "National"}, "geolevel": "National", "parentGeocode": "0", "raw": [0, 1, 2, 3, 4], "dp": null, "syn": [6, 7, 8, 9, 5], "syn_unrounded": null, "cons": null, "invar": null, "dp_queries": null, "congDistGeocode": null, "sldlGeocode": null, "slduGeocode": null, "minimalSchemaArray": null, "grbVars": null, "grbPenaltyVarsPos": null, "grbPenaltyVarsNeg": null, "ancestorsDP": null, "ancestorsRaw": null}' jsonStr = node.toJSON(keepAttrs=["raw", "syn"]) assert jsonStr == '{"raw": [0, 1, 2, 3, 4], "syn": [6, 7, 8, 9, 5]}' jsontuple = node.toJSON(addClassName=True) assert jsontuple == ('geounitNode', '{"geocode": "0", "geocodeDict": {"16": "Block", "12": "Block_Group", "11": "Tract", "5": "County", "2": "State", "1": "National"}, "geolevel": "National", "parentGeocode": "0", "raw": [0, 1, 2, 3, 4], "dp": null, "syn": [6, 7, 8, 9, 5], "syn_unrounded": null, "cons": null, "invar": null, "dp_queries": null, "congDistGeocode": null, "sldlGeocode": null, "slduGeocode": null, "minimalSchemaArray": null, "grbVars": null, "grbPenaltyVarsPos": null, "grbPenaltyVarsNeg": null, "ancestorsDP": null, "ancestorsRaw": null}') classname, jsonStr = jsontuple assert classname == 'geounitNode' assert jsonStr == '{"geocode": "0", "geocodeDict": {"16": "Block", "12": "Block_Group", "11": "Tract", "5": "County", "2": "State", "1": "National"}, "geolevel": "National", "parentGeocode": "0", "raw": [0, 1, 2, 3, 4], "dp": null, "syn": [6, 7, 8, 9, 5], "syn_unrounded": null, "cons": null, "invar": null, "dp_queries": null, "congDistGeocode": null, "sldlGeocode": null, "slduGeocode": null, "minimalSchemaArray": null, "grbVars": null, "grbPenaltyVarsPos": null, "grbPenaltyVarsNeg": null, "ancestorsDP": null, "ancestorsRaw": null}'
2,363
0.809247
#!/usr/bin/env python # Problem: Many forked repos on GitHub fall behind from their origins. # Solution: # 1) Verify that `apt install myrepos` is available on the system. # 2) Query GitHub API to find all of my repositories # 3) Clone each *fork* into *~/repos/mynameofit*, such that place I forked it # from is git origin (or update, if it exists) # 4) For each such clone, add *my fork* as a remote named after my GitHub # username # 5) Also for each clone, `mr register` the repo # Now custom `mr` commands can pull all origins and push to my remotes.
40.285714
77
0.719858
[ "MIT" ]
edunham/toys
utilities/updatify.py
564
Python
!/usr/bin/env python Problem: Many forked repos on GitHub fall behind from their origins. Solution: 1) Verify that `apt install myrepos` is available on the system. 2) Query GitHub API to find all of my repositories 3) Clone each *fork* into *~/repos/mynameofit*, such that place I forked it from is git origin (or update, if it exists) 4) For each such clone, add *my fork* as a remote named after my GitHub username 5) Also for each clone, `mr register` the repo Now custom `mr` commands can pull all origins and push to my remotes.
540
0.957447
""" Conditional Generative adversarial networks: https://arxiv.org/abs/1611.07004 U-net: https://arxiv.org/abs/1505.04597 Conditional generative adversarial network architecture modules used for simulation of detector response and unfolding in JetGAN framework. Generator() returns the generator model, and Discriminator() returns the descriminator model. """
27.923077
75
0.807163
[ "MIT" ]
nickelsey/jetgan
jetgan/model/cgan.py
363
Python
Conditional Generative adversarial networks: https://arxiv.org/abs/1611.07004 U-net: https://arxiv.org/abs/1505.04597 Conditional generative adversarial network architecture modules used for simulation of detector response and unfolding in JetGAN framework. Generator() returns the generator model, and Discriminator() returns the descriminator model.
353
0.972452
# AutoTransform # Large scale, component based code modification library # # Licensed under the MIT License <http://opensource.org/licenses/MIT> # SPDX-License-Identifier: MIT # Copyright (c) 2022-present Nathan Rockenbach <http://github.com/nathro> # @black_format """A change represents a submission from a run of AutoTransform on a particular Batch. They are used for managing submissions to code review/source control systems. A pull request is an example of a potential change."""
37.538462
91
0.780738
[ "MIT" ]
nathro/AutoTransform
src/python/autotransform/change/__init__.py
488
Python
A change represents a submission from a run of AutoTransform on a particular Batch. They are used for managing submissions to code review/source control systems. A pull request is an example of a potential change. AutoTransform Large scale, component based code modification library Licensed under the MIT License <http://opensource.org/licenses/MIT> SPDX-License-Identifier: MIT Copyright (c) 2022-present Nathan Rockenbach <http://github.com/nathro> @black_format
467
0.956967
# ReID Online Upload Service
28
28
0.821429
[ "MIT" ]
MikeCun/PersonReID
upload/__init__.py
28
Python
ReID Online Upload Service
26
0.928571
""" WSGI config for CongressionalRecord project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting. Usually you will have the standard Django WSGI application here, but it also might make sense to replace the whole Django WSGI application with a custom one that later delegates to the Django one. For example, you could introduce WSGI middleware here, or combine a Django application with an application of another framework. """ import os # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # if running multiple sites in the same mod_wsgi process. To fix this, use # mod_wsgi daemon mode with each site in its own daemon process, or use # os.environ["DJANGO_SETTINGS_MODULE"] = "CongressionalRecord.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CongressionalRecord.settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication # application = HelloWorldApplication(application)
44.181818
79
0.807956
[ "Apache-2.0" ]
kdunn926/eunomia-django
CongressionalRecord/wsgi.py
1,458
Python
WSGI config for CongressionalRecord project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting. Usually you will have the standard Django WSGI application here, but it also might make sense to replace the whole Django WSGI application with a custom one that later delegates to the Django one. For example, you could introduce WSGI middleware here, or combine a Django application with an application of another framework. We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks if running multiple sites in the same mod_wsgi process. To fix this, use mod_wsgi daemon mode with each site in its own daemon process, or use os.environ["DJANGO_SETTINGS_MODULE"] = "CongressionalRecord.settings" This application object is used by any WSGI server configured to use this file. This includes Django's development server, if the WSGI_APPLICATION setting points here. Apply WSGI middleware here. from helloworld.wsgi import HelloWorldApplication application = HelloWorldApplication(application)
1,250
0.857339
# Copyright 2018-2022 Streamlit Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import streamlit as st st.text("This text is awesome!")
35.555556
74
0.760938
[ "Apache-2.0" ]
Aaryanverma/streamlit
e2e/scripts/st_text.py
640
Python
Copyright 2018-2022 Streamlit Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
555
0.867188
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- project = "SeqAL" copyright = "2020, Xu Liang" author = "Xu Liang" # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "myst_parser", ] # The suffix of source filenames. source_suffix = [".rst", ".md"] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = "sphinx_rtd_theme" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"]
33.438596
79
0.659496
[ "MIT" ]
BrambleXu/SeqAL
docs/source/conf.py
1,906
Python
Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html -- Path setup -------------------------------------------------------------- If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. import os import sys sys.path.insert(0, os.path.abspath('.')) -- Project information ----------------------------------------------------- -- General configuration --------------------------------------------------- Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. The suffix of source filenames. Add any paths that contain templates here, relative to this directory. List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. This pattern also affects html_static_path and html_extra_path. -- Options for HTML output ------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css".
1,578
0.827912
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # flake8: noqa # # AppDaemon documentation build configuration file, created by # sphinx-quickstart on Fri Aug 11 14:36:18 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) autodoc_mock_imports = ["iso8601", "dateutil"] sys.path.insert(0, os.path.abspath("..")) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"] autodoc_member_order = "bysource" # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master doctree document. master_doc = "index" # General information about the project. project = "AppDaemon" copyright = "2021, Andrew Cockburn" author = "Andrew Cockburn" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = "4.0.7" # The full version, including alpha/beta/rc tags. release = "4.0.7" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False todo_include_todos = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "sphinx_rtd_theme" # html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' # html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value # html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = "AppDaemondoc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', # Latex figure (float) alignment #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, "AppDaemon.tex", "AppDaemon Documentation", "Andrew Cockburn", "manual",), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [(master_doc, "appdaemon", "AppDaemon Documentation", [author], 1)] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( master_doc, "AppDaemon", "AppDaemon Documentation", author, "AppDaemon", "Sandboxed python Apps for automation", "Miscellaneous", ), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # omit class name during the generation of the doc add_module_names = False
32.043624
91
0.709708
[ "Apache-2.0" ]
ReneTode/appdaemon
docs/conf.py
9,549
Python
!/usr/bin/env python3 -*- coding: utf-8 -*- flake8: noqa AppDaemon documentation build configuration file, created by sphinx-quickstart on Fri Aug 11 14:36:18 2017. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('.')) -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix(es) of source filenames. You can specify multiple suffix as a list of string: source_suffix = ['.rst', '.md'] The encoding of source files. source_encoding = 'utf-8-sig' The master doctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. This is also used if you do content translation via gettext catalogs. Usually you set "language" from the command line for these cases. There are two options for replacing |today|: either, you set today to some non-false value, then it is used: today = '' Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents. default_role = None If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::). add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default. show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting. modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents. keep_warnings = False -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. html_theme = 'alabaster' Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation. html_theme_options = {} Add any paths that contain custom themes here, relative to this directory. html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation". html_title = None A shorter title for the navigation bar. Default is the same as html_title. html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar. html_logo = None The name of an image file (relative to this directory) to use as a favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large. html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation. html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format. html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities. html_use_smartypants = True Custom sidebar templates, maps document names to template names. html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names. html_additional_pages = {} If false, no module index is generated. html_domain_indices = True If false, no index is generated. html_use_index = True If true, the index is split into individual pages for each letter. html_split_index = False If true, links to the reST sources are added to the pages. html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served. html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml"). html_file_suffix = None Language to be used for generating the HTML full-text search index. Sphinx supports the following languages: 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' html_search_language = 'en' A dictionary with options for the search language support, empty by default. Now only 'ja' uses this config value html_search_options = {'type': 'default'} The name of a javascript file (relative to the configuration directory) that implements a search results scorer. If empty, the default will be used. html_search_scorer = 'scorer.js' Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Latex figure (float) alignment'figure_align': 'htbp', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page. latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters. latex_use_parts = False If true, show page references after internal links. latex_show_pagerefs = False If true, show URL addresses after external links. latex_show_urls = False Documents to append as an appendix to all manuals. latex_appendices = [] If false, no module index is generated. latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links. man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals. texinfo_appendices = [] If false, no module index is generated. texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'. texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu. texinfo_no_detailmenu = False omit class name during the generation of the doc
8,018
0.839669
# -*- coding: utf-8 -*- # Author:Qiujie Yao # Email: yaoqiujie@gscopetech.com # @Time: 2019-06-26 14:15
20.8
33
0.653846
[ "Apache-2.0" ]
iyaoqiujie/VehicleInspection
VehicleInspection/apps/appointment/permissions.py
106
Python
-*- coding: utf-8 -*- Author:Qiujie Yao Email: yaoqiujie@gscopetech.com @Time: 2019-06-26 14:15
95
0.913462
# -*- coding: utf-8 -*- """Tests for :mod:`docdata`."""
14.25
31
0.491228
[ "MIT" ]
cthoyt/docdata
tests/__init__.py
57
Python
Tests for :mod:`docdata`. -*- coding: utf-8 -*-
49
0.859649
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- # pylint: disable=too-many-lines # pylint: disable=too-many-statements def load_arguments(self, _): pass
37.866667
76
0.558099
[ "MIT" ]
tbyfield/azure-cli-extensions
src/fidalgo/azext_fidalgo/generated/_params.py
568
Python
-------------------------------------------------------------------------- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See License.txt in the project root for license information. Code generated by Microsoft (R) AutoRest Code Generator. Changes may cause incorrect behavior and will be lost if the code is regenerated. -------------------------------------------------------------------------- pylint: disable=too-many-lines pylint: disable=too-many-statements
506
0.890845
# from nonbonded.cli.project.project import project # # __all__ = [project]
19
51
0.75
[ "MIT" ]
SimonBoothroyd/nonbonded
nonbonded/cli/projects/__init__.py
76
Python
from nonbonded.cli.project.project import project __all__ = [project]
69
0.907895
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # capmetrics-etl documentation build configuration file, created by # sphinx-quickstart on Mon Jan 11 00:08:57 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import shlex # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('../')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon' ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'capmetrics-etl' copyright = '2016, Julio Gonzalez Altamirano' author = 'Julio Gonzalez Altamirano' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. version = '0.1.0' release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' #html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value #html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. #html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'capmetrics-etldoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', # Latex figure (float) alignment #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'capmetrics-etl.tex', 'capmetrics-etl Documentation', 'Julio Gonzalez Altamirano', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'capmetrics-etl', 'capmetrics-etl Documentation', [author], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'capmetrics-etl', 'capmetrics-etl Documentation', author, 'capmetrics-etl', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False
32.452962
79
0.719025
[ "MIT" ]
jga/capmetrics-etl
docs/conf.py
9,314
Python
!/usr/bin/env python3 -*- coding: utf-8 -*- capmetrics-etl documentation build configuration file, created by sphinx-quickstart on Mon Jan 11 00:08:57 2016. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix(es) of source filenames. You can specify multiple suffix as a list of string: source_suffix = ['.rst', '.md'] The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. This is also used if you do content translation via gettext catalogs. Usually you set "language" from the command line for these cases. There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents.keep_warnings = False If true, `todo` and `todoList` produce output, else they produce nothing. -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation.html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Language to be used for generating the HTML full-text search index. Sphinx supports the following languages: 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'html_search_language = 'en' A dictionary with options for the search language support, empty by default. Now only 'ja' uses this config valuehtml_search_options = {'type': 'default'} The name of a javascript file (relative to the configuration directory) that implements a search results scorer. If empty, the default will be used.html_search_scorer = 'scorer.js' Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Latex figure (float) alignment'figure_align': 'htbp', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu.texinfo_no_detailmenu = False
7,889
0.847005
"""nflDAs URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ]
34
77
0.708556
[ "MIT" ]
BARarch/NFL-Topics
nflDAs/nflDAs/urls.py
748
Python
nflDAs URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
622
0.831551
# -*- coding: utf-8 -*- # # django-staticbuilder documentation build configuration file, created by # sphinx-quickstart on Wed Jan 30 22:32:51 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import re, sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.todo'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'django-staticbuilder' copyright = u'2013, Matthew Tretter' pkgmeta = {} execfile(os.path.join(os.path.dirname(__file__), '..', '..', 'staticbuilder', 'pkgmeta.py'), pkgmeta) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = re.match('\d+\.\d+', pkgmeta['__version__']).group() # The full version, including alpha/beta/rc tags. release = pkgmeta['__version__'] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'django-staticbuilderdoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'django-staticbuilder.tex', u'django-staticbuilder Documentation', u'Matthew Tretter', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'django-staticbuilder', u'django-staticbuilder Documentation', [u'Matthew Tretter'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'django-staticbuilder', u'django-staticbuilder Documentation', u'Matthew Tretter', 'django-staticbuilder', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote'
32.708502
82
0.714692
[ "MIT" ]
hzdg/django-staticbuilder
docs/source/conf.py
8,079
Python
-*- coding: utf-8 -*- django-staticbuilder documentation build configuration file, created by sphinx-quickstart on Wed Jan 30 22:32:51 2013. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ----------------------------------------------------- If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages.language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] -- Options for HTML output --------------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output -------------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto/manual]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output -------------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------------ Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote'
6,654
0.823617
# -*- coding: utf-8 -*- # Scrapy settings for mySpider project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://doc.scrapy.org/en/latest/topics/settings.html # https://doc.scrapy.org/en/latest/topics/downloader-middleware.html # https://doc.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'mySpider' SPIDER_MODULES = ['mySpider.spiders'] NEWSPIDER_MODULE = 'mySpider.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent USER_AGENT = 'mySpider (+http://www.yourdomain.com)' # Obey robots.txt rules ROBOTSTXT_OBEY = True # Configure maximum concurrent requests performed by Scrapy (default: 16) #CONCURRENT_REQUESTS = 32 # Configure a delay for requests for the same website (default: 0) # See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay # See also autothrottle settings and docs #DOWNLOAD_DELAY = 3 # The download delay setting will honor only one of: #CONCURRENT_REQUESTS_PER_DOMAIN = 16 #CONCURRENT_REQUESTS_PER_IP = 16 # Disable cookies (enabled by default) #COOKIES_ENABLED = False # Disable Telnet Console (enabled by default) #TELNETCONSOLE_ENABLED = False # Override the default request headers: #DEFAULT_REQUEST_HEADERS = { # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', # 'Accept-Language': 'en', #} # Enable or disable spider middlewares # See https://doc.scrapy.org/en/latest/topics/spider-middleware.html #SPIDER_MIDDLEWARES = { # 'mySpider.middlewares.MyspiderSpiderMiddleware': 543, #} # Enable or disable downloader middlewares # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html #DOWNLOADER_MIDDLEWARES = { # 'mySpider.middlewares.MyspiderDownloaderMiddleware': 543, #} # Enable or disable extensions # See https://doc.scrapy.org/en/latest/topics/extensions.html #EXTENSIONS = { # 'scrapy.extensions.telnet.TelnetConsole': None, #} # Configure item pipelines # See https://doc.scrapy.org/en/latest/topics/item-pipeline.html ITEM_PIPELINES = { 'mySpider.pipelines.MyspiderPipeline': 300, } # Enable and configure the AutoThrottle extension (disabled by default) # See https://doc.scrapy.org/en/latest/topics/autothrottle.html #AUTOTHROTTLE_ENABLED = True # The initial download delay #AUTOTHROTTLE_START_DELAY = 5 # The maximum download delay to be set in case of high latencies #AUTOTHROTTLE_MAX_DELAY = 60 # The average number of requests Scrapy should be sending in parallel to # each remote server #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 # Enable showing throttling stats for every response received: #AUTOTHROTTLE_DEBUG = False # Enable and configure HTTP caching (disabled by default) # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings #HTTPCACHE_ENABLED = True #HTTPCACHE_EXPIRATION_SECS = 0 #HTTPCACHE_DIR = 'httpcache' #HTTPCACHE_IGNORE_HTTP_CODES = [] #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
33.945055
102
0.775332
[ "MIT" ]
zxallen/spider
mySpider/mySpider/settings.py
3,089
Python
-*- coding: utf-8 -*- Scrapy settings for mySpider project For simplicity, this file contains only settings considered important or commonly used. You can find more settings consulting the documentation: https://doc.scrapy.org/en/latest/topics/settings.html https://doc.scrapy.org/en/latest/topics/downloader-middleware.html https://doc.scrapy.org/en/latest/topics/spider-middleware.html Crawl responsibly by identifying yourself (and your website) on the user-agent Obey robots.txt rules Configure maximum concurrent requests performed by Scrapy (default: 16)CONCURRENT_REQUESTS = 32 Configure a delay for requests for the same website (default: 0) See https://doc.scrapy.org/en/latest/topics/settings.htmldownload-delay See also autothrottle settings and docsDOWNLOAD_DELAY = 3 The download delay setting will honor only one of:CONCURRENT_REQUESTS_PER_DOMAIN = 16CONCURRENT_REQUESTS_PER_IP = 16 Disable cookies (enabled by default)COOKIES_ENABLED = False Disable Telnet Console (enabled by default)TELNETCONSOLE_ENABLED = False Override the default request headers:DEFAULT_REQUEST_HEADERS = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en',} Enable or disable spider middlewares See https://doc.scrapy.org/en/latest/topics/spider-middleware.htmlSPIDER_MIDDLEWARES = { 'mySpider.middlewares.MyspiderSpiderMiddleware': 543,} Enable or disable downloader middlewares See https://doc.scrapy.org/en/latest/topics/downloader-middleware.htmlDOWNLOADER_MIDDLEWARES = { 'mySpider.middlewares.MyspiderDownloaderMiddleware': 543,} Enable or disable extensions See https://doc.scrapy.org/en/latest/topics/extensions.htmlEXTENSIONS = { 'scrapy.extensions.telnet.TelnetConsole': None,} Configure item pipelines See https://doc.scrapy.org/en/latest/topics/item-pipeline.html Enable and configure the AutoThrottle extension (disabled by default) See https://doc.scrapy.org/en/latest/topics/autothrottle.htmlAUTOTHROTTLE_ENABLED = True The initial download delayAUTOTHROTTLE_START_DELAY = 5 The maximum download delay to be set in case of high latenciesAUTOTHROTTLE_MAX_DELAY = 60 The average number of requests Scrapy should be sending in parallel to each remote serverAUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 Enable showing throttling stats for every response received:AUTOTHROTTLE_DEBUG = False Enable and configure HTTP caching (disabled by default) See https://doc.scrapy.org/en/latest/topics/downloader-middleware.htmlhttpcache-middleware-settingsHTTPCACHE_ENABLED = TrueHTTPCACHE_EXPIRATION_SECS = 0HTTPCACHE_DIR = 'httpcache'HTTPCACHE_IGNORE_HTTP_CODES = []HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
2,698
0.873422
""" Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave beyond the new length. Ex_1: Given nums = [3,2,2,3], val = 3, Your function should return length = 2, with the first two elements of nums being 2. It doesn't matter what you leave beyond the returned length. Ex_2: Given nums = [0,1,2,2,3,0,4,2], val = 2, Your function should return length = 5, with the first five elements of nums containing 0, 1, 3, 0, and 4. Note that the order of those five elements can be arbitrary. It doesn't matter what values are set beyond the returned length. Clarification: Confused why the returned value is an integer but your answer is an array? Note that the input array is passed in by reference, which means modification to the input array will be known to the caller as well. Internally you can think of this: // nums is passed in by reference. (i.e., without making a copy) int len = removeElement(nums, val); // any modification to nums in your function would be known by the caller. // using the length returned by your function, it prints the first len elements. for (int i = 0; i < len; i++) { print(nums[i]); } """ class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ #My code starts here j=0 for i in range(len(nums)): if nums[i]!=val: nums[j]=nums[i] j+=1 return j """ My thinking: Use two pointers. """
38.844444
133
0.680778
[ "MIT" ]
ChenhaoJiang/LeetCode-Solution
1-50/27_remove-element.py
1,748
Python
:type nums: List[int] :type val: int :rtype: int Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave beyond the new length. Ex_1: Given nums = [3,2,2,3], val = 3, Your function should return length = 2, with the first two elements of nums being 2. It doesn't matter what you leave beyond the returned length. Ex_2: Given nums = [0,1,2,2,3,0,4,2], val = 2, Your function should return length = 5, with the first five elements of nums containing 0, 1, 3, 0, and 4. Note that the order of those five elements can be arbitrary. It doesn't matter what values are set beyond the returned length. Clarification: Confused why the returned value is an integer but your answer is an array? Note that the input array is passed in by reference, which means modification to the input array will be known to the caller as well. Internally you can think of this: // nums is passed in by reference. (i.e., without making a copy) int len = removeElement(nums, val); // any modification to nums in your function would be known by the caller. // using the length returned by your function, it prints the first len elements. for (int i = 0; i < len; i++) { print(nums[i]); } My code starts here
1,433
0.819794
# # Copyright 2021 IBM All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Version of ibm-appconfiguration-python-sdk """ __version__ = '0.1.2'
34.947368
74
0.753012
[ "Apache-2.0" ]
hardik-dadhich/appconfiguration-python-sdk
ibm_appconfiguration/version.py
664
Python
Version of ibm-appconfiguration-python-sdk Copyright 2021 IBM All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
607
0.914157
# coding=utf-8 # Copyright 2021 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """i_naturalist2018 dataset.""" from tensorflow_datasets.image_classification.i_naturalist2018.i_naturalist2018 import INaturalist2018
39.368421
102
0.783422
[ "Apache-2.0" ]
BeeAlarmed/datasets
tensorflow_datasets/image_classification/i_naturalist2018/__init__.py
748
Python
i_naturalist2018 dataset. coding=utf-8 Copyright 2021 The TensorFlow Datasets Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
610
0.815508
# --------------------------------------------------------------------- # # Copyright (c) 2012 University of Oxford # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, --INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # --------------------------------------------------------------------- from django.conf.urls.defaults import patterns, url from . import views urlpatterns = patterns('', url(r'^(?:(?P<slug>[a-z\d\-/]+)/)?$', views.DocumentationView.as_view(), name='page'), )
43.878788
90
0.679558
[ "MIT" ]
dataflow/DataStage
datastage/web/documentation/urls.py
1,448
Python
--------------------------------------------------------------------- Copyright (c) 2012 University of Oxford Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, --INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---------------------------------------------------------------------
1,204
0.831492
# -*- coding: utf-8 -*- # # pytest-dasktest documentation build configuration file, created by # sphinx-quickstart on Thu Oct 1 00:43:18 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import shlex # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.ifconfig', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'pytest-dasktest' copyright = u'2015, Marius van Niekerk' author = u'Marius van Niekerk' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.1.0' # The full version, including alpha/beta/rc tags. release = '0.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' #html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value #html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. #html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'pytest-cookiecutterplugin_namedoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', # Latex figure (float) alignment #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'pytest-cookiecutterplugin_name.tex', u'pytest-\\{\\{cookiecutter.plugin\\_name\\}\\} Documentation', u'\\{\\{cookiecutter.full\\_name\\}\\}', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'pytest-cookiecutterplugin_name', u'pytest-dasktest Documentation', [author], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'pytest-cookiecutterplugin_name', u'pytest-dasktest Documentation', author, 'pytest-cookiecutterplugin_name', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False
32.801394
116
0.719567
[ "MIT" ]
mariusvniekerk/pytest-dask
docs/conf.py
9,414
Python
-*- coding: utf-8 -*- pytest-dasktest documentation build configuration file, created by sphinx-quickstart on Thu Oct 1 00:43:18 2015. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix(es) of source filenames. You can specify multiple suffix as a list of string: source_suffix = ['.rst', '.md'] The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages. This is also used if you do content translation via gettext catalogs. Usually you set "language" from the command line for these cases. There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents.keep_warnings = False If true, `todo` and `todoList` produce output, else they produce nothing. -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation.html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Language to be used for generating the HTML full-text search index. Sphinx supports the following languages: 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'html_search_language = 'en' A dictionary with options for the search language support, empty by default. Now only 'ja' uses this config valuehtml_search_options = {'type': 'default'} The name of a javascript file (relative to the configuration directory) that implements a search results scorer. If empty, the default will be used.html_search_scorer = 'scorer.js' Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Latex figure (float) alignment'figure_align': 'htbp', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu.texinfo_no_detailmenu = False
7,941
0.843531
""" mbed SDK Copyright (c) 2011-2015 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com> """ from mbed_os_tools.test.host_tests_plugins.module_copy_silabs import ( HostTestPluginCopyMethod_Silabs, load_plugin, )
31.708333
72
0.788436
[ "Apache-2.0" ]
ARMmbed/mbed-os-tools
packages/mbed-host-tests/mbed_host_tests/host_tests_plugins/module_copy_silabs.py
761
Python
mbed SDK Copyright (c) 2011-2015 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>
624
0.819974
""" Visualize the single different data samples or averages All visualization nodes are zero-processing nodes, i.e. their execute method returns exactly the data that it gets as parameter. However, when the data is passed through the visualization node, it performs different kinds of analysis and creates some plots of the data. In principle, visualization nodes can be plugged between two arbitrary other nodes; however some nodes expect that the data contains some meta-information like channel- or feature names. Many of the nodes are trainable even though don't really learn a model (they don't process the data anyway). The reason for that is that they require information about the class labels for creating the plots. """
49.066667
78
0.80163
[ "BSD-3-Clause" ]
pyspace/pyspace
pySPACE/missions/nodes/visualization/__init__.py
736
Python
Visualize the single different data samples or averages All visualization nodes are zero-processing nodes, i.e. their execute method returns exactly the data that it gets as parameter. However, when the data is passed through the visualization node, it performs different kinds of analysis and creates some plots of the data. In principle, visualization nodes can be plugged between two arbitrary other nodes; however some nodes expect that the data contains some meta-information like channel- or feature names. Many of the nodes are trainable even though don't really learn a model (they don't process the data anyway). The reason for that is that they require information about the class labels for creating the plots.
727
0.987772
# Copyright (c) 2021. Slonos Labs. All rights Reserved.
28.5
56
0.719298
[ "MIT" ]
kapousa/BrontoMind2
app/base/gg.py
57
Python
Copyright (c) 2021. Slonos Labs. All rights Reserved.
53
0.929825
# -*- coding: utf-8 -*- # # RequestsThrottler documentation build configuration file, created by # sphinx-quickstart on Tue Dec 31 13:40:59 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import requests_throttler # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('..')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'RequestsThrottler' copyright = u'2013, Lou Marvin Caraig' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = requests_throttler.__version__ # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'RequestsThrottlerdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'RequestsThrottler.tex', u'RequestsThrottler Documentation', u'Lou Marvin Caraig', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'requeststhrottler', u'RequestsThrottler Documentation', [u'Lou Marvin Caraig'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'RequestsThrottler', u'RequestsThrottler Documentation', u'Lou Marvin Caraig', 'RequestsThrottler', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False autodoc_member_order = 'bysource'
31.758491
81
0.72279
[ "Apache-2.0" ]
a-tal/requests-throttler
docs/conf.py
8,416
Python
-*- coding: utf-8 -*- RequestsThrottler documentation build configuration file, created by sphinx-quickstart on Tue Dec 31 13:40:59 2013. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that are commented out serve to show the default. If extensions (or modules to document with autodoc) are in another directory, add these directories to sys.path here. If the directory is relative to the documentation root, use os.path.abspath to make it absolute, like shown here.sys.path.insert(0, os.path.abspath('.')) -- General configuration ------------------------------------------------ If your documentation needs a minimal Sphinx version, state it here.needs_sphinx = '1.0' Add any Sphinx extension module names here, as strings. They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. Add any paths that contain templates here, relative to this directory. The suffix of source filenames. The encoding of source files.source_encoding = 'utf-8-sig' The master toctree document. General information about the project. The version info for the project you're documenting, acts as replacement for |version| and |release|, also used in various other places throughout the built documents. The short X.Y version. The full version, including alpha/beta/rc tags. The language for content autogenerated by Sphinx. Refer to documentation for a list of supported languages.language = None There are two options for replacing |today|: either, you set today to some non-false value, then it is used:today = '' Else, today_fmt is used as the format for a strftime call.today_fmt = '%B %d, %Y' List of patterns, relative to source directory, that match files and directories to ignore when looking for source files. The reST default role (used for this markup: `text`) to use for all documents.default_role = None If true, '()' will be appended to :func: etc. cross-reference text.add_function_parentheses = True If true, the current module name will be prepended to all description unit titles (such as .. function::).add_module_names = True If true, sectionauthor and moduleauthor directives will be shown in the output. They are ignored by default.show_authors = False The name of the Pygments (syntax highlighting) style to use. A list of ignored prefixes for module index sorting.modindex_common_prefix = [] If true, keep warnings as "system message" paragraphs in the built documents.keep_warnings = False -- Options for HTML output ---------------------------------------------- The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes. Theme options are theme-specific and customize the look and feel of a theme further. For a list of options available for each theme, see the documentation.html_theme_options = {} Add any paths that contain custom themes here, relative to this directory.html_theme_path = [] The name for this set of Sphinx documents. If None, it defaults to "<project> v<release> documentation".html_title = None A shorter title for the navigation bar. Default is the same as html_title.html_short_title = None The name of an image file (relative to this directory) to place at the top of the sidebar.html_logo = None The name of an image file (within the static path) to use as favicon of the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.html_favicon = None Add any paths that contain custom static files (such as style sheets) here, relative to this directory. They are copied after the builtin static files, so a file named "default.css" will overwrite the builtin "default.css". Add any extra paths that contain custom files (such as robots.txt or .htaccess) here, relative to this directory. These files are copied directly to the root of the documentation.html_extra_path = [] If not '', a 'Last updated on:' timestamp is inserted at every page bottom, using the given strftime format.html_last_updated_fmt = '%b %d, %Y' If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities.html_use_smartypants = True Custom sidebar templates, maps document names to template names.html_sidebars = {} Additional templates that should be rendered to pages, maps page names to template names.html_additional_pages = {} If false, no module index is generated.html_domain_indices = True If false, no index is generated.html_use_index = True If true, the index is split into individual pages for each letter.html_split_index = False If true, links to the reST sources are added to the pages.html_show_sourcelink = True If true, "Created using Sphinx" is shown in the HTML footer. Default is True.html_show_sphinx = True If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.html_show_copyright = True If true, an OpenSearch description file will be output, and all pages will contain a <link> tag referring to it. The value of this option must be the base URL from which the finished HTML is served.html_use_opensearch = '' This is the file name suffix for HTML files (e.g. ".xhtml").html_file_suffix = None Output file base name for HTML help builder. -- Options for LaTeX output --------------------------------------------- The paper size ('letterpaper' or 'a4paper').'papersize': 'letterpaper', The font size ('10pt', '11pt' or '12pt').'pointsize': '10pt', Additional stuff for the LaTeX preamble.'preamble': '', Grouping the document tree into LaTeX files. List of tuples (source start file, target name, title, author, documentclass [howto, manual, or own class]). The name of an image file (relative to this directory) to place at the top of the title page.latex_logo = None For "manual" documents, if this is true, then toplevel headings are parts, not chapters.latex_use_parts = False If true, show page references after internal links.latex_show_pagerefs = False If true, show URL addresses after external links.latex_show_urls = False Documents to append as an appendix to all manuals.latex_appendices = [] If false, no module index is generated.latex_domain_indices = True -- Options for manual page output --------------------------------------- One entry per manual page. List of tuples (source start file, name, description, authors, manual section). If true, show URL addresses after external links.man_show_urls = False -- Options for Texinfo output ------------------------------------------- Grouping the document tree into Texinfo files. List of tuples (source start file, target name, title, author, dir menu entry, description, category) Documents to append as an appendix to all manuals.texinfo_appendices = [] If false, no module index is generated.texinfo_domain_indices = True How to display URL addresses: 'footnote', 'no', or 'inline'.texinfo_show_urls = 'footnote' If true, do not generate a @detailmenu in the "Top" node's menu.texinfo_no_detailmenu = False
7,035
0.835908