package
stringlengths
1
122
pacakge-description
stringlengths
0
1.3M
zsv.ticker
zsv.tickerenables flexible and idiomatic regular execution of tasks:from zsv.ticker import Ticker ticker = Ticker() ticker.start(5) while ticker.tick(): execute_task()Tickeraims to be more idiomatic and easy to use than a time calculation and sleep call, and further enables the instantaneous termination of a waiting task:import signal from time import sleep from zsv.ticker import Ticker ticker = Ticker() ticker.start(5) def abort(signum, frame): ticker.stop() signal.signal(signal.SIGINT, abort) while ticker.tick(): print("tick") sleep(2) print("tock")The above script wraps astopcall in a signal handler registered to SIGINT: hitting Ctrl+C after the script prints “tick” but before it prints “tock” will yield a final “tock” before it terminates.
zswag
Zswagzswag is a set of libraries for using/hosting zserio services through OpenAPI.Table of Contents:ComponentsSetupFor Python UsersFor C++ UsersOpenAPI Generator CLIGenerator Usage ExampleDocumentation extractionServer Component (Python)Using the Python ClientC++ ClientClient Environment SettingsHTTP Proxies and AuthenticationSwagger User InterfaceOpenAPI Options InteroperabilityHTTP methodRequest BodyURL Blob ParameterURL Scalar ParameterURL Array ParameterURL Compound ParameterServer URL Base PathAuthentication SchemesComponentsThe zswag repository contains two main libraries which provide OpenAPI layers for zserio Python and C++ clients. For Python, there is even a generic zserio OpenAPI server layer.The following UML diagram provides a more in-depth overview:Here are some brief descriptions of the main components:zswagclis a C++ Library which exposes the zserio OpenAPI service clientOAClientas well as the more genericOpenApiClientandOpenApiConfigclasses. The latter two are reused for the Python client library.zswagis a Python Library which provides both a zserio Python service client (OAClient) as well as a zserio-OpenAPI server layer based on Flask/Connexion (OAServer). It also contains the command-line toolzswag.gen, which can be used to generate an OpenAPI specification from a zserio Python service class.pyzswagclis a binding library which exposes the C++-based OpenApi parsing/request functionality to Python.Please consider it "internal".httpclis a wrapper aroundcpp-httplib, HTTP request configuration and OS secret storage abilities based on thekeychainlibrary.SetupFor Python UsersSimply runpip install zswag.Note: This only works with ...64-bit Python 3.8.x,pip --version>= 19.364-bit Python 3.9.x,pip --version>= 19.3Note:On Windows, make sure that you have theMicrosoft Visual C++ Redistributable Binariesinstalled. You can find the x64 installer here:https://aka.ms/vs/16/release/vc_redist.x64.exeFor C++ UsersUsing CMake, you can ...🌟run tests.🌟build the zswag wheels for a custom Python version.🌟integrate the C++ client into a C++ project.Dependencies are managed via CMake'sFetchContentmechanism and Conan 2.0. Make sure you have a recent version of CMake (>= 3.24) and Conan (>= 2.0.5) installed.The basic setup follows the usual CMake configure/build steps:mkdirbuild&&cdbuild cmake.. cmake--build.Note:The Python environment used for configuration will be used to build the resulting wheels. After building, you will find the Python wheels underbuild/bin/wheel.To run tests, just execute CTest at the top of the build directory:cdbuild&&ctest--verboseOpenAPI Generator CLIAfter installingzswagvia pip asdescribed above, you can runpython -m zswag.gen, a CLI to generate OpenAPI YAML files. The CLI offers the following optionsusage: Zserio OpenApi YAML Generator [-h] -s service-identifier -i zserio-or-python-path [-r zserio-src-root-dir] [-p top-level-package] [-c tags [tags ...]] [-o output] [-b BASE_CONFIG_YAML] optional arguments: -h, --help show this help message and exit -s service-identifier, --service service-identifier Fully qualified zserio service identifier. Example: -s my.package.ServiceClass -i zserio-or-python-path, --input zserio-or-python-path Can be either ... (A) Path to a zserio .zs file. Must be either a top- level entrypoint (e.g. all.zs), or a subpackage (e.g. services/myservice.zs) in conjunction with a "--zserio-source-root|-r <dir>" argument. (B) Path to parent dir of a zserio Python package. Examples: -i path/to/schema/main.zs (A) -i path/to/python/package/parent (B) -r zserio-src-root-dir, --zserio-source-root zserio-src-root-dir When -i specifies a zs file (Option A), indicate the directory for the zserio -src directory argument. If not specified, the parent directory of the zs file will be used. -p top-level-package, --package top-level-package When -i specifies a zs file (Option A), indicate that a specific top-level zserio package name should be used. Examples: -p zserio_pkg_name -c tags [tags ...], --config tags [tags ...] Configuration tags for a specific or all methods. The argument syntax follows this pattern: [(service-method-name):](comma-separated-tags) Note: The -c argument may be applied multiple times. The `comma-separated-tags` must be a list of tags which indicate OpenApi method generator preferences. The following tags are supported: get|put|post|delete : HTTP method tags query|path| : Parameter location tags header|body flat|blob : Flatten request object, or pass it as whole blob. (param-specifier) : Specify parameter name, format and location for a specific request-part. See below. security=(name) : Set a particular security scheme to be used. The scheme details must be provided through the --base-config-yaml. path=(method-path) : Set a particular method path. May contain placeholders for path params. A (param-specifier) tag has the following schema: (field?name=... &in=[path|body|query|header] &format=[binary|base64|hex] [&style=...] [&explode=...]) Examples: Expose all methods as POST, but `getLayerByTileId` as GET with flat path-parameters: `-c post getLayerByTileId:get,flat,path` For myMethod, put the whole request blob into the a query "data" parameter as base64: `-c myMethod:*?name=data&in=query&format=base64` For myMethod, set the "AwesomeAuth" auth scheme: `-c myMethod:security=AwesomeAuth` For myMethod, provide the path and place myField explicitely in a path placeholder: `-c 'myMethod:path=/my-method/{param},... myField?name=param&in=path&format=string'` Note: * The HTTP-method defaults to `post`. * The parameter 'in' defaults to `query` for `get`, `body` otherwise. * If a method uses a parameter specifier, the `flat`, `body`, `query`, `path`, `header` and `body`-tags are ignored. * The `flat` tag is only meaningful in conjunction with `query` or `path`. * An unspecific tag list (no service-method-name) affects the defaults only for following, not preceding specialized tag assignments. -o output, --output output Output file path. If not specified, the output will be written to stdout. -b BASE_CONFIG_YAML, --base-config-yaml BASE_CONFIG_YAML Base configuration file. Can be used to fully or partially substitute --config arguments, and to provide additional OpenAPI information. The YAML file must look like this: method: # Optional method tags dictionary <method-name|*>: <list of config tags> securitySchemes: ... # Optional OpenAPI securitySchemes info: ... # Optional OpenAPI info section servers: ... # Optional OpenAPI servers section security: ... # Optional OpenAPI global securityGenerator Usage exampleLet's consider the following zserio service saved undermyapp/services.zs:package services; struct Request { int32 value; }; struct Response { int32 value; }; service MyService { Response myApi(Request); };An OpenAPI fileapi.yamlforMyServicecan now be created with the followingzswag.geninvocation:cdmyapp python-mzswag.gen-sservices.MyService-iservices.zs-oapi.yamlYou can further customize the generation using-cconfiguration arguments. For example,-c get,flat,pathwill recursively "flatten" the zserio request object into it's compound scalar fields usingx-zserio-request-partfor all methods. If you want to change OpenAPI parameters only for one particular method, you can prefix the tag config argument with the method name (-c methodName:tags...).Documentation ExtractionWhen invokingzswag.genwith-i zserio-filean attempt will be made to populate the service/method/request/response descriptions with doc-strings that are extracted from the zserio sources.For structs and services, the documentation is expected to be enclosed by/*! .... !*/markers preceding the declaration:/*!### My Markdown Struct DocI choose to __highlight__ this word.!*/structMyStruct{...};For service methods, a single-line doc-string is parsed which immediately precedes the declaration:/** This method is documented. */ReturnTypemyMethod(ArgumentType);Server ComponentTheOAServercomponent gives you the power to marry a zserio-generated app server class with a user-written app controller and a fitting OpenAPI specification. It is based onFlaskandConnexion.Implementation choice regarding HTTP response codes:The server as implemented here will return HTTP code400(Bad Request) when the user request could not be parsed, and500(Internal Server Error) when a different exception occurred while generating the response/running the user's controller implementation.Integration ExampleWe consider the samemyappdirectory with aservices.zszserio file as already used in theOpenAPI Generator Example.Note:myappmust be available as a module (it must be possible toimport myapp).We recommend to run the zserio Python generator invocation inside themyappmodule's__init__.py, like this:importzseriofromos.pathimportdirname,abspathworking_dir=dirname(abspath(__file__))zserio.generate(zs_dir=working_dir,main_zs_file="services.zs",gen_dir=working_dir)A server script likemyapp/server.pymight then look as follows:importzswagimportmyapp.controllerascontrollerfrommyappimportworking_dir# This import only works after zserio generation.importservices.apiasservicesapp=zswag.OAServer(controller_module=controller,service_type=services.MyService.Service,yaml_path=working_dir+"/api.yaml",zs_pkg_path=working_dir)if__name__=="__main__":app.run()The server script above references two important components:AnOpenAPI file(myapp/api.yaml): Upon startup,OAServerwill output an error message if this file does not exist. The error message already contains the correct command to invoke theOpenAPI Generator CLIto generatemyapp/api.yaml.Acontroller module(myapp/controller.py): This file provides the actual implementations for your service endpoints.For the current example,controller.pymight look as follows:importservices.apiasservices# Written by youdefmy_api(request:services.Request):returnservices.Response(request.value*42)Using the Python ClientThe generic Python client talks to any zserio service that is running via HTTP/REST, and provides an OpenAPI specification of it's interface.Integration ExampleAs an example, consider a Python module calledmyappwhich has the samemyapp/__init__.pyandmyapp/services.zszserio definition aspreviously mentioned. We consider that the server is providing its OpenAPI spec underlocalhost:5000/openapi.json.In this setting, a clientmyapp/client.pymight look as follows:fromzswagimportOAClientimportservices.apiasservicesopenapi_url="http://localhost:5000/openapi.json"# The client reads per-method HTTP details from the OpenAPI URL.# You can also pass a local file by setting the `is_local_file` argument# of the OAClient constructor.client=services.MyService.Client(OAClient(openapi_url))# This will trigger an HTTP request under the hood.client.my_api(services.Request(1))As you can see, an instance ofOAClientis passed into the constructor for zserio to use as the service client's transport implementation.Note:While connecting, the client will also use ...Persistent HTTP configuration.Additional HTTP query/header/cookie/proxy/basic-auth configs passed into theOAClientconstructor using an instance ofzswag.HTTPConfig. For example:fromzswagimportOAClient,HTTPConfigimportservices.apiasservicesconfig=HTTPConfig()\.header(key="X-My-Header",val="value")\# Can be specified.cookie(key="MyCookie",val="value")\# multiple times..query(key="MyCookie",val="value")\#.proxy(host="localhost",port=5050,user="john",pw="doe")\.basic_auth(user="john",pw="doe")\.bearer("bearer-token")\.api_key("token")client=services.MyService.Client(OAClient("http://localhost:8080/openapi.",config=config))# Alternative when specifying api-key or bearerclient=services.MyService.Client(OAClient("http://localhost:8080/openapi.",api_key="token",bearer="token"))Note:The additionalconfigwill only enrich, not overwrite the default persistent configuration. If you would like to prevent persistent config from being considered at all, setHTTP_SETTINGS_FILEto empty, e.g. viaos.environ['HTTP_SETTINGS_FILE']=''C++ ClientThe generic C++ client talks to any zserio service that is running via HTTP/REST, and provides an OpenAPI specification of its interface. When using the C++OAClientwith your zserio schema, make sure that the flags-withTypeInfoCodeand-withReflectionCodeare passed to the zserio C++ emitter.Integration ExampleAs an example, we consider themyappdirectory which contains aservices.zszserio definition aspreviously mentioned.We assume that zswag is added tomyappas aGit submoduleundermyapp/zswag.Next tomyapp/services.zs, we place amyapp/CMakeLists.txtwhich describes our project:project(myapp)# If you are not interested in building zswag Python# wheels, you can set the following option:# set(ZSWAG_BUILD_WHEELS OFF)# If your compilation environment does not provide# libsecret, the following switch will disable keychain integration:# set(ZSWAG_KEYCHAIN_SUPPORT OFF)# This is how C++ will know about the zswag lib# and its dependencies, such as zserio.if(NOTTARGETzswag)FetchContent_Declare(zswagGIT_REPOSITORY"https://github.com/ndsev/zswag.git"GIT_TAG"v1.5.0"GIT_SHALLOWON)FetchContent_MakeAvailable(zswag)endif()find_package(OpenSSLCONFIGREQUIRED)target_link_libraries(httplibINTERFACEOpenSSL::SSL)# This command is provided by zswag to easily create# a CMake C++ reflection library from zserio code.add_zserio_library(${PROJECT_NAME}-zserio-cppWITH_REFLECTIONROOT"${CMAKE_CURRENT_SOURCE_DIR}"ENTRYservices.zsTOP_LEVEL_PKGmyapp_services)# We create a myapp client executable which links to# the generated zserio C++ library and the zswag client# library.add_executable(${PROJECT_NAME}client.cpp)# Make sure to link to the `zswagcl` targettarget_link_libraries(${PROJECT_NAME}${PROJECT_NAME}-zserio-cppzswagcl)Theadd_executablecommand above references the filemyapp/client.cpp, which contains the code to actually use the zswag C++ client.#include"zswagcl/oaclient.hpp"#include<iostream>#include"myapp_services/services/MyService.h"usingnamespacezswagcl;usingnamespacehttpcl;namespaceMyService=myapp_services::services::MyService;intmain(intargc,char*argv[]){// Assume that the server provides its OpenAPI definition hereautoopenApiUrl="http://localhost:5000/openapi.json";// Create an HTTP client to be used by our OpenAPI clientautohttpClient=std::make_unique<HttpLibHttpClient>();// Fetch the OpenAPI configuration using the HTTP clientautoopenApiConfig=fetchOpenAPIConfig(openApiUrl,*httpClient);// Create a Zserio reflection-based OpenAPI client that// uses the OpenAPI configuration we just retrieved.autoopenApiClient=OAClient(openApiConfig,std::move(httpClient));// Create a MyService client based on the OpenApi-Client// implementation of the zserio::IServiceClient interface.automyServiceClient=MyService::Client(openApiClient);// Create the request objectautorequest=myapp_services::services::Request(2);// Invoke the REST endpoint. Mind that your method-// name from the schema is appended with a "...Method" suffix.autoresponse=myServiceClient.myApiMethod(request);// Print the responsestd::cout<<"Got "<<response.getValue()<<std::endl;}Note:While connecting,HttpLibHttpClientwill also use ...Persistent HTTP configuration.Additional HTTP query/header/cookie/proxy/basic-auth configs passed into theOAClientconstructor using an instance ofhttpcl::Config. You can include this class via#include "httpcl/http-settings.hpp". The additionalConfigwill only enrich, not overwrite the default persistent configuration. If you would like to prevent persistent config from being considered at all, setHTTP_SETTINGS_FILEto empty, e.g. viasetenv.Client Environment SettingsBoth the Python and C++ Clients can be configured using the following environment variables:Variable NameDetailsHTTP_SETTINGS_FILEPath to settings file for HTTP proxies and authentication, seenext sectionHTTP_LOG_LEVELVerbosity level for console/log output. Set todebugfor detailed output.HTTP_LOG_FILELogfile-path (including filename) to redirect console output. The log will rotate with three files (HTTP_LOG_FILE,HTTP_LOG_FILE-1,HTTP_LOG_FILE-2).HTTP_LOG_FILE_MAXSIZEMaximum size of the logfile, in bytes. Defaults to 1GB.HTTP_TIMEOUTTimeout for HTTP requests (connection+transfer) in seconds. Defaults to 60s.HTTP_SSL_STRICTSet to any nonempty value for strict SSL certificate validation.Persistent HTTP Headers, Proxy, Cookie and AuthenticationBoth the PythonOAClientand C++HttpLibHttpClientread a YAML file stored under a path which is given by theHTTP_SETTINGS_FILEenvironment variable. The YAML file contains a list of HTTP-related configs that are applied to HTTP requests based on a regular expression which is matched against the requested URL.For example, the following entry would match all requests due to the.*url-match-pattern:-url:.*basic-auth:user:johndoekeychain:keychain-service-stringproxy:host:localhostport:8888user:testkeychain:...cookies:key:valueheaders:key:valuequery:key:valueapi-key:valueNote:Forproxyconfigs, the credentials are optional.Theapi-keysetting will be applied under the correct cookie/header/query parameter, if the service you are connecting to uses anOpenAPIapiKeyauth scheme.Passwords can be stored in clear text by setting apasswordfield instead of thekeychainfield. Keychain entries can be made with different tools on each platform:Linuxsecret-toolmacOSadd-generic-passwordWindowscmdkeySwagger User InterfaceIf you have installedpip install "connexion[swagger-ui]", you can view API docs of your service under[/prefix]/ui.OpenAPI Options InteroperabilityThe Server, Clients and Generator offer various degrees of freedom regarding the OpenAPI YAML file. The following sections detail which components support which aspects of OpenAPI. The difference in compliance is mostly due to limited development scopes. If you are missing a particular OpenAPI feature for a particular component, feel free to create an issue!Note:For all options that are not supported byzswag.gen, you will need to manually edit the OpenAPI YAML file to achieve the desired configuration. You will also need to edit the file manually to fill in meta-info (provider name, service version, etc.).HTTP methodTo change theHTTP method, the desired method name is placed as the key under the method path, such as in the following example:paths:/methodName:{get|post|put|delete}:...Component SupportFeatureC++ ClientPython ClientOAServerzswag.gengetpostputdelete✔️✔️✔️✔️patch❌️❌️❌️❌️Note:Patch is unsupported, because the required semantics of a partial object update cannot be realized in the zserio transport layer interface.Request BodyA server can instruct clients to transmit their zserio request object in the request body when using HTTPpost,putordelete. This is done by setting the OpenAPIrequestBody/contenttoapplication/x-zserio-object:requestBody:content:application/x-zserio-object:schema:type:stringComponent SupportFeatureC++ ClientPython ClientOAServerzswag.genapplication/x-zserio-object✔️✔️✔️✔️URL Blob ParameterZswag tools support an additional OpenAPI method parameter field calledx-zserio-request-part. Through this field, a service provider can express that a certain request parameter only contains a part of, or the whole zserio request object. When parameter contains the whole request object,x-zserio-request-partshould be set to an asterisk (*):parameters:-description:''in:query|path|headername:parameterNamerequired:truex-zserio-request-part:"*"schema:format:string|byte|base64|base64url|hex|binaryAbout theformatspecifier value:Bothstringandbinaryresult in a raw URL-encoded string buffer.Bothbyteandbase64result in a standard Base64-encoded value. Thebase64urloption indicates URL-safe Base64 format.Thehexencoding produces a hexadecimal encoding of the request blob.Note:When a parameter is passed within=path, its valuemust not be empty. This holds true for strings and bytes, but also for arrays (see below).Component SupportFeatureC++ ClientPython ClientOAServerzswag.genx-zserio-request-part: *✔️✔️✔️✔️format: string✔️✔️✔️✔️format: byte✔️✔️✔️✔️format: hex✔️✔️✔️✔️URL Scalar ParameterUsingx-zserio-request-part, it is also possible to transfer only a single scalar (nested) member of the request object:parameters:-description:''in:query|path|headername:parameterNamerequired:truex-zserio-request-part:"[parent.]*member"schema:format:string|byte|base64|base64url|hex|binaryIn this case,x-zserio-request-partshould point to a scalar type, such asuint8,float32,stringetc.Theformatvalue effect remains as explained above. A small difference exists for integer types: Their hexadecimal representation will be the natural numeric one, not binary.Component SupportFeatureC++ ClientPython ClientOAServerzswag.genx-zserio-request-part: <[parent.]*member>✔️✔️✔️✔️URL Array ParameterThex-zserio-request-partmay also point to an array member of the zserio request struct, like so:parameters:-description:''in:query|path|headerstyle:form|simple|label|matrixexplode:true|falsename:parameterNamerequired:truex-zserio-request-part:"[parent.]*array_member"schema:format:string|byte|base64|base64url|hex|binaryIn this case,x-zserio-request-partshould point to an array of scalar types. The array will be encoded according to theformat, style and explodespecifiers.FeatureC++ ClientPython ClientOAServerzswag.genx-zserio-request-part: <[parent.]*array_member>✔️✔️✔️✔️style: simple✔️✔️✔️✔️style: form✔️✔️✔️✔️style: label✔️✔️❌✔️style: matrix✔️✔️❌✔️explode: true✔️✔️✔️✔️explode: false✔️✔️✔️✔️URL Compound ParameterIn this case,x-zserio-request-partpoints to a zserio compound struct instead of a field with a scalar value.This is currently not supported.Component SupportFeatureC++ ClientPython ClientOAServerzswag.genx-zserio-request-part: <[parent.]*compound_member>❌️❌️❌️❌️Server URL Base PathOpenAPI allows for aserversfield in the spec that lists URL path prefixes under which the specified API may be reached. The OpenAPI clients looks into this list to determine a URL base path from the first entry in this list. A sample entry might look as follows:servers: - http://unused-host-information/path/to/my/apiThe OpenAPI client will then call methods with your specified host and port, but prefix the/path/to/my/apistring.Component SupportFeatureC++ ClientPython ClientOAServerzswag.genservers✔️✔️✔️✔️Authentication SchemesTo facilitate the communication of authentication needs for the whole or parts of a service, OpenAPI allows forsecuritySchemesandsecurityfields in the spec. Please refer to the relevant parts of theOpenAPI 3 specificationfor some examples on how to integrate these fields into your spec.Zswag currently understands the following authentication schemes:HTTP Basic Authorization:If a called endpoint requires HTTP basic auth, zswag will verify that the HTTP config contains basic-auth credentials. If there are none, zswag will throw a descriptive runtime error.HTTP Bearer Authorization:If a called endpoint requires HTTP bearer auth, zswag will verify that the HTTP config contains a header with the key nameAuthorizationand the valueBearer <token>,case-sensitive.API-Key Cookie:If a called endpoint requires a Cookie API-Key, zswag will either applytheapi-keysetting, or verify that the HTTP config contains a cookie with the required name,case-sensitive.API-Key Query Parameter:If a called endpoint requires a Query API-Key, zswag will either apply theapi-keysetting, or verify that the HTTP config contains a query key-value pair with the required name,case-sensitive.API-Key Header:If a called endpoint requires an API-Key Header, zswag will either apply theapi-keysetting, or verify that the HTTP config contains a header key-value pair with the required name,case-sensitive.Note: If you don't want to pass your Basic-Auth/Bearer/Query/Cookie/Header credential through yourpersistent config, you can pass ahttpcl::Config/HTTPConfigobject to theOAClient/OAClient. constructor in C++/Python with the relevant detail.Component SupportFeatureC++ ClientPython ClientOAServerzswag.genHTTP Basic-AuthHTTP Bearer-AuthCookie API-KeyHeader API-KeyQuery API-Key✔️✔️✔️(**)✔️OpenID ConnectOAuth2❌️❌️✔️(**)❌️(**): The server support for all authentication schemes depends on your configuration of the WSGI server (Apache/Nginx/...) which wraps the zswag Flask app.
zswiss
No description available on PyPI.
zsx-some-tools
Don't Read Me!
zt
Example PackageThis is a simple example package. You can useGithub-flavored Markdownto write your content.
ztask
ZtaskZtaskhelps to log task inzohoprojectsand complete the damned timesheets from the terminal using aTaskwarriorinspired syntax.This little program is made by and for terminal enthusiasts,enjoy it!RequirementsYou only need a distribution of python3 installed.⚙️Installation:You can install the requirements (preferably in an environment) using:pip install ztaskDownload directly the script and set the variables at your user path in .ztask/env_variables.py, more details about these variables bellow.If you install "ztask" in a environment you will need to initialize the environment before using ztask, for so sometimes is convenient to use an alias like:alias eztask='conda activate <env_name> && ztask'Usage:Ztask, as it should be, is aterminal user interfacethat can be run with command "ztask":For printing your zoho task:ztaskShows all the table, without truncating the table:ztask longLog the task in zoho:ztask log number_of_task 'date' hh:mmZtask date suports natural language such as: 'today', 'yesterday' etcExamples:Log the task 4, two days ago with a duration of 7:30 hours:ztask log 4 '2 days ago' 07:30Log the taks 12 today 8 hours:ztask log 12 'today' 08:00💾 env variablesThe first time you execute the program will create a file in your user directory, and will ask you to fill the content using a terminal interface.If something fails in the process the file should look like:C:\Users\YOUR USER NAME\.ztask\ztask.iniOr in Unix based systems:/home/YOUR USER NAME/.ztask/ztask.iniSet the following env variables in the env_variables.py file (copy paste and fill):[variables]client_id = <YOUR CLIENT ID>client_secret = <YOUR CLIENT SECRET>refresh_token = <YOUR REFRESH TOKEN>user_id = <YOUR USER ID>These variables can be found athttps://api-console.zoho.euafter creating a self client.You can get your refresh_token after getting first the grant token. Go to self client same web and generate the grant token using the scope:ZohoProjects.tasks.ALL,ZohoProjects.timesheets.ALL,ZohoProjects.projects.ALL,ZohoProjects.portals.READ,ZohoProjects.bugs.ALLIf you couldn't get the config file done you can get your refresh token using the grant_token:ztask get_refresh_token "YOUR GRANT TOKEN"The user_id can be found at zoho projects, clicking in the right corner (user icon)
ztc
-- if it’s not monitored, it doesn’t exist#################### IntroZTC is collection of templates and scripts (UserParameter's) for zabbixmonitoring system [http://zabbix.com].It includes script and templates for comprehensive monitoring of Linux OS,nginx and apache web servers, PostgreSQL and MySQL databases, java apps andmore.Please check wiki for full and most recent information:https://bitbucket.org/rvs/ztc/wiki/Home########################################################### License:GPLv3 unless specified in the beginning of file#################### Authors:* Vladimir Rusinov - Maitainer, primary developer<[email protected]>* Denis Seleznyov [https://bitbucket.org/xy2/]# contrib:* Artem Silenkov, 2gis [http://2gis.ru]# 3rd parties:* Greg Sabino Mullane - check_postgres plugin for Nagios and others (used inPostgreSQL template)<[email protected]>http://www.bucardo.org/check_postgres/* Mucknet - parts of Linux template (some disk stats items)http://www.muck.net/?p=19* check_postgres.pl authors* Allan Saddi <[email protected]>* Artem Silenkov* Alex Lov# Other copyright holders:* Murano Softwarehttp://muranosoft.com/ http://muranosoft.ru/* Docufide, Inc. / Parchment, Inc.http://www.docufide.com/ http://www.parchment.com/* Wrike, Inc.http://www.wrike.com/########################################################### Become an author/contributor/tester!hg repo: http://bitbucket.org/rvs/ztc/Please, send your bugreports, comments, patches and fixes to:* http://bitbucket.org/rvs/ztc/* http://greenmice.info/* mailto:[email protected]* Jabber/GTalk/MSN: [email protected]* Skype/Yahoo: v.rusinovThanks!
ztchooks
ZTC Hooks for Python3ztchooksprovides primitives for serializing and verifying hooks fired fromZeroTier CentralWebhook signatures from ZeroTier Central are in the HTTP header field:X-ZTC-SignatureExample Flask app can be found in theexample/subfolderLicenseCopyright 2023 ZeroTier, Inc. All rights reserved. Licensed under the Mozilla Public License Version 2.0. See theLICENSEfile for the full license text.
ztctl
No description available on PyPI.
ztdebugger
Detail description can be found athttps://github.com/zhou6140919/debugger
ztDemo
No description available on PyPI.
zt-dlipower
Digital Loggers Network Power Switch Python ModuleThis is a python module and a script to mange the Digital Loggers Web Power switch.The module provides a python class named PowerSwitch that allows managing the web power switch from python programs.When run as a script this acts as a command line utility to manage the DLI Power switch.SUPPORTED DEVICESThis module has been tested against the following Digital Loggers Power network power switches:ProSwitchWebPowerSwitch IIWebPowerSwitch IIIWebPowerSwitch IVWebPowerSwitch VEthernet Power Controller IIIExampleimportdlipowerprint("Connecting to a DLI PowerSwitch at lpc.digital-loggers.com")switch=dlipower.PowerSwitch(hostname="lpc.digital-loggers.com",userid="admin")print("Turning off the first outlet")switch.off(1)print("The powerstate of the first outlet is currently",switch[0].state)print('Renaming the first outlet as "Traffic light"')switch[0].name="Traffic light"print("The current status of the powerswitch is:")print(switch)Connecting to a DLI PowerSwitch at lpc.digital-loggers.comTurning off the first outletThe powerstate of the first outlet is currently OFFRenaming the first outlet as "Traffic light"The current status of the powerswitch is:DLIPowerSwitch at lpc.digital-loggers.comOutlet Hostname State1 Traffic light OFF2 killer robot ON3 Buiten verlicti ON4 Meeting Room Li OFF5 Brocade LVM123 ON6 Shoretel ABC123 ON7 Shortel 24V - T ON8 Shortel 24V - T ON
zteb
ZTEB -- ZTEB is Tony's Electronic Birthday-CardGetting Started$pipinstallzteb $ztebunwrapBackground StoryNedelcho Petrov and me, being the great friends that we are, were brainstorming ideas for Tony's (Anton Karakochev) birthday present at the very last moment. Inbetween of trying to find a rather unique and satisfying present and entertaining ourselves, as, did I say, great friends, we considered everything from a set of fresh winter tyres to mount a car onto to some bitcoins (or infinitesimal fractions thereof) to be locked for good as a nice (?) investment for the next twenty years. I thought about this for a while on my own, but concluded that even though such an investment could probably be sufficient to buy a new car, it would be a shame if there are no tyres to mount it on. I took the idea a bit further (or behind) and decided to lock a simple birthday card in an electronic time capsule of some sort, so it could only be read after three days. This would make for some present and prevent Tony from realising what kind of friends he has, or at least in our presence.About the ProjectZTEBprovides a simple command line interface to create a sort of electronic time capsules, the content of which can only be retrieved after a specified amount of time. The functionality is based on the paperTime-lock puzzles and timed-release Cryptoby Rivest, Shamir and Wagner and relies on encrypting the contents of the capsule and only exposing information on how to retrieve the encryption key with significant computational effort. In case our current beliefs on complexity classes (P/NP) and prime number factorization techniques are correct, a fixed amount of iterations is required to solve the puzzle. The time it takes to perform a single iteration, however, can vary greatly between various machines and algorithm implementations, the average naturally decreasing as more powerful CPUs are produced. This implementation can create a capsule which takes approximately the specified amount of time to open on the current machine, running the same operating system, running the current code, on the same Python interpreter, using the same...CLICreating a time capsuleUsage: zteb wrap [OPTIONS] CARD OUTPUT Wrap an electronic birthday-card. Options: -w, --wrapper-text PATH Optional path to file containing wrapper text. This is shown while unwrapping the card. -d, --duration DELTA Desired amount of time for the unwrapping to take in the format of pandas.Timedelta. --help Show this message and exit.Example$ztebwrapamazing-capsule-contents.txtcapsule.zteb-d13:37:00Opening a time capsuleUsage: zteb unwrap [OPTIONS] Unwrap an electronic birthday-card. Options: -c, --card PATH Path to a wrapped birthday-card. If not specified, the built-incard for Tony's birthday is being unwrapped. -o, --output-file PATH Path to file to store card message to. -s, --silent Suppress all stdout output. --help Show this message and exit.Example$ztebunwrap-ccapsule.zteb
ztech-pythena
pythenaThis is a simple python module that will allow you to query athena the same way the AWS Athena console would. It only requires a database name and query string.Installpipinstallztech-pythenaSetupBe sure to set up your AWS authentication credentials. You can do so by using the aws cli and runningpip install awscli aws configureMore help on configuring the aws cli herehttps://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.htmlSimple Usageimportpythenaathena_client=pythena.Athena("mydatabase")# Returns results as a pandas dataframedf=athena_client.execute("select * from mytable")print(df.sample(n=2))# Prints 2 rows from your dataframeConnect to Databaseimportpythena# Connect to a databaseathena_client=pythena.Athena(database="mydatabase")# Connect to a database and override default aws region in your aws configurationathena_client=pythena.Athena(database="mydatabase",region='us-east-1')athena_client.execute()execute( query = 'SQL_QUERY', # Required s3_output_url='FULL_S3_PATH', # Optional (Format example: 's3://mybucket/mydir' save_results=TRUE | FALSE # Optional. Defaults to True only when 's3_output_url' is provided. If True, the s3 results will not be deleted and an tuple is returned with the execution_id. run_async=TRUE | FALSE # Optional. If True, allows you to run the query asynchronously. Returns execution_id, use get_result(execution_id) to fetch it when finished )Full Usage Examplesimportpythena# Prints out all databases listed in the glue catalogpythena.print_databases()pythena.print_databases(region='us-east-1')# Overrides default region# Gets all databases and returns as a listpythena.get_databases()pythena.get_databases(region='us-east-1')# Overrides default region# Connect to a databaseathena_client=pythena.Athena(database="mydatabase")# Prints out all tables in a databaseathena_client.print_tables()# Gets all tables in the database you are connected to and returns as a listathena_client.get_tables()# Execute a querydataframe=athena_client.execute(query="select * from my_table")# Results are returned as a dataframe# Execute a query and save results to s3dataframe=athena_client.execute(query="select * from my_table",s3_output_url="s3://mybucket/mydir")# Results are returned as a dataframe# Get Execution Id and save resultsdataframe,execution_id=athena_client.execute(query="select * from my_table",save_results=True)# Execute a query asynchronouslyexecution_id=athena_client.execute(query="select * from my_table",run_async=True)# Returns just the execution iddataframe=athena_client.get_result(execution_id)# Will report errors if query failed or let you know if it is still running# With asynchronous queries, can check status, get error, or cancelpythena.get_query_status(execution_id)pythena.get_query_error(execution_id)pythena.cancel_query(execution_id)NoteBy default, when executing athena queries, via boto3 or the AWS athena console, the results are saved in an s3 bucket. This module by default, assuming a successful execution, will delete the s3 result file to keep s3 clean. If an s3_output_url is provided, then the results will be saved to that location and will not be deleted.
zte-mf823
SynopsisVodem Vodafone K4607-Z Web Interface Python bindingsCode ExampleUse the simple interface:import vodem.simple vodem.simple.sms_send("+16175551212", "Message String") inbox = list(vodem.simple.sms_inbox_unread()) vodem.simple.sms_delete(1)For more advanced features, use the raw api:import vodem.api import vodem.util message = vodem.util.encode_sms_message("Message String") time = vodem.util.encode_time(datetime.datetime.now()) number = "+16175551212;" vodem.api.sms_send({'Number' : number, 'sms_time' : time, 'MessageBody' : message })Exception handling:import vodem.api import vodem.exceptions try: vodem.api.disconnect_network() except vodem.exceptions.VodemError as exc: raiseFor more examples consult the examples directoryMotivationThis interface is built to integrate sms capability into an application, or other functions of the vodem that are exposed via the web interface.It requires the hardware vodem and activated sim card.InstallationUsing PyPipip install vodem-vodafone-K4607-ZUsing Gitgit clone https://github.com/alzeih/python-vodem-vodafone-K4607-Z.git cd python-vodem-vodafone-K4607-Z python setup.py build python setup.py installAPI ReferenceSeehttp://python-vodem-vodafone-k4607-z.readthedocs.org/TestsWarningAs some of the tests are potentially destructive, expensive, or annoying to others, it is best to run tests in a device without a sim card.To ensure you have been made aware of the risks, read test/unit/api/__init__.py for instructions.Unfortunately this restriction doesn’t work without the top test module specified explicitly as this places unittest into discovery mode which ignores the load_tests protocol.Running Testspython -m unittest testContributorsBugs, Feature requests, Documentation, and Contributions are tracked via this respository.This project adheres to theOpen Code of Conduct. By participating, you are expected to honor this code.All code should be checked with pylint, tested and documented.LicenseMIT. See LICENCE.
ztest
No description available on PyPI.
z-test-poetry
No description available on PyPI.
ztest_tejas360
Example PackageThis is a simple example package. You can useGithub-flavored Markdownto write your content.
ztestupload
upload test
ztestutils
Failed to fetch description. HTTP Status Code: 404
zteSuperMath
Failed to fetch description. HTTP Status Code: 404
ztext
ztextThis project is designed for NLP analysis eaily, event you don't have any background of NLP you still can use it for text insights. Functions:Text clean.Topic analysisSVO (Subject Verb and Object extraction)NER (Entity extraction)Topic and SVO visualization (for now Visualization only support run in Jupyter notebook and Colab)installIn python3.6 or later environmentpip install ztextIn IPython, Jupyter notebook or Colab!pip install ztextfrom source:pip3 install git+https://github.com/ZackAnalysis/ztext.gitQuick StartStart a Jupyter notebook locally or a Colab notebook (https://colab.research.google.com/)find a demo athttps://colab.research.google.com/drive/1W2mD6QHOGdVEfGShOR_tBnYHxz_D5ore?usp=sharinginstall package:!pip install ztextimport ztextload sampledata from sampledata:df = ztext.sampledata()zt = ztext.Ztext(df=df, textCol='content',nTopics=5, custom_stopwrods=['sell','home'], samplesize=200)from file!wget https://github.com/ZackAnalysis/ztext/blob/master/ztext/sampleData.xlsx?raw=truefilename = "sampleData.xlsx"zt = ztext.Ztext()zt.loadfile(filename, textCol='content')zt.nTopics = 6zt.custom_stopwords = ['text','not','emotion']from pandas dataframezt.loaddf(df)FunctionsSentiment analysis:zt.sentiment()Topic analysis:zt.get_topics()SVO and NERzt.getSVO('topic2')Visulzationzt.getldaVis()zt.getSVOvis('topic2',options="any")save outputzt.df.to_excel('filename.xlsx)`
ztf-auth
No description available on PyPI.
ztffields
No description available on PyPI.
ztffp
ztf_fpAuthor: Michael C. Stroh, Northwestern UniversityWebsite:www.michaelcstroh.comA python library to streamline requesting Zwicky Transient Facility (ZTF) forced photometry.A simple command line examplepython ztf_fp.py 256.7975042 58.0974194 -source_name 2021kjbOutputSending ZTF request for (R.A.,Decl)=(256.7975042,58.0974194) wget --http-user=ztffps --http-passwd=dontgocrazy! -O ztffp_493YUZW74Q.txt "https://ztfweb.ipac.caltech.edu/cgi-bin/requestForcedPhotometry.cgi?ra=256.797504&dec=58.097419&jdstart=2459269.628723&jdend=2459329.628723&email=<REDACTED>&userpass=<REDACTED>" Waiting for the email (rechecking every 20 seconds). Downloading file... wget --http-user=ztffps --http-password=dontgocrazy! -O forcedphotometry_req00015274_lc.txt "https://ztfweb.ipac.caltech.edu/ztf/ops/forcedphot/lc/0/15/req15274/cksum16bf0dfcd7fc6781336f6d0792a8874d/forcedphotometry_req00015274_lc.txt" Downloading file... wget --http-user=ztffps --http-password=dontgocrazy! -O forcedphotometry_req00015274_log.txt "https://ztfweb.ipac.caltech.edu/ztf/ops/forcedphot/lc/0/15/req15274/cksum16bf0dfcd7fc6781336f6d0792a8874d/forcedphotometry_req00015274_log.txt" Downloaded: 2021kjb_lc.txt Downloaded: 2021kjb_log.txt ZTF_r: 15 detections and 3 upper limits. ZTF_g: 13 detections and 4 upper limits. Creating ./2021kjb ZTF wget log: ./2021kjb/ztffp_493YUZW74Q.txt ZTF downloaded file: ./2021kjb/2021kjb_lc.txt ZTF downloaded file: ./2021kjb/2021kjb_log.txt ZTF figure: ./2021kjb/2021kjb_lc.pngRequirementsSoftware installed on your systempython 3.6+wget (MacOS often is missing this. If so, check out brew, macports or anaconda.)Email address reachable with IMAPPython librariesastropy (for possible time and coordinate conversions)matplotlib (for possible plotting, but easily removable)numpypandaslxmlInstallationgit clone https://github.com/mcstroh/ztf_fp.gitSetupThe library requires your ZTF forced photometry credentials (email and password), and your credentials to access your email address where the links to the ZTF light curve are sent.For bash/zsh equivalents (e.g., .bashrc, .bash_profile, .zshrc, etc)### ZTF forced photometry service ztf_email_address="[email protected]" ztf_email_password="1234567890password" ztf_email_imapserver="imap.mydomain.com" ztf_user_password="01234ztf" export ztf_email_address export ztf_email_password export ztf_email_imapserver export ztf_user_passwordor for csh/tcsh equivalents (e.g.,.cshrc, tcshrc, etc.)setenv ztf_email_address [email protected] setenv ztf_email_password 1234567890password setenv ztf_email_imapserver imap.mydomain.com setenv ztf_user_password 01234ztfNote that if the email you registered with the ZTF forced photometry is an alias for another address, you will need to also defineztf_user_address="[email protected]" export ztf_user_addressor the equivalent for csh and tcsh shells.Check your email configuration - IMPORTANT TO DO THIS FIRST!It is important to verify that the script is able to use your email credentials so that you don't spam the ZTF forced photometry service with duplicate requests while you debug your email setup.Run the following to see if the script can access your email with the provided credentials.Inputpython ztf_fp.py -emailtestSuccessful outputYour email inbox was found and contains 600 messages. If this is not correct, please check your settings.Output if it definitely is not workingYour inbox was not located. Please check your settings.More about running on the command lineSexagesimal coordinates are also supported:python ztf_fp.py 17:07:11.40 +58:05:50.71 -source_name 2021kjbBy default, the script requests forced photometry from the 60 days prior to the moment you submit the job (equivalent to-days 60), but this is easily changed.You may also specify date ranges in JD (-jdstartand-jdendarguments) or MJD (-mjdstartand-mjdendarguments).List of available optionsusage: ztf_fp.py <ra> <decl> [-h] [-logfile [logfile]] [-plotfile [plotfile]] [-emailtest] [-source_name [source_name]] [-mjdstart [mjdstart]] [-mjdend [mjdend]] [-jdstart [jdstart]] [-jdend [jdend]] [-ztf_all_jd] [-days [days]] [-emailcheck [emailcheck]] [-skip_clean] [-directory_path [directory_path]] [-fivemindelay [fivemindelay]] [-skip_plot] [ra] [decl] Grab ZTF forced photometry on the given location. positional arguments: ra Right ascension of the target. Can be provided in DDD.ddd or HH:MM:SS.ss formats. decl Declination of the target. Can be provided in +/-DDD.ddd or DD:MM:SS.ss formats. optional arguments: -h, --help show this help message and exit -logfile [logfile] Log file to process instead of submitting a new job. -plotfile [plotfile] Light curve file to plot instead of submitting and downloading a new job. -emailtest Test your email settings. This is performed without sending a request to the ZTF server. -source_name [source_name] Source name that will be used to name output files. -mjdstart [mjdstart] Start of date range for forced photometry query. Overrides -jdstart. -mjdend [mjdend] End of date range for forced photometry query. Overrides -jdstop -jdstart [jdstart] Start of date range for forced photometry query. -jdend [jdend] End of date range for forced photometry query. -ztf_all_jd Use the full range of ZTF public dates. -days [days] Number of days prior to jdend to query (or number of days prior to today if jdend is not given). -emailcheck [emailcheck] How often to recheck your email for the ZTF results. -skip_clean After completion skip placing all output files in the same directory. -directory_path [directory_path] Path to directory for clean-up. Requires -directory option. -fivemindelay [fivemindelay] How often (in seconds) to query the email after 5 minutes have elapsed. -skip_plot Skip making the plot. Useful for automated and batch use cases, or if user wants to use their personal plotting code.Automated / batch job requestsThis file supports being imported as a library and called for batch processing. See ztf_bulk_example.py for a working example of calling ztf_fp.py using an external script.Below we show the body of ztf_bulk_example.py#! python # # Run ztf_fp.py on a list of coordinates # # M.C. Stroh (Northwestern University) # # from multiprocessing import Pool, cpu_count import numpy as np import pandas as pd import ztf_fp def ztf_forced_photometry(row): # Send ZTF forced photometry request ztf_file_names = ztf_fp.run_ztf_fp(days=20, ra=row.ra, decl=row.decl, source_name=row.source_name, directory_path='/tmp', verbose=False, do_plot=False) # # Do something intelligent with the output # For this example we'll simply list the files for ztf_file_name in ztf_file_names: print(ztf_file_name) return def batch_ztf_forced_photometry(): # # Populate a pandas dataframe with the positions you are interested in # This is a simple example using a couple of SN Ia discovered by the Young Supernova Experiment data = [['2021kcc',194.0331000,-4.9606139],['2021jze',154.9723750,-3.7354000]] # The column names are used in the ztf_forced_photometry function defined above df = pd.DataFrame(data, columns = ['source_name','ra','decl']) n_workers = int(np.floor(cpu_count()/2)) # Requires casting as an integer for pool argument / don't hit the ZTF server too hard pool_vals = [x for _, x in df.iterrows()] # Turn to list for pool mapping function below # Now send to the list to be completed print(f"Processing {len(pool_vals)} ZTF forced photometry requests utilizing {n_workers} workers.") ztf_pool = Pool(n_workers) res = ztf_pool.map(ztf_forced_photometry, pool_vals) ztf_pool.close() ztf_pool.join() if __name__ == "__main__": batch_ztf_forced_photometry()OutputProcessing 2 ZTF forced photometry requests utilizing 4 workers. Sending ZTF request for (R.A.,Decl)=(194.0331,-4.9606139) wget --http-user=ztffps --http-passwd=dontgocrazy! -O ztffp_TAFLM4V59R.txt "https://ztfweb.ipac.caltech.edu/cgi-bin/requestForcedPhotometry.cgi?ra=194.0331&dec=-4.960614&jdstart=2459311.592520&jdend=2459331.592520&email=<REDACTED>&userpass=<REDACTED>" Sending ZTF request for (R.A.,Decl)=(154.972375,-3.7354) wget --http-user=ztffps --http-passwd=dontgocrazy! -O ztffp_4B3X481ZRP.txt "https://ztfweb.ipac.caltech.edu/cgi-bin/requestForcedPhotometry.cgi?ra=154.972375&dec=-3.7354&jdstart=2459311.592520&jdend=2459331.592520&email=<REDACTED>&userpass=<REDACTED>" /tmp/2021kcc/ztffp_TAFLM4V59R.txt /tmp/2021kcc/2021kcc_lc.txt /tmp/2021kcc/2021kcc_log.txt /tmp/2021jze/ztffp_4B3X481ZRP.txt /tmp/2021jze/2021jze_lc.txt /tmp/2021jze/2021jze_log.txtIf you are not interested in the output files, you can direct the files to /tmp using the-directory_pathoption similar to the above example.AcknowledgementsThis project is created at theCenter for Interdisciplinary Exploration and Research in AstrophysicsatNorthwestern University. This work is supported by the Heising-Simons Foundation under grant #2018-0911 awarded toRaffaella Margutti.
ztfidr
No description available on PyPI.
ztfimg
ZTFimg
ztfin2p3
ztfin2p3
ztflc
Force photometry lc fitter
ztfparsnip
ztfparsnipRetrainParsnipforZTF. This is achieved by usingfpbotforced photometry lightcurves of theBright Transient Survey. These are augmented (redshifted, noisified and - when possible - K-corrected).The package is maintained byA. Townsend(HU Berlin) andS. Reusch(DESY).The following augmentation steps are taken for each parent lightcurve to generate a desired number of children (calculated viaweights):draw a new redshift from a cubic distribution with maximum redshift increasedelta_zonly accept the lightcurve if at leastn_det_thresholddatapoints are above the signal-to-noise thresholdSN_thresholdif the lightcurve has an existing SNCosmo template, apply aK-correctionat that magnitude (ifk_corr=True)randomly drop datapoints untilsubsampling_rateis reachedadd some scatter to the observed dates (jd_scatter_sigmain days)ifphase_lim=True, only keep datapoints during a typical duration (depends on the type of source):warning: Note that a highdelta_zwithout loosening theSN_thresholdandn_det_thresholdwill result in a large dropout rate, which will ultimately lead to far less lightcurves being generated than initially desired.UsageCreate an augmented training samplefrompathlibimportPathfromztfparsnip.createimportCreateLightcurvesweights={"sn_ia":9400,"tde":9400,"sn_other":9400,"agn":9400,"star":9400}if__name__=="__main__":sample=CreateLightcurves(output_format="parsnip",classkey="simpleclasses",weights=weights,train_dir=Path("train"),plot_dir=Path("plot"),seed=None,phase_lim=True,k_corr=True,)sample.select()sample.create(plot_debug=False)Train Parsnip with the augmented samplefromztfparsnip.trainimportTrainif__name__=="__main__":train=Train(classkey="simpleclasses",seed=None)train.run()Evaluate the Parsnip modelfromztfparsnip.trainimportTrainif__name__=="__main__":train=Train(classkey="simpleclasses",seed=None)train.classify()
ztfquery
ztfqueryThis package is made to ease access to Zwicky Transient Facility data and data-products. It is maintained by M. Rigault (CNRS/IN2P3) and S. Reusch (DESY).cite ztfqueryztfquery: a python tool to access ztf (and SEDM) dataztfquerycontains a list of tools:ZTF products:a wrapper of theIRSA web APIthat enable to get ztf data(requires access for full data, but not public data):Images and pipeline products, e.g. catalog ; See theztfquery.query.pydocumentationLightCurves (not from image subtraction): See theztfquery.lightcurve.pydocumentationZTF observing logs: See theztfquery.skyvision.pydocumentationMarshal/Fritz:Download the source information and data, such as lightcurves, spectra, coordinates and redshift:from theZTF-I Marshal: See theztfquery.marshal.pydocumentationfrom theZTF-II Fritz: See theztfquery.fritz.pydocumentationSEDM Data:tools to download SEDM data, including IFU cubes and target spectra, frompharosSee theztfquery.sedm.pydocumentationZTF alert:Currently only a simple alert reader. See theztfquery.alert.pydocumentationCreditsCitationMickael Rigault. (2018, August 14). ztfquery, a python tool to access ZTF data (Version doi). Zenodo.http://doi.org/10.5281/zenodo.1345222AcknowledgmentsIf you have usedztfqueryfor a research you are publishing, pleaseinclude the following in your acknowledgments:"The ztfquery code was funded by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement n°759194 - USNAC, PI: Rigault)."Corresponding Authors:M. Rigault:[email protected], CNRS/IN2P3S. Reusch:[email protected], DESYInstallationztfquery requirespython >= 3.8Install the codeusing pip:pip install ztfquery(favored)or for the latest version:go wherever you want to save the folder and thengitclonehttps://github.com/MickaelRigault/ztfquery.gitcdztfquery poetryinstallSet your environmentYou should also create the global variable$ZTFDATA(usually in your~/.bash_profileor~/.cshrc). Data you will download from IRSA will be saved in the directory indicated by$ZTFDATAfollowing the IRSA data structure.Login and Password storageYour credentials will requested the first time you need to access a service (IRSA, Marshal, etc.). They will then be stored, crypted, under ~/.ztfquery. Useztfquery.io.set_account(servicename)to reset it.You can also directly provide account settings when runningload_metadataanddownload_datausing theauth=[your_username, your_password]parameter. Similarly, directly provide the username and password to the ztf ops page when loadingNightSummaryusing theztfops_authparameter.Quick Examples
ztfy.alchemy
ContentsWhat is ztfy.alchemy ?How to use ztfy.alchemy ?Changelog0.3.60.3.50.3.40.3.30.3.20.3.10.3.00.2.50.2.40.2.30.2.20.2.10.20.1.10.1What is ztfy.alchemy ?ZTFY.alchemy is a Zope3 package which can be used to connect Zope3 applications with SQLAlchemy.Main features include :integration of SQLAlchemy transactions with Zope3 transaction managerregister PostgreSQL geometric data types (PostGIS) through GeoTypes package.Most code fragments are based on zope.sqlalchemy, z3c.sqlalchemy and z3c.zalchemy elements and source codes, except for elements handling PostGIS data types..How to use ztfy.alchemy ?#TODO: To be written…Changelog0.3.6added “close_all_connections” function in ztfy.alchemy.engine module. This function should be called in any scheduler task in an after-commit hook to be sure that all databases connections are correctly closed when the task ends0.3.5replace “@listens_for” decorator with “listen” calls in connections events listeners0.3.4added connections cleaning thread to invalidate connections which are still unused five minutes after begin checked-in to connections pool0.3.3small changes in session management with a new argument allowing to create a session without integrating it in the Zope transaction’s scoped sessioncorrected parent’s call in GeometryLINESTRING constructor0.3.2small changes in session managementremove thread-local sessions store0.3.1handle aliases in session management via new getSession() function “alias” argument0.3.0add new getUserSession function which can accept an existing session as input argumentremoved GeoTypes dependency0.2.5changed package source layout0.2.4added SQLAlchemy engines vocabulary0.2.3updated package dependencies0.2.2changed import of threading.local module0.2.1merged updates from z3c.zalchemy parent package0.2switched to ZTK-1.1.20.1.1add “pool_recycle” attribute to IEngineDirective and IAlchemyEngineUtility interfacesuse properties in AlchemyEngineUtilityupdated locales0.1initial release
ztfy.appskin
ContentsIntroductionHISTORY0.3.70.3.60.3.50.3.40.3.3.10.3.30.3.20.3.10.3.00.2.30.2.20.2.10.2.00.1.30.1.20.1.10.1.0IntroductionZTFY.appskin is a base skin for ZTFY based applications.It includes a responsive design based on Twitter Bootstrap.Thierry Florac <[email protected]> - AuthorHISTORY0.3.7added missing “Edge” mode in layouts templates0.3.6updated buildout0.3.5added table actions viewlet managersmall CSS updates0.3.4remove class update on missing action0.3.3.1small CSS update on daterange widgets style0.3.3french locales updates0.3.2include login viewlet in default application skinCSS updates concerning dialogs and data tables0.3.1added z3c.form dynamic javascript to default ZTFY.appskin layout0.3.0added login/logout marker interfaces and views to default AppSkin layer0.2.3add custom tables batch providersmall CSS updates0.2.2small CSS updates0.2.1use last ZTFY.skin classes and remove dependency with ZTFY.blog package0.2.0added new contextual “appskin:resources” TALES expression to get resources from new IApplicationResources interface adapter0.1.3updated french translations0.1.2added warning message for IE 8 or lower incompatibility0.1.1CSS updates0.1.0first release
ztfy.base
ContentsIntroductionHISTORY0.1.30.1.20.1.10.1.0IntroductionA small set of generic content interfaces, adapters and base classes associated to ZTFY packages.Most of these have been extracted from ZTFY.blog to reduce dependencies with this package from other application packages not really using ZTFY.blog content management features.Thierry Florac <[email protected]> - AuthorHISTORY0.1.3changed IBaseContent interface to remove I18n attributes; matching class containing these attributes was moved to ztfy.i18n package, you have to upgrade your packages and update your base classes when using BaseContent class!!remove I18n attributes and checks from several adapters0.1.2changed default IUniqueID adapter to remove initial ‘0x’ from resulting hex value0.1.1corrected ordering methods in OrderedContainer class0.1.0first release
ztfy.baseskin
ContentsIntroductionHISTORY0.2.00.1.0IntroductionZTFY.baseskin is a base package for all ZTFY’s skin-related packages.It mainly contains:a whole set of skin-related interfaces shared by all skinsa base layera small set of forms, buttons and viewlets interfaces, classes and adapters shared by all skin-related packages.Thierry Florac <[email protected]> - AuthorHISTORY0.2.0added script meta base class0.1.0first release
ztfy.beaker
ContentsIntroductionBeaker session configurationsHISTORYIntroductionZTFY.beaker is a small wrapper around Beaker (http://pypi.python.org/pypi/Beaker) session and caching library.It allows you to define a Beaker session throught a ZCML configuration directive to include it in a WSGI application based on ZTFY packages.A BeakerSessionUtility can then be created and registered to act as a session data container.Beaker session configurationsAll Beaker session options can be defined throught ZCML directives. Seemetadirectives.pyto get the complete list of configuration options.For example, to define a Memcached session configuration:<configure xmlns:beaker="http://namespaces.ztfy.org/beaker"> <beaker:memcachedSession url="127.0.0.1:11211" cookie_expires="False" lock_dir="/var/lock/sessions" /> </configure>Directives are available for memory, DBM, file, Memcached and SQLAlchemy sessions storages.Thierry Florac <[email protected]> - AuthorHISTORY0.1.0first release
ztfy.blog
ContentsWhat is ztfy.blog ?How to use ztfy.blog ?Changelog0.6.20.6.10.6.00.5.50.5.40.5.30.5.20.5.10.5.00.4.120.4.110.4.100.4.90.4.80.4.70.4.60.4.50.4.40.4.30.4.20.4.10.4.00.3.130.3.120.3.110.3.100.3.90.3.80.3.70.3.60.3.50.3.40.3.30.3.20.3.10.30.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.20.1.10.1What is ztfy.blog ?ztfy.blog is a set of modules which allows easy management of a simple web site based on Zope3 application server.It’s main goal is to be simple to use and manage.So it’s far from being a “features full” environment, but available features currently include:a simple management interfacesites, organized with sections and internal blogstopics, made of custom elements (text or HTML paragraphs, resources and links)a default front-office skin.All these elements can be extended by registering a simple set of interfaces and adapters, to create a complete web site matching your own needs.A few list of extensions is available in several packages, like ztfy.gallery which provides basic management of images galleries in a custom skin, or ztfy.hplskin which provides another skin.How to use ztfy.blog ?ztfy.blog usage is described via doctests in ztfy/blog/doctests/README.txtChangelog0.6.2replace references to IBaseContent/BaseContent with new II18nBaseContent/I18nBaseContent from “ztfy.i18n” package0.6.1move internal references links generic features to ZTFY.skin package0.6.0extract generic interfaces, components and adapters in ZTFY.base and ZTFY.skin packages to remove unneeded dependencies with ZTFY.blog from other packages.WARNING: some parts of your code may become incompatible with this release!!!0.5.5added missing property in default skin’s site presentation class0.5.4added checks in database upgrade code0.5.3use correct widgets prefix in resources add forms0.5.2remove security proxy on back-office interface adapter0.5.1move several skin-related interfaces and classes to ZTFY.skinuse fancybox plug-in data API from ZTFY.skinreorganized resources to facilitate custom skins not reusing ZTFY.blog CSSimports cleanup0.5.0use ZTFY.skin data APImake package resources compatible with Fanstatic “bottom” option0.4.12removed “$.browser” check which is deprecated in JQuery 1.7use last roles edit form from ztfy.security0.4.11added custom ZODBBrowser state loader for ordered container0.4.10changed style of container batch links0.4.9use generic marker interface and ++back++ namespace to identify contents with custom back-office properties0.4.8updated localesremoved useless title on category add form0.4.7added site’s back-office custom logoremoved useless title on dialog add formsuse “getContentName()” function from ZTFY.utils package when creating new resources or links0.4.6small CSS updates in default skin to match new ZTFY skinadded legend on site’s tree view0.4.5changed “++static++” namespace traverser layer0.4.4changed package source layout0.4.3implement ztfy.security ILocalRoleManager interface0.4.2remove default JPEG format when creating or using thumbnails0.4.1changed batch size to 10000 items in site tree view0.4.0large refactoring due to integration of generic features (forms, javascript…) into ztfy.skin packageadded a global ‘operators’ groups, which has the “ztfy.ViewManagementScreens” permission; any principal receiving an administrator or contributor role will automatically be included in this group.define default BaseEditForm buttonschanged permissions on login viewletminor CSS updates0.3.13small back-office CSS update0.3.12added new back-office presentation properties to add custom CSS, banner and favorites iconchanged dialogs overlay mask color and opacitychanged default dialogs container width0.3.11added BaseDisplayForm and BaseDialogDisplayForm classesadded alternate title on illustrations and updated templates to improve XHTML standard complianceadded HTTP-equiv meta header class and interfaceremoved zope.proxy package dependency0.3.10improved back-office batchingremove closed dialog’s overlays from HTML source code0.3.9updated back-office stylesuse jQuery’s multi-select plug-in for internal reference’s widget (with the help of a new XML-RPC search view)remove form’s error status automatically only if it’s not an error statusadded “CALLBACK” output mode in javascript forms to be able to call a custom callbackadded “getOuput()” method in add and edit forms to get a custom AJAX output in derived formsadded progress bar in forms managing file uploads ; this code is based on Apache2 upload progress module but forms still function correctly if module is not enabledsmall javascript updates0.3.8use absolute URL on workflow forms redirectionsadded display of Google +1 button in presentation settings and templatesadded display of Facebook ‘Like’ button in presentation settings and templates0.3.7add “managers” group on automatic database upgrade0.3.6added “devmode” ZCML condition on manager grants0.3.5corrected automatic database upgrade code (again, sorry…!)0.3.4corrected automatic database upgrade code0.3.3added RSS feedsadded roles management dialogsadded interfaces and adapters to handle HTML metasadded extension in displays URLschanged necessary permission from ztfy.ManageContent to ztfy.ViewManagementScreens to get access to many management dialogscorrect dependencies in default skin resourcesupdated database automatic upgrade codeadd check for II18n adapter in banner viewletadded CSS class for Disqus threads list elementsand a few other little enhancements…0.3.2changed TopicResourcesView to correctly display only selected resourcescheck for I18n adapter result in TitleColumn.renderCell0.3.1migrated resources management from zc.resourcelibrary to fanstatic0.3switch to ZTK-1.1.2fixed JavaScript typonew ISiteManagerTreeViewContent interface to handle presentation of site’s tree view contentschanged breadcrumbs handling to correctly get IBreadcrumbInfo multi-adapterchanged TitleColumn.renderCell to correctly check title’s URLchanged permission required to display “management” linkadded better checking of II18n adapter in several contextsadded ‘ztfy.ViewManagementScreens’ permissionadded “container_interface” attribute on OrderedContainerBaseView for use in “updateOrder” methodadded JavaScript resource for function common to front-office and back-officeremoved many “zope.app” packages dependenciesremoved ztfy.blog.crontab module, which was moved to ztfy.scheduler package to remove a cyclic dependencyswitch “getPrincipal()” function from “ztfy.utils” to “ztfy.security” package0.2.9changed pagination behavioradded pagination on category index pageadded Google site verification code0.2.8changed behavior of categories ‘getVisibleTopics()’ method to also get topics matching sub-categories of the given category0.2.7corrected timezone in sitemap lastmod attributemodified $.ZBlog.form.edit function to add a custom callbackcorrected handling of topics ‘commentable’ property which was ignored0.2.6added IContainerSitemapInfo interface and adapters to handle sitemaps correctly…0.2.5added sitemaps XML views (see “sitemaps.org” for details)0.2.4added workaround to display new sites properties without OIDmoved Google Analytics integration page in default layoutupdate database upgrade code used when creating a site manager0.2.3integration of Google Analytics and AdSense services0.2.2modified topic comments template to correctly handle presentation settings0.2.1small templates modifications for better XHTML complianceadded ‘++presentation++’ namespace traverserchanged ‘title’ index default options0.2added interfaces, base classes and adapters to handle presentation correctly inside custom skinsadded ‘skin:’ and ‘site:’ TALES path adapteradded warning message when displaying a category without any topicchanged topics ordering in topics containers viewschanged fields list of ‘title’ text indexadded missing “content_type” property on sections and topicsadded ‘content_type’ indexfew code cleanup (unused imports…)some bugs corrected0.1.2resources cleanup and minimizationlight changes in paragraphs templates0.1.1Added MANIFEST.in file to handle source package without missing files0.1Initial release
ztfy.bootstrap
ContentsIntroductionHISTORY0.1.60.1.50.1.40.1.30.1.20.1.10.1.0IntroductionZTFY.bootstrap is mainly a new set of Fanstatic resources for Twitter Bootstrap (including Glypicons set of icons and CSS for responsive design).It also defines a new browser layer, and a set of forms templates to be used with this skin, which also relies on ZTFY.skin package.Finally, ZTFY.bootstrap provides a new basic skin for ZTFY.blog (but because of conditional includes, usage of ZTFY.blog is not mandatory to use ZTFY.bootstrap package).Thierry Florac <[email protected]> - AuthorHISTORY0.1.6only display form label tag (including “required” marker) if label is not empty0.1.5added “alert” class to status messages0.1.4add check when creating Fanstatic resources against optionally installed ZTFY.blog package0.1.3added missing “widget” class in widgets block0.1.2use new release of ZTFY.blog0.1.1small changes in forms templates0.1.0first release using Bootstrap 2.3.0
ztfy.cache
ContentsIntroductionCache proxyContributorsChangelog0.1.10.1.0IntroductionZTFY.cache is a small package which provides a common interface to handle several cache backends.Currently available backends include Zope native RAM cache and Memcached cache.Cache proxyThe main concept included ZTFY.cache package is just those of a small proxy which provides a same interfaces to several proxy classes.When defining a proxy, you just have to set the interface and the registration name matching the given registered cache utility. Cache access is then bound to the ICacheHandler interface, which allows you to set, query and invalidate data in the cache.The cache proxy can be defined as a persistent utility, or through ZCML directives. Using ZCML can allow you to define different caches, according to the used application front-end.ContributorsThierry Florac <[email protected]>, AuthorChangelog0.1.1updated dependenciesupdated Buildout’s bootstrap0.1.0package created using templer [Thierry Florac]
ztfy.captcha
ContentsWhat is ztfy.captcha ?How to use ztfy.captcha ?Changelog0.3.40.3.30.3.20.3.10.3.00.2.50.2.40.2.30.2.20.2.10.20.1.10.1What is ztfy.captcha ?ztfy.captcha is a small package used to generate “human” verification images called ‘captchas’, which can easily be integrated into public forms to avoid spam.How to use ztfy.captcha ?A set of ztfy.captcha usages are given as doctests in ztfy/captcha/doctests/README.txtChangelog0.3.4check ztfy.myams package when creating Fanstatic resourceupdated resources for MyAMS skin0.3.3use shared cache to store and load SHA seed when using captcha in multi-process environment0.3.2added MyAMS skin integrationupdated captcha widget base layer to use ztfy.baseskin package0.3.1updated fonts list for better code readability0.3.0use ZTFY.skin data API0.2.5changed captcha image generation code0.2.4changed package source layout0.2.3created missing ZTK-1.1 branch :-/0.2.2added TTF fonts in manifest0.2.1replace deprecated sha module with hashliblocate captchaAdapter for security policy0.2switch to ZTK-1.10.1.1added CDATA headers to improve XHTML compliance0.1initial release
ztfy.comment
ContentsWhat is ztfy.comment ?How to use ztfy.comment ?Changelog0.3.20.3.10.30.2.10.20.1What is ztfy.comment ?Explain here what is the purpose of ztfy.comment.How to use ztfy.comment ?Explain here how the package is used. Points to doctests here !Changelog0.3.2added location attributes to allow deep copy0.3.1changed package source layout0.3Switched to ZTK-1.1.2Added Location as parent class to comments0.2.1Use ‘getAge’ function from ztfy.utils.date module0.2Added attributes and methods on IComment interface0.1Initial release
ztfy.extfile
ContentsWhat is ztfy.extfile ?How to use ztfy.extfile ?Changelog0.2.140.2.130.2.120.2.110.2.100.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.10.1What is ztfy.extfile ?ztfy.extfile is a package which allows storing File and Image objects data outside of the Zope database (ZODB), into ‘external’ files. Files can be stored in the local file system, or remotely via protocols like SFTP or NFS (even HTTP is possible) ; an efficient cache system allows to store local copies of the remote files locally.Finally, external files can be stored via Blob objects, provided by the latest versions of the ZODB.How to use ztfy.extfile ?A set of ztfy.extfile usages are given as doctests in ztfy/extfile/doctests/README.txt.Changelog0.2.14use all file content instead of 4Kb sample to extract MIME type to prevent errors when checking MS-Office files0.2.13rewrite getMagicContentType function for last python-magic release0.2.12add extra content-type check through PIL for images not handled natively0.2.11reset default blobs opening mode to ‘r’ but add mode argument in getBlob() method0.2.10changed blob read mode to ‘c’ to get access to blob data after database connection is closed0.2.9updated IBaseBlobFile interfaceregistered IResult adapter for ZODB.blob.BlobFile (copied from z3c.blobfile package)0.2.8changed package source layout0.2.7set content-type on BlobImage class data updatemove file properties container IObjectCopiedEvent to ztfy.file package0.2.6removed unused package dependency0.2.5added ‘__nonzero__’ boolean operator to check for empty files0.2.4corrected import0.2.3corrected database automatic upgrade code0.2.2updated database automatic upgrade code0.2.1replace deprecated md5 module with hashlib.md50.2Switched to ZTK-1.1.20.1.1update database upgrade code used when creating a site manager0.1Initial release
ztfy.file
=================ztfy.file package=================.. contents::What is ztfy.file ?===================ztfy.file is a set of classes to be used with Zope3 application server.The purpose of this package is to handle :- custom schema fields with their associated properties and browser widgets toautomatically handle fields as external files- automatically handle generation of images thumbnails for any image ; thesethumbnails are accessed via a custom namespace ("++display++w128.jpeg" for example to geta thumbnail of 128 pixels width) and are stored via images annotations- allow selection of a square part of a thumbnail to be used as a "mini-square thumbnail".Square thumbnails selection is based on JQuery package extensions, so the ztfy.jqueryui isrequired to use all functions of ztfy.file package.How to use ztfy.file ?======================A set of ztfy.file usages are given as doctests in ztfy/file/doctests/README.txtChangelog=========0.3.13------- corrected Firefox byte-range0.3.12------- changed Firefox requests management using range to use file iterator instead of simple stringand avoid mod_wsgi errors on big files0.3.11------- handle byte-range requests on files0.3.10------- use all file content instead of 4Kb sample to extract MIME type to preventerrors when checking MS-Office files0.3.9------ use IBaseSkinLayer from ztfy.baseskin package as base layer for fields widgets0.3.8------ added configuration directives to check for installed packages and remove static dependencies- updated Buildout0.3.7------ use new "getMagicContentType()" function from ztfy.extfile package0.3.6------ corrected PIL thumbnail generator0.3.5------ added annotations check- added IWatermarker interface and utility0.3.4------ corrected TAR extractor to correctly handle directories- corrected GZip extractor to correctly implement IArchiveExtractor interface0.3.3------ added MIME types vocabulary (based on file extensions)- added libmagic MIME types vocabulary0.3.2------ commit transaction before sending blob file and change opening mode to 'c'0.3.1------ updated locales- updated style of files download links0.3.0------ use ZTFY.skin data API0.2.14------- allow FileProperty value update from a FileUpload input- syntax correction in HTML field input0.2.13------- added display template for HTML input field0.2.12------- force images in "RGBA" mode when reading images in "P" mode before resizing whilegenerating thumbnails0.2.11------- added new getMagicContentType function- added archives extraction interface and utilities- added "downloadable" attribute on file/image widgets- corrected display widgets- switch dependencies from PIL to Pillow0.2.10------- changed package source layout0.2.9------ include IObjectCopiedEvent subscriber moved from ztfy.extfile package- remove default JPEG format when creating thumbnails (thumbnails are now created by defaultusing the same file format as the original image); JPEG is only used as default when sourceimage is not in JPEG, PNG or GIF format- use PIL to get image size when not in JPEG, PNG or GIF format- added 'display:' TALES adapter to easily get display adapter from page templates0.2.8------ update imports for last ztfy.jqueryui and ztfy.skin packages0.2.7------ automatically add filename extension in name of FileField or ImageField attributesvalues.WARNING: since then, getting field data directly from request returns a tuple made of filecontent and file name !!- use mimetypes package to get content-type for text files- updated doctests0.2.6------ modified ++file++ and ++display++ namespaces to accept an extension0.2.5------ added ImageFieldDataConverter to check that uploaded files are really images0.2.4------ changed position of file input fields- changed handling of jQuery's "imgAreaSelect" plug-in0.2.3------ added check in image field widget thumbnail generation code0.2.2------ added extension in displays URLs- changed square thumbnails management by using JQuery "imgAreaSelect" plug-in- handle NOT_CHANGED value in square thumbnails converters0.2.1------ handle z3c.form NOT_CHANGED value in file field data converter- migrated resources management from zc.resourcelibrary to Fanstatic0.2---- Switched to ZTK-1.1.20.1.1------ added a little sharpening on thumbnails generation- added conversions while getting position and dimension of square thumbnails generation0.1---- initial release
ztfy.gallery
ContentsWhat is ztfy.gallery ?How to use ztfy.gallery ?Changelog0.4.10.4.00.3.50.3.40.3.30.3.20.3.10.3.00.2.160.2.150.2.140.2.130.2.120.2.110.2.100.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.100.1.90.1.80.1.70.1.60.1.50.1.40.1.30.1.20.1.10.1What is ztfy.gallery ?ZTFY.gallery is an extension to ZTFY.blog package. It’s goal is to handle images galleries included into a web site.Package also includes a small basic set of features to be able to sell printed pictures via Paypal.You can get a working sample of package features and skin on my own web site address,http://www.imagesdusport.com(actually only in french).How to use ztfy.gallery ?ztfy.gallery package usage is described via doctests in ztfy/gallery/doctests/README.txtChangelog0.4.1add missing HTML attributes in gallery topic search result to correctly display fancybox view0.4.0update to last ZTFY.base, ZTFY.skin and ZTFY.blog packages0.3.5corrected widgets prefix in images add form dialogs0.3.4small CSS update0.3.3correct handle of encodings in index upload formsmall CSS updates0.3.2re-organized resourcesextend fancybox data APIuse menus classes from ZTFY.skin0.3.1use AJAX cache when loading translations scripts0.3.0use ZTFY.skin data APImake package resources compatible with Fanstatic “bottom” option0.2.16changed CSS class in gallery index contents view0.2.15small CSS updates to match last jScrollPane plug-in0.2.14removed useless add forms title0.2.13removed useless title on dialog add forms0.2.12changed style of links inside topics0.2.11changed package source layoutrebuild minified JavaScript files0.2.10remove default JPEG format when creating or using thumbnailsmoved default paragraph renderer from ztfy.gallery.browser package to ztfy.gallery.defaultskinadded new gallery renderer with big scrollable images0.2.9updated minified gallery CSS0.2.8refactoring to follow release 0.3.0 of ztfy.skinreplace class adapters with simple factories0.2.7moved Paypal menus and forms to Gallery skin0.2.6changed menus viewlets weight0.2.5added index management on images galleriesadded alternate title on illustrations to improve XHTML standard complianceadded site search statistics in Google Analyticsimproved search engine to get display pictures matching searched termsset IImageGalleryPaypalInfo parent interface to II18nAttributesAware for I18n attributes acquisition to work correctly in templatesadd “fb” XML namespace to layout templatessplitted ZCML files0.2.4switched IArchiveContentAddInfo “content” attribute from ImageField to FileField to prevent new ImageFieldDataConverter validation code which raises an exception if provided file is not in a recognized image format…0.2.3added display of Google +1 button in presentation settings and templatesadded display of Facebook “Like” button in presentation settings and templates0.2.2added RSS feedsadded links on several home page elementsadded extension in displays URLsadded Google Analytics events tracking on images display(very) little update in skin CSSupdated Fanstatic libraries nameschanged behavior or home page background0.2.1cleaned imports0.2switch to ZTK-1.1.2removed many zope.app package dependenciesmigrated resources management from zc.resourcelibrary to fanstatic0.1.10changed default skin resources namesadded CDATA headers to improve XHTML complianceadded timeout on home page to automatically reload background image0.1.9added Google site verification code0.1.8added ‘alt’ attribute on images thumbnailsadded ‘nowrap’ CSS class on tablesset user language in HTML ‘lang’ and ‘xml:lang’ attributesuse “ztfy:” XHTML namespace for custom tags attributes0.1.7added CSS classes in ‘Gallery’ skin for docutils tablesadded links on thumbnails of home pageupdated Paypal settings to disable payment for a single image0.1.6small translations updatemoved Google Analytics integration page in default layoutsmall CSS updates in Gallery skinadd links on image and topic header in topics lists0.1.5integration of Google Analytics and AdSense services into Gallery skin layouts0.1.4modified home page script to correctly handle background image title0.1.3updated Gallery skin to add a loading hourglass while downloading home page background image0.1.2moved resource from default skin to Gallery skinadded JQuery navigator plug-in with matching stylessmall CSS and javascript updates0.1.1minified resourcesadded missing translations for favorite icon0.1Initial release
ztfy.geoportal
ContentsIntroductionHISTORY0.2.50.2.40.2.30.2.20.2.10.2.00.1.40.1.30.1.20.1.10.1.0IntroductionZTFY package for french IGN’s GeoPortail accessThierry Florac <[email protected]> - AuthorHISTORY0.2.5small CSS updateschanged default layers visibilitychanged zoom level when positionning to GPS coordinates0.2.4remove unneeded parameters in map initialization options0.2.3use setOpacity() method to define default layer opacity0.2.2change default map layer opacityadd marker interface for location edit formhide input fields in location edit form0.2.1updated GPS coordinates selection widget0.2.0enhanced map creation process0.1.4use ZTFY.skin data APImake package resources and scripts compatible with Fanstatic “bottom” option0.1.3added “version” attribute on config utility to define Geoportail version to useadded “development” attribute to get access to development scriptsupdated translations0.1.2updated dependencies0.1.1use ZTFY.skin viewlets to handle forms prefix0.1.0first release
ztfy.hplskin
ContentsWhat is ztfy.hplskin ?How to use ztfy.hplskin ?Changelog0.1.80.1.70.1.60.1.50.1.40.1.30.1.20.1.10.1.0What is ztfy.hplskin ?ztfy.hplskin is a custom skin for a ztfy.blog based web site. It was designed at first to be used in ‘http://www.ulthar.net’ website, a french site dedicated to H.P.Lovecraft and Cthulhu mythos.How to use ztfy.hplskin ?A set of ztfy.hplskin usage are given as doctests in ztfy/hplskin/doctests/README.txtChangelog0.1.8use last interfaces and classes from ZTFY.base and ZTFY.skin packages0.1.7changed package source layout0.1.6remove default JPEG format when creating or using thumbnailssmall changes in banner adapters factories0.1.5refactoring to follow last release of ztfy.skin, ztfy.blog and ztfy.jqueryui packages0.1.4changed menus viewlets weight0.1.3added alternate title on illustrations to improve XHTML standard complianceadded “fb” XML namespace to layout template0.1.2remove duplicated viewlet menu to blog presentation edit formadded display of Google +1 button in presentation settingsadded display of Facebook “Like” button in presentation settings and templates0.1.1add check for II18n adapter in banner viewletadded extension in displays URLscorrect resources dependencies0.1.0Initial release
ztfy.i18n
ContentsWhat is ztfy.i18n ?How to use ztfy.i18n ?Changelog0.3.50.3.40.3.30.3.20.3.10.3.00.2.140.2.130.2.120.2.110.2.100.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.10.1What is ztfy.i18n ?ztfy.i18n is a package used to handle internalization of contents attributes.Supported attributes types include:text and textline fieldsfile and images fieldsHTML fieldsHow to use ztfy.i18n ?A set of ztfy.i18n usages are given as doctests in ztfy/i18n/doctests/README.txtChangelog0.3.5use all file content instead of 4Kb sample to extract MIME type to prevent errors when checking MS-Office files0.3.4refactored interfaces to prevent circular referencesadded configuration directives to remove static dependencies with “ztfy.skin” package0.3.3use new “getMagicContentType()” function from ztfy.extfile packagesmall imports cleanup0.3.2use Unicode for default language when no language nogotiator is available0.3.1updated localesupdated style of files download links0.3.0use ZTFY.skin data APIremoved unused CSS stylesmake package resources compatibles with Fanstatic “bottom” option0.2.14small CSS update for flags tabs0.2.13added custom title viewlet for I18n contentsmodified CSS to match new ZTFY skin0.2.12added “translated” property decoratoruse getMagicContentType method from ztfy.file package0.2.11changed package source layout0.2.10remove default JPEG format when creating or using thumbnails0.2.9added “translate” TAL adapter0.2.8automatically add file’s extension in I18nFileField and I18nImageField attributes valuesuse mimetypes package to get content-type for text files0.2.7use dictionaries instead of tuples in languages vocabularies0.2.6added request context to languages vocabularies translationsmodified “setLanguage.html” view to use context’s absolute URL and avoid bad redirections when using virtual hosting0.2.5added missing widgets permissions registration0.2.4added “ZTFY base languages” vocabulary, to handle a list of languages not including country codesupdated translationschanged position of file input fieldschanged handling of jQuery’s “imgAreaSelect” plug-inminor changes in CSS styling0.2.3added check in image field widget thumbnail generation code0.2.2added extension in displays URLshandle square thumbnails via JQuery imgAreaSelect plug-incheck II18n adapter correctly in I18nTalesAdapterbetter check for request in I18nAttributesAdapter.getPreferedLanguage method0.2.1migrated resources management from zc.resourcelibrary to fanstatic0.2switched to ZTK-1.1.2restrictions on I18nAttributesAdapter adapted interface to II18nAttributesAwarehandle z3c.form “NOT_CHANGED” value for I18n file attributes properties0.1.1use Invalid exception instead of ValueError to handle invariants0.1initial release
ztfy.imgtags
ContentsIntroductionWARNINGHISTORY0.1.30.1.20.1.10.1.0IntroductionZTFY package for EXIF/IPTC/XMP tags managementWARNINGThis package requires pyexiv2 package, which is not actually available on Pypi!Thierry Florac <[email protected]> - AuthorHISTORY0.1.3added “precision” argument to “getGPSLocation” method to get rounded coordinates0.1.2added configuration directives to limit package dependencies with “ztfy.skin” package0.1.1corrected conversion of EXIF GPS coordinates0.1.0first release
ztfy.jqueryui
ContentsWhat is ztfy.jqueryui ?How to use ztfy.jqueryui ?Requiring plugins through templatesChangelog0.7.120.7.110.7.100.7.90.7.80.7.70.7.60.7.50.7.4.10.7.40.7.30.7.20.7.10.7.00.6.70.6.60.6.50.6.40.6.30.6.20.6.10.6.00.5.50.5.40.5.30.5.20.5.10.5.00.4.10.40.30.20.1What is ztfy.jqueryui ?ztfy.jqueryui is a set of javascript resources (and their dependencies) allowing any application to easily use a set of JQuery plug-ins; when possible, all CSS and JavaScript resources are already minified via Yahoo ‘yui-compressor’ tool.Most of these plug-ins are used by default ZTFY skins and packages.Currently available plug-ins include :the JQuery enginejquery-alertsjquery-colorpickerjquery-cookiejquery-datatablesjquery-datetimejquery-easingjquery-fancyboxjquery-formjquery-i18njqeury-imgareaselectjqeury-jscrollpanejquery-jsonrpcjquery-jtipjquery-layoutjquery-liquidcarouseljquery-multiselectjquery-progressbarjquery-tipsyjquery-toolsjquery-treetablejquery-uiHow to use ztfy.jqueryui ?All JQuery resources are just defined as Fanstatic libraries. ZCML registration is not required.Using a given plug-in is as simple as using the following syntax in any HTML view:>>> from ztfy.jqueryui import jquery >>> jquery.need()Given that, all plug-in dependencies will automatically be included into resulting HTML page.A single resource can be required several times for a single page, but the resulting resources will be included only one via the Fanstatic machinery.When available, a minified version as well as a “clear source” version are defined. When using ZTFY.webapp package, the first one is used in “deployment” mode while the second one is automatically used in “development” mode to make debugging very easy.Requiring plugins through templatesIf, for example, you want to call resources from a site’s layout for which you don’t have any Python class, you can call it directly from a page template, like this:<tal:var replace="fanstatic:ztfy.jqueryui#jquery" />The “fanstatic:” expression is provided by ztfy.utils package.Changelog0.7.12updated bootstrap.py for Buildout 20.7.11added JQuery-handsontable plug-in in release 0.10.20.7.10updated JQuery-fancybox plug-in to release 1.3.40.7.9updated jquery-datetime widget style0.7.8small CSS and image updates on JQuery-datetime plug-in0.7.7added overflow on JQuery-multiselect selection box0.7.6updated JQuery-multiselect plug-in to remove old IE exceptions…0.7.5added JQuery-color plug-inupdated JQuery-multiselect plug-in for backspace key handlingupdate JQuery-tipsy plug-in to take care of tooltip position0.7.4.1added missing JQuery-masonry resources :-(0.7.4added JQuery-masonry plug-in0.7.3JQuery-multiselect plug-in updates to disable highlight and store multiselect instance in input data0.7.2allow browser cache when loading translations scripts0.7.1update JQuery to release 1.7.2update JQuery-tools to release 1.2.7add JQuery-mousewheel plug-insmall CSS updates0.7.0added JQuery-1.9.1 and JQuery-migrate plug-inswitch default JQuery version to 1.7switch JQuery-form to version 3.27switch JQuery-tools to version 1.2.7added translation string for JQuery-multiselectforce background color on JQuery-datetime inputs0.6.7changed JQuery-layout dependencies0.6.6added JQuery-dotdotdot plug-inupdated JQuery-JScrollPane plug-indispatch of JQuery-UI plug-ins in several inter-dependent resources0.6.5added JQuery-tipsy plug-insmall CSS updates0.6.4added JQuery-I18n plug-inupdated JQuery-alerts to handle localesupdated JQuery-multiselect plug-insupdated locales0.6.3added JQuery-layout plug-inadded JQuery-cookie plug-inadded JQuery-liquidcarousel plug-in0.6.2changed package source layout0.6.1switched default JQuery-Tools package to release 1.2.40.6.0added JQuery ColorPicker plug-inremoved unused ‘browser’ module and moved resources to ztfy.jqueryui0.5.5new small update on JQuery multi-select widget styleupdated README.txt0.5.4small update on JQuery multi-select widget style0.5.3updated JQuery-MultiSelect plug-in to release 0.1.11-tfimproved IE’s CSS compatibility for JQuery-MultiSelect plug-inadded customized JQuery-ProgressBar plug-in, which is based on Apache2’s progress extension module (http://github.com/drogus/apache-upload-progress-module/)0.5.2updated JQuery UI 1.7 library to release 1.7.3added JQuery UI library in release 1.8.16 (set as default)remove “Tabs” plugin from JQuery UI widgets package to avoid conflict with JQuery Tools Tabs (which is used in several ZTFY packages)remove JQuery-form in releases 2.07 and 2.36remove JQuery-UI in release 1.5.20.5.1updated resources path and rebuild minified version of CSS and JS resources0.5.0migrated from zc.resourcelibrary to zope.fanstatic0.4.1added JQuery-1.4.4 and JQuery-1.7 ; JQuery-1.4.4 is now the default one for ZTFY packages.0.4switched to ZTK-1.1.2changed z-index for JQuery datetime calendar to use it in overlaysadded custom release (0.1.9-tf) of jquery-multiselect plug-inadded release 1.7.4 of jquery-datatables plug-inswitched jquery-form plugin to release 2.51small style change on date and datetime input fields0.3added jScrollPane plug-in (revision 93)corrected resources dependencies0.2added JQuery TOOLS release 1.2.4 (resource ‘ztfy.jquery.tools-1.2’)removed unused CSS resources0.1initial release
ztfy.ldap
ContentsWhat is ztfy.ldap ?How to use ztfy.ldap ?ContributorsChangelog0.1.30.1.20.1.10.1.0What is ztfy.ldap ?ztfy.ldap is a small set of utilities and classes to make LDAP interaction easier within a ZTK/ZopeApp based application.The main class is LDAPGroupsFolder, which is an authentication plug-in used to enable LDAP groups as authentication principals. This class is extending ZTFY.security package so that LDAP groups can be used everywhere where a principal can be selected to grant a role.LDAPGroupsFolder code is mainly based on “ldapgroups” package, which seems actually unmaintained.Based on ldappool package, ztfy.ldap also provides a pooled LDAP adapter, which stores it’s connections within a pool.Adapters for some ofztfy.mailinterfaces are also provided.How to use ztfy.ldap ?ztfy.ldap usages will be described onZTFY home pageContributorsThierry Florac <[email protected]> - AUthorChangelog0.1.3changed LDAPGroupInformation implemented interfaces order0.1.2added subscribers to add interfaces on LDAP principals0.1.1added cache management facilities0.1.0package created using templer [Thierry Florac]
ztfy.lock
ContentsIntroductionLocking utilityContributorsChangelog0.1.20.1.10.1.0IntroductionZTFY.lock is a small package which can be used to get locks on persistent objects in several contexts.These contexts include:simple ‘threading’ locking, in a single-process environmentfile locking (using ‘zc.lockfile’ package), in a multi-processes environment where all processes are handled on a single hostmemcached locking (using ‘lovely.memcached’ package), in a multi-process environment where processes are handled on several hosts.Locking utilityLocking is handled by a utility implementing ILockingUtility interface and registered for that interface. Locking policy have to be chosen on that utility to define the locking helper which will be used.According to the selected policy, additional parameters will have to be defined to set the file locks path or the memcached client connection.ContributorsThierry Florac <[email protected]>, AuthorChangelog0.1.2added configuration directives to remove static dependencies with ztfy.skin package0.1.1use last ZTFY.skin base classes0.1.0package created using templer [Thierry Florac]
ztfy.mail
ContentsWhat is ztfy.mail ?How to use ztfy.mail ?ContributorsHISTORY0.1.60.1.50.1.40.1.30.1.20.1.10.1.0What is ztfy.mail ?ztfy.mail is a small package which provides a few interfaces and utilities to help handling email messages.How to use ztfy.mail ?ztfy.mail usages will be described onZTFY home page::ZTFY home page:http://www.ztfy.orgContributorsThierry Florac <[email protected]> - AuthorHISTORY0.1.6added ‘charset’ parameter to TextMessage constructor0.1.5added “getPrincipalAddress” helper function0.1.4updated Buildout’s bootstrapupdated dependenciescorrected imports for PEP 80.1.3handle message target addresses as a list or as a single string0.1.2initialized I18n translations0.1.1first published release, only minor formatting changes…0.1.0first release
ztfy.media
ContentsIntroductionMedias conversionsHISTORY0.1.120.1.110.1.100.1.90.1.80.1.70.1.60.1.50.1.40.1.30.1.20.1.10.1.0Introductionztfy.media is a ZTK/ZopeApp ZTFY package used to automatically convert and display medias files (audios, videos…).It was developed in the context of a medias library management application handling several kinds of medias (mainly images, videos, and audio files), to be able to automatically display these contents in web pages.Medias conversionsAutomatic medias conversions implies several pre-requisites:the ‘’ffmpeg’’ executable must be available in your path;you have to rely on a ZEO connection handling a blobs cache directory;you have to create and register (with a name) this ZEO connection in your site management folder (see ztfy.utils.zodb.ZEOConnection object);you have to create and register (without name) a ZTFY medias conversion utility.Medias conversion utility allows you to define listening address and port of a ZeroMQ process which will wait for conversions requests. These requests are automatically done when an IObjectAddedEvent is notified on a IFile object containing contents for which a converter has been registered; default converters based on FFmpeg are available for images, video and audio files, but you can provide your own converters for any kind of custom file.Medias conversion utility also allows to define in which formats you want to convert the new medias. All conversions are actually done with the help of FFmpeg, each conversion being done in a dedicated sub-process handling it’s own ZEO connection.Converted medias are stored in the ZODB as Blob files in the original media file annotations.Thierry Florac <[email protected]> - AuthorHISTORY0.1.12added configuration options to medias converter to force conversion of medias already provided in target content type. This can be required if uploaded medias don’t provide properties for correct random access to any part of the video or audio file.0.1.11updated FlowPlayer fonts path in CSScorrected logger nameremoved missing imports0.1.10corrected conversions code (based on “pyams_media” package source code) to use libAV ‘avconv/avprobe’ toolsadded MP4 and WebM conversions optionsupdated FlowPlayer to release 6.0.5updated medias previews0.1.9corrected video frame size names array0.1.8added small check in requested formats0.1.7use new “getMagicContentType()” function from ztfy.extfile packageuse non-empty suffix when detected content-type is unknown0.1.6added flush on some video output filesadded sound file thumbnail in audio previewalways use temporary files for Quicktime video conversions0.1.5automatically include a video player watermark on videos thumbnailsupdated video preview template0.1.4reset video bitrate command line option to “-b” (instead of “-b:v”) to be compatible with all FFmpeg versionsupdated video preview for Firefox compatibility0.1.3added one second before checking ZMQ processes startupupdated package resources0.1.2register ZMQ medias converter process exit callback0.1.1removed forgotten ‘print’ statementupdate README0.1.0first release
ztfy.monitor
====================ztfy.monitor package====================.. contents::What is ztfy.monitor ?======================ztfy.monitor is a small monitor for Zope 3, using zc.z3monitor as base package.It adds a "threads" command to monitoring console, to see what the Zope server isactually doing, even when all threads are busy and the server can't respond to any request.It's actually useful when your server is not performing as well as you would like, is eatingall your CPU time or is waiting in a deadlock loop.It's main code is based on DeadlockDebugger, developed by Nuxeo for the Zope2 applicationserver.How to use ztfy.monitor ?=========================This package can be used via the zc.monitor NGI server ; read the configuration of this package to see how it is configured.Go on by including ztfy.monitor package into your application configuration : ::<include package="ztfy.monitor" />After that and as soon as the monitoring server is launched, you can connect anduse the "threads" command to see threads activity ; for example, by using the "netcat"application on a monitor running on port 8081 : ::$ echo "threads" | nc localhost 8081Threads traceback dump at 2008-11-03 21:50:46Thread -1210468160:File "./bin/paster", line 151, in ?paste.script.command.run()File "/var/local/src/ztfy/lib/python2.4/site-packages/PasteScript-1.6.2-py2.4.egg/paste/script/command.py", line 79, in runinvoke(command, command_name, options, args[1:])File "/var/local/src/ztfy/lib/python2.4/site-packages/PasteScript-1.6.2-py2.4.egg/paste/script/command.py", line 118, in invokeexit_code = runner.run(args)File "/var/local/src/ztfy/lib/python2.4/site-packages/PasteScript-1.6.2-py2.4.egg/paste/script/command.py", line 213, in runresult = self.command()File "/var/local/src/ztfy/lib/python2.4/site-packages/PasteScript-1.6.2-py2.4.egg/paste/script/serve.py", line 257, in commandserver(app)File "/var/local/src/ztfy/lib/python2.4/site-packages/PasteDeploy-1.3.1-py2.4.egg/paste/deploy/loadwsgi.py", line 139, in server_wrapperwsgi_app, context.global_conf,File "/var/local/src/ztfy/lib/python2.4/site-packages/PasteDeploy-1.3.1-py2.4.egg/paste/deploy/util/fixtypeerror.py", line 57, in fix_callval = callable(*args, **kw)File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 1314, in server_runnerserve(wsgi_app, **kwargs)File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 1282, in serveserver.serve_forever()File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 1066, in serve_foreverself.handle_request()File "/usr/lib/python2.4/SocketServer.py", line 217, in handle_requestrequest, client_address = self.get_request()File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 1100, in get_request(conn,info) = SecureHTTPServer.get_request(self)File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 378, in get_request(conn, info) = self.socket.accept()File "/usr/lib/python2.4/socket.py", line 161, in acceptsock, addr = self._sock.accept()Thread -1303708784:File "/usr/lib/python2.4/threading.py", line 442, in __bootstrapself.run()File "/usr/lib/python2.4/threading.py", line 422, in runself.__target(*self.__args, **self.__kwargs)File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 851, in worker_thread_callbackrunnable = self.queue.get()File "/usr/lib/python2.4/Queue.py", line 119, in getself.not_empty.wait()File "/usr/lib/python2.4/threading.py", line 203, in waitwaiter.acquire()Thread -1295316080:...When a thread is actually handling a web request, it's URL is written in the first line : ::Thread -1303708784 (GET /++apidoc++/Interface/ztfy.app.test.test.IDocument/index.html):File "/usr/lib/python2.4/threading.py", line 442, in __bootstrapself.run()File "/usr/lib/python2.4/threading.py", line 422, in runself.__target(*self.__args, **self.__kwargs)File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 863, in worker_thread_callbackrunnable()File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 1037, in <lambda>lambda: self.process_request_in_thread(request, client_address))File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 1053, in process_request_in_threadself.finish_request(request, client_address)File "/usr/lib/python2.4/SocketServer.py", line 254, in finish_requestself.RequestHandlerClass(request, client_address, self)File "/usr/lib/python2.4/SocketServer.py", line 521, in __init__self.handle()File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 432, in handleBaseHTTPRequestHandler.handle(self)File "/usr/lib/python2.4/BaseHTTPServer.py", line 316, in handleself.handle_one_request()File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 427, in handle_one_requestself.wsgi_execute()File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/httpserver.py", line 287, in wsgi_executeself.wsgi_start_response)File "build/bdist.darwin-8.10.1-i386/egg/z3c/evalexception.py", line 10, in __call__File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/evalexception/middleware.py", line 186, in __call__return self.respond(environ, start_response)File "/var/local/src/ztfy/lib/python2.4/site-packages/Paste-1.6-py2.4.egg/paste/evalexception/middleware.py", line 306, in respondapp_iter = self.application(environ, detect_start_response)File "/var/local/src/ztfy/eggs/zope.app.wsgi-3.4.0-py2.4.egg/zope/app/wsgi/__init__.py", line 54, in __call__request = publish(request, handle_errors=handle_errors)File "/var/local/src/ztfy/eggs/tmp4szHYV/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py", line 133, in publishFile "/var/local/src/ztfy/eggs/tmpUIaR4E/zope.app.publication-3.4.3-py2.4.egg/zope/app/publication/zopepublication.py", line 167, in callObjectFile "/var/local/src/ztfy/eggs/tmp4szHYV/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py", line 108, in mapplyFile "/var/local/src/ztfy/eggs/tmp4szHYV/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py", line 114, in debug_callFile "/var/local/src/ztfy/eggs/zope.app.pagetemplate-3.4.0-py2.4.egg/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__return self.index(*args, **kw)File "/var/local/src/ztfy/eggs/zope.app.pagetemplate-3.4.0-py2.4.egg/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__return self.im_func(im_self, *args, **kw)File "/var/local/src/ztfy/eggs/zope.app.pagetemplate-3.4.0-py2.4.egg/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),File "/var/local/src/ztfy/eggs/tmpvYYhPw/zope.pagetemplate-3.4.0-py2.4.egg/zope/pagetemplate/pagetemplate.py", line 115, in pt_renderFile "/var/local/src/ztfy/eggs/tmpUxe0uv/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", line 271, in __call__File "/var/local/src/ztfy/eggs/tmpUxe0uv/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", line 346, in interpretFile "/var/local/src/ztfy/eggs/tmpUxe0uv/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", line 891, in do_useMacro...Of course, the service is available even when each server's thread is currently busy and whenthe server can't serve any web request.Changelog=========0.1---- Initial release
ztfy.myams
ContentsIntroductionWhat is it?ContributorsHistory0.1.320.1.310.1.300.1.290.1.280.1.270.1.260.1.250.1.240.1.230.1.220.1.210.1.200.1.190.1.180.1.17.30.1.17.20.1.17.10.1.170.1.160.1.15.20.1.15.10.1.150.1.140.1.130.1.120.1.110.1.100.1.90.1.80.1.70.1.60.1.50.1.40.1.30.1.20.1.10.1.0IntroductionA ZTFY package providing a new Bootstrap-based application management skinWhat is it?MyAMS, “My Application Management Skin”, is a new ZTFY package which provides a complete application management skin based on Bootstrap. It is heavilly using AJAX and HTML5 “data” API, and already includes a few JQuery plug-ins like DataTables or Validate.No end-user or even developer documentation is available yet. I hope to be able to produce one as well as a complete demonstration site as soon as possible.ContributorsThierry Florac <[email protected]> - AuthorNicolas Lacoste <[email protected]> - Testing and J2EE implementationHistory0.1.32updated AJAX error message handling0.1.31updates included from last PyAMS_skin package (MyAMS.js)0.1.30updates included from last PyAMS_skin package (MyAMS.js)0.1.29updates included from last PyAMS_skin packagehandle CTRL key to open links in new window (MyAMS.js)added pre- and post- reload callbacks on JSON “reload” responseadd check in progress handler (MyAMS.js)added DOM sort helper (MyAMS.js)allow persistent divs in switcher fieldset (MyAMS.css)set minimum height for modal title (MyAMS.css)updated messages styles in message box (MyAMS.css)added option to change message status (MyAMS-notify.js)added handles to orderable lists (MyAMS.css)added top and left negative margins classes (MyAMS.css)removed minimum height for TinyMCE editors (MyAMS.css)add translation strings to Fancybox plug-inupdated CSS0.1.28added optional attributes on widgets, form groups and forms to manage labels and widgets CSS classesadded Bootstrap wizard plug-in (MyAMS.js)added form reset callbacks (MyAMS.js)added “MyAMS.getObject()” function to get object from string in dotted name formupdated “MyAMS.ajax.check” to check for an array of extensions in a single call (MyAMS.js)use asynchronous mode for DataTables extensions (MyAMS.js)CSS updates0.1.27added inner package name in static configuration to complete application versionsynchronize MyAMS.js with pyams_skin package for post progress management0.1.26use default async mode in “MyAMS.skin.loadURL”allow array of checkers in “MyAMS.ajax.check”small javascript updates0.1.25added data attributes to handle modal “shown” and “hidden” events callbacksupdated callbacks management for plug-ins loaded dynamicallyupdated CSS styles for disabled or read-only plug-ins0.1.24add optional target to menus itemscorrection in form management (MyAMS.js)refactored variables names (MyAMS.js)CSS updates0.1.23added check on modals to allow hidden overflow0.1.22synchronize MyAMS.js and CSS with pyams_skin package0.1.21added JQuery-inputmask plug-in (bundled version including all extensions)updated JQuery-validate plug-in to enable custom validation rulessmall CSS updates0.1.20CSS updates0.1.19switch JQuery-imgareaselect plug-in to release 0.9.11-rc1small CSS updates0.1.18added default template for select widgets based on Select2upgraded FontAwesome to release 4.5.0upgrade JQuery-maskedinput to release 1.4.1switch JQuery-modalmanager to strict modeupdated MyAMS.js for menu management, AJAX errors handling, focus management, plug-ins management, TableDND plug-in settings, breadcrumbs displayadded attribute “data-ams-disabled-handlers” to disable event handlers0.1.17.3packaging problem of minified resources0.1.17.2small changes in focus management0.1.17.1bad correction of “MyAMS.plugins.initData()” function after migration to ‘strict’ mode0.1.17switch to Javascript strict modegeneralize default form layout to all forms (and not only input forms)0.1.16small updates in MyAMS.jssmall CSS updatesnew backport from pyams_skin development package0.1.15.2changed default layout language0.1.15.1replace minified javascript resource0.1.15new backport from pyams_skin development package including a few CSS and javascript updates0.1.14new backport from pyams_skin development package including a few CSS updates and several new plug-ins0.1.13backports from last pyams_skin package resources, including JQuery, JQuery-UI and Bootstrap upgrades as well as new default plug-ins0.1.12small CSS and Javascript updates0.1.11allow usage of a custom static configuration for a given view by setting a request attribute0.1.10restore previous logout behaviour0.1.9added optional form’s title attributeupdated Google Analytics coderedirect to relative URL in logout view0.1.8added target link attribute to menusadded title attribute to menusadded IInnerForm interface to handle forms located inside another containeradded DataTables finalization callbacks handlerupdated UnauthorizedExceptionView to correctly handle AJAX authentication errorsupdated MyAMS.baseURL functionchanged login form login field descriptionforce content-type to text/plain in form’s AJAX response to prevent HTML content-type0.1.7added JQuery DataTables “editable” plug-in extension supportsmall CSS updates0.1.6added setting to handle warnings when leaving an unsaved modified formhandle static configuration property to hide refresh buttonupdate FontAwesome icons to release 4.2.0small CSS updates0.1.5added login form header and footer text attributes and content providers (using reStructuredText)added new status “notify” in JSON response to be able to fire a given eventadded custom radio button input templateadded I18n attributes in main layoutadded batch properties in base table classadded custom boolean terms to update translationsupdated form template to use custom label and input classessmall CSS updates0.1.4added version display in shortcuts paneladded tabs viewlet in headeradded UserVoice API keyupdated and corrected Javascript APIsmall CSS updates0.1.3corrected link to favourites iconsmall CSS fixes0.1.2added new content providers for search engines and available languages drop-down menuadded new “form reset callback” data APIfirst step in adding new “upload/download” progress notificationsupdated javascript data API to be able to warn user when leaving a form containing modified and unsaved dataupdated and added CSS classesjavascript syntax cleanup in MyAMS.notify package (a complete code rewrite is planed…)0.1.1small changes on exceptions viewsadded view for JSON-RPC exceptionsadded minified Fanstatic resourcesimproved AJAX errors managementsmall CSS updates0.1.0first release
ztfy.scheduler
ContentsWhat is ztfy.scheduler ?How to use ztfy.scheduler ?Changelog0.5.20.5.10.5.00.4.90.4.80.4.70.4.60.4.50.4.40.4.30.4.20.4.10.4.00.3.40.3.30.3.20.3.10.3.00.2.20.2.10.20.1What is ztfy.scheduler ?ztfy.scheduler is a base package for those which need to build scheduled tasks which can run inside a ZTK/ZopeApp based environment (ZEO is required !). These tasks can be scheduled:on a cron-style base,at a given date/time (like the “at” command)or at a given interval.Scheduling is done through the APScheduler (http://packages.python.org/APScheduler/) package and so all these kinds of tasks can be scheduled with the same sets of settings. But tasks management is made through a simple web interface and tasks running history is stored in the ZODB.On application start, the scheduler is run in a dedicated ZeroMQ process, which is also used to handle synchronization between tasks settings and scheduler jobs.Tasks logs can be stored in the ZODB for a variable duration (based on a number of iterations). These log reports can also be sent by mail, on each run or only when errors are detected.How to use ztfy.scheduler ?A set of ztfy.scheduler usages are given as doctests in ztfy/scheduler/doctests/README.txtChangelog0.5.2allow multiple recipients of task execution report0.5.1removed condition on debug mode run button0.5.0added task execution menu to run in debug mode without using ZMQ process0.4.9updated french translation0.4.8added tasks attributes relatives to empty reports handling0.4.7use “tztime” function in history sorting0.4.6added one second before checking ZMQ processes startup0.4.5remove ZTFY.security resources dependencies0.4.4convert roles edit forms to dialogs0.4.3register ZMQ scheduler process exit callback function0.4.2added system command execution task (local, or remote throught SSH)added option to execute a task immediately on user’s request0.4.1removed title from jobs list template0.4.0complete package refactoring, with tasks and scheduler jobs synchronization based on a dedicated ZeroMQ process0.3.4changed package source layout0.3.3implement ztfy.security ILocalRoleManager interface0.3.2start and stop scheduler when scheduler utility is registered or unregistered, instead of when it’s added or removedremove scheduler from schedulers handler when scheduler is stopped0.3.1update ShelveJobStore to take care of specific file systems configurations, because sometimes shelve modification time is not updated when “sync()” is called. From now on jobs configuration timestamp is stored in shelve and a blocking file lock is used to prevent concurrent modifications in it. At least it seems to work on Linux, any feedback concerning other OS is still welcome…0.3.0refactoring to follow last releases of ztfy.skin and ztfy.jqueryui packagesredefined interfaces so that tasks scheduling mode (cron-style, interval-style…) can be defined on a per-task basis and is not bound to the task class; new scheduling modes can also be added via registered utilitiesstore tasks execution log in tasks historyadd an “URL getter” task, which can be used to call a remote “management” URL on periodic basisadd username/password/realm to ZEO connectionsmodify ZODB packer task to be able to pack another remote database instead of only those to which scheduler is definedimproved handling of transactions and conflict errors0.2.2changed ISite package import0.2.1updated database automatic upgrade code0.2migrated to ZTK-1.1integrated ZODBPackerTask (moved from ztfy.blog package)0.1initial release
ztfy.security
ContentsWhat is ztfy.security ?How to use ztfy.security ?Changelog0.4.30.4.20.4.10.4.00.3.10.3.00.2.110.2.100.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1What is ztfy.security ?ztfy.security is a thin wrapper around zope.security and zope.securitypolicy packages.It provides an adapter to ISecurityManager interfaces, which allows you to get and set roles and permissions applied to a given principal on a given adapted context.This adapter also allows you to fire events when a role is granted or revoked to a given principal ; this functionality can be useful, for example, when you want to forbid removal of a ‘contributor’ role to a principal when he already owns a set of contents.Finally, ztfy.security provides a small set of schema fields, which can be used when you want to define a field as a principal id or as a list of principals ids.How to use ztfy.security ?ztfy.security package usage is described via doctests in ztfy/security/doctests/README.txtChangelog0.4.3order principals by title in input and display widgets0.4.2added “backspace_removes_last” property to PrincipalsListWidget0.4.1added missing translations0.4.0added new token authentication plug-in. This plug-in relies on a classic InternalPrincipalContainer but can extract credentials from an encoded token given in URL. This token is built in a way that includes current date so that it’s not permanent.0.3.1added “names” argument in principals search methods which allows to provide names of authentication plug-ins in which principals are to be searchedadd “auth_plugins” property to principals selection widgets to define names of authentication plug-ins which can be used in search method0.3.0use ZTFY.skin data APIremove unused resourcesdisable auto-completion on roles input widgets0.2.11convert roles edit form to dialog0.2.10use request cache in “getPrincipal()” function0.2.9corrected ISecurityManager methods arguments namestemplates updated to display null values0.2.8changed package source layout0.2.7added ILocalRoleIndexer interface and default adapter0.2.6added annotations interfaces on standard zope.pluggableauth GroupFolder classescape quotes in Javascript code0.2.5updated imports for last ztfy.jqueryui and ztfy.skin packageadded AJAX checks in principals widgets0.2.4added check in JSON’s “getAddr()” method to remove “++skin++” namespacecorrected syntax and translation in MissingPrincipal class0.2.3added permission grant, unset and revoke methods in ISecurityManager interface and adapteradded check in principals widgets0.2.2switched resources management from zc.resourcelibrary to fanstatic0.2.1removed “zope.app” packages dependencies0.2Switched to ZTK-1.1.2Added schema fields, properties, widgets and resources to handle roles assignment via simple context attributes and propertiesAdded IAuthenticatorSearchAdapter to offer a common search interface to authenticator plug-ins0.1Initial release
ztfy.sendit
ContentsIntroductionHISTORY0.1.200.1.190.1.180.1.170.1.160.1.150.1.140.1.130.1.120.1.110.1.100.1.90.1.80.1.70.1.60.1.50.1.40.1.30.1.20.1.10.1.0Introductionztfy.sendit is a small package which provides an application which authenticated users can use to send files to remote contacts, like in SendIt web site.It’s main use case is for principals from inside an organization who want to share documents with their remote contacts; contacts selection can be done via any registered authentication plug-in.You can customize your application so that external users registration is opened or made only by organization’s inner principals.Thierry Florac <[email protected]> - AuthorHISTORY0.1.20added packet backup time option of 8 weeks0.1.19force packet registration in outbox displayforce unicode in packet history attributes0.1.18small correction in XML-RPC API to add check on packet description0.1.17added views to allow registered users to receive a new profile activation messageadded minified resources0.1.16make user login case insensitive0.1.15added “trusted_redirects” attribute in security configuration interface to allow usage of application behind an application firewall using another protocol (HTTP / HTTPS)0.1.14use all file content instead of 4Kb sample to extract MIME type to prevent errors when checking MS-Office files0.1.13use (I)I18nBaseContent classes from “ztfy.i18n” packageadd tests to correctly handle admin account in dev-mode0.1.12user new “getMagicContentType()” function from ztfy.extfile package0.1.11add missing permissions to application administrator role0.1.10use unicode when defining default user’s profile company name0.1.9use last ZTFY.base and ZTFY.skin interfaces and classes0.1.8added new ztfy.appskin IApplicationResources interface adapter0.1.7french translation update0.1.6corrected handling of non-unicode inputs in XML-RPC servicescorrected display condition of dashboard legendremoved unnecessary output from scheduler tasks0.1.5added XML-RPC services with client module0.1.4apply empty string instead of null value in principals description to allow plug-ins search methods to operate without errorupdated quota usage progress indicator image for quota usage greater than 100%0.1.3removed unneeded check about “open registration” setting in registration confirmation formadded quota usage gauge in dashboard and outboxadded external users domain name in recipients search widgetsmall change in packet reject messagecorrectly handle null values in MIME type filter plug-in0.1.2updated login form to prevent storage of bad credentials in session0.1.1modifications in login formCSS classes updates0.1.0first release
ztfy.sequence
ContentsIntroductionSequence utilityContributorsChangelog0.1.10.1.0IntroductionZTFY.sequence is a small package used to set sequential identifiers on selected persistent contents.The SequentialIntIds utility is based on zope.intid.IntIds utility, but overrides a few methods to be able to define these sequential IDs.Classes for which we want to get these sequential IDs have to implement the ISequentialIntIdTarget marker interface. They can also implement two attributes, which allows to define the name of the sequence to use and a prefix.This prefix, which can also be defined on the utility, is used to define an ID in hexadecimal form, as for example ‘LIB-IMG-000012ae7c’, based on the ‘main’ numeric ID.Sequence utilitySequences are handled by a utility implementing ISequentialIntIds interface and registered for that interface.You can set two optional parameters on this utility, to define the first hexadecimal ID prefix as well as the length of hexadecimal ID (not including prefix).ContributorsThierry Florac <[email protected]>, AuthorChangelog0.1.1force unicode on hexadecimal OID valueadded TAL “sequence:” namespace package0.1.0package created using templer [Thierry Florac]
ztfy.skin
ContentsWhat is ztfy.skin ?How to use ztfy.skin ?Changelog0.6.230.6.220.6.210.6.200.6.190.6.180.6.170.6.160.6.150.6.140.6.130.6.120.6.110.6.100.6.9.10.6.90.6.8.10.6.80.6.70.6.60.6.50.6.40.6.30.6.20.6.10.6.00.5.210.5.200.5.190.5.180.5.170.5.160.5.150.5.140.5.130.5.120.5.110.5.100.5.90.5.80.5.70.5.60.5.50.5.40.5.30.5.20.5.10.5.00.4.100.4.90.4.80.4.70.4.60.4.50.4.40.4.30.4.20.4.10.4.00.3.60.3.50.3.40.3.30.3.20.3.10.3.00.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.30.1.20.1.10.1What is ztfy.skin ?ZTFY.skin is the first ZTFY-based management interface.It’s a set of base classes used by many ZTFY packages, mainly for management purpose.Currently available classes include:ZTFY layer and skinadd and edit forms, including AJAX dialogsdate and datetime widgetsviewlet managermenu and menu itemsMost of ZTFY.skin base classes are based on z3c.* packages classes, including:z3c.form, z3c.formjs and z3c.formuiz3c.templatez3c.menuz3c.layer.pageletHow to use ztfy.skin ?ztfy.skin usage is described via doctests in ztfy/skin/doctests/README.txtChangelog0.6.23changed AJAX protocol when checking for absolute URLsswitched ZTFY.skin.js to strict mode0.6.22corrected dynamic CSS loading function0.6.21modified ‘RELOAD’ status in forms callbacks to avoid calling “window.location.reload()” which can break several jQuery plug-ins (notably “jquery-multiselect”)0.6.20added check against ZTFY.form when initializing download helper0.6.19use “window.location.reload()” instead of updating “window.location.href” on “RELOAD” post response0.6.18updated requirements0.6.17move common interfaces and adapters to “ztfy.baseskin” package. Impact on existing code should still be minimal as matching interfaces and classes are still imported for compatibility reason…0.6.16added custom ordered select input widget template using JQuery to avoid IE bug0.6.15don’t load JQuery-progressbar plug-in when form doesn’t contain progress framecheck AJAX error message before displaying error dialog0.6.14check for pages using JQuery-layout plug-in before calling translations script to avoid flickering when layout is created0.6.13fixed Javascript typo error in french translation stringsadded error management callback in $.ZTFY.getScript() functionchanged skin scripts initialization order0.6.12updated button style in display formadded JQuery-datatables plug-in in ZTFY default widgetsadd label on fieldset’s legend containing a checkboxadd URL in dialog’s data attributes0.6.11updated buttons styleadded hints on dialog’s close link0.6.10updated DatesRangeDataConverter to correctly handle 4 digits years0.6.9.1updated locales0.6.9added “button” data argument to date and datetime widgets0.6.8.1build minified version of javascript file0.6.8updated small ZTFY download helper function0.6.7added optional “handler” argument in $.ZTFY.dialog methods to specify name of a custom AJAX handleradded <form> tag in container views when containing actionssmall CSS updates0.6.6remove empty labels from forms templatesadded AJAX download helper0.6.5remove BODY scroll position from JQuery multiselect widgets top position when using these components in dialogs0.6.4extract “workflow.manager” viewlets manager from ZTFY.workflow package to remove cross references0.6.3always disable « Enter » key in dialog forms inputs, and redirect it to first action button click0.6.2move ZTFY.blog ‘search’ JSON-RPC function to ZTFY.skin with name ‘searchByTitle’move ZTFY.blog internal references javascript functions to ZTFY.skinsmall ZCML refactoring0.6.1extract ‘skin:’ and ‘metas:’ TALES namespaces from ZTFY.blog0.6.0use new ZTFY.base package for generic ZTFY content featuresinclude many generic interfaces, components and adapters from ZTFY.blog package to remove unneeded dependencies of other packages with ZTFY.blog0.5.21added AJAX start/stop functions callbacks0.5.20added option on TextLineList input widget to disable action of backspace key0.5.19changed help and warning messages colors0.5.18small CSS updates0.5.17added “nochange_output” and “changes_output” on add and edit dialog formsadded “with_self” argument to “getForms()” methodupdated CSS and javascript code to handle JQuery multiselect widgets position inside dialogs containing an overflow0.5.16added option to use a checkbox as a group switcher instead of only “+” signadded “small” buttons style0.5.15include legend height in viewspace height computeadd form data attribute to disable check of “submitted” flag0.5.14status message style updateupdated AJAX errors display code0.5.13corrected display of TextLineList default valuechanged place of dialog status messagedefine relative CSS position for widgets containeruse better generic method to calculate max height of dialogs view spaceadd generic class on actions containeradded new FormObjectCreatedEvent to be fired after object creation is finished in add forms0.5.12corrected date and datetime widgets pattern conversion between Python and Javascript0.5.11corrected JQuery-datetime resources download for english language0.5.10add form attribute to display hints on input widgetssmall changes in JQuery multiselect plug-in search arguments management0.5.9add HTTP header cache control directive in dialog views to disable IE cachecheck result format in AJAX forms callbacks to automatically convert string results to JSON (required for IE)don’t show required fields markers on widgets in display mode0.5.8add check againt missing attribute in callback function used in JQuery-multiselect plug-inremoved attribute in TextLineList input widget which prevented user to enter several valuesupdated locales0.5.7set response status to 401 on login formadded custom layout for login formexclude hidden input fields when creating info tipsadd new IDialogTitle interface so that any editor dialog can define it’s own title via an optional adapteradded base container view class which doesn’t force back-office skin0.5.6corrected javascript test in form submit callbacksnew CSS classes0.5.5small correction in TextLineList widget template0.5.4modified and extended fancybox data APIupdated CSS stylesadded support for submit callbacks on each widgetremoved tests relative to IE browserallow HTML code in widgets hintsadded base ISkinnable interface and traverser for contents managing custom skinsmoved several skin-related classes and interfaces from ZTFY.blog package0.5.3re-define package resourcesadd new “$.ZTFY.getScript()” function which can use browser cacheuse browser cache when loading translations scriptsadd control for AJAX submit callbacks returning null values without error messageadded checks for missing JQuery plug-ins0.5.2add custom tables batch provider0.5.1allow several plug-ins in a single HTML element, separated by spacescorrection in getCSSClass() method of InnerContainerBaseView0.5.0initialize new data APImake all widgets compatible with data API and javascript code movable to page bottommove custom widgets from ZTFY.utils package0.4.10add attributes to ISubFormViewlet to make them switchableupdate JQuery selectors for version 1.7+update scroll markers position when an Ajax form generates a new status messageinclude dialog’s help to compute maximum viewspace heightchanges in $.ZTFY.form.initHints() functioninclude sub-forms and tab-forms in main form view spacesmall style changes on legends0.4.9remove relative position on viewspace to enable JQuery-multiselect plug-in to work correctly inside dialogs0.4.8added indicator to viewspace dialog when a scrollbar is required to show that hidden input fields are availablemove login form from ZTFY.zmi packageinclude hints initialization code in javascript functionsmall changes in error and status messages style0.4.7small change on batch links stylechanged hints style0.4.6changed style of container batch linkschanged style of forms tabs0.4.5small dialogs overlay CSS updatecorrection in ++back++ namespace traverser0.4.4use generic marker interface and ++back++ namespace to identify contents with custom back-office properties0.4.3changed viewlets template layer to make them easily reusable0.4.2added optional ‘message’ attribute in AJAX edit and add forms outputadded ‘status_class’ forms attribute to get status message classcorrected edit form errors handling callbetter handling of custom back-office properties in main layoutenhanced title viewletmake dialogs draggable and adapt their inner size to window height0.4.1corrected small syntax error in containers template0.4.0big CSS and small templates updates to create a new back-office skinuse viewlets managers to handle forms and widgets prefix and suffixadded hints on forms fields0.3.6use ‘BASE’ header if available instead of window.location.href to get AJAX calls targetadd callback argument to “$.ZTFY.dialog.open()” to handle opening errors0.3.5corrected URL replace function with regexpadded located boolean terms0.3.4add class container.InnerContainerBaseView as base class used to handle tables displayed inside another viewadd interface and viewlet manager to handle custom actions viewletsadd attribute for empty message and change default legend locationadd sub-form fieldset CSS class supportadd condition on submit buttons to display them only when dialog is in input mode and at least one widget is also in input modeadded “data” parameter in AJAX add and edit dialog functionsadded high batch size in ordered containeradded “indexOf” method to Array prototype if missing (IE)added widgets prefix and suffix support in sub-formsadded widgets groups support in main forms, which can be used to group widgets with common fieldset and legendadded custom display widgets for text and textarea fieldscorrected changes management in EditForm subforms handling custom update methodcorrected translation of forms help messagechanged forms templates prefix and suffix managementinitialize support for viewlets-based sub-formssmall changes in JQuery dialogs managementsmall CSS updatesremoved macros-based form template0.3.3add slots for forms prefix and suffixdefine default template and layout for templates based pagesadd interface and viewlet manager to handle custom actions viewletsadd attribute for empty containers message and change default legend location0.3.2changed package source layout0.3.1upgrade dialog overlay effect to match release 1.2.4 of JQuery-Tools0.3.0large refactoring to include many “generic” functions (forms, dialogs, javascript code…) extracted from ztfy.blog package back-officechanged display of forms statussmall changes on display formssmall CSS updates0.2.9changed display forms templateadded fixed width textarea display widget0.2.8added “autocomplete” attribute on formschanged template of password widget0.2.7added default favicon0.2.6add missing IDialog and IButtonForm interfaces on DialogDisplayForm classadd possible prefix and suffix in dialogs viewsmodify DialogDisplayForm to handle actions0.2.5reset default form’s progress bar update interval to default (1000 ms) ; previous one was setup for testing and debugging…switch from $.getJSON() in $.ajax() in progress frame to handle errors correctly0.2.4integration of JQuery’s progress bar plug-in in upload forms ; this plug-in is based on Apache2’s upload progress module but forms still function without it. More info :https://github.com/drogus/apache-upload-progress-module/added check if forms submit code to prevent several posts on double clicksmall upgrades on CSS and HTML stylings0.2.3modified #tabforms CSS styleadded small javascript resource0.2.2switch from zc.resourcelibrary to fanstatic0.2.1removed “zope.app” packages dependencies0.2switched to ZTK-1.1.2removed tooltips in forms and dialogsmajor changes in sub-forms handlingremove macros from z3c.template based form template0.1.3added ‘ContentProviderBase’ base class for template based content providers0.1.2added ‘visible’ attribute on IBreadcrumbInfo interface0.1.1added MANIFEST.in for source package constructionoverride form.addForm method to be able to translate buttons label0.1Initial release
ztfy.thesaurus
ContentsWhat is ztfy.thesaurus ?How to use ztfy.thesaurus ?HISTORY0.2.16.10.2.160.2.150.2.140.2.130.2.120.2.110.2.100.2.90.2.80.2.7.20.2.7.10.2.70.2.60.2.50.2.40.2.30.2.20.2.10.2.00.1.40.1.30.1.20.1.10.1.0What is ztfy.thesaurus ?ztfy.thesaurus is a quite small package used to handle content’s indexation through the help of a structured and controlled vocabulary’s thesaurus, which is like a big hierarchic dictionary of terms linked together.Several XML standards have emerged to handle such thesauri ; this package is mainly based on a custom format but can import and export data in formats like SKOS (RDF) and SuperDoc.How to use ztfy.thesaurus ?A set of ztfy.thesaurus usages are given as doctests in ztfy/thesaurus/doctests/README.txtThierry Florac <[email protected]>HISTORY0.2.16.1removed forgotten debug output0.2.16removed “thesaurus_name” attribute from thesaurus terms indexesonly index term internal ID (requires index rebuild!)allow indexing of terms parents and synonyms0.2.15updated indexes and search methods with activated stemming0.2.14don’t display label of archived synonyms if term’s labeladded extra arguments in thesaurus “findTerms()” method to allow exact searches of terms0.2.13add “base_label” attribute in IThesaurusTerm interface to allow exact search of termsadded “base_label” attribute value index in thesaurus internal catalogalways place term exact match (if any) on first place of terms selection listchanged default results terms selection list to 50 items instead of 20add automatic vertical overflow in JQuery-multiselect terms selection list0.2.12handle accentuated characters in thesaurus name when no filename is provided in export dialog formhandle empty description in SKOS/RDF exporthandle extract selection in SuperDoc export0.2.11use IntIds “register” method instead of “getId” to prevent errors while re-indexing contents containing unregistered terms0.2.10change thesaurus term indexed value(s) to allow modification of term’s label without interfering with indexes contentsremove double entries from terms search JSON-RPC methods when entered text matches a term and (at least) one of it’s synonymscorrectly encode “&” character in term’s dialog opening URLmake “/” character forbidden in term’s label0.2.9fanstatic resources cleanup0.2.8use last interfaces, classes and interfaces from ZTFY.base and ZTFY.skin packages instead of ZTFY.blog0.2.7.2updated javascript code to correctly handle expansion of terms tree0.2.7.1updated locales0.2.7updated loading and merge for better handling of custom thesaurus formatschanged tree “getChildNodes” method for first-level terms0.2.6small updates (with updated doctests!) in extracts managementadded marker interface for generic thesaurus viewsadded feature in terms tree view to automatically deploy tree until a given searched termadded option on multi-selection terms input widget to disable action of backspace keyimports cleanup0.2.5update term’s generic/usage reverse links in term’s creation formuse caption instead of label in terms selection form0.2.4add attribute on terms list input widget which allows to display an entire list of terms which can be selected from a thesaurusadded controls and error messages when changing term’s label to allow correct catalog update and avoid duplicates0.2.3added search engine inside terms tree to get synonyms which are not part of the terms treeupdate terms generic/specifics and usage/used_for associations when importing a thesaurusdon’t reinitialize extracts to an empty set when a term is no more associated to a genericcorrected SKOS loader synonyms associations management0.2.2add new thesaurus add form to create a new thesaurus without importing any dataremove security proxy when comparing two termsuse new ZTFY.skin edit form “CALLBACK” APIremove archived terms from selection search results0.2.1activate AJAX cache when loading I18n translations strings0.2.0use ZTFY.skin data APImake resources compatible with Fanstatic “bottom” option0.1.4convert roles edit form to dialog0.1.3removed useless add forms titleimports cleanup0.1.2updated templates for ZTFY.skin >= 0.4.0changed icons class0.1.1updated doctestscorrected packaging0.1.0first release
ztfy.utils
ContentsWhat is ztfy.utils ?How to use ztfy.utils ?Changelog0.4.160.4.15.10.4.150.4.140.4.130.4.120.4.110.4.100.4.90.4.80.4.70.4.60.4.50.4.40.4.30.4.20.4.10.4.00.3.140.3.130.3.120.3.110.3.100.3.90.3.80.3.70.3.60.3.50.3.40.3.30.3.20.3.10.30.2.10.20.1What is ztfy.utils ?ztfy.utils is a set of classes and functions which can be used to handle many small operations.Internal sub-packages include :date : convert dates to unicode ISO format, parse ISO datetime, convert date to datetimerequest : get current request, get request annotations, get and set request data via annotationssecurity : get unproxied value of a given object ; can be applied to lists or dictstimezone : convert datetime to a given timezone ; provides a server default timezone utilitytraversing : get object parents until a given interface is implementedunicode : convert any text to unicode for easy storageprotocol : utility functions and modules for several nerwork protocolscatalog : TextIndexNG index for Zope catalog and hurry.query “Text” query itemtext : simple text operations and text to HTML conversionhtml : HTML parser and HTML to text converterfile : file upload data convertertal : text and HTML conversions for use from within TALHow to use ztfy.utils ?A set of ztfy.utils usage are given as doctests in ztfy/utils/doctests/README.txtChangelog0.4.16added HTTP client option to disable SSL certificate verification0.4.15.1packaging mismatch! :-/0.4.15modified request property decorator0.4.14modified cookies management in XML-RPC cookie authenticated transport0.4.13added check in dates management functions to handle years prior to 19000.4.12added “getClientFromURL()” function to HTTP client module to build an HTTP client from a simple URL0.4.11added “encode” and “decode” functions in “ztfy.utils.unicode” module (with updated doctests)0.4.10added configuration directives to remove static dependencies with “ztfy.skin” and “zopyx.txng3.core”updated Buildout’s bootstrap0.4.9added “ztfy.utils.decorator” module with “@deprecated” decorator0.4.8remove security proxy in ITransactionManager adapter0.4.7added new “component” registry utility moduleadded date and datetime display formatsadded “keep_chars” argument in translateString function0.4.6added ISet interface with permissions on zc.set.Set class0.4.5make current participation request optional in “indexObject()” function0.4.4added “allow_none” and “headers” arguments in XML-RPC “getClient()” methods0.4.3change test for date types in tztime/gmtime functions (because datetime inherits from date!)0.4.2small correction in getHumanSize() functionadded dates formatting functionsadded check between date and datetime types in timezone module0.4.1use request locale formatter in getHumanSize function0.4.0move custom schema fields widgets to ZTFY.skin package0.3.14added legend on ZEO connection properties edit formforce usage of “escapeSlashes” argument when checking new content name0.3.13added ZEO connection interface, utility and toolsadded “ztfy.utils.container” utility moduleadded a persistent utility to store ZEO connection settingsadded “TextLine list” schema field and widgetadded request and session cached propertiesadded Python 2.7 compatibility code and timeout parameter to XML-RPC protocol helperchanged request “data:” TAL namespace to basic HTTP request so it can be used in views called via JSON-RPC or XML-RPC0.3.12updated package source layout0.3.11added dotted decimal schema field, not handling locales :-/0.3.10upgraded for ztfy.jqueryui 0.6.0added Color schema field and widgetadded StringLine schema fieldadded “text:translate” TAL adaptermoved ITransactionManager adapter from ztfy.scheduler package0.3.9added HTTP client based on httplib2, handling authentication and proxies0.3.8corrected encodings vocabulary0.3.7added encodings vocabulary0.3.6corrected code and translations in MissingPrincipal classadded permissions on TextIndexNG index0.3.5re-add IList and IDict interfaces forgotten from bad merge :-(0.3.4better check for missing requests0.3.3Added “fanstatic:” TALES expression0.3.2Mark ztfy.utils.security functions and classes as deprecated0.3.1Updated signature in ztfy.utils.catalog.index to match last hurry.query release0.3Switched to ZTK-1.1.2 and Python 2.6Added “getAge” function in date moduleAdded session module and TALES adapter to get/set session valuesCheck None value in catalog.getObjectId(…) and catalog.getObject(…) methods0.2.1Added ‘site.locateAndRegister’ facility functionUpdate ServerTimezoneUtility parent classes0.2Added ‘data’ namespace to access request data0.1Initial release
ztfy.webapp
Table of ContentsZTFY.webappIntroductionFeaturesInstallationUsageResourcesChangelog1.1.5 (2013-09-23)1.1.4 (2013-06-14)1.1.3 (2012-04-17)1.1.2 (2012-03-12)1.1.1 (2011-12-24)1.1.0 (2011-12-18)DownloadZTFY.webappIntroductionZTFY.webapp is mainly based on BlueBream concepts and packages, but introduces a few changes and a set of new functionalities ; it’s main goal is to provide a Paster template to create a new ZTFY.blog based web site in just a few seconds.More informations about ZTFY packages can be found onZTFY home page.The “webapp” is nothing more than a “configuration container”, which references and configures all packages needed to handle a web site ; it doesn’t provide any real functionality in itself, except those required to handle the web server in itself.BlueBream– formerly known asZope 3– is a web framework written in the Python programming language.BlueBream is free/open source software, owned by theZope Foundation, licensed under theZope Public License(BSD like, GPL compatible license).FeaturesHere are the features distinguishing BlueBream from other Python web frameworks:BlueBream is built on top of theZope Toolkit(ZTK), which has many years of experience proving it meets the demanding requirements for stable, scalable software.BlueBream uses the powerful and familiarBuildoutbuilding system written in Python.BlueBream employs the Zope Object DatabaseZODB, a transactional object database, providing extremely powerful and easy to use persistence.BlueBream registers components with Zope Component Markup Language (ZCML), an XML based configuration language, providing limitless flexibility.BlueBream features theZope Component Architecture(ZCA) which implementsSeparation of concernsto create highly cohesive reusable components (zope.component).BlueBream implements theWSGIspecification (Web Server Gateway Interface) with the help ofPasteDeploy.BlueBream includes a number of well tested components to implement common activities. A few of these are:zope.publisherpublishes Python objects on the web, emphasizingWSGIcompatibilityzope.securityprovides a generic mechanism for pluggable security policieszope.testingandzope.testbrowseroffer unit and functional testing frameworkszope.pagetemplateis an XHTML-compliant language for developing templateszope.schemais a schema engine to describe your data modelszope.formlibis a tool for automatically generating forms from your schemasOn top of this, ZTFY provides a few set of additional packages, which allows you to manage a full web site in just a few minutes, including :a complete content management interface (based onz3c.form)an alternate ZMIa structured web site, containing sections and articles, blog(s), topics…images galleriesand many more little features, described onZTFY home page.You will also find on this web page all informations required to know how to create and setup a new web site using these packages.Three simple skins are provided in the default setup, and a “nearly ready to use” configuration file for Apache2mod_wsgimodule is also provided.InstallationIf you have installedsetuptoolsordistributeaneasy_installcommand will be available. Then, you can install ZTFY.webapp usingeasy_installcommand like this:$ easy_install ztfy.webappInternet access toPyPIis required to perform installation of ZTFY.webapp.TheZTFY.webappdistribution provides a quick project creation tool based on PasteScript templates. Once ZTFY.webapp is installed, runpastercommand to create the project directory structure. Thecreatesub-command provided by paster will show a wizard to create the project directory structure.$ paster create -t ztfy.webappThis will bring a wizard asking details about your new project. If you provide a package name and version number, you will get a working application which can be modified further. The project name will be used as the egg name. You can also change the values provided later.The project name can be given as a command line argument:$ paster create -t ztfy.webapp sampleprojectIf you provide an option from the command line, it will not be prompted by the wizard. The other variables are given below, you can give the values from the command line, if required:interpreter– Name of the custom Python interpreterrelease– The version of ZTFY.webappversion– The version of your project (eg:- 0.1)description– One-line description of the packagelong_description– Multi-line description (in reStructuredText)keywords– Space-separated keywords/tagsauthor– Author nameauthor_email– Author emailurl– URL of the homepagelicense_name– License nameIf you are in a hurry, you can simply pressEnter/Returnkey and change the values later. But it would be a good idea, if you provide a good name for your project.UsageThe generated package is bundled with Buildout configuration and the Buildout bootstrap script (bootstrap.py). First you need to bootstrap the buildout itself:$ cd sampleproject $ python bootstrap.pyThe bootstrap script will install thezc.buildoutanddistributepackages. Also, it will create the basic directory structure. Next step is building the application. To build the application, run the buildout:$ ./bin/buidoutThe buildout script will download all dependencies and setup the environment to run your application.The most common thing you need while developing an application is running the server. ZTFY.webapp uses thepastercommand provided by PasteScript to run the WSGI server. To run the server, you can pass the PasteDeploy configuration file as the argument toservesub-command as given here:$ ./bin/paster serve debug.iniOnce you run the server, you can access it here:http://localhost:8080/. The port number (8080) can be changed from the PasteDeploy configuration file (debug.ini).The second most common thing must be running the test cases. ZTFY.webapp creates a testrunner using thezc.recipe.testrunnerBuildout recipe. You can see atestcommand inside thebindirectory. To run test cases, just run this command:$ ./bin/testSometimes you may want to get the debug shell. ZTFY.webapp provides a Python prompt with your application object. You can invoke the debug shell like this:$ ./bin/paster shell debug.iniMore about the test runner and debug shell will be explained in the BlueBream Manual. You can continue reading about BlueBream from thedocumentation site.ResourcesZTFY home pageWebsite with documentationProject blogThe bugs and issues are tracked atlaunchpad.BlueBream WikiPyPI HomeTwitterMailing listIRC Channel:#bluebream at irc.freenode.netBuildbotThe source code is managed atZope reposistory. You can perform a read-only checkout of trunk code like this (Anonymous access):svn co svn://svn.zope.org/repos/main/bluebream/trunk bluebreamYou can alsobecome a source code contributor (committer) after signing a contributor agreementYou can seemore details about contributing in wiki.Changelog1.1.5 (2013-09-23)added ZTFY.base and ZODBBrowser in default project dependencies and configuration1.1.4 (2013-06-14)activate Fanstatic “bottom” option for resources, as all ZTFY packages are now compatible with itremove several packages (ztfy.gallery, ztfy.hplskin and ztfy.alchemy) from standard configuration, as they are not required in most default environments1.1.3 (2012-04-17)moved main configuration file (configure.zcml) from src/webapp/ directory to etc/register “overrides.zcml” from ztfy.skin package instead of ztfy.blogremoved ztfy.jqueryui ZCML files include1.1.2 (2012-03-12)added gzip filter in deploy.ini pipeline (Fanstatic configuration is not compatible with Apache’s mod_deflate for static resources)added conditional Apache’s mod_upload_progress configurationadded mod_wsgi comments in generated README.txtmodified Apache’s mod_ssl configurationchanged application factory to force ++vh++ namespace in HTTPSdisabled site packages and picked versions in generated buildout1.1.1 (2011-12-24)changed WSGIScriptAlias path in Apache mod_wsgi configuration1.1.0 (2011-12-18)initial release (based on BlueBream)Download
ztfy.workflow
ContentsWhat is ztfy.workflow ?How to use ztfy.workflow ?Changelog0.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.10.1.0What is ztfy.workflow ?ztfy.workflow is an extension to hurry.workflow package. It provides a small set of base content classes, utilities and viewlets to handle basic workflow management.How to use ztfy.workflow ?See doctests in ztfy/workflow/doctests/README.txt to have a full description of ztfy.workflow usage.Changelog0.2.9move default “workflow.manager” viewlets manager to ZTFY.skin package to remove unneeded dependency with ZTFY.workflow0.2.8updated translation0.2.7added “:published” and “:visible” to “wf:” TALES path adaptersadded “wf_name” index in WorfklowCatalogmodify “++wf++” namespace so that when an InvalidTransactionError is raised, we look for a registered error view before raising a TraversalError0.2.6changed package source layout0.2.5removed unused package dependency0.2.4changed ISite interface import in database upgrade code0.2.3updated database automatic upgrade code0.2.2updated database automatic upgrade code0.2.1remove “zope.app” package dependencies0.2switched to ZTK-1.1.2 and hurry.workflow-0.11add ITransition interface to transitionsadd ITransitionTarget interface to handle transitions viewlet links0.1.1update database upgrade code used when creating a site manager0.1.0initial release
ztfy.zmi
ContentsWhat is ztfy.zmi ?How to use ztfy.zmi ?Changelog0.3.10.3.00.2.110.2.100.2.90.2.80.2.70.2.60.2.50.2.40.2.30.2.20.2.10.20.1.20.1.10.1What is ztfy.zmi ?ztfy.zmi is a small package which just provides a new skin called ZMI. This skin is done to include standard ZMI views with ZTFY.blog management skin.How to use ztfy.zmi ?This skin is mainly done for site-level management tasks, such as handling site-level utilities ; so it’s mainly targeted to site system administrators.Changelog0.3.1strange bug workaround where a translated string can’t be integrated into template… :-(0.3.0use ZTFY.skin data API0.2.11move login form to ZTFY.skin packageupdated forms and views templates0.2.10modified ZMI access menu to handle virtual hosts correctly0.2.9added menu to access management console from back-officeremoved useless test0.2.8modified templates to match new ZTFY.skin packageadded weight on several viewlets0.2.7changed package source layout0.2.6refactoring to follow release 0.3.0 or ztfy.skin package0.2.5changed viewlets order value0.2.4modified login form to be used as “normal” page as well as IUnauthorized exception’s default view0.2.3modified ‘@@SelectedManagementView.html’ for redirects to work better in a virtual host environment with custom startup script0.2.2updated ZMI breadcrumbs to facilitate navigation in site’s management folder0.2.1modified login process to allow authentication on global PrincipalRegistrymigrated resources management from zc.resourcelibrary to fanstatic0.2switch to ZTK-1.1added access to login page on IUnauthorized exception0.1.2changed breadcrumbs handling to correctly get IBreadcrumbInfo multi-adapterchanged viewlet layer to IZMILayer instead of IZTFYBlogBackLayer0.1.1fixed bug related to naming of several divs in form macros0.1initial release
ztfy.zmq
ContentsIntroductionHISTORY0.1.40.1.30.1.20.1.10.1.0IntroductionZTFY.zmq is a small ZTFY integration of ZeroMQ library.It provides two main classes which are:ZMQProcess, which is a ZMQ listening process, based on multiprocessing package.ZMQMessageHandler, which is a simple ZMQ messages handler which delegates it’s functionality to a ZMQ agnostic handling class.When creating a new ZMQProcess instance, you only have to specify it’s listening address and it’s messages handler.Default ZMQ process is based on request/response (REQ/REP) messages, but this can easily be overriden in custom subclasses.Most of this package main concepts are based onStefan Scherfkework. Thanks to him!Thierry Florac <[email protected]> - AuthorHISTORY0.1.4added “socket” module with utility functions0.1.3updated package dependenciesupdated Buildout’s bootstrap0.1.2handle TERM signal to be sure parent processes can terminate ZMQ processes0.1.1added ZMQ process exit callback function, to be registered on application exit for any created process. This is required when using WSGI servers to end ZMQ processes in a clean way.0.1.0first release
zthreading
Please see the github repo and help @https://github.com/LamaAni/zthreading.py
zthreadpool
线程池, 固定指定数量的线程来执行任务, 避免重复创建和销毁线程时的资源消耗注意:如果任务数量超过线程数量, 超出的任务会等待有正在执行的任务执行完毕后, 在有空闲线程时才会执行测试代码:if __name__ == '__main__':import timeimport threadingp = ThreadPool(2)@p.task()def fun(a, c):print(a, '开始', time.strftime(' %H:%M:%S', time.localtime()))for i in range(c):time.sleep(0.01)print(a, ' 结束', time.strftime(' %H:%M:%S', time.localtime()))fun('aa', 100)fun('bb', 100)fun('cc', 100)fun('dd', 100)p.close()p.join()print('--end--')
ztilde
UNKNOWN
ztime
ztimeZen time library.
ztimer
计时器池管理器作用:将多个计时器挂在到计时器管理器中, 用一个线程来统一管理, 减少资源消耗别的多线程计时器在线程切换时会造成额外资源消耗管理线程会根据在创建第一个计时器时自动启动, 关闭最后一个计时器后自动关闭注意:尽量不要调用Timer_Manager()中的close(), add_timer(), remove_timer()函数, 除非你真的完全了解这个模块在计时器回调函数中调用close(), add_timer(), remove_timer()函数会造成死锁测试代码:if __name__ == '__main__':def fun1(t: Timer):print('回调', t.meta, t.callback_count, time.strftime(' %H:%M:%S', time.localtime()))def fun_de(t: Timer):print(t.meta, '关闭')import timet1 = Timer(fun1, 1, 5, close_callback=fun_de, meta='计时器1 ')t1.start()time.sleep(0.5)t2 = Timer(fun1, 1, 2, meta=' 计时器2 ')t2.start()print('等待计时器1结束')t1.join()print('结束')
ztjgwz
some toolsLearn how to package your Python code for PyPI
ztk-api
折淘客APIWARNING(警告)这个项目已经不再维护,请使用QiYu API项目。WARNINGthis is only for internal use (use at your own risk)
ztl
This project contains theZTLlibrary enabling light-weight and widely compatibleremote task executionusingZeroMQ.The basic communication principle is as follows:Thereby, each task has the following lifecycle:An example communication could look like this:Request:Reply:
ztlearn
zeta-learnzeta-learn is a minimalistic python machine learning library designed to deliver fast and easy model prototyping.zeta-learn aims to provide an extensive understanding of machine learning through the use of straightforward algorithms and readily implemented examples making it a useful resource for researchers and students.Documentation:https://zeta-learn.comPython versions:3.5 and aboveFree software:MIT licenseDependenciesnumpy >= 1.15.0matplotlib >= 2.0.0FeaturesKeras like Sequential API for building models.Built on Numpy and Matplotlib.Examples folder with readily implemented machine learning models.Installpip install ztlearnExamplesPrincipal Component Analysis (PCA) ##################################DIGITS Dataset - PCA <https://github.com/jefkine/zeta-learn/blob/master/examples/digits/digits_pca.py>_.. image:: /examples/plots/results/pca/digits_pca.png :align: center :alt: digits pcaMNIST Dataset - PCA <https://github.com/jefkine/zeta-learn/blob/master/examples/mnist/mnist_pca.py>_.. image:: /examples/plots/results/pca/mnist_pca.png :align: center :alt: mnist pcaKMEANSK-Means Clustering (4 Clusters) <https://github.com/jefkine/zeta-learn/blob/master/examples/clusters/kmeans_cluestering.py>_.. image:: /examples/plots/results/kmeans/k_means_4_clusters.png :align: center :alt: k-means (4 clusters)Convolutional Neural Network (CNN) ##################################DIGITS Dataset Model Summary <https://github.com/jefkine/zeta-learn/blob/master/examples/digits/digits_cnn.py>_.. code:: htmlDIGITS CNNInput Shape: (1, 8, 8) +---------------------+---------+--------------+ ¦ LAYER TYPE ¦ PARAMS ¦ OUTPUT SHAPE ¦ +---------------------+---------+--------------+ ¦ Conv2D ¦ 320 ¦ (32, 8, 8) ¦ ¦ Activation: RELU ¦ 0 ¦ (32, 8, 8) ¦ ¦ Dropout ¦ 0 ¦ (32, 8, 8) ¦ ¦ BatchNormalization ¦ 4,096 ¦ (32, 8, 8) ¦ ¦ Conv2D ¦ 18,496 ¦ (64, 8, 8) ¦ ¦ Activation: RELU ¦ 0 ¦ (64, 8, 8) ¦ ¦ MaxPooling2D ¦ 0 ¦ (64, 7, 7) ¦ ¦ Dropout ¦ 0 ¦ (64, 7, 7) ¦ ¦ BatchNormalization ¦ 6,272 ¦ (64, 7, 7) ¦ ¦ Flatten ¦ 0 ¦ (3,136,) ¦ ¦ Dense ¦ 803,072 ¦ (256,) ¦ ¦ Activation: RELU ¦ 0 ¦ (256,) ¦ ¦ Dropout ¦ 0 ¦ (256,) ¦ ¦ BatchNormalization ¦ 512 ¦ (256,) ¦ ¦ Dense ¦ 2,570 ¦ (10,) ¦ +---------------------+---------+--------------+TOTAL PARAMETERS: 835,338DIGITS Dataset Model Results.. image:: /examples/plots/results/cnn/digits_cnn_tiled_results.png :align: center :alt: digits cnn results tiledDIGITS Dataset Model Loss.. image:: /examples/plots/results/cnn/digits_cnn_loss_graph.png :align: center :alt: digits model lossDIGITS Dataset Model Accuracy.. image:: /examples/plots/results/cnn/digits_cnn_accuracy_graph.png :align: center :alt: digits model accuracyMNIST Dataset Model Summary <https://github.com/jefkine/zeta-learn/blob/master/examples/mnist/mnist_cnn.py>_.. code:: htmlMNIST CNNInput Shape: (1, 28, 28) +---------------------+------------+--------------+ ¦ LAYER TYPE ¦ PARAMS ¦ OUTPUT SHAPE ¦ +---------------------+------------+--------------+ ¦ Conv2D ¦ 320 ¦ (32, 28, 28) ¦ ¦ Activation: RELU ¦ 0 ¦ (32, 28, 28) ¦ ¦ Dropout ¦ 0 ¦ (32, 28, 28) ¦ ¦ BatchNormalization ¦ 50,176 ¦ (32, 28, 28) ¦ ¦ Conv2D ¦ 18,496 ¦ (64, 28, 28) ¦ ¦ Activation: RELU ¦ 0 ¦ (64, 28, 28) ¦ ¦ MaxPooling2D ¦ 0 ¦ (64, 27, 27) ¦ ¦ Dropout ¦ 0 ¦ (64, 27, 27) ¦ ¦ BatchNormalization ¦ 93,312 ¦ (64, 27, 27) ¦ ¦ Flatten ¦ 0 ¦ (46,656,) ¦ ¦ Dense ¦ 11,944,192 ¦ (256,) ¦ ¦ Activation: RELU ¦ 0 ¦ (256,) ¦ ¦ Dropout ¦ 0 ¦ (256,) ¦ ¦ BatchNormalization ¦ 512 ¦ (256,) ¦ ¦ Dense ¦ 2,570 ¦ (10,) ¦ +---------------------+------------+--------------+TOTAL PARAMETERS: 12,109,578MNIST Dataset Model Results.. image:: /examples/plots/results/cnn/mnist_cnn_tiled_results.png :align: center :alt: mnist cnn results tiledRegression ##########Linear Regression <https://github.com/jefkine/zeta-learn/blob/master/examples/boston/boston_linear_regression.py>_.. image:: /examples/plots/results/regression/linear_regression.png :align: center :alt: linear regressionPolynomial Regression <https://github.com/jefkine/zeta-learn/blob/master/examples/boston/boston_polynomial_regression.py>_.. image:: /examples/plots/results/regression/polynomial_regression.png :align: center :alt: polynomial regressionElastic Regression <https://github.com/jefkine/zeta-learn/blob/master/examples/boston/boston_elastic_regression.py>_.. image:: /examples/plots/results/regression/elastic_regression.png :align: center :alt: elastic regression
ztm
Fetch data from ZTM APIFeaturesFetch GPS position and append to CSV fileQuickstartInstall and run ZTM api wrapper:$ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python $ pipsi install ztm $ ztm --apikey <APIKEY> fetch --line 150 --line 250 $ cat ztm.csvRunning TestsDoes the code actually work?:$ git clone https://github.com/wooyek/ztm.git $ cd ztm $ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python $ pipsi install pew $ pew new -p python3 -a $(pwd) $(pwd | xargs basename) $ pip install -r requirements/development.txt $ pipsi install tox $ toxWe recommend usingpipsifor installingpewandtoxbut a legacy approach to creating virtualenv and installing requirements should also work. Please installrequirements/development.txtto setup virtual env for testing and development.CreditsThis package was created withCookiecutterand thewooyek/cookiecutter-pylibproject template.History0.1.0 (2019-01-01)First release on PyPI.
ztmAPI448474
No description available on PyPI.
ztmapi-core
Failed to fetch description. HTTP Status Code: 404
ztm-buses
ZTM Buses PackageCurrent FeaturesThe package consists of three main functionalities:ZTMFetcherBusStatisticianVisualizerZTMFetcherTheZTMFetchermodule allows acquiring information from the Warsaw API.Import the module:fromztm_busesimportZTMFetcherInitialize with multiple API keys (may be beneficial when handling a substantial number of requests.):fetcher=ZTMFetcher(['your_apikey1','your_apikey2'])API keys can be obtained onhttps://api.um.warszawa.pl/.Fetch Bus Location:location=fetcher.fetch_bus_location()Fetch Bus Location Period:hour_location=fetcher.fetch_bus_location_period(period,"filename_to_save_json.json")Fetch Bus Stop Coordinates and Routes:fetcher.fetch_busstop_coordinates("filename_to_save_json.json")fetcher.fetch_routes("filename_to_save_json.json")For all methods, if a filename was not given, the data will be automatically saved with the date to avoid overwriting issues.Fetch Lines for Bus Stop:list_of_lines=fetcher.fetch_lines_for_busstop(bus_stop_complex_id,bus_stop_id)Fetch Whole Timetable:fetcher.read_the_whole_schedule("filename_to_save_json.json")Beware that fetching the whole timetable requires sending about 28,000 requests and may take from 20 to 50 minutes depending on the server load.BusStatisticianTheBusStatisticianmodule allows obtaining information about the speed and punctuality of buses.Import the module:fromztm_busesimportBusStatisticianInitialize:statistician=BusStatistician(bus_coordinates_file,timetable_file,routes_file,bus_stops_file)Get Speed Statistics:speed_data_frame=statistician.get_speed_statistics()Get Punctuality Statistics:punctuality_data_frame=statistician.get_punctuality_statistics()Thespeed_data_framecontains the columns: 'speed', 'lon', 'lat', 'vehicle_number', 'line_number'. Thepunctuality_data_framecontains 'Bus_num', 'Line', 'Busstop_id', 'Busstop_name', 'Lon', 'Lat', 'Arrived', 'Expected', 'Delay [min]'.Due to the complicated structure of bus routes and imperfections of the data, the punctuality data is prone to some larger errors.VisualizerTheVisualizermodule takes the dataframes from theBusStatisticianand plots them on the Warsaw map.Import the module:fromztm_busesimportVisualizerInitialize:vis=Visualizer()Heat Map of Speeds:vis.heat_map_speeds(speed_data_frame,html_file_to_save)Scatter Map of Speeds:vis.scatter_map_speeds(speed_data_frame,html_file_to_save)For speed maps output html file is optional and if not given the result will not be savedMap of Punctuality:vis.map_punctuality(punctuality_data_frame,html_file_to_save)For punctuality map the html file is required parameterIt is worth noting that before visualizing the data, it has to be cleaned up as the API sometimes responds with nonrealistic data (time traveling, hypersonic buses).Installationpipinstallztm_buses
ztool
ZTool文档暂未完善安装# 安装python-mpipinstallztool# 升级python-mpipinstall--upgradeztool# 卸载python-mpipuninstallztool
ztool2
No description available on PyPI.
ztools
ToolBox for Python, Easy to Use.概述ztools模块封装了使用Python语言编写的工具。工程主页:https://github.com/zoumingzhe/ztools下载地址:https://pypi.python.org/pypi/ztools法律许可: MITlicense, (C) 2018-2020ZouMingzhe<[email protected]>安装通过pip命令安装ztools模块:pip install ztools如果已经安装ztools模块,可以通过pip命令更新:pip install--upgradeztools更多安装信息请查阅安装文档。工具timeout:https://github.com/zoumingzhe/ztools/blob/master/ztools/ztools/tool/timeout.py超时,提供超时判断。progressbar:https://github.com/zoumingzhe/ztools/blob/master/ztools/ztools/tool/progressbar.py进度条,提供进度条显示。plot:https://github.com/zoumingzhe/ztools/blob/master/ztools/ztools/GUI/plot.py绘图,提供基于matplotlib的绘图功能。filebase:https://github.com/zoumingzhe/ztools/blob/master/ztools/ztools/file/filebase.py文件,提供文件访问与相关操作。xls:https://github.com/zoumingzhe/ztools/blob/master/ztools/ztools/file/xls.pyExcle,提供对.xls文件访问与相关操作。MySQL:https://github.com/zoumingzhe/ztools/blob/master/ztools/ztools/db/MySQL.pyMySQL数据库,提供基于pymysql的MySQL数据库访问。文档API(应用程序接口)文档、用法和例程可查阅documentation目录下的文档。.rst后缀文件可以在任何文本编辑器中查看或者使用Sphinx转换成HTML或PDF格式例程例程存放在工程文件的examples目录下。测试单元测试存放在工程文件的test目录下。支持本项目由ZouMingzhe<[email protected]> 创建并维护。为了完善ztools模块的功能,欢迎您贡献代码至:https://github.com/zoumingzhe/ztools语言简体中文English
ztplite
SynopsisProvides Zero Touch Provisioning functions for Fortinet assets using FortiManager.Initial Setup #############ZTPLite requires a system that is running python3To install ztplite is simple. All that is required is to run:.. code-block:: pythonpip install ztpliteA good practice is always to perform python package installs from a virtual environment so as not to interfere with the system requirements. See the python docs or other documents about virtual environments (venv or virtualenv) such asVirtual Environment Docs <https://docs.python.org/3/tutorial/venv.html>_Program UsageTo get ZTPLite working, a python module acting as a driver must be called. This driver is minimal and must call the :ref:Controller's<Controller Module>provision_unregistered_devicesfunction. Once that call is made, the rest of the program runs automatically.To define the driver (we will call itztpl_main.py), things could not be simpler. As stated before it simply needs to call a function within the :ref:Controller<Controller Module>that looks to provision unregistered devices called (drumroll please)provision_unregistered_devices. A full driver module is provided here:.. code-block:: python#!/usr/bin/env python3 from ztplite import ztplcontroller def main(): ztplcontroller.provision_unregistered_devices() if __name__ == "__main__": main()In the case that follows the calling module (remember that we named itztpl_main.py) is executed. Shown below is the call and an explanation of the arguments string that would be used for an example run....so:.. code-block:: pythonpython ztpl_main.py -s 10.1.1.1 -o /home/fortinet/ztpdemo/ztplite.log -c /home/fortinet/ztpdemo/configyml.yml -i /home/fortinet/ztpdemo/instructions.json --ssl -DThis would call a driver python module namedztpl_main.pywith the target FMG at 10.1.1.1The information log would be at /home/fortinet/ztpdemo/ztplite.logThe configuration file is the yaml file at /home/fortinet/ztpdemo/configyml.ymlThe instruction file is a json file at /home/fortinet/ztpdemo/instructions.jsonThe conversation with the FMG will utilize sslThe code will be running in Debug mode as well so the default debug log will be in affect. If the call needed to place the debug log specifically, the -d flag should have been used as discussed below in the :ref:Additional Argument InformationsectionClearly the above call would be hosted in a cron job somewhere or within a task that called it from within a virtual environment every hour or day or whatever timeframe the customer found acceptable. Any other task management process (other than cron) could be used to call the program of course.Additional Argument Informationztpl_main.py [-h] [-i INSTRUCTION_FILE] [-c CONFIG_FILE] [-s FMG_ADDRESS] [-u FMG_UNAME] [-p FMG_PWORD] [-o LOG_LOCATION] [-d DEBUG_LOG_LOCATION] [--use_syslog] [--syslog_addr SYSLOG_ADDR] [--syslog_port SYSLOG_PORT] [--syslog_fac SYSLOG_FAC] [--new_pass NEW_PASS] [-v V] [-D] [--run_test] [--ssl]Configuration:-i, --instruction_file INSTRUCTION_FILE_PATH: Instruction file path providing text to code structure. Defaults to ztpltexttocode.json in the directory where the main driver module is called-c, --config_file CONFIG_FILE: Config file path providing a location where the configuration file is located. No default is provided and this is a requirement-s, --fmg_address FMG_ADDR_STRING: FMG address or FQDN to FMG performing the ZTP operationsAuthentication:-u, --fmg_uname FMG_UNAME: FMG username used for authentication. Default isadmin-p, --fmg_pword FMG_PWORD: FMG password used for authentication. Default is a blank passwordLocal Logging:-o, --log_location LOG_LOCATION: Standard log location. Defaults to a log in the local directory namedztplite.log-d, --debug_log_location DEBUG_LOG_LOCATION: Debug Log location, default is the current directory with a filename ofdebug.logRemote Logging:--use_syslog: Sets requirement for syslog logging. Default isfalse--syslog_addr SYSLOG_ADDR: IP address of listening syslog server. Defaults to/dev/logfor local host logging.--syslog_port SYSLOG_PORT: Port used for syslog server. Default is514--syslog_fac SYSLOG_FAC: Facility for syslog server logging. Default isuserOptional Arguments:-h, --help: Display this help message and exit--new_pass NEW_PASSWORD: New Password for all FortiGates during this process-v: Runs code in verbose mode. Append multiple letter v for verbosity (i.e. -vvvv)-D, --debug: Run in debug mode. Enables debug logging and console debugging--ssl: Connect to FMG using SSL. Default isfalse--run_test: Run a test to determine if the instruction file has correct requirements in the DATA-REQ list. No actual modifications will take place if run_test is set
ztpserver
Quick OverviewZTPServer provides a bootstrap environment for Arista EOS based products. ZTPserver interacts with the ZeroTouch Provisioning (ZTP) mode of Arista EOS. The default ZTP start up mode triggers an unprovisioned Arista EOS nodes to enter a bootstrap readdy state if a valid configuration file is not already present on the internal flash storage.ZTPServer provides a number of configurable bootstrap operation workflows that extend beyond simply loading an configuration and boot image. It provides the ability to define the target node through the introduction of definitions and templates that call pre-built actions and statically defined or dynamically generated attributes. The attributes and actions can also be extended to provide custom functionality that are specific to a given implementation. ZTPServer also provides a topology validation engine with a simple syntax to express LLDP neighbor adjacencies. It is written mostly in Python and leverages standard protocols like DHCP and DHCP options for boot functions, HTTP for bi-directional transport, and XMPP and syslog for logging. Most of the files that the user interacts with are YAML based.ZTPServer FeaturesAutomated configuration file generation and applicationImage and file system validation and standardizationConnectivity validation and topology based auto-provisioningConfig and device templates with resource allocation for dynamic deploymentsZero touch replacement and upgrade capabilitiesUser extensible actionsEmail, XMPP, syslog based logging and accounting of all processesDocsZTPServer official documentationis built and hosted at (http://ReadTheDocs.org/).ContributingPlease see theCONTRIBUTING.mdfile for additional information.SupportMailing [email protected]: irc.freenode.net#aristaDependenciesServerPython 3.6 or later (https://www.python.org/downloads)routes 2.5 or later (https://pypi.python.org/pypi/Routes)webob 1.8 or later (http://webob.org/)PyYaml 6.0 or later (http://pyyaml.org/)ClientArista EOS 4.12.0 or laterLicenseBSD-3, See LICENSE file
ztq_console
简介ZTQ 队列服务, 分为3个包:ztq_core, ztq_worker, ztq_console。默认使用redis作为队列的后端。ztq_core提供一系列的方法把任务push到队列中,由ztq_worker去获取队列任务并且执行。你可以在这里找到它:http://pypi.python.org/pypi/ztq_core/ztq_worker:队列的接收端,以线程为单位阻塞式的去监视一个队列。每一个线程称为Worker 当有任务push到了队列中,相应的Worker会自动pull下来去执行。你可以在这里找到它:http://pypi.python.org/pypi/ztq_worker/ztq_console:对每一个队列的每一个任务执行情况进行监控、下达指令。这个包是可选的你可以在这里找到它:http://pypi.python.org/pypi/ztq_console/关于 ZTQ* 开源, 使用MIT 许可 * 基于Python, 容易使用和修改 * 支持linux 和 windows * 可靠,可以应付突然断电等情况 * 可管理,自身带有ztq_console 监控后台 * 灵活,可以在不同的机器上运行多个Worker, 并且随时热插拔Worker * 使用简单安装pip install ztq_core pip install ztq_worker pip install ztq_console使用先定义一个普通的任务# my_send.pydef send(body):print ‘START: ‘, body sleep(5) print ‘END:’, bodydef send2(body):print ‘START2’, body raise Exception(‘connection error’)将普通的任务改成队列任务# my_send.py import time from ztq_core import async @async # 使用默认队列default def send(body): print ‘START: ‘, body sleep(5) print ‘END:’, body @async(queue=‘mail’) # 使用队列mail def send(body): print ‘START2’, body raise Exception(‘connection error’)运行worker# 运行:bin/ztq_worker app.ini # app.ini 例子, 在ztq_worker 包里面有个config 目录放有app.ini 这个文件 [server] host = localhost port = 6379 db = 0 alias = w01 active_config = false modules = my_send # 所有需要import的任务模块,每个一行 [queues] default= 0 # default队列,起1个处理线程 mail = 0, 0 # mail队列,起2个处理线程 [log] handler_file = ./ztq_worker.log level = ERROR运行import ztq_core from my_send import send # 设置 Redis 连接 ztq_core.setup_redis(‘default’, ‘localhost’, 6379, 0) send(‘hello, world’) # 动态指定queue send(‘hello world from mail’, ztq_queue=‘mail’)更详细的测试例子可见ztq_core包下的demo.py使用更高级的特征抢占式执行# 后插入先执行。如果任务已经在队列,会优先 send (body, ztq_first=True)探测任务状态# ztq_first存在就优先, ztq_run不存在就运行 # 返回的是"running" 代表正在运行, 是"queue" 代表正在排队 # 如果是"error" 代表出错, 是"none" 代表这个任务不在排队,也没在执行 ping_task(send, body, ztq_first=True, ztq_run=True)支持事务import transaction ztq_core.enable_transaction(True) send_mail(from1, to1, body1) send_mail(from2, to2, body2) transaction.commit() # 也可以单独关闭事务 send_mail(from2, to2, body2, ztq_transaction=False)定时任务from ztq_core.async import async from ztq_core import redis_wrap from ztq_core.cron import has_cron, add_cron_job @async(queue='clock-0') def bgrewriteaof(): """ 将redis的AOF文件压缩 """ redis = redis_wrap.get_redis() redis.bgrewriteaof() # 如果队列上没有这个定时任务,就加上。自动定时压缩reids if not has_cron(bgrewriteaof): add_cron({'hour':1}, bgrewriteaof)任务串行from ztq_core import prepare_task # 根据(方法,参数)生成一个任务 callback = prepare_task(send, body) # 执行完 send_mail 之后队列会自动将callback 放入指定的队列 send_mail(body, ztq_callback=callback)异常处理from ztq_core import prepare_task @async(queue='mail') def fail_callback(return_code, return_msg): print return_code, return_msg fcallback = prepare_task(send2) # 如果任务 send 抛出了任何异常,都会将fcallback 放入指定队列 send(body, ztq_fcallback=fcallback)进度回调import ztq_worker @async(queue='doc2pdf') def doc2pdf(filename): ... # 可被进度回调函数调用 ztq_worker.report_progress(page=2) ... from ztq_core import prepare_task pcallback = prepare_task(send2, body) doc2pdf(filename, ztq_pcallback=pcallback)批处理# 为提升性能,需要多个xapian索引操作,一次性提交数据库 @async(queue=‘xapian’) def index(data): pass def do_commit(): xapian_conn.commit() # 每执行20个索引任务之后,一次性提交数据库 # 不够20个,但队列空的时候,也会提交 register_batch_queue(‘xapian’, 20, batch_func=do_commit)1.0dev —Initial version
ztq_core
简介ZTQ 队列服务, 分为3个包:ztq_core, ztq_worker, ztq_console。默认使用redis作为队列的后端。ztq_core提供一系列的方法把任务push到队列中,由ztq_worker去获取队列任务并且执行。你可以在这里找到它:http://pypi.python.org/pypi/ztq_core/ztq_worker:队列的接收端,以线程为单位阻塞式的去监视一个队列。每一个线程称为Worker 当有任务push到了队列中,相应的Worker会自动pull下来去执行。你可以在这里找到它:http://pypi.python.org/pypi/ztq_worker/ztq_console:对每一个队列的每一个任务执行情况进行监控、下达指令。这个包是可选的你可以在这里找到它:http://pypi.python.org/pypi/ztq_console/关于 ZTQ* 开源, 使用MIT 许可 * 基于Python, 容易使用和修改 * 支持linux 和 windows * 可靠,可以应付突然断电等情况 * 可管理,自身带有ztq_console 监控后台 * 灵活,可以在不同的机器上运行多个Worker, 并且随时热插拔Worker * 使用简单安装pip install ztq_core pip install ztq_worker pip install ztq_console使用先定义一个普通的任务# my_send.pydef send(body):print ‘START: ‘, body sleep(5) print ‘END:’, bodydef send2(body):print ‘START2’, body raise Exception(‘connection error’)将普通的任务改成队列任务# my_send.py import time from ztq_core import async @async # 使用默认队列default def send(body): print ‘START: ‘, body sleep(5) print ‘END:’, body @async(queue=‘mail’) # 使用队列mail def send(body): print ‘START2’, body raise Exception(‘connection error’)运行worker# 运行:bin/ztq_worker app.ini # app.ini 例子, 在ztq_worker 包里面有个config 目录放有app.ini 这个文件 [server] host = localhost port = 6379 db = 0 alias = w01 active_config = false modules = my_send # 所有需要import的任务模块,每个一行 [queues] default= 0 # default队列,起1个处理线程 mail = 0, 0 # mail队列,起2个处理线程 [log] handler_file = ./ztq_worker.log level = ERROR运行import ztq_core from my_send import send # 设置 Redis 连接 ztq_core.setup_redis(‘default’, ‘localhost’, 6379, 0) send(‘hello, world’) # 动态指定queue send(‘hello world from mail’, ztq_queue=‘mail’)更详细的测试例子可见ztq_core包下的demo.py使用更高级的特征抢占式执行# 后插入先执行。如果任务已经在队列,会优先 send (body, ztq_first=True)探测任务状态# ztq_first存在就优先, ztq_run不存在就运行 # 返回的是"running" 代表正在运行, 是"queue" 代表正在排队 # 如果是"error" 代表出错, 是"none" 代表这个任务不在排队,也没在执行 ping_task(send, body, ztq_first=True, ztq_run=True)支持事务import transaction ztq_core.enable_transaction(True) send_mail(from1, to1, body1) send_mail(from2, to2, body2) transaction.commit() # 也可以单独关闭事务 send_mail(from2, to2, body2, ztq_transaction=False)定时任务from ztq_core.async import async from ztq_core import redis_wrap from ztq_core.cron import has_cron, add_cron_job @async(queue='clock-0') def bgrewriteaof(): """ 将redis的AOF文件压缩 """ redis = redis_wrap.get_redis() redis.bgrewriteaof() # 如果队列上没有这个定时任务,就加上。自动定时压缩reids if not has_cron(bgrewriteaof): add_cron({'hour':1}, bgrewriteaof)任务串行from ztq_core import prepare_task # 根据(方法,参数)生成一个任务 callback = prepare_task(send, body) # 执行完 send_mail 之后队列会自动将callback 放入指定的队列 send_mail(body, ztq_callback=callback)异常处理from ztq_core import prepare_task @async(queue='mail') def fail_callback(return_code, return_msg): print return_code, return_msg fcallback = prepare_task(send2) # 如果任务 send 抛出了任何异常,都会将fcallback 放入指定队列 send(body, ztq_fcallback=fcallback)进度回调import ztq_worker @async(queue='doc2pdf') def doc2pdf(filename): ... # 可被进度回调函数调用 ztq_worker.report_progress(page=2) ... from ztq_core import prepare_task pcallback = prepare_task(send2, body) doc2pdf(filename, ztq_pcallback=pcallback)批处理# 为提升性能,需要多个xapian索引操作,一次性提交数据库 @async(queue=‘xapian’) def index(data): pass def do_commit(): xapian_conn.commit() # 每执行20个索引任务之后,一次性提交数据库 # 不够20个,但队列空的时候,也会提交 register_batch_queue(‘xapian’, 20, batch_func=do_commit)1.0dev —Initial version
ztq_worker
简介ZTQ 队列服务, 分为3个包:ztq_core, ztq_worker, ztq_console。默认使用redis作为队列的后端。ztq_core提供一系列的方法把任务push到队列中,由ztq_worker去获取队列任务并且执行。你可以在这里找到它:http://pypi.python.org/pypi/ztq_core/ztq_worker:队列的接收端,以线程为单位阻塞式的去监视一个队列。每一个线程称为Worker 当有任务push到了队列中,相应的Worker会自动pull下来去执行。你可以在这里找到它:http://pypi.python.org/pypi/ztq_worker/ztq_console:对每一个队列的每一个任务执行情况进行监控、下达指令。这个包是可选的你可以在这里找到它:http://pypi.python.org/pypi/ztq_console/关于 ZTQ* 开源, 使用MIT 许可 * 基于Python, 容易使用和修改 * 支持linux 和 windows * 可靠,可以应付突然断电等情况 * 可管理,自身带有ztq_console 监控后台 * 灵活,可以在不同的机器上运行多个Worker, 并且随时热插拔Worker * 使用简单安装pip install ztq_core pip install ztq_worker pip install ztq_console使用先定义一个普通的任务# my_send.pydef send(body):print ‘START: ‘, body sleep(5) print ‘END:’, bodydef send2(body):print ‘START2’, body raise Exception(‘connection error’)将普通的任务改成队列任务# my_send.py import time from ztq_core import async @async # 使用默认队列default def send(body): print ‘START: ‘, body sleep(5) print ‘END:’, body @async(queue=‘mail’) # 使用队列mail def send(body): print ‘START2’, body raise Exception(‘connection error’)运行worker# 运行:bin/ztq_worker app.ini # app.ini 例子, 在ztq_worker 包里面有个config 目录放有app.ini 这个文件 [server] host = localhost port = 6379 db = 0 alias = w01 active_config = false modules = my_send # 所有需要import的任务模块,每个一行 [queues] default= 0 # default队列,起1个处理线程 mail = 0, 0 # mail队列,起2个处理线程 [log] handler_file = ./ztq_worker.log level = ERROR运行import ztq_core from my_send import send # 设置 Redis 连接 ztq_core.setup_redis(‘default’, ‘localhost’, 6379, 0) send(‘hello, world’) # 动态指定queue send(‘hello world from mail’, ztq_queue=‘mail’)更详细的测试例子可见ztq_core包下的demo.py使用更高级的特征抢占式执行# 后插入先执行。如果任务已经在队列,会优先 send (body, ztq_first=True)探测任务状态# ztq_first存在就优先, ztq_run不存在就运行 # 返回的是"running" 代表正在运行, 是"queue" 代表正在排队 # 如果是"error" 代表出错, 是"none" 代表这个任务不在排队,也没在执行 ping_task(send, body, ztq_first=True, ztq_run=True)支持事务import transaction ztq_core.enable_transaction(True) send_mail(from1, to1, body1) send_mail(from2, to2, body2) transaction.commit() # 也可以单独关闭事务 send_mail(from2, to2, body2, ztq_transaction=False)定时任务from ztq_core.async import async from ztq_core import redis_wrap from ztq_core.cron import has_cron, add_cron_job @async(queue='clock-0') def bgrewriteaof(): """ 将redis的AOF文件压缩 """ redis = redis_wrap.get_redis() redis.bgrewriteaof() # 如果队列上没有这个定时任务,就加上。自动定时压缩reids if not has_cron(bgrewriteaof): add_cron({'hour':1}, bgrewriteaof)任务串行from ztq_core import prepare_task # 根据(方法,参数)生成一个任务 callback = prepare_task(send, body) # 执行完 send_mail 之后队列会自动将callback 放入指定的队列 send_mail(body, ztq_callback=callback)异常处理from ztq_core import prepare_task @async(queue='mail') def fail_callback(return_code, return_msg): print return_code, return_msg fcallback = prepare_task(send2) # 如果任务 send 抛出了任何异常,都会将fcallback 放入指定队列 send(body, ztq_fcallback=fcallback)进度回调import ztq_worker @async(queue='doc2pdf') def doc2pdf(filename): ... # 可被进度回调函数调用 ztq_worker.report_progress(page=2) ... from ztq_core import prepare_task pcallback = prepare_task(send2, body) doc2pdf(filename, ztq_pcallback=pcallback)批处理# 为提升性能,需要多个xapian索引操作,一次性提交数据库 @async(queue=‘xapian’) def index(data): pass def do_commit(): xapian_conn.commit() # 每执行20个索引任务之后,一次性提交数据库 # 不够20个,但队列空的时候,也会提交 register_batch_queue(‘xapian’, 20, batch_func=do_commit)1.0dev —Initial version
ztrack
ztrackToolbox for zebrafish pose estimation.InstallationUse the package managerpipto install ztrack.pipinstallztrack
ztracker
No description available on PyPI.
ztransforms
语言: 🇨🇳🇺🇸«ZTransforms»是一个图像数据增强代码库基于pytorch/vision实现架构,添加albumentations后端输入图像格式:numpy ndarray数据类型:uint8通道排列顺序:rgb关键依赖版本:pytorch/vision: c1f85d34761d86db21b6b9323102390834267c9balbumentations-team/albumentations: v0.5.2内容列表内容列表背景安装使用主要维护人员致谢参与贡献方式许可证背景PyTorch提供了官方数据增强实现:transforms。该模块基于PIL进行数据增强操作,其优缺点如下:优点:简洁清晰的数据架构简单易懂的数据处理流完善的文档介绍缺点:基于PIL后端,提供的图像增强功能有限基于PIL后端,相较于其他库的执行速度慢针对于执行速度问题,torchvision也意识到了这一点,从0.8.0开始进行了改进Prior to v0.8.0, transforms in torchvision have traditionally been PIL-centric and presented multiple limitations due to that. Now, since v0.8.0, transforms implementations are Tensor and PIL compatible and we can achieve the following new features: transform multi-band torch tensor images (with more than 3-4 channels) torchscript transforms together with your model for deployment support for GPU acceleration batched transformation such as for videos read and decode data directly as torch tensor with torchscript support (for PNG and JPEG image formats)一方面通过新的后端Pillow-SIMD来提高PIL的执行速度;另一方面添加PyTorch后端来实现GPU加速在网上找到两个数据增强库,除了分类数据增强外还提供了检测/分割数据增强:imgaug:其实现了更多的数据增强操作;albumentations:其在不同的后端(pytorch/imgaug/opencv)中找出各自最快的增强函数(参考Benchmarking results)上述两个数据增强库均实现了类似于transforms的数据流操作方式。不过相对而言,个人还是最喜欢官方的实现和使用方式,所以新建这个代码库,基于transforms,在原有功能中添加albumentation后端实现,同时添加新的数据增强操作(如果albumentation未实现,就使用imgaug实现)安装$ pip install ztransforms使用# import torchvision.transforms as transforms import ztransforms.cls as transforms ... ...主要维护人员zhujian -Initial work-zjykzj致谢pytorch/visionalbumentations-team/albumentationsaleju/imgaugopencv/opencv@Article{info11020125, AUTHOR = {Buslaev, Alexander and Iglovikov, Vladimir I. and Khvedchenya, Eugene and Parinov, Alex and Druzhinin, Mikhail and Kalinin, Alexandr A.}, TITLE = {Albumentations: Fast and Flexible Image Augmentations}, JOURNAL = {Information}, VOLUME = {11}, YEAR = {2020}, NUMBER = {2}, ARTICLE-NUMBER = {125}, URL = {https://www.mdpi.com/2078-2489/11/2/125}, ISSN = {2078-2489}, DOI = {10.3390/info11020125} } @misc{imgaug, author = {Jung, Alexander B. and Wada, Kentaro and Crall, Jon and Tanaka, Satoshi and Graving, Jake and Reinders, Christoph and Yadav, Sarthak and Banerjee, Joy and Vecsei, Gábor and Kraft, Adam and Rui, Zheng and Borovec, Jirka and Vallentin, Christian and Zhydenko, Semen and Pfeiffer, Kilian and Cook, Ben and Fernández, Ismael and De Rainville, François-Michel and Weng, Chi-Hung and Ayala-Acevedo, Abner and Meudec, Raphael and Laporte, Matias and others}, title = {{imgaug}}, howpublished = {\url{https://github.com/aleju/imgaug}}, year = {2020}, note = {Online; accessed 01-Feb-2020} }参与贡献方式欢迎任何人的参与!打开issue或提交合并请求。注意:GIT提交,请遵守Conventional Commits规范语义版本化,请遵守Semantic Versioning 2.0.0规范README编写,请遵守standard-readme规范许可证Apache License 2.0© 2021 zjykzj
ztranslator
ztranslatorSimples tradutor de linha de comando. Você pode configurar uma combinação de teclas de atalho para que execute o ztranslator, para isso basta passar --notify como parametro de linha comando, que o ztranslator se encarrega de pegar a última entrada na área de transferência e exibir o texto traduzido em um simpático balãozinho na sua Área de Trabalho.Instalação:$pipinstallztranslatorExemplos de uso:Na linha de comando:$ztranslator--text"Hello World"--source-langen--target-langpt--source-apigoogle $ztranslator--help$python-mtranslator--helpNo seu código python:In[1]:fromtranslatorimportTranslatorIn[2]:t=Translator(source_lang="pt",target_lang='en',source_api="google")In[3]:t.translate("Type copyright, credits or license for more information")Out[3]:'Digite copyright, créditos ou licença para mais informações'Configuração para Desenvolvimento$gitclonehttps://github.com/andreztz/ztranslator.git $cdztranslator $virtualenvvenv $sourcevenv/bin/activate $pipinstall-e.Histórico de lançamento1.0.0 - Altera interface da API e linha de comando.0.1.0 - Adiciona acesso a api do google translate via googletrans.0.0.7 - O primeiro lançamento adequado.Trabalho em andamentoAndré Santos –@ztzandre–[email protected]://github.com/andreztz/ztranslatorContribuaFork it (https://github.com/andreztz/ztranslator/fork)Create your feature branch (git checkout -b feature/fooBar)Commit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull Request
ztreamy
ztreamy: a framework for publishing semantic events on the Webhttp://www.ztreamy.org/ztreamy is a prototype implementation of a framework for publishing streams of events through on the Web, built on top of the Tornado Web server. The framework provides services that are specific to events described with RDF, although any other kinds of events can be transported as well.The platform provides scalability through replication: streams can be repeated from other servers. Streams can also be aggregated and filtered.A python library for consuming events at the client side is already provided. For consuming events from programs written in other languages, the client can use an HTTP client library and parse the events itself. Support for other languages is planned to be added in the future.This is an alpha version of the framework. There is no guarantee that the main programming interfaces will no change in the near future.Basic documentation for installing and testing the framework is available at:http://www.ztreamy.org/doc/This documentation is still work in progress.A thorough description and evaluation of Ztreamy has been published at the Journal of Web Semantics. If you want to cite Ztreamy from a research publication or report, please use the following bibliographic reference:Jesus Arias Fisteus, Norberto Fernandez Garcia, Luis Sanchez Fernandez, Damaris Fuentes-Lorenzo, “Ztreamy: a middleware for publishing semantic streams on the Web”. Journal of Web Semantics (2013). doi:10.1016/j.websem.2013.11.002.
ztree2python
ztree2pythonztree2python imports a data file created by z-Tree (Fischbacher, 2007) into python as pandas dataframes. This function inputs the "filename" of a z-Tree data file, and it returns a dictionary, which contains the dataframes of the tables. The keys are the names of all tables, "globals", "subjects", and so on. The value associated with each key is a pandas dataframe for the table.InstallationUse the package managerpipto install.pipinstallztree2pythonAlternatively, simply put ztree2python.py and a z-Tree data file (e.g., 221215_1449.xls) in the current directory or the working directory.UsageThe ztree2python is a simple function that takes the filename of a z-Tree data file as the argument and returns a dictionary that contains all of the tables in the z-Tree data file.fromztree2pythonimportztree2pythonasz2p# input the file name, and it returns a dictionary.tables=z2p('221215_1449.xls')The function returns a dictionary. Each table is stored as a dataframe in thetables. Get the data of a table as follows:# Extract a table by name, for example, the "subjects" table.my_table=tables['subjects']my_table.head()See all of the tables intablesas follows:# The dictionary also contains a series of table names. See the list.tables['list_tables']# Display all of the tables.fromIPython.displayimportdisplayforname,tblintables.items():display(tbl)Technical notesThe function reads the data and iterates the following process over the names of the tables. It filters the rows of the main dataframe to only include rows that belong to the current table. Then it processes the data for each treatment within the table and creates a dataframe for each treatment. If the period is repeated in the treatment, the data for the treatment has a header row with variable names inserted each period. This function assumes that these header rows are the same within the treatment and reads the top header row as the variable names, then removes all header rows afterwards. All data will be converted to numeric, if possible. Finally, the table for the current treatment is added to the dataframe for the current table.After all the tables have been processed, the function returns the dictionary of dataframes.LicenseMIT. ztree2python is "provided "as is", without warranty of any kind."ReferenceFischbacher, U. (2007). z-Tree: Zurich toolbox for ready-made economic experiments.Experimental Economics, 10(2), 171-178.https://doi.org/10.1007/s10683-006-9159-4.Takeuchi, Kan. (2022). ztree2python.py,http://github.com/takekan/ztree2python.Takeuchi, K. (2022). ztree2stata: A data converter for z-Tree and Stata users.I would appreciate it if you kindly mention to this code in a footnote or somewhere.Enjoy!
ztshare
Target Usersfinancial market analyst of Chinalearners of financial data analysis with pandas/NumPypeople who are interested in China financial dataInstallationpip install ztshareUpgradepip install ztshare –upgradeQuick Startimport ztshare as zs zs.set_app(app_id='your appId', app_secret='your appSecret') zs.pro_bar(zcode='000001.SH', start_date='20210621', end_date='20210621')return:date high amount vol low adj close open 20210506 3471.2400 400525169.6 310424192.0 3426.8487 1.0 3441.2826 3446.0743 20210507 3457.8924 411078841.6 353785389.0 3416.7755 1.0 3418.8741 3446.4070 20210510 3429.7359 399717549.0 374170884.0 3401.9346 1.0 3427.9909 3423.5900 20210511 3448.0959 390326273.8 350934112.0 3384.6966 1.0 3441.8454 3406.5980 20210512 3466.3708 343860406.4 311444547.0 3428.3944 1.0 3462.7513 3429.7544 20210513 3448.0169 356376917.8 319325327.0 3418.3846 1.0 3429.5361 3432.1380 20210514 3490.6437 411116942.8 336982309.0 3422.5649 1.0 3490.3762 3436.0919 20210517 3530.5055 424476783.4 322135969.0 3490.1438 1.0 3517.6158 3490.4091 20210518 3529.0144 336028774.7 271308558.0 3510.8620 1.0 3529.0144 3520.6488 20210519 3521.1100 349973152.3 278321117.0 3503.8151 1.0 3510.9647 3521.1100 20210520 3517.7400 390355321.5 326009333.0 3486.0662 1.0 3506.9444 3500.8773 20210521 3518.3769 356025931.3 283826285.0 3479.6744 1.0 3486.5569 3510.8353 20210524 3498.3037 367181627.9 289509242.0 3469.8746 1.0 3497.2821 3486.2711 20210525 3584.5774 472213531.4 341241127.0 3502.4429 1.0 3581.3418 3502.5390 20210526 3603.4881 455831256.7 341980288.0 3585.3700 1.0 3593.3570 3586.8388 20210527 3626.3584 429004239.3 309551486.0 3579.2600 1.0 3608.8507 3585.7337 20210528 3622.1800 452445032.0 349208830.0 3582.3580 1.0 3600.7844 3610.7668 20210531 3615.6568 449694381.0 331523770.0 3580.6524 1.0 3615.4773 3600.0700 20210601 3626.0737 471663104.8 352811413.0 3581.9115 1.0 3624.7138 3608.5978
zts-helloPypi
ReadmeThis is a test package with a below structure:├── README.md ├── helloPypi │ ├── __init__.py │ ├── hello.py ├── setup.py
ztsuper-ctbs
No description available on PyPI.
zttt
Tic Tac Toe is a famous game in which two players take turns placing a mark on a 3x3 grid. The first player to get three in a row wins.The module is a standalone implementation of the game TicTacToe providing functionality to keep track of the game’s state and to make moves.FeaturesStandalone implementation of the game Tic Tac Toe.Provides a way to customisemove triggersand access state variables.Comes with an engine with near perfect moves.Written in Python from scratch and does not require any external libraries.Can be integrated into a larger project, with very little effort.Throws custom-built errors making it easy to debug and handle errors.LinksPyPIGitHubDocumentationExamplesInstallationpipinstallzttt
ztv
ztv- astronomical image viewerztvis an astronomical image viewer designed to be used from a python command line for display and analysis.ztvis useful as-is for display and simple analysis of images already loaded in tonumpy arrays, as well asFITS files. It can display the most recently acquired image by watching a directory for new FITS files to appear or watching a single FITS file for when it changes. It can also receive new images via anActiveMQ message stream.ztvis intended for real-time display and analysis.ztvis not intended to produce publication quality figures.ztvcomes with a number of built-in control panels, for: - selecting input source (FITS file, auto-reload from FITS file, etc) - selecting a frame to subtract (e.g. sky or dark) and a flat field frame to divide by - setting colormap, stretch, and lower/upper limits - doing basic slice plots, statistics, and aperture photometry. Additional panels can be written and added, for e.g. controlling a camera. (One example add-on panel is included that generates faked images in the FITS format.)If proper FITS header keywords are available,ztvwill display the ra/dec of the cursor point.Examples of usageTo launch:import ztv z = ztv.ZTV()To load an image in a numpy array:import numpy as np im = np.random.normal(size=[10, 256, 256]) # create a 3-d image stack z.load(im)You can now look at your data, manipulate display parameters, etc all using the gui elements. All of these elements are accessible through the tabbed control panels. You can also switch amongst the control panel tabs bycmd-alt-#where#is the number of the panel, starting from 1. Or, bycmd-[andcmd-]to move left/right amongst the tabs. You can even switch tabs from the command line api, e.g.:z.control_panel('Color')To change cursor mode, presscmd-#where#is the number shown in the pop-up menu that’s available by right-clicking in the primary image area:To manipulate display parameters:z.cmap('gist_heat') z.minmax(0., 4.) z.scaling('Sqrt') z.xy_center(100, 100) z.zoom(5.)To set up a statistics box and see the GUI output (note that output is also returned to your command line as a dict):z.stats_box(xrange=[80, 100], yrange=[100,120], show_overplot=True) z.control_panel('Stats')There’s a lot more you can do from the command line if you play withztv, especially in an exploration-friendly environment likeipython. And, anything you can do from the command line can be done from the GUI.Download an iconic FITS image from the web and display it:from urllib import urlopen from zipfile import ZipFile from StringIO import StringIO remote_url = 'http://www.spacetelescope.org/static/projects/fits_liberator/datasets/eagle/656nmos.zip' local_filename = '/tmp/hst-eagle-nebula-656nmos.fits' zip = ZipFile(StringIO(urlopen(remote_url).read())) zip_filename = zip.filelist[0].filename open(local_filename, 'w').write(zip.open(zip_filename).read()) z.load(local_filename) z.scaling('Log') z.minmax(0, 500)We can even do a little aperture photometry while we’re here:z.cmap('gray') z.xy_center(624, 524) z.zoom(4) z.minmax(0, 1000) z.scaling('Asinh') z.control_panel('phot') z.aperture_phot(xclick=614, yclick=516, show_overplot=True)And, of course, you can adjust the window size to suit your needs, either smaller:or larger:Example of an Add-on Control PanelOne of the motivating use cases forztvwas real-time quick-look of incoming images and the ability to extend the basic installation, including instrumentat control. An example of this is thatztvwill be used to both control and inspect the images from a slit viewing camera on a spectrograph of mine. To demonstrate this extensibility, there’s a simple example inztv_examples/fits_faker_panel/:from ztv_examples.fits_faker_panel.launch_ztv import launch_ztv z = launch_ztv() z.start_fits_faker()Our fake example data looks a lot better when we subtract the sky and divide the flat field (someone needs to blow the dust off that fake dewar window…):z.control_panel('Source') z.sky_frame(True) z.flat_frame(True)Installation and Dependenciesztvuses several packages, includingwxPython,astropy. These should be automatically installed if you installztvfrompypiwith:pip install ztvYou can also grab source code fromgithub.Note thatztvwas developed and tested on OS X.Example of installation using Mac OS X’s included PythonThe following steps worked on a fresh install of OS X Yosemite 10.10.5 on 2015-09-06:Install Xcode from the App StoreLaunch Xcode one time to accept licensesInstall pip and other necessary python packagesRun following command lines in a terminal:curl -o ~/Downloads/get-pip.py https://bootstrap.pypa.io/get-pip.py sudo -H python ~/Downloads/get-pip.py sudo -H pip install matplotlib sudo -H pip install astropy sudo -H pip install astropy-helpersInstall wxPython version 3DownloadOS X cocoa version of wxPython version 3 from here(waswxPython3.0-osx-docs-demos-3.0.2.0-cocoa-py2.7.dmgat time of writing)Open disk image and install with the following command line command:(This is necessary because package isn’t properly signed & is an old-style package, seehere. Obviously may need to update exact file path to the pkg.)sudo installer -pkg /Volumes/wxPython3.0-osx-3.0.2.0-cocoa-py2.7/wxPython3.0-osx-cocoa-py2.7.pkg -target /Finally, installztv:sudo -H pip install ztvExample of installation into anaconda python distributionThe following was tested on a fresh install of OS X 10.10.5 on 2015-09-08.Install Xcode from the App Store and launch Xcode one time to accept its licenses.DownloadAnaconda-2.3.0-MacOSX-x86_64.shfrom here.bash Anaconda-2.3.0-MacOSX-x86_64.sh source ~/.bash_profile conda create --name ztv-test wxpython matplotlib source activate ztv-test pip install ztvExample of installation into a Homebrew python distributionThe following was tested on a fresh install of OS X 10.10.5 on 2015-09-07.Install Xcode from the App Store and launch Xcode one time to accept its licenses.InstallHomebrewwith the one-line ruby command onHomebrew’s home pageInstall python & other necessary bits with the following commands.brew install python brew install wxpython pip install numpy pip install ztvNote thatnumpyis explicitly installed first usingpip install numpybeforeztvis installed. During testing on OS X 10.10.5 on 2015-09-07 allowing the numpy dependency to be automatically filled bypip install ztvresulted in an installation error that does not occur if you follow the above sequence.Linux/UbuntuI tested briefly on Ubuntu 14.04.ztvbasically works, although the pulldown colormap menus will not have bitmaps of the colormaps. Also, (at least on my testing virtual machine) the performance ofztvwas much laggier than on my main OS X laptop. For the colormaps you could try looking atthis link, but it didn’t work on my test system.BackgroundIn graduate school in the late 1990’s I learnedIDLand usedAaron Barth’s ATVextensively. I even contributed a little to a now-outdated version ofATV, adding 3-d image stack capability.ATVwas and is incredibly useful for quick-looks at image data, analysis, and all the things you want when working with typical astronomical image data.After graduate school I began migrating toward python and away from IDL. I’ve written about this choice elsewhere, but some of the basic reasons were to avoid IDL licensing issues and being beholden to one company. (To be fair, how much I pay every year to keep my IDL license current has always been reasonable. It helps that my license has some obscure history to it that makes the maintenance fees moderate. But, at any time they could raise the prices on me massively. And, I wanted to use a language that could effectively be on every machine I touch, from my main laptop to an embedded server.)In python there are already a multitude of possible image viewers. Many of which are great and can do much of what I needed. (See next section for some links.) But, inevitably as I’ve played with them I’ve found they each doesn’t scratch my itch in some way. I wanted something that worked exactly the way I wanted, with the right (for me) mix of complexity and simplicity. I need day-to-day image quicklook from the python command-line, e.g. while I’m developing some new image processing algorithm or to check on last night’s data. But, I also need to be able to easily adapt my viewer to other situations, including real-time use on a slit-viewing camera, quick-reduction of incoming data, etc.. So, I wroteztv.The nameztvis an obvious play off ofATV. And, “z” is my daughter’s middle initial.Other Image Viewers You Should Check OutIf you’re using IDL, check outATVof course!SAOImage DS9Aladin Desktop Sky Atlas(not primarily an image viewer, but can open FITS files and overlay catalogs and other images nicely)gingaToyz(If your favorite isn’t on this list, please [email protected] get it added.)AcknowledgementsThank you to Aaron Barth for his originalATV. Thank you to all the numerous people who have put so much effort in to all the packages that make my work not only easier but possible. I especially thank the developers ofastropyand its associated packages. e.g. It’s an amazing thing to do correct FITS coordinate conversions in one line of code.AuthorHenry Roe ([email protected])Licenseztvis licensed under the MIT License, seeLICENSE.txt. Basically, feel free to use any or all of this code in any way. But, no warranties, guarantees, etc etc..
ztw-sdk-obs-python
ZTW OBS Python SDK
ztxtq1
Failed to fetch description. HTTP Status Code: 404