Skip to content

Commit

Permalink
Fix some None typing for cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymathews committed Jul 28, 2023
1 parent a43719e commit 0e01652
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spatialprofilingtoolbox/db/feature_matrix_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from enum import Enum
from enum import auto
from typing import cast

import pandas as pd
from psycopg2.extensions import cursor as Psycopg2Cursor
Expand All @@ -30,15 +31,15 @@ class FeatureMatrixExtractor:
Pull from the database and create convenience bundle of feature matrices and metadata.
"""

cursor: Psycopg2Cursor | None
cursor: Psycopg2Cursor
database_config_file: str | None
db_source: DBSource

def __init__(self,
cursor: Psycopg2Cursor | None=None,
database_config_file: str | None=None,
):
self.cursor = cursor
self.cursor = cast(Psycopg2Cursor, cursor)
self.database_config_file = database_config_file
if cursor is not None:
self.db_source = DBSource.CURSOR
Expand Down Expand Up @@ -77,7 +78,6 @@ def extract(self,
study=study,
continuous_also=continuous_also,
)
self.cursor = None
if self.db_source == DBSource.UNKNOWN:
logger.error('The database source can not be determined.')
return extraction
Expand Down

0 comments on commit 0e01652

Please sign in to comment.