diff --git a/CHANGELOG.md b/CHANGELOG.md index 23b270faf..cdca102c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 6.18.5 - March 29, 2024 + +* other_name in committee matching +* swap getargspec for getfullargspec on Update + ## 6.18.4 - March 25, 2024 * Rollback on committee matching diff --git a/openstates/cli/update.py b/openstates/cli/update.py index f72139f11..21ffc9cd9 100644 --- a/openstates/cli/update.py +++ b/openstates/cli/update.py @@ -98,7 +98,7 @@ def do_scrape( for scraper_name, scrape_args in scrapers.items(): ScraperCls = juris.scrapers[scraper_name] if ( - "session" in inspect.getargspec(ScraperCls.scrape).args + "session" in inspect.getfullargspec(ScraperCls.scrape).args and "session" not in scrape_args ): logger.warning( diff --git a/openstates/importers/base.py b/openstates/importers/base.py index fee57b3d6..a9778aa8c 100644 --- a/openstates/importers/base.py +++ b/openstates/importers/base.py @@ -593,60 +593,3 @@ def resolve_person( # return the newly-cached object return self.person_cache[cache_key] - - def resolve_committee( - self, json_id: str, allow_no_match: bool = False - ) -> typing.Optional[_ID]: - if not json_id: - return None - - if json_id.startswith("~"): - # keep caches of all the pseudo-ids to avoid doing 1000s of lookups during import - if json_id not in self.pseudo_id_cache: - spec = get_pseudo_id(json_id) - # need to include other_names in matching - if list(spec.keys()) == ["name"]: - name = spec["name"] - spec = ( - Q(name__iexact=name) - | Q(other_names__name__iexact=name) - ) - else: - spec = Q(**spec) - - # continue with logic from resolve_json_id - if isinstance(spec, Q): - objects = self.model_class.objects.filter(spec) - else: - objects = self.model_class.objects.filter(**spec) - ids = {each.id for each in objects} - if len(ids) == 1: - self.pseudo_id_cache[json_id] = ids.pop() - errmsg = None - elif not ids: - errmsg = "cannot resolve pseudo id to {}: {}".format( - self.model_class.__name__, json_id - ) - else: - errmsg = "multiple objects returned for {} pseudo id {}: {}".format( - self.model_class.__name__, json_id, ids - ) - - # either raise or log error - if errmsg: - if not allow_no_match: - raise UnresolvedIdError(errmsg) - else: - self.error(errmsg) - self.pseudo_id_cache[json_id] = None - - # return the cached object - return self.pseudo_id_cache[json_id] - - # get the id that the duplicate points to, or use self - json_id = self.duplicates.get(json_id, json_id) - - try: - return self.json_to_db_id[json_id] - except KeyError: - raise UnresolvedIdError("cannot resolve id: {}".format(json_id)) diff --git a/openstates/importers/organizations.py b/openstates/importers/organizations.py index ed3f3f5d3..9a6557df8 100644 --- a/openstates/importers/organizations.py +++ b/openstates/importers/organizations.py @@ -14,5 +14,5 @@ def limit_spec(self, spec: _JsonDict) -> _JsonDict: name = spec.pop("name", None) if name: - return Q(**spec) & Q(name=name) + return Q(**spec) & (Q(other_names__0__name=name) | Q(name=name)) return spec diff --git a/pyproject.toml b/pyproject.toml index 67f1ec3ab..e0b348e59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "openstates" -version = "6.18.4" +version = "6.18.5" description = "core infrastructure for the openstates project" authors = ["James Turk "] license = "MIT"