Skip to content

Commit bd0a00f

Browse files
committed
fix type issues
1 parent 6c2acf3 commit bd0a00f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/humanloop/files/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def list_files(
118118
def retrieve_by_path(
119119
self,
120120
*,
121-
# @TODO: @ale, can this be None?
122-
path: str | None = None,
121+
path: str,
123122
environment: typing.Optional[str] = None,
124123
include_raw_file_content: typing.Optional[bool] = None,
125124
request_options: typing.Optional[RequestOptions] = None,

src/humanloop/overload.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _handle_tracing_context(kwargs: Dict[str, Any], client: Any) -> Dict[str, An
7575
if "trace_parent_id" in kwargs:
7676
logger.warning(
7777
"Ignoring trace_parent_id argument at line %d: the Flow decorator manages tracing.",
78-
inspect.currentframe().f_lineno, # type: ignore [union-attr]
78+
inspect.currentframe().f_lineno, # type: ignore[union-attr]
7979
)
8080
kwargs = {
8181
**kwargs,
@@ -120,7 +120,7 @@ def _handle_local_files(
120120
return kwargs
121121

122122
try:
123-
file_content = sync_client.get_file_content(normalized_path, file_type) # type: ignore [arg-type] file_type was checked above
123+
file_content = sync_client.get_file_content(normalized_path, file_type) # type: ignore [arg-type]
124124
kwargs[file_type] = file_content
125125
except HumanloopRuntimeError as e:
126126
raise HumanloopRuntimeError(f"Failed to use local file for `{normalized_path}`: {str(e)}")
@@ -191,7 +191,7 @@ def overload_client(
191191
"""Overloads client methods to add tracing, local file handling, and evaluation context."""
192192
# Store original log method as _log for all clients. Used in flow decorator
193193
if hasattr(client, "log") and not hasattr(client, "_log"):
194-
client._log = client.log # type: ignore [attr-defined]
194+
client._log = client.log # type: ignore[attr-defined]
195195

196196
# Create a closure to capture sync_client and use_local_files
197197
def log_wrapper(self: Any, **kwargs) -> LogResponseType:
@@ -205,7 +205,7 @@ def log_wrapper(self: Any, **kwargs) -> LogResponseType:
205205
logger.error("sync_client is None but client has call method and use_local_files=%s", use_local_files)
206206
raise HumanloopRuntimeError("sync_client is required for clients that support call operations")
207207
if hasattr(client, "call") and not hasattr(client, "_call"):
208-
client._call = client.call # type: ignore [attr-defined]
208+
client._call = client.call # type: ignore[attr-defined]
209209

210210
# Create a closure to capture sync_client and use_local_files
211211
def call_wrapper(self: Any, **kwargs) -> CallResponseType:

src/humanloop/sync/sync_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def pull(self, path: str | None = None, environment: str | None = None) -> Tuple
343343
)
344344

345345
try:
346-
if path is None:
346+
if normalized_path is None or path is None: # path being None means normalized_path is None, but we check both for improved type safety
347347
# Pull all files from the root
348348
logger.debug("Pulling all files from root")
349349
successful_files, failed_files = self._pull_directory(

0 commit comments

Comments
 (0)