Skip to content

Commit

Permalink
HDXDS-247 Disable bites fix (#57)
Browse files Browse the repository at this point in the history
Disable bites fix
  • Loading branch information
mcarans authored Nov 7, 2023
1 parent d9e9857 commit 1bf8830
Show file tree
Hide file tree
Showing 29 changed files with 54 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .config/coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ exclude_also =
if 0:
if __name__ == .__main__.:
if TYPE_CHECKING:
@(abc\.)?abstractmethod
@(abc\.)?abstractmethod
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ you make a git commit:

pre-commit install

The configuration file for this project is in a
The configuration file for this project is in a
non-start location. Thus, you will need to edit your
`.git/hooks/pre-commit` file to reflect this. Change
the line that begins with `ARGS` to:
Expand All @@ -29,7 +29,7 @@ the line that begins with `ARGS` to:

With pre-commit, all code is formatted according to
[black]("https://github.com/psf/black") and
[ruff]("https://github.com/charliermarsh/ruff") guidelines.
[ruff]("https://github.com/charliermarsh/ruff") guidelines.

To check if your changes pass pre-commit without committing, run:

Expand All @@ -46,8 +46,8 @@ Follow the example set out already in ``api.rst`` as you write the documentation
## Packages

[pip-tools](https://github.com/jazzband/pip-tools) is used for
package management. If you’ve introduced a new package to the
source code (i.e.anywhere in `src/`), please add it to the
package management. If you’ve introduced a new package to the
source code (i.e.anywhere in `src/`), please add it to the
`project.dependencies` section of
`pyproject.toml` with any known version constraints.

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies = [
"ckanapi>=4.7",
"defopt>=6.4.0",
"email_validator",
"hdx-python-country>=3.5.7",
"hdx-python-country>=3.5.9",
"hdx-python-utilities>=3.6.2",
"libhxl>=5.1",
"makefun",
Expand Down Expand Up @@ -95,7 +95,7 @@ test = """
"""

[[tool.hatch.envs.test.matrix]]
python = ["3.11"]
python = ["3.12"]

[tool.hatch.envs.lint]
detached = true
Expand Down
40 changes: 20 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --all-extras --output-file=requirements.txt --resolver=backtracking pyproject.toml
#
annotated-types==0.5.0
annotated-types==0.6.0
# via pydantic
attrs==23.1.0
# via
Expand All @@ -19,7 +19,7 @@ cfgv==3.4.0
# via pre-commit
chardet==5.2.0
# via frictionless
charset-normalizer==3.3.0
charset-normalizer==3.3.2
# via requests
ckanapi==4.7
# via hdx-python-api (pyproject.toml)
Expand All @@ -29,7 +29,7 @@ colorama==0.4.6
# via typer
coverage[toml]==7.3.2
# via pytest-cov
cryptography==41.0.4
cryptography==41.0.5
# via pyopenssl
defopt==6.4.0
# via hdx-python-api (pyproject.toml)
Expand All @@ -43,23 +43,23 @@ docopt==0.6.2
# num2words
docutils==0.20.1
# via defopt
email-validator==2.0.0.post2
email-validator==2.1.0.post1
# via hdx-python-api (pyproject.toml)
et-xmlfile==1.1.0
# via openpyxl
filelock==3.12.4
filelock==3.13.1
# via virtualenv
frictionless==5.16.0
# via hdx-python-utilities
hdx-python-country==3.5.7
hdx-python-country==3.5.9
# via hdx-python-api (pyproject.toml)
hdx-python-utilities==3.6.2
# via
# hdx-python-api (pyproject.toml)
# hdx-python-country
humanize==4.8.0
# via frictionless
identify==2.5.30
identify==2.5.31
# via pre-commit
idna==3.4
# via
Expand Down Expand Up @@ -93,7 +93,7 @@ makefun==1.15.1
# via hdx-python-api (pyproject.toml)
markdown-it-py==3.0.0
# via rich
marko==2.0.0
marko==2.0.1
# via frictionless
markupsafe==2.1.3
# via jinja2
Expand All @@ -103,7 +103,7 @@ ndg-httpsclient==0.5.1
# via hdx-python-api (pyproject.toml)
nodeenv==1.8.0
# via pre-commit
num2words==0.5.12
num2words==0.5.13
# via quantulum3
openpyxl==3.1.2
# via hdx-python-utilities
Expand All @@ -121,7 +121,7 @@ ply==3.11
# libhxl
pockets==0.9.1
# via sphinxcontrib-napoleon
pre-commit==3.4.0
pre-commit==3.5.0
# via hdx-python-api (pyproject.toml)
pyasn1==0.5.0
# via
Expand All @@ -137,15 +137,15 @@ pydantic-core==2.10.1
# via pydantic
pygments==2.16.1
# via rich
pyopenssl==23.2.0
pyopenssl==23.3.0
# via
# hdx-python-api (pyproject.toml)
# ndg-httpsclient
pyphonetics==0.5.3
# via hdx-python-country
pyrsistent==0.19.3
pyrsistent==0.20.0
# via jsonschema
pytest==7.4.2
pytest==7.4.3
# via
# hdx-python-api (pyproject.toml)
# pytest-cov
Expand Down Expand Up @@ -184,11 +184,11 @@ rfc3986==2.0.0
# via frictionless
rich==13.6.0
# via typer
ruamel-yaml==0.17.34
ruamel-yaml==0.18.5
# via hdx-python-utilities
ruamel-yaml-clib==0.2.8
# via ruamel-yaml
shellingham==1.5.3
shellingham==1.5.4
# via typer
simpleeval==0.9.13
# via frictionless
Expand All @@ -204,7 +204,7 @@ sphinxcontrib-napoleon==0.7
# via defopt
stringcase==1.2.0
# via frictionless
structlog==23.1.0
structlog==23.2.0
# via libhxl
tableschema-to-template==0.0.13
# via hdx-python-utilities
Expand All @@ -225,21 +225,21 @@ unidecode==1.3.7
# via
# libhxl
# pyphonetics
urllib3==2.0.6
urllib3==2.0.7
# via
# libhxl
# requests
validators==0.22.0
# via frictionless
virtualenv==20.24.5
virtualenv==20.24.6
# via pre-commit
wheel==0.41.2
wheel==0.41.3
# via libhxl
xlrd==2.0.1
# via hdx-python-utilities
xlrd3==1.1.0
# via libhxl
xlsxwriter==3.1.6
xlsxwriter==3.1.9
# via tableschema-to-template
xlwt==1.3.0
# via hdx-python-utilities
Expand Down
10 changes: 5 additions & 5 deletions src/hdx/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ def _generate_resource_view(
bites_disabled: Optional[ListTuple[bool]] = None,
indicators: Optional[ListTuple[Dict]] = None,
findreplace: Optional[Dict] = None,
) -> resource_view.ResourceView:
) -> Optional[resource_view.ResourceView]:
"""Create QuickCharts for the given resource in a dataset. If you do
not supply a path, then the internal indicators resource view template
will be used. You can disable specific bites by providing
Expand All @@ -2104,12 +2104,12 @@ def _generate_resource_view(
findreplace (Optional[Dict]): Replacements for anything else in resource view. Defaults to None.
Returns:
resource_view.ResourceView: The resource view if QuickCharts created, None is not
Optional[resource_view.ResourceView]: The resource view if QuickCharts created, None is not
"""
if bites_disabled == [True, True, True]:
return None
elif not bites_disabled:
if not bites_disabled:
bites_disabled = [False, False, False]
elif all(i for i in bites_disabled):
return None
res = self.set_quickchart_resource(resource)
if res is None:
return None
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/Accepted_Tags.csv
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,4 @@ wind speed
women
yellow fever
youth
zika
zika
2 changes: 1 addition & 1 deletion tests/fixtures/Tag_Mapping.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4841,4 +4841,4 @@ fl20070525gha ,merge,flood;geodata,,,,,,,??
fl20090901sen ,merge,flood;geodata,,,,,,,??
fl20120924ssd ,merge,flood;geodata,,,,,,,??
fl20080301ecu ,merge,flood;geodata,,,,,,,??
fl20070802bgd ,merge,flood;geodata,,,,,,,??
fl20070802bgd ,merge,flood;geodata,,,,,,,??
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_base_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"name"
]
}
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_dataset_static.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
"format": "csv"
}
]
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_datasource_topline.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
}
],
"primary_key": "code"
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_datasource_topline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ schema:
type: "text"
- id: "units"
type: "text"
primary_key: "code"
primary_key: "code"
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_email_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"timeout": 3,
"username": "user",
"password": "pass"
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_missing_site_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"hdx_site": "feature",
"hdx_key": "54321",
"hdx_read_only": false
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_resource_static.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"format": "zipped csv",
"url": "http://test/spreadsheet.xlsx",
"description": "My Resource"
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_resource_static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: "MyResource1"
package_id: "6f36a41c-f126-4b18-aaaf-6c2ddfbc5d4d"
format: "csv"
url: "http://test/spreadsheet.xlsx"
description: "My Resource"
description: "My Resource"
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_resource_view_static.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title: Quick Charts
view_type: hdx_hxl_preview
description: lala
hxl_preview_config: '{"configVersion":2,"bites":[{"init":true,"type":"key figure","filteredValues":[],"errorMsg":null,"ingredient":{"aggregateColumn":null,"valueColumn":"#affected+killed","aggregateFunction":"sum"},"dataTitle":"#affected+killed","displayCategory":"Key Figures","unit":null,"hashCode":-1955043658,"title":"Sum of fatalities","value":null},{"init":true,"type":"chart","filteredValues":[],"errorMsg":null,"swapAxis":true,"showGrid":true,"pieChart":false,"ingredient":{"aggregateColumn":"#adm1+name","valueColumn":"#affected+killed","aggregateFunction":"sum"},"dataTitle":"#affected+killed","displayCategory":"Charts","hashCode":738289179,"title":"Sum of fatalities grouped by admin1","values":null,"categories":null},{"init":true,"type":"chart","filteredValues":[],"errorMsg":null,"swapAxis":true,"showGrid":true,"pieChart":false,"ingredient":{"aggregateColumn":"#adm2+name","valueColumn":"#affected+killed","aggregateFunction":"sum"},"dataTitle":"#affected+killed","displayCategory":"Charts","hashCode":766918330,"title":"Sum of fatalities grouped by admin2","values":null,"categories":null}]}'
hxl_preview_config: '{"configVersion":2,"bites":[{"init":true,"type":"key figure","filteredValues":[],"errorMsg":null,"ingredient":{"aggregateColumn":null,"valueColumn":"#affected+killed","aggregateFunction":"sum"},"dataTitle":"#affected+killed","displayCategory":"Key Figures","unit":null,"hashCode":-1955043658,"title":"Sum of fatalities","value":null},{"init":true,"type":"chart","filteredValues":[],"errorMsg":null,"swapAxis":true,"showGrid":true,"pieChart":false,"ingredient":{"aggregateColumn":"#adm1+name","valueColumn":"#affected+killed","aggregateFunction":"sum"},"dataTitle":"#affected+killed","displayCategory":"Charts","hashCode":738289179,"title":"Sum of fatalities grouped by admin1","values":null,"categories":null},{"init":true,"type":"chart","filteredValues":[],"errorMsg":null,"swapAxis":true,"showGrid":true,"pieChart":false,"ingredient":{"aggregateColumn":"#adm2+name","valueColumn":"#affected+killed","aggregateFunction":"sum"},"dataTitle":"#affected+killed","displayCategory":"Charts","hashCode":766918330,"title":"Sum of fatalities grouped by admin2","values":null,"categories":null}]}'
2 changes: 1 addition & 1 deletion tests/fixtures/config/hdx_showcase_static.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"package_id": "6f36a41c-f126-4b18-aaaf-6c2ddfbc5d4d",
"image_url": "http://myvisual/visual.png",
"url": "http://visualisation/url/"
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/project_configuration.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"my_param": "abc"
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/config/user_agent_config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
preprefix: lala
user_agent: myua
user_agent: myua
2 changes: 1 addition & 1 deletion tests/fixtures/config/user_agent_config2.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user_agent: myuseragent
user_agent: myuseragent
2 changes: 1 addition & 1 deletion tests/fixtures/config/user_agent_config3.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lookup:
user_agent: mylookupagent
lookup2:
user_agent: mylookupagent2
user_agent: mylookupagent2
2 changes: 1 addition & 1 deletion tests/fixtures/config/user_agent_config_wrong.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lala: myuseragent
lala: myuseragent
1 change: 0 additions & 1 deletion tests/fixtures/gen_resource/test_data_no_years.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ GWNO,EVENT_ID_CNTY,EVENT_ID_NO_CNTY,EVENT_DATE,YEAR,TIME_PRECISION,EVENT_TYPE,AC
615,2229RTA,,19/04/2001,,1,Riots/Protests,Rioters (Algeria),Berber Ethnic Group (Algeria),5,Police Forces of Algeria (1999-),,1,15,Algeria,Tizi Ouzou,Tizi Ouzou,,Tizi Ouzou,36.71183,4.04591,3,Kabylie report,"Riots were reported in numerous villages in Kabylie, resulting in dozens wounded in clashes between protesters and police and significant material damage.",0
615,2230RTA,,20/04/2001,,1,Riots/Protests,Protesters (Algeria),Students (Algeria),6,,,0,60,Algeria,Bejaia,Amizour,,Amizour,36.64022,4.90131,1,Crisis Group,Students protested in the Amizour area. At least 3 were later arrested for allegedly insulting gendarmes.,0
615,2231RTA,,21/04/2001,,1,Riots/Protests,Rioters (Algeria),Berber Ethnic Group (Algeria),5,Police Forces of Algeria (1999-),,1,15,Algeria,Bejaia,Amizour,,Amizour,36.64022,4.90131,1,Kabylie report,"Rioters threw molotov cocktails, rocks and burning tires at gendarmerie stations in Beni Douala, El-Kseur and Amizour.",0

