| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,7 +74,7 @@ def _migration_from_file(self, filename: str) -> migration.Migration: | |||
| 74 | 74 | path = os.path.join(self.basedir, filename) | |
| 75 | 75 | spec = importlib.util.spec_from_file_location(module_name, path) | |
| 76 | 76 | module = importlib.util.module_from_spec(spec) | |
| 77 | - spec.loader.exec_module(module) | ||
| 77 | + spec.loader.exec_module(module) # type: ignore | ||
| 78 | 78 | try: | |
| 79 | 79 | result = migration.Migration(module.migration_id, | |
| 80 | 80 | module.prev_migration_id, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -307,7 +307,7 @@ def where_equal(cls, | |||
| 307 | 307 | def _results_to_models(cls, | |
| 308 | 308 | results: Iterable[Iterable[Any]]) -> List['ModelObject']: | |
| 309 | 309 | items = [dict(zip(cls.columns, result)) for result in results] | |
| 310 | - return [cls(item, persisted=True) for item in items] | ||
| 310 | + return [cls(item, persisted=True) for item in items] # type: ignore | ||
| 311 | 311 | ||
| 312 | 312 | @classmethod | |
| 313 | 313 | def _execute_read(cls, db_api: Callable[..., CallableReturn], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ | |||
| 15 | 15 | """Helps build SQL for complex Spanner queries.""" | |
| 16 | 16 | ||
| 17 | 17 | import abc | |
| 18 | - from typing import Any, Dict, Iterable, List, Tuple, Type | ||
| 18 | + from typing import Any, Dict, Iterable, List, Sequence, Tuple, Type | ||
| 19 | 19 | ||
| 20 | 20 | from spanner_orm import condition | |
| 21 | 21 | from spanner_orm import error | |
@@ -47,7 +47,7 @@ def types(self) -> Dict[str, Any]: | |||
| 47 | 47 | return self._types | |
| 48 | 48 | ||
| 49 | 49 | @abc.abstractmethod | |
| 50 | - def process_results(self, results: List[List[Any]]) -> None: | ||
| 50 | + def process_results(self, results: List[Sequence[Any]]) -> None: | ||
| 51 | 51 | pass | |
| 52 | 52 | ||
| 53 | 53 | def _segments(self, | |
@@ -148,7 +148,7 @@ def __init__(self, model: Type[Any], | |||
| 148 | 148 | def _select(self) -> Tuple[str, Dict[str, Any], Dict[str, Any]]: | |
| 149 | 149 | return ('SELECT COUNT(*)', {}, {}) | |
| 150 | 150 | ||
| 151 | - def process_results(self, results: List[List[Any]]) -> int: | ||
| 151 | + def process_results(self, results: List[Sequence[Any]]) -> int: | ||
| 152 | 152 | return int(results[0][0]) | |
| 153 | 153 | ||
| 154 | 154 | ||
@@ -186,7 +186,7 @@ def _select(self) -> Tuple[str, Dict[str, Any], Dict[str, Any]]: | |||
| 186 | 186 | prefix=self._select_prefix(), | |
| 187 | 187 | columns=', '.join(columns)), parameters, types) | |
| 188 | 188 | ||
| 189 | - def process_results(self, results: List[List[Any]]) -> List[Type[Any]]: | ||
| 189 | + def process_results(self, results: List[Sequence[Any]]) -> List[Type[Any]]: | ||
| 190 | 190 | return [self._process_row(result) for result in results] | |
| 191 | 191 | ||
| 192 | 192 | def _process_row(self, row: List[Any]) -> Type[Any]: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,9 +88,8 @@ def _parse_constraints(self) -> List[RelationshipConstraint]: | |||
| 88 | 88 | raise error.ValidationError( | |
| 89 | 89 | 'Destination column must be present in destination model') | |
| 90 | 90 | ||
| 91 | - # TODO(dbrandao): remove when pytype #234 is fixed | ||
| 92 | 91 | constraints.append( | |
| 93 | 92 | RelationshipConstraint(self.destination, destination_column, | |
| 94 | - self.origin, origin_column)) # type: ignore | ||
| 93 | + self.origin, origin_column)) | ||
| 95 | 94 | ||
| 96 | 95 | return constraints | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ | |||
| 15 | 15 | """Table-level API lambdas for Spanner transactions.""" | |
| 16 | 16 | ||
| 17 | 17 | import logging | |
| 18 | - from typing import Any, Dict, Iterable, List | ||
| 18 | + from typing import Any, Dict, Iterable, List, Sequence | ||
| 19 | 19 | ||
| 20 | 20 | from google.cloud import spanner | |
| 21 | 21 | from google.cloud.spanner_v1 import transaction as spanner_transaction | |
@@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | 27 | # Read methods | |
| 28 | 28 | def find(transaction: spanner_transaction.Transaction, table_name: str, | |
| 29 | - columns: Iterable[str], keyset: spanner.KeySet) -> List[Iterable[Any]]: | ||
| 29 | + columns: Iterable[str], keyset: spanner.KeySet) -> List[Sequence[Any]]: | ||
| 30 | 30 | """Retrieves rows from the given table based on the provided KeySet. | |
| 31 | 31 | ||
| 32 | 32 | Args: | |
@@ -51,7 +51,7 @@ def find(transaction: spanner_transaction.Transaction, table_name: str, | |||
| 51 | 51 | ||
| 52 | 52 | def sql_query(transaction: spanner_transaction.Transaction, query: str, | |
| 53 | 53 | parameters: Dict[str, Any], | |
| 54 | - parameter_types: Dict[str, type_pb2.Type]) -> List[Iterable[Any]]: | ||
| 54 | + parameter_types: Dict[str, type_pb2.Type]) -> List[Sequence[Any]]: | ||
| 55 | 55 | """Executes a given SQL query against the Spanner database. | |
| 56 | 56 | ||
| 57 | 57 | This isn't technically read-only, but it's necessary to implement the read- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,9 @@ | |||
| 12 | 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | 13 | # See the License for the specific language governing permissions and | |
| 14 | 14 | # limitations under the License. | |
| 15 | + | ||
| 16 | + # type: ignore | ||
| 17 | + | ||
| 15 | 18 | import logging | |
| 16 | 19 | import unittest | |
| 17 | 20 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments