StackOverflow Questions for Tag: contextmanager

Julian
Julian

Reputation: 4800

How do I write a null (no-op) contextmanager in Python?

Score: 117

Views: 32972

Answers: 7

Read More
Sahand
Sahand

Reputation: 2175

Handling instances of a context manager inside another context manager

Score: 47

Views: 13871

Answers: 4

Read More
olamundo
olamundo

Reputation: 24991

Create a "with" block on several context managers?

Score: 352

Views: 162766

Answers: 4

Read More
mara004
mara004

Reputation: 2349

Shorter way to define contextmanager by decorator?

Score: 0

Views: 120

Answers: 2

Read More
Kumar Gaurav
Kumar Gaurav

Reputation: 21

Testing async context manager fixture in pytest yields unexpected async generator object

Score: 2

Views: 344

Answers: 1

Read More
Miguel
Miguel

Reputation: 9

How to temporarily change a class object?

Score: 0

Views: 48

Answers: 1

Read More
Leon0402
Leon0402

Reputation: 298

Context managers as attributes

Score: 1

Views: 82

Answers: 0

Read More
HISI
HISI

Reputation: 4797

One-line syntax to read and return file on Python using with

Score: -2

Views: 610

Answers: 2

Read More
Michiel Karrenbelt
Michiel Karrenbelt

Reputation: 143

Python context manager that backs up and restores `cwd` leaves terminal in erroneous state

Score: 1

Views: 55

Answers: 1

Read More
Cobalt Rimbo
Cobalt Rimbo

Reputation: 13

How to extend the lifespan of an object under asynccontextmanager into a background task in FastAPI?

Score: 1

Views: 286

Answers: 2

Read More
Carl Thomé
Carl Thomé

Reputation: 2742

Use context manager in lambda, how?

Score: 7

Views: 2297

Answers: 3

Read More
Recursing
Recursing

Reputation: 648

Async Context Manager that performs an action on context switch

Score: 2

Views: 877

Answers: 2

Read More
Chris Rutherford
Chris Rutherford

Reputation: 1

How can I mock multiple context managers and function calls with pytest in async contexts?

Score: 0

Views: 23

Answers: 0

Read More
user444997
user444997

Reputation: 323

Understanding the Python with statement and context managers

Score: 32

Views: 18481

Answers: 6

Read More
JamesThomasMoon
JamesThomasMoon

Reputation: 7164

logger.exception during context-manager __exit__

Score: -2

Views: 38

Answers: 2

Read More
Romanin
Romanin

Reputation: 11

How to make dynamic widgets in DearPyGUI?

Score: 0

Views: 330

Answers: 1

Read More
Callum
Callum

Reputation: 321

Using a context manager with mysql connector python

Score: 9

Views: 9653

Answers: 3

Read More
Danny Staple
Danny Staple

Reputation: 7332

In python, is there a good idiom for using context managers in setup/teardown

Score: 75

Views: 20211

Answers: 6

Read More
Yuxuan Zhang
Yuxuan Zhang

Reputation: 43

Dealing with interlacing lock in Python3

Score: 3

Views: 222

Answers: 3

Read More
nonbot
nonbot

Reputation: 983

Context Managers as a class vs. function?

Score: 7

Views: 6421

Answers: 3

Read More
PreviousPage 1Next