2 changes: 1 addition & 1 deletion tests/fixtures/organization_show_results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ packages:
num_followers: 32
id: "b67e6c74-c185-4f43-b561-0e114a736f19"
tags:
approval_status: approved
approval_status: approved
1 change: 0 additions & 1 deletion tests/fixtures/test_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ GWNO,EVENT_ID_CNTY,EVENT_ID_NO_CNTY,EVENT_DATE,YEAR,TIME_PRECISION,EVENT_TYPE,AC
615,2229RTA,,19/04/2001,2001,1,Riots/Protests,Rioters (Algeria),Berber Ethnic Group (Algeria),5,Police Forces of Algeria (1999-),,1,15,Algeria,Tizi Ouzou,Tizi Ouzou,,Tizi Ouzou,36.71183,4.04591,3,Kabylie report,"Riots were reported in numerous villages in Kabylie, resulting in dozens wounded in clashes between protesters and police and significant material damage.",0
615,2230RTA,,20/04/2001,2002,1,Riots/Protests,Protesters (Algeria),Students (Algeria),6,,,0,60,Algeria,Bejaia,Amizour,,Amizour,36.64022,4.90131,1,Crisis Group,Students protested in the Amizour area. At least 3 were later arrested for allegedly insulting gendarmes.,
615,2231RTA,,21/04/2001,2001,1,Riots/Protests,Rioters (Algeria),Berber Ethnic Group (Algeria),5,Police Forces of Algeria (1999-),,1,15,Algeria,Bejaia,Amizour,,Amizour,36.64022,4.90131,1,Kabylie report,"Rioters threw molotov cocktails, rocks and burning tires at gendarmerie stations in Beni Douala, El-Kseur and Amizour.",0

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ indicator_id,indicator_label_en
200144,Population aged 15-24 years (thousands)
200151,Population aged 65 years or older (thousands)
200343,Population aged 14 years or younger (thousands)
200345,Population aged 25-64 years (thousands)
200345,Population aged 25-64 years (thousands)
DT.TDS.DECT.GN.ZS,Total debt service (% of GNI)
NY.GDP.DEFL.ZS,GDP deflator (base year varies by country)
NY.GDP.MKTP.CD,GDP (current US$)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4020,7 +4020,7 @@ PRYA.12MO.F,ZWE,2011,Source:Data sources,ZWE - LFS - Labour Force Survey - Repos
PRYA.12MO.F,ZWE,2014,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period: not specified
PRYA.12MO.F,ZWE,2019,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period: not specified
PRYA.12MO.GPI,ZWE,2011,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period: not specified
PRYA.12MO.GPI,ZWE,2014,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period:
PRYA.12MO.GPI,ZWE,2014,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period:
PRYA.12MO.GPI,ZWE,2019,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period: not specified
PRYA.12MO.M,ZWE,2011,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period: not specified
PRYA.12MO.M,ZWE,2014,Source:Data sources,ZWE - LFS - Labour Force Survey - Repository: ILO-STATISTICS - Micro data processing | Age coverage - minimum age: 15 years old | Age coverage - maximum age: None. Reference period: not specified
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 1bf8830

Please sign in to comment.