Socket
Socket
Sign inDemoInstall

pyctx

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pyctx

Context package to use data between function calls, use timers and log it.


Maintainers
1

Readme

CTX

pipeline status coverage report

Context package to use data between function calls, use timers and log it.

For example you want have some decision point in your code::

from pyctx.context import Context
ctx = Context('APP')
x = 100
y = (x + 1) * (x - 1)
ctx.log.set_data('isEven', y % 2)
ctx.log.set_data('y', y)
ctx.log.start_timer('timer1')
import time
time.sleep(1)
ctx.log.stop_timer('timer1')
with ctx.log.timeit('timer2_context_manager'):
    time.sleep(5)

ctx.finalize()
# {'type': 'APP', 'ctxId': '0fdecfe0-067e-4bdd-9920-3b7ed46d8a98', 'startTime': '2019-08-06 09:42:31.222184', 'endTime': '2019-08-06 09:42:37.236861', 'data': {'isEven': 1, 'y': 9999}, 'timers': {'timer1': 1.00633, 'timer2_context_manager': 5.002412}}

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc