Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
1 answer
103 views

This is the code @router.post("/tel/verify-otp", summary="Verify OTP and update user tel number" ) async def verify_tel_otp( command: ...
0 votes
1 answer
118 views

What is the actual practical advantage of using a scoped_session vs a normal session when using a contextmanager to handle opening and closing of the session at the appropriate times? In the following ...
1 vote
1 answer
104 views

Why when using separate with, the 2nd executor is blocked until all tasks from 1st executor is done when using a single compound with, the 2nd executor can proceed while the 1st executor is still ...
0 votes
0 answers
88 views

I'm really looking for best practices here, or something I've not thought of. I have scripts which loop through multiple tables (potentially hundreds) in Snowflake within Snowflake, and do some form ...
0 votes
1 answer
88 views

Considering the following class and object: class foo: def __init__(self,name): self.name = name def print_name(self): print(self.name) object1 = foo('...
2 votes
1 answer
274 views

I am having a hard time to write clean code with context managers in Python without getting in a context manager hell. Imagine something like: class A: def __init__(self): self.b = B() # ...
Leon0402's user avatar
  • 308
1 vote
1 answer
74 views

I have a context manager that temporarily backs up a directory and restores it upon exit. Here's the implementation: import shutil import tempfile from pathlib import Path from contextlib import ...
1 vote
2 answers
670 views

I use an object that needs a startup and a teardown process (load from/save to cache, for example) in a FastAPI endpoints. I used a asynccontextmanager to manage the context of an object, but I also ...
1 vote
1 answer
139 views

I'm writing tests for a python fastApi applciation, however, the issue is not directly related to fastAPI itself. I have a block of code that doesn't seem to be mocked properly, and the offending code ...
0 votes
1 answer
837 views

It is well possible to experiment with the problem of a dynamic widget on tables: import dearpygui.dearpygui as dpg from typing_extensions import Union, Optional, Any # * Local Imports import database ...
3 votes
3 answers
236 views

I am trying to implement the following logic in Python3: # Clarification: # function f() is the only function that would acquire both locks # It is protected by other locks so f() itself has no ...
0 votes
0 answers
87 views

I have a class called Series, which inherits from a base class called Fred. Series has a number of methods, which retrieve data from different API end points and process that data into properties of ...
0 votes
1 answer
64 views

I have created a database fixture @pytest.fixture def mock_db(mocker): """Fixture for setting up a mock database connection.""" mock_cursor = mocker.MagicMock() ...
0 votes
1 answer
102 views

I am running code in parallel using mpi4py. I've noticed that if I run the code and perform a keyboard interrupt, my context manager __exit__ will run if I run the code as python file.py but will not ...
jared's user avatar
  • 9,583
-2 votes
1 answer
154 views

I asked a question earlier today, Is it important to call close() on an file opened with open() if flush() is called after each write() operation? I asked this question while thinking about data loss, ...

15 30 50 per page
1
2 3 4 5
...
43

AltStyle によって変換されたページ (->オリジナル) /