Skip to content

Commit

Permalink
Remove unecessary parentheses after not operator
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed Nov 9, 2023
1 parent 6b00030 commit 6b5b7ed
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pyxform/entities/entities_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ def get_entity_declaration(
update_condition = entity_row.get("update_if", None)
entity_label = entity_row.get("label", None)

if update_condition and not (entity_id):
if update_condition and not entity_id:
raise PyXFormError(
"The entities sheet is missing the entity_id column which is required when updating entities."
)

if entity_id and create_condition and not (update_condition):
if entity_id and create_condition and not update_condition:
raise PyXFormError(
"The entities sheet can't specify an entity creation condition and an entity_id without also including an update condition."
)

if not (entity_id) and not (entity_label):
if not entity_id and not entity_label:
raise PyXFormError(
"The entities sheet is missing the label column which is required when creating entities."
)
Expand Down
4 changes: 2 additions & 2 deletions pyxform/entities/entity_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def xml_instance(self, **kwargs):
attributes["update"] = "1"
attributes["baseVersion"] = ""

if create_condition or (not (update_condition) and not (entity_id_expression)):
if create_condition or (not update_condition and not entity_id_expression):
attributes["create"] = "1"

if self.get("parameters", {}).get("label", None):
Expand All @@ -60,7 +60,7 @@ def xml_bindings(self):

bind_nodes.append(self._get_id_bind_node(survey, entity_id_expression))

if create_condition or not (entity_id_expression):
if create_condition or not entity_id_expression:
bind_nodes.append(self._get_id_setvalue_node())

if update_condition:
Expand Down
2 changes: 1 addition & 1 deletion pyxform/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def nest_setvalues(self, xml_node):
.strip(),
"event": "xforms-value-changed",
}
if not (setvalue[1] == ""):
if not setvalue[1] == "":
setvalue_attrs["value"] = self.get_root().insert_xpaths(
setvalue[1], self
)
Expand Down
2 changes: 1 addition & 1 deletion pyxform/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def xml(self):
self._setup_xpath_dictionary()

for triggering_reference in self.setvalues_by_triggering_ref.keys():
if not (re.search(BRACKETED_TAG_REGEX, triggering_reference)):
if not re.search(BRACKETED_TAG_REGEX, triggering_reference):
raise PyXFormError(
"Only references to other fields are allowed in the 'trigger' column."
)
Expand Down
4 changes: 2 additions & 2 deletions pyxform/survey_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ def get_translations(self, default_language):
# how they're defined - https://opendatakit.github.io/xforms-spec/#languages
if (
display_element == "guidance_hint"
and not (isinstance(label_or_hint, dict))
and not isinstance(label_or_hint, dict)
and len(label_or_hint) > 0
):
label_or_hint = {default_language: label_or_hint}

# always use itext for hint if there's a guidance hint
if (
display_element == "hint"
and not (isinstance(label_or_hint, dict))
and not isinstance(label_or_hint, dict)
and len(label_or_hint) > 0
and "guidance_hint" in self.keys()
and len(self["guidance_hint"]) > 0
Expand Down
2 changes: 1 addition & 1 deletion pyxform/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def get_languages_with_bad_tags(languages):
lang_code = re.search(lang_code_regex, lang)

if lang != "default" and (
not (lang_code) or not (lang_code.group(1) in iana_subtags)
not lang_code or not lang_code.group(1) in iana_subtags
):
languages_with_bad_tags.append(lang)
return languages_with_bad_tags
Expand Down
2 changes: 1 addition & 1 deletion pyxform/xls2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def workbook_to_json(
if not question_type:
# if name and label are also missing,
# then its a comment row, and we skip it with warning
if not ((constants.NAME in row) or (constants.LABEL in row)):
if not (constants.NAME in row or constants.LABEL in row):
warnings.append(
ROW_FORMAT_STRING % row_number
+ " Row without name, text, or label is being skipped:\n"
Expand Down

0 comments on commit 6b5b7ed

Please sign in to comment.