Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 22 for some_file (0.25 sec)

  1. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    ```Python
    with open("./somefile.txt") as f:
        contents = f.read()
        print(contents)
    ```
    
    Underneath, the `open("./somefile.txt")` creates an object that is called a "Context Manager".
    
    When the `with` block finishes, it makes sure to close the file, even if there were exceptions.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  2. internal/ioutil/ioutil_test.go

    	if err != nil {
    		t.Fatalf("Error Stat(): %v", err)
    	}
    	if !SameFile(fi1, fi2) {
    		t.Fatal("Expected the files to be same")
    	}
    	if err = os.WriteFile(tmpFile, []byte("aaa"), 0o644); err != nil {
    		t.Fatal(err)
    	}
    	fi2, err = os.Stat(tmpFile)
    	if err != nil {
    		t.Fatalf("Error Stat(): %v", err)
    	}
    	if SameFile(fi1, fi2) {
    		t.Fatal("Expected the files not to be same")
    	}
    }
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Feb 02 11:02:31 GMT 2024
    - 5.1K bytes
    - Viewed (0)
  3. internal/ioutil/ioutil.go

    	bufp := copyBufPool.Get().(*[]byte)
    	buf := *bufp
    	defer copyBufPool.Put(bufp)
    
    	return io.CopyBuffer(dst, src, buf)
    }
    
    // SameFile returns if the files are same.
    func SameFile(fi1, fi2 os.FileInfo) bool {
    	if !os.SameFile(fi1, fi2) {
    		return false
    	}
    	if !fi1.ModTime().Equal(fi2.ModTime()) {
    		return false
    	}
    	if fi1.Mode() != fi2.Mode() {
    		return false
    	}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 19 11:26:59 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  4. docs/zh/docs/tutorial/dependencies/dependencies-with-yield.md

    例如,<a href="https://docs.python.org/zh-cn/3/tutorial/inputoutput.html#reading-and-writing-files" class="external-link" target="_blank">您可以使用`with`读取文件</a>:
    
    ```Python
    with open("./somefile.txt") as f:
        contents = f.read()
        print(contents)
    ```
    
    在底层,`open("./somefile.txt")`创建了一个被称为“上下文管理器”的对象。
    
    当`with`块结束时,它会确保关闭文件,即使发生了异常也是如此。
    
    当你使用`yield`创建一个依赖项时,**FastAPI**会在内部将其转换为上下文管理器,并与其他相关工具结合使用。
    
    ### 在依赖项中使用带有`yield`的上下文管理器
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  5. src/cmd/addr2line/addr2line_test.go

    	// Debug paths are stored slash-separated, so convert to system-native.
    	srcPath = filepath.FromSlash(srcPath)
    	fi2, err := os.Stat(srcPath)
    
    	if err != nil {
    		t.Fatalf("Stat failed: %v", err)
    	}
    	if !os.SameFile(fi1, fi2) {
    		t.Fatalf("addr2line_test.go and %s are not same file", srcPath)
    	}
    	if want := "124"; srcLineNo != want {
    		t.Fatalf("line number = %v; want %s", srcLineNo, want)
    	}
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Feb 21 22:16:54 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/dependencies/dependencies-with-yield.md

    ```Python
    with open("./somefile.txt") as f:
        contents = f.read()
        print(contents)
    ```
    
    Im Hintergrund erstellt das `open("./somefile.txt")` ein Objekt, das als „Kontextmanager“ bezeichnet wird.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:10:29 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  7. docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md

    ```Python
    with open("./somefile.txt") as f:
        contents = f.read()
        print(contents)
    ```
    
    その後の`open("./somefile.txt")`は「コンテキストマネージャ」と呼ばれるオブジェクトを作成します。
    
    `with`ブロックが終了すると、例外があったとしてもファイルを確かに閉じます。
    
    `yield`を依存関係を作成すると、**FastAPI** は内部的にそれをコンテキストマネージャに変換し、他の関連ツールと組み合わせます。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  8. api/except.txt

    pkg os, func Lstat(string) (FileInfo, error)
    pkg os, func Mkdir(string, FileMode) error
    pkg os, func MkdirAll(string, FileMode) error
    pkg os, func OpenFile(string, int, FileMode) (*File, error)
    pkg os, func SameFile(FileInfo, FileInfo) bool
    pkg os, func Stat(string) (FileInfo, error)
    pkg os, method (*File) Chmod(FileMode) error
    pkg os, method (*File) Readdir(int) ([]FileInfo, error)
    pkg os, method (*File) Stat() (FileInfo, error)
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Thu May 25 00:13:30 GMT 2023
    - 34.6K bytes
    - Viewed (0)
  9. api/go1.4.txt

    pkg syscall (windows-amd64), type ProcessEntry32 struct, Threads uint32
    pkg syscall (windows-amd64), type ProcessEntry32 struct, Usage uint32
    
    # CL 127740043 os: make SameFile handle paths like c:a.txt properly, Alex Brainman <******@****.***>
    pkg syscall (windows-386), func FullPath(string) (string, error)
    pkg syscall (windows-amd64), func FullPath(string) (string, error)
    
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Fri Dec 12 03:01:01 GMT 2014
    - 34K bytes
    - Viewed (0)
  10. cmd/xl-storage.go

    		s.RUnlock()
    		return diskID, nil
    	}
    	s.RUnlock()
    
    	fi, err := s.checkFormatJSON()
    	if err != nil {
    		return "", err
    	}
    
    	if xioutil.SameFile(fi, fileInfo) && diskID != "" {
    		s.Lock()
    		// If the file has not changed, just return the cached diskID information.
    		s.formatLastCheck = time.Now()
    		s.Unlock()
    		return diskID, nil
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 84.7K bytes
    - Viewed (0)
Back to top