Saravanan666/pypi-org huggingface dataset:
Package: mocksafe
MockSafe v0.6.0-alphaA mocking library developed to enable static and runtime type checking of your mocks to help keep them up-to-date with your production code.It has a simple, fluent API and is designed to be used with Python’sassertstatement.Checkout the docs link below for more information.Install and quickstartpip install mocksafeLibrary UsageLinksInstall:PyPiDocs:Read The DocsLicense:MITSource:GitHubIssues:GitHub IssuesDiscussion:Questions & Feedback
Package: mockser
mockserMock HTTP server. Asks you for a JSON response everytime you visit a path for the first time.Installationpip install mockserCommand line interfaceusage: mockser [-h] [-p PORT]

Mock HTTP server. Asks you for a JSON response everytime you visit a path for the first time.

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  Port to run the server on. Defaults to 8080.
Package: mockseries
mockseriesmockseriesis and easy to use and intuitive  Python package that helps generate synthetic (mock) timeseries.-> Documentation website.Installation#python >=3.9
pip install mockseriesFor older versions of python, here is the compatibility matrix:mockseries versionPython versions0.3.x3.9 - 3.120.2.x3.8 - 3.110.1.x3.6 - 3.8ContributingContributions are welcome!Standards, objectives and process not defined yet.Quick RunDefine a timeseriesfromdatetimeimporttimedeltafrommockseries.trendimportLinearTrendfrommockseries.seasonalityimportSinusoidalSeasonalityfrommockseries.noiseimportRedNoisetrend=LinearTrend(coefficient=2,time_unit=timedelta(days=4),flat_base=100)seasonality=SinusoidalSeasonality(amplitude=20,period=timedelta(days=7))\+SinusoidalSeasonality(amplitude=4,period=timedelta(days=1))noise=RedNoise(mean=0,std=3,correlation=0.5)timeseries=trend+seasonality+noiseGenerate valuesfrom datetime import datetime
from mockseries.utils import datetime_range

ts_index = datetime_range(
    granularity=timedelta(hours=1),
    start_time=datetime(2021, 5, 31),
    end_time=datetime(2021, 8, 30),
)
ts_values = timeseries.generate(ts_index)Plot or write to csvfrommockseries.utilsimportplot_timeseries,write_csvprint(ts_index,ts_values)plot_timeseries(ts_index,ts_values,save_path="hello_mockseries.png")write_csv(ts_index,ts_values,"hello_mockseries.csv")ReferencesJ. R. Maat, A. Malali, and P. Protopapas, “TimeSynth: A Multipurpose Library for Synthetic Time Series in Python,” 2017. [Online]. Available:http://github.com/TimeSynth/TimeSynth.TStimulus. Available:https://github.com/cetic/TSimulus.
Package: mock-server
Mock serverSimple mock server for REST and XML-RPC APIIt can mock GET, POST, PUT, PATCH, DELETE and some more rarely used HTTP methods.Build status atTravis CI:DEMOhttp://demo.mockapi.org/__manageInstallationInstall with pip:$ pip install mock-serverOr install with easy_install:$ easy_install mock-serverAnd after run:$ mock-server --dir=/path/to/apiIt will be listening on port 8888 and wait for your HTTP requests.OverviewFor create mock for url path go to:http://localhost:8888/__manage/createMocked GET /user/tom:$ curl -v -X GET http://demo.mockapi.org/user/tom

> GET /user/tom HTTP/1.1
> Host: demo.mockapi.org
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Content-Length: 64
< Server: TornadoServer/2.4.1
<
{
    "name": "Tom",
    "surname": "Smith",
    "age": 22
}FeaturesMocking REST API.Mocking RPC API (xml, json).Upstream server proxy (proxy an existing api).Variables in url path.Simple api documentation (markdown).Api authentication (HTTP Basic authentication).Release new versionhttps://packaging.python.org/tutorials/packaging-projects/Formatresponse content format:%METHOD%_%STATUS%.%FORMAT%response headers format:%METHOD%_H_%STATUS%.%FORMAT%root_dir/
    GET_200.json         # response content for GET /
    GET_H_200.json       # headers for GET /
    user/
        DELETE_404.xml   # response content for DELETE /user.xml?__statusCode=404
        POST_200.json    # response content for POST /user
        POST_H_200.json  # headers for POST /userBug reportIf you have any trouble, report bug at GitHub Issuehttps://github.com/tomashanacek/mock-server/issuesContributorsWilliam ZhangHistory0.3.9fix unicode 500 errorfix grammar when API does not existMany thanks to @bopo and @krmaxwell0.3.8fix http util when returning HTTPHeaders instancefix Tornado versionPython 2.7 and 3.4 compatibilityMany thanks to @eduardosan and @winkidney0.3.7support for custom response provider0.3.6support for non-standard status codes0.3.5added num_processes command line option for possibility to start multiple worker processes0.3.4edit rpc method fix0.3.3create resource quotation character fix0.3.2todo escaping fix0.3.1support for todos in api documentationaccess log improvements0.3upstream server proxy (proxy an existing api)variables in url pathsimple api documentation (markdown)api authentication (HTTP Basic authentication)manage interface improvementsNo notes on earlier releases.
Package: mocksey
mockseyStupidly-simple python mocking utility with moxie.Mocksey MotivationI was teaching a class on unit testing to a group of co-workers who were familiar withSimple Test for PHPso I hacked together what is becoming Mocksey.Mocksey the TDD’d version of that TDD utilty.It’s so meta even this acronym.InstallationEither find mocksey onPyPIor install it with pip or easy_installpip install mocksey
#or
easy_install mockseyBasic UsageIt’s pretty simple.  Create a mocked object with generate_mock, inject it (or monkey patch) and set up your assertions.  After your function call(s), simply call ‘run_asserts’ and win!The unit tests are a pretty decent working example.TweakseyTweaksey is a collection of beautification wrappers.  Currently there’s only one aroundmock, but there may be more in the future.  It’ll look best if you also havenoseinstalled, and may only be worth it in that case, actually.  Anyhow, to use it simply import tweaksey from mocksey and get your copy of the mock package fromtweaksey.tweak_mock.  Your mock assertions should now have a touch more friendliness.  If there are more you’d like to add, go for it!  Michael Foord, if you want to take the output and run, that cool too (conversely, if you don’t like that I did this, I’ll kill it square dead).Changelog0.3.1Mocksey now sets nose to full diff mode.0.3.0Tweaksey now requires you to pass in the ‘mock’ library that you’re
tweaking.  This allows one to apply mocks to python3’sunittest.mock.LicenseThis software is hereby released under the MIT License, as seen in the LICENSE file
Package: mocksftp
mocksftp - Easily test your sftp client codeIn-process SFTP server for testing your SFTP related client code.Usage exampleFor pytest, use thesftp_serverandsftp_clientfixtures:fromcontextlibimportclosingimportpy.pathdeftest_open_file(sftp_server,sftp_client):# Write directly in the server root.root_path=py.path.local(sftp_server.root)root_path.join('file.txt').write('content')# Access the folder via the clientsftp=sftp_client.open_sftp()assertsftp.listdir('.')==['file.txt']withclosing(sftp.open('file.txt','r'))asdata:assertdata.read()==b'content'HistoryThis project was started as a fork ofhttps://github.com/carletes/mock-ssh-servercreated by Carlos Valiente.The SSH related code was removed to focus solely on the SFTP protocol.Alternativeshttps://github.com/ulope/pytest-sftpserverhttps://github.com/rspivak/sftpserver
Package: mocksign
MockSignSimulate the look of hand-signed and scanned documents. MockSign is a simple tool to help you shortcut the tedious process of printing, hand-signing and scanning documents.InstallationUse pip to install MockSign withpipinstallmocksignUsageBefore using MockSign, a collection of real signature images is needed. This can be
achieved by scanning and cropping signatures using an image editing program likeGimpand saving them into a designated folder.Afterwards, MockSign can be started withmocksign.License & AttributionMockSign is licensed under theMITlicense and draws inspiration fromFalsiSignby Edouard Klein.
Package: mockspace
mockspaceAboutmockspaceis a tool that provides a convenient interface for quickly creating a mock environment:
add web-services, fill them with the methods you need and configure response parameters.InstallationTo install mockspace, run this command in your terminal:pipinstallmockspaceLaunchingTo start mockspace, run the following command:mockspaceand go tohttp://localhost:8080.UsageAdd the necessary web-servicesFill a web-services with methods you needConfigure response parametersLicenseMIT
Package: mock-ssh-server
mock-ssh-serverpacks a Python context manager that implements an SSH
server for testing purposes. It is built on top ofparamiko, so it does
not need OpenSSH binaries to be installed.Sample usageAs apy.testfixture:import os

from pytest import yield_fixture

import mockssh


@yield_fixture()
def server():
    users = {
        "sample-user": "/path/to/user-private-key",
    }
    with mockssh.Server(users) as s:
        yield s


def test_ssh_session(server):
    for uid in server.users:
        with server.client(uid) as c:
            _, stdout, _ = c.exec_command("ls /")
            assert stdout.read()

def test_sftp_session(server):
    for uid in server.users:
        target_dir = tempfile.mkdtemp()
        target_fname = os.path.join(target_dir, "foo")
        assert not os.access(target_fname, os.F_OK)

        with server.client(uid) as c:
            sftp = c.open_sftp()
            sftp.put(__file__, target_fname, confirm=True)
            assert os.access(target_fname, os.F_OK)
Package: mocktail
MocktailThe non-alcoholic, Mockito-inspired utility forunittest.mock!This package provides dead-simple utilities for setting return values for mocks
with a Mockito-inspired syntax:fromunittest.mockimportMagicMockfrommocktailimportwhenmy_mock=MagicMock()when(my_mock).some_method('foo').then_return('bar')my_mock.some_method('foo')# 'bar'Unlike other solutions (likemockito-python),
it deliberately only works with mocks created usingunittest.mock. To set the return
values of arbitrary objects, combine withunittest.mock.patch.Installationpip install mocktailBuyer beware!This package -- though very minimal -- is in early alpha stage. Use with your own
risk!ContributingPull requests and bug reports are gladly accepted in this Github repository.LicenseMITTODO(More) matchersMatcher for "rest of args / kwargs"verifysyntaxDocsSome way to make "missed" matches more explicit, ie. raising an error
e.g.when(...).foo(...).then_return(...).raise_missing()orwhen(..., raise_missing=True).foo(...).then_return(...)Refactor the logic when hooking multiplethen_returnsfor call proxies.
Currently, it should work because existingside_effectis called, but it's a bit hairyThe matcher interface could be removed and instead we could just overwrite__eq__for matchers
Package: mocktest
… is a powerful and easy-to-use mocking library, inspired by rspec and
similar in some ways to Michael Foord’s popular Mock module.Source / Issues:http://github.com/gfxmonk/mocktest/tree/masterZero install feed:http://gfxmonk.net/dist/0install/mocktest.xml(this is the preferred distribution method)Cheese shop entry:http://pypi.python.org/pypi/mocktestDocumentation / InstallationPlease see the full documentation online at:http://gfxmonk.net/dist/doc/mocktest/doc/
Package: mocktime
mocktime通过对time.time()和datetime.now()的修改，实现模拟时间功能。可用于历史事件回测，或未来事件调试。项目起源本项目来自于使用定时任务调度框架实现程序化交易回测的一个设想策略一般由行情事件驱动，但在开盘前和收盘后无行情，只能靠定时任务来驱动。如：before_trading,after_tradingK线行情事件本质上可认为也是固定频率的定时任务。如：on_bar定时任务框架一般只能用于实盘，因为它的时间机制是基于操作系统，而回测的时间是基于历史数据框架中大量的使用到datetime.now(), 它无法根据历史进行修改，而本项目就是为了打破这个限制而做的尝试最先支持了apscheduler，之后支持了日志库logging和loguru编写了schedule的示例后，想到可能还有其它调度库需要模拟时间后来还想到模拟时间功能可以快速的检测任务规则是否编写正确，很有必要独立成一个项目原理time.time()打补丁，使其可以修改成任意时间，这样其它模块就可以取到历史时间datetime.now()中使用了time.time()，替换它成历史时间每个任务执行完后更新time.time()为下次任务的触发时间安装pipinstallmocktime-U示例importtimefromdatetimeimportdatetimeimportmocktimeif__name__=='__main__':mocktime.configure(mock=True,tick=False)print('真实时间:',mocktime.now(),mocktime.time())print('默认模拟时间，带时区:',datetime.now(),time.time())mocktime.configure(mock=False,tick=False)print('还原成真实时间:',datetime.now(),time.time())mocktime.configure(mock=True,tick=False)mocktime.time_update(datetime(2023,1,2,3,4,5))print('更新模拟时间:',datetime.now())mocktime.time_add(5.1)print('模拟时间+5.1s:',datetime.now())mocktime.configure(mock=True,tick=True)time.sleep(5)print('开启时间流逝，等5s，时间更新:',datetime.now())mocktime.configure(mock=True,tick=False)time.sleep(5)print('关闭时间流逝，等5s，时间不变:',datetime.now())mocktime.configure(mock=True,tick=True)print('开启时间流逝后再更新时间:',datetime.now())mocktime.time_update(datetime(2023,1,2,3,4,5))time.sleep(5)print('从新设置的时间开始流逝:',datetime.now())输出如下真实时间: 2023-11-24 15:37:16.168329 1700811436.1683288
默认模拟时间，带时区: 1970-01-01 08:00:00 0.0
还原成真实时间: 2023-11-24 15:37:16.168329 1700811436.1683288
更新模拟时间: 2023-01-02 03:04:05
模拟时间+5.1s: 2023-01-02 03:04:10.100000
开启时间流逝，等5s，时间更新: 2023-01-02 03:04:15.106348
关闭时间流逝，等5s，时间不变: 2023-01-02 03:04:15.106348
开启时间流逝后再更新时间: 2023-01-02 03:04:15.106348
从新设置的时间开始流逝: 2023-01-02 03:04:10.010793调度任务示例apschedulerexamples/apscheduler/demo.py导入mocktime后，设置好过去的开始与结束时间，但任务并没有继续执行。因为模拟时间是固定不变的需继承BlockingScheduler，在每批次的任务执行完后立即更新时间mocktime.time_addscheduleexamples/schedule/demo.py同样遇到需更新模拟时间问题在循环中取get_next_run，然后更新时间mocktime.time_updatedagsterexamples/dagster/usercustomize.py难点在于mocktime需要跨进程,通过mocktime.multiprocess实现由于跨进程通讯复杂，所以只实现了tick=True的功能模拟时间三种运行模式真实时间模式。当前真实时间开始、正常速度执行。可以不需mocktime参与mocktime.configure(mock=False, tick=False)加速模拟模式。任意时间开始(历史和未来都可以)，加速执行。需mocktime修改时间，还需在任务循环中更新mocktime.time_update。一般用于历史回测mocktime.configure(mock=True, tick=False)时间流逝模式。任意时间开始(历史和未来都可以)，正常速度执行。仅需mocktime修改时间。一般用于任务触发测试，可免于修改操作系统时间mocktime.configure(mock=True, tick=True)不存在的模式。时间流逝，但又不是模拟模式，不就是真实时间吗？！mocktime.configure(mock=False, tick=True) # 当tick=True时，强行mock=True跨进程模式。只是时间流逝模式configure(mock=True, tick=True)的一种应用场景mocktime.multiprocess(r'd:\a.pkl', datetime(2022, 1, 1).timestamp())参考资料1.《深度剖析CPython解释器》34.
侵入Python虚拟机，动态修改底层数据结构和运行时 -https://www.cnblogs.com/traditional/p/15489296.html
Package: mockup
Plone Mockup is an ongoing effort to modernize Plone’s javascript story. Check out examples and documentation athttp://plone.github.io/mockup/The Goals of MockupStandardize configuration of patterns implemented in js
to use HTML data attributes, so they can be developed
without running a backend server.Use modern AMD approach to declaring dependencies on other js libs.Full unit testing of jsInstall & Run TestsInstall Node version 0.10 or greaterInstall using package manager, e.g. apt or yumInstall without using package managerInstall PhantomJSDownload and install PhantomJSMaybe use your package manager:$ apt-get install phantomjsNow git clone & build Mockup:$ git clone https://github.com/plone/mockup.git
$ cd mockup
$ make bootstrapRun tests with PhantomJS:$ make testRun tests with Chrome:$ make test-devGenerate widgets.pot file in the working directory for Plone translations:$ make i18n-dumpIf you are currently in the buildout.coredev/src/mockup folder and want to update
the translations in plone.app.locales, first go back in the buildout.coredev
folder, copy widgets.pot in the plone.app.locales package and resync the po files like
this:$ cd ../..
$ cp src/mockup/widgets.pot src/plone.app.locales/plone/app/locales/locales/widgets.pot
$ bin/buildout -c experimental/i18n.cfg  # to have the bin/i18n command
$ bin/i18n widgetsIf you did some changes in the js files and want to test them live in Plone:go to Site Setup -> Resource Registriesclick on the “Development Mode (only logged in users)” checkboxclick on the “Develop Javascript” button for the plone-editor-tools bundle
(for folder contents changes, may be another bundle for an other pattern)click the “Save” buttonrefresh your page (folder contents for example)To have the js changes in the next Plone release, you need to build the
bundles, seeREADME of plone.staticresourcesYou may be interested readingJavaScript For Plone DevelopersandResource Registrydocumentation too.To test a translation, for example French:edit the po file src/plone.app.locales/plone/app/locales/locales/fr/LC_MESSAGES/widgets.porestart your instance to rebuild the mo file from the po filepurge your localStorage and refresh the page to trigger a new download of the translationsThe translations are handled by mockup/js/i18n.js that calls the plonejsi18n view defined
in plone.app.content to generate a json of the translations from the mo file.
The plonejsi18n view is called one time for a given domain and language and the result
is cached in localStorage for 24 hours.
The only way to test the new translations is to restart the instance to update the mo file
from the po file, and then to purge the localStorage to trigger a new download of the translations.LicenseThe BSD 3-Clause License. Copyrights hold the Plone Foundation.
SeeLICENSE.rstfor details.CreditsOriginally created byRok Garbasusing parts ofPatterns
library. Now maintained by thePlone Foundation.Status of builds
Package: mockupgen
mockupgenA tool that generates a 3D device mockup from a screenshot.Installationpip install mockupgenAlternatively, from source:git clone https://github.com/rmenon1008/mockupgen.git
cd mockupgen
pip install .Usagemockupgen [OPTION...] screenshot_file

