civics-cdf-validator 1.49.dev12__py3-none-any.whl → 1.49.dev13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4182,34 +4182,32 @@ class ElectionEventDatesAreSequential(base.DateRule):
4182
4182
  raise loggers.ElectionError(self.error_log)
4183
4183
 
4184
4184
 
4185
- class NoSourceDirPathBeforeInitialDeliveryDate(base.BaseRule):
4186
- """SourceDirPath should only be defined if one of the initial delivery dates is in the past."""
4185
+ class SourceDirPathMustBeSetAfterInitialDeliveryDate(base.BaseRule):
4186
+ """SourceDirPath must be set if any InitialDeliveryDate is in the past."""
4187
4187
 
4188
4188
  def elements(self):
4189
4189
  return ["Feed"]
4190
4190
 
4191
4191
  def check(self, element):
4192
- if not element_has_text(element.find("SourceDirPath")):
4192
+ if element_has_text(element.find("SourceDirPath")):
4193
4193
  return
4194
4194
  today = datetime.date.today()
4195
4195
  today_partial_date = base.PartialDate(
4196
4196
  year=today.year, month=today.month, day=today.day
4197
4197
  )
4198
- initial_deliveries = element.findall(".//InitialDeliveryDate")
4199
- if initial_deliveries:
4200
- for initial_delivery in initial_deliveries:
4201
- initial_delivery_date = (
4202
- base.PartialDate.init_partial_date(initial_delivery.text)
4203
- if element_has_text(initial_delivery)
4204
- else None
4205
- )
4206
- if initial_delivery_date and initial_delivery_date < today_partial_date:
4207
- return
4208
- raise loggers.ElectionWarning.from_message(
4209
- "SourceDirPath is defined but all initialDeliveryDate are in the"
4210
- " future.",
4211
- [element],
4198
+ initial_deliveries = element.findall(".//InitialDeliveryDate") or []
4199
+ for initial_delivery in initial_deliveries:
4200
+ initial_delivery_date = (
4201
+ base.PartialDate.init_partial_date(initial_delivery.text)
4202
+ if element_has_text(initial_delivery)
4203
+ else None
4212
4204
  )
4205
+ if initial_delivery_date and initial_delivery_date < today_partial_date:
4206
+ raise loggers.ElectionError.from_message(
4207
+ "SourceDirPath is not set but an InitialDeliveryDate is in the "
4208
+ f"past for feed {element.find('FeedId').text}.",
4209
+ [element],
4210
+ )
4213
4211
 
4214
4212
 
4215
4213
  class OfficeHolderSubFeedDatesAreSequential(base.DateRule):
@@ -4790,10 +4788,10 @@ METADATA_RULES = (
4790
4788
  FeedInactiveDateIsLatestDate,
4791
4789
  FeedInactiveDateSetForNonEvergreenFeed,
4792
4790
  FeedTypeHasValidFeedLongevity,
4793
- NoSourceDirPathBeforeInitialDeliveryDate,
4794
4791
  OfficeHolderSubFeedDatesAreSequential,
4795
4792
  OptionalAndEmpty,
4796
4793
  Schema,
4794
+ SourceDirPathMustBeSetAfterInitialDeliveryDate,
4797
4795
  SourceDirPathsAreUnique,
4798
4796
  UniqueLabel,
4799
4797
  # go/keep-sorted end
@@ -5,4 +5,4 @@ No dependencies should be added to this module.
5
5
  See https://packaging.python.org/guides/single-sourcing-package-version/
6
6
  """
7
7
 
8
- __version__ = '1.49.dev12'
8
+ __version__ = '1.49.dev13'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.49.dev12
3
+ Version: 1.49.dev13
4
4
  Summary: Checks if an election feed follows best practices
5
5
  Home-page: https://github.com/google/civics_cdf_validator
6
6
  Author: Google Civics
@@ -3,13 +3,13 @@ civics_cdf_validator/base.py,sha256=5zntjAdAA-bdwYOOStFgUle9LGX_ccelS--thMhUG9A,
3
3
  civics_cdf_validator/gpunit_rules.py,sha256=Cg-qlOeVKTCQ5qUKYSxbVrrh3tdLt1X5Eg-7uyyR_SY,9487
4
4
  civics_cdf_validator/loggers.py,sha256=LS6U9YWzu72V2Q0PwyE9xE03Ul392UAPRnrp2uRBMLA,6923
5
5
  civics_cdf_validator/office_utils.py,sha256=aFxcFQZF2oBn0gPXt_kv1LxHGvwzABScT8X5yaYtVLw,2705
6
- civics_cdf_validator/rules.py,sha256=mQByCHxof6D0Ifw-SpfnlQcIbPLPaO7f6qPSTLIZGj8,159916
6
+ civics_cdf_validator/rules.py,sha256=Ucw1vURByvUoyMVdBUDnzggO15kExbnpsBZU0Wlg-EE,159895
7
7
  civics_cdf_validator/stats.py,sha256=YNqv3Khkt_hJxCIunFBRSl23oXqu5gNjCmWMHFbAcSU,3819
8
8
  civics_cdf_validator/validator.py,sha256=2nwlFfQ9AmpTaO5n5ekaO845Rm0JPjNF-Il6FJW_50k,12678
9
- civics_cdf_validator/version.py,sha256=XR8QyYKrxeV1eHqomROga81p7X4JpjgDXULUY7MGvQU,189
10
- civics_cdf_validator-1.49.dev12.dist-info/licenses/LICENSE-2.0.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
11
- civics_cdf_validator-1.49.dev12.dist-info/METADATA,sha256=5cxrxIuKc_9jy4AY3mF2hlOt9br6zBmP57K8S-1xow0,1009
12
- civics_cdf_validator-1.49.dev12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- civics_cdf_validator-1.49.dev12.dist-info/entry_points.txt,sha256=QibgvtMOocwDi7fQ1emgMJ2lIlI41sW0__KIQdnVn90,77
14
- civics_cdf_validator-1.49.dev12.dist-info/top_level.txt,sha256=PYT5Eclxbop5o6DJIcgs4IeU6Ds5jqyftjoFbgkkJYo,21
15
- civics_cdf_validator-1.49.dev12.dist-info/RECORD,,
9
+ civics_cdf_validator/version.py,sha256=VFMdAjvjwr34E1vqDkhcL8mmJWGxF_XUDagoSEfJ11Y,189
10
+ civics_cdf_validator-1.49.dev13.dist-info/licenses/LICENSE-2.0.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
11
+ civics_cdf_validator-1.49.dev13.dist-info/METADATA,sha256=MBpl8nej6fgkR0c0jy0owtovKInrOYSLDPpp1k8viaw,1009
12
+ civics_cdf_validator-1.49.dev13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ civics_cdf_validator-1.49.dev13.dist-info/entry_points.txt,sha256=QibgvtMOocwDi7fQ1emgMJ2lIlI41sW0__KIQdnVn90,77
14
+ civics_cdf_validator-1.49.dev13.dist-info/top_level.txt,sha256=PYT5Eclxbop5o6DJIcgs4IeU6Ds5jqyftjoFbgkkJYo,21
15
+ civics_cdf_validator-1.49.dev13.dist-info/RECORD,,