Skip to content

Add pathlib-based file existence utilities#5

Closed
Copilot wants to merge 17 commits intodev-qdpfrom
copilot/add-path-exists-functionality
Closed

Add pathlib-based file existence utilities#5
Copilot wants to merge 17 commits intodev-qdpfrom
copilot/add-path-exists-functionality

Conversation

Copy link

Copilot AI commented Jan 5, 2026

Adds Python-native file existence checking utilities using pathlib.Path.exists() as an alternative to platform-specific implementations.

Changes

  • qumat/file_utils.py: New module with two utilities:

    • path_exists(file_path): Returns boolean for file/directory existence
    • ensure_file_exists(file_path): Returns Path object or raises FileNotFoundError
    • Both accept string or Path inputs
  • qumat/__init__.py: Exports new utilities for direct import from qumat package

  • testing/test_file_utils.py: 10 test cases covering existence checks, type handling, and cross-platform paths

  • examples/file_utils_example.py: Usage demonstration

Usage

from qumat import path_exists, ensure_file_exists
from pathlib import Path

# Check existence
if path_exists("/path/to/file.txt"):
    process_file()

# Verify and get Path object
try:
    config_path = ensure_file_exists("config.yaml")
except FileNotFoundError:
    use_defaults()

# Works with Path objects
path_exists(Path.home() / "data.csv")
Original prompt

// Verify file exists
if !path.exists() {
Contributor
@rich7420
rich7420
yesterday
I think we could add this path.exists() in other format.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

guan404ming and others added 13 commits November 27, 2025 00:38
…pache#654)

* Add mypy for static type checking

Added mypy static type checking to pre-commit hooks.

* pre-commit hook: fix

Signed-off-by: ryankert01 <ryan980053@gmail.com>

* update version and clean-up strings

Signed-off-by: ryankert01 <ryan980053@gmail.com>

---------

Signed-off-by: ryankert01 <ryan980053@gmail.com>
* Implement T-gate (π/8 gate) across all backends

- Add apply_t_gate() method to QuMat class with validation
- Implement T-gate support in Qiskit, Cirq, and Amazon Braket backends
- Restore T-gate documentation in basic_gates.md to match implementation

Fixes apache#681

* Refine T-gate docs and add coverage

* chore: satisfy pre-commit hooks
* docs: add missing QuMat APIs

* clarify T-gate usage and parameter description

* alignment docs/api.md

Co-authored-by: 江家瑋 <36886416+JiangJiaWei1103@users.noreply.github.com>

---------

Co-authored-by: 江家瑋 <36886416+JiangJiaWei1103@users.noreply.github.com>
Fixes apache#707 

(Trying to find some simple issues to help with while hopefully finally finding time to toy with the code over Christmas.)
…d of None (apache#757)

* fix the bug

* Update documentation to reflect draw_circuit() returns value instead of printing
* Refactor circuit execution to use working_circuit

* precommit
Co-authored-by: Krishna Dave <krishnadave@Krishnas-MacBook-Pro-2.local>
@ryankert01 ryankert01 changed the base branch from main to dev-qdp January 5, 2026 01:58
@ryankert01
Copy link
Owner

@copilot we've change base branch to dev-qdp

Copilot AI and others added 4 commits January 5, 2026 02:00
…ests

Co-authored-by: ryankert01 <91534261+ryankert01@users.noreply.github.com>
Co-authored-by: ryankert01 <91534261+ryankert01@users.noreply.github.com>
Co-authored-by: ryankert01 <91534261+ryankert01@users.noreply.github.com>
Co-authored-by: ryankert01 <91534261+ryankert01@users.noreply.github.com>
Copilot AI changed the title [WIP] Add path.exists() functionality in different format Add pathlib-based file existence utilities Jan 5, 2026
Copilot AI requested a review from ryankert01 January 5, 2026 02:05
Copy link
Author

Copilot AI commented Jan 5, 2026

@copilot we've change base branch to dev-qdp

Acknowledged. The PR is now targeting dev-qdp and is mergeable with no conflicts.

@ryankert01 ryankert01 closed this Jan 5, 2026
@ryankert01 ryankert01 deleted the copilot/add-path-exists-functionality branch January 5, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants