Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 863 for _state (0.29 sec)

  1. docs_src/sql_databases_peewee/sql_app/database.py

    from contextvars import ContextVar
    
    import peewee
    
    DATABASE_NAME = "test.db"
    db_state_default = {"closed": None, "conn": None, "ctx": None, "transactions": None}
    db_state = ContextVar("db_state", default=db_state_default.copy())
    
    
    class PeeweeConnectionState(peewee._ConnectionState):
        def __init__(self, **kwargs):
            super().__setattr__("_state", db_state)
            super().__init__(**kwargs)
    
        def __setattr__(self, name, value):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 662 bytes
    - Viewed (0)
  2. tests/test_dependency_contextvars.py

    legacy_request_state_context_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar(
        "legacy_request_state_context_var", default=None
    )
    
    app = FastAPI()
    
    
    async def set_up_request_state_dependency():
        request_state = {"user": "deadpond"}
        contextvar_token = legacy_request_state_context_var.set(request_state)
        yield request_state
        legacy_request_state_context_var.reset(contextvar_token)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  3. tests/test_dependency_contextmanager.py

    class OtherDependencyError(Exception):
        pass
    
    
    async def asyncgen_state(state: Dict[str, str] = Depends(get_state)):
        state["/async"] = "asyncgen started"
        yield state["/async"]
        state["/async"] = "asyncgen completed"
    
    
    def generator_state(state: Dict[str, str] = Depends(get_state)):
        state["/sync"] = "generator started"
        yield state["/sync"]
        state["/sync"] = "generator completed"
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  4. tests/test_dependency_normal_exceptions.py

        return {"message": "OK"}
    
    
    @pytest.fixture(autouse=True)
    def reset_state_and_db():
        global fake_database
        global state
        fake_database = initial_fake_database.copy()
        state = initial_state.copy()
    
    
    client = TestClient(app)
    
    
    def test_dependency_gets_exception():
        assert state["except"] is False
        assert state["finally"] is False
        response = client.put("/invalid-user/rick", json="Morty")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  5. docs/em/docs/how-to/sql-databases-peewee.md

    ```Python
    # db._state = PeeweeConnectionState()
    ```
    
    & ๐Ÿ“ `sql_app/main.py` ๐Ÿ“, ๐Ÿค ๐Ÿ’ช `async` ๐Ÿ”— `reset_db_state()` & โŽ โšซ๏ธ โฎ๏ธ `pass`:
    
    ```Python
    async def reset_db_state():
    #     database.db._state._state.set(db_state_default.copy())
    #     database.db._state.reset()
        pass
    ```
    
    โคด๏ธ ๐Ÿƒ ๐Ÿ‘† ๐Ÿ“ฑ โฎ๏ธ Uvicorn:
    
    <div class="termy">
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  6. src/main/java/jcifs/smb1/dcerpc/msrpc/netdfs.idl

    	const uint32_t DFS_STORAGE_STATE_OFFLINE = 0x0001;
    	const uint32_t DFS_STORAGE_STATE_ONLINE = 0x0002;
    	const uint32_t DFS_STORAGE_STATE_ACTIVE = 0x0004;
    
    	typedef struct {
    		[string] wchar_t *entry_path;
    	} DfsInfo1;
    
    	typedef struct {
    		uint32_t count;
    		[size_is(count)] DfsInfo1 *s;
    	} DfsEnumArray1;
    
    	typedef struct {
    		uint32_t state;
    		[string] wchar_t *server_name;
    Others
    - Registered: Sun Apr 28 00:10:09 GMT 2024
    - Last Modified: Fri Mar 22 20:39:42 GMT 2019
    - 1.7K bytes
    - Viewed (0)
  7. src/main/java/jcifs/dcerpc/msrpc/netdfs.idl

    	const uint32_t DFS_STORAGE_STATE_OFFLINE = 0x0001;
    	const uint32_t DFS_STORAGE_STATE_ONLINE = 0x0002;
    	const uint32_t DFS_STORAGE_STATE_ACTIVE = 0x0004;
    
    	typedef struct {
    		[string] wchar_t *entry_path;
    	} DfsInfo1;
    
    	typedef struct {
    		uint32_t count;
    		[size_is(count)] DfsInfo1 *s;
    	} DfsEnumArray1;
    
    	typedef struct {
    		uint32_t state;
    		[string] wchar_t *server_name;
    Others
    - Registered: Sun Apr 28 00:10:09 GMT 2024
    - Last Modified: Sun Jul 01 13:12:10 GMT 2018
    - 1.7K bytes
    - Viewed (0)
  8. docs_src/sql_databases_peewee/sql_app/main.py

    from .database import db_state_default
    
    database.db.connect()
    database.db.create_tables([models.User, models.Item])
    database.db.close()
    
    app = FastAPI()
    
    sleep_time = 10
    
    
    async def reset_db_state():
        database.db._state._state.set(db_state_default.copy())
        database.db._state.reset()
    
    
    def get_db(db_state=Depends(reset_db_state)):
        try:
            database.db.connect()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 2.2K bytes
    - Viewed (0)
  9. docs/en/docs/how-to/sql-databases-peewee.md

    ```Python
    # db._state = PeeweeConnectionState()
    ```
    
    And in the file `sql_app/main.py` file, comment the body of the `async` dependency `reset_db_state()` and replace it with a `pass`:
    
    ```Python
    async def reset_db_state():
    #     database.db._state._state.set(db_state_default.copy())
    #     database.db._state.reset()
        pass
    ```
    
    Then run your app with Uvicorn:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (0)
  10. tensorflow/c/eager/parallel_device/parallel_device_lib.cc

      while (true) {
        {
          tensorflow::mutex_lock l(execution_mutex_);
          while (execution_state_ == ExecutionState::kIdle ||
                 execution_state_ == ExecutionState::kHasResult) {
            start_execute_.wait(l);
          }
          if (execution_state_ == ExecutionState::kShuttingDown) {
            return;
          } else if (execution_state_ == ExecutionState::kReadyToExecute) {
            // op_outputs_ may have been std::moved
    C++
    - Registered: Tue Apr 30 12:39:09 GMT 2024
    - Last Modified: Fri Feb 09 07:47:20 GMT 2024
    - 25.4K bytes
    - Viewed (1)
Back to top