OPTION:
  -t TEMPLATE                  template name or number
  -o OUTFILE                   output file name (use extension to specify format)
  -w WIDTH                     output width (will upscale if requested)
  --crop                       crop instead of stretching the screenshot to fit the mockup
  --rotate                     number of times to rotate the screenshot 90 degrees ccw
  --brightness B               screen brightness adjustment (default: 1.0)
  --contrast C                 screen contrast adjustment (default: 1.0)
  --list                       list available templates
  --custom-templates PATH/URL  specify a custom directory of templates (see README.md)TemplatesThemockupgen-templatesrepository contains the default templates used bymockupgen. They are all based on mockups created byAnthony Boyd. You can see the available templates withmockupgen --list.Custom templatesInstead of using the default templates, you can supply your own by specifying--custom-template-dir. The directory or URL should contain an index.json file with the following format:// index.json
// Note: All paths are relative to this file

{
    "index_version": 1.0,                  // Version of the template index
    "templates": [
        {
            // Required fields
            "name": "Macbook Pro 16 Silver (Green Background)",
            "slug": "mbp-16-silver-green", // Try to follow device-size-color-background format
            "base_file": "base.png",       // The device template image
            "screen_points": [             // The pixel locations of the 4 corners of the screen
                [896, 224],                // Starts in the top left and goes counter clockwise
                [896, 654],
                [1471, 985],
                [1471, 555]
            ],

            // Only one of the two options below must be specified
            "mask_file": "mask.png",  // An image used to mask the screenshot (alpha channel used)
            // OR
            "mask_aspect_ratio": 1.0, // Aspect ratio to mask the screenshot (assumes rectangular)

            // Optional fields
            "black_white_point": ["292826", "D9DCDD"], // Black and white points
                                                       // for color correction
            "brightness": 1.0,        // Brightness adjustment of the screenshot
            "contrast": 1.0           // Contrast adjustment of the screenshot
        },
        ...
    ]
}AboutMockups typically require expensive and slow image processing tools to create. While these can create very realistic mockups, they're very manual and usually overkill for the blog post thumbnail I'm trying to create.The tool uses opencv to mask, warp and composite screenshots onto a template. Right now, it doesn't do any lighting or shadow effects.
Package: mockup-highlightjs
Highlightjs for Plone 5.============================This addon integrates https://highlightjs.org/ via https://github.com/pcdummy/pat-highlightjs into Plone 5.Patternslib searches for pre tags and calls https://github.com/pcdummy/pat-highlightjs/blob/master/src/pat-highlightjs.js#L46 on it.Usage=====mockup-highlightjs has 3 profiles:- **default**: Means register js/css and a extra bundle + download for highlightjs.- **registerjs**: Just register js/css and include somewhere else.- **uninstall**: Uninstall both of the above.registerjs Usage:Add to **YourAddon.site/profiles/default/metadata.xml**::<?xml version="1.0"?><metadata><version>1000</version><dependencies><dependency>profile-mockup-highlightjs:registerjs</dependency></dependencies></metadata>Add to **YourAddon.theme/profiles/default/registry.xml**::<!-- bundle definition --><records prefix="plone.bundles/youraddon-bundle"interface='Products.CMFPlone.interfaces.IBundleRegistry'><value key="resources"><element>mockup-bundles-highlightjs</element><element>mockup-styles-highlightjs-monokai-sublime</element></value><value key="enabled">True</value><value key="compile">True</value><value key="jscompilation">++theme++youraddon/js/bundle-compiled.js</value><value key="csscompilation">++theme++youraddon/css/persona-compiled.css</value><value key="last_compilation">2016-01-31 00:00:00</value></records>Bootstrap the JS environment for pattern development----------------------------------------------------Make sure, you have `GNU make`, `node` and `git` installed.Then::$ git clone https://github.com/collective/mockup-highlightjs.git$ cd mockup-highlightjs$ make bootstrapThen::$ python -m SimpleHTTPServer$ chrome http://localhost:8000Run the tests.In watch mode::$ make test pattern=pattern-highlightjsOnly once::$ make test-once pattern=pattern-highlightjsIn Google Chrome browser::$ make test-dev pattern=pattern-highlightjsGenerate **registerjs entries** for all the available styles::$ src/mockup-highlightjs/scripts/echo_less_resources.sh$ src/mockup-highlightjs/scripts/echo_less_resources-remove.shBootstrap Plone for testing the Plone integration----------------------------------------------------Just use the provided ``make`` target commands (see ``Makefile``, for what theyare doing)... note::The make targets to bootstrap Plone erase the ``var`` directory! You willloose any changes made to your Plone database.$ make ploneContribute----------- Issue Tracker: https://github.com/collective/mockup-highlightjs/issues- Source Code: https://github.com/collective/mockup-highlightjsSupport-------If you are having issues, please let me know.License-------The project is licensed under the BSD license.Changelog=========1.0.0-alpha.2 (2016-04-04)--------------------------- Fix make bootstrap by:- adding resolutions to bower.json.- Use http://semver.org/ for versioning.[pcdummy]1.0a1 (2016-02-14)------------------- Initial release.[pcdummy]
Package: mockwalkers
MockWalkersDesciptionA walkers dynamic simulation library.This project originated as our final project during the 9th Workshop on Collaborative Scientific Software Development and Management of Open Source Scientific Packages, held at the International Centre for Theoretical Physics (ICTP) in the picturesque city of Trieste, Italy.Installationpip install mockwalkersAuthorsDavid, Jimoh, Matias and AlouetteLicenseSee LICENCE file
Package: mockwebserver
Mock Web ServerA simple web server for unit testing purposes. Acts as context manager for teardown.How to developpip install -r requirements.txtHow to usefrom mockwebserver import MockWebServer()
import requests

def test_requests_get():
    with MockWebServer() as server:
        url = server.set('/path/to/page', "page content")
        response = requests.get(url)
        assert response.ok
        assert response.text = "page content"How to distributeIf you need to publish a new version of this package you can use this command:$makebuild
$makedistLicenseLicensed underMIT license. Viewlicense.