instance_id
stringlengths 10
57
| base_commit
stringlengths 40
40
| created_at
stringdate 2014-04-30 14:58:36
2025-04-30 20:14:11
| environment_setup_commit
stringlengths 40
40
| hints_text
stringlengths 0
273k
| patch
stringlengths 251
7.06M
| problem_statement
stringlengths 11
52.5k
| repo
stringlengths 7
53
| test_patch
stringlengths 231
997k
| meta
dict | version
stringclasses 864
values | install_config
dict | requirements
stringlengths 93
34.2k
⌀ | environment
stringlengths 760
20.5k
⌀ | FAIL_TO_PASS
listlengths 1
9.39k
| FAIL_TO_FAIL
listlengths 0
2.69k
| PASS_TO_PASS
listlengths 0
7.87k
| PASS_TO_FAIL
listlengths 0
192
| license_name
stringclasses 56
values | docker_image
stringlengths 42
89
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0b01001001__spectree-64
|
a091fab020ac26548250c907bae0855273a98778
|
2020-10-12 13:21:50
|
a091fab020ac26548250c907bae0855273a98778
|
diff --git a/setup.py b/setup.py
index 1b3cb64..4ef21e6 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
setup(
name='spectree',
- version='0.3.7',
+ version='0.3.8',
author='Keming Yang',
author_email='[email protected]',
description=('generate OpenAPI document and validate request&response '
diff --git a/spectree/utils.py b/spectree/utils.py
index bb5698d..73d6c71 100644
--- a/spectree/utils.py
+++ b/spectree/utils.py
@@ -54,6 +54,7 @@ def parse_params(func, params, models):
'in': 'query',
'schema': schema,
'required': name in query.get('required', []),
+ 'description': schema.get('description', ''),
})
if hasattr(func, 'headers'):
@@ -64,6 +65,7 @@ def parse_params(func, params, models):
'in': 'header',
'schema': schema,
'required': name in headers.get('required', []),
+ 'description': schema.get('description', ''),
})
if hasattr(func, 'cookies'):
@@ -74,6 +76,7 @@ def parse_params(func, params, models):
'in': 'cookie',
'schema': schema,
'required': name in cookies.get('required', []),
+ 'description': schema.get('description', ''),
})
return params
|
[BUG]description for query paramters can not show in swagger ui
Hi, when I add a description for a schema used in query, it can not show in swagger ui but can show in Redoc
```py
@HELLO.route('/', methods=['GET'])
@api.validate(query=HelloForm)
def hello():
"""
hello 注释
:return:
"""
return 'ok'
class HelloForm(BaseModel):
"""
hello表单
"""
user: str # 用户名称
msg: str = Field(description='msg test', example='aa')
index: int
data: HelloGetListForm
list: List[HelloListForm]
```


|
0b01001001/spectree
|
diff --git a/tests/common.py b/tests/common.py
index 0f2d696..83b4140 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -1,7 +1,7 @@
from enum import IntEnum, Enum
from typing import List
-from pydantic import BaseModel, root_validator
+from pydantic import BaseModel, root_validator, Field
class Order(IntEnum):
@@ -43,7 +43,7 @@ class Cookies(BaseModel):
class DemoModel(BaseModel):
uid: int
limit: int
- name: str
+ name: str = Field(..., description='user name')
def get_paths(spec):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index bf3426d..53dd3e1 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -98,8 +98,10 @@ def test_parse_params():
'name': 'uid',
'in': 'query',
'required': True,
+ 'description': '',
'schema': {
'title': 'Uid',
'type': 'integer',
}
}
+ assert params[2]['description'] == 'user name'
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[flask,falcon,starlette]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
annotated-types==0.7.0
anyio==4.9.0
blinker==1.9.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
exceptiongroup==1.2.2
falcon==4.0.2
Flask==3.1.0
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
itsdangerous==2.2.0
Jinja2==3.1.6
MarkupSafe==3.0.2
packaging==24.2
pluggy==1.5.0
pydantic==2.11.1
pydantic_core==2.33.0
pytest==8.3.5
requests==2.32.3
sniffio==1.3.1
-e git+https://github.com/0b01001001/spectree.git@a091fab020ac26548250c907bae0855273a98778#egg=spectree
starlette==0.46.1
tomli==2.2.1
typing-inspection==0.4.0
typing_extensions==4.13.0
urllib3==2.3.0
Werkzeug==3.1.3
zipp==3.21.0
|
name: spectree
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- annotated-types==0.7.0
- anyio==4.9.0
- blinker==1.9.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- exceptiongroup==1.2.2
- falcon==4.0.2
- flask==3.1.0
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- itsdangerous==2.2.0
- jinja2==3.1.6
- markupsafe==3.0.2
- packaging==24.2
- pluggy==1.5.0
- pydantic==2.11.1
- pydantic-core==2.33.0
- pytest==8.3.5
- requests==2.32.3
- sniffio==1.3.1
- starlette==0.46.1
- tomli==2.2.1
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- urllib3==2.3.0
- werkzeug==3.1.3
- zipp==3.21.0
prefix: /opt/conda/envs/spectree
|
[
"tests/test_utils.py::test_parse_params"
] |
[] |
[
"tests/test_utils.py::test_comments",
"tests/test_utils.py::test_parse_code",
"tests/test_utils.py::test_parse_name",
"tests/test_utils.py::test_has_model",
"tests/test_utils.py::test_parse_resp",
"tests/test_utils.py::test_parse_request"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.0b01001001_1776_spectree-64
|
|
12rambau__sepal_ui-347
|
4554f35da3fab21c32c35c4bd557ecfdec9c60c5
|
2021-11-19 12:32:22
|
114063b50ee5b1ccbab680424bb048e11939b870
|
diff --git a/sepal_ui/mapping/__init__.py b/sepal_ui/mapping/__init__.py
index 7f72a0eb..aa84ddee 100644
--- a/sepal_ui/mapping/__init__.py
+++ b/sepal_ui/mapping/__init__.py
@@ -2,6 +2,7 @@ from .aoi_control import *
from .draw_control import *
from .fullscreen_control import *
from .layer import *
+from .layer_state_control import *
from .map_btn import *
from .sepal_map import *
from .value_inspector import *
diff --git a/sepal_ui/mapping/layer_state_control.py b/sepal_ui/mapping/layer_state_control.py
new file mode 100644
index 00000000..eff80080
--- /dev/null
+++ b/sepal_ui/mapping/layer_state_control.py
@@ -0,0 +1,99 @@
+from traitlets import Int, observe
+from ipyleaflet import WidgetControl
+
+from sepal_ui import sepalwidgets as sw
+from sepal_ui.message import ms
+
+
+class LayerStateControl(WidgetControl):
+ """
+ A specific statebar dedicated to the the counting of loading tiles in the map
+
+ every time a map is added to the map the counter will be raised by one. same behaviour with removed.
+ """
+
+ m = None
+ "SepalMap: the map connected to the control"
+
+ w_state = None
+ "sw.StateBar: the stateBar displaying the number of layer loading on the map"
+
+ nb_layer = Int(0).tag(sync=True)
+ "Int: the number of layers in the map"
+
+ nb_loading_layer = Int(0).tag(sync=True)
+ "Int: the number of loading layer in the map"
+
+ def __init__(self, m, **kwargs):
+
+ # save the map as a member of the widget
+ self.m = m
+
+ # create a statebar
+ msg = ms.layer_state.complete.format(self.nb_layer)
+ self.w_state = sw.StateBar(loading=False, msg=msg)
+
+ # overwrite the widget set in the kwargs (if any)
+ kwargs["widget"] = self.w_state
+ kwargs["position"] = kwargs.pop("position", "topleft")
+ kwargs["transparent_bg"] = True
+
+ # create the widget
+ super().__init__(**kwargs)
+
+ # add js behaviour
+ self.m.observe(self.update_nb_layer, "layers")
+
+ def update_nb_layer(self, change):
+ """
+ Update the number of layer monitored by the statebar
+ """
+
+ # exit if nothing changed
+ # for example we change a layer parameters and it trigger this one
+ if len(change["new"]) == len(change["old"]):
+ return
+
+ self.nb_layer = len([lyr for lyr in change["new"] if not lyr.base])
+
+ # identify the modified layer
+ modified_layer = list(set(change["new"]) ^ set(change["old"]))[0]
+ if modified_layer.base is True:
+ return
+
+ # add a layer
+ if len(change["new"]) > len(change["old"]):
+ modified_layer.observe(self.update_loading, "loading")
+
+ # remove a layer
+ elif len(change["new"]) < len(change["old"]):
+ # the test is splitted as not all the layers have a loading trait
+ if hasattr(modified_layer, "loading") is True:
+ if modified_layer.loading is True:
+ self.nb_loading_layer += -1
+
+ return
+
+ def update_loading(self, change):
+ """update the nb_loading_layer value according to the number of tile loading on the map"""
+
+ increment = [-1, 1]
+ self.nb_loading_layer += increment[change["new"]]
+
+ return
+
+ @observe("nb_loading_layer", "nb_layer")
+ def _update_state(self, change):
+
+ # check if anything is loading
+ self.loading = bool(self.nb_loading_layer)
+
+ # update the message
+ if self.loading is True:
+ msg = ms.layer_state.loading.format(self.nb_loading_layer, self.nb_layer)
+ else:
+ msg = ms.layer_state.complete.format(self.nb_layer)
+
+ self.w_state.msg = msg
+
+ return
diff --git a/sepal_ui/mapping/sepal_map.py b/sepal_ui/mapping/sepal_map.py
index e2860daf..4ef41d1a 100644
--- a/sepal_ui/mapping/sepal_map.py
+++ b/sepal_ui/mapping/sepal_map.py
@@ -31,6 +31,7 @@ import sepal_ui.frontend.styles as styles
from sepal_ui.mapping.basemaps import basemap_tiles
from sepal_ui.mapping.draw_control import DrawControl
from sepal_ui.mapping.layer import EELayer
+from sepal_ui.mapping.layer_state_control import LayerStateControl
from sepal_ui.mapping.value_inspector import ValueInspector
from sepal_ui.message import ms
from sepal_ui.scripts import utils as su
@@ -55,6 +56,7 @@ class SepalMap(ipl.Map):
dc (bool, optional): wether or not the drawing control should be displayed. default to false
vinspector (bool, optional): Add value inspector to map, useful to inspect pixel values. default to false
gee (bool, optional): wether or not to use the ee binding. If False none of the earthengine display fonctionalities can be used. default to True
+ statebar (bool): wether or not to display the Statebar in the map
kwargs (optional): any parameter from a ipyleaflet.Map. if set, 'ee_initialize' will be overwritten.
"""
@@ -74,7 +76,18 @@ class SepalMap(ipl.Map):
_id = None
"str: a unique 6 letters str to identify the map in the DOM"
- def __init__(self, basemaps=[], dc=False, vinspector=False, gee=True, **kwargs):
+ state = None
+ "sw.StateBar: the statebar to inform the user about tile loading"
+
+ def __init__(
+ self,
+ basemaps=[],
+ dc=False,
+ vinspector=False,
+ gee=True,
+ statebar=False,
+ **kwargs,
+ ):
# set the default parameters
kwargs["center"] = kwargs.pop("center", [0, 0])
@@ -114,6 +127,10 @@ class SepalMap(ipl.Map):
self.v_inspector = ValueInspector(self)
not vinspector or self.add_control(self.v_inspector)
+ # specific statebar
+ self.state = LayerStateControl(self)
+ not statebar or self.add_control(self.state)
+
# create a proxy ID to the element
# this id should be unique and will be used by mutators to identify this map
self._id = "".join(random.choice(string.ascii_lowercase) for i in range(6))
diff --git a/sepal_ui/message/en/layer_control.json b/sepal_ui/message/en/layer_control.json
new file mode 100644
index 00000000..2f90d41c
--- /dev/null
+++ b/sepal_ui/message/en/layer_control.json
@@ -0,0 +1,6 @@
+{
+ "layer_state": {
+ "loading": "loading {} layer(s) out of {}",
+ "complete": "{} layer(s) loaded"
+ }
+}
\ No newline at end of file
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index e143170e..6ad4d5d0 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -250,7 +250,7 @@ class Alert(v.Alert, SepalWidget):
return su.check_input(input_, msg)
-class StateBar(v.SystemBar):
+class StateBar(v.SystemBar, SepalWidget):
"""Widget to display quick messages on simple inline status bar
|
display a loading statebar when a layer is loading in the map
## issue
I experienced some issues with the FCDM module as the map is super slow to load (it uses a adaptative buffer, the more you zoom the slower it gets it's a nightmare). The consequence is that the user clicks frantically on the `zoom` `unzoom` btn and the layer never fully loads and they eventually break the app.
I've looked into the loading widgets that exists in ipyleaflet and that's not very elegant (from my perspective).
## current implementation
I came up with the idea of overwriting the `add_layer` method to add a `StateBar` at the top left corner for every layer and dynamically show them when the tile are reloading. overwritting the `add_layer` method is super versatile as it's the basic function called by all the others (`add_ee_layer`, `addLayer`, `add_raster_layer` ... etc).
- user doesn't change anything in the way object are added to the map
- each time you add a layer, it adds a statebar writting "loading \<whatever\>"
- the statebare is shown whenever the layer is loading (thank you traitlets)
## questions
- should we remove them when the layer is removed (overwritting remove_layer as well) ?
- should the statebar always be displayed (and instead of changing viz, we could change loading trait) ?
- do you think it could be useful in general ?
## demo
Here is a gif demo and the the code I used.

```python
from sepal_ui.mapping import SepalMap
from sepal_ui import sepalwidgets as sw
from ipyleaflet import WidgetControl
import ee
ee.Initialize()
# create a custom statebar
class StateBar(sw.StateBar):
def __init__(self, **kwargs):
name = kwargs.pop("layer", "layer")
kwargs["_metadata"] = {"layer": name}
super().__init__(**kwargs)
self.msg = f"Loading {name}"
self.loading = True
def activate(self, change):
if change['new']:
self.show()
else:
self.hide()
return
# define a custom Map class
class Map(SepalMap):
layer_state_list = []
def add_layer(self, l):
# call the original function
super().add_layer(l)
# add a layer state object
state = StateBar(layer=l.name)
self.layer_state_list += [state]
self.add_control(WidgetControl(widget=state, position='topleft'))
# link it to the layer state
#layer = next(l for l in self.layers if l.name == name)
l.observe(state.activate, "loading")
return
# create the map and zoom on congo
test_map = Map()
test_map.zoom = 10
test_map.center = [5.703447982149503, 28.32275390625]
# load hansen & al ddataset
dataset = ee.Image('UMD/hansen/global_forest_change_2020_v1_8')
treeCoverVisParam = {
"bands": ['treecover2000'],
"min": 0,
"max": 100,
"palette": ['black', 'green']
}
test_map.addLayer(dataset, treeCoverVisParam, 'tree cover')
# load the S2 RGB product (SR)
def maskS2clouds(image):
qa = image.select('QA60');
# Bits 10 and 11 are clouds and cirrus, respectively.
cloudBitMask = 1 << 10;
cirrusBitMask = 1 << 11;
# Both flags should be set to zero, indicating clear conditions.
mask = (
qa
.bitwiseAnd(cloudBitMask).eq(0)
.And(qa.bitwiseAnd(cirrusBitMask).eq(0))
)
return image.updateMask(mask).divide(10000)
dataset = (
ee.ImageCollection('COPERNICUS/S2_SR')
.filterDate('2020-01-01', '2020-01-30')
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE',20))
.map(maskS2clouds)
)
visualization = {
"min": 0.0,
"max": 0.3,
"bands": ['B4', 'B3', 'B2'],
}
test_map.addLayer(dataset.mean(), visualization, 'RGB')
# display the map
test_map
```
|
12rambau/sepal_ui
|
diff --git a/tests/test_LayerStateControl.py b/tests/test_LayerStateControl.py
new file mode 100644
index 00000000..ce2aecb2
--- /dev/null
+++ b/tests/test_LayerStateControl.py
@@ -0,0 +1,84 @@
+from ipyleaflet import RasterLayer
+from traitlets import Bool
+import ee
+import pytest
+
+from sepal_ui import mapping as sm
+from sepal_ui.scripts import utils as su
+
+
+class TestLayerStateControl:
+ def test_init(self):
+
+ m = sm.SepalMap()
+ state = sm.LayerStateControl(m)
+ m.add_control(state)
+
+ assert isinstance(state, sm.LayerStateControl)
+ assert state.w_state.loading is False
+
+ return
+
+ @su.need_ee
+ def test_update_nb_layer(self, map_with_layers):
+
+ # create the map and controls
+ m = map_with_layers
+ state = next(c for c in m.controls if isinstance(c, sm.LayerStateControl))
+
+ # TODO I don't know how to check state changes but I can at least check the conclusion
+ assert state.w_state.msg == "2 layer(s) loaded"
+
+ # remove a layer to update the nb_layer
+ m.remove_layer(-1)
+ assert state.w_state.msg == "1 layer(s) loaded"
+
+ return
+
+ def test_update_loading(self, map_with_layers):
+
+ # get the map and control
+ m = map_with_layers
+ state = next(c for c in m.controls if isinstance(c, sm.LayerStateControl))
+
+ # check that the parameter is updated with existing layers
+ m.layers[-1].loading = True
+ assert state.nb_loading_layer == 1
+ assert state.w_state.msg == "loading 1 layer(s) out of 2"
+
+ # check when this loading layer is removed
+ m.remove_layer(-1)
+ assert state.nb_loading_layer == 0
+ assert state.w_state.msg == "1 layer(s) loaded"
+
+ return
+
+ @pytest.fixture
+ def map_with_layers(self, fake_layer):
+ """create a map with 2 layers and a stateBar"""
+
+ # create the map and controls
+ m = sm.SepalMap()
+ state = sm.LayerStateControl(m)
+ m.add_control(state)
+
+ # add some ee_layer (loading very fast)
+ # world lights
+ dataset = ee.ImageCollection("NOAA/DMSP-OLS/CALIBRATED_LIGHTS_V4").filter(
+ ee.Filter.date("2010-01-01", "2010-12-31")
+ )
+ m.addLayer(dataset, {}, "Nighttime Lights")
+
+ # a fake layer with loading update possibilities
+ m.add_layer(fake_layer)
+
+ return m
+
+ @pytest.fixture
+ def fake_layer(self):
+ """create a layer from a fakelayer class that have only one parameter: the laoding trait"""
+
+ class FakeLayer(RasterLayer):
+ loading = Bool(False).tag(sync=True)
+
+ return FakeLayer()
diff --git a/tests/test_SepalMap.py b/tests/test_SepalMap.py
index 51f5a01a..30a0d3eb 100644
--- a/tests/test_SepalMap.py
+++ b/tests/test_SepalMap.py
@@ -51,6 +51,10 @@ class TestSepalMap:
m = sm.SepalMap(vinspector=True)
assert m.v_inspector in m.controls
+ # check that the map start with a statebar
+ m = sm.SepalMap(statebar=True)
+ assert m.state in m.controls
+
# check that a wrong layer raise an error if it's not part of the leaflet basemap list
with pytest.raises(Exception):
m = sm.SepalMap(["TOTO"])
diff --git a/tests/test_StateBar.py b/tests/test_StateBar.py
index 9eb3ab0f..0ed4ed5c 100644
--- a/tests/test_StateBar.py
+++ b/tests/test_StateBar.py
@@ -7,6 +7,7 @@ class TestStateBar:
# minimal state bar
state_bar = sw.StateBar()
assert len(state_bar.children) == 2
+ assert state_bar.viz is True
return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 3
}
|
2.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@4554f35da3fab21c32c35c4bd557ecfdec9c60c5#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_StateBar.py::TestStateBar::test_init"
] |
[
"tests/test_LayerStateControl.py::TestLayerStateControl::test_init",
"tests/test_SepalMap.py::TestSepalMap::test_init",
"tests/test_SepalMap.py::TestSepalMap::test_set_center",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_bounds",
"tests/test_SepalMap.py::TestSepalMap::test_add_colorbar",
"tests/test_SepalMap.py::TestSepalMap::test_add_ee_layer",
"tests/test_SepalMap.py::TestSepalMap::test_get_basemap_list",
"tests/test_SepalMap.py::TestSepalMap::test_get_viz_params",
"tests/test_SepalMap.py::TestSepalMap::test_add_layer",
"tests/test_SepalMap.py::TestSepalMap::test_add_basemap",
"tests/test_SepalMap.py::TestSepalMap::test_get_scale",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_raster"
] |
[
"tests/test_StateBar.py::TestStateBar::test_add_msg"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-411
|
179bd8d089275c54e94a7614be7ed03d298ef532
|
2022-02-28 17:46:40
|
97371fbaed444727126a2969cd68f856db77221f
|
diff --git a/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst b/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst
index 1a982afb..867227cb 100644
--- a/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst
+++ b/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst
@@ -8,6 +8,7 @@ sepal\_ui.sepalwidgets.DatePicker
.. autosummary::
~DatePicker.menu
+ ~DatePicker.disabled
.. rubric:: Methods
@@ -15,5 +16,8 @@ sepal\_ui.sepalwidgets.DatePicker
:nosignatures:
~Datepicker.close_menu
+ ~DatePicker.disable
-.. automethod:: sepal_ui.sepalwidgets.DatePicker.close_menu
\ No newline at end of file
+.. automethod:: sepal_ui.sepalwidgets.DatePicker.close_menu
+
+.. automethod:: sepal_ui.sepalwidgets.DatePicker.disable
\ No newline at end of file
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 3ad7f1a9..68b81746 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -1,7 +1,7 @@
from pathlib import Path
import ipyvuetify as v
-from traitlets import link, Int, Any, List, observe, Dict, Unicode
+from traitlets import link, Int, Any, List, observe, Dict, Unicode, Bool
from ipywidgets import jslink
import pandas as pd
import ee
@@ -40,6 +40,9 @@ class DatePicker(v.Layout, SepalWidget):
menu = None
"v.Menu: the menu widget to display the datepicker"
+ disabled = Bool(False).tag(sync=True)
+ "traitlets.Bool: the disabled status of the Datepicker object"
+
def __init__(self, label="Date", **kwargs):
# create the widgets
@@ -93,6 +96,14 @@ class DatePicker(v.Layout, SepalWidget):
return
+ @observe("disabled")
+ def disable(self, change):
+ """A method to disabled the appropriate components in the datipkcer object"""
+
+ self.menu.v_slots[0]["children"].disabled = self.disabled
+
+ return
+
class FileInput(v.Flex, SepalWidget):
"""
|
add a disabled trait on the datepicker
I'm currently coding it in a module and the process of disabling a datepicker is uterly boring. I think we could add an extra trait to the layout and pilot the enabling and disabling directly from the built-in widget
```python
self.w_start = sw.DatePicker(label="start", v_model=None)
# disable both the slots (hidden to everyone) and the menu
self.w_start.menu.v_slots[0]["children"].disabled = True
self.w_start.menu.disabled = True
```
|
12rambau/sepal_ui
|
diff --git a/tests/test_DatePicker.py b/tests/test_DatePicker.py
index f4c6d40e..e5f5d06f 100644
--- a/tests/test_DatePicker.py
+++ b/tests/test_DatePicker.py
@@ -35,6 +35,14 @@ class TestDatePicker:
return
+ def test_disable(self, datepicker):
+
+ for boolean in [True, False]:
+ datepicker.disabled = boolean
+ assert datepicker.menu.v_slots[0]["children"].disabled == boolean
+
+ return
+
@pytest.fixture
def datepicker(self):
"""create a default datepicker"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 2
}
|
2.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
bqplot==0.12.44
branca==0.4.2
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
colour==0.1.5
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
EditorConfig==0.17.0
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
ffmpeg-python==0.2.0
filelock==3.18.0
folium==0.13.0
fonttools==4.56.0
fqdn==1.5.1
future==1.0.0
geeadd==1.2.1
geemap==0.8.9
geocoder==1.38.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyevents==2.0.2
ipyfilechooser==0.6.0
ipykernel==6.29.5
ipyleaflet==0.13.3
ipynb-py-convert==0.4.6
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipytree==0.2.2
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsbeautifier==1.15.4
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
logzero==1.7.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
mss==10.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyCRS==1.0.2
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pyshp==2.3.1
pytest==8.3.5
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
ratelim==0.1.6
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@179bd8d089275c54e94a7614be7ed03d298ef532#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
whitebox==2.3.6
whiteboxgui==2.3.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- bqplot==0.12.44
- branca==0.4.2
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- colorama==0.4.6
- colour==0.1.5
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- editorconfig==0.17.0
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- ffmpeg-python==0.2.0
- filelock==3.18.0
- folium==0.13.0
- fonttools==4.56.0
- fqdn==1.5.1
- future==1.0.0
- geeadd==1.2.1
- geemap==0.8.9
- geocoder==1.38.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyevents==2.0.2
- ipyfilechooser==0.6.0
- ipykernel==6.29.5
- ipyleaflet==0.13.3
- ipynb-py-convert==0.4.6
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipytree==0.2.2
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsbeautifier==1.15.4
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- logzero==1.7.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- mss==10.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pycrs==1.0.2
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pyshp==2.3.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- ratelim==0.1.6
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- whitebox==2.3.6
- whiteboxgui==2.3.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_DatePicker.py::TestDatePicker::test_disable"
] |
[] |
[
"tests/test_DatePicker.py::TestDatePicker::test_init",
"tests/test_DatePicker.py::TestDatePicker::test_bind"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-411
|
|
12rambau__sepal_ui-416
|
8b76805db051d6d15024bd9ec2d78502cd92132e
|
2022-03-11 19:47:50
|
97371fbaed444727126a2969cd68f856db77221f
|
diff --git a/docs/source/modules/sepal_ui.sepalwidgets.DrawerItem.rst b/docs/source/modules/sepal_ui.sepalwidgets.DrawerItem.rst
index a3280cd3..22b87b44 100644
--- a/docs/source/modules/sepal_ui.sepalwidgets.DrawerItem.rst
+++ b/docs/source/modules/sepal_ui.sepalwidgets.DrawerItem.rst
@@ -7,7 +7,9 @@ sepal\_ui.sepalwidgets.DrawerItem
.. autosummary::
- ~DrawerItem.rt
+ ~DrawerItem.rt
+ ~DrawerItem.alert
+ ~DrawerItem.alert_badge
.. rubric:: Methods
@@ -15,5 +17,11 @@ sepal\_ui.sepalwidgets.DrawerItem
:nosignatures:
~DrawerItem.display_tile
+ ~DrawerItem.add_notif
+ ~DrawerItem.remove_notif
-.. automethod:: sepal_ui.sepalwidgets.DrawerItem.display_tile
\ No newline at end of file
+.. automethod:: sepal_ui.sepalwidgets.DrawerItem.display_tile
+
+.. automethod:: sepal_ui.sepalwidgets.DrawerItem.add_notif
+
+.. automethod:: sepal_ui.sepalwidgets.DrawerItem.remove_notif
\ No newline at end of file
diff --git a/sepal_ui/sepalwidgets/app.py b/sepal_ui/sepalwidgets/app.py
index a1aff843..2a87de83 100644
--- a/sepal_ui/sepalwidgets/app.py
+++ b/sepal_ui/sepalwidgets/app.py
@@ -1,3 +1,4 @@
+from traitlets import link, Bool, observe
from functools import partial
from datetime import datetime
@@ -73,12 +74,29 @@ class DrawerItem(v.ListItem, SepalWidget):
card (str, optional): the mount_id of tiles in the app
href (str, optional): the absolute link to an external web page
kwargs (optional): any parameter from a v.ListItem. If set, '_metadata', 'target', 'link' and 'children' will be overwritten.
+ model (optional): sepalwidget model where is defined the bin_var trait
+ bind_var (optional): required when model is selected. Trait to link with 'alert' self trait parameter
"""
rt = None
"sw.ResizeTrigger: the trigger to resize maps and other javascript object when jumping from a tile to another"
- def __init__(self, title, icon=None, card=None, href=None, **kwargs):
+ alert = Bool(False).tag(sync=True)
+ "Bool: trait to control visibility of an alert in the drawer item"
+
+ alert_badge = None
+ "v.ListItemAction: red circle to display in the drawer"
+
+ def __init__(
+ self,
+ title,
+ icon=None,
+ card=None,
+ href=None,
+ model=None,
+ bind_var=None,
+ **kwargs
+ ):
# set the resizetrigger
self.rt = js.rt
@@ -108,6 +126,45 @@ class DrawerItem(v.ListItem, SepalWidget):
# call the constructor
super().__init__(**kwargs)
+ # cannot be set as a class member because it will be shared with all
+ # the other draweritems.
+ self.alert_badge = v.ListItemAction(
+ children=[v.Icon(children=["fas fa-circle"], x_small=True, color="red")]
+ )
+
+ if model:
+ if not bind_var:
+ raise Exception(
+ "You have selected a model, you need a trait to bind with drawer."
+ )
+
+ link((model, bind_var), (self, "alert"))
+
+ @observe("alert")
+ def add_notif(self, change):
+ """Add a notification alert to drawer"""
+
+ if change["new"]:
+ if self.alert_badge not in self.children:
+ new_children = self.children[:]
+ new_children.append(self.alert_badge)
+ self.children = new_children
+ else:
+ self.remove_notif()
+
+ return
+
+ def remove_notif(self):
+ """Remove notification alert"""
+
+ if self.alert_badge in self.children:
+ new_children = self.children[:]
+ new_children.remove(self.alert_badge)
+
+ self.children = new_children
+
+ return
+
def display_tile(self, tiles):
"""
Display the apropriate tiles when the item is clicked.
@@ -138,6 +195,9 @@ class DrawerItem(v.ListItem, SepalWidget):
# change the current item status
self.input_value = True
+ # Remove notification
+ self.remove_notif()
+
return self
|
Interact with navigation drawers
Sometimes is useful to pass some data from the module model to the app environment and so far we do not have this implementation.
We can add two simple methods to the drawers so they can update their state with icons, badges, and so.
|
12rambau/sepal_ui
|
diff --git a/tests/test_DrawerItem.py b/tests/test_DrawerItem.py
index ad26c3a2..0e80ffc9 100644
--- a/tests/test_DrawerItem.py
+++ b/tests/test_DrawerItem.py
@@ -1,3 +1,6 @@
+import pytest
+from sepal_ui.model import Model
+from traitlets import Bool
import ipyvuetify as v
from sepal_ui import sepalwidgets as sw
@@ -60,3 +63,32 @@ class TestDrawerItem:
assert tile.viz is False
return
+
+ @pytest.fixture
+ def model(self):
+ class TestModel(Model):
+ app_ready = Bool(False).tag(sync=True)
+
+ return TestModel()
+
+ def test_add_notif(self, model):
+
+ drawer_item = sw.DrawerItem("title", model=model, bind_var="app_ready")
+
+ model.app_ready = True
+
+ assert drawer_item.alert_badge in drawer_item.children
+
+ model.app_ready = False
+
+ assert drawer_item.alert_badge not in drawer_item.children
+
+ def test_remove_notif(self, model):
+
+ drawer_item = sw.DrawerItem("title", model=model, bind_var="app_ready")
+
+ model.app_ready = True
+
+ drawer_item.remove_notif()
+
+ assert drawer_item.alert_badge not in drawer_item.children
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 2
}
|
2.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
bqplot==0.12.44
branca==0.4.2
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
colour==0.1.5
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
EditorConfig==0.17.0
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
ffmpeg-python==0.2.0
filelock==3.18.0
folium==0.13.0
fonttools==4.56.0
fqdn==1.5.1
future==1.0.0
geeadd==1.2.1
geemap==0.8.9
geocoder==1.38.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyevents==2.0.2
ipyfilechooser==0.6.0
ipykernel==6.29.5
ipyleaflet==0.13.3
ipynb-py-convert==0.4.6
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipytree==0.2.2
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsbeautifier==1.15.4
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
logzero==1.7.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
mss==10.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyCRS==1.0.2
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pyshp==2.3.1
pytest==8.3.5
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
ratelim==0.1.6
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@8b76805db051d6d15024bd9ec2d78502cd92132e#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
whitebox==2.3.6
whiteboxgui==2.3.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- bqplot==0.12.44
- branca==0.4.2
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- colorama==0.4.6
- colour==0.1.5
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- editorconfig==0.17.0
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- ffmpeg-python==0.2.0
- filelock==3.18.0
- folium==0.13.0
- fonttools==4.56.0
- fqdn==1.5.1
- future==1.0.0
- geeadd==1.2.1
- geemap==0.8.9
- geocoder==1.38.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyevents==2.0.2
- ipyfilechooser==0.6.0
- ipykernel==6.29.5
- ipyleaflet==0.13.3
- ipynb-py-convert==0.4.6
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipytree==0.2.2
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsbeautifier==1.15.4
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- logzero==1.7.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- mss==10.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pycrs==1.0.2
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pyshp==2.3.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- ratelim==0.1.6
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- whitebox==2.3.6
- whiteboxgui==2.3.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_DrawerItem.py::TestDrawerItem::test_add_notif",
"tests/test_DrawerItem.py::TestDrawerItem::test_remove_notif"
] |
[] |
[
"tests/test_DrawerItem.py::TestDrawerItem::test_init_cards",
"tests/test_DrawerItem.py::TestDrawerItem::test_display_tile"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-418
|
8b76805db051d6d15024bd9ec2d78502cd92132e
|
2022-03-14 14:24:04
|
97371fbaed444727126a2969cd68f856db77221f
|
diff --git a/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst b/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst
index 867227cb..322cca23 100644
--- a/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst
+++ b/docs/source/modules/sepal_ui.sepalwidgets.DatePicker.rst
@@ -9,6 +9,7 @@ sepal\_ui.sepalwidgets.DatePicker
~DatePicker.menu
~DatePicker.disabled
+ ~DatePicker.date_text
.. rubric:: Methods
@@ -17,7 +18,13 @@ sepal\_ui.sepalwidgets.DatePicker
~Datepicker.close_menu
~DatePicker.disable
+ ~DatePicker.is_valid_date
+ ~DatePicker.check_date
.. automethod:: sepal_ui.sepalwidgets.DatePicker.close_menu
-.. automethod:: sepal_ui.sepalwidgets.DatePicker.disable
\ No newline at end of file
+.. automethod:: sepal_ui.sepalwidgets.DatePicker.disable
+
+.. automethod:: sepal_ui.sepalwidgets.DatePicker.check_date
+
+.. autofunction:: sepal_ui.sepalwidgets.DatePicker.disable
\ No newline at end of file
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 7d003229..bf1adf0b 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -1,4 +1,5 @@
from pathlib import Path
+from datetime import datetime
import ipyvuetify as v
from traitlets import link, Int, Any, List, observe, Dict, Unicode, Bool
@@ -40,6 +41,9 @@ class DatePicker(v.Layout, SepalWidget):
menu = None
"v.Menu: the menu widget to display the datepicker"
+ date_text = None
+ "v.TextField: the text field of the datepicker widget"
+
disabled = Bool(False).tag(sync=True)
"traitlets.Bool: the disabled status of the Datepicker object"
@@ -48,7 +52,7 @@ class DatePicker(v.Layout, SepalWidget):
# create the widgets
date_picker = v.DatePicker(no_title=True, v_model=None, scrollable=True)
- date_text = v.TextField(
+ self.date_text = v.TextField(
v_model=None,
label=label,
hint="YYYY-MM-DD format",
@@ -69,7 +73,7 @@ class DatePicker(v.Layout, SepalWidget):
{
"name": "activator",
"variable": "menuData",
- "children": date_text,
+ "children": self.date_text,
}
],
)
@@ -84,8 +88,28 @@ class DatePicker(v.Layout, SepalWidget):
# call the constructor
super().__init__(**kwargs)
- jslink((date_picker, "v_model"), (date_text, "v_model"))
- jslink((date_picker, "v_model"), (self, "v_model"))
+ jslink((date_picker, "v_model"), (self.date_text, "v_model"))
+ jslink((self, "v_model"), (date_picker, "v_model"))
+
+ @observe("v_model")
+ def check_date(self, change):
+ """
+ A method to check if the value of the set v_model is a correctly formated date
+ Reset the widget and display an error if it's not the case
+ """
+
+ self.date_text.error_messages = None
+
+ # exit immediately if nothing is set
+ if change["new"] is None:
+ return
+
+ # change the error status
+ if not self.is_valid_date(change["new"]):
+ msg = self.date_text.hint
+ self.date_text.error_messages = msg
+
+ return
@observe("v_model")
def close_menu(self, change):
@@ -104,6 +128,27 @@ class DatePicker(v.Layout, SepalWidget):
return
+ @staticmethod
+ def is_valid_date(date):
+ """
+ Check if the date is provided using the date format required for the widget
+
+ Args:
+ date (str): the date to test in YYYY-MM-DD format
+
+ Return:
+ (bool): the date to test
+ """
+
+ try:
+ date = datetime.strptime(date, "%Y-%m-%d")
+ valid = True
+
+ except Exception:
+ valid = False
+
+ return valid
+
class FileInput(v.Flex, SepalWidget):
"""
|
Can't instantiate a sw.DatePicker with initial v_model
Is not possible to instantiate the sepal DatePicker with an initially given date through the `v_model` parameter
|
12rambau/sepal_ui
|
diff --git a/tests/test_DatePicker.py b/tests/test_DatePicker.py
index e5f5d06f..48993736 100644
--- a/tests/test_DatePicker.py
+++ b/tests/test_DatePicker.py
@@ -17,6 +17,11 @@ class TestDatePicker:
datepicker = sw.DatePicker("toto")
assert isinstance(datepicker, sw.DatePicker)
+ # datepicker with default value
+ value = "2022-03-14"
+ datepicker = sw.DatePicker(v_model=value)
+ assert datepicker.v_model == value
+
return
def test_bind(self, datepicker):
@@ -43,6 +48,34 @@ class TestDatePicker:
return
+ def test_is_valid_date(self, datepicker):
+
+ # a nicely shaped date
+ test = "2022-03-14"
+ assert datepicker.is_valid_date(test) is True
+
+ # a badly shaped date
+ test = "2022-50-14"
+ assert datepicker.is_valid_date(test) is False
+
+ return
+
+ def test_check_date(self, datepicker):
+
+ # manually update the value with a badely shaped date
+ test = "2022-50-14"
+ datepicker.v_model = test
+ assert datepicker.v_model == test
+ assert datepicker.date_text.error_messages is not None
+
+ # manually update the value with a nicely shaped date
+ test = "2022-03-14"
+ datepicker.v_model = test
+ assert datepicker.v_model == test
+ assert datepicker.date_text.error_messages is None
+
+ return
+
@pytest.fixture
def datepicker(self):
"""create a default datepicker"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
2.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
bqplot==0.12.44
branca==0.4.2
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
colour==0.1.5
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
EditorConfig==0.17.0
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
ffmpeg-python==0.2.0
filelock==3.18.0
folium==0.13.0
fonttools==4.56.0
fqdn==1.5.1
future==1.0.0
geeadd==1.2.1
geemap==0.8.9
geocoder==1.38.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyevents==2.0.2
ipyfilechooser==0.6.0
ipykernel==6.29.5
ipyleaflet==0.13.3
ipynb-py-convert==0.4.6
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipytree==0.2.2
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsbeautifier==1.15.4
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
logzero==1.7.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
mss==10.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyCRS==1.0.2
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pyshp==2.3.1
pytest==8.3.5
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
ratelim==0.1.6
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@8b76805db051d6d15024bd9ec2d78502cd92132e#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
whitebox==2.3.6
whiteboxgui==2.3.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- bqplot==0.12.44
- branca==0.4.2
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- colorama==0.4.6
- colour==0.1.5
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- editorconfig==0.17.0
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- ffmpeg-python==0.2.0
- filelock==3.18.0
- folium==0.13.0
- fonttools==4.56.0
- fqdn==1.5.1
- future==1.0.0
- geeadd==1.2.1
- geemap==0.8.9
- geocoder==1.38.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyevents==2.0.2
- ipyfilechooser==0.6.0
- ipykernel==6.29.5
- ipyleaflet==0.13.3
- ipynb-py-convert==0.4.6
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipytree==0.2.2
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsbeautifier==1.15.4
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- logzero==1.7.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- mss==10.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pycrs==1.0.2
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pyshp==2.3.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- ratelim==0.1.6
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- whitebox==2.3.6
- whiteboxgui==2.3.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_DatePicker.py::TestDatePicker::test_is_valid_date",
"tests/test_DatePicker.py::TestDatePicker::test_check_date"
] |
[] |
[
"tests/test_DatePicker.py::TestDatePicker::test_init",
"tests/test_DatePicker.py::TestDatePicker::test_bind",
"tests/test_DatePicker.py::TestDatePicker::test_disable"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-419
|
97371fbaed444727126a2969cd68f856db77221f
|
2022-03-15 11:14:02
|
97371fbaed444727126a2969cd68f856db77221f
|
diff --git a/docs/source/modules/sepal_ui.rst b/docs/source/modules/sepal_ui.rst
index 366a3fb2..2650327b 100644
--- a/docs/source/modules/sepal_ui.rst
+++ b/docs/source/modules/sepal_ui.rst
@@ -24,3 +24,11 @@ Content
sepal_ui.theme
sepal_ui.color
sepal_ui.config_file
+
+.. rubric:: Attributes
+
+.. autosummary::
+
+ sepal_ui.get_theme
+
+.. autofunction:: sepal_ui.get_theme
diff --git a/docs/source/modules/sepal_ui.scripts.utils.rst b/docs/source/modules/sepal_ui.scripts.utils.rst
index d4a30a14..6c404e8a 100644
--- a/docs/source/modules/sepal_ui.scripts.utils.rst
+++ b/docs/source/modules/sepal_ui.scripts.utils.rst
@@ -23,6 +23,7 @@ sepal\_ui.scripts.utils
switch
to_colors
set_config_locale
+ set_config_theme
.. autofunction:: sepal_ui.scripts.utils.catch_errors
@@ -54,6 +55,8 @@ sepal\_ui.scripts.utils
.. autofunction:: sepal_ui.scripts.utils.set_config_locale
+.. autofunction:: sepal_ui.scripts.utils.set_config_theme
+
diff --git a/docs/source/modules/sepal_ui.sepalwidgets.AppBar.rst b/docs/source/modules/sepal_ui.sepalwidgets.AppBar.rst
index 3787c444..011eae2b 100644
--- a/docs/source/modules/sepal_ui.sepalwidgets.AppBar.rst
+++ b/docs/source/modules/sepal_ui.sepalwidgets.AppBar.rst
@@ -10,6 +10,7 @@ sepal\_ui.sepalwidgets.AppBar
~AppBar.toogle_button
~AppBar.title
~AppBar.locale
+ ~AppBar.theme
.. rubric:: Methods
diff --git a/docs/source/modules/sepal_ui.sepalwidgets.ThemeSelect.rst b/docs/source/modules/sepal_ui.sepalwidgets.ThemeSelect.rst
new file mode 100644
index 00000000..5c4e14d0
--- /dev/null
+++ b/docs/source/modules/sepal_ui.sepalwidgets.ThemeSelect.rst
@@ -0,0 +1,21 @@
+sepal\_ui.sepalwidgets.ThemeSelect
+==================================
+
+.. autoclass:: sepal_ui.sepalwidgets.ThemeSelect
+
+ .. rubric:: Attributes
+
+ .. autosummary::
+
+ ~ThemeSelect.THEME_ICONS
+ ~ThemeSelect.theme
+
+ .. rubric:: Methods
+
+ .. autosummary::
+ :nosignatures:
+
+ ~ThemeSelect.toggle_theme
+
+.. automethod:: sepal_ui.sepalwidgets.ThemeSelect.toggle_theme
+
\ No newline at end of file
diff --git a/docs/source/modules/sepal_ui.sepalwidgets.rst b/docs/source/modules/sepal_ui.sepalwidgets.rst
index b1bc9ef1..9d0c6864 100644
--- a/docs/source/modules/sepal_ui.sepalwidgets.rst
+++ b/docs/source/modules/sepal_ui.sepalwidgets.rst
@@ -33,3 +33,4 @@ sepal\_ui.sepalwidgets
sepal_ui.sepalwidgets.Tooltip
sepal_ui.sepalwidgets.VectorField
sepal_ui.sepalwidgets.LocaleSelect
+ sepal_ui.sepalwidgets.ThemeSelect
diff --git a/sepal_ui/__init__.py b/sepal_ui/__init__.py
index 69eccad6..bf79e175 100644
--- a/sepal_ui/__init__.py
+++ b/sepal_ui/__init__.py
@@ -1,18 +1,49 @@
+from types import SimpleNamespace
+from pathlib import Path
+from configparser import ConfigParser
+
+import ipyvuetify as v
+
+from sepal_ui.frontend import styles
+
__author__ = """Pierrick Rambaud"""
__email__ = "[email protected]"
__version__ = "2.6.2"
-# direct access to colors
-from sepal_ui.frontend import styles
-import ipyvuetify as v
-from types import SimpleNamespace
-from pathlib import Path
-theme = v.theme.themes.dark if v.theme.dark else v.theme.themes.light
+def get_theme(config_file):
+ """
+ get the theme from the config file (default to dark)
+
+ Return:
+ (str): the theme to use
+ """
+
+ # init theme
+ theme = "dark"
+
+ # read the config file if existing
+ if config_file.is_file():
+ config = ConfigParser()
+ config.read(config_file)
+ theme = config.get("sepal-ui", "theme", fallback="dark")
+
+ # set vuetify theme
+ v.theme.dark = True if theme == "dark" else False
+
+ return theme
+
+
+config_file = Path.home() / ".sepal-ui-config"
+"Pathlib.Path: the configuration file generated by sepal-ui based application to save parameters as language or theme"
+
+theme = getattr(v.theme.themes, get_theme(config_file))
"traitlets: the theme used in sepal"
color = SimpleNamespace(
- bg=styles.bg_color,
+ main=theme.main,
+ darker=theme.darker,
+ bg=theme.bg_color,
primary=theme.primary,
accent=theme.accent,
secondary=theme.secondary,
@@ -20,8 +51,6 @@ color = SimpleNamespace(
info=theme.info,
warning=theme.warning,
error=theme.error,
+ menu=theme.menu,
)
-'SimpleNamespace: the colors of sepal. members are in the following list: "bg, primary, accent, secondary, success, info, warning, error". They will render according to the selected theme.'
-
-config_file = Path.home() / ".sepal-ui-config"
-"Pathlib.Path: the configuration file generated by sepal-ui based application to save parameters as language or theme"
+'SimpleNamespace: the colors of sepal. members are in the following list: "main, darker, bg, primary, accent, secondary, success, info, warning, error, menu". They will render according to the selected theme.'
diff --git a/sepal_ui/aoi/aoi_model.py b/sepal_ui/aoi/aoi_model.py
index d713e7b9..0ecfdd74 100644
--- a/sepal_ui/aoi/aoi_model.py
+++ b/sepal_ui/aoi/aoi_model.py
@@ -10,6 +10,7 @@ from ipyleaflet import GeoJSON
import geemap
import ee
+from sepal_ui import color
from sepal_ui.frontend.styles import AOI_STYLE
from sepal_ui.scripts import utils as su
from sepal_ui.scripts import gee
@@ -626,9 +627,12 @@ class AoiModel(Model):
for f in data["features"]:
f["properties"]["name"] = self.name
+ # adapt the style to the theme
+ style = {**AOI_STYLE, "color": color.success, "fillColor": color.success}
+
# create a GeoJSON object
self.ipygeojson = GeoJSON(
- data=data, style=AOI_STYLE, name="aoi", attribution="SEPA(c)"
+ data=data, style=style, name="aoi", attribution="SEPAL(c)"
)
return self.ipygeojson
diff --git a/sepal_ui/bin/module_theme b/sepal_ui/bin/module_theme
new file mode 100755
index 00000000..8d153333
--- /dev/null
+++ b/sepal_ui/bin/module_theme
@@ -0,0 +1,55 @@
+#!/usr/bin/python3
+
+from colorama import init, Fore, Style
+
+from sepal_ui.scripts import utils as su
+
+# init colors for all plateforms
+init()
+
+
+def check_theme(theme):
+ """
+ Check if the theme is a legit name
+
+ Return:
+ (bool)
+ """
+
+ themes = ["dark", "light"]
+
+ return theme in themes
+
+
+if __name__ == "__main__":
+
+ # welcome the user
+ print(Fore.YELLOW)
+ print("##########################################")
+ print("# #")
+ print("# SEPAL MODULE THEMING TOOL #")
+ print("# #")
+ print("##########################################")
+ print(Fore.RESET)
+ print(f"Welcome in the {Style.BRIGHT}module theming{Style.NORMAL} interface.")
+
+ # select a language
+ is_theme = False
+ while is_theme is False:
+
+ theme = input(f"{Fore.CYAN}Provide a theme name: \n{Fore.RESET}")
+ is_theme = check_theme(theme)
+
+ # display an error if the language does not exist
+ if is_theme is False:
+ print(
+ f'{Fore.RED} The provided theme name ("{theme}") is not a supported theme. {Fore.RESET}'
+ )
+
+ # write the new color code in the config file
+ su.set_config_theme(theme)
+
+ # display information
+ print(
+ f'{Fore.GREEN} The provided theme ("{theme}") has been set as default theme for all SEPAL applications.{Fore.RESET}'
+ )
diff --git a/sepal_ui/frontend/styles.py b/sepal_ui/frontend/styles.py
index cf4b2971..a48b3dea 100644
--- a/sepal_ui/frontend/styles.py
+++ b/sepal_ui/frontend/styles.py
@@ -2,24 +2,28 @@ from traitlets import Unicode
from IPython.display import display
import ipyvuetify as v
-# change vuetify theming
-v.theme.dark = True
-
# set the colors for the dark theme
-v.theme.themes.dark.primary = "#B3842E"
+v.theme.themes.dark.primary = "#b3842e"
v.theme.themes.dark.accent = "#a1458e"
v.theme.themes.dark.secondary = "#324a88"
-v.theme.themes.dark.success = "#3F802A"
-v.theme.themes.dark.info = "#79B1C9"
+v.theme.themes.dark.success = "#3f802a"
+v.theme.themes.dark.info = "#79b1c9"
v.theme.themes.dark.warning = "#b8721d"
-v.theme.themes.dark.error = "#A63228"
+v.theme.themes.dark.error = "#a63228"
-# fixed colors
-sepal_main = "#24221F"
-sepal_darker = "#1a1a1a"
+# fixed colors for drawer and appbar
+v.theme.themes.dark.main = "#24221f"
+v.theme.themes.light.main = "#2e7d32"
+v.theme.themes.dark.darker = "#1a1a1a"
+v.theme.themes.light.darker = "#005005"
# set the background
-bg_color = "#121212" if v.theme.dark else "#fff"
+v.theme.themes.dark.bg_color = "#121212"
+v.theme.themes.light.bg_color = "#fff"
+
+# set a specific color for menus
+v.theme.themes.dark.menu = "#424242"
+v.theme.themes.light.menu = "#fff"
class Styles(v.VuetifyTemplate):
@@ -49,30 +53,33 @@ class Styles(v.VuetifyTemplate):
styles = Styles()
display(styles)
-COMPONENTS = {
- "PROGRESS_BAR": {
- "color": "indigo",
- }
-}
-
# default styling of the aoi layer
AOI_STYLE = {
"stroke": True,
- "color": v.theme.themes.dark.success,
+ "color": "grey",
"weight": 2,
"opacity": 1,
"fill": True,
- "fillColor": v.theme.themes.dark.success,
+ "fillColor": "grey",
"fillOpacity": 0.4,
}
+# the colors are set as follow.
+# 1 (True): dark theme
+# 0 (false): light theme
+# This will need to be changed if we want to support more than 2 theme
+COMPONENTS = {
+ "PROGRESS_BAR": {
+ "color": ["#2196f3", "#3f51b5"],
+ }
+}
-_folder = {"color": "amber", "icon": "far fa-folder"}
-_table = {"color": "green accent-4", "icon": "far fa-table"}
-_vector = {"color": "deep-purple", "icon": "far fa-vector-square"}
-_other = {"color": "light-blue", "icon": "far fa-file"}
-_parent = {"color": "white", "icon": "far fa-folder-open"}
-_image = {"color": "deep-purple", "icon": "far fa-image"}
+_folder = {"color": ["#ffca28", "#ffc107"], "icon": "far fa-folder"}
+_table = {"color": ["#4caf50", "#00c853"], "icon": "far fa-table"}
+_vector = {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-vector-square"}
+_other = {"color": ["#00bcd4", "#03a9f4"], "icon": "far fa-file"}
+_parent = {"color": ["#424242", "#ffffff"], "icon": "far fa-folder-open"}
+_image = {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-image"}
ICON_TYPES = {
"": _folder,
diff --git a/sepal_ui/mapping/mapping.py b/sepal_ui/mapping/mapping.py
index ab44e84c..1dae10f3 100644
--- a/sepal_ui/mapping/mapping.py
+++ b/sepal_ui/mapping/mapping.py
@@ -100,7 +100,10 @@ class SepalMap(geemap.Map):
if len(basemaps):
[self.add_basemap(basemap) for basemap in set(basemaps)]
else:
- self.add_basemap("CartoDB.DarkMatter")
+ default_basemap = (
+ "CartoDB.DarkMatter" if v.theme.dark is True else "CartoDB.Positron"
+ )
+ self.add_basemap(default_basemap)
# add the base controls
self.clear_controls()
diff --git a/sepal_ui/message/en/locale.json b/sepal_ui/message/en/locale.json
index da5c4efc..c96a4857 100644
--- a/sepal_ui/message/en/locale.json
+++ b/sepal_ui/message/en/locale.json
@@ -155,7 +155,10 @@
}
},
"locale": {
- "change": "The locale \"{0}\" will now be used as default language in SEPAL apps. please restart the current application to take this change into account. Note that if \"{0}\" is not avalaible in another application, SEPAL will fallback to the closest possible language",
+ "change": "The locale \"{0}\" will now be used as default language in SEPAL apps. Please restart the current application to take this change into account. Note that if \"{0}\" is not avalaible in another application, SEPAL will fallback to the closest possible language",
"fallback": "The \"{0}\" locale is not available for this application. We will be using \"{1}\" instead. Please report to the maintainer if you want to add \"{0}\" to the suported languages."
+ },
+ "theme": {
+ "change": "The theme \"{0}\" will be used as default theme in SEPAL apps. Please restart the current application to take this change into account."
}
}
\ No newline at end of file
diff --git a/sepal_ui/scripts/utils.py b/sepal_ui/scripts/utils.py
index adbce606..2cd55df9 100644
--- a/sepal_ui/scripts/utils.py
+++ b/sepal_ui/scripts/utils.py
@@ -521,3 +521,31 @@ def set_config_locale(locale):
config.write(config_file.open("w"))
return
+
+
+@versionadded(version="2.7.0")
+def set_config_theme(theme):
+ """
+ Set the provided theme in the sepal-ui config file
+
+ Args:
+ theme (str): a theme name (currently supporting "dark" and "light")
+ """
+
+ config = ConfigParser()
+
+ # read the existing file if available
+ if config_file.is_file():
+ config.read(config_file)
+
+ # set the section if needed
+ if "sepal-ui" not in config.sections():
+ config.add_section("sepal-ui")
+
+ # set the value
+ config.set("sepal-ui", "theme", theme)
+
+ # save back the file
+ config.write(config_file.open("w"))
+
+ return
diff --git a/sepal_ui/sepalwidgets/app.py b/sepal_ui/sepalwidgets/app.py
index 2d26b7e1..15bcd5f2 100644
--- a/sepal_ui/sepalwidgets/app.py
+++ b/sepal_ui/sepalwidgets/app.py
@@ -2,20 +2,29 @@ from traitlets import link, Bool, observe
from functools import partial
from datetime import datetime
from pathlib import Path
+from itertools import cycle
import ipyvuetify as v
from deprecated.sphinx import versionadded
import pandas as pd
from ipywidgets import jsdlink
+import sepal_ui
from sepal_ui.sepalwidgets.sepalwidget import SepalWidget
from sepal_ui import color
-from sepal_ui.frontend.styles import sepal_main, sepal_darker
from sepal_ui.frontend import js
from sepal_ui.scripts import utils as su
from sepal_ui.message import ms
-__all__ = ["AppBar", "DrawerItem", "NavDrawer", "Footer", "App", "LocaleSelect"]
+__all__ = [
+ "AppBar",
+ "DrawerItem",
+ "NavDrawer",
+ "Footer",
+ "App",
+ "LocaleSelect",
+ "ThemeSelect",
+]
class AppBar(v.AppBar, SepalWidget):
@@ -37,6 +46,9 @@ class AppBar(v.AppBar, SepalWidget):
locale = None
"sw.LocaleSelect: the locale selector of all apps"
+ theme = None
+ "sw.ThemeSelect: the theme selector of all apps"
+
def __init__(self, title="SEPAL module", translator=None, **kwargs):
self.toggle_button = v.Btn(
@@ -47,13 +59,20 @@ class AppBar(v.AppBar, SepalWidget):
self.title = v.ToolbarTitle(children=[title])
self.locale = LocaleSelect(translator=translator)
+ self.theme = ThemeSelect()
# set the default parameters
- kwargs["color"] = kwargs.pop("color", sepal_main)
+ kwargs["color"] = kwargs.pop("color", color.main)
kwargs["class_"] = kwargs.pop("class_", "white--text")
kwargs["dense"] = kwargs.pop("dense", True)
kwargs["app"] = True
- kwargs["children"] = [self.toggle_button, self.title, v.Spacer(), self.locale]
+ kwargs["children"] = [
+ self.toggle_button,
+ self.title,
+ v.Spacer(),
+ self.locale,
+ self.theme,
+ ]
super().__init__(**kwargs)
@@ -252,7 +271,7 @@ class NavDrawer(v.NavigationDrawer, SepalWidget):
# set default parameters
kwargs["v_model"] = kwargs.pop("v_model", True)
kwargs["app"] = True
- kwargs["color"] = kwargs.pop("color", sepal_darker)
+ kwargs["color"] = kwargs.pop("color", color.darker)
kwargs["children"] = children
# call the constructor
@@ -313,7 +332,7 @@ class Footer(v.Footer, SepalWidget):
text = text if text != "" else "SEPAL \u00A9 {}".format(datetime.today().year)
# set default parameters
- kwargs["color"] = kwargs.pop("color", sepal_main)
+ kwargs["color"] = kwargs.pop("color", color.main)
kwargs["class_"] = kwargs.pop("class_", "white--text")
kwargs["app"] = True
kwargs["children"] = [text]
@@ -414,6 +433,7 @@ class App(v.App, SepalWidget):
# add js event
self.appBar.locale.observe(self._locale_info, "value")
+ self.appBar.theme.observe(self._theme_info, "v_model")
def show_tile(self, name):
"""
@@ -442,13 +462,14 @@ class App(v.App, SepalWidget):
return self
@versionadded(version="2.4.1", reason="New end user interaction method")
- def add_banner(self, msg, **kwargs):
+ def add_banner(self, msg, id_=None, **kwargs):
"""
Display an alert object on top of the app to communicate development information to end user (release date, known issues, beta version). The alert is dissmisable and prominent
Args:
msg (str): the message to write in the Alert
kwargs: any arguments of the v.Alert constructor. if set, 'children' will be overwritten.
+ id_ (str, optional): unique banner identificator to avoid multiple aggregations.
Return:
self
@@ -457,16 +478,28 @@ class App(v.App, SepalWidget):
kwargs["type"] = kwargs.pop("type", "info")
kwargs["border"] = kwargs.pop("border", "left")
kwargs["class_"] = kwargs.pop("class_", "mt-5")
- kwargs["transition"] = kwargs.pop("transition", "slide-x-transition")
+ kwargs["transition"] = kwargs.pop("transition", "scroll-x-transition")
kwargs["prominent"] = kwargs.pop("prominent", True)
kwargs["dismissible"] = kwargs.pop("dismissible", True)
kwargs["children"] = [msg] # cannot be overwritten
+ kwargs["attributes"] = {"id": id_}
+ kwargs["v_model"] = kwargs.pop("v_model", False)
+
+ # Verify if alert is already in the app.
+ children = self.content.children.copy()
- # create the alert
+ # remove already existing alert
+ alert = next((c for c in children if c.attributes.get("id") == id_), False)
+ alert is False or children.remove(alert)
+
+ # create alert
alert = v.Alert(**kwargs)
- # add the alert to the app
- self.content.children = [alert] + self.content.children.copy()
+ # add the alert to the app if not already there
+ self.content.children = [alert] + children
+
+ # Display the alert
+ alert.v_model = True
return self
@@ -475,7 +508,16 @@ class App(v.App, SepalWidget):
if change["new"] != "":
msg = ms.locale.change.format(change["new"])
- self.add_banner(msg, type="success")
+ self.add_banner(msg, id_="locale")
+
+ return
+
+ def _theme_info(self, change):
+ """display information about the theme change"""
+
+ if change["new"] != "":
+ msg = ms.theme.change.format(change["new"])
+ self.add_banner(msg, id_="theme")
return
@@ -535,7 +577,7 @@ class LocaleSelect(v.Menu, SepalWidget):
self.language_list = v.List(
dense=True,
flat=True,
- color="grey darken-3",
+ color=color.menu,
v_model=True,
max_height="300px",
style_="overflow: auto; border-radius: 0 0 0 0;",
@@ -600,3 +642,62 @@ class LocaleSelect(v.Menu, SepalWidget):
su.set_config_locale(loc.code)
return
+
+
+class ThemeSelect(v.Btn, SepalWidget):
+ """
+ A theme selector for sepal-ui based application.
+
+ It displays the currently requested theme (default to dark).
+ When value is changed, the sepal-ui config file is updated. It is designed to be used in a AppBar component.
+
+ .. versionadded:: 2.7.0
+
+ Args:
+ kwargs (dict, optional): any arguments for a Btn object, children and v_model will be override
+ """
+
+ THEME_ICONS = {"dark": "fas fa-moon", "light": "fas fa-sun"}
+ "dict: the dictionnry of icons to use for each theme (used as keys)"
+
+ theme = "dark"
+ "str: the current theme of the widget (default to dark)"
+
+ def __init__(self, **kwargs):
+
+ # get the current theme name
+ self.theme = sepal_ui.get_theme(sepal_ui.config_file)
+
+ # set the btn parameters
+ kwargs["x_small"] = kwargs.pop("x_small", True)
+ kwargs["fab"] = kwargs.pop("fab", True)
+ kwargs["class_"] = kwargs.pop("class_", "ml-2")
+ kwargs["children"] = [v.Icon(children=[self.THEME_ICONS[self.theme]])]
+ kwargs["v_model"] = self.theme
+
+ # create the btn
+ super().__init__(**kwargs)
+
+ # add some js events
+ self.on_event("click", self.toggle_theme)
+
+ def toggle_theme(self, widget, event, data):
+ """
+ toggle the btn icon from dark to light and adapt the configuration file at the same time
+ """
+ # use a cycle to go through the themes
+ theme_cycle = cycle(self.THEME_ICONS.keys())
+ next(t for t in theme_cycle if t == self.theme)
+ self.theme = next(t for t in theme_cycle)
+
+ # change icon
+ self.color = "info"
+ self.children[0].children = [self.THEME_ICONS[self.theme]]
+
+ # change the paramater file
+ su.set_config_theme(self.theme)
+
+ # trigger other events by changing v_model
+ self.v_model = self.theme
+
+ return
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index bf1adf0b..365d4f0b 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -9,7 +9,7 @@ import ee
import geopandas as gpd
from natsort import humansorted
-
+from sepal_ui import color
from sepal_ui.message import ms
from sepal_ui.frontend.styles import COMPONENTS, ICON_TYPES
from sepal_ui.scripts import utils as su
@@ -215,13 +215,13 @@ class FileInput(v.Flex, SepalWidget):
self.loading = v.ProgressLinear(
indeterminate=False,
- background_color="grey darken-3",
- color=COMPONENTS["PROGRESS_BAR"]["color"],
+ background_color=color.menu,
+ color=COMPONENTS["PROGRESS_BAR"]["color"][v.theme.dark],
)
self.file_list = v.List(
dense=True,
- color="grey darken-3",
+ color=color.menu,
flat=True,
v_model=True,
max_height="300px",
@@ -374,13 +374,13 @@ class FileInput(v.Flex, SepalWidget):
if el.is_dir():
icon = ICON_TYPES[""]["icon"]
- color = ICON_TYPES[""]["color"]
+ color = ICON_TYPES[""]["color"][v.theme.dark]
elif el.suffix in ICON_TYPES.keys():
icon = ICON_TYPES[el.suffix]["icon"]
- color = ICON_TYPES[el.suffix]["color"]
+ color = ICON_TYPES[el.suffix]["color"][v.theme.dark]
else:
icon = ICON_TYPES["DEFAULT"]["icon"]
- color = ICON_TYPES["DEFAULT"]["color"]
+ color = ICON_TYPES["DEFAULT"]["color"][v.theme.dark]
children = [
v.ListItemAction(children=[v.Icon(color=color, children=[icon])]),
@@ -405,7 +405,7 @@ class FileInput(v.Flex, SepalWidget):
v.ListItemAction(
children=[
v.Icon(
- color=ICON_TYPES["PARENT"]["color"],
+ color=ICON_TYPES["PARENT"]["color"][v.theme.dark],
children=[ICON_TYPES["PARENT"]["icon"]],
)
]
diff --git a/sepal_ui/translator/translator.py b/sepal_ui/translator/translator.py
index 3982aad6..f0a39f77 100644
--- a/sepal_ui/translator/translator.py
+++ b/sepal_ui/translator/translator.py
@@ -119,7 +119,7 @@ class Translator(SimpleNamespace):
if config_file.is_file():
config = ConfigParser()
config.read(config_file)
- target = config["sepal-ui"]["locale"]
+ target = config.get("sepal-ui", "locale", fallback="en")
else:
return ("en", None)
diff --git a/setup.py b/setup.py
index d7f3d03e..1b207b7e 100644
--- a/setup.py
+++ b/setup.py
@@ -57,7 +57,7 @@ setup_params = {
"pytest",
],
"doc": [
- "jupyter-sphinx @ git+git://github.com/jupyter/jupyter-sphinx.git",
+ "jupyter-sphinx @ git+https://github.com/jupyter/jupyter-sphinx.git",
"pydata-sphinx-theme",
"sphinx-notfound-page",
"Sphinx",
|
automatically detect the theme used and adapt the frontend accordingly
I have seen it on several zoom : it's so cool to display everything in dark but look so wrong when people are actually just developing in there own env in light theme.
Several situation that I would like to handle :
- voila theme
- jupyterLab theme
- jupyter notebook theme
|
12rambau/sepal_ui
|
diff --git a/tests/test_LocaleSelect.py b/tests/test_LocaleSelect.py
index 5da8c6e0..1813b58d 100644
--- a/tests/test_LocaleSelect.py
+++ b/tests/test_LocaleSelect.py
@@ -6,7 +6,7 @@ from sepal_ui import sepalwidgets as sw
from sepal_ui import config_file
-class TestBtn:
+class TestLocalSelect:
def test_init(self, locale_select):
# minimal btn
diff --git a/tests/test_SepalMap.py b/tests/test_SepalMap.py
index 440ce972..43f32238 100644
--- a/tests/test_SepalMap.py
+++ b/tests/test_SepalMap.py
@@ -53,8 +53,8 @@ class TestSepalMap:
m.set_drawing_controls(True)
assert isinstance(m.dc, geemap.DrawControl)
- assert m.dc.rectangle == {"shapeOptions": {"color": "#79B1C9"}}
- assert m.dc.polygon == {"shapeOptions": {"color": "#79B1C9"}}
+ assert m.dc.rectangle == {"shapeOptions": {"color": "#79b1c9"}}
+ assert m.dc.polygon == {"shapeOptions": {"color": "#79b1c9"}}
assert m.dc.marker == {}
assert m.dc.polyline == {}
diff --git a/tests/test_ThemeSelect.py b/tests/test_ThemeSelect.py
new file mode 100644
index 00000000..0de07d20
--- /dev/null
+++ b/tests/test_ThemeSelect.py
@@ -0,0 +1,36 @@
+from configparser import ConfigParser
+
+import pytest
+
+from sepal_ui import sepalwidgets as sw
+from sepal_ui import config_file
+
+
+class TestThemeSelect:
+ def test_init(self, theme_select):
+
+ # minimal btn
+ assert isinstance(theme_select, sw.ThemeSelect)
+
+ return
+
+ def test_change_language(self, theme_select):
+
+ # change value
+ theme_select.fire_event("click", None)
+ config = ConfigParser()
+ config.read(config_file)
+ assert "sepal-ui" in config.sections()
+ assert config["sepal-ui"]["theme"] == "light"
+
+ return
+
+ @pytest.fixture
+ def theme_select(self):
+ """Create a simple theme_select"""
+
+ # destroy any existing config file
+ if config_file.is_file():
+ config_file.unlink()
+
+ return sw.ThemeSelect()
diff --git a/tests/test_utils.py b/tests/test_utils.py
index a648b462..05136ab4 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -326,3 +326,29 @@ class TestUtils:
config_file.unlink()
return
+
+ def test_set_config_theme(self):
+
+ # remove any config file that could exist
+ if config_file.is_file():
+ config_file.unlink()
+
+ # create a config_file with a set language
+ theme = "dark"
+ su.set_config_theme(theme)
+
+ config = ConfigParser()
+ config.read(config_file)
+ assert "sepal-ui" in config.sections()
+ assert config["sepal-ui"]["theme"] == theme
+
+ # change an existing locale
+ theme = "light"
+ su.set_config_theme(theme)
+ config.read(config_file)
+ assert config["sepal-ui"]["theme"] == theme
+
+ # destroy the file again
+ config_file.unlink()
+
+ return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 14
}
|
2.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"numpy>=1.16.0",
"pandas>=1.0.0",
"ipyvuetify",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
bqplot==0.12.44
branca==0.4.2
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
colour==0.1.5
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
EditorConfig==0.17.0
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
ffmpeg-python==0.2.0
filelock==3.18.0
folium==0.13.0
fonttools==4.56.0
fqdn==1.5.1
future==1.0.0
geeadd==1.2.1
geemap==0.8.9
geocoder==1.38.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyevents==2.0.2
ipyfilechooser==0.6.0
ipykernel==6.29.5
ipyleaflet==0.13.3
ipynb-py-convert==0.4.6
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipytree==0.2.2
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsbeautifier==1.15.4
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
logzero==1.7.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
mss==10.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyCRS==1.0.2
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pyshp==2.3.1
pytest==8.3.5
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
ratelim==0.1.6
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@97371fbaed444727126a2969cd68f856db77221f#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
whitebox==2.3.6
whiteboxgui==2.3.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- bqplot==0.12.44
- branca==0.4.2
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- colorama==0.4.6
- colour==0.1.5
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- editorconfig==0.17.0
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- ffmpeg-python==0.2.0
- filelock==3.18.0
- folium==0.13.0
- fonttools==4.56.0
- fqdn==1.5.1
- future==1.0.0
- geeadd==1.2.1
- geemap==0.8.9
- geocoder==1.38.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyevents==2.0.2
- ipyfilechooser==0.6.0
- ipykernel==6.29.5
- ipyleaflet==0.13.3
- ipynb-py-convert==0.4.6
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipytree==0.2.2
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsbeautifier==1.15.4
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- logzero==1.7.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- mss==10.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pycrs==1.0.2
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pyshp==2.3.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- ratelim==0.1.6
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- whitebox==2.3.6
- whiteboxgui==2.3.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_ThemeSelect.py::TestThemeSelect::test_init",
"tests/test_ThemeSelect.py::TestThemeSelect::test_change_language",
"tests/test_utils.py::TestUtils::test_set_config_theme"
] |
[
"tests/test_SepalMap.py::TestSepalMap::test_init",
"tests/test_SepalMap.py::TestSepalMap::test_set_drawing_controls",
"tests/test_SepalMap.py::TestSepalMap::test_remove_last_layer",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_bounds",
"tests/test_SepalMap.py::TestSepalMap::test_show_dc",
"tests/test_SepalMap.py::TestSepalMap::test_change_cursor",
"tests/test_SepalMap.py::TestSepalMap::test_add_colorbar",
"tests/test_SepalMap.py::TestSepalMap::test_addLayer",
"tests/test_SepalMap.py::TestSepalMap::test_get_viz_params",
"tests/test_utils.py::TestUtils::test_init_ee"
] |
[
"tests/test_LocaleSelect.py::TestLocalSelect::test_init",
"tests/test_LocaleSelect.py::TestLocalSelect::test_change_language",
"tests/test_SepalMap.py::TestSepalMap::test_get_basemap_list",
"tests/test_utils.py::TestUtils::test_hide_component",
"tests/test_utils.py::TestUtils::test_show_component",
"tests/test_utils.py::TestUtils::test_download_link",
"tests/test_utils.py::TestUtils::test_is_absolute",
"tests/test_utils.py::TestUtils::test_random_string",
"tests/test_utils.py::TestUtils::test_get_file_size",
"tests/test_utils.py::TestUtils::test_catch_errors",
"tests/test_utils.py::TestUtils::test_loading_button",
"tests/test_utils.py::TestUtils::test_to_colors",
"tests/test_utils.py::TestUtils::test_switch",
"tests/test_utils.py::TestUtils::test_next_string",
"tests/test_utils.py::TestUtils::test_set_config_locale"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-459
|
a4b3091755a11ef31a3714858007a93b750b6a79
|
2022-05-04 08:13:02
|
7eb3f48735e1cfeac75fecf88dd8194c8daea3d3
|
diff --git a/docs/source/modules/sepal_ui.translator.Translator.rst b/docs/source/modules/sepal_ui.translator.Translator.rst
index 60fa976c..642a3ab6 100644
--- a/docs/source/modules/sepal_ui.translator.Translator.rst
+++ b/docs/source/modules/sepal_ui.translator.Translator.rst
@@ -27,6 +27,7 @@ sepal\_ui.translator.Translator
~Translator.find_target
~Translator.available_locales
~Translator.merge_dict
+ ~Translator.delete_empty
.. automethod:: sepal_ui.translator.Translator.missing_keys
@@ -38,6 +39,8 @@ sepal\_ui.translator.Translator
.. automethod:: sepal_ui.translator.Translator.merge_dict
+.. automethod:: sepal_ui.translator.Translator.delete_empty
+
.. autofunction:: sepal_ui.translator.Translator.find_target
\ No newline at end of file
diff --git a/sepal_ui/message/en/locale.json b/sepal_ui/message/en/locale.json
index 632249f8..22b77234 100644
--- a/sepal_ui/message/en/locale.json
+++ b/sepal_ui/message/en/locale.json
@@ -2,11 +2,6 @@
"test_key": "Test key",
"status": "Status: {}",
"widgets": {
- "navdrawer": {
- "code": "Source code",
- "wiki": "Wiki",
- "bug": "Bug report"
- },
"asset_select": {
"types": {
"0": "Raster",
diff --git a/sepal_ui/sepalwidgets/app.py b/sepal_ui/sepalwidgets/app.py
index b004b9ee..df1e81d8 100644
--- a/sepal_ui/sepalwidgets/app.py
+++ b/sepal_ui/sepalwidgets/app.py
@@ -255,19 +255,13 @@ class NavDrawer(v.NavigationDrawer, SepalWidget):
code_link = []
if code:
- item_code = DrawerItem(
- ms.widgets.navdrawer.code, icon="far fa-file-code", href=code
- )
+ item_code = DrawerItem("Source code", icon="far fa-file-code", href=code)
code_link.append(item_code)
if wiki:
- item_wiki = DrawerItem(
- ms.widgets.navdrawer.wiki, icon="fas fa-book-open", href=wiki
- )
+ item_wiki = DrawerItem("Wiki", icon="fas fa-book-open", href=wiki)
code_link.append(item_wiki)
if issue:
- item_bug = DrawerItem(
- ms.widgets.navdrawer.bug, icon="fas fa-bug", href=issue
- )
+ item_bug = DrawerItem("Bug report", icon="fas fa-bug", href=issue)
code_link.append(item_bug)
children = [
diff --git a/sepal_ui/translator/translator.py b/sepal_ui/translator/translator.py
index f0a39f77..f4fdec47 100644
--- a/sepal_ui/translator/translator.py
+++ b/sepal_ui/translator/translator.py
@@ -166,7 +166,8 @@ class Translator(SimpleNamespace):
Identify numbered dictionnaries embeded in the dict and transform them into lists
This function is an helper to prevent deprecation after the introduction of pontoon for translation.
- The user is now force to use keys even for numbered lists. SimpleNamespace doesn't support integer indexing so this function will transform back this "numbered" dictionnary (with integer keys) into lists.
+ The user is now force to use keys even for numbered lists. SimpleNamespace doesn't support integer indexing
+ so this function will transform back this "numbered" dictionnary (with integer keys) into lists.
Args:
d (dict): the dictionnary to sanitize
@@ -252,7 +253,8 @@ class Translator(SimpleNamespace):
"""
gather all the .json file in the provided l10n folder as 1 single json dict
- the json dict will be sanitysed and the key will be used as if they were coming from 1 single file. be careful with duplication
+ the json dict will be sanitysed and the key will be used as if they were coming from 1 single file.
+ be careful with duplication. empty string keys will be removed.
Args:
folder (pathlib.path)
@@ -264,6 +266,29 @@ class Translator(SimpleNamespace):
final_json = {}
for f in folder.glob("*.json"):
- final_json = {**final_json, **cls.sanitize(json.loads(f.read_text()))}
+ tmp_dict = cls.delete_empty(json.loads(f.read_text()))
+ final_json = {**final_json, **cls.sanitize(tmp_dict)}
return final_json
+
+ @versionadded(version="2.8.1")
+ @classmethod
+ def delete_empty(cls, d):
+ """
+ Remove empty strings ("") recursively from the dictionaries. This is to prevent untranslated strings from
+ Crowdin to be uploaded. The dictionnary must only embed dictionnaries and no lists.
+
+ Args:
+ d (dict): the dictionnary to sanitize
+
+ Return:
+ (dict): the sanitized dictionnary
+
+ """
+ for k, v in list(d.items()):
+ if isinstance(v, dict):
+ cls.delete_empty(v)
+ elif v == "":
+ del d[k]
+
+ return d
|
crowdin untranslated keys are marked as empty string
These string are interpreted as "something" by the translator leading to empty strings everywhere in the build-in component.
They should be ignored
|
12rambau/sepal_ui
|
diff --git a/tests/test_Translator.py b/tests/test_Translator.py
index 930a533e..c6d0e85e 100644
--- a/tests/test_Translator.py
+++ b/tests/test_Translator.py
@@ -49,25 +49,29 @@ class TestTranslator:
# a test dict with many embeded numbered list
# but also an already existing list
test = {
- "foo1": {"0": "foo2", "1": "foo3"},
- "foo4": {
- "foo5": {"0": "foo6", "1": "foo7"},
- "foo8": "foo9",
- },
- "foo10": ["foo11", "foo12"],
+ "a": {"0": "b", "1": "c"},
+ "d": {"e": {"0": "f", "1": "g"}, "h": "i"},
+ "j": ["k", "l"],
}
# the sanitize version of this
result = {
- "foo1": ["foo2", "foo3"],
- "foo4": {"foo5": ["foo6", "foo7"], "foo8": "foo9"},
- "foo10": ["foo11", "foo12"],
+ "a": ["b", "c"],
+ "d": {"e": ["f", "g"], "h": "i"},
+ "j": ["k", "l"],
}
assert Translator.sanitize(test) == result
return
+ def test_delete_empty(self):
+
+ test = {"a": "", "b": 1, "c": {"d": ""}, "e": {"f": "", "g": 2}}
+ result = {"b": 1, "c": {}, "e": {"g": 2}}
+
+ assert Translator.delete_empty(test) == result
+
def test_missing_keys(self, translation_folder):
# check that all keys are in the fr dict
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 4
}
|
2.8
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
bqplot==0.12.44
branca==0.4.2
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
colour==0.1.5
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
EditorConfig==0.17.0
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
ffmpeg-python==0.2.0
filelock==3.18.0
folium==0.13.0
fonttools==4.56.0
fqdn==1.5.1
future==1.0.0
geeadd==1.2.1
geemap==0.8.9
geocoder==1.38.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyevents==2.0.2
ipyfilechooser==0.6.0
ipykernel==6.29.5
ipyleaflet==0.13.3
ipynb-py-convert==0.4.6
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipytree==0.2.2
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsbeautifier==1.15.4
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
logzero==1.7.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
mss==10.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyCRS==1.0.2
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pyshp==2.3.1
pytest==8.3.5
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
ratelim==0.1.6
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@a4b3091755a11ef31a3714858007a93b750b6a79#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
whitebox==2.3.6
whiteboxgui==2.3.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- bqplot==0.12.44
- branca==0.4.2
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- colorama==0.4.6
- colour==0.1.5
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- editorconfig==0.17.0
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- ffmpeg-python==0.2.0
- filelock==3.18.0
- folium==0.13.0
- fonttools==4.56.0
- fqdn==1.5.1
- future==1.0.0
- geeadd==1.2.1
- geemap==0.8.9
- geocoder==1.38.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyevents==2.0.2
- ipyfilechooser==0.6.0
- ipykernel==6.29.5
- ipyleaflet==0.13.3
- ipynb-py-convert==0.4.6
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipytree==0.2.2
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsbeautifier==1.15.4
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- logzero==1.7.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- mss==10.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pycrs==1.0.2
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pyshp==2.3.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- ratelim==0.1.6
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- whitebox==2.3.6
- whiteboxgui==2.3.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Translator.py::TestTranslator::test_delete_empty"
] |
[] |
[
"tests/test_Translator.py::TestTranslator::test_init",
"tests/test_Translator.py::TestTranslator::test_search_key",
"tests/test_Translator.py::TestTranslator::test_sanitize",
"tests/test_Translator.py::TestTranslator::test_missing_keys",
"tests/test_Translator.py::TestTranslator::test_find_target",
"tests/test_Translator.py::TestTranslator::test_available_locales"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-501
|
7eb3f48735e1cfeac75fecf88dd8194c8daea3d3
|
2022-06-09 11:09:52
|
7eb3f48735e1cfeac75fecf88dd8194c8daea3d3
|
diff --git a/docs/source/modules/sepal_ui.translator.Translator.rst b/docs/source/modules/sepal_ui.translator.Translator.rst
index 642a3ab6..7f11e39f 100644
--- a/docs/source/modules/sepal_ui.translator.Translator.rst
+++ b/docs/source/modules/sepal_ui.translator.Translator.rst
@@ -2,19 +2,6 @@ sepal\_ui.translator.Translator
===============================
.. autoclass:: sepal_ui.translator.Translator
-
- .. rubric:: Attributes
-
- .. autosummary::
-
- ~Translator.default_dict
- ~Translator.target_dict
- ~Translator.default
- ~Translator.target
- ~Translator.targeted
- ~Translator.match
- ~Translator.keys
- ~Translator.folder
.. rubric:: Methods
@@ -33,7 +20,7 @@ sepal\_ui.translator.Translator
.. automethod:: sepal_ui.translator.Translator.sanitize
-.. automethod:: sepal_ui.translator.Translator.search_key
+.. autofunction:: sepal_ui.translator.Translator.search_key
.. automethod:: sepal_ui.translator.Translator.available_locales
diff --git a/sepal_ui/sepalwidgets/app.py b/sepal_ui/sepalwidgets/app.py
index 96c10461..bfd59e3d 100644
--- a/sepal_ui/sepalwidgets/app.py
+++ b/sepal_ui/sepalwidgets/app.py
@@ -602,7 +602,7 @@ class LocaleSelect(v.Menu, SepalWidget):
# extract the language information from the translator
# if not set default to english
- code = "en" if translator is None else translator.target
+ code = "en" if translator is None else translator._target
loc = self.COUNTRIES[self.COUNTRIES.code == code].squeeze()
attr = {**self.ATTR, "src": self.FLAG.format(loc.flag), "alt": loc.name}
diff --git a/sepal_ui/translator/translator.py b/sepal_ui/translator/translator.py
index f4fdec47..efa29bc9 100644
--- a/sepal_ui/translator/translator.py
+++ b/sepal_ui/translator/translator.py
@@ -1,21 +1,26 @@
import json
-from types import SimpleNamespace
from pathlib import Path
from collections import abc
-from deepdiff import DeepDiff
from configparser import ConfigParser
-from deprecated.sphinx import versionadded
+from deprecated.sphinx import versionadded, deprecated
+from box import Box
from sepal_ui import config_file
-class Translator(SimpleNamespace):
+class Translator(Box):
"""
- The translator is a SimpleNamespace of Simplenamespace. It reads 2 Json files, the first one being the source language (usually English) and the second one the target language.
+ The translator is a Python Box of boxes. It reads 2 Json files, the first one being the source language (usually English) and the second one the target language.
It will replace in the source dictionary every key that exist in both json dictionaries. Following this procedure, every message that is not translated can still be accessed in the source language.
To access the dictionary keys, instead of using [], you can simply use key name as in an object ex: translator.first_key.secondary_key.
There are no depth limits, just respect the snake_case convention when naming your keys in the .json files.
+ 5 internal keys are created upon initialization (there name cannot be used as keys in the translation message):
+ - (str) _default : the default locale of the translator
+ - (str) _targeted : the initially requested language. Use to display debug information to the user agent
+ - (str) _target : the target locale of the translator
+ - (bool) _match : if the target language match the one requested one by user, used to trigger information in appBar
+ - (str) _folder : the path to the l10n folder
Args:
json_folder (str | pathlib.Path): The folder where the dictionaries are stored
@@ -23,75 +28,60 @@ class Translator(SimpleNamespace):
default (str, optional): The language code (IETF BCP 47) of the source lang. default to "en" (it should be the same as the source dictionary)
"""
- FORBIDDEN_KEYS = [
- "default_dict",
- "target_dict",
- "in",
- "class",
- "default",
- "target",
- "match",
- ]
- "list(str): list of the forbidden keys, using one of them in a translation dict will throw an error"
-
- target_dict = {}
- "(dict): the target language dictionary"
-
- default_dict = {}
- "dict: the source language dictionary"
-
- default = None
- "str: the default locale of the translator"
-
- targeted = None
- "str: the initially requested language. Use to display debug information to the user agent"
-
- target = None
- "str: the target locale of the translator"
-
- match = None
- "bool: if the target language match the one requested one by user, used to trigger information in appBar"
-
- keys = None
- "all the keys can be acceced as attributes"
-
- folder = None
- "pathlib.Path: the path to the l10n folder"
+ _protected_keys = [
+ "find_target",
+ "search_key",
+ "sanitize",
+ "_update",
+ "missing_keys",
+ "available_locales",
+ "merge_dict",
+ "delete_empty",
+ ] + dir(Box)
+ "keys that cannot be used as var names as they are protected for methods"
def __init__(self, json_folder, target=None, default="en"):
- # init the simple namespace
- super().__init__()
+ # the name of the 5 variables that cannot be used as init keys
+ FORBIDDEN_KEYS = ["_folder", "_default", "_target", "_targeted", "_match"]
- # force cast to path
- self.folder = Path(json_folder)
+ # init the box with the folder
+ folder = Path(json_folder)
# reading the default dict
- self.default = default
- self.default_dict = self.merge_dict(self.folder / default)
+ default_dict = self.merge_dict(folder / default)
# create a dictionary in the target language
- self.targeted, target = self.find_target(self.folder, target)
- self.target = target or default
- self.target_dict = self.merge_dict(self.folder / self.target)
+ targeted, target = self.find_target(folder, target)
+ target = target or default
+ target_dict = self.merge_dict(folder / target)
# evaluate the matching of requested and obtained values
- self.match = self.targeted == self.target
+ match = targeted == target
# create the composite dictionary
- ms_dict = self._update(self.default_dict, self.target_dict)
+ ms_dict = self._update(default_dict, target_dict)
# check if forbidden keys are being used
- [self.search_key(ms_dict, k) for k in self.FORBIDDEN_KEYS]
+ # this will raise an error if any
+ [self.search_key(ms_dict, k) for k in FORBIDDEN_KEYS]
- # transform it into a json str
+ # # unpack the json as a simple namespace
ms_json = json.dumps(ms_dict)
+ ms_boxes = json.loads(ms_json, object_hook=lambda d: Box(**d, frozen_box=True))
- # unpack the json as a simple namespace
- ms = json.loads(ms_json, object_hook=lambda d: SimpleNamespace(**d))
+ private_keys = {
+ "_folder": str(folder),
+ "_default": default,
+ "_targeted": targeted,
+ "_target": target,
+ "_match": match,
+ }
- for k, v in ms.__dict__.items():
- setattr(self, k, getattr(ms, k))
+ # the final box is not frozen
+ # waiting for an answer here: https://github.com/cdgriffith/Box/issues/223
+ # it the meantime it's easy to call the translator using a frozen_box argument
+ super(Box, self).__init__(**private_keys, **ms_boxes)
@versionadded(version="2.7.0")
@staticmethod
@@ -139,8 +129,8 @@ class Translator(SimpleNamespace):
return (target, lang)
- @classmethod
- def search_key(cls, d, key):
+ @staticmethod
+ def search_key(d, key):
"""
Search a specific key in the d dictionary and raise an error if found
@@ -149,14 +139,9 @@ class Translator(SimpleNamespace):
key (str): the key to look for
"""
- for k, v in d.items():
- if isinstance(v, abc.Mapping):
- cls.search_key(v, key)
- else:
- if k == key:
- raise Exception(
- f"You cannot use the key {key} in your translation dictionary"
- )
+ if key in d:
+ msg = f"You cannot use the key {key} in your translation dictionary"
+ raise Exception(msg)
return
@@ -218,34 +203,19 @@ class Translator(SimpleNamespace):
return ms
+ @deprecated(version="2.9.0", reason="Not needed with automatic translators")
def missing_keys(self):
- """
- this function is intended for developer use only
- print the list of the missing keys in the target dictionnairie
-
- Return:
- (str): the list of missing keys
- """
-
- # find all the missing keys
- try:
- ddiff = DeepDiff(self.default_dict, self.target_dict)[
- "dictionary_item_removed"
- ]
- except Exception:
- ddiff = ["All messages are translated"]
-
- return "\n".join(ddiff)
+ pass
def available_locales(self):
"""
Return the available locales in the l10n folder
Return:
- (list): the lilst of str codes
+ (list): the list of str codes
"""
- return [f.name for f in self.folder.iterdir() if f.is_dir()]
+ return [f.name for f in Path(self._folder).glob("[!^._]*") if f.is_dir()]
@versionadded(version="2.7.0")
@classmethod
|
use box for the translator ?
I discovered this lib while working on the geemap drop.
I think it could be super handy for the translator keys and maybe faster. https://github.com/cdgriffith/Box
side note: we will need it anyway for the geemap drop
|
12rambau/sepal_ui
|
diff --git a/tests/test_Translator.py b/tests/test_Translator.py
index c6d0e85e..ff6c46f8 100644
--- a/tests/test_Translator.py
+++ b/tests/test_Translator.py
@@ -35,9 +35,10 @@ class TestTranslator:
def test_search_key(self):
- # assert that having a wrong key in the json will raise an error
+ # assert that having a wrong key at root level
+ # in the json will raise an error
key = "toto"
- d = {"a": {"toto": "b"}, "c": "d"}
+ d = {"toto": {"a": "b"}, "c": "d"}
with pytest.raises(Exception):
Translator.search_key(d, key)
@@ -72,16 +73,6 @@ class TestTranslator:
assert Translator.delete_empty(test) == result
- def test_missing_keys(self, translation_folder):
-
- # check that all keys are in the fr dict
- translator = Translator(translation_folder, "fr")
- assert translator.missing_keys() == "All messages are translated"
-
- # check that 1 key is missing
- translator = Translator(translation_folder, "es")
- assert translator.missing_keys() == "root['test_key']"
-
return
def test_find_target(self, translation_folder):
@@ -114,6 +105,12 @@ class TestTranslator:
for locale in res:
assert locale in translator.available_locales()
+ # Check no hidden and protected files are in locales
+ locales = translator.available_locales()
+ assert not all(
+ [(loc.startswith(".") or loc.startswith("_")) for loc in locales]
+ )
+
return
@pytest.fixture(scope="class")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 3
},
"num_modified_files": 3
}
|
2.8
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.2
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.19.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@7eb3f48735e1cfeac75fecf88dd8194c8daea3d3#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.2
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.19.0
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Translator.py::TestTranslator::test_search_key"
] |
[] |
[
"tests/test_Translator.py::TestTranslator::test_init",
"tests/test_Translator.py::TestTranslator::test_sanitize",
"tests/test_Translator.py::TestTranslator::test_delete_empty",
"tests/test_Translator.py::TestTranslator::test_find_target",
"tests/test_Translator.py::TestTranslator::test_available_locales"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-501
|
|
12rambau__sepal_ui-516
|
9c319b0c21b8b1ba75173f3f85fd184747c398de
|
2022-07-03 07:19:07
|
114063b50ee5b1ccbab680424bb048e11939b870
|
diff --git a/docs/source/modules/sepal_ui.aoi.AoiModel.rst b/docs/source/modules/sepal_ui.aoi.AoiModel.rst
index 0f5b8f1a..ccdcab52 100644
--- a/docs/source/modules/sepal_ui.aoi.AoiModel.rst
+++ b/docs/source/modules/sepal_ui.aoi.AoiModel.rst
@@ -12,7 +12,6 @@ sepal\_ui.aoi.AoiModel
~AoiModel.NAME
~AoiModel.ISO
~AoiModel.GADM_BASE_URL
- ~AoiModel.GADM_ZIP_DIR
~AoiModel.GAUL_ASSET
~AoiModel.ASSET_SUFFIX
~AoiModel.CUSTOM
diff --git a/sepal_ui/aoi/aoi_model.py b/sepal_ui/aoi/aoi_model.py
index ad2a72fb..40f9b4e6 100644
--- a/sepal_ui/aoi/aoi_model.py
+++ b/sepal_ui/aoi/aoi_model.py
@@ -61,11 +61,6 @@ class AoiModel(Model):
GADM_BASE_URL = "https://biogeo.ucdavis.edu/data/gadm3.6/gpkg/gadm36_{}_gpkg.zip"
"str: the base url to download gadm maps"
- GADM_ZIP_DIR = Path.home() / "tmp" / "GADM_zip"
- "pathlib.Path: the zip dir where we download the zips"
-
- GADM_ZIP_DIR.mkdir(parents=True, exist_ok=True)
-
GAUL_ASSET = "FAO/GAUL/2015/level{}"
"str: the GAUL asset name"
diff --git a/sepal_ui/mapping/sepal_map.py b/sepal_ui/mapping/sepal_map.py
index 6a518ccc..6ca115fc 100644
--- a/sepal_ui/mapping/sepal_map.py
+++ b/sepal_ui/mapping/sepal_map.py
@@ -16,7 +16,7 @@ import random
from haversine import haversine
import numpy as np
import rioxarray
-import xarray_leaflet
+import xarray_leaflet # noqa: F401
import matplotlib.pyplot as plt
from matplotlib import colors as mpc
from matplotlib import colorbar
@@ -38,11 +38,6 @@ from sepal_ui.mapping.basemaps import basemap_tiles
__all__ = ["SepalMap"]
-# call x_array leaflet at least once
-# flake8 will complain as it's a pluggin (i.e. never called)
-# We don't want to ignore testing F401
-xarray_leaflet
-
class SepalMap(ipl.Map):
"""
diff --git a/sepal_ui/mapping/value_inspector.py b/sepal_ui/mapping/value_inspector.py
index f848018f..783d68ad 100644
--- a/sepal_ui/mapping/value_inspector.py
+++ b/sepal_ui/mapping/value_inspector.py
@@ -3,7 +3,7 @@ import ee
import geopandas as gpd
from shapely import geometry as sg
import rioxarray
-import xarray_leaflet
+import xarray_leaflet # noqa: F401
from rasterio.crs import CRS
import rasterio as rio
import ipyvuetify as v
@@ -16,11 +16,6 @@ from sepal_ui.mapping.map_btn import MapBtn
from sepal_ui.frontend.styles import COMPONENTS
from sepal_ui.message import ms
-# call x_array leaflet at least once
-# flake8 will complain as it's a pluggin (i.e. never called)
-# We don't want to ignore testing F401
-xarray_leaflet
-
class ValueInspector(WidgetControl):
"""
diff --git a/sepal_ui/sepalwidgets/tile.py b/sepal_ui/sepalwidgets/tile.py
index dec40168..69a92dc0 100644
--- a/sepal_ui/sepalwidgets/tile.py
+++ b/sepal_ui/sepalwidgets/tile.py
@@ -76,7 +76,7 @@ class Tile(v.Layout, SepalWidget):
self._metadata["mount_id"] = "nested_tile"
# remove elevation
- self.elevation = False
+ self.children[0].elevation = False
# remove title
self.set_title()
|
deprecate zip_dir
https://github.com/12rambau/sepal_ui/blob/a9255e7c566aac31ee7f8303e74fb7e8a3d57e5f/sepal_ui/aoi/aoi_model.py#L64
This folder is created on AOI call but is not used anymore as we are using the tmp module to create the tmp directory.
|
12rambau/sepal_ui
|
diff --git a/tests/test_Tile.py b/tests/test_Tile.py
index aa22d301..de0de97e 100644
--- a/tests/test_Tile.py
+++ b/tests/test_Tile.py
@@ -81,7 +81,7 @@ class TestTile:
assert res == tile
assert tile._metadata["mount_id"] == "nested_tile"
- assert tile.elevation is False
+ assert tile.children[0].elevation == 0
assert len(tile.children[0].children) == 1
return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 5
}
|
2.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.2
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@9c319b0c21b8b1ba75173f3f85fd184747c398de#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.2
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Tile.py::TestTile::test_nest"
] |
[] |
[
"tests/test_Tile.py::TestTile::test_init",
"tests/test_Tile.py::TestTile::test_set_content",
"tests/test_Tile.py::TestTile::test_set_title",
"tests/test_Tile.py::TestTile::test_hide",
"tests/test_Tile.py::TestTile::test_show",
"tests/test_Tile.py::TestTile::test_toggle_inputs",
"tests/test_Tile.py::TestTile::test_get_id",
"tests/test_Tile.py::TestTile::test_tile_about",
"tests/test_Tile.py::TestTile::test_tile_disclaimer"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-516
|
|
12rambau__sepal_ui-517
|
9c319b0c21b8b1ba75173f3f85fd184747c398de
|
2022-07-03 10:05:47
|
114063b50ee5b1ccbab680424bb048e11939b870
|
diff --git a/sepal_ui/message/en/utils.json b/sepal_ui/message/en/utils.json
new file mode 100644
index 00000000..0282d86c
--- /dev/null
+++ b/sepal_ui/message/en/utils.json
@@ -0,0 +1,7 @@
+{
+ "utils": {
+ "check_input": {
+ "error": "The value has not been initialized"
+ }
+ }
+}
\ No newline at end of file
diff --git a/sepal_ui/scripts/utils.py b/sepal_ui/scripts/utils.py
index b062906d..1f37abc2 100644
--- a/sepal_ui/scripts/utils.py
+++ b/sepal_ui/scripts/utils.py
@@ -17,6 +17,7 @@ from matplotlib import colors as c
from deprecated.sphinx import versionadded, deprecated
import sepal_ui
+from sepal_ui.message import ms
from sepal_ui.conf import config_file, config
from .warning import SepalWarning
@@ -631,3 +632,31 @@ def geojson_to_ee(geo_json, geodesic=False, encoding="utf-8"):
raise ValueError("Could not convert the geojson to ee.Geometry()")
return
+
+
+def check_input(input_, msg=ms.utils.check_input.error):
+ """
+ Check if the inpupt value is initialized.
+ If not raise an error, else return True
+
+ Args:
+ input\_ (any): the input to check
+ msg (str, optionnal): the message to display if the input is not set
+
+ Return:
+ (bool): check if the value is initialized
+ """
+
+ # by the default the variable is considered valid
+ init = True
+
+ # check the collection type that are the only one supporting the len method
+ try:
+ init = False if len(input_) == 0 else init
+ except Exception:
+ init = False if input_ is None else init
+
+ if init is False:
+ raise ValueError(msg)
+
+ return init
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index 4fd9c633..55ad3b65 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -3,11 +3,13 @@ from tqdm.notebook import tqdm
from ipywidgets import jslink, Output
import ipyvuetify as v
from traitlets import Unicode, observe, directional_link, Bool
+from deprecated.sphinx import deprecated
from sepal_ui.sepalwidgets.sepalwidget import SepalWidget
from sepal_ui.scripts.utils import set_type
from sepal_ui.frontend.styles import TYPES, color
from sepal_ui.message import ms
+from sepal_ui.scripts import utils as su
__all__ = ["Divider", "Alert", "StateBar", "Banner"]
@@ -229,6 +231,7 @@ class Alert(v.Alert, SepalWidget):
return self
+ @deprecated(version="3.0", reason="This method is now part of the utils module")
def check_input(self, input_, msg=None):
"""
Check if the inpupt value is initialized.
@@ -241,20 +244,9 @@ class Alert(v.Alert, SepalWidget):
Return:
(bool): check if the value is initialized
"""
- if not msg:
- msg = "The value has not been initialized"
- init = True
+ msg = msg or ms.utils.check_input.error
- # check the collection type that are the only one supporting the len method
- try:
- init = False if len(input_) == 0 else init
- except Exception:
- init = False if input_ is None else init
-
- if init is False:
- self.add_msg(msg, "error")
-
- return init
+ return su.check_input(input_, msg)
class StateBar(v.SystemBar):
|
refactor check_input to raise error instead of displaying a message?
https://github.com/12rambau/sepal_ui/blob/a9255e7c566aac31ee7f8303e74fb7e8a3d57e5f/sepal_ui/sepalwidgets/alert.py#L232
This was initially coded as a message to prevent the execution from stopping when a function was using undefined variables. Along the way we introduced `try ... exept` statements in our functions and now main methods are mostly used with the `loading_button` decorator.
I think we could refactor the `check_input` so that it directly raises an error instead writing down a message in the alert. Maybe even better, we deprecate this function and we move `check_input` to `utils` (with the error raising mechanism).
|
12rambau/sepal_ui
|
diff --git a/tests/test_Alert.py b/tests/test_Alert.py
index 6116cbc7..d125b74e 100644
--- a/tests/test_Alert.py
+++ b/tests/test_Alert.py
@@ -111,28 +111,22 @@ class TestAlert:
alert = sw.Alert()
- var_test = None
- res = alert.check_input(var_test)
- assert res is False
- assert alert.viz is True
- assert alert.children[0].children[0] == "The value has not been initialized"
+ with pytest.raises(ValueError, match="The value has not been initialized"):
+ alert.check_input(None)
- res = alert.check_input(var_test, "toto")
- assert alert.children[0].children[0] == "toto"
+ with pytest.raises(ValueError, match="toto"):
+ alert.check_input(None, "toto")
- var_test = 1
- res = alert.check_input(var_test)
+ res = alert.check_input(1)
assert res is True
# test lists
- var_test = [range(2)]
- res = alert.check_input(var_test)
+ res = alert.check_input([range(2)])
assert res is True
# test empty list
- var_test = []
- res = alert.check_input(var_test)
- assert res is False
+ with pytest.raises(ValueError):
+ alert.check_input([])
return
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 59bda7b8..9f6742cd 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -391,3 +391,24 @@ class TestUtils:
su.geojson_to_ee(dict_)
return
+
+ def test_check_input(self):
+
+ with pytest.raises(ValueError, match="The value has not been initialized"):
+ su.check_input(None)
+
+ with pytest.raises(ValueError, match="toto"):
+ su.check_input(None, "toto")
+
+ res = su.check_input(1)
+ assert res is True
+
+ # test lists
+ res = su.check_input([range(2)])
+ assert res is True
+
+ # test empty list
+ with pytest.raises(ValueError):
+ su.check_input([])
+
+ return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
2.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest==8.3.5
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@9c319b0c21b8b1ba75173f3f85fd184747c398de#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest==8.3.5
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Alert.py::TestAlert::test_check_input",
"tests/test_utils.py::TestUtils::test_check_input"
] |
[
"tests/test_utils.py::TestUtils::test_init_ee",
"tests/test_utils.py::TestUtils::test_geojson_to_ee"
] |
[
"tests/test_Alert.py::TestAlert::test_init",
"tests/test_Alert.py::TestAlert::test_add_msg",
"tests/test_Alert.py::TestAlert::test_add_live_msg",
"tests/test_Alert.py::TestAlert::test_append_msg",
"tests/test_Alert.py::TestAlert::test_reset",
"tests/test_Alert.py::TestAlert::test_rmv_last_msg",
"tests/test_Alert.py::TestAlert::test_update_progress",
"tests/test_utils.py::TestUtils::test_hide_component",
"tests/test_utils.py::TestUtils::test_show_component",
"tests/test_utils.py::TestUtils::test_download_link",
"tests/test_utils.py::TestUtils::test_random_string",
"tests/test_utils.py::TestUtils::test_get_file_size",
"tests/test_utils.py::TestUtils::test_catch_errors",
"tests/test_utils.py::TestUtils::test_loading_button",
"tests/test_utils.py::TestUtils::test_to_colors",
"tests/test_utils.py::TestUtils::test_switch",
"tests/test_utils.py::TestUtils::test_next_string",
"tests/test_utils.py::TestUtils::test_set_config_locale",
"tests/test_utils.py::TestUtils::test_set_config_theme",
"tests/test_utils.py::TestUtils::test_set_style"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-518
|
698d446e33062934d49f9edb91cbe303b73e786f
|
2022-07-03 10:33:15
|
114063b50ee5b1ccbab680424bb048e11939b870
|
diff --git a/sepal_ui/mapping/aoi_control.py b/sepal_ui/mapping/aoi_control.py
index 01a6aa48..ae143d2c 100644
--- a/sepal_ui/mapping/aoi_control.py
+++ b/sepal_ui/mapping/aoi_control.py
@@ -36,7 +36,7 @@ class AoiControl(WidgetControl):
kwargs["position"] = kwargs.pop("position", "topright")
# create a hoverable btn
- btn = MapBtn(logo="fas fa-search-location", v_on="menu.on")
+ btn = MapBtn(content="fas fa-search-location", v_on="menu.on")
slot = {"name": "activator", "variable": "menu", "children": btn}
self.aoi_list = sw.ListItemGroup(children=[], v_model="")
w_list = sw.List(
diff --git a/sepal_ui/mapping/fullscreen_control.py b/sepal_ui/mapping/fullscreen_control.py
index 5e23c1d6..2855fa72 100644
--- a/sepal_ui/mapping/fullscreen_control.py
+++ b/sepal_ui/mapping/fullscreen_control.py
@@ -43,7 +43,7 @@ class FullScreenControl(WidgetControl):
self.zoomed = fullscreen
# create a btn
- self.w_btn = MapBtn(logo=self.ICONS[self.zoomed])
+ self.w_btn = MapBtn(self.ICONS[self.zoomed])
# overwrite the widget set in the kwargs (if any)
kwargs["widget"] = self.w_btn
@@ -88,7 +88,7 @@ class FullScreenControl(WidgetControl):
self.zoomed = not self.zoomed
# change button icon
- self.w_btn.logo.children = [self.ICONS[self.zoomed]]
+ self.w_btn.children[0].children = [self.ICONS[self.zoomed]]
# zoom
self.template.send({"method": self.METHODS[self.zoomed], "args": []})
diff --git a/sepal_ui/mapping/map_btn.py b/sepal_ui/mapping/map_btn.py
index ab55e1c8..0ea13364 100644
--- a/sepal_ui/mapping/map_btn.py
+++ b/sepal_ui/mapping/map_btn.py
@@ -7,26 +7,26 @@ from sepal_ui.frontend.styles import map_btn_style
class MapBtn(v.Btn, sw.SepalWidget):
"""
Btn specifically design to be displayed on a map. It matches all the characteristics of
- the classic leaflet btn but as they are from ipyvuetify we can use them in combination with Menu to produce on-the-map. The MapBtn is responsive to theme changes.
- Tiles. It only accept icon as children as the space is very limited.
+ the classic leaflet btn but as they are from ipyvuetify we can use them in combination with Menu to produce on-the-map tiles.
+ The MapBtn is responsive to theme changes. It only accept icon or 3 letters as children as the space is very limited.
Args:
- logo (str): a fas/mdi fully qualified name
+ content (str): a fas/mdi fully qualified name or a string name. If a string name is used, only the 3 first letters will be displayed.
"""
- logo = None
- "(sw.Icon): a sw.Icon"
-
- def __init__(self, logo, **kwargs):
+ def __init__(self, content, **kwargs):
# create the icon
- self.logo = sw.Icon(small=True, children=[logo])
+ if content.startswith("mdi-") or content.startswith("fas fa-"):
+ content = sw.Icon(small=True, children=[content])
+ else:
+ content = content[: min(3, len(content))].upper()
# some parameters are overloaded to match the map requirements
kwargs["color"] = "text-color"
kwargs["outlined"] = True
kwargs["style_"] = " ".join([f"{k}: {v};" for k, v in map_btn_style.items()])
- kwargs["children"] = [self.logo]
+ kwargs["children"] = [content]
kwargs["icon"] = False
super().__init__(**kwargs)
diff --git a/sepal_ui/mapping/value_inspector.py b/sepal_ui/mapping/value_inspector.py
index ecc52e72..96508ba3 100644
--- a/sepal_ui/mapping/value_inspector.py
+++ b/sepal_ui/mapping/value_inspector.py
@@ -54,7 +54,7 @@ class ValueInspector(WidgetControl):
)
# create a clickable btn
- btn = MapBtn(logo="fas fa-crosshairs", v_on="menu.on")
+ btn = MapBtn("fas fa-crosshairs", v_on="menu.on")
slot = {"name": "activator", "variable": "menu", "children": btn}
close_btn = sw.Icon(children=["fas fa-times"], small=True)
title = sw.Html(tag="h4", children=[ms.v_inspector.title])
|
add posibility to add text in the map_btn
The current implementation of the map_btn only authorize to use logos. It would be nice to let the opportunity to use letters as in the SEPAL main framework (3 letters only in capital)
|
12rambau/sepal_ui
|
diff --git a/tests/test_FullScreenControl.py b/tests/test_FullScreenControl.py
index 39141edf..148242b8 100644
--- a/tests/test_FullScreenControl.py
+++ b/tests/test_FullScreenControl.py
@@ -14,7 +14,7 @@ class TestFullScreenControl:
assert isinstance(control, sm.FullScreenControl)
assert control in map_.controls
assert control.zoomed is False
- assert "fas fa-expand" in control.w_btn.logo.children
+ assert "fas fa-expand" in control.w_btn.children[0].children
return
@@ -29,12 +29,12 @@ class TestFullScreenControl:
control.toggle_fullscreen(None, None, None)
assert control.zoomed is True
- assert "fas fa-compress" in control.w_btn.logo.children
+ assert "fas fa-compress" in control.w_btn.children[0].children
# click again to reset to initial state
control.toggle_fullscreen(None, None, None)
assert control.zoomed is False
- assert "fas fa-expand" in control.w_btn.logo.children
+ assert "fas fa-expand" in control.w_btn.children[0].children
return
diff --git a/tests/test_MapBtn.py b/tests/test_MapBtn.py
index 0dd605b8..9a9d9c2f 100644
--- a/tests/test_MapBtn.py
+++ b/tests/test_MapBtn.py
@@ -1,11 +1,29 @@
from sepal_ui import mapping as sm
+from sepal_ui import sepalwidgets as sw
class TestMapBtn:
- def test_map_btn(self):
+ def test_init(self):
+ # fas icon
map_btn = sm.MapBtn("fas fa-folder")
-
assert isinstance(map_btn, sm.MapBtn)
+ assert isinstance(map_btn.children[0], sw.Icon)
+ assert map_btn.children[0].children[0] == "fas fa-folder"
+
+ # mdi icon
+ map_btn = sm.MapBtn("mdi-folder")
+ assert isinstance(map_btn.children[0], sw.Icon)
+ assert map_btn.children[0].children[0] == "mdi-folder"
+
+ # small text
+ map_btn = sm.MapBtn("to")
+ assert isinstance(map_btn.children[0], str)
+ assert map_btn.children[0] == "TO"
+
+ # long text
+ map_btn = sm.MapBtn("toto")
+ assert isinstance(map_btn.children[0], str)
+ assert map_btn.children[0] == "TOT"
return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 4
}
|
2.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.2
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@698d446e33062934d49f9edb91cbe303b73e786f#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.2
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_MapBtn.py::TestMapBtn::test_init"
] |
[
"tests/test_FullScreenControl.py::TestFullScreenControl::test_init",
"tests/test_FullScreenControl.py::TestFullScreenControl::test_toggle_fullscreen"
] |
[] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-518
|
|
12rambau__sepal_ui-533
|
7710c4abf8f0dfa916a4933c766ab6203bf3a76e
|
2022-07-06 07:47:43
|
114063b50ee5b1ccbab680424bb048e11939b870
|
diff --git a/sepal_ui/__init__.py b/sepal_ui/__init__.py
index 5eab7e53..79ccdf6f 100644
--- a/sepal_ui/__init__.py
+++ b/sepal_ui/__init__.py
@@ -1,8 +1,11 @@
import ipyvuetify as v
from sepal_ui.conf import config, config_file
-from sepal_ui.frontend.styles import color, get_theme
+from sepal_ui.frontend.styles import SepalColor, get_theme
__author__ = """Pierrick Rambaud"""
__email__ = "[email protected]"
__version__ = "2.9.4"
+
+color = SepalColor()
+'color: the colors of sepal. members are in the following list: "main, darker, bg, primary, accent, secondary, success, info, warning, error, menu". They will render according to the selected theme.'
diff --git a/sepal_ui/aoi/aoi_model.py b/sepal_ui/aoi/aoi_model.py
index 330e4bfd..fb856a77 100644
--- a/sepal_ui/aoi/aoi_model.py
+++ b/sepal_ui/aoi/aoi_model.py
@@ -10,7 +10,7 @@ from ipyleaflet import GeoJSON
from traitlets import Any
from sepal_ui import color
-from sepal_ui.frontend.styles import AOI_STYLE
+from sepal_ui.frontend import styles as ss
from sepal_ui.message import ms
from sepal_ui.model import Model
from sepal_ui.scripts import gee
@@ -619,7 +619,8 @@ class AoiModel(Model):
f["properties"]["name"] = self.name
# adapt the style to the theme
- style = {**AOI_STYLE, "color": color.success, "fillColor": color.success}
+ style = json.loads((ss.JSON_DIR / "aoi.json").read_text())
+ style.update(color=color.success, fillColor=color.success)
# create a GeoJSON object
self.ipygeojson = GeoJSON(
diff --git a/sepal_ui/frontend/json/aoi.json b/sepal_ui/frontend/json/aoi.json
new file mode 100644
index 00000000..af272ded
--- /dev/null
+++ b/sepal_ui/frontend/json/aoi.json
@@ -0,0 +1,9 @@
+{
+ "stroke": true,
+ "color": "grey",
+ "weight": 2,
+ "opacity": 1,
+ "fill": true,
+ "fillColor": "grey",
+ "fillOpacity": 0.4
+}
\ No newline at end of file
diff --git a/sepal_ui/frontend/json/file_icons.json b/sepal_ui/frontend/json/file_icons.json
new file mode 100644
index 00000000..2b140fd1
--- /dev/null
+++ b/sepal_ui/frontend/json/file_icons.json
@@ -0,0 +1,12 @@
+{
+ "": {"color": ["#ffca28", "#ffc107"], "icon": "far fa-folder"},
+ ".csv": {"color": ["#4caf50", "#00c853"], "icon": "far fa-table"},
+ ".txt": {"color": ["#4caf50", "#00c853"], "icon": "far fa-table"},
+ ".tif": {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-image"},
+ ".tiff": {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-image"},
+ ".vrt": {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-image"},
+ ".shp": {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-vector-square"},
+ ".geojson": {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-vector-square"},
+ "DEFAULT": {"color": ["#00bcd4", "#03a9f4"], "icon": "far fa-file"},
+ "PARENT": {"color": ["#424242", "#ffffff"], "icon": "far fa-folder-open"}
+}
\ No newline at end of file
diff --git a/sepal_ui/frontend/json/layer.json b/sepal_ui/frontend/json/layer.json
new file mode 100644
index 00000000..9976aff6
--- /dev/null
+++ b/sepal_ui/frontend/json/layer.json
@@ -0,0 +1,7 @@
+{
+ "stroke": true,
+ "weight": 2,
+ "opacity": 1,
+ "fill": true,
+ "fillOpacity": 0
+}
\ No newline at end of file
diff --git a/sepal_ui/frontend/json/layer_hover.json b/sepal_ui/frontend/json/layer_hover.json
new file mode 100644
index 00000000..c6b7ff45
--- /dev/null
+++ b/sepal_ui/frontend/json/layer_hover.json
@@ -0,0 +1,7 @@
+{
+ "stroke": true,
+ "weight": 5,
+ "opacity": 1,
+ "fill": true,
+ "fillOpacity": 0
+}
\ No newline at end of file
diff --git a/sepal_ui/frontend/json/map_btn.json b/sepal_ui/frontend/json/map_btn.json
new file mode 100644
index 00000000..79817a81
--- /dev/null
+++ b/sepal_ui/frontend/json/map_btn.json
@@ -0,0 +1,6 @@
+{
+ "padding": "0px",
+ "min-width": "0px",
+ "width": "30px",
+ "height": "30px"
+}
\ No newline at end of file
diff --git a/sepal_ui/frontend/json/progress_bar.json b/sepal_ui/frontend/json/progress_bar.json
new file mode 100644
index 00000000..ef7461ef
--- /dev/null
+++ b/sepal_ui/frontend/json/progress_bar.json
@@ -0,0 +1,3 @@
+{
+ "color": ["#2196f3", "#3f51b5"]
+}
\ No newline at end of file
diff --git a/sepal_ui/frontend/styles.py b/sepal_ui/frontend/styles.py
index 97a03dde..a8bfff93 100644
--- a/sepal_ui/frontend/styles.py
+++ b/sepal_ui/frontend/styles.py
@@ -8,6 +8,26 @@ from traitlets import Bool, HasTraits, Unicode, observe
import sepal_ui.scripts.utils as su
from sepal_ui import config
+################################################################################
+# access the folders where style information is stored (layers, widgets)
+#
+
+# the colors are set using tables as follow.
+# 1 (True): dark theme
+# 0 (false): light theme
+JSON_DIR = Path(__file__).parent / "json"
+"pathlib.Path: the path to the json style folder"
+
+CSS_DIR = Path(__file__).parent / "css"
+"pathlib.Path: the path to the css style folder"
+
+JS_DIR = Path(__file__).parent / "js"
+"pathlib.Path: the path to the js style folder"
+
+################################################################################
+# define all the colors taht we want to use in the theme
+#
+
DARK_THEME = {
"primary": "#b3842e",
"accent": "#a1458e",
@@ -21,6 +41,7 @@ DARK_THEME = {
"bg": "#121212", # Are not traits
"menu": "#424242", # Are not traits
}
+"dict: colors used for the dark theme"
LIGHT_THEME = {
"primary": v.theme.themes.light.primary,
@@ -35,17 +56,19 @@ LIGHT_THEME = {
"bg": "#FFFFFF",
"menu": "#FFFFFF",
}
+"dict: colors used for the light theme"
+TYPES = ("info", "primary", "secondary", "accent", "error", "success", "warning", "anchor") # fmt: skip
+"tuple: the different types defined by ipyvuetify"
-if not DARK_THEME.keys() == LIGHT_THEME.keys():
- raise Exception("Both dictionaries has to have the same color names")
+################################################################################
+# define classes and method to make the application resonsive
+#
def get_theme():
"""
get theme name from the config file (default to dark)
- Args:
-
Return:
(str): the theme to use
"""
@@ -53,10 +76,11 @@ def get_theme():
class SepalColor(HasTraits, SimpleNamespace):
- """Custom simple name space to store and access to the sepal_ui colors and
- with a magic method to display theme."""
+ """
+ Custom simple name space to store and access to the sepal_ui colors and
+ with a magic method to display theme.
+ """
- # Initialize with the current theme
_dark_theme = Bool(True if get_theme() == "dark" else False).tag(sync=True)
"bool: whether to use dark theme or not. By changing this value, the theme value will be stored in the conf file. Is only intended to be accessed in development mode."
@@ -117,10 +141,6 @@ class SepalColor(HasTraits, SimpleNamespace):
return html
-color = SepalColor()
-'color: the colors of sepal. members are in the following list: "main, darker, bg, primary, accent, secondary, success, info, warning, error, menu". They will render according to the selected theme.'
-
-
class Styles(v.VuetifyTemplate):
"""
Fixed styles to fix display issues in the lib:
@@ -132,7 +152,7 @@ class Styles(v.VuetifyTemplate):
- ensure that tqdm bars are using a transparent background when displayed in an alert
"""
- css = (Path(__file__).parent / "css/custom.css").read_text()
+ css = (CSS_DIR / "custom.css").read_text()
cdn = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
template = Unicode(
f'<style>{css}</style><link rel="stylesheet" href="{cdn}"/>'
@@ -142,83 +162,3 @@ class Styles(v.VuetifyTemplate):
styles = Styles()
display(styles)
-
-# default styling of the aoi layer
-AOI_STYLE = {
- "stroke": True,
- "color": "grey",
- "weight": 2,
- "opacity": 1,
- "fill": True,
- "fillColor": "grey",
- "fillOpacity": 0.4,
-}
-
-# the colors are set as follow.
-# 1 (True): dark theme
-# 0 (false): light theme
-# This will need to be changed if we want to support more than 2 theme
-COMPONENTS = {
- "PROGRESS_BAR": {
- "color": ["#2196f3", "#3f51b5"],
- }
-}
-
-_folder = {"color": ["#ffca28", "#ffc107"], "icon": "far fa-folder"}
-_table = {"color": ["#4caf50", "#00c853"], "icon": "far fa-table"}
-_vector = {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-vector-square"}
-_other = {"color": ["#00bcd4", "#03a9f4"], "icon": "far fa-file"}
-_parent = {"color": ["#424242", "#ffffff"], "icon": "far fa-folder-open"}
-_image = {"color": ["#9c27b0", "#673ab7"], "icon": "far fa-image"}
-
-ICON_TYPES = {
- "": _folder,
- ".csv": _table,
- ".txt": _table,
- ".tif": _image,
- ".tiff": _image,
- ".vrt": _image,
- ".shp": _vector,
- ".geojson": _vector,
- "DEFAULT": _other,
- "PARENT": _parent,
-}
-
-TYPES = (
- "info",
- "primary",
- "secondary",
- "accent",
- "error",
- "success",
- "warning",
- "anchor",
-)
-
-# Default styles to GeoJSON layers added to a SepalMap.
-
-layer_style = {
- "stroke": True,
- "color": color.primary,
- "weight": 2,
- "opacity": 1,
- "fill": True,
- "fillOpacity": 0,
-}
-
-layer_hover_style = {
- "stroke": True,
- "color": color.primary,
- "weight": 5,
- "opacity": 1,
- "fill": True,
- "fillOpacity": 0,
-}
-
-map_btn_style = {
- "padding": "0px",
- "min-width": "0px",
- "width": "30px",
- "height": "30px",
- "background": color.bg,
-}
diff --git a/sepal_ui/mapping/map_btn.py b/sepal_ui/mapping/map_btn.py
index 0ea13364..109f13ee 100644
--- a/sepal_ui/mapping/map_btn.py
+++ b/sepal_ui/mapping/map_btn.py
@@ -1,7 +1,10 @@
+import json
+
import ipyvuetify as v
+from sepal_ui import color
from sepal_ui import sepalwidgets as sw
-from sepal_ui.frontend.styles import map_btn_style
+from sepal_ui.frontend import styles as ss
class MapBtn(v.Btn, sw.SepalWidget):
@@ -22,10 +25,14 @@ class MapBtn(v.Btn, sw.SepalWidget):
else:
content = content[: min(3, len(content))].upper()
+ # create the style from default
+ style = json.loads((ss.JSON_DIR / "map_btn.json").read_text())
+ style.update(background=color.bg)
+
# some parameters are overloaded to match the map requirements
kwargs["color"] = "text-color"
kwargs["outlined"] = True
- kwargs["style_"] = " ".join([f"{k}: {v};" for k, v in map_btn_style.items()])
+ kwargs["style_"] = " ".join([f"{k}: {v};" for k, v in style.items()])
kwargs["children"] = [content]
kwargs["icon"] = False
diff --git a/sepal_ui/mapping/sepal_map.py b/sepal_ui/mapping/sepal_map.py
index 4ef41d1a..f746a72c 100644
--- a/sepal_ui/mapping/sepal_map.py
+++ b/sepal_ui/mapping/sepal_map.py
@@ -6,6 +6,7 @@ if "GDAL_DATA" in list(os.environ.keys()):
if "PROJ_LIB" in list(os.environ.keys()):
del os.environ["PROJ_LIB"]
+import json
import math
import random
import string
@@ -27,7 +28,8 @@ from matplotlib import colorbar
from matplotlib import colors as mpc
from rasterio.crs import CRS
-import sepal_ui.frontend.styles as styles
+from sepal_ui import color
+from sepal_ui.frontend import styles as ss
from sepal_ui.mapping.basemaps import basemap_tiles
from sepal_ui.mapping.draw_control import DrawControl
from sepal_ui.mapping.layer import EELayer
@@ -775,8 +777,18 @@ class SepalMap(ipl.Map):
# apply default coloring for geoJson
if isinstance(layer, ipl.GeoJSON):
- layer.style = layer.style or styles.layer_style
- hover_style = styles.layer_hover_style if hover else layer.hover_style
+
+ # define the default values
+ default_style = json.loads((ss.JSON_DIR / "layer.json").read_text())
+ default_style.update(color=color.primary)
+ default_hover_style = json.loads(
+ (ss.JSON_DIR / "layer_hover.json").read_text()
+ )
+ default_hover_style.update(color=color.primary)
+
+ # apply the style depending on the parameters
+ layer.style = layer.style or default_style
+ hover_style = default_hover_style if hover else layer.hover_style
layer.hover_style = layer.hover_style or hover_style
super().add_layer(layer)
diff --git a/sepal_ui/mapping/value_inspector.py b/sepal_ui/mapping/value_inspector.py
index 96508ba3..8149a078 100644
--- a/sepal_ui/mapping/value_inspector.py
+++ b/sepal_ui/mapping/value_inspector.py
@@ -1,3 +1,5 @@
+import json
+
import ee
import geopandas as gpd
import ipyvuetify as v
@@ -10,7 +12,7 @@ from shapely import geometry as sg
from sepal_ui import color
from sepal_ui import sepalwidgets as sw
-from sepal_ui.frontend.styles import COMPONENTS
+from sepal_ui.frontend import styles as ss
from sepal_ui.mapping.layer import EELayer
from sepal_ui.mapping.map_btn import MapBtn
from sepal_ui.message import ms
@@ -47,10 +49,11 @@ class ValueInspector(WidgetControl):
# create a loading to place it on top of the card. It will always be visible
# even when the card is scrolled
+ p_style = json.loads((ss.JSON_DIR / "progress_bar.json").read_text())
self.w_loading = sw.ProgressLinear(
indeterminate=False,
background_color=color.menu,
- color=COMPONENTS["PROGRESS_BAR"]["color"][v.theme.dark],
+ color=p_style["color"][v.theme.dark],
)
# create a clickable btn
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index 6ad4d5d0..f80b20ef 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -6,7 +6,8 @@ from ipywidgets import Output, jslink
from tqdm.notebook import tqdm
from traitlets import Bool, Unicode, directional_link, observe
-from sepal_ui.frontend.styles import TYPES, color
+from sepal_ui import color
+from sepal_ui.frontend.styles import TYPES
from sepal_ui.message import ms
from sepal_ui.scripts import utils as su
from sepal_ui.scripts.utils import set_type
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 38ffef00..438238e1 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -1,3 +1,4 @@
+import json
from datetime import datetime
from pathlib import Path
@@ -10,7 +11,7 @@ from natsort import humansorted
from traitlets import Any, Bool, Dict, Int, List, Unicode, link, observe
from sepal_ui import color
-from sepal_ui.frontend.styles import COMPONENTS, ICON_TYPES
+from sepal_ui.frontend import styles as ss
from sepal_ui.message import ms
from sepal_ui.scripts import gee
from sepal_ui.scripts import utils as su
@@ -193,6 +194,9 @@ class FileInput(v.Flex, SepalWidget):
v_model = Unicode(None, allow_none=True).tag(sync=True)
"str: the v_model of the input"
+ ICON_STYLE = json.loads((ss.JSON_DIR / "file_icons.json").read_text())
+ "dict: the style applied to the icons in the file menu"
+
def __init__(
self,
extentions=[],
@@ -216,10 +220,11 @@ class FileInput(v.Flex, SepalWidget):
v_model=None,
)
+ p_style = json.loads((ss.JSON_DIR / "progress_bar.json").read_text())
self.loading = v.ProgressLinear(
indeterminate=False,
background_color=color.menu,
- color=COMPONENTS["PROGRESS_BAR"]["color"][v.theme.dark],
+ color=p_style["color"][v.theme.dark],
)
self.file_list = v.List(
@@ -376,14 +381,14 @@ class FileInput(v.Flex, SepalWidget):
for el in list_dir:
if el.is_dir():
- icon = ICON_TYPES[""]["icon"]
- color = ICON_TYPES[""]["color"][v.theme.dark]
- elif el.suffix in ICON_TYPES.keys():
- icon = ICON_TYPES[el.suffix]["icon"]
- color = ICON_TYPES[el.suffix]["color"][v.theme.dark]
+ icon = self.ICON_STYLE[""]["icon"]
+ color = self.ICON_STYLE[""]["color"][v.theme.dark]
+ elif el.suffix in self.ICON_STYLE.keys():
+ icon = self.ICON_STYLE[el.suffix]["icon"]
+ color = self.ICON_STYLE[el.suffix]["color"][v.theme.dark]
else:
- icon = ICON_TYPES["DEFAULT"]["icon"]
- color = ICON_TYPES["DEFAULT"]["color"][v.theme.dark]
+ icon = self.ICON_STYLE["DEFAULT"]["icon"]
+ color = self.ICON_STYLE["DEFAULT"]["color"][v.theme.dark]
children = [
v.ListItemAction(children=[v.Icon(color=color, children=[icon])]),
@@ -410,8 +415,8 @@ class FileInput(v.Flex, SepalWidget):
v.ListItemAction(
children=[
v.Icon(
- color=ICON_TYPES["PARENT"]["color"][v.theme.dark],
- children=[ICON_TYPES["PARENT"]["icon"]],
+ color=self.ICON_STYLE["PARENT"]["color"][v.theme.dark],
+ children=[self.ICON_STYLE["PARENT"]["icon"]],
)
]
),
|
add TYPES to documentation
don't haw to deal with variables yet
|
12rambau/sepal_ui
|
diff --git a/tests/test_SepalMap.py b/tests/test_SepalMap.py
index 30a0d3eb..438ffa7a 100644
--- a/tests/test_SepalMap.py
+++ b/tests/test_SepalMap.py
@@ -1,3 +1,4 @@
+import json
import math
import random
from pathlib import Path
@@ -7,9 +8,9 @@ import ee
import pytest
from ipyleaflet import GeoJSON, LocalTileLayer
-import sepal_ui.frontend.styles as styles
from sepal_ui import get_theme
from sepal_ui import mapping as sm
+from sepal_ui.frontend import styles as ss
# create a seed so that we can check values
random.seed(42)
@@ -289,8 +290,11 @@ class TestSepalMap:
# Assert
new_layer = m.layers[-1]
- assert new_layer.style == styles.layer_style
- assert new_layer.hover_style == styles.layer_hover_style
+ layer_style = json.loads((ss.JSON_DIR / "layer.json").read_text())
+ hover_style = json.loads((ss.JSON_DIR / "layer_hover.json").read_text())
+
+ assert all([new_layer.style[k] == v for k, v in layer_style.items()])
+ assert all([new_layer.hover_style[k] == v for k, v in hover_style.items()])
# Arrange with style
layer_style = {"color": "blue"}
diff --git a/tests/test_style.py b/tests/test_style.py
new file mode 100644
index 00000000..a52c5f5e
--- /dev/null
+++ b/tests/test_style.py
@@ -0,0 +1,19 @@
+from sepal_ui.frontend import styles as ss
+
+
+class TestStyle:
+ def test_folders(self):
+
+ assert ss.JSON_DIR.is_dir()
+ assert ss.CSS_DIR.is_dir()
+ assert ss.JS_DIR.is_dir()
+
+ return
+
+ def test_colors(self):
+
+ # test that colors have the same size and names
+ assert len(ss.DARK_THEME.keys()) == len(ss.LIGHT_THEME.keys())
+ assert all(dc in ss.LIGHT_THEME.keys() for dc in ss.DARK_THEME.keys())
+
+ return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 8
}
|
2.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest==8.3.5
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@7710c4abf8f0dfa916a4933c766ab6203bf3a76e#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest==8.3.5
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_style.py::TestStyle::test_folders"
] |
[
"tests/test_SepalMap.py::TestSepalMap::test_init",
"tests/test_SepalMap.py::TestSepalMap::test_set_center",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_bounds",
"tests/test_SepalMap.py::TestSepalMap::test_add_colorbar",
"tests/test_SepalMap.py::TestSepalMap::test_add_ee_layer",
"tests/test_SepalMap.py::TestSepalMap::test_get_basemap_list",
"tests/test_SepalMap.py::TestSepalMap::test_get_viz_params",
"tests/test_SepalMap.py::TestSepalMap::test_add_layer",
"tests/test_SepalMap.py::TestSepalMap::test_add_basemap",
"tests/test_SepalMap.py::TestSepalMap::test_get_scale",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_raster"
] |
[
"tests/test_style.py::TestStyle::test_colors"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-535
|
6a619361e90ab318463e2094fc9dbcbc85dd2e8f
|
2022-07-06 13:02:30
|
114063b50ee5b1ccbab680424bb048e11939b870
|
diff --git a/sepal_ui/mapping/sepal_map.py b/sepal_ui/mapping/sepal_map.py
index 57693e56..e2860daf 100644
--- a/sepal_ui/mapping/sepal_map.py
+++ b/sepal_ui/mapping/sepal_map.py
@@ -227,8 +227,8 @@ class SepalMap(ipl.Map):
# Center map to the centroid of the layer(s)
self.center = [(maxy - miny) / 2 + miny, (maxx - minx) / 2 + minx]
- # create the tuples for each corner
- tl, br, bl, tr = (minx, maxy), (maxx, miny), (minx, miny), (maxx, maxy)
+ # create the tuples for each corner in (lat/lng) convention
+ tl, br, bl, tr = (maxy, minx), (miny, maxx), (miny, minx), (maxy, maxx)
# find zoom level to display the biggest diagonal (in km)
lg, zoom = 40075, 1 # number of displayed km at zoom 1
diff --git a/sepal_ui/message/en/locale.json b/sepal_ui/message/en/locale.json
index 5989dee5..b689db70 100644
--- a/sepal_ui/message/en/locale.json
+++ b/sepal_ui/message/en/locale.json
@@ -37,7 +37,6 @@
"custom": "Custom",
"no_access": "It seems like you do not have access to the input asset or it does not exist.",
"wrong_type": "The type of the selected asset ({}) does not match authorized asset type ({}).",
- "hint": "Select an asset in the list or write a custom asset name. Be careful, you need to have access to this asset to use it",
"placeholder": "users/custom_user/custom_asset"
},
"load_table": {
@@ -65,20 +64,6 @@
"asset": "GEE Asset name",
"btn": "Select AOI",
"complete": "The AOI has been selected",
- "shape_drawn": "A shape has been drawn",
- "file_pattern": "aoi_{}",
- "no_selection": "No selection method has been picked up",
- "no_country": "No Country has been selected",
- "asset_already_exist": "The asset was already existing you can continue to use it. It's also available at :{}",
- "asset_created": "The asset has been created under the name : {}",
- "name_used": "The name was already in used, change it or delete the previous asset in your GEE acount",
- "no_asset": "No Asset has been provided",
- "check_if_asset": "Check carefully that your string is an assetId",
- "not_available": "This function is not yet available",
- "no_shape": "No shape has been drawn on the map",
- "shp_error": "An error occured with provided .shp file",
- "aoi_message": "click on \"selet these inputs\" to validate your AOI",
- "geojson_to_ee": "Convert your .csv file into a ee_object",
"exception" : {
"no_inputs": "Please provide fully qualified inputs before validating your AOI",
"no_asset" : "Please select an asset.",
@@ -98,7 +83,6 @@
"planet" : {
"exception" : {
"empty": "Please fill the required field(s).",
- "format" : "Please check the format of your inputs.",
"invalid" : "Invalid email or password",
"nosubs" : "Your credentials do not have any valid planet subscription."
},
@@ -143,7 +127,7 @@
"0": "New element",
"1": "Modify element"
},
- "btn": {
+ "btn": {
"save": {
"name": "save",
"tooltip": "create new class"
diff --git a/sepal_ui/reclassify/table_view.py b/sepal_ui/reclassify/table_view.py
index 0f8bf1cd..c3f8a35a 100644
--- a/sepal_ui/reclassify/table_view.py
+++ b/sepal_ui/reclassify/table_view.py
@@ -212,15 +212,24 @@ class EditDialog(v.Dialog):
self.title = v.CardTitle(children=[self.TITLES[0]])
# Action buttons
- btn_txt = ms.rec.table.edit_dialog.btn
- self.save = sw.Btn(btn_txt.save.name)
- save_tool = sw.Tooltip(self.save, btn_txt.save.tooltip, bottom=True)
+ self.save = sw.Btn(ms.rec.table.edit_dialog.btn.save.name)
+ save_tool = sw.Tooltip(
+ self.save, ms.rec.table.edit_dialog.btn.save.tooltip, bottom=True
+ )
- self.modify = sw.Btn(btn_txt.modify.name).hide() # by default modify is hidden
- modify_tool = sw.Tooltip(self.modify, btn_txt.modify.tooltip, bottom=True)
+ self.modify = sw.Btn(
+ ms.rec.table.edit_dialog.btn.modify.name
+ ).hide() # by default modify is hidden
+ modify_tool = sw.Tooltip(
+ self.modify, ms.rec.table.edit_dialog.btn.modify.tooltip, bottom=True
+ )
- self.cancel = sw.Btn(btn_txt.cancel.name, outlined=True, class_="ml-2")
- cancel_tool = sw.Tooltip(self.cancel, btn_txt.cancel.tooltip, bottom=True)
+ self.cancel = sw.Btn(
+ ms.rec.table.edit_dialog.btn.cancel.name, outlined=True, class_="ml-2"
+ )
+ cancel_tool = sw.Tooltip(
+ self.cancel, ms.rec.table.edit_dialog.btn.cancel.tooltip, bottom=True
+ )
actions = v.CardActions(children=[save_tool, modify_tool, cancel_tool])
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index 6d869aaa..e143170e 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -380,8 +380,11 @@ class Banner(v.Snackbar, SepalWidget):
Args:
nb_banner (int): the number of banners in the queue
"""
- msg = ms.widgets.banner
- txt = msg.close if nb_banner == 0 else msg.next.format(nb_banner)
+ # do not wrap ms.widget.banner. If you do it won't be recognized by the key-checker of the Translator
+ if nb_banner == 0:
+ txt = ms.widgets.banner.close
+ else:
+ txt = ms.widgets.banner.next.format(nb_banner)
self.btn_close.children = [txt]
return
diff --git a/sepal_ui/translator/translator.py b/sepal_ui/translator/translator.py
index 5cf26320..f3a4b791 100644
--- a/sepal_ui/translator/translator.py
+++ b/sepal_ui/translator/translator.py
@@ -3,6 +3,7 @@ from collections import abc
from configparser import ConfigParser
from pathlib import Path
+import pandas as pd
from box import Box
from deprecated.sphinx import deprecated, versionadded
@@ -262,3 +263,58 @@ class Translator(Box):
del d[k]
return d
+
+ @versionadded(version="2.10.0")
+ def key_use(self, folder, name):
+ """
+ Parse all the files in the folder and check if keys are all used at least once.
+ Return the unused key names.
+
+ .. warning::
+
+ Don't forget that there are many ways of calling Translator variables
+ (getattr, save.cm.xxx in another variable etc...) SO don't forget to check
+ manually the variables suggested by this method before deleting them
+
+ Args:
+ folder (pathlib.Path): The application folder using this translator data
+ name (str): the name use by the translator in this app (usually "cm")
+
+ Return:
+ (list): the list of unused keys
+ """
+ # cannot set FORBIDDEN_KEY in the Box as it would lock another key
+ FORBIDDEN_KEYS = ["_folder", "_default", "_target", "_targeted", "_match"]
+
+ # sanitize folder
+ folder = Path(folder)
+
+ # get all the python files recursively
+ py_files = [
+ f for f in folder.glob("**/*.py") if ".ipynb_checkpoints" not in str(f)
+ ]
+
+ # get the flat version of all keys
+ keys = list(set(pd.json_normalize(self).columns) ^ set(FORBIDDEN_KEYS))
+
+ # init the unused keys list
+ unused_keys = []
+
+ for k in keys:
+
+ # by default we consider that the is never used
+ is_present = False
+
+ # read each python file and search for the pattern of the key
+ # if it's find change status of the counter and exit the search
+ for f in py_files:
+ tmp = f.read_text()
+ if f"{name}.{k}" in tmp:
+ is_present = True
+ break
+
+ # if nothing is find, the value is still False and the key can be
+ # added to the list
+ is_present or unused_keys.append(k)
+
+ return unused_keys
|
create a translator function to check the use of the keys
If you are updating many time the same application you may end up removing some or all the existing keys. It complex to visually assess if all the remaining keys in the dict are used.
Maybe a parser could be interesting to check all the folder files and validate the keys that are used.
Usage will be of course for developer only
|
12rambau/sepal_ui
|
diff --git a/tests/test_Translator.py b/tests/test_Translator.py
index 7c8e7242..48d34519 100644
--- a/tests/test_Translator.py
+++ b/tests/test_Translator.py
@@ -6,6 +6,7 @@ from pathlib import Path
import pytest
from sepal_ui import config_file
+from sepal_ui.message import ms
from sepal_ui.translator import Translator
@@ -121,6 +122,16 @@ class TestTranslator:
return
+ def test_key_use(self):
+
+ # check key usage method and the lib content at the same time
+ expected = ["test_key"]
+ lib_folder = Path(__file__).parents[1]
+ res = ms.key_use(lib_folder, "ms")
+ assert res == expected
+
+ return
+
@pytest.fixture(scope="class")
def translation_folder(self):
"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 5
}
|
2.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.3.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
haversine==2.9.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipyspin==1.0.1
ipython==8.12.3
ipython-genutils==0.2.0
ipyurl==0.1.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyter_server_xarray_leaflet==0.2.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mercantile==1.2.1
mistune==3.1.3
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@6a619361e90ab318463e2094fc9dbcbc85dd2e8f#egg=sepal_ui
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.10
wrapt==1.17.2
xarray==2024.7.0
xarray_leaflet==0.2.3
xyzservices==2025.1.0
yarg==0.1.9
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- fsspec==2025.3.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- haversine==2.9.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipyspin==1.0.1
- ipython==8.12.3
- ipython-genutils==0.2.0
- ipyurl==0.1.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==7.8.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-terminals==0.5.3
- jupyter-server-xarray-leaflet==0.2.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==1.1.11
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mercantile==1.2.1
- mistune==3.1.3
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==3.6.10
- wrapt==1.17.2
- xarray==2024.7.0
- xarray-leaflet==0.2.3
- xyzservices==2025.1.0
- yarg==0.1.9
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Translator.py::TestTranslator::test_key_use"
] |
[] |
[
"tests/test_Translator.py::TestTranslator::test_init",
"tests/test_Translator.py::TestTranslator::test_search_key",
"tests/test_Translator.py::TestTranslator::test_sanitize",
"tests/test_Translator.py::TestTranslator::test_delete_empty",
"tests/test_Translator.py::TestTranslator::test_find_target",
"tests/test_Translator.py::TestTranslator::test_available_locales"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-571
|
412e02ef08df68c256f384081d2c7eaecc09428e
|
2022-08-11 17:01:29
|
8c50a7f032daafcbf7cfb6dc16d5d421f02a32e5
|
diff --git a/.cz.yaml b/.cz.yaml
index 05742add..c2d69e89 100644
--- a/.cz.yaml
+++ b/.cz.yaml
@@ -3,7 +3,7 @@ commitizen:
changelog_incremental: true
tag_format: v_$major.$minor.$patch$prerelease
update_changelog_on_bump: true
- version: 2.10.3
+ version: 2.10.2
version_files:
- setup.py:version
- sepal_ui/__init__.py:__version__
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml
index ffeb0434..89744741 100644
--- a/.github/workflows/unit.yml
+++ b/.github/workflows/unit.yml
@@ -30,10 +30,6 @@ jobs:
python -m pip install --upgrade pip
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- - name: Install localetileserver
- run: |
- pip install localtileserver
-
- name: Install dependencies
run: pip install .[test]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab8a7927..fb338910 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,16 +1,3 @@
-## v_2.10.3 (2022-08-10)
-
-### Fix
-
-- lazy import localtileserver
-- avoid reloading root when fileinput is already none
-
-### Refactor
-
-- .. spelling:word-list::
-- reset method
-- remove legacy print
-
## v_2.10.2 (2022-07-28)
### Fix
diff --git a/sepal_ui/__init__.py b/sepal_ui/__init__.py
index 0f65dc57..64d44a80 100644
--- a/sepal_ui/__init__.py
+++ b/sepal_ui/__init__.py
@@ -5,7 +5,7 @@ from sepal_ui.frontend.styles import SepalColor, get_theme
__author__ = """Pierrick Rambaud"""
__email__ = "[email protected]"
-__version__ = "2.10.3"
+__version__ = "2.10.2"
color = SepalColor()
'color: the colors of sepal. members are in the following list: "main, darker, bg, primary, accent, secondary, success, info, warning, error, menu". They will render according to the selected theme.'
diff --git a/sepal_ui/mapping/__init__.py b/sepal_ui/mapping/__init__.py
index 78835859..b178a82b 100644
--- a/sepal_ui/mapping/__init__.py
+++ b/sepal_ui/mapping/__init__.py
@@ -3,6 +3,7 @@ from .draw_control import *
from .fullscreen_control import *
from .layer import *
from .layer_state_control import *
+from .legend_control import *
from .map_btn import *
from .menu_control import *
from .sepal_map import *
diff --git a/sepal_ui/mapping/legend_control.py b/sepal_ui/mapping/legend_control.py
new file mode 100644
index 00000000..de367c3c
--- /dev/null
+++ b/sepal_ui/mapping/legend_control.py
@@ -0,0 +1,158 @@
+from ipyleaflet import WidgetControl
+from ipywidgets import HTML
+from traitlets import Bool, Dict, Unicode, observe
+
+import sepal_ui.sepalwidgets as sw
+from sepal_ui.message import ms
+from sepal_ui.scripts import utils as su
+
+
+class LegendControl(WidgetControl):
+ """
+ A custom Legend widget ready to be embed in a map
+
+ This Legend can be control though it's different attributes, changin it's position of course but also the orientation ,the keys and their colors.
+
+ .. versionadded:: 2.10.4
+
+ Args:
+ legend_dict (dict): the dictionnary to fill the legend values. cannot be empty.
+ title (str) title of the legend, if not set a default value in the current language will be used
+ vertical (bool): the orientation of the legend. default to True
+ """
+
+ title = Unicode(None).tag(sync=True)
+ "Unicode: title of the legend."
+
+ legend_dict = Dict(None).tag(sync=True)
+ "Dict: dictionary with key as label name and value as color"
+
+ vertical = Bool(None).tag(sync=True)
+ "Bool: whether to display the legend in a vertical or horizontal way"
+
+ _html_table = None
+
+ _html_title = None
+
+ def __init__(
+ self, legend_dict={}, title=ms.mapping.legend, vertical=True, **kwargs
+ ):
+
+ # init traits
+ self.title = title
+ self.legend_dict = legend_dict
+ self.vertical = vertical
+
+ # generate the content based on the init options
+ self._html_title = sw.Html(tag="h4", children=[f"{self.title}"])
+ self._html_table = sw.Html(tag="table", children=[])
+
+ # create a card inside the widget
+ # Be sure that the scroll bar will be shown up when legend horizontal
+ self.legend_card = sw.Card(
+ attributes={"id": "legend_card"},
+ style_="overflow-x:auto; white-space: nowrap;",
+ max_width=450,
+ max_height=350,
+ children=[self._html_title, self._html_table],
+ ).hide()
+
+ # set some parameters for the actual widget
+ kwargs["widget"] = self.legend_card
+ kwargs["position"] = kwargs.pop("position", "bottomright")
+
+ super().__init__(**kwargs)
+
+ self._set_legend(legend_dict)
+
+ def __len__(self):
+ """returns the number of elements in the legend"""
+
+ return len(self.legend_dict)
+
+ def hide(self):
+ """Hide control by hiding its content"""
+ self.legend_card.hide()
+
+ def show(self):
+ """Show control by displaying its content"""
+ self.legend_card.show()
+
+ @observe("legend_dict", "vertical")
+ def _set_legend(self, _):
+ """Creates/update a legend based on the class legend_dict member"""
+
+ # Do this to avoid crash when called by trait for the first time
+ if self._html_table is None:
+ return
+
+ if not self.legend_dict:
+ self.hide()
+ return
+
+ self.show()
+
+ if self.vertical:
+ elements = [
+ sw.Html(
+ tag="tr" if self.vertical else "td",
+ children=[
+ sw.Html(tag="td", children=self.color_box(color)),
+ label.capitalize(),
+ ],
+ )
+ for label, color in self.legend_dict.items()
+ ]
+ else:
+ elements = [
+ (
+ sw.Html(
+ tag="td",
+ children=[label.capitalize()],
+ ),
+ sw.Html(
+ tag="td",
+ children=self.color_box(color),
+ ),
+ )
+ for label, color in self.legend_dict.items()
+ ]
+ # Flat nested list
+ elements = [e for row in elements for e in row]
+
+ self._html_table.children = elements
+
+ return
+
+ @observe("title")
+ def _update_title(self, change):
+ """Trait method to update the title of the legend"""
+
+ # Do this to avoid crash when called by trait
+ if self._html_title is None:
+ return
+
+ self._html_title.children = change["new"]
+
+ return
+
+ @staticmethod
+ def color_box(color, size=35):
+ """Returns an rectangular SVG html element with the provided color"""
+
+ # Define height and width based on the size
+ w = size
+ h = size / 2
+
+ return [
+ HTML(
+ f"""
+ <th>
+ <svg width='{w}' height='{h}'>
+ <rect width='{w}' height='{h}' style='fill:{su.to_colors(color)};
+ stroke-width:1;stroke:rgb(255,255,255)'/>
+ </svg>
+ </th>
+ """
+ )
+ ]
diff --git a/sepal_ui/mapping/sepal_map.py b/sepal_ui/mapping/sepal_map.py
index 6d2690ad..004c4360 100644
--- a/sepal_ui/mapping/sepal_map.py
+++ b/sepal_ui/mapping/sepal_map.py
@@ -33,6 +33,7 @@ from sepal_ui.mapping.basemaps import basemap_tiles
from sepal_ui.mapping.draw_control import DrawControl
from sepal_ui.mapping.layer import EELayer
from sepal_ui.mapping.layer_state_control import LayerStateControl
+from sepal_ui.mapping.legend_control import LegendControl
from sepal_ui.mapping.value_inspector import ValueInspector
from sepal_ui.message import ms
from sepal_ui.scripts import utils as su
@@ -859,6 +860,28 @@ class SepalMap(ipl.Map):
return layer
+ def add_legend(
+ self,
+ title=ms.mapping.legend,
+ legend_dict={},
+ position="bottomright",
+ vertical=True,
+ ):
+ """
+ Creates and adds a custom legend as widget control to the map
+
+ Args:
+ title (str, optional): Title of the legend. Defaults to 'Legend'.
+ legend_dict (dict): dictionary with key as label name and value as color
+ """
+
+ # Define as class member so it can be accessed from outside.
+ self.legend = LegendControl(
+ legend_dict, title=title, vertical=vertical, position=position
+ )
+
+ return self.add_control(self.legend)
+
# ##########################################################################
# ### overwrite geemap calls ###
# ##########################################################################
diff --git a/sepal_ui/message/en/locale.json b/sepal_ui/message/en/locale.json
index b689db70..247d226f 100644
--- a/sepal_ui/message/en/locale.json
+++ b/sepal_ui/message/en/locale.json
@@ -78,7 +78,8 @@
}
},
"mapping": {
- "no_image": "The image file does not exist."
+ "no_image": "The image file does not exist.",
+ "legend" : "Legend"
},
"planet" : {
"exception" : {
diff --git a/setup.py b/setup.py
index 89750b43..f259be17 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from subprocess import check_call
from setuptools import setup
from setuptools.command.develop import develop
-version = "2.10.3"
+version = "2.10.2"
DESCRIPTION = "Wrapper for ipyvuetify widgets to unify the display of voila dashboards in SEPAL platform"
LONG_DESCRIPTION = open("README.rst").read()
@@ -69,6 +69,7 @@ setup_params = {
"pyyaml",
"dask",
"tqdm",
+ "localtileserver",
"jupyter-server-proxy",
"matplotlib",
"rioxarray",
|
add_legend feature
Now, as we got rid of the geemap library, one important and missing feature is `add_legend`, would be nice to get it back natively.
|
12rambau/sepal_ui
|
diff --git a/tests/test_LegendControl.py b/tests/test_LegendControl.py
new file mode 100644
index 00000000..142cdce7
--- /dev/null
+++ b/tests/test_LegendControl.py
@@ -0,0 +1,114 @@
+import re
+
+from sepal_ui.mapping import LegendControl
+
+
+class TestLegend:
+ def test_init(self):
+
+ legend_dict = {
+ "forest": "#b3842e",
+ "non forest": "#a1458e",
+ "secondary": "#324a88",
+ "success": "#3f802a",
+ "info": "#79b1c9",
+ "warning": "#b8721d",
+ }
+
+ # hardcode expected
+ expected_labels = [
+ "Forest",
+ "Non forest",
+ "Secondary",
+ "Success",
+ "Info",
+ "Warning",
+ ]
+
+ legend = LegendControl(legend_dict, title="Legend")
+
+ # Check all the default values
+ assert legend.title == "Legend"
+ assert legend._html_title.children[0] == "Legend"
+ assert legend.legend_dict == legend_dict
+
+ # check all the labels and colors are present in the html
+ assert all([label in str(legend._html_table) for label in expected_labels])
+ assert all([color in str(legend._html_table) for color in legend_dict.values()])
+
+ # Check the lenght
+ assert len(legend) == 6
+
+ return
+
+ def test_set_legend(self):
+
+ legend_dict = {
+ "forest": "#b3842e",
+ "info": "#79b1c9",
+ }
+
+ legend = LegendControl(legend_dict)
+
+ new_legend = {
+ "forest": "#b3842e",
+ "non forest": "#3f802a",
+ }
+
+ # trigger the event
+ legend.legend_dict = new_legend
+
+ assert legend.legend_dict == new_legend
+
+ # Check that previous labels are not in the new legend
+ assert "Info" not in str(legend._html_table)
+
+ # check all the new labels are present in the legend
+ assert all(
+ [label in str(legend._html_table) for label in ["Forest", "Non forest"]]
+ )
+
+ # Act: change the view
+
+ # Check current view
+ assert legend.vertical is True
+
+ # in the vertical view, there should be at least two rows
+ assert str(legend._html_table).count("'tr'") == 2
+
+ legend.vertical = False
+ assert str(legend._html_table).count("'tr'") == 0
+
+ return
+
+ def test_update_title(self):
+
+ legend_dict = {
+ "forest": "#b3842e",
+ "info": "#79b1c9",
+ }
+
+ legend = LegendControl(legend_dict)
+
+ legend.title = "leyenda"
+
+ # Check all the default values
+ assert legend.title == "leyenda"
+ assert legend._html_title.children[0] == "leyenda"
+
+ return
+
+ def test_color_box(self):
+
+ legend_dict = {
+ "forest": "#b3842e",
+ "info": "#79b1c9",
+ }
+ legend = LegendControl(legend_dict)
+ str_box = re.sub("[ ]+", "", str(legend.color_box("blue", 50)[0]))
+
+ assert "fill:#0000ff" in str_box
+ assert "width='50'" in str_box
+ assert "'height='25.0'" in str_box
+
+ return
diff --git a/tests/test_SepalMap.py b/tests/test_SepalMap.py
index 2ba4da45..7c4f1dc4 100644
--- a/tests/test_SepalMap.py
+++ b/tests/test_SepalMap.py
@@ -11,6 +11,7 @@ from ipyleaflet import GeoJSON
from sepal_ui import get_theme
from sepal_ui import mapping as sm
from sepal_ui.frontend import styles as ss
+from sepal_ui.mapping.legend_control import LegendControl
# create a seed so that we can check values
random.seed(42)
@@ -387,6 +388,25 @@ class TestSepalMap:
return
+ def test_add_legend(self, ee_map_with_layers):
+
+ legend_dict = {
+ "forest": "#b3842e",
+ "non forest": "#a1458e",
+ "secondary": "#324a88",
+ "success": "#3f802a",
+ "info": "#79b1c9",
+ "warning": "#b8721d",
+ }
+
+ ee_map_with_layers.add_legend(legend_dict=legend_dict)
+
+ # just test that is a Legend, the rest is tested by Legend
+ assert isinstance(ee_map_with_layers.legend, LegendControl)
+ assert ee_map_with_layers.legend.legend_dict == legend_dict
+
+ return
+
@pytest.fixture
def rgb(self):
"""add a raster file of the bahamas coming from rasterio test suit"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 8
}
|
2.10
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"nbmake"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
haversine==2.9.0
httplib2==0.22.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest==8.3.5
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@412e02ef08df68c256f384081d2c7eaecc09428e#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==2.1.2
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- haversine==2.9.0
- httplib2==0.22.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest==8.3.5
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==2.1.2
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_LegendControl.py::TestLegend::test_init",
"tests/test_LegendControl.py::TestLegend::test_set_legend",
"tests/test_LegendControl.py::TestLegend::test_update_title",
"tests/test_LegendControl.py::TestLegend::test_color_box"
] |
[
"tests/test_SepalMap.py::TestSepalMap::test_init",
"tests/test_SepalMap.py::TestSepalMap::test_set_center",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_bounds",
"tests/test_SepalMap.py::TestSepalMap::test_add_raster",
"tests/test_SepalMap.py::TestSepalMap::test_add_colorbar",
"tests/test_SepalMap.py::TestSepalMap::test_add_ee_layer",
"tests/test_SepalMap.py::TestSepalMap::test_get_basemap_list",
"tests/test_SepalMap.py::TestSepalMap::test_get_viz_params",
"tests/test_SepalMap.py::TestSepalMap::test_add_layer",
"tests/test_SepalMap.py::TestSepalMap::test_add_basemap",
"tests/test_SepalMap.py::TestSepalMap::test_get_scale",
"tests/test_SepalMap.py::TestSepalMap::test_zoom_raster"
] |
[] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-574
|
412e02ef08df68c256f384081d2c7eaecc09428e
|
2022-08-16 14:28:01
|
8c50a7f032daafcbf7cfb6dc16d5d421f02a32e5
|
diff --git a/sepal_ui/translator/translator.py b/sepal_ui/translator/translator.py
index 1ad14c98..ea647223 100644
--- a/sepal_ui/translator/translator.py
+++ b/sepal_ui/translator/translator.py
@@ -65,7 +65,7 @@ class Translator(Box):
# check if forbidden keys are being used
# this will raise an error if any
- [self.search_key(ms_dict, k) for k in FORBIDDEN_KEYS]
+ [self.search_key(ms_dict, k) for k in FORBIDDEN_KEYS + self._protected_keys]
# # unpack the json as a simple namespace
ms_json = json.dumps(ms_dict)
@@ -130,8 +130,7 @@ class Translator(Box):
return (target, lang)
- @staticmethod
- def search_key(d, key):
+ def search_key(self, d, key):
"""
Search a specific key in the d dictionary and raise an error if found
@@ -144,7 +143,9 @@ class Translator(Box):
msg = f"You cannot use the key {key} in your translation dictionary"
raise Exception(msg)
- return
+ for k, v in d.items():
+ if isinstance(v, dict):
+ return self.search_key(v, key)
@classmethod
def sanitize(cls, d):
|
_protected_keys are not raising error when used in translator
`protected_keys` are not raising errors when used in a json translation file. It is also happening with the "`FORBIDDEN_KEYS`" when are used in nested levels.
To reproduce...
```Python
# set up the appropriate keys for each language
keys = {
"en": {
"find_target": "A key",
"test_key": "Test key",
"nested" : {
"items" : {
"_target" : "value"
},
},
"merge_dict" : "value"
},
"fr": {
"a_key": "Une clef",
"test_key": "Clef de test"
},
"fr-FR": {
"a_key": "Une clef",
"test_key": "Clef de test"
},
"es": {
"a_key": "Una llave"
},
}
# generate the tmp_dir in the test directory
tmp_dir = Path(".").parent / "data" / "messages"
tmp_dir.mkdir(exist_ok=True, parents=True)
# create the translation files
for lan, d in keys.items():
folder = tmp_dir / lan
folder.mkdir(exist_ok=True)
(folder / "locale.json").write_text(json.dumps(d, indent=2))
```
When the object is being instantiated, there's not any error to alert that the nested key "`_target`" cannot be used, nor the "`find_target`" in the first level.
```Python
translator = Translator(tmp_dir, "en")
```
|
12rambau/sepal_ui
|
diff --git a/tests/test_Translator.py b/tests/test_Translator.py
index 3c3704af..865bcd84 100644
--- a/tests/test_Translator.py
+++ b/tests/test_Translator.py
@@ -40,17 +40,30 @@ class TestTranslator:
assert translator._target == "fr-FR"
assert translator._match is True
+ # Check that is failing when using
+
return
def test_search_key(self):
+ # generate the tmp_dir in the test directory
+ tmp_dir = Path(__file__).parent / "data" / "messages"
+ tmp_dir.mkdir(exist_ok=True, parents=True)
+
# assert that having a wrong key at root level
# in the json will raise an error
key = "toto"
d = {"toto": {"a": "b"}, "c": "d"}
with pytest.raises(Exception):
- Translator.search_key(d, key)
+ Translator(tmp_dir).search_key(d, key)
+
+ # Search when the key is in a deeper nested level
+ key = "nested_key"
+ d = {"en": {"level1": {"level2": {"nested_key": "value"}}}}
+
+ with pytest.raises(Exception):
+ Translator(tmp_dir).search_key(d, key)
return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 1
}
|
2.10
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"nbmake"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
haversine==2.9.0
httplib2==0.22.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==1.5.2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest==8.3.5
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-futures==0.9.9
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@412e02ef08df68c256f384081d2c7eaecc09428e#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==2.1.2
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyio==4.9.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- haversine==2.9.0
- httplib2==0.22.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==1.5.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest==8.3.5
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-futures==0.9.9
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==2.1.2
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Translator.py::TestTranslator::test_search_key"
] |
[] |
[
"tests/test_Translator.py::TestTranslator::test_init",
"tests/test_Translator.py::TestTranslator::test_sanitize",
"tests/test_Translator.py::TestTranslator::test_delete_empty",
"tests/test_Translator.py::TestTranslator::test_find_target",
"tests/test_Translator.py::TestTranslator::test_available_locales",
"tests/test_Translator.py::TestTranslator::test_key_use"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-574
|
|
12rambau__sepal_ui-601
|
89f8d87dc4f83bfc2e96a111692ae252e470e8bc
|
2022-10-13 11:16:16
|
8a8196e3c7893b7a0aebdb4910e83054f59e0374
|
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 95fda88a..6293f828 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -6,6 +6,7 @@ import ee
import geopandas as gpd
import ipyvuetify as v
import pandas as pd
+from deprecated.sphinx import versionadded
from ipywidgets import jslink
from natsort import humansorted
from traitlets import Any, Bool, Dict, Int, List, Unicode, link, observe
@@ -29,13 +30,18 @@ __all__ = [
]
+@versionadded(
+ version="2.13.0",
+ reason="Empty v_model will be treated as empty string: :code:`v_model=''`.",
+)
class DatePicker(v.Layout, SepalWidget):
"""
Custom input widget to provide a reusable DatePicker. It allows to choose date as a string in the following format YYYY-MM-DD
Args:
label (str, optional): the label of the datepicker field
- kwargs (optional): any parameter from a v.Layout abject. If set, 'children' will be overwritten.
+ layout_kwargs (dict, optional): any parameter for the wrapper layout
+ kwargs (optional): any parameter from a v.DatePicker abject.
"""
@@ -48,13 +54,14 @@ class DatePicker(v.Layout, SepalWidget):
disabled = Bool(False).tag(sync=True)
"traitlets.Bool: the disabled status of the Datepicker object"
- def __init__(self, label="Date", **kwargs):
+ def __init__(self, label="Date", layout_kwargs={}, **kwargs):
+
+ kwargs["v_model"] = kwargs.get("v_model", "")
# create the widgets
- date_picker = v.DatePicker(no_title=True, v_model=None, scrollable=True)
+ self.date_picker = v.DatePicker(no_title=True, scrollable=True, **kwargs)
self.date_text = v.TextField(
- v_model=None,
label=label,
hint="YYYY-MM-DD format",
persistent_hint=True,
@@ -69,7 +76,7 @@ class DatePicker(v.Layout, SepalWidget):
offset_y=True,
v_model=False,
close_on_content_click=False,
- children=[date_picker],
+ children=[self.date_picker],
v_slots=[
{
"name": "activator",
@@ -80,17 +87,18 @@ class DatePicker(v.Layout, SepalWidget):
)
# set the default parameter
- kwargs["v_model"] = kwargs.pop("v_model", None)
- kwargs["row"] = kwargs.pop("row", True)
- kwargs["class_"] = kwargs.pop("class_", "pa-5")
- kwargs["align_center"] = kwargs.pop("align_center", True)
- kwargs["children"] = [v.Flex(xs10=True, children=[self.menu])]
+ layout_kwargs["row"] = layout_kwargs.get("row", True)
+ layout_kwargs["class_"] = layout_kwargs.get("class_", "pa-5")
+ layout_kwargs["align_center"] = layout_kwargs.get("align_center", True)
+ layout_kwargs["children"] = layout_kwargs.pop(
+ "children", [v.Flex(xs10=True, children=[self.menu])]
+ )
# call the constructor
- super().__init__(**kwargs)
+ super().__init__(**layout_kwargs)
- jslink((date_picker, "v_model"), (self.date_text, "v_model"))
- jslink((self, "v_model"), (date_picker, "v_model"))
+ link((self.date_picker, "v_model"), (self.date_text, "v_model"))
+ link((self.date_picker, "v_model"), (self, "v_model"))
@observe("v_model")
def check_date(self, change):
@@ -102,7 +110,7 @@ class DatePicker(v.Layout, SepalWidget):
self.date_text.error_messages = None
# exit immediately if nothing is set
- if change["new"] is None:
+ if not change["new"]:
return
# change the error status
|
Datepicker is not fully customizable
As our main `DatePicker` usage is as in its "menu" form, it is not handy to set some use cases:
- set a min_, max_ value directly (you have to `datepicker.children.....min_`...)
- set a default initial value with `v_model` since it is hardcoded from the beginning
- the `jslink` "link" will only work if the change is made from a "js" event, but not if you want to link the values since the initialization.
|
12rambau/sepal_ui
|
diff --git a/tests/test_DatePicker.py b/tests/test_DatePicker.py
index d206c10b..3ae0b219 100644
--- a/tests/test_DatePicker.py
+++ b/tests/test_DatePicker.py
@@ -23,6 +23,28 @@ class TestDatePicker:
return
+ def test_kwargs(self):
+ """test kwargs to both datepicker and layout"""
+
+ date_picker_kwargs = {
+ "min": "2018-02-14",
+ "max": "2021-03-14",
+ }
+
+ layout_kwargs = {
+ "class_": "pa-0",
+ "align_center": False,
+ }
+
+ datepicker = sw.DatePicker(
+ v_model="", layout_kwargs=layout_kwargs, **date_picker_kwargs
+ )
+
+ assert datepicker.date_picker.min == "2018-02-14"
+ assert datepicker.date_picker.max == "2021-03-14"
+ assert datepicker.class_ == "pa-0"
+ assert datepicker.align_center is False
+
def test_bind(self, datepicker):
class Test_io(Model):
out = Any(None).tag(sync=True)
diff --git a/tests/test_sepalwidgets.py b/tests/test_sepalwidgets.py
index 1dd4d004..2c06d37f 100644
--- a/tests/test_sepalwidgets.py
+++ b/tests/test_sepalwidgets.py
@@ -18,7 +18,7 @@ class TestSepalWidgets:
for c in v_classes:
- if c in ["Alert", "Tooltip", "Banner"]:
+ if c in ["Alert", "Tooltip", "Banner", "DatePicker"]:
# they are meant to be hidden by default
# they are specific sepalwidgets and tested elswhere
continue
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 1
}
|
2.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyio==3.7.1
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.2
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
haversine==2.9.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nodeenv==1.9.1
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest==8.3.5
pytest-cov==6.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@89f8d87dc4f83bfc2e96a111692ae252e470e8bc#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==2.1.2
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyio==3.7.1
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.2
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- haversine==2.9.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nodeenv==1.9.1
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest==8.3.5
- pytest-cov==6.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==2.1.2
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_DatePicker.py::TestDatePicker::test_kwargs"
] |
[] |
[
"tests/test_DatePicker.py::TestDatePicker::test_init",
"tests/test_DatePicker.py::TestDatePicker::test_bind",
"tests/test_DatePicker.py::TestDatePicker::test_disable",
"tests/test_DatePicker.py::TestDatePicker::test_is_valid_date",
"tests/test_DatePicker.py::TestDatePicker::test_check_date",
"tests/test_sepalwidgets.py::TestSepalWidgets::test_generated",
"tests/test_sepalwidgets.py::TestSepalWidgets::test_html"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-608
|
2d5126f5e9521470cbeb5ad374f74046e889f771
|
2022-11-18 07:51:19
|
8a8196e3c7893b7a0aebdb4910e83054f59e0374
|
diff --git a/docs/source/widgets/btn.rst b/docs/source/widgets/btn.rst
index 949d5468..91d92967 100644
--- a/docs/source/widgets/btn.rst
+++ b/docs/source/widgets/btn.rst
@@ -20,8 +20,8 @@ The default color is set to "primary".
v.theme.dark = False
btn = sw.Btn(
- text = "The One btn",
- icon = "fas fa-cogs"
+ msg = "The One btn",
+ gliph = "fas fa-cogs"
)
btn
@@ -42,8 +42,8 @@ Btn can be used to launch function on any Javascript event such as "click".
v.theme.dark = False
btn = sw.Btn(
- text = "The One btn",
- icon = "fas fa-cogs"
+ msg = "The One btn",
+ gliph = "fas fa-cogs"
)
btn.on_event('click', lambda *args: print('Hello world!'))
diff --git a/sepal_ui/reclassify/reclassify_view.py b/sepal_ui/reclassify/reclassify_view.py
index f4d6ca40..18a90455 100644
--- a/sepal_ui/reclassify/reclassify_view.py
+++ b/sepal_ui/reclassify/reclassify_view.py
@@ -33,8 +33,8 @@ class ImportMatrixDialog(v.Dialog):
# create the 3 widgets
title = v.CardTitle(children=["Load reclassification matrix"])
self.w_file = sw.FileInput(label="filename", folder=folder)
- self.load_btn = sw.Btn("Load")
- cancel = sw.Btn("Cancel", outlined=True)
+ self.load_btn = sw.Btn(msg="Load")
+ cancel = sw.Btn(msg="Cancel", outlined=True)
actions = v.CardActions(children=[cancel, self.load_btn])
# default params
@@ -81,8 +81,8 @@ class SaveMatrixDialog(v.Dialog):
# create the widgets
title = v.CardTitle(children=["Save matrix"])
self.w_file = v.TextField(label="filename", v_model=None)
- btn = sw.Btn("Save matrix")
- cancel = sw.Btn("Cancel", outlined=True)
+ btn = sw.Btn(msg="Save matrix")
+ cancel = sw.Btn(msg="Cancel", outlined=True)
actions = v.CardActions(children=[cancel, btn])
self.alert = sw.Alert(children=["Choose a name for the output"]).show()
@@ -464,7 +464,7 @@ class ReclassifyView(sw.Card):
self.btn_list = [
sw.Btn(
- "Custom",
+ msg="Custom",
_metadata={"path": "custom"},
small=True,
class_="mr-2",
@@ -472,7 +472,7 @@ class ReclassifyView(sw.Card):
)
] + [
sw.Btn(
- f"use {name}",
+ msg=f"use {name}",
_metadata={"path": path},
small=True,
class_="mr-2",
@@ -490,18 +490,20 @@ class ReclassifyView(sw.Card):
self.save_dialog = SaveMatrixDialog(folder=out_path)
self.import_dialog = ImportMatrixDialog(folder=out_path)
self.get_table = sw.Btn(
- ms.rec.rec.input.btn, "far fa-table", color="success", small=True
+ msg=ms.rec.rec.input.btn, gliph="far fa-table", color="success", small=True
)
self.import_table = sw.Btn(
- "import",
- "fas fa-download",
+ msg="import",
+ gliph="fas fa-download",
color="secondary",
small=True,
class_="ml-2 mr-2",
)
- self.save_table = sw.Btn("save", "fas fa-save", color="secondary", small=True)
+ self.save_table = sw.Btn(
+ msg="save", gliph="fas fa-save", color="secondary", small=True
+ )
self.reclassify_btn = sw.Btn(
- ms.rec.rec.btn, "fas fa-chess-board", small=True, disabled=True
+ msg=ms.rec.rec.btn, gliph="fas fa-chess-board", small=True, disabled=True
)
self.toolbar = v.Toolbar(
diff --git a/sepal_ui/reclassify/table_view.py b/sepal_ui/reclassify/table_view.py
index c3f8a35a..24ac31b5 100644
--- a/sepal_ui/reclassify/table_view.py
+++ b/sepal_ui/reclassify/table_view.py
@@ -49,19 +49,24 @@ class ClassTable(sw.DataTable):
# create the 4 CRUD btn
# and set them in the top slot of the table
self.edit_btn = sw.Btn(
- ms.rec.table.btn.edit,
- icon="fas fa-pencil-alt",
+ msg=ms.rec.table.btn.edit,
+ gliph="fas fa-pencil-alt",
class_="ml-2 mr-2",
color="secondary",
small=True,
)
self.delete_btn = sw.Btn(
- ms.rec.table.btn.delete, icon="fas fa-trash-alt", color="error", small=True
+ msg=ms.rec.table.btn.delete,
+ gliph="fas fa-trash-alt",
+ color="error",
+ small=True,
)
self.add_btn = sw.Btn(
- ms.rec.table.btn.add, icon="fas fa-plus", color="success", small=True
+ msg=ms.rec.table.btn.add, gliph="fas fa-plus", color="success", small=True
+ )
+ self.save_btn = sw.Btn(
+ msg=ms.rec.table.btn.save, gliph="far fa-save", small=True
)
- self.save_btn = sw.Btn(ms.rec.table.btn.save, icon="far fa-save", small=True)
slot = v.Toolbar(
class_="d-flex mb-6",
@@ -212,20 +217,19 @@ class EditDialog(v.Dialog):
self.title = v.CardTitle(children=[self.TITLES[0]])
# Action buttons
- self.save = sw.Btn(ms.rec.table.edit_dialog.btn.save.name)
+ self.save = sw.Btn(msg=ms.rec.table.edit_dialog.btn.save.name)
save_tool = sw.Tooltip(
self.save, ms.rec.table.edit_dialog.btn.save.tooltip, bottom=True
)
- self.modify = sw.Btn(
- ms.rec.table.edit_dialog.btn.modify.name
- ).hide() # by default modify is hidden
+ self.modify = sw.Btn(msg=ms.rec.table.edit_dialog.btn.modify.name)
+ self.modify.hide() # by default modify is hidden
modify_tool = sw.Tooltip(
self.modify, ms.rec.table.edit_dialog.btn.modify.tooltip, bottom=True
)
self.cancel = sw.Btn(
- ms.rec.table.edit_dialog.btn.cancel.name, outlined=True, class_="ml-2"
+ msg=ms.rec.table.edit_dialog.btn.cancel.name, outlined=True, class_="ml-2"
)
cancel_tool = sw.Tooltip(
self.cancel, ms.rec.table.edit_dialog.btn.cancel.tooltip, bottom=True
@@ -437,7 +441,7 @@ class SaveDialog(v.Dialog):
v_model=ms.rec.table.save_dialog.placeholder,
)
- self.save = sw.Btn(ms.rec.table.save_dialog.btn.save.name)
+ self.save = sw.Btn(msg=ms.rec.table.save_dialog.btn.save.name)
save = sw.Tooltip(
self.save,
ms.rec.table.save_dialog.btn.save.tooltip,
@@ -446,7 +450,7 @@ class SaveDialog(v.Dialog):
)
self.cancel = sw.Btn(
- ms.rec.table.save_dialog.btn.cancel.name, outlined=True, class_="ml-2"
+ msg=ms.rec.table.save_dialog.btn.cancel.name, outlined=True, class_="ml-2"
)
cancel = sw.Tooltip(
self.cancel, ms.rec.table.save_dialog.btn.cancel.tooltip, bottom=True
@@ -600,8 +604,8 @@ class TableView(sw.Card):
folder=self.class_path,
)
self.btn = sw.Btn(
- ms.rec.table.classif.btn,
- icon="far fa-table",
+ msg=ms.rec.table.classif.btn,
+ gliph="far fa-table",
color="success",
outlined=True,
)
diff --git a/sepal_ui/sepalwidgets/btn.py b/sepal_ui/sepalwidgets/btn.py
index c6437d86..137622fa 100644
--- a/sepal_ui/sepalwidgets/btn.py
+++ b/sepal_ui/sepalwidgets/btn.py
@@ -1,6 +1,9 @@
+import warnings
from pathlib import Path
import ipyvuetify as v
+from deprecated.sphinx import deprecated
+from traitlets import Unicode, observe
from sepal_ui.scripts import utils as su
from sepal_ui.sepalwidgets.sepalwidget import SepalWidget
@@ -14,27 +17,83 @@ class Btn(v.Btn, SepalWidget):
the color will be defaulted to 'primary' and can be changed afterward according to your need
Args:
+ msg (str, optional): the text to display in the btn
+ gliph (str, optional): the full name of any mdi/fa icon
text (str, optional): the text to display in the btn
icon (str, optional): the full name of any mdi/fa icon
kwargs (dict, optional): any parameters from v.Btn. if set, 'children' will be overwritten.
+
+ .. deprecated:: 2.13
+ ``text`` and ``icon`` will be replaced by ``msg`` and ``gliph`` to avoid duplicating ipyvuetify trait.
"""
v_icon = None
"v.Icon: the icon in the btn"
- def __init__(self, text="Click", icon="", **kwargs):
+ gliph = Unicode("").tag(sync=True)
+ "traitlet.Unicode: the name of the icon"
+
+ msg = Unicode("").tag(sync=True)
+ "traitlet.Unicode: the text of the btn"
+
+ def __init__(self, msg="Click", gliph="", **kwargs):
+
+ # deprecation in 2.13 of text and icon
+ # as they already exist in the ipyvuetify Btn traits (as booleans)
+ if "text" in kwargs:
+ if isinstance(kwargs["text"], str):
+ msg = kwargs.pop("text")
+ warnings.warn(
+ '"text" is deprecated, please use "msg" instead', DeprecationWarning
+ )
+ if "icon" in kwargs:
+ if isinstance(kwargs["icon"], str):
+ gliph = kwargs.pop("icon")
+ warnings.warn(
+ '"icon" is deprecated, please use "gliph" instead',
+ DeprecationWarning,
+ )
# create the default v_icon
self.v_icon = v.Icon(left=True, children=[""])
- self.set_icon(icon)
# set the default parameters
kwargs["color"] = kwargs.pop("color", "primary")
- kwargs["children"] = [self.v_icon, text]
+ kwargs["children"] = [self.v_icon, self.msg]
# call the constructor
super().__init__(**kwargs)
+ self.gliph = gliph
+ self.msg = msg
+
+ @observe("gliph")
+ def _set_gliph(self, change):
+ """
+ Set a new icon. If the icon is set to "", then it's hidden
+ """
+ new_gliph = change["new"]
+ self.v_icon.children = [new_gliph]
+
+ # hide the component to avoid the right padding
+ if not new_gliph:
+ su.hide_component(self.v_icon)
+ else:
+ su.show_component(self.v_icon)
+
+ return self
+
+ @observe("msg")
+ def _set_text(self, change):
+ """
+ Set the text of the btn
+ """
+
+ self.children = [self.v_icon, change["new"]]
+
+ return self
+
+ @deprecated(version="2.14", reason="Replace by the private _set_gliph")
def set_icon(self, icon=""):
"""
set a new icon. If the icon is set to "", then it's hidden.
@@ -45,13 +104,7 @@ class Btn(v.Btn, SepalWidget):
Return:
self
"""
- self.v_icon.children = [icon]
-
- if not icon:
- su.hide_component(self.v_icon)
- else:
- su.show_component(self.v_icon)
-
+ self.gliph = icon
return self
def toggle_loading(self):
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 5a9507ad..1bb0e850 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -256,7 +256,7 @@ class FileInput(v.Flex, SepalWidget):
"name": "activator",
"variable": "x",
"children": Btn(
- icon="fas fa-search", v_model=False, v_on="x.on", text=label
+ gliph="fas fa-search", v_model=False, v_on="x.on", msg=label
),
}
],
|
create a function to set the text of the btn dynamically
icon and text should be editable dynamically
https://github.com/12rambau/sepal_ui/blob/8af255ec0d1cb3ad4dd74d021ad140fafef756f6/sepal_ui/sepalwidgets/btn.py#L38
|
12rambau/sepal_ui
|
diff --git a/tests/test_Btn.py b/tests/test_Btn.py
index 407c0e3b..058cb775 100644
--- a/tests/test_Btn.py
+++ b/tests/test_Btn.py
@@ -50,6 +50,47 @@ class TestBtn:
return
+ def test_set_gliph(self, btn):
+
+ # new gliph
+ gliph = "fas fa-folder"
+ btn.gliph = gliph
+
+ assert isinstance(btn.v_icon, v.Icon)
+ assert btn.v_icon.children[0] == gliph
+
+ # change existing icon
+ gliph = "fas fa-file"
+ btn.gliph = gliph
+ assert btn.v_icon.children[0] == gliph
+
+ # remove all gliph
+ gliph = ""
+ btn.gliph = gliph
+ assert "d-none" in btn.v_icon.class_
+
+ # assert deprecation
+ with pytest.deprecated_call():
+ sw.Btn(icon="fas fa-folder")
+
+ return
+
+ def test_test_msg(self, btn):
+
+ # test the initial text
+ assert btn.children[1] == "Click"
+
+ # update msg
+ msg = "New message"
+ btn.msg = msg
+ assert btn.children[1] == msg
+
+ # test deprecation notice
+ with pytest.deprecated_call():
+ sw.Btn(text="Deprecation")
+
+ return
+
@pytest.fixture
def btn(self):
"""Create a simple btn"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 5
}
|
2.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"nbmake"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL",
"pip install localtileserver"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyio==3.7.1
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
GDAL==3.11.0
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
haversine==2.9.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
numexpr==2.10.2
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest==8.3.5
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@2d5126f5e9521470cbeb5ad374f74046e889f771#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==2.1.2
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyio==3.7.1
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- gdal==3.11.0
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- haversine==2.9.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- numexpr==2.10.2
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- pytest==8.3.5
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==2.1.2
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Btn.py::TestBtn::test_set_gliph",
"tests/test_Btn.py::TestBtn::test_test_msg"
] |
[] |
[
"tests/test_Btn.py::TestBtn::test_init",
"tests/test_Btn.py::TestBtn::test_set_icon",
"tests/test_Btn.py::TestBtn::test_toggle_loading"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-644
|
8a8196e3c7893b7a0aebdb4910e83054f59e0374
|
2022-11-29 14:42:21
|
8a8196e3c7893b7a0aebdb4910e83054f59e0374
|
diff --git a/sepal_ui/sepalwidgets/btn.py b/sepal_ui/sepalwidgets/btn.py
index 137622fa..105f6160 100644
--- a/sepal_ui/sepalwidgets/btn.py
+++ b/sepal_ui/sepalwidgets/btn.py
@@ -25,6 +25,9 @@ class Btn(v.Btn, SepalWidget):
.. deprecated:: 2.13
``text`` and ``icon`` will be replaced by ``msg`` and ``gliph`` to avoid duplicating ipyvuetify trait.
+
+ .. deprecated:: 2.14
+ Btn is not using a default ``msg`` anymor`.
"""
v_icon = None
@@ -36,7 +39,7 @@ class Btn(v.Btn, SepalWidget):
msg = Unicode("").tag(sync=True)
"traitlet.Unicode: the text of the btn"
- def __init__(self, msg="Click", gliph="", **kwargs):
+ def __init__(self, msg="", gliph="", **kwargs):
# deprecation in 2.13 of text and icon
# as they already exist in the ipyvuetify Btn traits (as booleans)
@@ -55,7 +58,7 @@ class Btn(v.Btn, SepalWidget):
)
# create the default v_icon
- self.v_icon = v.Icon(left=True, children=[""])
+ self.v_icon = v.Icon(children=[""])
# set the default parameters
kwargs["color"] = kwargs.pop("color", "primary")
@@ -89,6 +92,7 @@ class Btn(v.Btn, SepalWidget):
Set the text of the btn
"""
+ self.v_icon.left = bool(change["new"])
self.children = [self.v_icon, change["new"]]
return self
|
sepal_ui.Btn does't work as expected
I want to create a simple Icon button, to do so:
```python
sw.Btn(icon=True, gliph ="mdi-plus")
```
Doing this, without "msg" parameter will add the default text to the button which is "click", I think is worthless having that value.
So if I want to remove the default text, I would expect doing this:
```python
sw.Btn(children = [""], icon=True, gliph ="mdi-plus")
# or
sw.Btn(msg= ""] icon=True, gliph ="mdi-plus")
```
Which leads the icon aligned to the left and not centered (as it is using a empyt string as message).
|
12rambau/sepal_ui
|
diff --git a/tests/test_Btn.py b/tests/test_Btn.py
index fcaed760..4e3cb9b5 100644
--- a/tests/test_Btn.py
+++ b/tests/test_Btn.py
@@ -11,7 +11,7 @@ class TestBtn:
btn = sw.Btn()
assert btn.color == "primary"
assert btn.v_icon.children[0] == ""
- assert btn.children[1] == "Click"
+ assert btn.children[1] == ""
# extensive btn
btn = sw.Btn("toto", "fas fa-folder")
@@ -42,12 +42,18 @@ class TestBtn:
assert isinstance(btn.v_icon, v.Icon)
assert btn.v_icon.children[0] == gliph
+ assert btn.v_icon.left is True
# change existing icon
gliph = "fas fa-file"
btn.gliph = gliph
assert btn.v_icon.children[0] == gliph
+ # display only the gliph
+ btn.msg = ""
+ assert btn.children[1] == ""
+ assert btn.v_icon.left is False
+
# remove all gliph
gliph = ""
btn.gliph = gliph
@@ -79,4 +85,4 @@ class TestBtn:
def btn(self):
"""Create a simple btn"""
- return sw.Btn()
+ return sw.Btn("Click")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
2.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL",
"pip install localtileserver"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyio==3.7.1
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
execnet==2.1.1
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
GDAL==3.11.0
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
haversine==2.9.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nodeenv==1.9.1
numexpr==2.10.2
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@8a8196e3c7893b7a0aebdb4910e83054f59e0374#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==2.1.2
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyio==3.7.1
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- execnet==2.1.1
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- gdal==3.11.0
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- haversine==2.9.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nodeenv==1.9.1
- numexpr==2.10.2
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==2.1.2
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Btn.py::TestBtn::test_init",
"tests/test_Btn.py::TestBtn::test_set_gliph"
] |
[] |
[
"tests/test_Btn.py::TestBtn::test_toggle_loading",
"tests/test_Btn.py::TestBtn::test_set_msg"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-646
|
8a8196e3c7893b7a0aebdb4910e83054f59e0374
|
2022-11-29 22:27:29
|
8a8196e3c7893b7a0aebdb4910e83054f59e0374
|
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index 68e3f115..de6d4abb 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -94,9 +94,10 @@ class Alert(v.Alert, SepalWidget):
self.show()
# cast the progress to float
+ total = tqdm_args.get("total", 1)
progress = float(progress)
- if not (0 <= progress <= 1):
- raise ValueError(f"progress should be in [0, 1], {progress} given")
+ if not (0 <= progress <= total):
+ raise ValueError(f"progress should be in [0, {total}], {progress} given")
# Prevent adding multiple times
if self.progress_output not in self.children:
@@ -107,7 +108,7 @@ class Alert(v.Alert, SepalWidget):
"bar_format", "{l_bar}{bar}{n_fmt}/{total_fmt}"
)
tqdm_args["dynamic_ncols"] = tqdm_args.pop("dynamic_ncols", tqdm_args)
- tqdm_args["total"] = tqdm_args.pop("total", 100)
+ tqdm_args["total"] = tqdm_args.pop("total", 1)
tqdm_args["desc"] = tqdm_args.pop("desc", msg)
tqdm_args["colour"] = tqdm_args.pop("tqdm_args", getattr(color, self.type))
@@ -120,7 +121,7 @@ class Alert(v.Alert, SepalWidget):
# Initialize bar
self.progress_bar.update(0)
- self.progress_bar.update(progress * 100 - self.progress_bar.n)
+ self.progress_bar.update(progress - self.progress_bar.n)
if progress == 1:
self.progress_bar.close()
|
allow other values for progress
Now that we are supporting tqdm it should be possible to support progress values that are not between 0 and 1. https://github.com/12rambau/sepal_ui/blob/c15a83dc6c92d076e6932afab4e4b2987585894b/sepal_ui/sepalwidgets/alert.py#L98
|
12rambau/sepal_ui
|
diff --git a/tests/test_Alert.py b/tests/test_Alert.py
index af360930..52c6931c 100644
--- a/tests/test_Alert.py
+++ b/tests/test_Alert.py
@@ -153,11 +153,18 @@ class TestAlert:
# test a random update
alert.update_progress(0.5)
- assert alert.progress_bar.n == 50
+ assert alert.progress_bar.n == 0.5
assert alert.viz is True
# show that a value > 1 raise an error
with pytest.raises(ValueError):
+ alert.reset()
alert.update_progress(1.5)
+ # check that if total is set value can be more than 1
+ alert.reset()
+ alert.update_progress(50, total=100)
+ assert alert.progress_bar.n == 50
+ assert alert.viz is True
+
return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
2.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-sugar"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyio==3.7.1
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
decorator==5.2.1
deepdiff==8.4.2
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
haversine==2.9.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nodeenv==1.9.1
numpy==2.0.2
orderly-set==5.3.0
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a2
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
pytest-sugar==1.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@8a8196e3c7893b7a0aebdb4910e83054f59e0374#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==3.0.0
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==2.1.2
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyio==3.7.1
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- decorator==5.2.1
- deepdiff==8.4.2
- defusedxml==0.7.1
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- haversine==2.9.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nodeenv==1.9.1
- numpy==2.0.2
- orderly-set==5.3.0
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a2
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest-sugar==1.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==3.0.0
- terminado==0.18.1
- tinycss2==1.4.0
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==2.1.2
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_Alert.py::TestAlert::test_update_progress"
] |
[] |
[
"tests/test_Alert.py::TestAlert::test_init",
"tests/test_Alert.py::TestAlert::test_add_msg",
"tests/test_Alert.py::TestAlert::test_add_live_msg",
"tests/test_Alert.py::TestAlert::test_append_msg",
"tests/test_Alert.py::TestAlert::test_reset",
"tests/test_Alert.py::TestAlert::test_rmv_last_msg"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-646
|
|
12rambau__sepal_ui-685
|
549667ffe968ab4d631766a96024819b0fabff00
|
2023-01-05 11:57:10
|
6b3f6e8c9f7c3e1dd7a20378153e0129f34c88e9
|
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml
index 88dda404..e29b052d 100644
--- a/.github/workflows/unit.yml
+++ b/.github/workflows/unit.yml
@@ -60,15 +60,7 @@ jobs:
- name: Check that there are no unexpected Sphinx warnings
if: matrix.python-version == '3.8'
- shell: python
- run: |
- from pathlib import Path
- text = Path("warnings.txt").read_text().strip()
- print("\n=== Sphinx Warnings ===\n\n" + text) # Print just for reference so we can look at the logs
- warnings = [ii for ii in text.split("\n")]
- expected = ["transition", "CHANGELOG.md", "modules.rst", "target"]
- unexpected = [ii for ii in text.split("\n") if all(i not in ii for i in expected)]
- assert len(unexpected) == 0
+ run: python tests/check_warnings.py
- name: test with pytest
run: pytest --color=yes --cov --cov-report=xml tests
diff --git a/docs/source/tutorials/add-tile.rst b/docs/source/tutorials/add-tile.rst
index 91524bc2..f63948a3 100644
--- a/docs/source/tutorials/add-tile.rst
+++ b/docs/source/tutorials/add-tile.rst
@@ -15,6 +15,7 @@ the tile cod is the following :
import ipyvuetify as v
from component.message import ms
from sepal_ui.scripts import utils as su
+ from sepal_ui.scripts import decorator as sd
class MyTile(sw.Tile):
@@ -45,7 +46,7 @@ the tile cod is the following :
# now that the Tile is created we can link it to a specific function
self.btn.on_event('click', self._on_run)
- @su.loading_button(debug=False)
+ @sd.loading_button(debug=False)
def _on_run(self, widget, data, event):
time.sleep(5)
diff --git a/docs/source/tutorials/decorator.rst b/docs/source/tutorials/decorator.rst
index 79f8e5c1..632068e0 100644
--- a/docs/source/tutorials/decorator.rst
+++ b/docs/source/tutorials/decorator.rst
@@ -82,6 +82,7 @@ Let's import the required modules. All the decorators are stored in the utils mo
import ipyvuetify as v
import sepal_ui.sepalwidgets as sw
import sepal_ui.scripts.utils as su
+ import sepal_ui.scripts.decorator as sd
Now, create a custom tile with all the elements that we will require to be displayed in our interface, as well as the events that we want to trigger.
@@ -125,19 +126,19 @@ It's time to use the decorators in the class methods. For this example, we will
.. code-block:: python
- @su.loading_button()
- @su.switch('loading', 'disabled', on_widgets=['w_select'])
+ @sd.loading_button()
+ @sd.switch('loading', 'disabled', on_widgets=['w_select'])
def get_items_event(self):
"""request GEE items"""
self.children = self.request_items()
- @su.switch('loading', 'disabled')
+ @sd.switch('loading', 'disabled')
def on_card_event(self):
sleep(2)
- @su.need_ee
+ @sd.need_ee
def request_items(self):
"""Connect to gee and request the root assets id's"""
diff --git a/noxfile.py b/noxfile.py
index 76b3ac6b..14582d70 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -27,7 +27,10 @@ def docs(session):
"docs/source/modules",
"./sepal_ui",
)
- session.run("sphinx-build", "-v", "-b", "html", "docs/source", "build")
+ session.run(
+ "sphinx-build", "-v", "-b", "html", "docs/source", "build", "-w", "warnings.txt"
+ )
+ session.run("python", "tests/check_warnings.py")
@nox.session(name="docs-live", reuse_venv=False)
diff --git a/sepal_ui/aoi/aoi_model.py b/sepal_ui/aoi/aoi_model.py
index 582abd49..28e00c8a 100644
--- a/sepal_ui/aoi/aoi_model.py
+++ b/sepal_ui/aoi/aoi_model.py
@@ -8,12 +8,10 @@ import ee
import geopandas as gpd
import pandas as pd
import traitlets as t
-from deprecated.sphinx import deprecated
from ipyleaflet import GeoJSON
from typing_extensions import Self
from sepal_ui import color
-from sepal_ui import sepalwidgets as sw
from sepal_ui.frontend import styles as ss
from sepal_ui.message import ms
from sepal_ui.model import Model
@@ -142,13 +140,8 @@ class AoiModel(Model):
ipygeojson: Optional[GeoJSON] = None
"The representation of the AOI as a ipyleaflet layer"
- @deprecated(
- version="2.11.3",
- reason=":code:`alert` positional argument will be removed. Successfull output messages has to be created in AoiView.",
- )
def __init__(
self,
- alert: Optional[sw.Alert] = None,
gee: bool = True,
vector: Optional[Union[str, Path]] = None,
asset: Optional[Union[str, Path]] = None,
diff --git a/sepal_ui/frontend/js/jupyter_clip.js b/sepal_ui/frontend/js/jupyter_clip.js
new file mode 100644
index 00000000..02605b66
--- /dev/null
+++ b/sepal_ui/frontend/js/jupyter_clip.js
@@ -0,0 +1,7 @@
+var tempInput = document.createElement("input");
+tempInput.value = _txt;
+document.body.appendChild(tempInput);
+tempInput.focus();
+tempInput.select();
+document.execCommand("copy");
+document.body.removeChild(tempInput);
diff --git a/sepal_ui/message/en/password_field.json b/sepal_ui/message/en/password_field.json
new file mode 100644
index 00000000..2f182d19
--- /dev/null
+++ b/sepal_ui/message/en/password_field.json
@@ -0,0 +1,5 @@
+{
+ "password_field": {
+ "label": "Password"
+ }
+}
diff --git a/sepal_ui/reclassify/parameters.py b/sepal_ui/reclassify/parameters.py
index bb214e6f..36e36c83 100644
--- a/sepal_ui/reclassify/parameters.py
+++ b/sepal_ui/reclassify/parameters.py
@@ -2,13 +2,13 @@ from sepal_ui.message import ms
__all__ = ["MATRIX_NAMES", "TABLE_NAMES", "NO_VALUE", "SCHEMA"]
-MATRIX_NAMES = ["src", "dst"]
-TABLE_NAMES = ["code", "desc", "color"]
+MATRIX_NAMES: list = ["src", "dst"]
+TABLE_NAMES: list = ["code", "desc", "color"]
# Set a value for missing reclassifications
-NO_VALUE = 999
+NO_VALUE: int = 999
-SCHEMA = {
+SCHEMA: dict = {
"id": [ms.rec.table.schema.id, "number"],
"code": [ms.rec.table.schema.code, "number"],
"desc": [ms.rec.table.schema.description, "string"],
diff --git a/sepal_ui/reclassify/reclassify_model.py b/sepal_ui/reclassify/reclassify_model.py
index bebf3baa..a3a15ff2 100644
--- a/sepal_ui/reclassify/reclassify_model.py
+++ b/sepal_ui/reclassify/reclassify_model.py
@@ -1,15 +1,18 @@
from pathlib import Path
+from typing import Any, Optional, Union
import ee
import geopandas as gpd
import numpy as np
import pandas as pd
import rasterio as rio
+import traitlets as t
from matplotlib.colors import to_rgba
from natsort import natsorted
from rasterio.windows import from_bounds
-from traitlets import Any, Bool, Dict, Int
+from typing_extensions import Self
+from sepal_ui import aoi
from sepal_ui.message import ms
from sepal_ui.model import Model
from sepal_ui.scripts import decorator as sd
@@ -23,91 +26,89 @@ __all__ = ["ReclassifyModel"]
class ReclassifyModel(Model):
- # inputs
- # should be unicode but we need to handle when nothing is set (None)
- band = Any(None).tag(sync=True)
- "str|int: the band name or number to use for the reclassification if raster type. Use property name if vector type"
+ band: t.Any = t.Any(None).tag(sync=True)
+ "the band name or number to use for the reclassification if raster type. Use property name if vector type"
- src_local = Any(None).tag(sync=True)
- "str: the source file to reclassify (from a local path) only used if :code:`gee=False`"
+ src_local: t.Any = t.Any(None).tag(sync=True)
+ "the source file to reclassify (from a local path) only used if :code:`gee=False`"
- src_gee = Any(None).tag(sync=True)
- "str: AssetId of the used input asset for reclassification. Only used if :code:`gee=True`"
+ src_gee: t.Unicode = t.Unicode(None, allow_none=True).tag(sync=True)
+ "AssetId of the used input asset for reclassification. Only used if :code:`gee=True`"
- dst_class_file = Any(None).tag(sync=True)
- "str: the destination file for reclassify matrix"
+ dst_class_file: t.Any = t.Any(None).tag(sync=True)
+ "the destination file for reclassify matrix"
- dst_dir = Any(None).tag(sync=True)
- "str: the dir used to store the output"
+ dst_dir: Union[Path, str] = ""
+ "the dir used to store the output"
- gee = Bool(False).tag(sync=True)
- "bool: either to use the gee backend or not"
+ gee: t.Bool = t.Bool(False).tag(sync=True)
+ "either to use the gee backend or not"
- aoi_model = None
- "aoi.AoiModel: AOI model object to get an area of interest if one is selected"
+ aoi_model: Optional[aoi.AoiModel] = None
+ "AOI model object to get an area of interest if one is selected"
- folder = None
- "str: the init GEE asset folder where the asset selector should start looking (debugging purpose)"
+ folder: str = ""
+ "the init GEE asset folder where the asset selector should start looking (debugging purpose)"
- enforce_aoi = None
- "bool: either or not an aoi should be set to allow the reclassification"
+ enforce_aoi: bool = False
+ "either or not an aoi should be set to allow the reclassification"
# data manipulation
- matrix = Dict({}).tag(sync=True)
- "dict: the transfer matrix between the input and the output using the following format: {old_value: new_value, ...}"
+ matrix: t.Dict = t.Dict({}).tag(sync=True)
+ "the transfer matrix between the input and the output using the following format: {old_value: new_value, ...}"
# outputs
- input_type = Bool(False).tag(sync=True) # 1 raster, 0 vector
- "bool: the input type, 1 for raster and 0 for vector"
+ input_type: t.Bool = t.Bool(False).tag(sync=True) # 1 raster, 0 vector
+ "the input type, 1 for raster and 0 for vector"
- src_class = Dict({}).tag(sync=True)
- "dict: the source classes using the following columns: {code: (desc, color)}"
+ src_class: t.Dict = t.Dict({}).tag(sync=True)
+ "the source classes using the following columns: {code: (desc, color)}"
- dst_class = Dict({}).tag(sync=True)
- "dict: the destination classes using the following columns: {code: (desc, color)}"
+ dst_class: t.Dict = t.Dict({}).tag(sync=True)
+ "the destination classes using the following columns: {code: (desc, color)}"
- dst_local = Any(None).tag(sync=True)
- "str: the output file. default to :code:`dst_dir/f'{src_local.stem}_reclass.{src_local.suffix}'`"
+ dst_local: t.Unicode = t.Unicode(None, allow_none=True).tag(sync=True)
+ "the output file. default to :code:`dst_dir/f'{src_local.stem}_reclass.{src_local.suffix}'`"
- dst_gee = Any(None).tag(sync=True)
- "str: the output assetId. default to :code:`dst_dir/f'{src_gee.stem}_reclass'`"
+ dst_gee: t.Unicode = t.Unicode(None, allow_none=True).tag(sync=True)
+ "the output assetId. default to :code:`dst_dir/f'{src_gee.stem}_reclass'`"
# Create a state var, to determine if an asset has been remaped
- remaped = Int(False).tag(sync=True)
- "int: state var updated each time an input is remapped"
+ remaped: t.Int = t.Int(0).tag(sync=True)
+ "state var updated each time an input is remapped"
- save = False
- "bool: either or not the relcassified dataset need to be saved"
+ save: bool = False
+ "either or not the relcassified dataset need to be saved"
- dst_local_memory = None
- "Any: the local output of the reclassification"
+ dst_local_memory: Any = None
+ "the local output of the reclassification"
- dst_gee_memory = None
- "Any: the gee output of the reclassification"
+ dst_gee_memory: Any = None
+ "the gee output of the reclassification"
- table_created = Bool(False).tag(sync=True)
- "bool: either or not a table have been created"
+ table_created: t.Bool = t.Bool(False).tag(sync=True)
+ "either or not a table have been created"
def __init__(
self,
- gee=False,
- dst_dir=Path.home(),
- aoi_model=None,
- folder="",
- save=True,
- enforce_aoi=False,
+ gee: bool = False,
+ dst_dir: Union[Path, str] = Path.home(),
+ aoi_model: Optional[aoi.AoiModel] = None,
+ folder: str = "",
+ save: bool = True,
+ enforce_aoi: bool = False,
**kwargs,
- ):
+ ) -> None:
"""
Reclassification model to store information about the current reclassification and share them within your app. save all the input and output of the reclassification + the the matrix to move from one to another. It is embeding 2 backends, one based on GEE that will use assets as in/out and another based on python that will use local files as in/out. The model can handle both vector and raster data, the format and name of the output will be determined from the the input format/name. The developer will still have the possiblity to choose where to save the outputs (folder name).
Args:
- gee (bool): either or not to set :code:`gee` to True
- dst_dir (str): the destination forlder for outputs
- folder(str, optional): the init GEE asset folder where the asset selector should start looking (debugging purpose)
- aoi_model (aoi.AoiModel, optional): the aoi model to link to the reclassify workflow
- enforce_aoi (bool, optional): either or not an aoi should be set to allow the reclassification
+ gee: either or not to set :code:`gee` to True
+ dst_dir: the destination forlder for outputs
+ folder: the init GEE asset folder where the asset selector should start looking (debugging purpose)
+ aoi_model: the aoi model to link to the reclassify workflow
+ enforce_aoi: either or not an aoi should be set to allow the reclassification
"""
# init the model
@@ -143,16 +144,12 @@ class ReclassifyModel(Model):
# set if the model need to save by default
self.save = save
- def get_classes(self):
+ def get_classes(self) -> dict:
"""
Extract the classes from the class file. The class file need to be compatible with the reclassify tool i.e. a table file with 3 headerless columns using the following format: 'code', 'desc', 'color'. Color need to be set in hexadecimal to be read else black will be used.
- Args:
- file (pathlike object): the pathlib object of the class file
-
Return:
- (dict): the dict of the classes using following format:
- {code: (name, color)}
+ the dict of the classes using following format: {code: (name, color)}
"""
file = self.dst_class_file
@@ -176,12 +173,12 @@ class ReclassifyModel(Model):
# create a dict out of it
return class_list
- def get_type(self):
+ def get_type(self) -> bool:
"""
Guess the type of the input and set the input type attribute for the model (vector or raster)
Return:
- (bool): the type of input (1 for raster, 0 for vector)
+ the type of input (1 for raster, 0 for vector)
"""
if self.gee:
@@ -210,7 +207,7 @@ class ReclassifyModel(Model):
raise AttributeError(f"Unrecognized file format: {input_path.suffix}")
return self.input_type
- def get_bands(self):
+ def get_bands(self) -> list:
"""
Use the input_type to extract all the bands/properties from the input
@@ -255,8 +252,13 @@ class ReclassifyModel(Model):
# remember to use self as a parameter
return natsorted(band_func[self.gee][self.input_type]())
- def get_aoi(self):
- """Validate and get feature collection from aoi_model"""
+ def get_aoi(self) -> Union[gpd.GeoDataFrame, ee.ComputedObject]:
+ """
+ Validate and get feature collection from aoi_model
+
+ Returns:
+ the saved AOI in the appropriate format
+ """
# by default it's none
aoi = None
@@ -279,14 +281,13 @@ class ReclassifyModel(Model):
return aoi
- def unique(self):
+ def unique(self) -> dict:
"""
Retreive all the existing class from the specified band/property according to the input_type.
The data will be saved in self.src_class with no_name and black as a color.
Return:
- (Dict): the unique class value found in the specified band/property
- and there color/name defaulted to none and black
+ the unique class value found in the specified band/property and there color/name defaulted to none and black
"""
if not self.band:
@@ -359,12 +360,9 @@ class ReclassifyModel(Model):
return self.src_class
- def reclassify(self):
+ def reclassify(self) -> Self:
"""
Reclassify the input according to the provided matrix. For vector file type reclassifying correspond to add an extra column at the end, for raster the initial class band will be replaced by the new class, the oher being kept unmodified. vizualization colors will be set for both local (QGIS compatible) and assets (SEPAL vizualization compatible).
-
- Return:
- self
"""
if not self.matrix:
@@ -586,12 +584,12 @@ class ReclassifyModel(Model):
return "Asset successfully reclassified."
- def set_dst_gee(self):
+ def set_dst_gee(self) -> str:
"""
Creates a unique and consecutive asset name based on the source
Return:
- (str) the destination folder
+ the destination folder
"""
# create the asset_id
diff --git a/sepal_ui/reclassify/reclassify_tile.py b/sepal_ui/reclassify/reclassify_tile.py
index 48adc351..4d6ac680 100644
--- a/sepal_ui/reclassify/reclassify_tile.py
+++ b/sepal_ui/reclassify/reclassify_tile.py
@@ -1,48 +1,53 @@
from pathlib import Path
+from typing import Optional, Union
import ipyvuetify as v
from traitlets import link
-from sepal_ui import reclassify as rec
+from sepal_ui import aoi
from sepal_ui import sepalwidgets as sw
from sepal_ui.message import ms
+from .reclassify_model import ReclassifyModel
+from .reclassify_view import ReclassifyView
+from .table_view import TableView
+
__all__ = ["ReclassifyTile"]
class ReclassifyTile(sw.Tile):
- result_dir = None
- "pathlib.Path: Directory to store the outputs (rasters, and csv_files)."
+ result_dir: Union[Path, str] = ""
+ "Directory to store the outputs (rasters, and csv_files)."
- model = None
- "ReclassifyModel: the reclassify model to use with these inputs"
+ model: Optional[ReclassifyModel] = None
+ "the reclassify model to use with these inputs"
- reclassify_view = None
- "ReclassifyView: a fully qualified ReclassifyView object"
+ reclassify_view: Optional[ReclassifyView] = None
+ "a fully qualified ReclassifyView object"
- table_view = None
- "TableView: a fully qualified TableView object"
+ table_view: Optional[TableView] = None
+ "a fully qualified TableView object"
def __init__(
self,
- results_dir=Path.home() / "downloads",
- gee=True,
- dst_class=None,
- default_class={},
- aoi_model=None,
- folder="",
+ results_dir: Union[Path, str] = Path.home() / "downloads",
+ gee: bool = True,
+ dst_class: Union[Path, str] = "",
+ default_class: dict = {},
+ aoi_model: Optional[aoi.AoiModel] = None,
+ folder: str = "",
**kwargs
- ):
+ ) -> None:
"""
All in one tile to reclassify GEE assets or local raster and create custom classifications
Args:
- results_dir (str|pathlike object): Directory to store the outputs (rasters, and csv_files). default to ~/downloads
- gee (bool): Use GEE variant, to reclassify assets or local input. default True
- dst_class (str|pathlib.Path, optional): the file to be used as destination classification. for app that require specific code system the file can be set prior and the user won't have the oportunity to change it
- default_class (dict|optional): the default classification system to use, need to point to existing sytem: {name: absolute_path}
- folder(str, optional): the init GEE asset folder where the asset selector should start looking (debugging purpose)
+ results_dir: Directory to store the outputs (rasters, and csv_files). default to ~/downloads
+ gee: Use GEE variant, to reclassify assets or local input. default True
+ dst_class: the file to be used as destination classification. for app that require specific code system the file can be set prior and the user won't have the oportunity to change it
+ default_class: the default classification system to use, need to point to existing sytem: {name: absolute_path}
+ folder: the init GEE asset folder where the asset selector should start looking (debugging purpose)
"""
# output directory
@@ -50,12 +55,12 @@ class ReclassifyTile(sw.Tile):
self.aoi_model = aoi_model
# create the model
- self.model = rec.ReclassifyModel(
+ self.model = ReclassifyModel(
dst_dir=self.results_dir, gee=gee, aoi_model=self.aoi_model, folder=folder
)
# set the tabs elements
- self.reclassify_view = rec.ReclassifyView(
+ self.reclassify_view = ReclassifyView(
self.model,
out_path=self.results_dir,
gee=gee,
@@ -65,7 +70,7 @@ class ReclassifyTile(sw.Tile):
folder=folder,
).nest_tile()
- self.table_view = rec.TableView(out_path=self.results_dir).nest_tile()
+ self.table_view = TableView(out_path=self.results_dir).nest_tile()
# create the tab
tiles = [self.reclassify_view, self.table_view]
diff --git a/sepal_ui/reclassify/reclassify_view.py b/sepal_ui/reclassify/reclassify_view.py
index 5d8b1daf..5a7ec6bd 100644
--- a/sepal_ui/reclassify/reclassify_view.py
+++ b/sepal_ui/reclassify/reclassify_view.py
@@ -1,10 +1,13 @@
from pathlib import Path
+from typing import Optional, Union
import ipyvuetify as v
import pandas as pd
from traitlets import Unicode
+from typing_extensions import Self
import sepal_ui.sepalwidgets as sw
+from sepal_ui import aoi
from sepal_ui.message import ms
from sepal_ui.scripts import decorator as sd
from sepal_ui.scripts import utils as su
@@ -17,15 +20,15 @@ __all__ = ["ReclassifyView"]
class ImportMatrixDialog(v.Dialog):
- file = Unicode("").tag(sync=True)
+ file: Unicode = Unicode("").tag(sync=True)
"the file to use"
- def __init__(self, folder, **kwargs):
+ def __init__(self, folder: Union[str, Path], **kwargs) -> None:
"""
Dialog to select the file to use and fill the matrix
Args:
- folder (pathlike object): the path to the saved classifications
+ folder: the path to the saved classifications
"""
# create the 3 widgets
@@ -48,14 +51,14 @@ class ImportMatrixDialog(v.Dialog):
# js behaviour
cancel.on_event("click", self._cancel)
- def _cancel(self, widget, event, data):
+ def _cancel(self, *args) -> Self:
"""exit and do nothing"""
self.value = False
return self
- def show(self):
+ def show(self) -> Self:
self.value = True
@@ -63,14 +66,13 @@ class ImportMatrixDialog(v.Dialog):
class SaveMatrixDialog(v.Dialog):
- """
- Dialog to setup the name of the output matrix file
-
- Args:
- folder (pathlike object): the path to the save folder. default to ~/
- """
+ def __init__(self, folder: Union[Path, str] = Path.home(), **kwargs) -> None:
+ """
+ Dialog to setup the name of the output matrix file
- def __init__(self, folder=Path.home(), **kwargs):
+ Args:
+ folder: the path to the save folder. default to ~/
+ """
# save the matrix
self._matrix = {}
@@ -102,7 +104,7 @@ class SaveMatrixDialog(v.Dialog):
self.w_file.on_event("blur", self._sanitize)
self.w_file.observe(self._store_info, "v_model")
- def _store_info(self, change):
+ def _store_info(self, change: dict) -> None:
"""Display where will be the file written"""
new_val = change["new"]
@@ -115,7 +117,9 @@ class SaveMatrixDialog(v.Dialog):
self.alert.add_msg(msg)
- def _cancel(self, widget, event, data):
+ return
+
+ def _cancel(self, *args) -> Self:
"""do nothing and exit"""
self.w_file.v_model = None
@@ -123,7 +127,7 @@ class SaveMatrixDialog(v.Dialog):
return self
- def _save(self, widget, event, data):
+ def _save(self, *args) -> Self:
"""save the matrix in a specified file"""
file = self.folder / f"{su.normalize_str(self.w_file.v_model)}.csv"
@@ -137,8 +141,10 @@ class SaveMatrixDialog(v.Dialog):
return self
- def show(self, matrix):
- """show the dialog and set the matrix values"""
+ def show(self, matrix: dict) -> Self:
+ """
+ show the dialog and set the matrix values
+ """
self._matrix = matrix
@@ -149,8 +155,10 @@ class SaveMatrixDialog(v.Dialog):
return self
- def _sanitize(self, widget, event, data):
- """sanitize the used name when saving"""
+ def _sanitize(self, *args) -> Self:
+ """
+ sanitize the used name when saving
+ """
if not self.w_file.v_model:
return self
@@ -161,15 +169,14 @@ class SaveMatrixDialog(v.Dialog):
class ClassSelect(sw.Select):
- """
- Custom widget to pick the value of a original class in the new classification system
-
- Args:
- new_codes(dict): the dict of the new codes to use as items {code: (name, color)}
- code (int): the orginal code of the class
- """
+ def __init__(self, new_codes: dict, old_code: int, **kwargs) -> None:
+ """
+ Custom widget to pick the value of a original class in the new classification system
- def __init__(self, new_codes, old_code, **kwargs):
+ Args:
+ new_codes: the dict of the new codes to use as items {code: (name, color)}
+ code: the orginal code of the class
+ """
# set default parameters
self.items = [
@@ -188,25 +195,28 @@ class ClassSelect(sw.Select):
class ReclassifyTable(sw.SimpleTable):
- """
- Table to store the reclassifying information.
- 2 columns are integrated, the new class value and the values in the original input
- One can select multiple class to be reclassify in the new classification
- Args:
- model (ReclassifyModel): model embeding the traitlet dict to store the reclassifying matrix. keys: class value in dst, values: list of values in src.
- dst_classes (dict|optional): a dictionnary that represent the classes of new the new classification table as {class_code: (class_name, class_color)}. class_code must be ints and class_name str.
- src_classes (dict|optional): the list of existing values within the input file {class_code: (class_name, class_color)}
+ HEADERS: list = ms.rec.rec.headers
+ "name of the column header [from, to]"
- Attributes:
- HEADER (list): name of the column header (from, to)
- model (ReclassifyModel): the reclassifyModel object to manipulate the
- input file and save parameters
- """
+ model: Optional[ReclassifyModel] = None
+ "the reclassifyModel object to manipulate the input file and save parameters"
- HEADERS = ms.rec.rec.headers
+ def __init__(
+ self,
+ model: ReclassifyModel,
+ dst_classes: dict = {},
+ src_classes: dict = {},
+ **kwargs,
+ ) -> None:
+ """
+ Table to store the reclassifying information. 2 columns are integrated, the new class value and the values in the original input. One can select multiple class to be reclassify in the new classification
- def __init__(self, model, dst_classes={}, src_classes={}, **kwargs):
+ Args:
+ model (ReclassifyModel): model embeding the traitlet dict to store the reclassifying matrix. keys: class value in dst, values: list of values in src.
+ dst_classes (dict|optional): a dictionnary that represent the classes of new the new classification table as {class_code: (class_name, class_color)}. class_code must be ints and class_name str.
+ src_classes (dict|optional): the list of existing values within the input file {class_code: (class_name, class_color)}
+ """
# default parameters
self.dense = True
@@ -226,13 +236,13 @@ class ReclassifyTable(sw.SimpleTable):
]
self.set_table(dst_classes, src_classes)
- def set_table(self, dst_classes, src_classes):
+ def set_table(self, dst_classes: dict, src_classes: dict) -> Self:
"""
Rebuild the table content based on the new_classes and codes provided
Args:
- dst_classes (dict|optional): a dictionnary that represent the classes of new the new classification table as {class_code: (class_name, class_color)}. class_code must be ints and class_name str.
- src_classes (dict|optional): the list of existing values within the input file {class_code: (class_name, class_color)}
+ dst_classes: a dictionnary that represent the classes of new the new classification table as {class_code: (class_name, class_color)}. class_code must be ints and class_name str.
+ src_classes: the list of existing values within the input file {class_code: (class_name, class_color)}
Return:
self
@@ -282,8 +292,10 @@ class ReclassifyTable(sw.SimpleTable):
return self
- def _update_matrix_values(self, change):
- """Update the appropriate matrix value when a Combo select change"""
+ def _update_matrix_values(self, change: dict) -> Self:
+ """
+ Update the appropriate matrix value when a Combo select change
+ """
# get the code of the class in the src classification
code = change["owner"]._metadata["class"]
@@ -295,24 +307,6 @@ class ReclassifyTable(sw.SimpleTable):
class ReclassifyView(sw.Card):
- """
- Stand-alone Card object allowing the user to reclassify a input file. the input can be of any type (vector or raster) and from any source (local or GEE).
- The user need to provide a destination classification file (table) in the following format : 3 headless columns: 'code', 'desc', 'color'. Once all the old class have been attributed to their new class the file can be exported in the source format to local memory or GEE. the output is also savec in memory for further use in the app. It can be used as a tile in a sepal_ui app. The id\\_ of the tile is set to "reclassify_tile"
-
- Args:
- model (ReclassifyModel): the reclassify model to manipulate the
- classification dataset. default to a new one
- class_path (str,optional): Folder path containing already existing
- classes. Default to ~/
- out_path (str,optional): the folder to save the created classifications.
- default to ~/downloads
- gee (bool): either or not to set :code:`gee` to True. default to False
- dst_class (str|pathlib.Path, optional): the file to be used as destination classification. for app that require specific code system the file can be set prior and the user won't have the oportunity to change it
- default_class (dict|optional): the default classification system to use, need to point to existing sytem: {name: absolute_path}
- folder(str, optional): the init GEE asset folder where the asset selector should start looking (debugging purpose)
- save (bool, optional): Whether to write/export the result or not.
- enforce_aoi (bool, optional): either or not an aoi should be set to allow the reclassification
- """
MAX_CLASS = 20
"int: the number of line in the table to trigger the display of an extra toolbar and alert"
@@ -355,18 +349,33 @@ class ReclassifyView(sw.Card):
def __init__(
self,
- model=None,
- class_path=Path.home(),
- out_path=Path.home() / "downloads",
- gee=False,
- dst_class=None,
- default_class={},
- aoi_model=None,
- save=True,
- folder="",
- enforce_aoi=False,
+ model: Optional[ReclassifyModel] = None,
+ class_path: Union[str, Path] = Path.home(),
+ out_path: Union[str, Path] = Path.home() / "downloads",
+ gee: bool = False,
+ dst_class: Union[str, Path] = "",
+ default_class: dict = {},
+ aoi_model: Optional[aoi.AoiModel] = None,
+ save: bool = True,
+ folder: Union[str, Path] = "",
+ enforce_aoi: bool = False,
**kwargs,
- ):
+ ) -> None:
+ """
+ Stand-alone Card object allowing the user to reclassify a input file. the input can be of any type (vector or raster) and from any source (local or GEE).
+ The user need to provide a destination classification file (table) in the following format : 3 headless columns: 'code', 'desc', 'color'. Once all the old class have been attributed to their new class the file can be exported in the source format to local memory or GEE. the output is also savec in memory for further use in the app. It can be used as a tile in a sepal_ui app. The id\\_ of the tile is set to "reclassify_tile"
+
+ Args:
+ model: the reclassify model to manipulate the classification dataset. default to a new one
+ class_path: Folder path containing already existing classes. Default to ~/
+ out_path: the folder to save the created classifications. default to ~/downloads
+ gee: either or not to set :code:`gee` to True. default to False
+ dst_class: the file to be used as destination classification. for app that require specific code system the file can be set prior and the user won't have the oportunity to change it
+ default_class: the default classification system to use, need to point to existing sytem: {name: absolute_path}
+ folder: the init GEE asset folder where the asset selector should start looking (debugging purpose)
+ save: Whether to write/export the result or not.
+ enforce_aoi: either or not an aoi should be set to allow the reclassification
+ """
# create metadata to make it compatible with the framwork app system
self._metadata = {"mount_id": "reclassify_tile"}
@@ -581,8 +590,10 @@ class ReclassifyView(sw.Card):
self.reclassify_btn.on_event("click", self.reclassify)
[btn.on_event("click", self._set_dst_class_file) for btn in self.btn_list]
- def _set_dst_class_file(self, widget, event, data):
- """Set the destination classification according to the one selected with btn. alter the widgets properties to reflect this change"""
+ def _set_dst_class_file(self, widget: v.VuetifyWidget, *args) -> Self:
+ """
+ Set the destination classification according to the one selected with btn. alter the widgets properties to reflect this change
+ """
# get the filename
filename = widget._metadata["path"]
@@ -599,12 +610,9 @@ class ReclassifyView(sw.Card):
return self
- def load_matrix_content(self, widget, event, data):
+ def load_matrix_content(self, widget: v.VuetifyWidget, *args) -> Self:
"""
Load the content of the file in the matrix. The table need to be already set to perform this operation
-
- Return:
- self
"""
self.import_dialog.value = False
file = self.import_dialog.w_file.v_model
@@ -656,13 +664,10 @@ class ReclassifyView(sw.Card):
return self
- def reclassify(self, widget, event, data):
+ def reclassify(self, *args) -> Self:
"""
Reclassify the input and store it in the appropriate format.
The input is not saved locally to avoid memory overload.
-
- Return:
- self
"""
# create the output file
@@ -674,8 +679,10 @@ class ReclassifyView(sw.Card):
return self
@sd.switch("loading", "disabled", on_widgets=["w_code"])
- def _update_band(self, change):
- """Update the band possibility to the available bands/properties of the input"""
+ def _update_band(self, *args) -> Self:
+ """
+ Update the band possibility to the available bands/properties of the input
+ """
# guess the file type and save it in the model
self.model.get_type()
@@ -687,13 +694,10 @@ class ReclassifyView(sw.Card):
@sd.switch("disabled", on_widgets=["reclassify_btn"], targets=[False])
@sd.switch("table_created", on_widgets=["model"], targets=[True])
- def get_reclassify_table(self, widget, event, data):
+ def get_reclassify_table(self, *args) -> Self:
"""
Display a reclassify table which will lead the user to select
a local code 'from user' to a target code based on a classes file
-
- Return:
- self
"""
# get the destination classes
@@ -716,14 +720,11 @@ class ReclassifyView(sw.Card):
return self
- def nest_tile(self):
+ def nest_tile(self) -> Self:
"""
Prepare the view to be used as a nested component in a tile.
the elevation will be set to 0 and the title remove from children.
The mount_id will also be changed to nested
-
- Return:
- self
"""
# remove id
diff --git a/sepal_ui/reclassify/table_view.py b/sepal_ui/reclassify/table_view.py
index ea708156..d8272b13 100644
--- a/sepal_ui/reclassify/table_view.py
+++ b/sepal_ui/reclassify/table_view.py
@@ -1,10 +1,12 @@
from colorsys import rgb_to_hls, rgb_to_hsv
from pathlib import Path
+from typing import Optional, Union
import ipyvuetify as v
import pandas as pd
from matplotlib.colors import to_rgb
from traitlets import Int
+from typing_extensions import Self
from sepal_ui import sepalwidgets as sw
from sepal_ui.message import ms
@@ -19,22 +21,14 @@ class ClassTable(sw.DataTable):
SCHEMA = param.SCHEMA
- def __init__(self, out_path=Path.home() / "downloads", **kwargs):
+ def __init__(
+ self, out_path: Union[str, Path] = Path.home() / "downloads", **kwargs
+ ) -> None:
"""
Custom data table to modify, display and save classification. From this interface, a user can modify a classification starting from a scratch or by loading a classification file. the display datatable allow all the CRUD fonctionality (create, read, update, delete).
- Attributes:
- SCHEMA (const list): the schema of the classification: ['id', 'code', 'description', 'color']
- out_path (pathlib.Path): the output folder to save the created classifications
- save_dialog (v.Dialog): the Dialog to save the classification (select name and format)
- edit_dialog (v.Dialog): the dialog to edit/create a noew line in the data-table. The user will provide: the code, the description and the color (with a color selector)
- edit_icon (v.Icon): the btn to open the edit_dialog (a line need to be selected in the table)
- delete_icon (v.icon): the btn to delete a selected line in the table
- add_icon (v.Icon): the btn to add a new line in the table
- save_icon (v.Icon): the btn to open the save_dialog and save the current classification table
-
Args:
- out_path (str|optional): output path where table will be saved, default to ~/downloads/
+ out_path: output path where table will be saved, default to ~/downloads/
"""
# save the output path
@@ -110,15 +104,12 @@ class ClassTable(sw.DataTable):
self.add_btn.on_event("click", self._add_event)
self.save_btn.on_event("click", self._save_event)
- def populate_table(self, items_file=None):
+ def populate_table(self, items_file: Union[Path, str] = "") -> Self:
"""
Populate table. It will fill the table with the item contained in the items_file parameter. If no file is provided the table is reset.
Args:
items (Path object|optional): file containing classes and description
-
- Return:
- self
"""
# If there is not any file passed as an argument, populate and empy table
@@ -151,7 +142,7 @@ class ClassTable(sw.DataTable):
return self
- def _save_event(self, widget, event, data):
+ def _save_event(self, *args) -> None:
"""open the save dialog to save the current table in a specific formatted table"""
if not self.items:
@@ -161,7 +152,7 @@ class ClassTable(sw.DataTable):
return
- def _edit_event(self, widget, event, data):
+ def _edit_event(self, *args) -> None:
"""Open the edit dialog and fill it with current line information"""
if not self.v_model:
@@ -171,14 +162,14 @@ class ClassTable(sw.DataTable):
return
- def _add_event(self, widget, event, data):
+ def _add_event(self, *args) -> None:
"""Open the edit dialog to create a new line to the table"""
self.edit_dialog.update()
return
- def _remove_event(self, widget, event, data):
+ def _remove_event(self, *args) -> None:
"""Remove current selection (self.v_model) element from table"""
if not self.v_model:
@@ -196,21 +187,12 @@ class EditDialog(v.Dialog):
TITLES = ms.rec.table.edit_dialog.titles
- def __init__(self, table, **kwargs):
+ def __init__(self, table: ClassTable, **kwargs) -> None:
"""
Dialog to modify/create new elements from the ClassTable data_table
Args:
- table (ClassTable, v.DataTable): Table linked with dialog
-
- Attributes:
- TITLES (list): the list of potential header (translated at the start of the application)
- table (classTable): the classTable associated with the dialog
- title (v.CardTitle): the title of the card ('modify' or 'new')
- save (sw.Btn): the btn to validate the new line and save it in the datatable
- modify (sw.Btn): the btn to validate the edited line and save it in the datatable
- cancel (sw.Btn): the btn to close the dialog without saving anything
- widgets (list): the list of widget to control the new element state (id, code, description, color) in this order.
+ table: Table linked with dialog
"""
# custom attributes
@@ -274,15 +256,12 @@ class EditDialog(v.Dialog):
self.modify.on_event("click", self._modify)
self.cancel.on_event("click", self._cancel)
- def update(self, data=[None, None, None, None]):
+ def update(self, data: list = [None, None, None, None]) -> Self:
"""
upadte the dialog with the provided information and activate it
Args:
- data (list): the text value of the selected line (id, code, description, color). default to 4 None (new line)
-
- Return:
- self
+ data: the text value of the selected line (id, code, description, color). default to 4 None (new line)
"""
# change the title accodring to the presence of data
@@ -341,7 +320,7 @@ class EditDialog(v.Dialog):
return self
- def _modify(self, widget, event, data):
+ def _modify(self, *args) -> None:
"""Modify elements in the data_table and close the dialog"""
# modify a local copy of the items
@@ -375,7 +354,7 @@ class EditDialog(v.Dialog):
return
- def _save(self, widget, event, data):
+ def _save(self, *args) -> None:
"""Add elements to the table and close the dialog"""
# modify a local copy of the items
@@ -397,7 +376,7 @@ class EditDialog(v.Dialog):
return
- def _cancel(self, widget, event, data):
+ def _cancel(self, *args) -> None:
"""Close dialog and do nothing"""
self.v_model = False
@@ -407,24 +386,16 @@ class EditDialog(v.Dialog):
class SaveDialog(v.Dialog):
- reload = Int().tag(sync=True)
+ reload = Int(0).tag(sync=True)
+ "a traitlet to inform the rest of the app that saving is complete"
- def __init__(self, table, out_path, **kwargs):
+ def __init__(self, table: ClassTable, out_path: Union[str, Path], **kwargs) -> None:
"""
Dialog to save as .csv file the content of a ClassTable data table
Args:
- table (ClassTable): Table linked with dialog
- out_path (str): Folder path to store table content
-
- Attributes:
- reload (Int): a traitlet to inform the rest of the app that saving is complete
- table (ClassTable): Table linked with dialog
- out_path (str): Folder path to store table content
- w_file_name (v.TextField): the filename to use in out_path
- save (sw.Btn): save btn to launch the saving of the table data in the out_path using the filename provided in the widget
- cancel (sw.Btn): btn to close the dialog and do nothing
- alert (sw.Alert): an alert to display evolution of the saving process (errors)
+ table: Table linked with dialog
+ out_path: Folder path to store table content
"""
# gather the table and saving params
@@ -481,7 +452,7 @@ class SaveDialog(v.Dialog):
self.w_file_name.on_event("blur", self._normalize_name)
self.w_file_name.observe(self._store_info, "v_model")
- def _store_info(self, change):
+ def _store_info(self, change: dict) -> None:
"""Display where will be the file written"""
new_val = change["new"]
@@ -494,12 +465,11 @@ class SaveDialog(v.Dialog):
self.alert.add_msg(msg)
- def show(self):
+ return
+
+ def show(self) -> Self:
"""
display the dialog and write down the text in the alert
-
- Return:
- self
"""
self.v_model = True
@@ -510,7 +480,7 @@ class SaveDialog(v.Dialog):
return self
- def _normalize_name(self, widget, event, data):
+ def _normalize_name(self, widget: v.VuetifyWidget, *args) -> None:
"""Replace the name with it's normalized version"""
# normalized the name
@@ -518,7 +488,7 @@ class SaveDialog(v.Dialog):
return
- def _save(self, widget, event, data):
+ def _save(self, *args) -> None:
"""Write current table on a text file"""
# set the file name
@@ -537,7 +507,7 @@ class SaveDialog(v.Dialog):
return
- def _cancel(self, widget, event, data):
+ def _cancel(self, *args) -> None:
"""hide the widget and do nothing"""
self.v_model = False
@@ -547,36 +517,39 @@ class SaveDialog(v.Dialog):
class TableView(sw.Card):
- title = None
+ title: Optional[v.CardTitle] = None
"v.CardTitle: the title of the card"
- class_path = None
+ class_path: str = ""
"str: Folder path containing already existing classes"
- out_path = None
+ out_path: str = ""
"str: the folder to save the created classifications"
- w_class_file = None
+ w_class_file: Optional[sw.FileInput] = None
"sw.FileInput: the file input of the existing classification system"
- w_class_table = None
+ w_class_table: Optional[ClassTable] = None
"ClassTable: the classtable (CRUD) to manage the editing of the classification"
- btn = None
+ btn: Optional[sw.Btn] = None
"sw.Btn: the btn to start loading file data into the table"
- alert = None
+ alert: Optional[sw.Alert] = None
"sw.Alert: the alert to display loading information (error and success)"
def __init__(
- self, class_path=Path.home(), out_path=Path.home() / "downloads", **kwargs
+ self,
+ class_path: Union[str, Path] = Path.home(),
+ out_path: Union[str, Path] = Path.home() / "downloads",
+ **kwargs,
):
"""
Stand-alone Card object allowing the user to build custom class table. The user can start from an existing table or start from scratch. It gives the oportunity to change: the value, the class name and the color. It can be used as a tile in a sepal_ui app. The id\\_ of the tile is set to "classification_tile"
Args:
- class_path (str|optional): Folder path containing already existing classes. Default to ~/
- out_path (str|optional): the folder to save the created classifications. default to ~/downloads
+ class_path: Folder path containing already existing classes. Default to ~/
+ out_path: the folder to save the created classifications. default to ~/downloads
"""
# create metadata to make it compatible with the framwork app system
@@ -642,12 +615,9 @@ class TableView(sw.Card):
self.btn.on_event("click", self.get_class_table)
@sd.loading_button(debug=True)
- def get_class_table(self, widget, event, data):
+ def get_class_table(self, *args) -> Self:
"""
Display class table widget in view
-
- Return:
- self
"""
# load the existing file into the table
@@ -655,14 +625,11 @@ class TableView(sw.Card):
return self
- def nest_tile(self):
+ def nest_tile(self) -> Self:
"""
Prepare the view to be used as a nested component in a tile.
the elevation will be set to 0 and the title remove from children.
The mount_id will also be changed to nested
-
- Return:
- self
"""
# remove id
diff --git a/sepal_ui/scripts/gee.py b/sepal_ui/scripts/gee.py
index f9258000..a3aa17ad 100644
--- a/sepal_ui/scripts/gee.py
+++ b/sepal_ui/scripts/gee.py
@@ -6,10 +6,10 @@ import ee
import ipyvuetify as v
from sepal_ui.message import ms
-from sepal_ui.scripts import utils as su
+from sepal_ui.scripts import decorator as sd
[email protected]_ee
[email protected]_ee
def wait_for_completion(task_descripsion: str, widget_alert: v.Alert = None) -> str:
"""
Wait until the selected process is finished. Display some output information
@@ -45,7 +45,7 @@ def wait_for_completion(task_descripsion: str, widget_alert: v.Alert = None) ->
return state
[email protected]_ee
[email protected]_ee
def is_task(task_descripsion: str) -> ee.batch.Task:
"""
Search for the described task in the user Task list return None if nothing is found
@@ -66,7 +66,7 @@ def is_task(task_descripsion: str) -> ee.batch.Task:
return current_task
[email protected]_ee
[email protected]_ee
def is_running(task_descripsion: str) -> ee.batch.Task:
"""
Search for the described task in the user Task list return None if nothing is currently running
@@ -86,7 +86,7 @@ def is_running(task_descripsion: str) -> ee.batch.Task:
return current_task
[email protected]_ee
[email protected]_ee
def get_assets(folder: Union[str, Path] = "", asset_list: List[str] = []) -> List[str]:
"""
Get all the assets from the parameter folder. every nested asset will be displayed.
@@ -113,7 +113,7 @@ def get_assets(folder: Union[str, Path] = "", asset_list: List[str] = []) -> Lis
return asset_list
[email protected]_ee
[email protected]_ee
def is_asset(asset_name: str, folder: Union[str, Path] = "") -> bool:
"""
Check if the asset already exist in the user asset folder
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 40c56a97..74c5f2b3 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -17,6 +17,7 @@ from typing_extensions import Self
from sepal_ui import color
from sepal_ui.frontend import styles as ss
from sepal_ui.message import ms
+from sepal_ui.scripts import decorator as sd
from sepal_ui.scripts import gee
from sepal_ui.scripts import utils as su
from sepal_ui.sepalwidgets.btn import Btn
@@ -364,7 +365,7 @@ class FileInput(v.Flex, SepalWidget):
return self
- @su.switch("indeterminate", on_widgets=["loading"])
+ @sd.switch("indeterminate", on_widgets=["loading"])
def _change_folder(self) -> None:
"""
Change the target folder
@@ -563,7 +564,7 @@ class LoadTableField(v.Col, SepalWidget):
return
- @su.switch("loading", on_widgets=["IdSelect", "LngSelect", "LatSelect"])
+ @sd.switch("loading", on_widgets=["IdSelect", "LngSelect", "LatSelect"])
def _on_file_input_change(self, change: dict) -> Self:
"""
Update the select content when the fileinput v_model is changing
@@ -672,7 +673,7 @@ class AssetSelect(v.Combobox, SepalWidget):
types: t.List = t.List().tag(sync=True)
"The list of types accepted by the asset selector. names need to be valide TYPES and changing this value will trigger the reload of the asset items."
- @su.need_ee
+ @sd.need_ee
def __init__(
self,
folder: Union[str, Path] = "",
@@ -725,7 +726,7 @@ class AssetSelect(v.Combobox, SepalWidget):
self.on_event("click:prepend", self._get_items)
self.observe(self._get_items, "default_asset")
- @su.switch("loading")
+ @sd.switch("loading")
def _validate(self, change: dict) -> None:
"""
Validate the selected asset. Throw an error message if is not accesible or not in the type list.
@@ -754,7 +755,7 @@ class AssetSelect(v.Combobox, SepalWidget):
return
- @su.switch("loading", "disabled")
+ @sd.switch("loading", "disabled")
def _get_items(self, *args) -> Self:
# init the item list
@@ -819,11 +820,11 @@ class PasswordField(v.TextField, SepalWidget):
"""
# default behavior
- kwargs["label"] = kwargs.pop("label", "Password")
+ kwargs["label"] = kwargs.pop("label", ms.password_field.label)
kwargs["class_"] = kwargs.pop("class_", "mr-2")
kwargs["v_model"] = kwargs.pop("v_model", "")
kwargs["type"] = "password"
- kwargs["append_icon"] = kwargs.pop("append_icon", "mdi-eye-off")
+ kwargs["append_icon"] = kwargs.pop("append_icon", "fa-solid fa-eye-slash")
# init the widget with the remaining kwargs
super().__init__(**kwargs)
@@ -838,10 +839,10 @@ class PasswordField(v.TextField, SepalWidget):
if self.type == "text":
self.type = "password"
- self.append_icon = "mdi-eye-off"
+ self.append_icon = "fa-solid fa-eye-slash"
else:
self.type = "text"
- self.append_icon = "mdi-eye"
+ self.append_icon = "fa-solid fa-eye"
return
@@ -875,8 +876,10 @@ class NumberField(v.TextField, SepalWidget):
# set default params
kwargs["type"] = "number"
- kwargs["append_outer_icon"] = kwargs.pop("append_outer_icon", "mdi-plus")
- kwargs["prepend_icon"] = kwargs.pop("prepend_icon", "mdi-minus")
+ kwargs["append_outer_icon"] = kwargs.pop(
+ "append_outer_icon", "fa-solid fa-plus"
+ )
+ kwargs["prepend_icon"] = kwargs.pop("prepend_icon", "fa-solid fa-minus")
kwargs["v_model"] = kwargs.pop("v_model", 0)
kwargs["readonly"] = kwargs.pop("readonly", True)
@@ -998,7 +1001,7 @@ class VectorField(v.Col, SepalWidget):
return self
- @su.switch("loading", on_widgets=["w_column", "w_value"])
+ @sd.switch("loading", on_widgets=["w_column", "w_value"])
def _update_file(self, change: dict) -> Self:
"""update the file name, the v_model and reset the other widgets"""
@@ -1034,7 +1037,7 @@ class VectorField(v.Col, SepalWidget):
return self
- @su.switch("loading", on_widgets=["w_value"])
+ @sd.switch("loading", on_widgets=["w_value"])
def _update_column(self, change: dict) -> Self:
"""Update the column name and empty the value list"""
diff --git a/sepal_ui/sepalwidgets/widget.py b/sepal_ui/sepalwidgets/widget.py
index 0c1d9551..1f332be8 100644
--- a/sepal_ui/sepalwidgets/widget.py
+++ b/sepal_ui/sepalwidgets/widget.py
@@ -1,3 +1,4 @@
+from pathlib import Path
from typing import Optional, Union
import ipyvuetify as v
@@ -81,22 +82,11 @@ class CopyToClip(v.VuetifyTemplate):
self.components = {"mytf": self.tf}
# template with js behaviour
- self.template = """
- <mytf/>
- <script>
- {methods: {
- jupyter_clip(_txt) {
- var tempInput = document.createElement("input");
- tempInput.value = _txt;
- document.body.appendChild(tempInput);
- tempInput.focus();
- tempInput.select();
- document.execCommand("copy");
- document.body.removeChild(tempInput);
- }
- }}
- </script>
- """
+ js_dir = Path(__file__).parents[1] / "frontend/js"
+ clip = (js_dir / "jupyter_clip.js").read_text()
+ self.template = (
+ "<mytf/>" "<script>{methods: {jupyter_clip(_txt) {%s}}}</script>" % clip
+ )
super().__init__()
|
NumberField is not using fontawesome icons
|
12rambau/sepal_ui
|
diff --git a/tests/check_warnings.py b/tests/check_warnings.py
new file mode 100644
index 00000000..af336d96
--- /dev/null
+++ b/tests/check_warnings.py
@@ -0,0 +1,56 @@
+import sys
+from pathlib import Path
+
+
+def check_warnings(file):
+ """
+ Check the list of warnings produced by the GitHub CI tests
+ raise errors if there are unexpected ones and/or if some are missing
+
+ Args:
+ file (pathlib.Path): the path to the generated warning.txt file from
+ the CI build
+
+ Return:
+ 0 if the warnings are all there
+ 1 if some warning are not registered or unexpected
+ """
+
+ # print some log
+ print("\n=== Sphinx Warnings test ===\n")
+
+ # find the file where all the known warnings are stored
+ warning_file = Path(__file__).parent / "data" / "warning_list.txt"
+
+ test_warnings = file.read_text().strip().split("\n")
+ ref_warnings = warning_file.read_text().strip().split("\n")
+
+ print(
+ f'Checking build warnings in file: "{file}" and comparing to expected '
+ f'warnings defined in "{warning_file}"\n\n'
+ )
+
+ # find all the missing warnings
+ missing_warnings = []
+ for wa in ref_warnings:
+ index = [i for i, twa in enumerate(test_warnings) if wa in twa]
+ if len(index) == 0:
+ missing_warnings += [wa]
+ print(f"Warning was not raised: {wa}\n")
+ else:
+ test_warnings.pop(index[0])
+
+ # the remaining one are unexpected
+ for twa in test_warnings:
+ print(f"Unexpected warning: {twa}\n")
+
+ return len(missing_warnings) != 0 or len(test_warnings) != 0
+
+
+if __name__ == "__main__":
+
+ # cast the file to path and resolve to an absolute one
+ file = Path.cwd() / "warnings.txt"
+
+ # execute the test
+ sys.exit(check_warnings(file))
diff --git a/tests/data/warning_list.txt b/tests/data/warning_list.txt
new file mode 100644
index 00000000..c4c475f8
--- /dev/null
+++ b/tests/data/warning_list.txt
@@ -0,0 +1,3 @@
+ERROR: Unknown target name: "type".
+ERROR: Document or section may not begin with a transition.
+WARNING: document isn't included in any toctree
\ No newline at end of file
diff --git a/tests/test_AoiModel.py b/tests/test_AoiModel.py
index f240e543..cba391be 100644
--- a/tests/test_AoiModel.py
+++ b/tests/test_AoiModel.py
@@ -9,36 +9,36 @@ from sepal_ui import aoi
class TestAoiModel:
- def test_init_no_ee(self, alert, fake_vector):
+ def test_init_no_ee(self, fake_vector):
# default init
- aoi_model = aoi.AoiModel(alert, gee=False)
+ aoi_model = aoi.AoiModel(gee=False)
assert isinstance(aoi_model, aoi.AoiModel)
assert aoi_model.gee is False
# with a default vector
- aoi_model = aoi.AoiModel(alert, vector=fake_vector, gee=False)
+ aoi_model = aoi.AoiModel(vector=fake_vector, gee=False)
assert aoi_model.name == "gadm36_VAT_0"
# test with a non ee admin
admin = "VAT" # GADM Vatican city
- aoi_model = aoi.AoiModel(alert, gee=False, admin=admin)
+ aoi_model = aoi.AoiModel(gee=False, admin=admin)
assert aoi_model.name == "VAT"
return
@pytest.mark.skipif(not ee.data._credentials, reason="GEE is not set")
- def test_init_ee(alert, gee_dir):
+ def test_init_ee(self, gee_dir):
# default init
- aoi_model = aoi.AoiModel(alert, folder=gee_dir)
+ aoi_model = aoi.AoiModel(folder=gee_dir)
assert isinstance(aoi_model, aoi.AoiModel)
assert aoi_model.gee is True
# with default assetId
asset_id = str(gee_dir / "feature_collection")
- aoi_model = aoi.AoiModel(alert, asset=asset_id, folder=gee_dir)
+ aoi_model = aoi.AoiModel(asset=asset_id, folder=gee_dir)
assert aoi_model.asset_name == asset_id
assert aoi_model.default_asset == asset_id
@@ -48,23 +48,23 @@ class TestAoiModel:
# check that wrongly defined asset_name raise errors
with pytest.raises(Exception):
- aoi_model = aoi.AoiModel(alert, folder=gee_dir)
+ aoi_model = aoi.AoiModel(folder=gee_dir)
aoi_model._from_asset({"pathname": None})
with pytest.raises(Exception):
- aoi_model = aoi.AoiModel(alert, folder=gee_dir)
+ aoi_model = aoi.AoiModel(folder=gee_dir)
asset = {"pathname": asset_id, "column": "data", "value": None}
aoi_model._from_asset(asset)
# it should be the same with a different name
- aoi_model = aoi.AoiModel(alert, folder=gee_dir)
+ aoi_model = aoi.AoiModel(folder=gee_dir)
asset = {"pathname": asset_id, "column": "data", "value": 0}
aoi_model._from_asset(asset)
assert aoi_model.name == "feature_collection_data_0"
# with a default admin
admin = "110" # GAUL Vatican city
- aoi_model = aoi.AoiModel(alert, admin=admin, folder=gee_dir)
+ aoi_model = aoi.AoiModel(admin=admin, folder=gee_dir)
assert aoi_model.name == "VAT"
return
@@ -121,7 +121,7 @@ class TestAoiModel:
return
- def test_clear_attributes(self, alert, aoi_model_outputs, aoi_model_traits):
+ def test_clear_attributes(self, aoi_model_outputs, aoi_model_traits):
aoi_model = aoi.AoiModel(gee=False)
@@ -151,7 +151,7 @@ class TestAoiModel:
assert all([is_none(out) for out in aoi_model_outputs])
# check that default are saved
- aoi_model = aoi.AoiModel(alert, admin="VAT", gee=False) # GADM for Vatican
+ aoi_model = aoi.AoiModel(admin="VAT", gee=False) # GADM for Vatican
# insert dummy parameter
[set_trait(trait) for trait in aoi_model_traits]
@@ -192,9 +192,9 @@ class TestAoiModel:
return
- def test_set_object(self, alert):
+ def test_set_object(self):
- aoi_model = aoi.AoiModel(alert, gee=False)
+ aoi_model = aoi.AoiModel(gee=False)
# test that no method returns an error
with pytest.raises(Exception):
@@ -202,9 +202,9 @@ class TestAoiModel:
return
- def test_from_admin(self, alert, gee_dir):
+ def test_from_admin(self, gee_dir):
- aoi_model = aoi.AoiModel(alert, folder=gee_dir)
+ aoi_model = aoi.AoiModel(folder=gee_dir)
# with fake number
with pytest.raises(Exception):
@@ -217,9 +217,9 @@ class TestAoiModel:
return
@pytest.mark.skipif(not ee.data._credentials, reason="GEE is not set")
- def test_from_point(self, alert, fake_points, gee_dir):
+ def test_from_point(self, fake_points, gee_dir):
- aoi_model = aoi.AoiModel(alert, folder=gee_dir, gee=False)
+ aoi_model = aoi.AoiModel(folder=gee_dir, gee=False)
# uncomplete json
points = {
@@ -244,9 +244,9 @@ class TestAoiModel:
return
@pytest.mark.skipif(not ee.data._credentials, reason="GEE is not set")
- def test_from_vector(self, alert, gee_dir, fake_vector):
+ def test_from_vector(self, gee_dir, fake_vector):
- aoi_model = aoi.AoiModel(alert, folder=gee_dir, gee=False)
+ aoi_model = aoi.AoiModel(folder=gee_dir, gee=False)
# with no pathname
with pytest.raises(Exception):
@@ -270,9 +270,9 @@ class TestAoiModel:
return
@pytest.mark.skipif(not ee.data._credentials, reason="GEE is not set")
- def test_from_geo_json(self, alert, gee_dir, square):
+ def test_from_geo_json(self, gee_dir, square):
- aoi_model = aoi.AoiModel(alert, folder=gee_dir, gee=False)
+ aoi_model = aoi.AoiModel(folder=gee_dir, gee=False)
# no points
with pytest.raises(Exception):
@@ -286,11 +286,11 @@ class TestAoiModel:
return
@pytest.mark.skipif(not ee.data._credentials, reason="GEE is not set")
- def test_from_asset(self, alert, gee_dir):
+ def test_from_asset(self, gee_dir):
# init parameters
asset_id = str(gee_dir / "feature_collection")
- aoi_model = aoi.AoiModel(alert, folder=gee_dir)
+ aoi_model = aoi.AoiModel(folder=gee_dir)
# no asset name
with pytest.raises(Exception):
@@ -381,12 +381,12 @@ class TestAoiModel:
return
@pytest.fixture
- def test_model(self, alert, gee_dir):
+ def test_model(self, gee_dir):
"""
Create a test AoiModel based on GEE using Vatican
"""
admin = "110" # vatican city (smalest adm0 feature)
- return aoi.AoiModel(alert, admin=admin, folder=gee_dir)
+ return aoi.AoiModel(admin=admin, folder=gee_dir)
@pytest.fixture(scope="class")
def aoi_model_traits(self):
diff --git a/tests/test_PasswordField.py b/tests/test_PasswordField.py
index 5d930a63..d4ff8855 100644
--- a/tests/test_PasswordField.py
+++ b/tests/test_PasswordField.py
@@ -16,12 +16,12 @@ class TestPasswordField:
# change the viz once
password._toggle_pwd(None, None, None)
assert password.type == "text"
- assert password.append_icon == "mdi-eye"
+ assert password.append_icon == "fa-solid fa-eye"
# change it a second time
password._toggle_pwd(None, None, None)
assert password.type == "password"
- assert password.append_icon == "mdi-eye-off"
+ assert password.append_icon == "fa-solid fa-eye-slash"
return
diff --git a/tests/test_ReclassifyView.py b/tests/test_ReclassifyView.py
index ad7124bc..84ad221e 100644
--- a/tests/test_ReclassifyView.py
+++ b/tests/test_ReclassifyView.py
@@ -11,7 +11,7 @@ from sepal_ui.reclassify import ReclassifyModel, ReclassifyView
class TestReclassifyView:
@pytest.mark.skipif(not ee.data._credentials, reason="GEE is not set")
- def test_init_exception(alert, gee_dir):
+ def test_init_exception(self, gee_dir):
"""Test exceptions"""
aoi_model = aoi.AoiModel(gee=False)
@@ -146,10 +146,10 @@ class TestReclassifyView:
return
@pytest.fixture
- def view_local(self, tmp_dir, class_file, alert):
+ def view_local(self, tmp_dir, class_file):
"""return a local reclassify view"""
- aoi_model = aoi.AoiModel(alert, gee=False)
+ aoi_model = aoi.AoiModel(gee=False)
return ReclassifyView(
aoi_model=aoi_model,
@@ -160,10 +160,10 @@ class TestReclassifyView:
)
@pytest.fixture
- def view_gee(self, tmp_dir, class_file, gee_dir, alert):
+ def view_gee(self, tmp_dir, class_file, gee_dir):
"""return a gee reclassify view"""
- aoi_model = aoi.AoiModel(alert, gee=True, folder=str(gee_dir))
+ aoi_model = aoi.AoiModel(gee=True, folder=str(gee_dir))
return ReclassifyView(
aoi_model=aoi_model,
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 13
}
|
2.13
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-sugar",
"pytest-icdiff",
"pytest-cov",
"pytest-deadfixtures",
"Flake8-pyproject",
"nox",
"nbmake"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL",
"pip install localtileserver"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyio==3.7.1
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
flake8==7.2.0
Flake8-pyproject==1.2.3
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
GDAL==3.11.0
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
icdiff==2.0.7
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
nox==2025.2.9
numexpr==2.10.2
numpy==2.0.2
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a6
platformdirs==4.3.7
pluggy==1.5.0
pprintpp==0.4.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycodestyle==2.13.0
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
pyflakes==3.3.2
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest==8.3.5
pytest-cov==6.0.0
pytest-deadfixtures==2.2.1
pytest-icdiff==0.9
pytest-sugar==1.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@549667ffe968ab4d631766a96024819b0fabff00#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==3.1.3
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyio==3.7.1
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-pyproject==1.2.3
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- gdal==3.11.0
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- icdiff==2.0.7
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mccabe==0.7.0
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- nox==2025.2.9
- numexpr==2.10.2
- numpy==2.0.2
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a6
- platformdirs==4.3.7
- pluggy==1.5.0
- pprintpp==0.4.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycodestyle==2.13.0
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pyflakes==3.3.2
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-deadfixtures==2.2.1
- pytest-icdiff==0.9
- pytest-sugar==1.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- sepal-ui==2.13.0
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==3.1.3
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_PasswordField.py::TestPasswordField::test_toogle_viz"
] |
[
"tests/test_AoiModel.py::TestAoiModel::test_clear_attributes"
] |
[
"tests/test_AoiModel.py::TestAoiModel::test_set_object",
"tests/test_PasswordField.py::TestPasswordField::test_init",
"tests/test_ReclassifyView.py::TestReclassifyView::test_init_local",
"tests/test_ReclassifyView.py::TestReclassifyView::test_set_dst_class_file"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-747
|
a683a7665a9710acd5ca939308e18539e92014b7
|
2023-02-08 10:00:39
|
22c831cffe193cb87de2720b655ebd069e585f45
|
diff --git a/sepal_ui/sepalwidgets/sepalwidget.py b/sepal_ui/sepalwidgets/sepalwidget.py
index 40826809..00cbe015 100644
--- a/sepal_ui/sepalwidgets/sepalwidget.py
+++ b/sepal_ui/sepalwidgets/sepalwidget.py
@@ -177,11 +177,11 @@ class SepalWidget(v.VuetifyWidget):
is_klass = isinstance(w, klass)
is_val = w.attributes.get(attr, "niet") == value if attr and value else True
- # asumption: searched element won't be nested inside one another
if is_klass and is_val:
elements.append(w)
- else:
- elements = self.get_children(w, klass, attr, value, id_, elements)
+
+ # always search for nested elements
+ elements = self.get_children(w, klass, attr, value, id_, elements)
return elements
|
make get_children recursively again
previous implementation used recursion to find all children within the widget that matches with the query, now it returns only first level of matching children, could we make it reclusively again?
|
12rambau/sepal_ui
|
diff --git a/tests/test_SepalWidget.py b/tests/test_SepalWidget.py
index 3abd719f..22699d69 100644
--- a/tests/test_SepalWidget.py
+++ b/tests/test_SepalWidget.py
@@ -108,24 +108,23 @@ class TestSepalWidget:
assert len(res) == 0
# search for specific attributes in any class
- # one alert that could match is ignored because the parent card is identified
- # earlier, that's a feature
res = test_card.get_children(attr="id", value=3)
- assert len(res) == 6
+ assert len(res) == 7
assert isinstance(res[0], sw.Alert)
assert isinstance(res[1], sw.Alert)
assert isinstance(res[2], sw.Alert)
assert isinstance(res[3], sw.Card)
assert isinstance(res[4], sw.Alert)
- assert isinstance(res[5], sw.Btn)
+ assert isinstance(res[5], sw.Alert)
+ assert isinstance(res[6], sw.Btn)
- # missing value (all children will match so nested are ignored)
+ # missing value (all children will match including icons)
res = test_card.get_children(attr="id")
- assert len(res) == 10
+ assert len(res) == 40
- # missing attr (all children will match so nested are ignored)
+ # missing attr (all children will match including icons)
res = test_card.get_children(value=5)
- assert len(res) == 10
+ assert len(res) == 40
# no match search attr
res = test_card.get_children(attr="toto", value="toto")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
2.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-sugar",
"pytest-icdiff",
"pytest-cov",
"pytest-deadfixtures",
"Flake8-pyproject",
"nox",
"nbmake"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyio==3.7.1
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
flake8==7.2.0
Flake8-pyproject==1.2.3
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
icdiff==2.0.7
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==3.1.3
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
nox==2025.2.9
numpy==2.0.2
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a6
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pprintpp==0.4.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycodestyle==2.13.0
pycparser==2.22
pyflakes==3.3.2
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
pytest-deadfixtures==2.2.1
pytest-icdiff==0.9
pytest-sugar==1.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@a683a7665a9710acd5ca939308e18539e92014b7#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyio==3.7.1
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-pyproject==1.2.3
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- icdiff==2.0.7
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mccabe==0.7.0
- mistune==3.1.3
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- nox==2025.2.9
- numpy==2.0.2
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a6
- platformdirs==4.3.7
- pprintpp==0.4.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycodestyle==2.13.0
- pycparser==2.22
- pyflakes==3.3.2
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest-cov==6.0.0
- pytest-deadfixtures==2.2.1
- pytest-icdiff==0.9
- pytest-sugar==1.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- sepal-ui==2.15.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_SepalWidget.py::TestSepalWidget::test_get_children"
] |
[] |
[
"tests/test_SepalWidget.py::TestSepalWidget::test_init",
"tests/test_SepalWidget.py::TestSepalWidget::test_set_viz",
"tests/test_SepalWidget.py::TestSepalWidget::test_show",
"tests/test_SepalWidget.py::TestSepalWidget::test_hide",
"tests/test_SepalWidget.py::TestSepalWidget::test_toggle_viz",
"tests/test_SepalWidget.py::TestSepalWidget::test_reset",
"tests/test_SepalWidget.py::TestSepalWidget::test_set_children",
"tests/test_SepalWidget.py::TestSepalWidget::test_set_children_error"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-747
|
|
12rambau__sepal_ui-758
|
27a18eba37bec8ef1cabfa6bcc4022164ebc4c3b
|
2023-02-13 16:42:43
|
22c831cffe193cb87de2720b655ebd069e585f45
|
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 04e69553..0cb7a9bf 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -156,6 +156,12 @@ class DatePicker(v.Layout, SepalWidget):
return
+ def today(self) -> Self:
+ """Update the date to the current day."""
+ self.v_model = datetime.today().strftime("%Y-%m-%d")
+
+ return self
+
@staticmethod
def is_valid_date(date: str) -> bool:
"""
|
add a today() method for the datepicker
It's something I do a lot, setting up the datepicker to today as:
```python
from sepal_ui import sepawidgets as sw
from datetime import datetime
dp = sw.Datepicker()
# do stulff and as a fallback do
dp.v_model = datetime.today().strftime("%Y-%m-%d")
```
Instead I would love to have something like:
```python
dp.today()
```
what do you think ?
|
12rambau/sepal_ui
|
diff --git a/tests/test_DatePicker.py b/tests/test_DatePicker.py
index 02ee81c1..cfa47475 100644
--- a/tests/test_DatePicker.py
+++ b/tests/test_DatePicker.py
@@ -1,3 +1,5 @@
+from datetime import datetime
+
import pytest
from traitlets import Any
@@ -96,6 +98,16 @@ class TestDatePicker:
return
+ def test_today(self, datepicker) -> None:
+ """check that the date is updated to today"""
+
+ res = datepicker.today()
+
+ assert res == datepicker
+ assert res.v_model == datetime.today().strftime("%Y-%m-%d")
+
+ return
+
@pytest.fixture
def datepicker(self):
"""create a default datepicker."""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 1
}
|
2.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-sugar",
"pytest-icdiff",
"pytest-cov",
"pytest-deadfixtures",
"Flake8-pyproject",
"nbmake"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL",
"pip install localtileserver"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyio==3.7.1
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
flake8==7.2.0
Flake8-pyproject==1.2.3
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
GDAL==3.11.0
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
icdiff==2.0.7
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
nox==2025.2.9
numexpr==2.10.2
numpy==2.0.2
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a6
platformdirs==4.3.7
pluggy==1.5.0
pprintpp==0.4.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycodestyle==2.13.0
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
pyflakes==3.3.1
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest==8.3.5
pytest-cov==6.0.0
pytest-deadfixtures==2.2.1
pytest-icdiff==0.9
pytest-sugar==1.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@27a18eba37bec8ef1cabfa6bcc4022164ebc4c3b#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==3.1.3
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyio==3.7.1
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-pyproject==1.2.3
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- gdal==3.11.0
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- icdiff==2.0.7
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mccabe==0.7.0
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- nox==2025.2.9
- numexpr==2.10.2
- numpy==2.0.2
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a6
- platformdirs==4.3.7
- pluggy==1.5.0
- pprintpp==0.4.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycodestyle==2.13.0
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pyflakes==3.3.1
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-deadfixtures==2.2.1
- pytest-icdiff==0.9
- pytest-sugar==1.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- sepal-ui==2.15.1
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==3.1.3
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_DatePicker.py::TestDatePicker::test_today"
] |
[] |
[
"tests/test_DatePicker.py::TestDatePicker::test_init",
"tests/test_DatePicker.py::TestDatePicker::test_kwargs",
"tests/test_DatePicker.py::TestDatePicker::test_bind",
"tests/test_DatePicker.py::TestDatePicker::test_disable",
"tests/test_DatePicker.py::TestDatePicker::test_is_valid_date",
"tests/test_DatePicker.py::TestDatePicker::test_check_date"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-774
|
2576446debe3544f3edeb208c76f671ffc0c8650
|
2023-03-01 15:49:43
|
22c831cffe193cb87de2720b655ebd069e585f45
|
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 04e69553..cd561bb5 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -205,6 +205,9 @@ class FileInput(v.Flex, SepalWidget):
clear: Optional[v.Btn] = None
"clear btn to remove everything and set back to the ini folder"
+ root: t.Unicode = t.Unicode("").tag(sync=True)
+ "the root folder from which you cannot go higher in the tree."
+
v_model: t.Unicode = t.Unicode(None, allow_none=True).tag(sync=True)
"the v_model of the input"
@@ -218,6 +221,7 @@ class FileInput(v.Flex, SepalWidget):
label: str = ms.widgets.fileinput.label,
v_model: Union[str, None] = "",
clearable: bool = False,
+ root: Union[str, Path] = "",
**kwargs,
) -> None:
"""
@@ -229,10 +233,12 @@ class FileInput(v.Flex, SepalWidget):
label: the label of the input
v_model: the default value
clearable: wether or not to make the widget clearable. default to False
+ root: the root folder from which you cannot go higher in the tree.
kwargs: any parameter from a v.Flex abject. If set, 'children' will be overwritten.
"""
self.extentions = extentions
self.folder = Path(folder)
+ self.root = str(root) if isinstance(root, Path) else root
self.selected_file = v.TextField(
readonly=True,
@@ -441,7 +447,10 @@ class FileInput(v.Flex, SepalWidget):
folder_list = humansorted(folder_list, key=lambda x: x.value)
file_list = humansorted(file_list, key=lambda x: x.value)
+ folder_list.extend(file_list)
+ # add the parent item if root is set and is not reached yet
+ # if root is not set then we always display it
parent_item = v.ListItem(
value=str(folder.parent),
children=[
@@ -458,9 +467,11 @@ class FileInput(v.Flex, SepalWidget):
),
],
)
-
- folder_list.extend(file_list)
- folder_list.insert(0, parent_item)
+ root_folder = Path(self.root)
+ if self.root == "":
+ folder_list.insert(0, parent_item)
+ elif root_folder in folder.parents:
+ folder_list.insert(0, parent_item)
return folder_list
diff --git a/sepal_ui/sepalwidgets/sepalwidget.py b/sepal_ui/sepalwidgets/sepalwidget.py
index 79428748..d9d10451 100644
--- a/sepal_ui/sepalwidgets/sepalwidget.py
+++ b/sepal_ui/sepalwidgets/sepalwidget.py
@@ -13,7 +13,7 @@ Example:
"""
import warnings
-from typing import Optional, Union
+from typing import List, Optional, Union
import ipyvuetify as v
import traitlets as t
@@ -125,7 +125,7 @@ class SepalWidget(v.VuetifyWidget):
value: str = "",
id_: str = "",
elements: Optional[list] = None,
- ) -> list:
+ ) -> List[v.VuetifyWidget]:
r"""
Recursively search for every element matching the specifications.
|
Restrict maximum parent level from InputFile
I have some apps where I’m interested on only search up to certain level, i.e., module_downloads, and I think that in the most of them, the user doesn’t need to go upper from sepal_user, once they start clicking, they could easily get lost over multiple folders.
what if we implement a parameter called: max_depth? We could use int values to this parameter, what do you think?
|
12rambau/sepal_ui
|
diff --git a/tests/conftest.py b/tests/conftest.py
index f8b2c217..bac6feee 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,7 @@
import uuid
from itertools import product
from pathlib import Path
+from typing import Optional
import ee
import geopandas as gpd
@@ -20,7 +21,7 @@ except Exception:
@pytest.fixture(scope="session")
-def root_dir():
+def root_dir() -> Path:
"""
Path to the root dir of the librairy.
"""
@@ -28,7 +29,7 @@ def root_dir():
@pytest.fixture(scope="session")
-def tmp_dir():
+def tmp_dir() -> Path:
"""
Creates a temporary local directory to store data.
"""
@@ -39,7 +40,7 @@ def tmp_dir():
@pytest.fixture(scope="session")
-def _hash():
+def _hash() -> str:
"""
Create a hash for each test instance.
"""
@@ -47,7 +48,7 @@ def _hash():
@pytest.fixture(scope="session")
-def gee_dir(_hash):
+def gee_dir(_hash: str) -> Optional[Path]:
"""
Create a test dir based on earthengine initialization
populate it with fake super small assets:
@@ -131,6 +132,6 @@ def gee_dir(_hash):
@pytest.fixture
-def alert():
+def alert() -> sw.Alert:
"""return a dummy alert that can be used everywhere to display informations."""
return sw.Alert()
diff --git a/tests/test_FileInput.py b/tests/test_FileInput.py
index 6fbba7a8..089f519b 100644
--- a/tests/test_FileInput.py
+++ b/tests/test_FileInput.py
@@ -1,3 +1,7 @@
+from pathlib import Path
+from typing import List
+
+import ipyvuetify as v
import pytest
from traitlets import Any
@@ -119,20 +123,32 @@ class TestFileInput:
return
+ def test_root(self, file_input: sw.FileInput, root_dir: Path) -> None:
+ """Add a root folder to a file_input and check that you can't go higher"""
+
+ # set the root to the current folder and reload
+ file_input.root = str(root_dir)
+ file_input._on_reload()
+ first_title_item = file_input.get_children(klass=v.ListItemTitle)[0]
+
+ assert ".. /" not in first_title_item.children[0]
+
+ return
+
@pytest.fixture
- def file_input(self, root_dir):
+ def file_input(self, root_dir: Path) -> sw.FileInput:
"""create a default file_input in the root_dir."""
return sw.FileInput(folder=root_dir)
@pytest.fixture
- def readme(self, root_dir):
+ def readme(self, root_dir: Path) -> Path:
"""return the readme file path."""
return root_dir / "README.rst"
@staticmethod
- def get_names(widget):
+ def get_names(file_input: sw.FileInput) -> List[str]:
"""get the list name of a fileinput object."""
- item_list = widget.file_list.children[0].children
+ item_list = file_input.file_list.children[0].children
def get_name(item):
return item.children[1].children[0].children[0]
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
2.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-sugar pytest-icdiff pytest-deadfixtures Flake8-pyproject nbmake",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL",
"pip install localtileserver"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyio==3.7.1
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
flake8==7.2.0
Flake8-pyproject==1.2.3
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.2
GDAL==3.11.0
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
icdiff==2.0.7
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
nox==2025.2.9
numexpr==2.10.2
numpy==2.0.2
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a6
platformdirs==4.3.7
pluggy==1.5.0
pprintpp==0.4.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycodestyle==2.13.0
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
pyflakes==3.3.2
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest==8.3.5
pytest-cov==6.0.0
pytest-deadfixtures==2.2.1
pytest-icdiff==0.9
pytest-sugar==1.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@2576446debe3544f3edeb208c76f671ffc0c8650#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==3.1.3
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyio==3.7.1
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-timeout==5.0.1
- attrs==25.3.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-pyproject==1.2.3
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.2
- gdal==3.11.0
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- icdiff==2.0.7
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab-pygments==0.3.0
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mccabe==0.7.0
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- nox==2025.2.9
- numexpr==2.10.2
- numpy==2.0.2
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a6
- platformdirs==4.3.7
- pluggy==1.5.0
- pprintpp==0.4.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycodestyle==2.13.0
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pyflakes==3.3.2
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-deadfixtures==2.2.1
- pytest-icdiff==0.9
- pytest-sugar==1.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- sepal-ui==2.15.2
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.29.3
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- werkzeug==3.1.3
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_FileInput.py::TestFileInput::test_root"
] |
[] |
[
"tests/test_FileInput.py::TestFileInput::test_init",
"tests/test_FileInput.py::TestFileInput::test_bind",
"tests/test_FileInput.py::TestFileInput::test_on_file_select",
"tests/test_FileInput.py::TestFileInput::test_on_reload",
"tests/test_FileInput.py::TestFileInput::test_reset",
"tests/test_FileInput.py::TestFileInput::test_select_file"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-774
|
|
12rambau__sepal_ui-807
|
1c183817ccae604484ad04729288e7beb3451a64
|
2023-04-03 20:51:14
|
b91b2a2c45b4fa80a7a0c699df978ebc46682260
|
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 07f6d872..13defac5 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -52,6 +52,7 @@ extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
+ "sphinx.ext.todo",
"sphinx_favicon",
"notfound.extension",
"sphinxcontrib.autoprogram",
@@ -155,3 +156,6 @@ html_css_files = ["css/custom.css", "css/icon.css"]
autosummary_generate = True
autoclass_content = "both"
autodoc_typehints = "description"
+
+# -- Options for TODO ----------------------------------------------------------
+todo_include_todos = True
diff --git a/sepal_ui/mapping/__init__.py b/sepal_ui/mapping/__init__.py
index b668ab60..32e56a39 100644
--- a/sepal_ui/mapping/__init__.py
+++ b/sepal_ui/mapping/__init__.py
@@ -24,6 +24,7 @@ from .layer_state_control import *
from .layers_control import *
from .legend_control import *
from .map_btn import *
+from .marker_cluster import *
from .menu_control import *
from .sepal_map import *
from .zoom_control import *
diff --git a/sepal_ui/mapping/layers_control.py b/sepal_ui/mapping/layers_control.py
index 87550f91..a4efdec3 100644
--- a/sepal_ui/mapping/layers_control.py
+++ b/sepal_ui/mapping/layers_control.py
@@ -191,6 +191,9 @@ class LayersControl(MenuControl):
self.menu.open_on_hover = True
self.menu.close_delay = 200
+ # set the ize according to the content
+ self.set_size(None, None, None, None)
+
# update the table at instance creation
self.update_table({})
diff --git a/sepal_ui/mapping/marker_cluster.py b/sepal_ui/mapping/marker_cluster.py
new file mode 100644
index 00000000..2eb7978f
--- /dev/null
+++ b/sepal_ui/mapping/marker_cluster.py
@@ -0,0 +1,20 @@
+"""Custom implementation of the marker cluster to hide it at once."""
+
+from ipyleaflet import MarkerCluster
+from traitlets import Bool, observe
+
+
+class MarkerCluster(MarkerCluster):
+ """Overwrite the MarkerCluster to hide all the underlying cluster at once.
+
+ .. todo::
+ remove when https://github.com/jupyter-widgets/ipyleaflet/issues/1108 is solved
+ """
+
+ visible = Bool(True).tag(sync=True)
+
+ @observe("visible")
+ def toggle_markers(self, change):
+ """change the marker value according to the cluster viz."""
+ for marker in self.markers:
+ marker.visible = self.visible
|
create a custom marker cluster that can be hidden
currently the marker cluster cannot be hidden, only the underlying markers can.
I twould be good if it was possible to hide all the underlying markers at once by changin the visible trait of the marker_cluster itself
|
12rambau/sepal_ui
|
diff --git a/tests/test_mapping/test_MarkerCluster.py b/tests/test_mapping/test_MarkerCluster.py
new file mode 100644
index 00000000..532eee9f
--- /dev/null
+++ b/tests/test_mapping/test_MarkerCluster.py
@@ -0,0 +1,22 @@
+"""Test the MarkerCluster control."""
+from ipyleaflet import Marker
+
+from sepal_ui import mapping as sm
+
+
+def test_init() -> None:
+ """Init a MarkerCluster."""
+ marker_cluster = sm.MarkerCluster()
+ assert isinstance(marker_cluster, sm.MarkerCluster)
+
+ return
+
+
+def test_visible() -> None:
+ """Hide MarkerCluster."""
+ markers = [Marker(location=(0, 0)) for _ in range(3)]
+ marker_cluster = sm.MarkerCluster(markers=markers)
+
+ # check that the visibility trait is linked
+ marker_cluster.visible = False
+ assert all(m.visible is False for m in markers)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 3
}
|
2.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyio==3.7.1
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
async-timeout==5.0.1
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.2
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab==4.0.13
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
multidict==6.2.0
mypy==1.15.0
mypy-extensions==1.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.0.8
notebook_shim==0.2.4
nox==2025.2.9
numpy==2.0.2
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a6
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest==8.3.5
pytest-cov==6.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@1c183817ccae604484ad04729288e7beb3451a64#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
Unidecode==1.3.8
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyio==3.7.1
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- async-timeout==5.0.1
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.2
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter==1.1.1
- jupyter-client==8.6.3
- jupyter-console==6.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab==4.0.13
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- multidict==6.2.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.0.8
- notebook-shim==0.2.4
- nox==2025.2.9
- numpy==2.0.2
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a6
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pytest==8.3.5
- pytest-cov==6.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- sepal-ui==2.16.1
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- unidecode==1.3.8
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_mapping/test_MarkerCluster.py::test_init",
"tests/test_mapping/test_MarkerCluster.py::test_visible"
] |
[] |
[] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-814
|
6d825ae167f96ad2e7b76b96ca07de562f74dcf0
|
2023-04-11 07:43:35
|
b91b2a2c45b4fa80a7a0c699df978ebc46682260
|
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index 19718f51..8dafab92 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -108,14 +108,17 @@ class Alert(v.Alert, SepalWidget):
Args:
progress: the progress status in float
msg: The message to use before the progress bar
- tqdm_args (optional): any arguments supported by a tqdm progress bar
+ tqdm_args (optional): any arguments supported by a tqdm progress bar, they will only be taken into account after a call to ``self.reset()``.
"""
# show the alert
self.show()
- # cast the progress to float
- total = tqdm_args.get("total", 1)
+ # cast the progress to float and perform sanity checks
progress = float(progress)
+ if self.progress_output not in self.children:
+ total = tqdm_args.get("total", 1)
+ else:
+ total = self.progress_bar.total
if not (0 <= progress <= total):
raise ValueError(f"progress should be in [0, {total}], {progress} given")
|
avoid to force developer to set total each time
I should be able to init the progress of an Alert first and then simply update the progress.
as in:
```python
from sepal_ui import sepalwidgets as sw
alert = sw.Alert()
# init
alert.update_progress(0, "toto", total=10)
# loop
for i in range(10):
alert.update_progress(i)
```
in the current implemetnation, total need to be set in every calls
|
12rambau/sepal_ui
|
diff --git a/tests/test_sepalwidgets/test_Alert.py b/tests/test_sepalwidgets/test_Alert.py
index 3f8de9a4..cac14ebb 100644
--- a/tests/test_sepalwidgets/test_Alert.py
+++ b/tests/test_sepalwidgets/test_Alert.py
@@ -175,7 +175,8 @@ def test_update_progress() -> None:
# check that if total is set value can be more than 1
alert.reset()
- alert.update_progress(50, total=100)
+ alert.update_progress(0, total=100)
+ alert.update_progress(50)
assert alert.progress_bar.n == 50
assert alert.viz is True
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
2.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
anyascii==0.3.2
anyio==3.7.1
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
async-timeout==5.0.1
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.1
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.12.0
httpcore==0.15.0
httplib2==0.22.0
httpx==0.23.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab==4.0.13
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
multidict==6.2.0
mypy==1.15.0
mypy-extensions==1.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.0.8
notebook_shim==0.2.4
nox==2025.2.9
numpy==2.0.2
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.0a6
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986==1.5.0
rfc3986-validator==0.1.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@6d825ae167f96ad2e7b76b96ca07de562f74dcf0#egg=sepal_ui
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
toml==0.10.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
tzdata==2025.2
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- anyascii==0.3.2
- anyio==3.7.1
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- async-timeout==5.0.1
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.1
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.12.0
- httpcore==0.15.0
- httplib2==0.22.0
- httpx==0.23.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter==1.1.1
- jupyter-client==8.6.3
- jupyter-console==6.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab==4.0.13
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- multidict==6.2.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.0.8
- notebook-shim==0.2.4
- nox==2025.2.9
- numpy==2.0.2
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.0a6
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986==1.5.0
- rfc3986-validator==0.1.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- send2trash==1.8.3
- sepal-ui==2.16.2
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- toml==0.10.2
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- tzdata==2025.2
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_sepalwidgets/test_Alert.py::test_update_progress"
] |
[] |
[
"tests/test_sepalwidgets/test_Alert.py::test_init",
"tests/test_sepalwidgets/test_Alert.py::test_add_msg",
"tests/test_sepalwidgets/test_Alert.py::test_add_live_msg",
"tests/test_sepalwidgets/test_Alert.py::test_append_msg",
"tests/test_sepalwidgets/test_Alert.py::test_reset",
"tests/test_sepalwidgets/test_Alert.py::test_rmv_last_msg"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.12rambau_1776_sepal_ui-814
|
|
12rambau__sepal_ui-856
|
999deb0011f05d3e7ff94e04b517ac2919e38a59
|
2023-08-03 07:55:32
|
b91b2a2c45b4fa80a7a0c699df978ebc46682260
|
diff --git a/sepal_ui/message/en/decorator.json b/sepal_ui/message/en/decorator.json
new file mode 100644
index 00000000..80b1422a
--- /dev/null
+++ b/sepal_ui/message/en/decorator.json
@@ -0,0 +1,6 @@
+{
+ "decorator": {
+ "no_alert": "You should provide the `alert` argument as parent does not have one",
+ "no_button": "You should provide the `button` argument as parent does not have one"
+ }
+}
diff --git a/sepal_ui/scripts/decorator.py b/sepal_ui/scripts/decorator.py
index b28e59e3..eb0e228d 100644
--- a/sepal_ui/scripts/decorator.py
+++ b/sepal_ui/scripts/decorator.py
@@ -13,13 +13,15 @@ import warnings
from functools import wraps
from itertools import product
from pathlib import Path
-from typing import Any, Callable, List, Union
+from typing import Any, Callable, List, Optional
import ee
import httplib2
import ipyvuetify as v
from deprecated.sphinx import versionadded
+from sepal_ui.message import ms
+
# from sepal_ui.scripts.utils import init_ee
from sepal_ui.scripts.warning import SepalWarning
@@ -60,14 +62,14 @@ def init_ee() -> None:
@versionadded(version="3.0", reason="moved from utils to a dedicated module")
-def catch_errors(alert: v.Alert, debug: bool = False) -> Any:
+def catch_errors(alert: Optional[v.Alert] = None, debug: bool = False) -> Any:
"""Decorator to execute try/except sentence and catch errors in the alert message.
If debug is True then the error is raised anyway.
Args:
- alert (sw.Alert): Alert to display errors
- debug (bool): Whether to raise the error or not, default to false
+ alert: Alert to display errors
+ debug: Whether to raise the error or not, default to false
Returns:
The return statement of the decorated method
@@ -75,12 +77,20 @@ def catch_errors(alert: v.Alert, debug: bool = False) -> Any:
def decorator_alert_error(func):
@wraps(func)
- def wrapper_alert_error(*args, **kwargs):
+ def wrapper_alert_error(self, *args, **kwargs):
+
+ # Change name of variable to assign it again in this scope
+ # check if alert exist in the parent object if alert is not set manually
+ assert hasattr(self, "alert") or alert, ms.decorator.no_alert
+ alert_ = self.alert if not alert else alert
+ alert_.reset()
+
+ # try to execute the method
value = None
try:
- value = func(*args, **kwargs)
+ value = func(self, *args, **kwargs)
except Exception as e:
- alert.add_msg(f"{e}", type_="error")
+ alert_.add_msg(f"{e}", type_="error")
if debug:
raise e
return value
@@ -119,8 +129,8 @@ def need_ee(func: Callable) -> Any:
@versionadded(version="3.0", reason="moved from utils to a dedicated module")
def loading_button(
- alert: Union[v.Alert, None] = None,
- button: Union[v.Btn, None] = None,
+ alert: Optional[v.Alert] = None,
+ button: Optional[v.Btn] = None,
debug: bool = False,
) -> Any:
"""Decorator to execute try/except sentence and toggle loading button object.
@@ -142,6 +152,9 @@ def loading_button(
# set btn and alert
# Change name of variable to assign it again in this scope
+ # check if they exist in the parent object if alert is not set manually
+ assert hasattr(self, "alert") or alert, ms.decorator.no_alert
+ assert hasattr(self, "btn") or button, ms.decorator.no_button
button_ = self.btn if not button else button
alert_ = self.alert if not alert else alert
@@ -186,7 +199,7 @@ def loading_button(
[custom_showwarning(w) for w in w_list]
except Exception as e:
- alert_.add_msg(f"{e}", "error")
+ alert_.add_msg(f"{e}", type_="error")
if debug:
button_.toggle_loading() # Stop loading button if there is an error
raise e
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index b3f3056d..9c70a732 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -229,6 +229,7 @@ class Alert(v.Alert, SepalWidget):
"""Empty the messages and hide it."""
self.children = [""]
self.hide()
+ self.type = set_type("info")
return self
diff --git a/sepal_ui/sepalwidgets/app.py b/sepal_ui/sepalwidgets/app.py
index f9b09496..59f9f397 100644
--- a/sepal_ui/sepalwidgets/app.py
+++ b/sepal_ui/sepalwidgets/app.py
@@ -14,7 +14,7 @@ Example:
from datetime import datetime
from itertools import cycle
from pathlib import Path
-from typing import Dict, List, Optional, Union
+from typing import Dict, List, Optional
import ipyvuetify as v
import pandas as pd
@@ -248,7 +248,7 @@ class AppBar(v.AppBar, SepalWidget):
def __init__(
self,
title: str = "SEPAL module",
- translator: Union[None, Translator] = None,
+ translator: Optional[Translator] = None,
**kwargs,
) -> None:
"""Custom AppBar widget with the provided title using the sepal color framework.
@@ -316,7 +316,7 @@ class DrawerItem(v.ListItem, SepalWidget):
icon: str = "",
card: str = "",
href: str = "",
- model: Union[Model, None] = None,
+ model: Optional[Model] = None,
bind_var: str = "",
**kwargs,
) -> None:
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 9b7ddc2d..51638b69 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -220,7 +220,7 @@ class FileInput(v.Flex, SepalWidget):
extensions: List[str] = [],
folder: Union[str, Path] = Path.home(),
label: str = ms.widgets.fileinput.label,
- v_model: Union[str, None] = "",
+ v_model: str = "",
clearable: bool = False,
root: Union[str, Path] = "",
**kwargs,
diff --git a/sepal_ui/sepalwidgets/sepalwidget.py b/sepal_ui/sepalwidgets/sepalwidget.py
index 68ac405f..3d7d7273 100644
--- a/sepal_ui/sepalwidgets/sepalwidget.py
+++ b/sepal_ui/sepalwidgets/sepalwidget.py
@@ -12,13 +12,13 @@ Example:
"""
import warnings
-from typing import List, Optional, Union
+from typing import List, Optional, Type, Union
import ipyvuetify as v
import traitlets as t
from deprecated.sphinx import versionadded
from traitlets import observe
-from typing_extensions import Self, Type
+from typing_extensions import Self
__all__ = ["SepalWidget", "Tooltip"]
diff --git a/sepal_ui/sepalwidgets/tile.py b/sepal_ui/sepalwidgets/tile.py
index a70a4e52..97a6aeb9 100644
--- a/sepal_ui/sepalwidgets/tile.py
+++ b/sepal_ui/sepalwidgets/tile.py
@@ -41,8 +41,8 @@ class Tile(v.Layout, SepalWidget):
id_: str,
title: str,
inputs: list = [""],
- btn: Union[v.Btn, None] = None,
- alert: Union[v.Alert, None] = None,
+ btn: Optional[v.Btn] = None,
+ alert: Optional[v.Alert] = None,
**kwargs,
) -> None:
"""Custom Layout widget for the sepal UI framework.
diff --git a/sepal_ui/sepalwidgets/widget.py b/sepal_ui/sepalwidgets/widget.py
index affbd822..52fa1d2c 100644
--- a/sepal_ui/sepalwidgets/widget.py
+++ b/sepal_ui/sepalwidgets/widget.py
@@ -11,7 +11,7 @@ Example:
"""
from pathlib import Path
-from typing import Optional, Union
+from typing import Optional
import ipyvuetify as v
import traitlets as t
@@ -124,7 +124,7 @@ class StateIcon(Tooltip):
def __init__(
self,
- model: Union[None, Model] = None,
+ model: Optional[Model] = None,
model_trait: str = "",
states: dict = {},
**kwargs,
|
Use Optional instead of Union[None, ...]
Now that we don't support 3.7 any more, we should drop `typing_extentions` and stop using the Union[none, ...] pattern.
2 option are possible:
1. `none|...`
2. `Optional[...]`
I personnaly prefer 2.
|
12rambau/sepal_ui
|
diff --git a/tests/test_planetapi/test_PlanetModel.py b/tests/test_planetapi/test_PlanetModel.py
index c343f5e3..37da73da 100644
--- a/tests/test_planetapi/test_PlanetModel.py
+++ b/tests/test_planetapi/test_PlanetModel.py
@@ -1,12 +1,11 @@
"""Test the planet PlanetModel model."""
import os
-from typing import Union
+from typing import Any, Union
import planet
import pytest
from pytest import FixtureRequest
-from typing_extensions import Any
from sepal_ui.planetapi import PlanetModel
diff --git a/tests/test_scripts/test_decorator.py b/tests/test_scripts/test_decorator.py
index 356a7b66..f400c4b8 100644
--- a/tests/test_scripts/test_decorator.py
+++ b/tests/test_scripts/test_decorator.py
@@ -22,22 +22,38 @@ def test_init_ee() -> None:
def test_catch_errors() -> None:
"""Check the catch error decorator."""
+ # create an external alert to test the wiring
+ alert = sw.Alert()
+
# create a fake object that uses the decorator
class Obj:
def __init__(self):
self.alert = sw.Alert()
self.btn = sw.Btn()
- self.func1 = sd.catch_errors(alert=self.alert)(self.func)
- self.func2 = sd.catch_errors(alert=self.alert, debug=True)(self.func)
+ @sd.catch_errors()
+ def func0(self, *args):
+ return 1 / 0
- def func(self, *args):
+ @sd.catch_errors(alert=alert)
+ def func1(self, *args):
+ return 1 / 0
+
+ @sd.catch_errors(debug=True)
+ def func2(self, *args):
return 1 / 0
obj = Obj()
- obj.func1()
+ # should return an alert error in the the self alert widget
+ obj.func0()
assert obj.alert.type == "error"
+
+ # should return an alert in the external alert widget
+ obj.func1()
+ assert alert.type == "error"
+
+ # should raise an error
with pytest.raises(Exception):
obj.func2()
@@ -83,8 +99,8 @@ def test_loading_button() -> None:
obj.alert.reset()
with pytest.raises(Exception):
obj.fun2(obj.btn, None, None)
- assert obj.btn.disabled is False
- assert obj.alert.type == "error"
+ assert obj.btn.disabled is False
+ assert obj.alert.type == "error"
# should only display the sepal warning
obj.alert.reset()
@@ -98,13 +114,13 @@ def test_loading_button() -> None:
obj.alert.reset()
with warnings.catch_warnings(record=True) as w_list:
obj.func4(obj.btn, None, None)
- assert obj.btn.disabled is False
- assert obj.alert.type == "warning"
- assert "sepal" in obj.alert.children[1].children[0]
- assert "toto" not in obj.alert.children[1].children[0]
- msg_list = [w.message.args[0] for w in w_list]
- assert any("sepal" in s for s in msg_list)
- assert any("toto" in s for s in msg_list)
+ assert obj.btn.disabled is False
+ assert obj.alert.type == "warning"
+ assert "sepal" in obj.alert.children[1].children[0]
+ assert "toto" not in obj.alert.children[1].children[0]
+ msg_list = [w.message.args[0] for w in w_list]
+ assert any("sepal" in s for s in msg_list)
+ assert any("toto" in s for s in msg_list)
return
diff --git a/tests/test_sepalwidgets/test_Alert.py b/tests/test_sepalwidgets/test_Alert.py
index cac14ebb..171a152f 100644
--- a/tests/test_sepalwidgets/test_Alert.py
+++ b/tests/test_sepalwidgets/test_Alert.py
@@ -125,6 +125,7 @@ def test_reset() -> None:
assert alert.viz is False
assert len(alert.children) == 1
assert alert.children[0] == ""
+ assert alert.type == "info"
return
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 7
}
|
2.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyascii==0.3.2
anyio==4.9.0
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
async-timeout==5.0.1
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.2
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
mypy==1.15.0
mypy-extensions==1.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
nox==2025.2.9
numexpr==2.10.2
numpy==2.0.2
overrides==7.7.0
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.19.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest @ file:///croot/pytest_1738938843180/work
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@999deb0011f05d3e7ff94e04b517ac2919e38a59#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
toml==0.10.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
Werkzeug==3.1.3
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyascii==0.3.2
- anyio==4.9.0
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- async-timeout==5.0.1
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.2
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter==1.1.1
- jupyter-client==8.6.3
- jupyter-console==6.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- nox==2025.2.9
- numexpr==2.10.2
- numpy==2.0.2
- overrides==7.7.0
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.19.0
- platformdirs==4.3.7
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- sepal-ui==2.16.4
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- toml==0.10.2
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- uri-template==1.3.0
- uritemplate==4.1.1
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.29.3
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- werkzeug==3.1.3
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_scripts/test_decorator.py::test_catch_errors"
] |
[] |
[
"tests/test_scripts/test_decorator.py::test_loading_button",
"tests/test_scripts/test_decorator.py::test_switch",
"tests/test_sepalwidgets/test_Alert.py::test_init",
"tests/test_sepalwidgets/test_Alert.py::test_add_msg",
"tests/test_sepalwidgets/test_Alert.py::test_add_live_msg",
"tests/test_sepalwidgets/test_Alert.py::test_append_msg",
"tests/test_sepalwidgets/test_Alert.py::test_reset",
"tests/test_sepalwidgets/test_Alert.py::test_rmv_last_msg",
"tests/test_sepalwidgets/test_Alert.py::test_update_progress"
] |
[] |
MIT License
| null |
|
12rambau__sepal_ui-896
|
b91b2a2c45b4fa80a7a0c699df978ebc46682260
|
2023-10-07 12:43:59
|
b91b2a2c45b4fa80a7a0c699df978ebc46682260
|
diff --git a/sepal_ui/message/en/locale.json b/sepal_ui/message/en/locale.json
index abdea912..b65a232d 100644
--- a/sepal_ui/message/en/locale.json
+++ b/sepal_ui/message/en/locale.json
@@ -85,14 +85,17 @@
"exception": {
"empty": "Please fill the required field(s).",
"invalid": "Invalid email or password",
- "nosubs": "Your credentials do not have any valid planet subscription."
+ "nosubs": "Your credentials do not have any valid planet subscription.",
+ "no_secret_file": "The credentials file does not exist, use a different login method."
},
"widget": {
"username": "Planet username",
"password": "Planet password",
"apikey": "Planet API key",
+ "store": "Remember credentials file in the session.",
"method": {
"label": "Login method",
+ "from_file": "From saved credentials",
"credentials": "Credentials",
"api_key": "Planet API key"
}
diff --git a/sepal_ui/planetapi/planet_model.py b/sepal_ui/planetapi/planet_model.py
index 7aee2ed4..c3939499 100644
--- a/sepal_ui/planetapi/planet_model.py
+++ b/sepal_ui/planetapi/planet_model.py
@@ -6,8 +6,8 @@ from typing import Dict, List, Optional, Union
import nest_asyncio
import planet.data_filter as filters
-import requests
import traitlets as t
+from deprecated.sphinx import deprecated
from planet import DataClient
from planet.auth import Auth
from planet.exceptions import NoPermission
@@ -21,7 +21,6 @@ nest_asyncio.apply()
class PlanetModel(Model):
-
SUBS_URL: str = (
"https://api.planet.com/auth/v1/experimental/public/my/subscriptions"
)
@@ -56,11 +55,18 @@ class PlanetModel(Model):
if credentials:
self.init_session(credentials)
- def init_session(self, credentials: Union[str, List[str]]) -> None:
+ @deprecated(
+ version="3.0",
+ reason="credentials member is deprecated, use self.auth._key instead",
+ )
+ def init_session(
+ self, credentials: Union[str, List[str]], write_secrets: bool = False
+ ) -> None:
"""Initialize planet client with api key or credentials. It will handle errors.
Args:
- credentials: planet API key or username and password pair of planet explorer.
+ credentials: planet API key, username and password pair or a secrets planet.json file.
+ write_secrets: either to write the credentials in the secret file or not. Defaults to True.
"""
if isinstance(credentials, str):
credentials = [credentials]
@@ -70,13 +76,21 @@ class PlanetModel(Model):
if len(credentials) == 2:
self.auth = Auth.from_login(*credentials)
+
+ # Check if the str is a path to a secret file
+ elif len(credentials) == 1 and credentials[0].endswith(".json"):
+ self.auth = Auth.from_file(credentials[0])
+
else:
self.auth = Auth.from_key(credentials[0])
- self.credentials = credentials
+ self.credentials = self.auth._key
self.session = Session(auth=self.auth)
self._is_active()
+ if self.active and write_secrets:
+ self.auth.store()
+
return
def _is_active(self) -> None:
@@ -213,10 +227,11 @@ class PlanetModel(Model):
"quad_download": true
}
"""
- url = "https://api.planet.com/basemaps/v1/mosaics?api_key={}"
- res = requests.get(url.format(self.credentials[0]))
+ mosaics_url = "https://api.planet.com/basemaps/v1/mosaics"
+ request = self.session.request("GET", mosaics_url)
+ response = asyncio.run(request)
- return res.json().get("mosaics", [])
+ return response.json().get("mosaics", [])
def get_quad(self, mosaic: dict, quad_id: str) -> dict:
"""Get a quad response for a specific mosaic and quad.
@@ -245,10 +260,13 @@ class PlanetModel(Model):
"percent_covered": 100
}
"""
- url = "https://api.planet.com/basemaps/v1/mosaics/{}/quads/{}?api_key={}"
- res = requests.get(url.format(mosaic["id"], quad_id, self.credentials[0]))
+ quads_url = "https://api.planet.com/basemaps/v1/mosaics/{}/quads/{}"
+ quads_url = quads_url.format(mosaic["id"], quad_id)
+
+ request = self.session.request("GET", quads_url)
+ response = asyncio.run(request)
- return res.json() or {}
+ return response.json() or {}
@staticmethod
def search_status(d: dict) -> List[Dict[str, bool]]:
diff --git a/sepal_ui/planetapi/planet_view.py b/sepal_ui/planetapi/planet_view.py
index 1de11832..72f3d771 100644
--- a/sepal_ui/planetapi/planet_view.py
+++ b/sepal_ui/planetapi/planet_view.py
@@ -1,5 +1,6 @@
"""The ``Card`` widget to use in application to interface with Planet."""
+from pathlib import Path
from typing import Optional
import ipyvuetify as v
@@ -12,7 +13,6 @@ from sepal_ui.scripts.decorator import loading_button
class PlanetView(sw.Layout):
-
planet_model: Optional[PlanetModel] = None
"Backend model to manipulate interface actions"
@@ -47,7 +47,7 @@ class PlanetView(sw.Layout):
):
"""Stand-alone interface to capture planet lab credentials.
- It also validate its subscription and connect to the client stored in the model.
+ It also validate its subscription and connect to the client from_file in the model.
Args:
btn (sw.Btn, optional): Button to trigger the validation process in the associated model.
@@ -67,18 +67,27 @@ class PlanetView(sw.Layout):
)
self.w_password = sw.PasswordField(label=ms.planet.widget.password)
self.w_key = sw.PasswordField(label=ms.planet.widget.apikey, v_model="").hide()
+ self.w_secret_file = sw.TextField(
+ label=ms.planet.widget.store,
+ v_model=str(Path.home() / ".planet.json"),
+ readonly=True,
+ class_="mr-2",
+ ).hide()
self.w_info_view = InfoView(model=self.planet_model)
self.w_method = v.Select(
label=ms.planet.widget.method.label,
class_="mr-2",
- v_model="credentials",
+ v_model="",
items=[
+ {"value": "from_file", "text": ms.planet.widget.method.from_file},
{"value": "credentials", "text": ms.planet.widget.method.credentials},
{"value": "api_key", "text": ms.planet.widget.method.api_key},
],
)
+ self.w_store = sw.Checkbox(label=ms.planet.widget.store, v_model=True)
+
w_validation = v.Flex(
style_="flex-grow: 0 !important;",
children=[self.btn],
@@ -87,17 +96,22 @@ class PlanetView(sw.Layout):
self.children = [
self.w_method,
sw.Layout(
+ attributes={"id": "planet_credentials"},
class_="align-center",
children=[
self.w_username,
self.w_password,
self.w_key,
+ self.w_secret_file,
],
),
+ self.w_store,
]
if not btn:
- self.children[-1].set_children(w_validation, "last")
+ self.get_children(attr="id", value="planet_credentials")[0].set_children(
+ w_validation, "last"
+ )
# Set it here to avoid displacements when using button
self.set_children(self.w_info_view, "last")
@@ -108,36 +122,82 @@ class PlanetView(sw.Layout):
self.w_method.observe(self._swap_inputs, "v_model")
self.btn.on_event("click", self.validate)
+ self.set_initial_method()
+
+ def validate_secret_file(self) -> None:
+ """Validate the secret file path."""
+ if not Path(self.w_secret_file.v_model).exists():
+ self.w_secret_file.error_messages = [ms.planet.exception.no_secret_file]
+ return False
+
+ self.w_secret_file.error_messages = []
+ return True
+
+ def set_initial_method(self) -> None:
+ """Set the initial method to connect to planet lab."""
+ self.w_method.v_model = (
+ "from_file" if self.validate_secret_file() else "credentials"
+ )
+
def reset(self) -> None:
"""Empty credentials fields and restart activation mode."""
- self.w_username.v_model = None
- self.w_password.v_model = None
- self.w_key.v_model = None
+ self.w_username.v_model = ""
+ self.w_password.v_model = ""
+ self.w_key.v_model = ""
self.planet_model.__init__()
return
def _swap_inputs(self, change: dict) -> None:
- """Swap between credentials and api key inputs."""
+ """Swap between credentials and api key inputs.
+
+ Args:
+ change.new: values of from_file, credentials, api_key
+ """
self.alert.reset()
self.reset()
- self.w_username.toggle_viz()
- self.w_password.toggle_viz()
- self.w_key.toggle_viz()
+ # small detail, but validate the file every time the method is changed
+ self.validate_secret_file()
+
+ if change["new"] == "credentials":
+ self.w_username.show()
+ self.w_password.show()
+ self.w_secret_file.hide()
+ self.w_store.show()
+ self.w_key.hide()
+
+ elif change["new"] == "api_key":
+ self.w_username.hide()
+ self.w_password.hide()
+ self.w_secret_file.hide()
+ self.w_store.show()
+ self.w_key.show()
+ else:
+ self.w_username.hide()
+ self.w_password.hide()
+ self.w_key.hide()
+ self.w_store.hide()
+ self.w_secret_file.show()
return
- @loading_button(debug=True)
+ @loading_button()
def validate(self, *args) -> None:
"""Initialize planet client and validate if is active."""
self.planet_model.__init__()
if self.w_method.v_model == "credentials":
credentials = [self.w_username.v_model, self.w_password.v_model]
+
+ elif self.w_method.v_model == "api_key":
+ credentials = self.w_key.v_model
+
else:
- credentials = [self.w_key.v_model]
+ if not self.validate_secret_file():
+ raise Exception(ms.planet.exception.no_secret_file)
+ credentials = self.w_secret_file.v_model
- self.planet_model.init_session(credentials)
+ self.planet_model.init_session(credentials, write_secrets=self.w_store.v_model)
return
|
get_mosaics from planet api fails
`get_mosaics` --and probably-- `get_quads` fails when the authentication process is done `from_login`... test has been passed because we are only testing the initialization of the `Planet` `from_key` but not to get elements from it
|
12rambau/sepal_ui
|
diff --git a/tests/test_planetapi/test_PlanetModel.py b/tests/test_planetapi/test_PlanetModel.py
index 68450a05..3741c62f 100644
--- a/tests/test_planetapi/test_PlanetModel.py
+++ b/tests/test_planetapi/test_PlanetModel.py
@@ -1,6 +1,7 @@
"""Test the planet PlanetModel model."""
import os
+from pathlib import Path
from typing import Any, Union
import planet
@@ -42,7 +43,7 @@ def test_init(planet_key: str, cred: list) -> None:
@pytest.mark.skipif("PLANET_API_KEY" not in os.environ, reason="requires Planet")
@pytest.mark.parametrize("credentials", ["planet_key", "cred"])
def test_init_client(credentials: Any, request: FixtureRequest) -> None:
- """Check init the client with 2 methods.
+ """Check init the client with 3 methods.
Args:
credentials: any credentials as set in the parameters
@@ -53,16 +54,66 @@ def test_init_client(credentials: Any, request: FixtureRequest) -> None:
planet_model.init_session(request.getfixturevalue(credentials))
assert planet_model.active is True
- # check the content of cred
- # I use a proxy to avoid exposing the credentials in the logs
- cred = request.getfixturevalue(credentials)
- cred = [cred] if isinstance(cred, str) else cred
- is_same = planet_model.credentials == cred
- assert is_same is True, "The credentials are not corresponding"
+ assert (
+ planet_model.auth._key == planet_model.credentials
+ ), "The credentials are not corresponding"
with pytest.raises(Exception):
planet_model.init_session("wrongkey")
+ with pytest.raises(Exception):
+ planet_model.init_session(["wrongkey", "credentials"])
+
+ return
+
+
[email protected]("PLANET_API_KEY" not in os.environ, reason="requires Planet")
+def test_init_with_file(planet_key) -> None:
+ """Check init the session from a file."""
+ planet_secret_file = Path.home() / ".planet.json"
+ existing = False
+
+ # This test will overwrite and remove the file, let's backup it
+ if planet_secret_file.exists():
+ existing = True
+ planet_secret_file.rename(planet_secret_file.with_suffix(".json.bak"))
+
+ # Create a file with the credentials
+ planet_model = PlanetModel()
+ # We assume that the credentials are valid
+ planet_model.init_session(planet_key, write_secrets=True)
+
+ assert planet_secret_file.exists()
+
+ # test init with the file
+ planet_model = PlanetModel()
+ planet_model.init_session(str(planet_secret_file))
+
+ assert planet_model.active is True
+
+ # Check that wrong credentials won't save the secrets file
+
+ # remove the file
+ planet_secret_file.unlink()
+
+ planet_model = PlanetModel()
+
+ with pytest.raises(Exception):
+ planet_model.init_session("wrong_key", write_secrets=True)
+
+ assert not planet_secret_file.exists()
+
+ # Check no save with good credentials
+
+ planet_model = PlanetModel()
+ planet_model.init_session(planet_key, write_secrets=False)
+
+ assert not planet_secret_file.exists()
+
+ # restore the file
+ if existing:
+ planet_secret_file.with_suffix(".json.bak").rename(planet_secret_file)
+
return
diff --git a/tests/test_planetapi/test_PlanetView.py b/tests/test_planetapi/test_PlanetView.py
index c700fe3f..1d0b39cc 100644
--- a/tests/test_planetapi/test_PlanetView.py
+++ b/tests/test_planetapi/test_PlanetView.py
@@ -2,11 +2,13 @@
import json
import os
+from pathlib import Path
import pytest
from sepal_ui import sepalwidgets as sw
-from sepal_ui.planetapi import PlanetView
+from sepal_ui.message import ms
+from sepal_ui.planetapi import PlanetModel, PlanetView
@pytest.mark.skipif("PLANET_API_KEY" not in os.environ, reason="requires Planet")
@@ -40,16 +42,27 @@ def test_reset() -> None:
# reset the view
planet_view.reset()
- assert planet_view.w_username.v_model is None
- assert planet_view.w_password.v_model is None
- assert planet_view.w_key.v_model is None
+ assert planet_view.w_username.v_model == ""
+ assert planet_view.w_password.v_model == ""
+ assert planet_view.w_key.v_model == ""
# use a default method
- default_method = "credentials"
- assert planet_view.w_method.v_model == default_method
- assert planet_view.w_username.viz is True
- assert planet_view.w_password.viz is True
- assert planet_view.w_key.viz is False
+ # Default method will be from_file if the secrets file exists
+ default_method = (
+ "from_file" if (Path.home() / ".planet.json").exists() else "credentials"
+ )
+ if default_method == "credentials":
+ assert planet_view.w_method.v_model == default_method
+ assert planet_view.w_username.viz is True
+ assert planet_view.w_password.viz is True
+ assert planet_view.w_key.viz is False
+ assert planet_view.w_secret_file.viz is False
+ else:
+ assert planet_view.w_method.v_model == default_method
+ assert planet_view.w_username.viz is False
+ assert planet_view.w_password.viz is False
+ assert planet_view.w_key.viz is False
+ assert planet_view.w_secret_file.viz is True
# change the method
planet_view.w_method.v_model = "api_key"
@@ -57,6 +70,7 @@ def test_reset() -> None:
assert planet_view.w_username.viz is False
assert planet_view.w_password.viz is False
assert planet_view.w_key.viz is True
+ assert planet_view.w_secret_file.viz is False
return
@@ -83,3 +97,66 @@ def test_validate() -> None:
assert planet_view.planet_model.active is True
return
+
+
[email protected]("PLANET_API_KEY" not in os.environ, reason="requires Planet")
+def test_validate_secret_file(planet_key) -> None:
+ """Test validation view method of the secret file."""
+ # Arrange
+ planet_secret_file = Path.home() / ".planet.json"
+
+ # Test with existing file
+ # Create a secrets file
+ planet_model = PlanetModel()
+ planet_model.init_session(planet_key, write_secrets=True)
+
+ planet_view = PlanetView()
+ planet_view.validate_secret_file()
+
+ assert planet_view.w_secret_file.error_messages == []
+
+ # Also validate with the event
+ planet_view.btn.fire_event("click", None)
+
+ # Test with non-existing file
+
+ # Create a backup of the file
+ planet_secret_file.rename(planet_secret_file.with_suffix(".json.bak"))
+
+ planet_view.validate_secret_file()
+
+ assert planet_view.w_secret_file.error_messages == [
+ ms.planet.exception.no_secret_file
+ ]
+
+ # Restore the file
+ planet_secret_file.with_suffix(".json.bak").rename(planet_secret_file)
+
+
+def test_validate_event() -> None:
+ """Test validation button event."""
+ # Arrange
+ planet_secret_file = Path.home() / ".planet.json"
+ exists = False
+
+ # if the file exists, rename it
+ if planet_secret_file.exists():
+ exists = True
+ planet_secret_file.rename(planet_secret_file.with_suffix(".json.bak"))
+
+ # Arrange
+ planet_view = PlanetView()
+
+ planet_view.w_method.v_model = "from_file"
+
+ # Act
+ planet_view.btn.fire_event("click", None)
+
+ # Assert
+ assert planet_view.alert.children[0].children == [
+ ms.planet.exception.no_secret_file
+ ]
+
+ # Restore if there was a file
+ if exists:
+ planet_secret_file.with_suffix(".json.bak").rename(planet_secret_file)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 3
}
|
2.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-sugar",
"pytest-icdiff",
"pytest-cov",
"pytest-deadfixtures",
"Flake8-pyproject",
"nbmake",
"pytest-regressions"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
affine==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aniso8601==10.0.0
annotated-types==0.7.0
anyascii==0.3.2
anyio==4.9.0
argcomplete==3.5.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
async-timeout==5.0.1
attrs==25.3.0
babel==2.17.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
branca==0.8.1
cachelib==0.13.0
cachetools==5.5.2
cattrs==24.1.3
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.1.1
color-operations==0.2.0
colorama==0.4.6
colorlog==6.9.0
comm==0.2.2
commitizen==4.4.1
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dask==2024.8.0
debugpy==1.8.13
decli==0.6.2
decorator==5.2.1
defusedxml==0.7.1
dependency-groups==1.3.0
Deprecated==1.2.18
distlib==0.3.9
docopt==0.6.2
earthengine-api==1.5.8
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
flake8==7.2.0
Flake8-pyproject==1.2.3
Flask==3.1.0
Flask-Caching==2.3.1
flask-cors==5.0.1
flask-restx==1.3.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
fsspec==2025.3.2
geojson==3.2.0
geopandas==1.0.1
google-api-core==2.24.2
google-api-python-client==2.166.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
h11==0.14.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
icdiff==2.0.7
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipyleaflet==0.19.2
ipython==8.12.3
ipyvue==1.11.2
ipyvuetify==1.11.1
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-leaflet==0.19.2
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
localtileserver==0.10.6
locket==1.0.0
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==3.1.3
morecantile==6.2.0
multidict==6.2.0
mypy==1.15.0
mypy-extensions==1.0.0
natsort==8.4.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbmake==1.5.5
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.3
notebook_shim==0.2.4
nox==2025.2.9
numexpr==2.10.2
numpy==2.0.2
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pipreqs==0.5.0
planet==2.19.0
platformdirs==4.3.7
pluggy==1.5.0
pprintpp==0.4.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
proto-plus==1.26.1
protobuf==6.30.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycodestyle==2.13.0
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
pyflakes==3.3.2
pygadm==0.5.3
pygaul==0.3.4
Pygments==2.19.1
PyJWT==2.10.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pystac==1.10.1
pytest==8.3.5
pytest-cov==6.0.0
pytest-datadir==1.6.1
pytest-deadfixtures==2.2.1
pytest-icdiff==0.9
pytest-regressions==2.7.0
pytest-sugar==1.0.0
python-box==7.3.2
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
questionary==2.1.0
rasterio==1.4.3
referencing==0.36.2
requests==2.32.3
requests-cache==1.2.1
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rio-cogeo==5.4.1
rio-tiler==7.5.1
rioxarray==0.15.0
rpds-py==0.24.0
rsa==4.9
scooby==0.10.0
Send2Trash==1.8.3
-e git+https://github.com/12rambau/sepal_ui.git@b91b2a2c45b4fa80a7a0c699df978ebc46682260#egg=sepal_ui
server-thread==0.3.0
shapely==2.0.7
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
termcolor==2.5.0
terminado==0.18.1
tinycss2==1.4.0
tomli==2.2.1
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
tzdata==2025.2
uri-template==1.3.0
uritemplate==4.1.1
url-normalize==2.2.0
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.30.0
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
Werkzeug==3.1.3
widgetsnbextension==4.0.13
wrapt==1.17.2
xarray==2024.7.0
xyzservices==2025.1.0
yarg==0.1.9
yarl==1.18.3
zipp==3.21.0
|
name: sepal_ui
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- affine==2.4.0
- aiohappyeyeballs==2.6.1
- aiohttp==3.11.14
- aiosignal==1.3.2
- aniso8601==10.0.0
- annotated-types==0.7.0
- anyascii==0.3.2
- anyio==4.9.0
- argcomplete==3.5.3
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==3.0.0
- async-lru==2.0.5
- async-timeout==5.0.1
- attrs==25.3.0
- babel==2.17.0
- backcall==0.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- blinker==1.9.0
- branca==0.8.1
- cachelib==0.13.0
- cachetools==5.5.2
- cattrs==24.1.3
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==8.1.8
- click-plugins==1.1.1
- cligj==0.7.2
- cloudpickle==3.1.1
- color-operations==0.2.0
- colorama==0.4.6
- colorlog==6.9.0
- comm==0.2.2
- commitizen==4.4.1
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dask==2024.8.0
- debugpy==1.8.13
- decli==0.6.2
- decorator==5.2.1
- defusedxml==0.7.1
- dependency-groups==1.3.0
- deprecated==1.2.18
- distlib==0.3.9
- docopt==0.6.2
- earthengine-api==1.5.8
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-pyproject==1.2.3
- flask==3.1.0
- flask-caching==2.3.1
- flask-cors==5.0.1
- flask-restx==1.3.0
- fonttools==4.56.0
- fqdn==1.5.1
- frozenlist==1.5.0
- fsspec==2025.3.2
- geojson==3.2.0
- geopandas==1.0.1
- google-api-core==2.24.2
- google-api-python-client==2.166.0
- google-auth==2.38.0
- google-auth-httplib2==0.2.0
- google-cloud-core==2.4.3
- google-cloud-storage==3.1.0
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- h11==0.14.0
- httpcore==1.0.7
- httplib2==0.22.0
- httpx==0.28.1
- icdiff==2.0.7
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipyleaflet==0.19.2
- ipython==8.12.3
- ipyvue==1.11.2
- ipyvuetify==1.11.1
- ipywidgets==8.1.5
- isoduration==20.11.0
- itsdangerous==2.2.0
- jedi==0.19.2
- jinja2==3.1.6
- json5==0.10.0
- jsonpointer==3.0.0
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter==1.1.1
- jupyter-client==8.6.3
- jupyter-console==6.6.3
- jupyter-core==5.7.2
- jupyter-events==0.12.0
- jupyter-leaflet==0.19.2
- jupyter-lsp==2.2.5
- jupyter-server==2.15.0
- jupyter-server-proxy==4.4.0
- jupyter-server-terminals==0.5.3
- jupyterlab==4.3.6
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==3.0.13
- kiwisolver==1.4.7
- localtileserver==0.10.6
- locket==1.0.0
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mccabe==0.7.0
- mistune==3.1.3
- morecantile==6.2.0
- multidict==6.2.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- natsort==8.4.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbmake==1.5.5
- nest-asyncio==1.6.0
- nodeenv==1.9.1
- notebook==7.3.3
- notebook-shim==0.2.4
- nox==2025.2.9
- numexpr==2.10.2
- numpy==2.0.2
- overrides==7.7.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- partd==1.4.2
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==11.1.0
- pipreqs==0.5.0
- planet==2.19.0
- platformdirs==4.3.7
- pluggy==1.5.0
- pprintpp==0.4.0
- pre-commit==4.2.0
- prometheus-client==0.21.1
- prompt-toolkit==3.0.50
- propcache==0.3.1
- proto-plus==1.26.1
- protobuf==6.30.2
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==19.0.1
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycodestyle==2.13.0
- pycparser==2.22
- pydantic==2.11.1
- pydantic-core==2.33.0
- pyflakes==3.3.2
- pygadm==0.5.3
- pygaul==0.3.4
- pygments==2.19.1
- pyjwt==2.10.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pystac==1.10.1
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-datadir==1.6.1
- pytest-deadfixtures==2.2.1
- pytest-icdiff==0.9
- pytest-regressions==2.7.0
- pytest-sugar==1.0.0
- python-box==7.3.2
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- questionary==2.1.0
- rasterio==1.4.3
- referencing==0.36.2
- requests==2.32.3
- requests-cache==1.2.1
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rio-cogeo==5.4.1
- rio-tiler==7.5.1
- rioxarray==0.15.0
- rpds-py==0.24.0
- rsa==4.9
- scooby==0.10.0
- send2trash==1.8.3
- sepal-ui==2.16.4
- server-thread==0.3.0
- shapely==2.0.7
- simpervisor==1.0.0
- six==1.17.0
- sniffio==1.3.1
- soupsieve==2.6
- stack-data==0.6.3
- termcolor==2.5.0
- terminado==0.18.1
- tinycss2==1.4.0
- tomli==2.2.1
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- tqdm==4.67.1
- traitlets==5.14.3
- traittypes==0.2.1
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- typing-inspection==0.4.0
- tzdata==2025.2
- uri-template==1.3.0
- uritemplate==4.1.1
- url-normalize==2.2.0
- urllib3==2.3.0
- uvicorn==0.34.0
- virtualenv==20.30.0
- voila==0.5.8
- wcwidth==0.2.13
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- websockets==15.0.1
- werkzeug==3.1.3
- widgetsnbextension==4.0.13
- wrapt==1.17.2
- xarray==2024.7.0
- xyzservices==2025.1.0
- yarg==0.1.9
- yarl==1.18.3
- zipp==3.21.0
prefix: /opt/conda/envs/sepal_ui
|
[
"tests/test_planetapi/test_PlanetView.py::test_validate_event"
] |
[] |
[] |
[] |
MIT License
| null |
|
139bercy__pypel-78
|
92fc416b197c73156d83579d2e439698d171e09d
|
2021-09-08 14:40:05
|
92fc416b197c73156d83579d2e439698d171e09d
|
diff --git a/Makefile b/Makefile
index b31b86f..7619a79 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-.PHONY: report local_elastic
+.PHONY: report test_cli
report:
- pytest --cov=. --html=tests/reports/report.html --cov-report html -W error tests/
+ pytest --cov=. --html=tests/reports/report.html --cov-report html -W error tests/ -vv
ci:
pytest --cov=. -W error tests/
diff --git a/README.md b/README.md
index cac0a61..66e0eeb 100644
--- a/README.md
+++ b/README.md
@@ -19,19 +19,32 @@ PYPEL (PYthon Pipeline into ELasticsearch) is a customizable ETL (Extract / Tran
- What if my usecase slightly differs from that ?
The Extract/Transform/Load parts are separated, and you can modify each one independantly to fit your usecase.
-## API descrption
-All functionalities are available through the pypel.Process class:
+## API summary
+All functionalities are available through the pypel.processes.Process class:
- - instantiate your Process : `process = pypel.Process()`
+ - instantiate your Process : `process = pypel.processes.Process()`
- extract data : `df = process.extract(file_path)`
- transform data : `df = process.transform(df)`
- load data : `process.load(df, es_indice, es_instance)`
es_indice is the elasticsearch indice you wanna load into, es_instance is an elasticsearch connection : `es = elasticserach.Elasticsearch(ip, ...)`
- for conveniance, a wrap-up function exists that bundles all 3 operations in one : `process.process(file_path, es_indice, es_instance)`
-The Process constructor takes optional Extractor, Transformer & Loader arguments. These must derive from their pypel-class.
+The Process constructor takes optional Extractor, Transformer & Loader arguments. These must derive from their BaseClass.
+
+4 subpackages are made accessible for customization :
+ - extractors are located in `pypel.extractors`
+ - transformers in `pypel.transformers`
+ - loaders in `pypel.loaders`
+ - processes in `pypel.processes`
+
+For options, detailed usage and/or functionalities please refer to the docstrings.
+
+### In-depth API usage
+All custom extractors, transformers and loaders MUST be derived from their respective BaseClass, e.g `BaseTransformer`
+
+The `Process` class exists for conveniance only. Complex use-cases can (and probably should) ignore it completely, but
+the cli currently only instanciates & executes `Process`es.
-For options, detailed usage and/or functionalities please refer to the documentation
### Loading from the command line
Pypel allows generating & loading from the command line by executing `pypel/main.py`.
@@ -44,7 +57,8 @@ For a `--config-file` example, see `pypel/conf_template.json`.
Only json config files are currently supported.
## Tests
-Move to the project's root directory `pypel` then run `make`. This generates html reports for easier reading.
+Move to the project's root directory `pypel` then run `make`. This generates html reports for easier reading, located
+at: `./tests/reports/report.html` & `./tests/reports/coverage/index.html` for coverage details.
To try loading from a config file, start a local elasticsearch then run `make test_cli`. The test is successful if
the recipe executed without failure AND the indices `pypel_bulk_MM_DD`, `pypel_bulk_2_MM_DD`, `pypel_change_indice_MM_DD`
diff --git a/conf_template.json b/conf_template.json
index 57b75a9..33c05a7 100644
--- a/conf_template.json
+++ b/conf_template.json
@@ -2,14 +2,15 @@
"Processes": [
{
"name": "EXAMPLE",
- "Extractor": {
- "name": "pypel.Extractor"
+ "Extractors": {
+ "name": "pypel.extractors.Extractor"
},
- "Transformers": {
- "name": "pypel.Transformer"
- },
- "Loader": {
- "name": "pypel.Loader",
+ "Transformers": [
+ {
+ "name": "pypel.transformers.Transformer"
+ }],
+ "Loaders": {
+ "name": "pypel.loaders.Loader",
"backup": false,
"name_export": null,
"dont_append_date": false,
@@ -19,19 +20,19 @@
},
{
"name": "ANOTHER_EXAMPLE",
- "Extractor": {
- "name": "pypel.Extractor"
+ "Extractors": {
+ "name": "pypel.extractors.Extractor"
},
"Transformers": [
{
- "name": "pypel.Transformer"
+ "name": "pypel.transformers.Transformer"
},
{
- "name":"pypel.ColumnStripperTransformer"
+ "name":"pypel.transformers.ColumnStripperTransformer"
}
],
"Loader": {
- "name": "pypel.Loader"
+ "name": "pypel.transformers.Loader"
},
"indice": "pypel_bulk_2"
}
diff --git a/pypel/processes/ProcessFactory.py b/pypel/ProcessFactory.py
similarity index 98%
rename from pypel/processes/ProcessFactory.py
rename to pypel/ProcessFactory.py
index 6dbc942..e010243 100644
--- a/pypel/processes/ProcessFactory.py
+++ b/pypel/ProcessFactory.py
@@ -1,5 +1,5 @@
import importlib
-from pypel.processes.Process import Process
+from pypel.processes import Process
from typing import Optional, Dict, TypedDict, Union, List
from elasticsearch import Elasticsearch
diff --git a/pypel/__init__.py b/pypel/__init__.py
index 3e6764a..a6fa67c 100644
--- a/pypel/__init__.py
+++ b/pypel/__init__.py
@@ -1,16 +1,15 @@
-from pypel.processes.Process import Process
-from pypel.processes.ProcessFactory import ProcessFactory
-from pypel.transformers.Transformer import Transformer, BaseTransformer, ColumnStripperTransformer
-from pypel.loaders.Loader import Loader, BaseLoader
-from pypel.extractors.Extractor import Extractor
+import pypel.processes as processes
+from pypel.ProcessFactory import ProcessFactory
+import pypel.transformers as transformers
+import pypel.loaders as loaders
+import pypel.extractors as extractors
from pypel.main import process_from_config
from pypel.utils.elk.init_index import *
from pypel.utils.elk.clean_index import *
from pypel._config.config import set_config, get_config
-__all__ = ["Process", "ProcessFactory", "process_from_config", "init_index", "clean_index", "BaseTransformer", "Loader",
- "Transformer", "Extractor", "logger", "set_config", "get_config", "BaseTransformer",
- "ColumnStripperTransformer"]
+__all__ = ["processes", "ProcessFactory", "process_from_config", "init_index", "clean_index", "extractors",
+ "loaders", "logger", "set_config", "get_config"]
import logging
diff --git a/pypel/extractors/Extractor.py b/pypel/extractors/Extractor.py
deleted file mode 100644
index 6b59768..0000000
--- a/pypel/extractors/Extractor.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import pandas as pd
-import re
-import openpyxl
-from pypel.utils.utils import arrayer
-import warnings
-import logging
-from pypel._config.config import get_config
-from typing import Dict, Optional, List, Union
-
-logger = logging.getLogger(__name__)
-logger.setLevel(getattr(logging, get_config()["LOGS_LEVEL"]))
-
-
-class Extractor:
- """
- Encapsulates all the extracting, getting data logic.
- """
-
- def extract(self, file_path: Union[str, bytes],
- converters: Optional[Dict[str, type]] = None,
- dates: Optional[List[str]] = False,
- sheet_name: Union[None, int, str, List[Union[int, str]]] = 0,
- skiprows: Optional[int] = None, **kwargs):
- """
- Read the passed file and return it as a dataframe.
- Uses many pandas parameters defined at Extractor instanciation.
-
- :param file_path: absolute path to the file
- :param converters:
- cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
- :param dates: this is equivalent to pandas' `parse_dates` in
- [read_excel](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
- :param sheet_name:
- cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
- :param skiprows:
- cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
- :param kwargs: additional pandas args
- :return: pandas.Dataframe object
- """
- if file_path.endswith(".csv"):
- if get_config()["LOGS"]:
- with open(file_path) as file:
- row_count = sum(1 for row in file)
- file_name = re.findall(r"(?<=/)[^/]*$", file_path)[0]
- logger.debug(f"{row_count} rows (including header)"
- f"detected in the csv {file_name}")
- return pd.read_csv(file_path,
- converters=converters,
- parse_dates=dates,
- **kwargs)
- elif file_path.endswith(".xlsx"):
- if get_config()["LOGS"]:
- wb = openpyxl.load_workbook(filename=file_path)
- if sheet_name != 0:
- sheet = wb[sheet_name]
- else:
- sheet = wb[wb.sheetnames[0]]
- sheet_name = sheet.title
- excel_rows = sheet.max_row
- try:
- file_name = re.findall(r"(?<=/)[.\s\w_-]+$", file_path)[0]
- except IndexError:
- warnings.warn(f"Could not get file name from file path :"
- f"{file_path}")
- file_name = "ERROR"
- logger.debug(f"{excel_rows} rows in the excel sheet \'{sheet_name}\' from file \'{file_name}\'")
- if skiprows is not None:
- skiprows = arrayer(skiprows)
- return pd.read_excel(io=file_path,
- skiprows=skiprows,
- sheet_name=sheet_name,
- converters=converters,
- **kwargs)
- elif file_path.endswith(".xls"):
- if get_config()["LOGS"]:
- logger.debug(f"Targeting file \'{file_path}\'")
- if skiprows is not None:
- skiprows = arrayer(skiprows)
- return pd.read_excel(io=file_path,
- skiprows=skiprows,
- sheet_name=sheet_name,
- converters=converters,
- engine="xlrd",
- **kwargs)
- else:
- raise ValueError("File has unsupported file extension")
diff --git a/pypel/extractors/Extractors.py b/pypel/extractors/Extractors.py
new file mode 100644
index 0000000..a87a530
--- /dev/null
+++ b/pypel/extractors/Extractors.py
@@ -0,0 +1,203 @@
+import abc
+import pandas as pd
+import re
+import openpyxl
+from pypel.utils.utils import arrayer
+import warnings
+import logging
+from pypel._config.config import get_config
+from typing import Dict, Optional, List, Union, Any
+
+logger = logging.getLogger(__name__)
+logger.setLevel(getattr(logging, get_config()["LOGS_LEVEL"]))
+
+
+class BaseExtractor:
+ @abc.abstractmethod
+ def extract(self, *args, **kwargs) -> Any:
+ """This method must be implemented"""
+
+
+class Extractor(BaseExtractor):
+ """
+ Encapsulates all the extracting, getting data logic.
+ """
+ def extract(self, file_path: Union[str, bytes],
+ converters: Optional[Dict[str, type]] = None,
+ dates: Optional[List[str]] = False,
+ sheet_name: Union[None, int, str, List[Union[int, str]]] = 0,
+ skiprows: Optional[int] = None, **kwargs) -> pd.DataFrame:
+ """
+ Read the passed file and return it as a dataframe.
+ Uses many pandas parameters defined at Extractor instanciation.
+
+ :param file_path: absolute path to the file
+ :param converters:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param dates: this is equivalent to pandas' `parse_dates` in
+ [read_excel](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param sheet_name:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param skiprows:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param kwargs: additional pandas args
+ :return: pandas.Dataframe object
+ """
+ if file_path.endswith(".csv"):
+ if get_config()["LOGS"]:
+ with open(file_path) as file:
+ row_count = sum(1 for row in file)
+ file_name = re.findall(r"(?<=/)[^/]*$", file_path)[0]
+ logger.debug(f"{row_count} rows (including header)"
+ f"detected in the csv {file_name}")
+ return pd.read_csv(file_path,
+ converters=converters,
+ parse_dates=dates,
+ **kwargs)
+ elif file_path.endswith(".xlsx"):
+ if get_config()["LOGS"]:
+ wb = openpyxl.load_workbook(filename=file_path)
+ if sheet_name != 0:
+ sheet = wb[sheet_name]
+ else:
+ sheet = wb[wb.sheetnames[0]]
+ sheet_name = sheet.title
+ excel_rows = sheet.max_row
+ try:
+ file_name = re.findall(r"(?<=/)[.\s\w_-]+$", file_path)[0]
+ except IndexError:
+ warnings.warn(f"Could not get file name from file path :"
+ f"{file_path}")
+ file_name = "ERROR"
+ logger.debug(f"{excel_rows} rows in the excel sheet \'{sheet_name}\' from file \'{file_name}\'")
+ if skiprows is not None:
+ skiprows = arrayer(skiprows)
+ return pd.read_excel(io=file_path,
+ skiprows=skiprows,
+ sheet_name=sheet_name,
+ converters=converters,
+ **kwargs)
+ elif file_path.endswith(".xls"):
+ if get_config()["LOGS"]:
+ logger.debug(f"Targeting file \'{file_path}\'")
+ if skiprows is not None:
+ skiprows = arrayer(skiprows)
+ return pd.read_excel(io=file_path,
+ skiprows=skiprows,
+ sheet_name=sheet_name,
+ converters=converters,
+ engine="xlrd",
+ **kwargs)
+ else:
+ raise ValueError("File has unsupported file extension")
+
+
+class CSVExtractor(BaseExtractor):
+ def extract(self, file_path: Union[str, bytes],
+ converters: Optional[Dict[str, type]] = None,
+ dates: Optional[List[str]] = False,
+ skiprows: Optional[int] = None, **kwargs) -> pd.DataFrame:
+ """
+ Read the passed file and return it as a dataframe.
+ Uses many pandas parameters defined at Extractor instanciation.
+
+ :param file_path: absolute path to the file
+ :param converters:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param dates: this is equivalent to pandas' `parse_dates` in
+ [read_excel](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param skiprows:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param kwargs: additional pandas args
+ :return: pandas.Dataframe object
+ """
+ if get_config()["LOGS"]:
+ with open(file_path) as file:
+ row_count = sum(1 for row in file)
+ file_name = re.findall(r"(?<=/)[^/]*$", file_path)[0]
+ logger.debug(f"{row_count} rows (including header)"
+ f"detected in the csv {file_name}")
+ return pd.read_csv(file_path,
+ converters=converters,
+ parse_dates=dates,
+ **kwargs)
+
+
+class XLSExtractor(BaseExtractor):
+ def extract(self, file_path: Union[str, bytes],
+ converters: Optional[Dict[str, type]] = None,
+ dates: Optional[List[str]] = False,
+ sheet_name: Union[None, int, str, List[Union[int, str]]] = 0,
+ skiprows: Optional[int] = None, **kwargs) -> pd.DataFrame:
+ """
+ Read the passed file and return it as a dataframe.
+ Uses many pandas parameters defined at Extractor instanciation.
+
+ :param file_path: absolute path to the file
+ :param converters:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param dates: this is equivalent to pandas' `parse_dates` in
+ [read_excel](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param sheet_name:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param skiprows:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param kwargs: additional pandas args
+ :return: pandas.Dataframe object
+ """
+ if get_config()["LOGS"]:
+ logger.debug(f"Targeting file \'{file_path}\'")
+ if skiprows is not None:
+ skiprows = arrayer(skiprows)
+ return pd.read_excel(io=file_path,
+ skiprows=skiprows,
+ sheet_name=sheet_name,
+ converters=converters,
+ engine="xlrd",
+ **kwargs)
+
+
+class XLSXExtractor(BaseExtractor):
+ def extract(self, file_path: Union[str, bytes],
+ converters: Optional[Dict[str, type]] = None,
+ dates: Optional[List[str]] = False,
+ sheet_name: Union[None, int, str, List[Union[int, str]]] = 0,
+ skiprows: Optional[int] = None, **kwargs) -> pd.DataFrame:
+ """
+ Read the passed file and return it as a dataframe.
+ Uses many pandas parameters defined at Extractor instanciation.
+
+ :param file_path: absolute path to the file
+ :param converters:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param dates: this is equivalent to pandas' `parse_dates` in
+ [read_excel](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param sheet_name:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param skiprows:
+ cf [pandas' doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html)
+ :param kwargs: additional pandas args
+ :return: pandas.Dataframe object
+ """
+ if get_config()["LOGS"]:
+ wb = openpyxl.load_workbook(filename=file_path)
+ if sheet_name != 0:
+ sheet = wb[sheet_name]
+ else:
+ sheet = wb[wb.sheetnames[0]]
+ sheet_name = sheet.title
+ excel_rows = sheet.max_row
+ try:
+ file_name = re.findall(r"(?<=/)[.\s\w_-]+$", file_path)[0]
+ except IndexError:
+ warnings.warn(f"Could not get file name from file path :"
+ f"{file_path}")
+ file_name = "ERROR"
+ logger.debug(f"{excel_rows} rows in the excel sheet \'{sheet_name}\' from file \'{file_name}\'")
+ if skiprows is not None:
+ skiprows = arrayer(skiprows)
+ return pd.read_excel(io=file_path,
+ skiprows=skiprows,
+ sheet_name=sheet_name,
+ converters=converters,
+ **kwargs)
diff --git a/pypel/extractors/__init__.py b/pypel/extractors/__init__.py
new file mode 100644
index 0000000..cf1e9d1
--- /dev/null
+++ b/pypel/extractors/__init__.py
@@ -0,0 +1,4 @@
+from .Extractors import BaseExtractor, Extractor, XLSExtractor, XLSXExtractor, CSVExtractor
+
+
+__all__ = ["BaseExtractor", "Extractor", "XLSExtractor", "XLSXExtractor", "CSVExtractor"]
diff --git a/pypel/loaders/Loader.py b/pypel/loaders/Loaders.py
similarity index 96%
rename from pypel/loaders/Loader.py
rename to pypel/loaders/Loaders.py
index a4bddea..1fe646e 100644
--- a/pypel/loaders/Loader.py
+++ b/pypel/loaders/Loaders.py
@@ -18,18 +18,13 @@ class Action(TypedDict):
_source: Any
-class BaseLoader(abc.ABC):
+class BaseLoader:
"""Dummy class that all Loaders should inherit from."""
@abc.abstractmethod
- def load(self, *args, **kwargs):
+ def load(self, *args, **kwargs) -> Any:
"""This method must be implemented"""
-class EmptyLoader(BaseLoader):
- def load(self, *args, **kwargs):
- """This loader does nothing."""
-
-
class Loader(BaseLoader):
"""
Encapsulates all the loading logic.
@@ -46,7 +41,7 @@ class Loader(BaseLoader):
path_to_export_folder: Union[None, str, bytes, os.PathLike] = None,
backup: bool = False,
name_export: Optional[str] = None,
- dont_append_date: bool = False):
+ dont_append_date: bool = False) -> None:
if backup:
if path_to_export_folder is None:
raise ValueError("No export folder passed but backup set to true !")
@@ -155,7 +150,7 @@ class CSVWriter(BaseLoader):
"""
Loader that saves the dataframe in a csv file
"""
- def load(self, dataframe: pd.DataFrame, path: os.PathLike, **kwargs):
+ def load(self, dataframe: pd.DataFrame, path: os.PathLike, **kwargs) -> None:
"""
Saves `dataframe` into the csv `path`
diff --git a/pypel/loaders/__init__.py b/pypel/loaders/__init__.py
new file mode 100644
index 0000000..a4d1925
--- /dev/null
+++ b/pypel/loaders/__init__.py
@@ -0,0 +1,4 @@
+from .Loaders import BaseLoader, Loader, CSVWriter
+
+
+__all__ = ["BaseLoader", "Loader", "CSVWriter"]
diff --git a/pypel/main.py b/pypel/main.py
index 242e271..9d1d273 100644
--- a/pypel/main.py
+++ b/pypel/main.py
@@ -1,15 +1,15 @@
import json
import os
import pathlib
-import warnings
+import sys
import elasticsearch
import argparse
import ssl
-from pypel.processes.ProcessFactory import ProcessFactory
+from pypel.ProcessFactory import ProcessFactory
# import pypel.utils.elk.clean_index as clean_index
# import pypel.utils.elk.init_index as init_index
import logging.handlers
-from typing import List, Dict, TypedDict, Union
+from typing import List, Dict, TypedDict, Union, Optional
logger = logging.getLogger(__name__)
@@ -26,14 +26,14 @@ class ProcessConfig(ProcessConfigMandatory):
class Config(TypedDict):
- Process: List[ProcessConfig]
+ Processes: List[ProcessConfig]
def select_process_from_config(es_: elasticsearch.Elasticsearch,
processes: Config,
process: str,
- files: pathlib.Path,
- indice: Union[None, str]):
+ files: Union[pathlib.Path, str],
+ indice: Optional[str]):
"""
Given a pair of configurations (global & process configuration `conf`and mapping configuration
`mappings`), load all processes related to `process`, or all of them if `process` is omitted in to the Elasticsearch
@@ -49,18 +49,23 @@ def select_process_from_config(es_: elasticsearch.Elasticsearch,
if processes is None:
raise ValueError("key 'Processes' not found in the passed config, no idea what to do.")
else:
- assert isinstance(processes, list)
+ try:
+ assert isinstance(processes, list)
+ except AssertionError as e_:
+ raise ValueError("Processes is not a list, please encapsulate Processes inside a list even if you only "
+ "have a single Process") from e_
if process == "all":
for proc in processes:
process_from_config(es_, proc, files, indice)
else:
- if process in [conf["name"] for conf in processes]:
- process_from_config(es_, [conf for conf in processes if conf["name"] == process][0], files, indice)
+ if process in [conf.get("name") for conf in processes]:
+ process_from_config(es_, [conf for conf in processes if conf.get("name") == process][0], files, indice)
else:
raise ValueError(f"process {process} not found in the configuration file !")
-def process_from_config(es_, process, files, indice):
+def process_from_config(es_: elasticsearch.Elasticsearch, process: ProcessConfig, files: Union[pathlib.Path, str],
+ indice: Optional[str]):
"""
Instantiate the process from its passed configuration, and execute it on passed file or directory
@@ -71,31 +76,34 @@ def process_from_config(es_, process, files, indice):
:return: None
"""
if indice:
- _indice = indice
+ indice_ = indice
else:
- _indice = process["indice"]
+ indice_ = process["indice"]
processor = ProcessFactory().create_process(process, es_)
if os.path.isdir(files):
file_paths = [os.path.join(files, f_).__str__() for f_ in os.listdir(files)]
- bulk_op = {indice: file_paths}
+ bulk_op = {indice_: file_paths}
processor.bulk(bulk_op)
+ elif os.path.isfile(files):
+ processor.process(files, indice_, es_)
else:
- processor.process(files, _indice, es_)
+ raise FileNotFoundError(f"Could not find file {files}")
-def get_args():
+def get_args(args_):
"""Return the process concerned - in case it's specified at the command line."""
parser = argparse.ArgumentParser(description='Process the type of Process')
+ parser.add_argument("-f", "--source-path", type=str, help="path to the file or directory to load from",
+ required=True)
parser.add_argument("-c", "--config-file", default="./conf/config.json", type=str,
help="get the path to the config file to load from")
- parser.add_argument("-f", "--source-path", type=str, help="path to the file or directory to load from")
# TODO: should that be a pypel functionnality ?
# parser.add_argument("-c", "--clean", default=False, type=str, help="should elasticsearch indices be cleared")
# parser.add_argument("-m", "--mapping", default="./conf/index_mappings.json", type=pathlib.Path,
# help="path to the elasticsearch indices's mappings")
parser.add_argument("-p", "--process", default="all", help="specify the process(es) to execute")
parser.add_argument("-i", "--indice", default=None, help="specify the indice to load into")
- return parser.parse_args()
+ return parser.parse_args(args_)
def get_es_instance(conf):
@@ -122,7 +130,7 @@ def get_es_instance(conf):
if __name__ == "__main__": # pragma: no cover
- args = get_args()
+ args = get_args(sys.argv[1:])
for arg in args.__dict__:
logger.debug(arg, args.__getattribute__(arg))
path_to_conf = os.path.join(os.getcwd(), args.config_file)
@@ -144,5 +152,5 @@ if __name__ == "__main__": # pragma: no cover
clean_index.clean_index(mappings, es_index_client)
init_index.init_index(mappings, es_index_client)
"""
- logger.debug(config["Processes"])
- select_process_from_config(es, config["Processes"], args.process, args.source_path, args.indice)
+ logger.debug(config.get("Processes"))
+ select_process_from_config(es, config.get("Processes"), args.process, args.source_path, args.indice)
diff --git a/pypel/processes/Process.py b/pypel/processes/Processes.py
similarity index 88%
rename from pypel/processes/Process.py
rename to pypel/processes/Processes.py
index 1c6e38c..0dec29e 100644
--- a/pypel/processes/Process.py
+++ b/pypel/processes/Processes.py
@@ -1,7 +1,7 @@
import os
-from pypel.extractors.Extractor import Extractor
-from pypel.transformers.Transformer import Transformer, BaseTransformer
-from pypel.loaders.Loader import Loader, BaseLoader
+from pypel.extractors.Extractors import BaseExtractor, CSVExtractor
+from pypel.transformers.Transformers import Transformer, BaseTransformer
+from pypel.loaders.Loaders import Loader, BaseLoader
from elasticsearch import Elasticsearch
import warnings
from typing import Dict, List, Union, Optional
@@ -14,14 +14,14 @@ class Process:
Parameters
----------
- :param extractor: pypel.Extractor
+ :param extractor: Optional[pypel.extractors.Extractor]
instance or class to use for extracting data. MUST be derived from pypel.Extractor
- :param transformer: pypel.Transformer
+ :param transformer: Union[pypel.BaseTransformer, type, List[pypel.transformers.BaseTransformers], None]
instance, class or list of instances to use for transforming data.
MUST be derived from pypel.Transformer, for lists, all elements of the list must inherit from pypel.Transformer.
if list-like, will be for-in looped on, so mind the order.
- :param loader: pypel.Loader
+ :param loader: Union[pypel.loaders.BaseLoader, type, None]
class to use for loading data. MUST be derived from pypel.Loader
Examples
@@ -29,24 +29,24 @@ class Process:
Instanciate the default Process
>>> import pypel
- >>> my_process = Process()
+ >>> my_process = pypel.processes.Process()
Instanciate a Process with a custom Extractor (same logic applies for custom Transformers/Loaders)
- >>> class MyExtractor(pypel.Extractor):
+ >>> class MyExtractor(pypel.extractors.Extractor):
... pass
>>> my_extractor_instance = MyExtractor()
- >>> my_process2 = pypel.Process(extractor=my_extractor_instance)
+ >>> my_process2 = pypel.processes.Process(extractor=my_extractor_instance)
"""
def __init__(self,
- extractor: Extractor = None,
- transformer: Union[Transformer, type, List[Transformer]] = None,
+ extractor: Optional[BaseExtractor] = None,
+ transformer: Union[BaseTransformer, type, List[BaseTransformer], None] = None,
loader: Union[Loader, type, None] = None):
- self.extractor = extractor if extractor is not None else Extractor()
+ self.extractor = extractor if extractor is not None else CSVExtractor()
self.transformer = transformer if transformer is not None else Transformer
self.loader = loader if loader is not None else Loader
try:
- assert isinstance(self.extractor, Extractor)
+ assert isinstance(self.extractor, BaseExtractor)
except AssertionError as e:
raise ValueError("Bad extractor") from e
try:
@@ -163,7 +163,7 @@ class Process:
=======
Example
- >>> process = Process(Extractor(), Transformer(), Loader())
+ >>> process = Process(CSVExtractor(), Transformer(), Loader())
>>> myconf = {"covid_stats.csv": "covid", "relance.xls": "relance", "obscure_name.xlsx": "id7654"}
>>> process.bulk(myconf)
Equivalent to
@@ -182,7 +182,7 @@ class Process:
except AssertionError:
err = ""
if not self.__transformer_is_instanced:
- err = f"Transformer"
+ err = "Transformer"
if not self.__loader_is_instanced:
if err:
err = f"{err}, Loader"
diff --git a/pypel/processes/__init__.py b/pypel/processes/__init__.py
new file mode 100644
index 0000000..ed7b6e1
--- /dev/null
+++ b/pypel/processes/__init__.py
@@ -0,0 +1,4 @@
+from .Processes import Process
+
+
+__all__ = ["Process"]
diff --git a/pypel/transformers/Transformer.py b/pypel/transformers/Transformers.py
similarity index 92%
rename from pypel/transformers/Transformer.py
rename to pypel/transformers/Transformers.py
index 05bc127..257d356 100644
--- a/pypel/transformers/Transformer.py
+++ b/pypel/transformers/Transformers.py
@@ -1,16 +1,16 @@
import os
-from pypel.extractors.Extractor import Extractor
+from pypel.extractors.Extractors import Extractor
import warnings
from typing import List, Dict, Optional, Any, Union
-from pandas import DataFrame, to_datetime
+from pandas import DataFrame, to_datetime, NA
import abc
-class BaseTransformer(abc.ABC):
+class BaseTransformer:
"""Dummy class that all Transformers must inherit from."""
@abc.abstractmethod
- def transform(self, *args, **kwargs) -> DataFrame:
+ def transform(self, *args, **kwargs) -> Any:
"""This method must be implemented"""
@@ -160,28 +160,28 @@ class Transformer(BaseTransformer):
class ColumnStripperTransformer(BaseTransformer):
"""Strips column names, removing trailing and leading whitespaces."""
- def transform(self, df: DataFrame):
- return df.columns.astype(str).str.strip()
+ def transform(self, df: DataFrame) -> DataFrame:
+ return df.rename(columns=str.strip)
class ColumnReplacerTransformer(BaseTransformer):
"""Allows replacing column names."""
- def transform(self, df: DataFrame, column_replace_dict: Dict[str, str]):
- return df.columns.to_series().replace(column_replace_dict, regex=True)
+ def transform(self, df: DataFrame, column_replace_dict: Dict[str, str]) -> DataFrame:
+ return df.rename(columns=column_replace_dict)
-class ColumnCapitaliser(BaseTransformer):
+class ColumnCapitaliserTransformer(BaseTransformer):
"""Capitalizes column names."""
- def transform(self, df: DataFrame):
- return df.columns.to_series().astype(str).str.capitalize()
+ def transform(self, df: DataFrame) -> DataFrame:
+ return df.rename(columns=str.capitalize)
-class ColumnContenStripper(BaseTransformer):
+class ColumnContenStripperTransformer(BaseTransformer):
"""Strips/trims the contents of a column. Said column(s) must contain only str values."""
- def transform(self, df: DataFrame, columns_to_strip: List[str]):
+ def transform(self, df: DataFrame, columns_to_strip: List[str]) -> DataFrame:
df_ = df.copy()
for column in columns_to_strip:
try:
@@ -196,25 +196,25 @@ class ColumnContenStripper(BaseTransformer):
class ContentReplacerTransformer(BaseTransformer):
"""Allows replacing contents of a column"""
- def transform(self, df: DataFrame, replace_dict: Dict[Any, Any]):
+ def transform(self, df: DataFrame, replace_dict: Dict[Any, Any]) -> DataFrame:
return df.replace(replace_dict, regex=True)
class NullValuesReplacerTransformer(BaseTransformer):
"""Replaces NaNs, NaTs or similar values by None, because None is understood by elasticsearc where nans arent."""
- def transform(self, df: DataFrame):
+ def transform(self, df: DataFrame) -> DataFrame:
"""
We use x != x because we want to check for both NaN & NaT at the same time, also any value that do pass this
check should probably be taken care of anyway.
"""
- return df.applymap(lambda x: None if x != x else x)
+ return df.applymap(lambda x: None if x is NA or x != x else x)
class DateFormatterTransformer(BaseTransformer):
"""Allows changing the date format of specific datetime columns"""
- def transform(self, df: DataFrame, date_columns: List[str], date_format="%Y-%m-%d"):
+ def transform(self, df: DataFrame, date_columns: List[str], date_format="%Y-%m-%d") -> DataFrame:
"""
:param df: the dataframe to modify
:param date_columns: the columns containing the datetime values to modify
@@ -226,7 +226,7 @@ class DateFormatterTransformer(BaseTransformer):
try:
df_[col] = df_[col].dt.strftime(date_format)
except AttributeError as e:
- raise ValueError(f"Column {col} has non-datetime values, the columns to format must be datetimes."
+ raise ValueError(f"Column {col} has non-datetime values, the columns to format must be datetimes. "
f"Please parse beforehands.") from e
return df_
@@ -234,7 +234,7 @@ class DateFormatterTransformer(BaseTransformer):
class DateParserTransformer(BaseTransformer):
"""Converts passed columns' values to datetime objects. Date parsing is prefered at extraction."""
- def transform(self, df: DataFrame, date_columns: List[str], date_format: str = "%Y-%m-%d"):
+ def transform(self, df: DataFrame, date_columns: List[str], date_format: str = "%Y-%m-%d") -> DataFrame:
"""
:param df: the dataframe containing the columns to parse
diff --git a/pypel/transformers/__init__.py b/pypel/transformers/__init__.py
new file mode 100644
index 0000000..fc98144
--- /dev/null
+++ b/pypel/transformers/__init__.py
@@ -0,0 +1,8 @@
+from .Transformers import (BaseTransformer, Transformer, ColumnStripperTransformer, ColumnReplacerTransformer,
+ ContentReplacerTransformer, ColumnCapitaliserTransformer, ColumnContenStripperTransformer,
+ NullValuesReplacerTransformer, DateParserTransformer, DateFormatterTransformer,
+ MergerTransformer)
+
+__all__ = ["BaseTransformer", "Transformer", "ColumnReplacerTransformer", "ColumnCapitaliserTransformer",
+ "ColumnStripperTransformer", "ColumnContenStripperTransformer", "ContentReplacerTransformer",
+ "NullValuesReplacerTransformer", "DateFormatterTransformer", "DateParserTransformer", "MergerTransformer"]
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 8d0a49f..e810536 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -7,3 +7,4 @@ xlrd>=2.0.0
pytest
pytest-cov
pytest-html
+pytest-mock
diff --git a/setup.py b/setup.py
index 0161bc1..8c048b6 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name='pypel',
- version='0.7.1',
+ version='0.9.0',
description="Python Pipeline into Elasticsearch",
packages=find_packages(exclude=('tests', 'docs', "docker", "Doc"), where="."),
author="Quentin Dimarellis",
|
Add tests for all Loaders & Transformers
Transformers implemented in #71 are not test covered. Neither is the CSVWriter loader.
|
139bercy/pypel
|
diff --git a/tests/__init__.py b/tests/__init__.py
index faa4ca5..9c5125e 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,1 +1,2 @@
-# obligé de la rajouter si on veut tester avec la commande "pytest" sinon il irra chercher les import dans le dossier d'instalation de pytest
\ No newline at end of file
+# obligé de la rajouter si on veut tester avec la commande "pytest"
+# sinon il ira chercher les import dans le dossier d'instalation de pytest
diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py
new file mode 100644
index 0000000..324e744
--- /dev/null
+++ b/tests/integration/test_cli.py
@@ -0,0 +1,209 @@
+import elasticsearch
+import pytest
+import pypel.processes
+import ssl
+import os
+from pypel.main import get_args, select_process_from_config, process_from_config, get_es_instance
+
+
[email protected]
+def process_config():
+ return {
+ "Extractors": {
+ "name": "pypel.extractors.Extractor"
+ },
+ "Transformers": [{
+ "name": "pypel.transformers.Transformer"
+ }],
+ "Loaders": {
+ "name": "pypel.loaders.Loader",
+ },
+ "indice": "my_indice"
+ }
+
+
[email protected]
+def processes_config():
+ return [{
+ "name": "EXAMPLE",
+ "Extractors": {
+ "name": "pypel.extractors.Extractor"
+ },
+ "Transformers": [
+ {
+ "name": "pypel.transformers.ColumnStripperTransformer"
+ }
+ ],
+ "Loaders": {
+ "name": "pypel.loaders.Loader"
+ },
+ "indice": "pypel_bulk"
+ },
+ {
+ "name": "ANOTHER_EXAMPLE",
+ "Extractors": {
+ "name": "pypel.extractors.Extractor"
+ },
+ "Transformers": [{
+ "name": "pypel.transformers.Transformer"
+ }],
+ "Loaders": {
+ "name": "pypel.loaders.Loader"
+ },
+ "indice": "pypel_bulk_2"
+ }]
+
+
+def mock_ssl_context(cafile):
+ return {"name": cafile}
+
+
+class TestGetArgs:
+ def test_raises_if_file_not_specified(self):
+ with pytest.raises(SystemExit):
+ get_args([])
+
+ def test_process(self):
+ key = "process"
+ expected = "MyProcess"
+ actual = get_args(["-p", "MyProcess", "-f", "/f"]).__getattribute__(key)
+ assert expected == actual
+
+ def test_indice(self):
+ key = "indice"
+ expected = "my_indice"
+ actual = get_args(["-i", "my_indice", "-f", "/f"]).__getattribute__(key)
+ assert expected == actual
+
+ def test_source_path(self):
+ key = "source_path"
+ expected = "/home/user/data.csv"
+ actual = get_args(["-f", "/home/user/data.csv"]).__getattribute__(key)
+ assert expected == actual
+
+ def test_config_file(self):
+ key = "config_file"
+ expected = "/home/user/pypel/config_template.json"
+ actual = get_args(["-c", "/home/user/pypel/config_template.json", "-f", "/f"]).__getattribute__(key)
+ assert expected == actual
+
+ def test_defaults(self):
+ expected = {
+ "source_path": "/home/user/data.csv",
+ "config_file": "./conf/config.json",
+ "process": "all",
+ "indice": None}
+ actual = get_args(["-f", "/home/user/data.csv"])
+ for key in actual.__dict__:
+ assert actual.__getattribute__(key) == expected[key]
+
+ def test_all_params(self):
+ expected = {
+ "source_path": "/file",
+ "config_file": "/home/user/pypel_conf.json",
+ "process": "MYPROCESS",
+ "indice": "indice"}
+ actual = get_args(["-f", "/file", "-i", "indice", "-c", "/home/user/pypel_conf.json", "-p", "MYPROCESS"])
+ for key in actual.__dict__:
+ assert actual.__getattribute__(key) == expected[key]
+
+
+class TestGetESInstance:
+ def test_no_authentication(self, monkeypatch):
+ def assert_es_instanciation_called_with(hosts, http_auth, use_ssl=False, scheme=None, port=8080,
+ ssl_context=None):
+ assert hosts == "localhost"
+ assert http_auth is None
+ monkeypatch.setattr(elasticsearch, "Elasticsearch", assert_es_instanciation_called_with)
+ get_es_instance({})
+
+ def test_authentication_no_cafile(self, monkeypatch):
+ def assert_es_instanciation_called_with(hosts, http_auth, use_ssl=False, scheme=None, port=8080,
+ ssl_context=None):
+ assert hosts == "localhost"
+ assert http_auth == ("user", "my_pwd")
+
+ monkeypatch.setattr(elasticsearch, "Elasticsearch", assert_es_instanciation_called_with)
+ get_es_instance({"user": "user", "pwd": "my_pwd"})
+
+ def test_cafile(self, monkeypatch):
+ def assert_es_instanciation_called_with(hosts, http_auth, use_ssl=False, scheme=None, port=8080,
+ ssl_context=None):
+ assert hosts == "1.12.4.2"
+ assert http_auth == ("elastic", "changeme")
+ assert use_ssl is True
+ assert scheme == "https"
+ assert port == 8080
+ assert ssl_context == {"name": "fake_cafile_content"}
+
+ monkeypatch.setattr(elasticsearch, "Elasticsearch", assert_es_instanciation_called_with)
+ monkeypatch.setattr(ssl, "create_default_context", mock_ssl_context)
+ get_es_instance({"user": "elastic", "pwd": "changeme", "host": "1.12.4.2", "scheme": "https", "port": 8080,
+ "cafile": "fake_cafile_content"})
+
+
+class TestProcessFromConfig:
+ def test_raises_if_non_existant_file(self, process_config, es_instance):
+ with pytest.raises(FileNotFoundError, match="Could not find file /i_do_not_exist"):
+ process_from_config(es_instance, process_config, "/i_do_not_exist", None)
+
+ def test_single_file(self, monkeypatch, process_config, es_instance):
+ def process_assert_called_with(_, file_path, indice, instance):
+ assert file_path == "./tests/fake_data/test_init_df.csv"
+ assert indice == "my_indice"
+ assert instance is es_instance
+
+ monkeypatch.setattr(pypel.processes.Process, "process", process_assert_called_with)
+ process_from_config(es_instance, process_config, "./tests/fake_data/test_init_df.csv", None)
+
+ def test_with_cl_indice(self, monkeypatch, process_config, es_instance):
+ def process_assert_called_with(_, file_path, indice, instance):
+ assert file_path == "./tests/fake_data/test_init_df.csv"
+ assert indice == "indice"
+ assert instance is es_instance
+
+ monkeypatch.setattr(pypel.processes.Process, "process", process_assert_called_with)
+ process_from_config(es_instance, process_config, "./tests/fake_data/test_init_df.csv", "indice")
+
+ def test_directory(self, monkeypatch, process_config, es_instance):
+ def bulk_assert_called_with(_, dic):
+ assert dic == {
+ "my_indice": [os.path.join("./tests/fake_data/", file) for file in os.listdir("./tests/fake_data/")]}
+
+ monkeypatch.setattr(pypel.processes.Process, "bulk", bulk_assert_called_with)
+ process_from_config(es_instance, process_config, "./tests/fake_data/", None)
+
+
+class TestSelectProcessFromConfig:
+ def test_raises_if_processes_not_found(self, es_instance):
+ with pytest.raises(ValueError, match="key 'Processes' not found in the passed config, no idea what to do."):
+ select_process_from_config(es_instance, None, None, None, None)
+
+ def test_raises_if_processes_not_a_list(self, es_instance):
+ with pytest.raises(ValueError,
+ match="Processes is not a list, please encapsulate Processes inside a list even if you only "
+ "have a single Process"):
+ select_process_from_config(es_instance, {}, None, None, None)
+
+ def test_raises_if_process_not_in_processes(self, es_instance, processes_config):
+ with pytest.raises(ValueError, match="process DOESNOTEXIST not found in the configuration file !"):
+ select_process_from_config(es_instance, processes_config, "DOESNOTEXIST", "/file", None)
+
+ def test_single_process(self, es_instance, monkeypatch, processes_config):
+ def process_from_conf_assert_called_with(es, proc, file, indice):
+ assert es == es_instance
+ assert proc == processes_config[0]
+ assert file == "/file"
+ assert indice is None
+
+ monkeypatch.setattr(pypel.main, "process_from_config", process_from_conf_assert_called_with)
+ select_process_from_config(es_instance, processes_config, "EXAMPLE", "/file", None)
+
+ def test_multiple_processes(self, es_instance, mocker, processes_config):
+ mocker.patch('pypel.main.process_from_config')
+ select_process_from_config(es_instance, processes_config, "all", "/file", None)
+ assert pypel.main.process_from_config.call_count == 2
+ # TODO: fix the assert_has_calls logic
+ # calls = [call(es_instance, proc, "/files", None) for proc in processes_config]
+ # print("mock_calls", pypel.main.process_from_config.mock_calls)
+ # pypel.main.process_from_config.assert_has_calls(calls)
diff --git a/tests/integration/test_factory.py b/tests/integration/test_factory.py
index 2e2ec4a..9bd0734 100644
--- a/tests/integration/test_factory.py
+++ b/tests/integration/test_factory.py
@@ -9,24 +9,24 @@ def factory():
class TestFactory:
def test_factory_defaults_when_empty_config(self, factory, es_instance):
- expected = pypel.Process()
+ expected = pypel.processes.Process()
obtained = factory.create_process({}, es_instance=es_instance)
assert isinstance(obtained, type(expected))
def test_factory_instantiates_non_default_transformers(self, factory, es_instance):
- expected = pypel.Process(transformer=pypel.transformers.Transformer.ColumnStripperTransformer)
- obtained = factory.create_process({"Extractors": {"name": "pypel.Extractor"},
- "Transformers": {"name": "pypel.ColumnStripperTransformer"},
- "Loaders": {"name": "pypel.Loader"}}, es_instance=es_instance)
+ expected = pypel.processes.Process(transformer=pypel.transformers.Transformer)
+ obtained = factory.create_process({"Extractors": {"name": "pypel.extractors.Extractor"},
+ "Transformers": {"name": "pypel.transformers.Transformer"},
+ "Loaders": {"name": "pypel.loaders.Loader"}}, es_instance=es_instance)
assert isinstance(obtained, type(expected))
def test_factory_instanciates_list_of_transformers(self, factory, es_instance):
- expected = pypel.Process(transformer=[pypel.transformers.Transformer.ColumnStripperTransformer(),
- pypel.Transformer()])
- obtained = factory.create_process({"Extractors": {"name": "pypel.Extractor"},
- "Transformers": [{"name": "pypel.ColumnStripperTransformer"},
- {"name": "pypel.Transformer"}],
- "Loaders": {"name": "pypel.Loader"}}, es_instance=es_instance)
+ expected = pypel.processes.Process(transformer=[pypel.transformers.ColumnStripperTransformer(),
+ pypel.transformers.ColumnCapitaliserTransformer()])
+ obtained = factory.create_process({"Extractors": {"name": "pypel.extractors.Extractor"},
+ "Transformers": [{"name": "pypel.transformers.ColumnStripperTransformer"},
+ {"name": "pypel.transformers.Transformer"}],
+ "Loaders": {"name": "pypel.loaders.Loader"}}, es_instance=es_instance)
assert isinstance(obtained, type(expected))
def test_raises_if_class_not_found(self, factory, es_instance):
diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py
index 397cbd1..85d20c8 100644
--- a/tests/integration/test_integration.py
+++ b/tests/integration/test_integration.py
@@ -8,14 +8,14 @@ import numpy
from tests.unit.test_Loader import LoaderTest, Elasticsearch
-class TransformerForTesting(pypel.Transformer):
+class TransformerForTesting(pypel.transformers.Transformer):
def _format_na(self, df: pd.DataFrame) -> pd.DataFrame:
return df.where(df.notnull(), 0).astype(int)
@pytest.fixture
def ep():
- return pypel.Process()
+ return pypel.processes.Process(extractor=pypel.extractors.Extractor())
def mockreturn_extract(self, dummy):
@@ -36,7 +36,7 @@ def mockreturn_extract(self, dummy):
"DATE_DECISION": [dt.datetime.strptime("2019/05/12", "%Y/%m/%d")],
"CODE_COMMUNE_ETABLISSEMENT": ['75112'],
"STATUT": ["decidé"]
- }
+ }
df = pd.DataFrame(d)
return df
@@ -57,13 +57,13 @@ def mockreturn_extract_no_date(self):
"CODE_COMMUNE_ETABLISSEMENT": ['75112'],
"Statut": ["decidé"],
"ShouldBeNone": numpy.NaN
- }
+ }
test_df = pd.DataFrame(test)
return test_df
def test_integration_extract_transform_no_date(ep, params, monkeypatch):
- monkeypatch.setattr(pypel.Process, "extract", mockreturn_extract_no_date)
+ monkeypatch.setattr(pypel.processes.Process, "extract", mockreturn_extract_no_date)
expected = {
"PROJET": ["nom du projet"],
"ENTREPRISE": ["MINISTERE DE L'ECONOMIE DES FINANCES ET DE LA RELANCE"],
@@ -79,20 +79,18 @@ def test_integration_extract_transform_no_date(ep, params, monkeypatch):
"CODE_COMMUNE_ETABLISSEMENT": ['75112'],
"STATUT": ["decidé"],
"SHOULDBENONE": None
- }
+ }
df = ep.extract()
with pytest.warns(UserWarning):
obtained = ep.transform(df,
- column_replace={
- "é": "e",
- " ": "_"},
- strip=["DEPARTEMENT"])
+ column_replace={"é": "e", " ": "_"},
+ strip=["DEPARTEMENT"])
expected_df = pd.DataFrame(expected)
assert_frame_equal(expected_df, obtained, check_names=True)
def test_integration_exctract_transform(ep, params, monkeypatch):
- monkeypatch.setattr(pypel.Process, "extract", mockreturn_extract)
+ monkeypatch.setattr(pypel.processes.Process, "extract", mockreturn_extract)
expected = {
"PROJET": ["nom du projet"],
"ENTREPRISE": ["MINISTERE DE L'ECONOMIE DES FINANCES ET DE LA RELANCE"],
@@ -110,12 +108,10 @@ def test_integration_exctract_transform(ep, params, monkeypatch):
"DATE_DECISION": ["2019-05-12"],
"CODE_COMMUNE_ETABLISSEMENT": ['75112'],
"STATUT": ["decidé"]
- }
+ }
df = ep.extract("")
obtained = ep.transform(df,
- column_replace={
- "é": "e",
- " ": "_"},
+ column_replace={"é": "e", " ": "_"},
date_format="%Y-%m-%d",
date_columns=["DATE_DEPOT_PROJET", "DATE_DEBUT_INSTRUCTION", "DATE_DECISION"])
expected_df = pd.DataFrame(expected)
@@ -217,12 +213,13 @@ def test_multiple_transformers(ep):
testing_df = pd.DataFrame({"0": [numpy.NaN]})
expected_df = pd.DataFrame({"0": [0]})
with pytest.warns(UserWarning):
- obtained_df = pypel.Process(transformer=[pypel.Transformer(), TransformerForTesting()]).transform(testing_df)
+ obtained_df = pypel.processes.Process(
+ transformer=[pypel.transformers.Transformer(), TransformerForTesting()]).transform(testing_df)
assert_frame_equal(expected_df, obtained_df, check_names=True)
def test_process_method():
path_csv = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.csv")
- process = pypel.Process(loader=LoaderTest(Elasticsearch()))
+ process = pypel.processes.Process(loader=LoaderTest(Elasticsearch()))
with pytest.warns(UserWarning):
process.process(path_csv, "indice")
diff --git a/tests/unit/test_Loader.py b/tests/unit/test_Loader.py
index 3bcd6b0..1805f88 100644
--- a/tests/unit/test_Loader.py
+++ b/tests/unit/test_Loader.py
@@ -1,6 +1,7 @@
+import os
import tempfile
import pytest
-import pypel
+import pypel.loaders.Loaders as loader
from pandas import DataFrame
@@ -8,7 +9,7 @@ class Elasticsearch:
pass
-class LoaderTest(pypel.Loader):
+class LoaderTest(loader.Loader):
def _bulk_into_elastic(self, actions: list, indice: str):
pass
@@ -34,8 +35,8 @@ class TestLoader:
[9, 9, 9, 9, 9]],
columns=["0", "1", "2", "3", "4"])
with tempfile.TemporaryDirectory() as path:
- loader = LoaderTest(Elasticsearch(), backup=True, path_to_export_folder=path)
- loader.load(df, "indice")
+ loader_ = LoaderTest(Elasticsearch(), backup=True, path_to_export_folder=path)
+ loader_.load(df, "indice")
def test_loading_no_export(self):
df = DataFrame(data=[[6, 6, 6, 6, 6],
@@ -43,8 +44,8 @@ class TestLoader:
[8, 8, 8, 8, 8],
[9, 9, 9, 9, 9]],
columns=["0", "1", "2", "3", "4"])
- loader = LoaderTest(Elasticsearch())
- loader.load(df, "indice")
+ loader_ = LoaderTest(Elasticsearch())
+ loader_.load(df, "indice")
def test_loading_export_named_file(self):
df = DataFrame(data=[[6, 6, 6, 6, 6],
@@ -53,29 +54,43 @@ class TestLoader:
[9, 9, 9, 9, 9]],
columns=["0", "1", "2", "3", "4"])
with tempfile.TemporaryDirectory() as path:
- loader = LoaderTest(Elasticsearch(), backup=True, path_to_export_folder=path, name_export="name")
- loader.load(df, "indice")
+ loader_ = LoaderTest(Elasticsearch(), backup=True, path_to_export_folder=path, name_export="name")
+ loader_.load(df, "indice")
def test_bad_folder_crashes(self):
with pytest.raises(ValueError):
- pypel.Loader(Elasticsearch(), path_to_export_folder="/this_folder_does_not_exist", backup=True)
+ loader.Loader(Elasticsearch(), path_to_export_folder="/this_folder_does_not_exist", backup=True)
def test_no_folder_crashes(self):
with pytest.raises(ValueError):
- pypel.Loader(Elasticsearch(), backup=True)
+ loader.Loader(Elasticsearch(), backup=True)
def test_good_folder(self):
- pypel.Loader(Elasticsearch(), path_to_export_folder="/", backup=True)
+ loader.Loader(Elasticsearch(), path_to_export_folder="/", backup=True)
def test_no_backup(self):
- pypel.Loader(Elasticsearch())
+ loader.Loader(Elasticsearch())
def test_bulk_into_elastic(self, monkeypatch):
- monkeypatch.setattr(pypel.loaders.Loader.elasticsearch.helpers, "streaming_bulk", mock_streaming_bulk_no_error)
- pypel.Loader(Elasticsearch())._bulk_into_elastic([], "indice")
+ monkeypatch.setattr(loader.elasticsearch.helpers, "streaming_bulk", mock_streaming_bulk_no_error)
+ loader.Loader(Elasticsearch())._bulk_into_elastic([], "indice")
def test_bulk_into_elastic_warns_on_error(self, monkeypatch):
- monkeypatch.setattr(pypel.loaders.Loader.elasticsearch.helpers, "streaming_bulk",
+ monkeypatch.setattr(loader.elasticsearch.helpers, "streaming_bulk",
mock_streaming_bulk_some_errors)
with pytest.warns(UserWarning):
- pypel.Loader(Elasticsearch())._bulk_into_elastic([], "indice")
+ loader.Loader(Elasticsearch())._bulk_into_elastic([], "indice")
+
+
+class TestCSVWriter:
+ def test_asserts_writes_csv(self):
+ df = DataFrame(data=[[6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]],
+ columns=["0", "1", "2", "3", "4"])
+ with tempfile.TemporaryDirectory() as path:
+ loader_ = loader.CSVWriter()
+ file_name = "tmpcsv.csv"
+ loader_.load(df, path + f"/{file_name}")
+ assert file_name in os.listdir(path)
diff --git a/tests/unit/test_extractor.py b/tests/unit/test_extractor.py
index edc9cc4..6a1f3e5 100644
--- a/tests/unit/test_extractor.py
+++ b/tests/unit/test_extractor.py
@@ -1,5 +1,5 @@
import pytest
-from pypel import Extractor
+from pypel.extractors import Extractor, CSVExtractor, XLSExtractor, XLSXExtractor
import pandas as pd
from pandas.testing import assert_frame_equal
import os
@@ -10,6 +10,21 @@ def ex():
return Extractor()
[email protected]
+def csv():
+ return CSVExtractor()
+
+
[email protected]
+def xls():
+ return XLSExtractor()
+
+
[email protected]
+def xlsx():
+ return XLSXExtractor()
+
+
class TestExtractor:
def test_raises_if_unsupported_file_extension(self, ex):
with pytest.raises(ValueError):
@@ -124,3 +139,123 @@ class TestExtractor:
[9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
df = ex.extract(path_xls)
assert_frame_equal(expected_xls, df)
+
+
+class TestCSVExtractor:
+ def test_extract_csv(self, csv):
+ path_csv = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.csv")
+ expected_csv = pd.DataFrame(data=[[1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4],
+ [5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
+ df = csv.extract(path_csv)
+ assert_frame_equal(expected_csv, df)
+
+ def test_extract_csv_no_logging(self, csv, disable_logs):
+ path_csv = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.csv")
+ expected_csv = pd.DataFrame(data=[[1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4],
+ [5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
+ df = csv.extract(path_csv)
+ assert_frame_equal(expected_csv, df)
+
+
+class TestXLSXExtractor:
+ def test_extract_xlsx(self, xlsx):
+ path = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xlsx")
+ expected_default = pd.DataFrame(data=[[1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4],
+ [5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
+ df = xlsx.extract(path)
+ assert_frame_equal(expected_default, df)
+
+ def test_extract_xlsx_no_logging(self, xlsx, disable_logs):
+ path = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xlsx")
+ expected_default = pd.DataFrame(data=[[1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4],
+ [5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
+ df = xlsx.extract(path)
+ assert_frame_equal(expected_default, df)
+
+ def test_extract_xlsx_skiprows(self, xlsx):
+ path = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xlsx")
+ expected_skip_5 = pd.DataFrame(data=[[6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]],
+ columns=[0, 1, 2, 3, 4])
+ df = xlsx.extract(path, skiprows=5, header=None)
+ assert_frame_equal(expected_skip_5, df)
+
+ def test_extract_xlsx_sheetname(self, xlsx):
+ path = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xlsx")
+ expected_sheetname = pd.DataFrame(data=[[9]], columns=["a"])
+ obtained_sheetname = xlsx.extract(path, sheet_name="TEST")
+ assert_frame_equal(expected_sheetname, obtained_sheetname)
+
+ def test_raises_if_badly_named_file(self, xlsx):
+ with pytest.warns(UserWarning):
+ xlsx.extract(os.path.join(os.getcwd(), "tests", "fake_data", "test_bad_filename$.xlsx"))
+
+
+class TestXLSExtractor:
+ def test_extract_xls(self, xls):
+ path_xls = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xls")
+ expected_xls = pd.DataFrame(data=[[1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4],
+ [5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
+ df = xls.extract(path_xls)
+ assert_frame_equal(expected_xls, df)
+
+ def test_extract_skiprows_xls(self, xls):
+ path_xls = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xls")
+ expected_xls = pd.DataFrame(data=[[5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=[0, 1, 2, 3, 4])
+ df = xls.extract(path_xls, skiprows=4, header=None)
+ assert_frame_equal(expected_xls, df)
+
+ def test_init_datafram_xls_no_logging(self, xls, disable_logs):
+ path_xls = os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.xls")
+ expected_xls = pd.DataFrame(data=[[1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4],
+ [5, 5, 5, 5, 5],
+ [6, 6, 6, 6, 6],
+ [7, 7, 7, 7, 7],
+ [8, 8, 8, 8, 8],
+ [9, 9, 9, 9, 9]], columns=["a", "b", "c", "d", "e"])
+ df = xls.extract(path_xls)
+ assert_frame_equal(expected_xls, df)
diff --git a/tests/unit/test_process.py b/tests/unit/test_process.py
index 2f88d75..e809431 100644
--- a/tests/unit/test_process.py
+++ b/tests/unit/test_process.py
@@ -4,7 +4,7 @@ import elasticsearch
from tests.unit.test_Loader import Elasticsearch, LoaderTest
-class Extractor2(pypel.Extractor):
+class Extractor2(pypel.extractors.Extractor):
pass
@@ -19,64 +19,64 @@ def assert_process_called_with_indice1_to_file1(_, file, indice):
class TestProcessInstanciation:
def test_default_instanciates(self):
- pypel.Process()
+ pypel.processes.Process()
def test_bad_type_args_fails(self):
with pytest.raises(ValueError):
- pypel.Process(extractor="") # noqa
+ pypel.processes.Process(extractor="")
with pytest.raises(ValueError):
- pypel.Process(transformer="")
+ pypel.processes.Process(transformer="")
with pytest.raises(ValueError):
- pypel.Process(loader="") # noqa
+ pypel.processes.Process(loader="")
with pytest.raises(ValueError):
- pypel.Process(extractor=[]) # noqa
+ pypel.processes.Process(extractor=[])
def test_instance_from_bad_class_fails(self):
with pytest.raises(ValueError):
- pypel.Process(extractor=FakeExtractor()) # noqa
+ pypel.processes.Process(extractor=FakeExtractor())
def test_good_args_instanciates(self):
- pypel.Process(extractor=Extractor2())
+ pypel.processes.Process(extractor=Extractor2())
def test_list_of_transformers_instanciates(self):
- pypel.Process(transformer=[pypel.Transformer(), pypel.Transformer()])
+ pypel.processes.Process(transformer=[pypel.transformers.Transformer(), pypel.transformers.Transformer()])
def test_list_of_uninstanced_transformers_fails(self):
with pytest.raises(ValueError):
- pypel.Process(transformer=[pypel.Transformer, pypel.Transformer])
+ pypel.processes.Process(transformer=[pypel.transformers.Transformer, pypel.transformers.Transformer])
def test_list_of_wrong_type_fails(self):
with pytest.raises(ValueError):
- pypel.Process(transformer=[0, 0])
+ pypel.processes.Process(transformer=[0, 0])
class TestProcessMethods:
def test_transform_instanced_no_args(self, df):
- process = pypel.Process(transformer=pypel.Transformer(date_format="", date_columns=[]))
+ process = pypel.processes.Process(transformer=pypel.transformers.Transformer(date_format="", date_columns=[]))
process.transform(df)
def test_transform_multiple_transformers_extra_args(self, df):
- process = pypel.Process(transformer=[pypel.Transformer(date_format="", date_columns=[]),
- pypel.Transformer(date_format="", date_columns=[])])
+ process = pypel.processes.Process(transformer=[pypel.transformers.Transformer(date_format="", date_columns=[]),
+ pypel.transformers.Transformer(date_format="", date_columns=[])])
with pytest.warns(UserWarning):
process.transform(df, "extra_argument")
def test_load_class_loader_fails_if_no_valid_es_instance_is_passed(self, df):
- process = pypel.Process(loader=pypel.Loader)
+ process = pypel.processes.Process(loader=pypel.loaders.Loader)
with pytest.raises(AssertionError):
process.load(df, "indice", Elasticsearch())
def test_load_class_loader_passes_if_valid_es_instance_is_passed(self, df):
- process = pypel.Process(loader=LoaderTest)
+ process = pypel.processes.Process(loader=LoaderTest)
process.load(df, "indice", elasticsearch.Elasticsearch())
def test_load_instanced_loader_extra_args_warns(self, df):
- process = pypel.Process(loader=LoaderTest(Elasticsearch()))
+ process = pypel.processes.Process(loader=LoaderTest(Elasticsearch()))
with pytest.warns(UserWarning):
process.load(df, "indice", "extra_arg", extrakeyword="yes")
def test_load_instanced_does_not_warn(self, df):
- process = pypel.Process(loader=LoaderTest(Elasticsearch()))
+ process = pypel.processes.Process(loader=LoaderTest(Elasticsearch()))
process.load(df, "indice")
def test_bulk_with_indice_to_list_format(self, monkeypatch):
@@ -85,14 +85,16 @@ class TestProcessMethods:
def mock_process_for_multiple_bulk(_, file, indice):
processed_dic[file] = indice
- monkeypatch.setattr(pypel.Process, "process", mock_process_for_multiple_bulk)
- process = pypel.Process(transformer=pypel.Transformer(), loader=pypel.Loader(Elasticsearch()))
+ monkeypatch.setattr(pypel.processes.Process, "process", mock_process_for_multiple_bulk)
+ process = pypel.processes.Process(transformer=pypel.transformers.Transformer(),
+ loader=pypel.loaders.Loader(Elasticsearch()))
process.bulk({"indice": ["file1", "file2"]})
assert processed_dic == {"file1": "indice", "file2": "indice"}
def test_single_bulk_with_file_indice_format(self, monkeypatch):
- process = pypel.Process(transformer=pypel.Transformer(), loader=pypel.Loader(Elasticsearch()))
- monkeypatch.setattr(pypel.Process, "process", assert_process_called_with_indice1_to_file1)
+ process = pypel.processes.Process(transformer=pypel.transformers.Transformer(),
+ loader=pypel.loaders.Loader(Elasticsearch()))
+ monkeypatch.setattr(pypel.processes.Process, "process", assert_process_called_with_indice1_to_file1)
process.bulk({"file1": "indice1"})
def test_multiple_bulk_with_file_indice_format(self, monkeypatch):
@@ -101,7 +103,8 @@ class TestProcessMethods:
def mock_process_for_multiple_bulk(_, file, indice):
processed_dic[file] = indice
- process = pypel.Process(transformer=pypel.Transformer(), loader=pypel.Loader(Elasticsearch()))
- monkeypatch.setattr(pypel.Process, "process", mock_process_for_multiple_bulk)
+ process = pypel.processes.Process(transformer=pypel.transformers.Transformer(),
+ loader=pypel.loaders.Loader(Elasticsearch()))
+ monkeypatch.setattr(pypel.processes.Process, "process", mock_process_for_multiple_bulk)
process.bulk({"file1": "indice1", "file2": "indice2", "file3": "indice3"})
assert processed_dic == {"file1": "indice1", "file2": "indice2", "file3": "indice3"}
diff --git a/tests/unit/test_transformer.py b/tests/unit/test_transformer.py
index b6d699c..0045447 100644
--- a/tests/unit/test_transformer.py
+++ b/tests/unit/test_transformer.py
@@ -1,7 +1,12 @@
import pytest
-from pypel import Transformer, Extractor
+from pypel.transformers import (Transformer, ColumnStripperTransformer, ColumnReplacerTransformer,
+ ContentReplacerTransformer, ColumnCapitaliserTransformer,
+ ColumnContenStripperTransformer, MergerTransformer,
+ NullValuesReplacerTransformer, DateParserTransformer, DateFormatterTransformer)
+from pypel.extractors import Extractor
import os
-from pandas import DataFrame
+from pandas import DataFrame, NA, NaT, to_datetime
+from numpy import nan
from pandas.testing import assert_frame_equal
@@ -10,10 +15,15 @@ def transformer():
return Transformer()
[email protected]
+def merger():
+ return MergerTransformer()
+
+
class RefExtractor(Extractor):
- def extract(self, *args, **kwargs):
+ def extract(self, *args, **kwargs) -> DataFrame:
return DataFrame({
- "0": [0, 1, 2]})
+ "0": [0, 1, 2]})
class TestTransformer:
@@ -50,6 +60,83 @@ class TestTransformer:
def test_merge_ref_with_default_extractor(self, transformer):
df = Extractor().extract(os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.csv"))
- transformer.merge_referential(df,
- os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.csv"))
+ expected = df.copy()
+ actual = transformer.merge_referential(df, os.path.join(os.getcwd(), "tests", "fake_data", "test_init_df.csv"))
+ assert_frame_equal(expected, actual)
+
+
+class TestAtomicTransformers:
+ def test_column_stripper(self):
+ tr = ColumnStripperTransformer()
+ expected = DataFrame(data=[[0]], columns=["bad_column_name"])
+ actual = tr.transform(DataFrame(data=[[0]], columns=[" bad_column_name "]))
+ assert_frame_equal(expected, actual)
+
+ def test_column_replacer(self):
+ tr = ColumnReplacerTransformer()
+ expected = DataFrame(data=[[0]], columns=["replaced"])
+ actual = tr.transform(DataFrame(data=[[0]], columns=["original"]), column_replace_dict={
+ "original": "replaced"})
+ assert_frame_equal(expected, actual)
+
+ def test_content_replacer(self):
+ tr = ContentReplacerTransformer()
+ expected = DataFrame(data=[["replaced"]], columns=[0])
+ actual = tr.transform(DataFrame(data=[["original"]], columns=[0]), replace_dict={
+ "original": "replaced"})
+ assert_frame_equal(expected, actual)
+
+ def test_column_capitaliser(self):
+ tr = ColumnCapitaliserTransformer()
+ expected = DataFrame(data=[[0]], columns=["Capitalized"])
+ actual = tr.transform(DataFrame(data=[[0]], columns=["capitalized"]))
+ assert_frame_equal(expected, actual)
+
+ def test_null_values_replacer(self):
+ tr = NullValuesReplacerTransformer()
+ expected = DataFrame(data=[[None], [None], [None]], columns=[0])
+ actual = tr.transform(DataFrame(data=[[NA], [NaT], [nan]], columns=[0]))
+ assert_frame_equal(expected, actual)
+
+ def test_date_parser(self):
+ tr = DateParserTransformer()
+ expected = DataFrame(data=[[to_datetime("13-01-1970")]], columns=["to_parse"])
+ actual = tr.transform(DataFrame(data=[["13 01 1970"]], columns=["to_parse"]), ["to_parse"], "%d %m %Y")
+ assert_frame_equal(expected, actual)
+
+ def test_date_formatter(self):
+ tr = DateFormatterTransformer()
+ expected = DataFrame(data=[["1970-01-22"]], columns=["to_format"])
+ actual = tr.transform(DataFrame(data=[[to_datetime("22 01 1970")]], columns=["to_format"]), ["to_format"])
+ assert_frame_equal(expected, actual)
+
+ def test_date_formatter_raises_if_non_datetimes_in_column(self):
+ with pytest.raises(ValueError, match="Column to_format has non-datetime values, the columns to format must "
+ "be datetimes. Please parse beforehands."):
+ tr = DateFormatterTransformer()
+ tr.transform(DataFrame(data=[["22 01 1970"]], columns=["to_format"]), ["to_format"])
+
+
+class TestColumnContentStripper:
+ def test_column_content_stripping(self):
+ tr = ColumnContenStripperTransformer()
+ expected = DataFrame(data=[["stripped"]], columns=["to_strip"])
+ actual = tr.transform(DataFrame(data=[[" stripped "]], columns=["to_strip"]), columns_to_strip=["to_strip"])
+ assert_frame_equal(expected, actual)
+
+ def test_warns_if_column_not_in_df(self):
+ with pytest.warns(UserWarning, match="No such column not_in_df in passed dataframe"):
+ tr = ColumnContenStripperTransformer()
+ tr.transform(DataFrame(data=[[" stripped "]], columns=["to_strip"]), columns_to_strip=["not_in_df"])
+
+ def test_warns_if_column_not_strings(self):
+ with pytest.warns(UserWarning, match="Column not_str is not of type `str`, cannot strip."):
+ tr = ColumnContenStripperTransformer()
+ tr.transform(DataFrame(data=[[0]], columns=["not_str"]), columns_to_strip=["not_str"])
+
+class TestMerger:
+ def test_merge_with_self(self, df, merger):
+ expected = df.copy()
+ actual = merger.transform(df, mergekey="0", ref=df)
+ assert_frame_equal(expected, actual)
diff --git a/tests/unit/test_unit_process.py b/tests/unit/test_unit_process.py
index cf8c763..39fb63d 100644
--- a/tests/unit/test_unit_process.py
+++ b/tests/unit/test_unit_process.py
@@ -1,5 +1,8 @@
import pytest
-from pypel import Extractor, Transformer, Loader, Process
+from pypel.extractors import Extractor
+from pypel.loaders import Loader
+from pypel.transformers import Transformer
+from pypel.processes import Process
from pandas import DataFrame
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_removed_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 11
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.8",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
elastic-transport==8.17.1
elasticsearch==8.17.2
et_xmlfile==2.0.0
exceptiongroup==1.2.2
iniconfig==2.1.0
numpy==1.19.5
openpyxl==3.1.5
packaging==24.2
pandas==1.2.5
pluggy==1.5.0
-e git+https://github.com/139bercy/pypel.git@92fc416b197c73156d83579d2e439698d171e09d#egg=pypel
pytest==8.3.5
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
pytz==2025.2
six==1.17.0
tomli==2.2.1
Unidecode==1.3.8
urllib3==2.2.3
xlrd==2.0.1
|
name: pypel
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=24.2=py38h06a4308_0
- python=3.8.20=he870216_0
- readline=8.2=h5eee18b_0
- setuptools=75.1.0=py38h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.44.0=py38h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- elastic-transport==8.17.1
- elasticsearch==8.17.2
- et-xmlfile==2.0.0
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- numpy==1.19.5
- openpyxl==3.1.5
- packaging==24.2
- pandas==1.2.5
- pluggy==1.5.0
- pytest==8.3.5
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- six==1.17.0
- tomli==2.2.1
- unidecode==1.3.8
- urllib3==2.2.3
- xlrd==2.0.1
prefix: /opt/conda/envs/pypel
|
[
"tests/integration/test_cli.py::TestGetArgs::test_raises_if_file_not_specified",
"tests/integration/test_cli.py::TestGetArgs::test_process",
"tests/integration/test_cli.py::TestGetArgs::test_indice",
"tests/integration/test_cli.py::TestGetArgs::test_source_path",
"tests/integration/test_cli.py::TestGetArgs::test_config_file",
"tests/integration/test_cli.py::TestGetArgs::test_defaults",
"tests/integration/test_cli.py::TestGetArgs::test_all_params",
"tests/integration/test_cli.py::TestGetESInstance::test_no_authentication",
"tests/integration/test_cli.py::TestGetESInstance::test_authentication_no_cafile",
"tests/integration/test_cli.py::TestGetESInstance::test_cafile",
"tests/integration/test_cli.py::TestProcessFromConfig::test_raises_if_non_existant_file",
"tests/integration/test_cli.py::TestProcessFromConfig::test_single_file",
"tests/integration/test_cli.py::TestProcessFromConfig::test_with_cl_indice",
"tests/integration/test_cli.py::TestProcessFromConfig::test_directory",
"tests/integration/test_cli.py::TestSelectProcessFromConfig::test_raises_if_processes_not_found",
"tests/integration/test_cli.py::TestSelectProcessFromConfig::test_raises_if_processes_not_a_list",
"tests/integration/test_cli.py::TestSelectProcessFromConfig::test_raises_if_process_not_in_processes",
"tests/integration/test_cli.py::TestSelectProcessFromConfig::test_single_process",
"tests/integration/test_cli.py::TestSelectProcessFromConfig::test_multiple_processes",
"tests/integration/test_factory.py::TestFactory::test_factory_defaults_when_empty_config",
"tests/integration/test_factory.py::TestFactory::test_factory_instantiates_non_default_transformers",
"tests/integration/test_factory.py::TestFactory::test_factory_instanciates_list_of_transformers",
"tests/integration/test_factory.py::TestFactory::test_raises_if_class_not_found",
"tests/integration/test_integration.py::test_integration_extract_transform_no_date",
"tests/integration/test_integration.py::test_integration_exctract_transform",
"tests/integration/test_integration.py::test_init_dataframe_excel",
"tests/integration/test_integration.py::test_init_dataframe_excel_skiprows",
"tests/integration/test_integration.py::test_init_dataframe_excel_sheetname",
"tests/integration/test_integration.py::test_init_dataframe_excel_csv",
"tests/integration/test_integration.py::test_init_bad_filename",
"tests/integration/test_integration.py::test_init_bad_filename_excel",
"tests/integration/test_integration.py::test_multiple_transformers",
"tests/integration/test_integration.py::test_process_method",
"tests/unit/test_Loader.py::TestLoader::test_loading_export_csv",
"tests/unit/test_Loader.py::TestLoader::test_loading_no_export",
"tests/unit/test_Loader.py::TestLoader::test_loading_export_named_file",
"tests/unit/test_Loader.py::TestLoader::test_bad_folder_crashes",
"tests/unit/test_Loader.py::TestLoader::test_no_folder_crashes",
"tests/unit/test_Loader.py::TestLoader::test_good_folder",
"tests/unit/test_Loader.py::TestLoader::test_no_backup",
"tests/unit/test_Loader.py::TestLoader::test_bulk_into_elastic",
"tests/unit/test_Loader.py::TestLoader::test_bulk_into_elastic_warns_on_error",
"tests/unit/test_Loader.py::TestCSVWriter::test_asserts_writes_csv",
"tests/unit/test_extractor.py::TestExtractor::test_raises_if_unsupported_file_extension",
"tests/unit/test_extractor.py::TestExtractor::test_extract_excel",
"tests/unit/test_extractor.py::TestExtractor::test_extract_excel_no_logging",
"tests/unit/test_extractor.py::TestExtractor::test_extract_excel_skiprows",
"tests/unit/test_extractor.py::TestExtractor::test_extract_excel_sheetname",
"tests/unit/test_extractor.py::TestExtractor::test_extract_excel_csv",
"tests/unit/test_extractor.py::TestExtractor::test_extract_excel_csv_no_logging",
"tests/unit/test_extractor.py::TestExtractor::test_extract_xls",
"tests/unit/test_extractor.py::TestExtractor::test_extract_skiprows_xls",
"tests/unit/test_extractor.py::TestExtractor::test_init_datafram_xls_no_logging",
"tests/unit/test_extractor.py::TestCSVExtractor::test_extract_csv",
"tests/unit/test_extractor.py::TestCSVExtractor::test_extract_csv_no_logging",
"tests/unit/test_extractor.py::TestXLSXExtractor::test_extract_xlsx",
"tests/unit/test_extractor.py::TestXLSXExtractor::test_extract_xlsx_no_logging",
"tests/unit/test_extractor.py::TestXLSXExtractor::test_extract_xlsx_skiprows",
"tests/unit/test_extractor.py::TestXLSXExtractor::test_extract_xlsx_sheetname",
"tests/unit/test_extractor.py::TestXLSXExtractor::test_raises_if_badly_named_file",
"tests/unit/test_extractor.py::TestXLSExtractor::test_extract_xls",
"tests/unit/test_extractor.py::TestXLSExtractor::test_extract_skiprows_xls",
"tests/unit/test_extractor.py::TestXLSExtractor::test_init_datafram_xls_no_logging",
"tests/unit/test_process.py::TestProcessInstanciation::test_default_instanciates",
"tests/unit/test_process.py::TestProcessInstanciation::test_bad_type_args_fails",
"tests/unit/test_process.py::TestProcessInstanciation::test_instance_from_bad_class_fails",
"tests/unit/test_process.py::TestProcessInstanciation::test_good_args_instanciates",
"tests/unit/test_process.py::TestProcessInstanciation::test_list_of_transformers_instanciates",
"tests/unit/test_process.py::TestProcessInstanciation::test_list_of_uninstanced_transformers_fails",
"tests/unit/test_process.py::TestProcessInstanciation::test_list_of_wrong_type_fails",
"tests/unit/test_process.py::TestProcessMethods::test_transform_instanced_no_args",
"tests/unit/test_process.py::TestProcessMethods::test_transform_multiple_transformers_extra_args",
"tests/unit/test_process.py::TestProcessMethods::test_load_class_loader_fails_if_no_valid_es_instance_is_passed",
"tests/unit/test_process.py::TestProcessMethods::test_load_instanced_loader_extra_args_warns",
"tests/unit/test_process.py::TestProcessMethods::test_load_instanced_does_not_warn",
"tests/unit/test_process.py::TestProcessMethods::test_bulk_with_indice_to_list_format",
"tests/unit/test_process.py::TestProcessMethods::test_single_bulk_with_file_indice_format",
"tests/unit/test_process.py::TestProcessMethods::test_multiple_bulk_with_file_indice_format",
"tests/unit/test_transformer.py::TestTransformer::test_format_str_columns_warns_if_column_missing",
"tests/unit/test_transformer.py::TestTransformer::test_format_dates_warns_if_date_format_omitted",
"tests/unit/test_transformer.py::TestTransformer::test_format_dates_warns_if_columns_omitted",
"tests/unit/test_transformer.py::TestTransformer::test_merge_referential_passing_dataframe",
"tests/unit/test_transformer.py::TestTransformer::test_merge_ref_passing_instanced_extractor",
"tests/unit/test_transformer.py::TestTransformer::test_merge_ref_crashes_if_extractor_param_not_a_valid_extractor_instance",
"tests/unit/test_transformer.py::TestTransformer::test_merge_ref_crashes_if_ref_is_not_path_nor_str",
"tests/unit/test_transformer.py::TestTransformer::test_merge_ref_with_default_extractor",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_column_stripper",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_column_replacer",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_content_replacer",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_column_capitaliser",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_null_values_replacer",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_date_parser",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_date_formatter",
"tests/unit/test_transformer.py::TestAtomicTransformers::test_date_formatter_raises_if_non_datetimes_in_column",
"tests/unit/test_transformer.py::TestColumnContentStripper::test_column_content_stripping",
"tests/unit/test_transformer.py::TestColumnContentStripper::test_warns_if_column_not_in_df",
"tests/unit/test_transformer.py::TestColumnContentStripper::test_warns_if_column_not_strings",
"tests/unit/test_transformer.py::TestMerger::test_merge_with_self",
"tests/unit/test_unit_process.py::TestWarnings::test_instanced_transformer_warns_if_addition_params_are_passed",
"tests/unit/test_unit_process.py::TestWarnings::test_instanced_loader_warns_if_addition_params_are_passed",
"tests/unit/test_unit_process.py::TestParameters::test_extractor_calls_init_dataframe_with_extract_parameters",
"tests/unit/test_unit_process.py::TestBulk::test_bulk_crashes_if_transformer_not_instanced",
"tests/unit/test_unit_process.py::TestBulk::test_bulk_crashes_if_loader_not_instanced",
"tests/unit/test_unit_process.py::TestBulk::test_bulk_crashes_if_both_not_instanced"
] |
[
"tests/unit/test_process.py::TestProcessMethods::test_load_class_loader_passes_if_valid_es_instance_is_passed"
] |
[] |
[] | null | null |
|
15five__scim2-filter-parser-13
|
3ed1858b492542d0bc9b9e9ab9547641595e28c1
|
2020-07-30 14:25:04
|
c794bf3e50e3cb71bdcf919feb43d11912907dd2
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 12a5d4f..178f172 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,10 @@
CHANGE LOG
==========
+0.3.5
+-----
+- Update the sql.Transpiler to collect namedtuples rather than tuples for attr paths
+
0.3.4
-----
- Update tox.ini and clean up linting errors
diff --git a/setup.py b/setup.py
index bbf57bf..bd16f70 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ def long_description():
setup(
name='scim2-filter-parser',
- version='0.3.4',
+ version='0.3.5',
description='A customizable parser/transpiler for SCIM2.0 filters',
url='https://github.com/15five/scim2-filter-parser',
maintainer='Paul Logston',
diff --git a/src/scim2_filter_parser/transpilers/sql.py b/src/scim2_filter_parser/transpilers/sql.py
index 6254f1e..2107758 100644
--- a/src/scim2_filter_parser/transpilers/sql.py
+++ b/src/scim2_filter_parser/transpilers/sql.py
@@ -4,9 +4,12 @@ clause based on a SCIM filter.
"""
import ast
import string
+import collections
from .. import ast as scim2ast
+AttrPath = collections.namedtuple('AttrPath', ['attr_name', 'sub_attr', 'uri'])
+
class Transpiler(ast.NodeTransformer):
"""
@@ -145,7 +148,7 @@ class Transpiler(ast.NodeTransformer):
# Convert attr_name to another value based on map.
# Otherwise, return None.
- attr_path_tuple = (attr_name_value, sub_attr_value, uri_value)
+ attr_path_tuple = AttrPath(attr_name_value, sub_attr_value, uri_value)
self.attr_paths.append(attr_path_tuple)
return self.attr_map.get(attr_path_tuple)
|
Return NamedTuple rather than tuple.
It would be nice to return a NamedTuple instead of a tuple here:
https://github.com/15five/scim2-filter-parser/blob/7ddc216f8c3dd1cdb2152944187e8f7f5ee07be2/src/scim2_filter_parser/transpilers/sql.py#L148
This way parts of each path could be accessed by name rather than by index in the tuple.
|
15five/scim2-filter-parser
|
diff --git a/tests/test_transpiler.py b/tests/test_transpiler.py
index b8e1bb4..280c2d3 100644
--- a/tests/test_transpiler.py
+++ b/tests/test_transpiler.py
@@ -36,6 +36,16 @@ class RFCExamples(TestCase):
self.assertEqual(expected_sql, sql, query)
self.assertEqual(expected_params, params, query)
+ def test_attr_paths_are_created(self):
+ query = 'userName eq "bjensen"'
+ tokens = self.lexer.tokenize(query)
+ ast = self.parser.parse(tokens)
+ self.transpiler.transpile(ast)
+
+ self.assertEqual(len(self.transpiler.attr_paths), 1)
+ for path in self.transpiler.attr_paths:
+ self.assertTrue(isinstance(path, transpile_sql.AttrPath))
+
def test_username_eq(self):
query = 'userName eq "bjensen"'
sql = "username = {a}"
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 3
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
asgiref==3.7.2
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
Django==3.2.25
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
pytz==2025.2
-e git+https://github.com/15five/scim2-filter-parser.git@3ed1858b492542d0bc9b9e9ab9547641595e28c1#egg=scim2_filter_parser
sly==0.3
sqlparse==0.4.4
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work
|
name: scim2-filter-parser
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib-metadata=4.11.3=py37h06a4308_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- asgiref==3.7.2
- django==3.2.25
- pytz==2025.2
- sly==0.3
- sqlparse==0.4.4
prefix: /opt/conda/envs/scim2-filter-parser
|
[
"tests/test_transpiler.py::RFCExamples::test_attr_paths_are_created"
] |
[] |
[
"tests/test_transpiler.py::RFCExamples::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians",
"tests/test_transpiler.py::RFCExamples::test_family_name_contains",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_ge",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_gt",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_le",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_lt",
"tests/test_transpiler.py::RFCExamples::test_schema_username_startswith",
"tests/test_transpiler.py::RFCExamples::test_schemas_eq",
"tests/test_transpiler.py::RFCExamples::test_title_has_value",
"tests/test_transpiler.py::RFCExamples::test_title_has_value_and_user_type_eq",
"tests/test_transpiler.py::RFCExamples::test_title_has_value_or_user_type_eq",
"tests/test_transpiler.py::RFCExamples::test_user_type_eq_and_email_contains_or_email_contains",
"tests/test_transpiler.py::RFCExamples::test_user_type_eq_and_not_email_type_eq",
"tests/test_transpiler.py::RFCExamples::test_user_type_eq_and_not_email_type_eq_work_and_value_contains",
"tests/test_transpiler.py::RFCExamples::test_user_type_ne_and_not_email_contains_or_email_contains",
"tests/test_transpiler.py::RFCExamples::test_username_eq",
"tests/test_transpiler.py::RFCExamples::test_username_startswith",
"tests/test_transpiler.py::UndefinedAttributes::test_email_type_eq_primary_value_eq_uuid_1",
"tests/test_transpiler.py::UndefinedAttributes::test_email_type_eq_primary_value_eq_uuid_2",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_1",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_2",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_3",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_4",
"tests/test_transpiler.py::UndefinedAttributes::test_schemas_eq",
"tests/test_transpiler.py::UndefinedAttributes::test_title_has_value_and_user_type_eq_1",
"tests/test_transpiler.py::UndefinedAttributes::test_title_has_value_and_user_type_eq_2",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_email_contains_or_email_contains",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_1",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_2",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_work_and_value_contains_1",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_work_and_value_contains_2",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_work_and_value_contains_3",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_ne_and_not_email_contains_or_email_contains",
"tests/test_transpiler.py::UndefinedAttributes::test_username_eq",
"tests/test_transpiler.py::AzureQueries::test_email_type_eq_primary_value_eq_uuid",
"tests/test_transpiler.py::AzureQueries::test_external_id_from_azure",
"tests/test_transpiler.py::AzureQueries::test_parse_simple_email_filter_with_uuid",
"tests/test_transpiler.py::CommandLine::test_command_line"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.15five_1776_scim2-filter-parser-13
|
|
15five__scim2-filter-parser-20
|
08de23c5626556a37beced764a22a2fa7021989b
|
2020-10-18 03:21:13
|
c794bf3e50e3cb71bdcf919feb43d11912907dd2
|
diff --git a/src/scim2_filter_parser/parser.py b/src/scim2_filter_parser/parser.py
index 516f65d..12c693e 100644
--- a/src/scim2_filter_parser/parser.py
+++ b/src/scim2_filter_parser/parser.py
@@ -110,9 +110,8 @@ class SCIMParser(Parser):
# which takes precedence over "or"
# 3. Attribute operators
precedence = (
- ('nonassoc', OR), # noqa F821
- ('nonassoc', AND), # noqa F821
- ('nonassoc', NOT), # noqa F821
+ ('left', OR, AND), # noqa F821
+ ('right', NOT), # noqa F821
)
# FILTER = attrExp / logExp / valuePath / *1"not" "(" FILTER ")"
|
Issue when using multiple "or" or "and"
Hi,
I am facing an issue, where the query having two or more "and" or more than two "or" is failing.
Have a look at examples below: -
1)```"displayName co \"username\" or nickName co \"username\" or userName co \"username\""```
```"displayName co \"username\" and nickName co \"username\" and userName co \"username\""```
the two queries fails giving ,
```scim2_filter_parser.parser.SCIMParserError: Parsing error at: Token(type='OR', value='or', lineno=1, index=52)```
notice above queries are having either only "or" or "and".
2)```"displayName co \"username\" and nickName co \"username\" or userName co \"username\""```
but this query works.
|
15five/scim2-filter-parser
|
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 4ff562c..19aa198 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -47,6 +47,24 @@ class BuggyQueries(TestCase):
with self.assertRaises(parser.SCIMParserError):
self.parser.parse(token_stream)
+ def test_g17_1_log_exp_order(self):
+ query = 'displayName co "username" or nickName co "username" or userName co "username"'
+
+ tokens = self.lexer.tokenize(query)
+ self.parser.parse(tokens) # Should not raise error
+
+ def test_g17_2_log_exp_order(self):
+ query = 'displayName co "username" and nickName co "username" and userName co "username"'
+
+ tokens = self.lexer.tokenize(query)
+ self.parser.parse(tokens) # Should not raise error
+
+ def test_g17_3_log_exp_order(self):
+ query = 'displayName co "username" and nickName co "username" or userName co "username"'
+
+ tokens = self.lexer.tokenize(query)
+ self.parser.parse(tokens) # Should not raise error
+
class CommandLine(TestCase):
def setUp(self):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[django-query]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.7",
"reqs_path": [
"docs/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
asgiref==3.7.2
Babel==2.14.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
Django==3.2.25
docutils==0.19
exceptiongroup==1.2.2
idna==3.10
imagesize==1.4.1
importlib-metadata==6.7.0
iniconfig==2.0.0
Jinja2==3.1.6
MarkupSafe==2.1.5
packaging==24.0
pluggy==1.2.0
Pygments==2.17.2
pytest==7.4.4
pytz==2025.2
requests==2.31.0
-e git+https://github.com/15five/scim2-filter-parser.git@08de23c5626556a37beced764a22a2fa7021989b#egg=scim2_filter_parser
sly==0.4
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sqlparse==0.4.4
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0
|
name: scim2-filter-parser
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- asgiref==3.7.2
- babel==2.14.0
- charset-normalizer==3.4.1
- django==3.2.25
- docutils==0.19
- exceptiongroup==1.2.2
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- jinja2==3.1.6
- markupsafe==2.1.5
- packaging==24.0
- pluggy==1.2.0
- pygments==2.17.2
- pytest==7.4.4
- pytz==2025.2
- requests==2.31.0
- sly==0.4
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- sqlparse==0.4.4
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- zipp==3.15.0
prefix: /opt/conda/envs/scim2-filter-parser
|
[
"tests/test_parser.py::BuggyQueries::test_g17_1_log_exp_order",
"tests/test_parser.py::BuggyQueries::test_g17_2_log_exp_order"
] |
[] |
[
"tests/test_parser.py::RegressionTestQueries::test_command_line",
"tests/test_parser.py::BuggyQueries::test_g17_3_log_exp_order",
"tests/test_parser.py::BuggyQueries::test_no_quotes_around_comp_value",
"tests/test_parser.py::CommandLine::test_command_line"
] |
[] |
MIT License
|
swerebench/sweb.eval.x86_64.15five_1776_scim2-filter-parser-20
|
|
15five__scim2-filter-parser-31
|
c794bf3e50e3cb71bdcf919feb43d11912907dd2
|
2022-07-09 01:20:42
|
c794bf3e50e3cb71bdcf919feb43d11912907dd2
|
logston: Hey @powellc, if you have the time, can you give this a rigorous review? It changes core logic in a pretty large way. I'd like to make sure my assumptions are sound and my changes are worth the costs.
andersk: When converting a string to a `LIKE` or `ILIKE` pattern, it’s necessary to escape `%`, `_`, and `\` as `\%`, `\_`, and `\\`. This doesn’t seem to do that.
```console
$ python3 -m scim2_filter_parser.transpilers.sql \
'userType eq "a%b_c\\d" and userName co "a%b_c\\d"'
SQL: (usertype = {a}) AND (username ILIKE {b})
PARAMS: {'a': 'a%b_c\\\\d', 'b': '%a%b_c\\\\d%'}
```
Expected:
```console
SQL: (usertype = {a}) AND (username ILIKE {b})
PARAMS: {'a': 'a%b_c\\d', 'b': '%a\\%b\\_c\\\\d%'}
```
This may be a separate bug, but this will increase its impact by transpiling more queries to `ILIKE`.
andersk: Oh…I guess there’s also a question of which databases this needs to be compatible with? `ILIKE` works in PostgreSQL but not MySQL or SQLite.
logston: Right, good points. As anticipated, this is trickier than this quick patch lets on.
Another solution that was suggested was to uppercase strings before comparison. eg. `UPPER`. I'll need to check if that's available in all major SQL engines.
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 14f28e6..35eb5c5 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,5 +1,12 @@
CHANGE LOG
==========
+0.4.0
+-----
+- Update userName to be case insensitive. #31
+
+BREAKING CHANGE: This allows queries that did not match rows before to
+match rows now!
+
0.3.9
-----
diff --git a/setup.py b/setup.py
index fa62e03..c46c582 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ def long_description():
setup(
name='scim2-filter-parser',
- version='0.3.9',
+ version='0.4.0',
description='A customizable parser/transpiler for SCIM2.0 filters',
url='https://github.com/15five/scim2-filter-parser',
maintainer='Paul Logston',
diff --git a/src/scim2_filter_parser/ast.py b/src/scim2_filter_parser/ast.py
index b019f01..28de65e 100644
--- a/src/scim2_filter_parser/ast.py
+++ b/src/scim2_filter_parser/ast.py
@@ -95,6 +95,12 @@ class AttrPath(AST):
sub_attr : (SubAttr, type(None)) # noqa: E203
uri : (str, type(None)) # noqa: E203
+ @property
+ def case_insensitive(self):
+ # userName is always case-insensitive
+ # https://datatracker.ietf.org/doc/html/rfc7643#section-4.1.1
+ return self.attr_name == 'userName'
+
class CompValue(AST):
value : str # noqa: E203
@@ -105,6 +111,10 @@ class AttrExpr(AST):
attr_path : AttrPath # noqa: E203
comp_value : CompValue # noqa: E203
+ @property
+ def case_insensitive(self):
+ return self.attr_path.case_insensitive
+
# The following classes for visiting and rewriting the AST are taken
# from Python's ast module. It's really easy to make mistakes when
diff --git a/src/scim2_filter_parser/transpilers/django_q_object.py b/src/scim2_filter_parser/transpilers/django_q_object.py
index def4633..5ef90b2 100644
--- a/src/scim2_filter_parser/transpilers/django_q_object.py
+++ b/src/scim2_filter_parser/transpilers/django_q_object.py
@@ -139,13 +139,13 @@ class Transpiler(ast.NodeTransformer):
partial = partial.replace(".", "__")
if full and partial:
# Specific to Azure
- op, value = self.visit_AttrExprValue(node.value, node.comp_value)
+ op, value = self.visit_AttrExprValue(node)
key = partial + "__" + op
return full & Q(**{key: value})
elif full:
return full
elif partial:
- op, value = self.visit_AttrExprValue(node.value, node.comp_value)
+ op, value = self.visit_AttrExprValue(node)
key = partial + "__" + op
return Q(**{key: value})
else:
@@ -159,20 +159,20 @@ class Transpiler(ast.NodeTransformer):
return None
if "." in attr:
attr = attr.replace(".", "__")
- op, value = self.visit_AttrExprValue(node.value, node.comp_value)
+ op, value = self.visit_AttrExprValue(node)
key = attr + "__" + op
query = Q(**{key: value})
if node.value == "ne":
query = ~query
return query
- def visit_AttrExprValue(self, node_value, node_comp_value):
- op = self.lookup_op(node_value)
+ def visit_AttrExprValue(self, node):
+ op = self.lookup_op(node.value)
- if node_comp_value:
+ if node.comp_value:
# There is a comp_value, so visit node and build SQL.
# prep item_id to be a str replacement placeholder
- value = self.visit(node_comp_value)
+ value = self.visit(node.comp_value)
else:
value = None
diff --git a/src/scim2_filter_parser/transpilers/sql.py b/src/scim2_filter_parser/transpilers/sql.py
index 0c3fba4..7128edb 100644
--- a/src/scim2_filter_parser/transpilers/sql.py
+++ b/src/scim2_filter_parser/transpilers/sql.py
@@ -112,28 +112,38 @@ class Transpiler(ast.NodeTransformer):
if isinstance(node.attr_path.attr_name, scim2ast.Filter):
full, partial = self.visit_PartialAttrExpr(node.attr_path.attr_name)
if full and partial:
- value = self.visit_AttrExprValue(node.value, node.comp_value)
+ value = self.visit_AttrExprValue(node)
return f'({full} AND {partial} {value})'
elif full:
return full
elif partial:
- value = self.visit_AttrExprValue(node.value, node.comp_value)
+ value = self.visit_AttrExprValue(node)
return f'{partial} {value}'
else:
return None
else:
+ # Case-insensitivity only needs to be checked in this branch
+ # because userName is currently the only attribute that can be case
+ # insensitive and userName can not be a nested part of a complex query (eg.
+ # emails.type in emails[type eq "Primary"]...).
+ # https://datatracker.ietf.org/doc/html/rfc7643#section-4.1.1
attr = self.visit(node.attr_path)
if attr is None:
return None
- value = self.visit_AttrExprValue(node.value, node.comp_value)
+
+ value = self.visit_AttrExprValue(node)
+
+ if node.case_insensitive:
+ return f'UPPER({attr}) {value}'
+
return f'{attr} {value}'
- def visit_AttrExprValue(self, node_value, node_comp_value):
- op_sql = self.lookup_op(node_value)
+ def visit_AttrExprValue(self, node):
+ op_sql = self.lookup_op(node.value)
item_id = self.get_next_id()
- if not node_comp_value:
+ if not node.comp_value:
self.params[item_id] = None
return op_sql
@@ -142,15 +152,19 @@ class Transpiler(ast.NodeTransformer):
# prep item_id to be a str replacement placeholder
item_id_placeholder = '{' + item_id + '}'
- if 'LIKE' == op_sql:
+ if node.value.lower() in self.matching_op_by_scim_op.keys():
# Add appropriate % signs to values in LIKE clause
- prefix, suffix = self.lookup_like_matching(node_value)
- value = prefix + self.visit(node_comp_value) + suffix
+ prefix, suffix = self.lookup_like_matching(node.value)
+ value = prefix + self.visit(node.comp_value) + suffix
+
else:
- value = self.visit(node_comp_value)
+ value = self.visit(node.comp_value)
self.params[item_id] = value
+ if node.case_insensitive:
+ return f'{op_sql} UPPER({item_id_placeholder})'
+
return f'{op_sql} {item_id_placeholder}'
def visit_AttrPath(self, node):
|
userName attribute should be case-insensitive, per the RFC
From https://github.com/15five/django-scim2/issues/76
> See https://datatracker.ietf.org/doc/html/rfc7643#section-4.1.1: (userName)
> This attribute is REQUIRED and is case insensitive.
> Currently this case-insensitive behavior is not implemented and the filter lookups are case-sensitive.
|
15five/scim2-filter-parser
|
diff --git a/tests/test_query.py b/tests/test_query.py
index ee4161d..7cd9595 100644
--- a/tests/test_query.py
+++ b/tests/test_query.py
@@ -16,6 +16,7 @@ class RFCExamples(unittest.TestCase):
username TEXT,
first_name TEXT,
last_name TEXT,
+ nickname TEXT,
title TEXT,
update_ts DATETIME,
user_type TEXT
@@ -24,17 +25,17 @@ class RFCExamples(unittest.TestCase):
INSERT_USERS = '''
INSERT INTO users
- (id, username, first_name, last_name, title, update_ts, user_type)
+ (id, username, first_name, last_name, nickname, title, update_ts, user_type)
VALUES
- (1, 'bjensen', 'Brie', 'Jensen', NULL, NULL, NULL),
- (2, 'momalley', 'Mike', 'O''Malley', NULL, NULL, NULL),
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', NULL, 'Employee'),
- (4, 'crobertson', 'Carly', 'Robertson', NULL, NULL, 'Intern'),
-
- (5, 'gt', 'Gina', 'Taylor', NULL, '2012-05-13T04:42:34Z', NULL),
- (6, 'ge', 'Greg', 'Edgar', NULL, '2011-05-13T04:42:34Z', NULL),
- (7, 'lt', 'Lisa', 'Ting', NULL, '2010-05-13T04:42:34Z', NULL),
- (8, 'le', 'Linda', 'Euler', NULL, '2011-05-13T04:42:34Z', NULL)
+ (1, 'bjensen', 'Brie', 'Jensen', 'BB', NULL, NULL, NULL),
+ (2, 'momalley', 'Mike', 'O''Malley', NULL, NULL, NULL, NULL),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', NULL, 'Employee'),
+ (4, 'crobertson', 'Carly', 'Robertson', NULL, NULL, NULL, 'Intern'),
+
+ (5, 'gt', 'Gina', 'Taylor', NULL, NULL, '2012-05-13T04:42:34Z', NULL),
+ (6, 'ge', 'Greg', 'Edgar', NULL, NULL, '2011-05-13T04:42:34Z', NULL),
+ (7, 'lt', 'Lisa', 'Ting', NULL, NULL, '2010-05-13T04:42:34Z', NULL),
+ (8, 'le', 'Linda', 'Euler', NULL, NULL, '2011-05-13T04:42:34Z', NULL)
'''
CREATE_TABLE_EMAILS = '''
@@ -95,6 +96,7 @@ class RFCExamples(unittest.TestCase):
# attr_name, sub_attr, uri: table name
('title', None, None): 'users.title',
('userName', None, None): 'users.username',
+ ('nickName', None, None): 'users.nickname',
('userType', None, None): 'users.user_type',
('name', 'familyName', None): 'users.last_name',
('meta', 'lastModified', None): 'users.update_ts',
@@ -105,6 +107,7 @@ class RFCExamples(unittest.TestCase):
('ims', 'type', None): 'ims.type',
('schemas', None, None): 'schemas.text',
('userName', None, 'urn:ietf:params:scim:schemas:core:2.0:User'): 'username',
+ ('nickName', None, 'urn:ietf:params:scim:schemas:core:2.0:User'): 'nickname',
}
JOINS = (
@@ -133,120 +136,120 @@ class RFCExamples(unittest.TestCase):
self.assertEqual(expected_rows, results)
- def test_username_eq(self):
- query = 'userName eq "bjensen"'
+ def test_nickname_eq(self):
+ query = 'nickName eq "BB"'
expected_rows = [
- (1, 'bjensen', 'Brie', 'Jensen', None, None, None)
+ (1, 'bjensen', 'Brie', 'Jensen', 'BB', None, None, None)
]
self.assertRows(query, expected_rows)
def test_family_name_contains(self):
query = '''name.familyName co "O'Malley"'''
expected_rows = [
- (2, 'momalley', 'Mike', "O'Malley", None, None, None),
+ (2, 'momalley', 'Mike', "O'Malley", None, None, None, None),
]
self.assertRows(query, expected_rows)
- def test_username_startswith(self):
- query = 'userName sw "J"'
+ def test_nickname_startswith(self):
+ query = 'nickName sw "J"'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
def test_schema_username_startswith(self):
- query = 'urn:ietf:params:scim:schemas:core:2.0:User:userName sw "J"'
+ query = 'urn:ietf:params:scim:schemas:core:2.0:User:nickName sw "J"'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
def test_title_has_value(self):
query = 'title pr'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
def test_meta_last_modified_gt(self):
query = 'meta.lastModified gt "2011-05-13T04:42:34Z"'
expected_rows = [
- (5, 'gt', 'Gina', 'Taylor', None, '2012-05-13T04:42:34Z', None),
+ (5, 'gt', 'Gina', 'Taylor', None, None, '2012-05-13T04:42:34Z', None),
]
self.assertRows(query, expected_rows)
def test_meta_last_modified_ge(self):
query = 'meta.lastModified ge "2011-05-13T04:42:34Z"'
expected_rows = [
- (5, 'gt', 'Gina', 'Taylor', None, '2012-05-13T04:42:34Z', None),
- (6, 'ge', 'Greg', 'Edgar', None, '2011-05-13T04:42:34Z', None),
- (8, 'le', 'Linda', 'Euler', None, '2011-05-13T04:42:34Z', None)
+ (5, 'gt', 'Gina', 'Taylor', None, None, '2012-05-13T04:42:34Z', None),
+ (6, 'ge', 'Greg', 'Edgar', None, None, '2011-05-13T04:42:34Z', None),
+ (8, 'le', 'Linda', 'Euler', None, None, '2011-05-13T04:42:34Z', None)
]
self.assertRows(query, expected_rows)
def test_meta_last_modified_lt(self):
query = 'meta.lastModified lt "2011-05-13T04:42:34Z"'
expected_rows = [
- (7, 'lt', 'Lisa', 'Ting', None, '2010-05-13T04:42:34Z', None),
+ (7, 'lt', 'Lisa', 'Ting', None, None, '2010-05-13T04:42:34Z', None),
]
self.assertRows(query, expected_rows)
def test_meta_last_modified_le(self):
query = 'meta.lastModified le "2011-05-13T04:42:34Z"'
expected_rows = [
- (6, 'ge', 'Greg', 'Edgar', None, '2011-05-13T04:42:34Z', None),
- (7, 'lt', 'Lisa', 'Ting', None, '2010-05-13T04:42:34Z', None),
- (8, 'le', 'Linda', 'Euler', None, '2011-05-13T04:42:34Z', None)
+ (6, 'ge', 'Greg', 'Edgar', None, None, '2011-05-13T04:42:34Z', None),
+ (7, 'lt', 'Lisa', 'Ting', None, None, '2010-05-13T04:42:34Z', None),
+ (8, 'le', 'Linda', 'Euler', None, None, '2011-05-13T04:42:34Z', None)
]
self.assertRows(query, expected_rows)
def test_title_has_value_and_user_type_eq(self):
query = 'title pr and userType eq "Employee"'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
def test_title_has_value_or_user_type_eq(self):
query = 'title pr or userType eq "Intern"'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
- (4, 'crobertson', 'Carly', 'Robertson', None, None, 'Intern'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
+ (4, 'crobertson', 'Carly', 'Robertson', None, None, None, 'Intern'),
]
self.assertRows(query, expected_rows)
def test_schemas_eq(self):
query = 'schemas eq "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"'
expected_rows = [
- (4, 'crobertson', 'Carly', 'Robertson', None, None, 'Intern'),
+ (4, 'crobertson', 'Carly', 'Robertson', None, None, None, 'Intern'),
]
self.assertRows(query, expected_rows)
def test_user_type_eq_and_email_contains_or_email_contains(self):
query = 'userType eq "Employee" and (emails co "example.com" or emails.value co "example.org")'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
def test_user_type_ne_and_not_email_contains_or_email_contains(self):
query = 'userType ne "Employee" and not (emails co "example.com" or emails.value co "example.org")'
expected_rows = [
- (4, 'crobertson', 'Carly', 'Robertson', None, None, 'Intern'),
+ (4, 'crobertson', 'Carly', 'Robertson', None, None, None, 'Intern'),
]
self.assertRows(query, expected_rows)
def test_user_type_eq_and_not_email_type_eq(self):
query = 'userType eq "Employee" and (emails.type eq "work")'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
def test_user_type_eq_and_not_email_type_eq_work_and_value_contains(self):
query = 'userType eq "Employee" and emails[type eq "work" and value co "@example.com"]'
expected_rows = [
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
@@ -254,8 +257,8 @@ class RFCExamples(unittest.TestCase):
query = ('emails[type eq "work" and value co "@example.com"] or '
'ims[type eq "xmpp" and value co "@foo.com"]')
expected_rows = [
- (1, 'bjensen', 'Brie', 'Jensen', None, None, None),
- (3, 'Jacob', 'Jacob', 'Jingleheimer', 'Friend', None, 'Employee'),
+ (1, 'bjensen', 'Brie', 'Jensen', 'BB', None, None, None),
+ (3, 'Jacob', 'Jacob', 'Jingleheimer', 'JJ', 'Friend', None, 'Employee'),
]
self.assertRows(query, expected_rows)
@@ -441,7 +444,7 @@ class CommandLine(unittest.TestCase):
' FROM users',
' LEFT JOIN emails ON emails.user_id = users.id',
' LEFT JOIN schemas ON schemas.user_id = users.id',
- ' WHERE username = bjensen;'
+ ' WHERE UPPER(username) = UPPER(bjensen);'
]
self.assertEqual(result, expected)
diff --git a/tests/test_transpiler.py b/tests/test_transpiler.py
index 2198cde..dfaf562 100644
--- a/tests/test_transpiler.py
+++ b/tests/test_transpiler.py
@@ -6,52 +6,72 @@ from scim2_filter_parser.lexer import SCIMLexer
from scim2_filter_parser.parser import SCIMParser
import scim2_filter_parser.transpilers.sql as transpile_sql
+class SetupHelper(TestCase):
+ attr_map = None
-class RFCExamples(TestCase):
+ def setUp(self):
+ self.lexer = SCIMLexer()
+ self.parser = SCIMParser()
+
+ def assertSQL(self, query, expected_sql, expected_params, attr_map=None):
+ tokens = self.lexer.tokenize(query)
+ ast = self.parser.parse(tokens)
+
+ if attr_map is None:
+ attr_map = self.attr_map
+
+ transpiler = transpile_sql.Transpiler(attr_map)
+
+ sql, params = transpiler.transpile(ast)
+
+ self.assertEqual(expected_sql, sql, query)
+ self.assertEqual(expected_params, params, query)
+
+
+class RFCExamples(SetupHelper, TestCase):
attr_map = {
('name', 'familyName', None): 'name.familyname',
('emails', None, None): 'emails',
('emails', 'type', None): 'emails.type',
('emails', 'value', None): 'emails.value',
('userName', None, None): 'username',
+ ('nickName', None, None): 'nickname',
('title', None, None): 'title',
('userType', None, None): 'usertype',
('schemas', None, None): 'schemas',
('userName', None, 'urn:ietf:params:scim:schemas:core:2.0:User'): 'username',
+ ('nickName', None, 'urn:ietf:params:scim:schemas:core:2.0:User'): 'nickname',
('meta', 'lastModified', None): 'meta.lastmodified',
('ims', 'type', None): 'ims.type',
('ims', 'value', None): 'ims.value',
}
- def setUp(self):
- self.lexer = SCIMLexer()
- self.parser = SCIMParser()
- self.transpiler = transpile_sql.Transpiler(self.attr_map)
-
- def assertSQL(self, query, expected_sql, expected_params):
- tokens = self.lexer.tokenize(query)
- ast = self.parser.parse(tokens)
- sql, params = self.transpiler.transpile(ast)
-
- self.assertEqual(expected_sql, sql, query)
- self.assertEqual(expected_params, params, query)
-
def test_attr_paths_are_created(self):
query = 'userName eq "bjensen"'
tokens = self.lexer.tokenize(query)
ast = self.parser.parse(tokens)
- self.transpiler.transpile(ast)
- self.assertEqual(len(self.transpiler.attr_paths), 1)
- for path in self.transpiler.attr_paths:
+ transpiler = transpile_sql.Transpiler(self.attr_map)
+ transpiler.transpile(ast)
+
+ self.assertEqual(len(transpiler.attr_paths), 1)
+ for path in transpiler.attr_paths:
self.assertTrue(isinstance(path, transpile_sql.AttrPath))
+ # userName is always case-insensitive
+ # https://datatracker.ietf.org/doc/html/rfc7643#section-4.1.1
def test_username_eq(self):
query = 'userName eq "bjensen"'
- sql = "username = {a}"
+ sql = "UPPER(username) = UPPER({a})"
params = {'a': 'bjensen'}
self.assertSQL(query, sql, params)
+ def test_nickname_eq(self):
+ query = 'nickName eq "Bob"'
+ sql = "nickname = {a}"
+ params = {'a': 'Bob'}
+ self.assertSQL(query, sql, params)
+
def test_family_name_contains(self):
query = '''name.familyName co "O'Malley"'''
sql = "name.familyname LIKE {a}"
@@ -60,13 +80,25 @@ class RFCExamples(TestCase):
def test_username_startswith(self):
query = 'userName sw "J"'
- sql = "username LIKE {a}"
+ sql = "UPPER(username) LIKE UPPER({a})"
+ params = {'a': 'J%'}
+ self.assertSQL(query, sql, params)
+
+ def test_nickname_startswith(self):
+ query = 'nickName sw "J"'
+ sql = "nickname LIKE {a}"
params = {'a': 'J%'}
self.assertSQL(query, sql, params)
def test_schema_username_startswith(self):
query = 'urn:ietf:params:scim:schemas:core:2.0:User:userName sw "J"'
- sql = "username LIKE {a}"
+ sql = "UPPER(username) LIKE UPPER({a})"
+ params = {'a': 'J%'}
+ self.assertSQL(query, sql, params)
+
+ def test_schema_nickname_startswith(self):
+ query = 'urn:ietf:params:scim:schemas:core:2.0:User:nickName sw "J"'
+ sql = "nickname LIKE {a}"
params = {'a': 'J%'}
self.assertSQL(query, sql, params)
@@ -149,27 +181,35 @@ class RFCExamples(TestCase):
params = {'a': 'work', 'b': '%@example.com%', 'c': 'xmpp', 'd': '%@foo.com%'}
self.assertSQL(query, sql, params)
+ def test_username_with_more_complex_query(self):
+ query = (
+ 'emails[type eq "work" and value co "@example.com"] or '
+ 'ims[type eq "xmpp" and value co "@foo.com"] or '
+ 'userName eq "bjensen"'
+ )
+ sql = (
+ '(((emails.type = {a}) AND (emails.value LIKE {b})) OR '
+ '((ims.type = {c}) AND (ims.value LIKE {d}))) OR '
+ '(UPPER(username) = UPPER({e}))'
+ )
+ params = {
+ 'a': 'work',
+ 'b': '%@example.com%',
+ 'c': 'xmpp',
+ 'd': '%@foo.com%',
+ 'e': 'bjensen',
+ }
+ self.assertSQL(query, sql, params)
-class UndefinedAttributes(TestCase):
-
- def setUp(self):
- self.lexer = SCIMLexer()
- self.parser = SCIMParser()
-
- def assertSQL(self, query, attr_map, expected_sql, expected_params):
- tokens = self.lexer.tokenize(query)
- ast = self.parser.parse(tokens)
- sql, params = transpile_sql.Transpiler(attr_map).transpile(ast)
- self.assertEqual(expected_sql, sql, query)
- self.assertEqual(expected_params, params, query)
+class UndefinedAttributes(SetupHelper, TestCase):
def test_username_eq(self):
query = 'userName eq "bjensen"'
sql = None
params = {}
attr_map = {}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_title_has_value_and_user_type_eq_1(self):
query = 'title pr and userType eq "Employee"'
@@ -178,7 +218,7 @@ class UndefinedAttributes(TestCase):
attr_map = {
('title', None, None): 'title',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_title_has_value_and_user_type_eq_2(self):
query = 'title pr and userType eq "Employee"'
@@ -187,14 +227,14 @@ class UndefinedAttributes(TestCase):
attr_map = {
('userType', None, None): 'usertype',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_schemas_eq(self):
query = 'schemas eq "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"'
sql = None
params = {}
attr_map = {}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_eq_and_email_contains_or_email_contains(self):
query = 'userType eq "Employee" and (emails co "example.com" or emails.value co "example.org")'
@@ -205,7 +245,7 @@ class UndefinedAttributes(TestCase):
('emails', None, None): 'emails',
('emails', 'value', None): 'emails.value',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_ne_and_not_email_contains_or_email_contains(self):
query = 'userType ne "Employee" and not (emails co "example.com" or emails.value co "example.org")'
@@ -216,7 +256,7 @@ class UndefinedAttributes(TestCase):
('emails', None, None): 'emails',
('emails', 'value', None): 'emails.value',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_eq_and_not_email_type_eq_1(self):
query = 'userType eq "Employee" and (emails.type eq "work")'
@@ -225,7 +265,7 @@ class UndefinedAttributes(TestCase):
attr_map = {
('userType', None, None): 'usertype',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_eq_and_not_email_type_eq_2(self):
query = 'userType eq "Employee" and (emails.type eq "work")'
@@ -234,7 +274,7 @@ class UndefinedAttributes(TestCase):
attr_map = {
('emails', 'type', None): 'emails.type',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_eq_and_not_email_type_eq_work_and_value_contains_1(self):
query = 'userType eq "Employee" and emails[type eq "work" and value co "@example.com"]'
@@ -243,7 +283,7 @@ class UndefinedAttributes(TestCase):
attr_map = {
('userType', None, None): 'usertype',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_eq_and_not_email_type_eq_work_and_value_contains_2(self):
query = 'userType eq "Employee" and emails[type eq "work" and value co "@example.com"]'
@@ -252,7 +292,7 @@ class UndefinedAttributes(TestCase):
attr_map = {
('emails', 'type', None): 'emails.type',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_user_type_eq_and_not_email_type_eq_work_and_value_contains_3(self):
query = 'userType eq "Employee" and emails[type eq "work" and value co "@example.com"]'
@@ -262,7 +302,7 @@ class UndefinedAttributes(TestCase):
('emails', 'type', None): 'emails.type',
('emails', 'value', None): 'emails.value',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_1(self):
query = ('emails[type eq "work" and value co "@example.com"] or '
@@ -273,7 +313,7 @@ class UndefinedAttributes(TestCase):
('emails', 'value', None): 'emails.value',
('ims', 'type', None): 'ims.type',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_2(self):
query = ('emails[type eq "work" and value co "@example.com"] or '
@@ -285,7 +325,7 @@ class UndefinedAttributes(TestCase):
('ims', 'type', None): 'ims.type',
('ims', 'value', None): 'ims.value',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_3(self):
query = ('emails[type eq "work" and value co "@example.com"] or '
@@ -297,7 +337,7 @@ class UndefinedAttributes(TestCase):
('emails', 'type', None): 'emails.type',
('ims', 'type', None): 'ims.type',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_4(self):
query = ('emails[type eq "work" and value co "@example.com"] or '
@@ -308,7 +348,7 @@ class UndefinedAttributes(TestCase):
('emails', 'type', None): 'emails.type',
('ims', 'value', None): 'ims.value',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_email_type_eq_primary_value_eq_uuid_1(self):
query = 'emails[type eq "Primary"].value eq "001750ca-8202-47cd-b553-c63f4f245940"'
@@ -317,7 +357,7 @@ class UndefinedAttributes(TestCase):
attr_map = {
('emails', 'value', None): 'emails.value',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
def test_email_type_eq_primary_value_eq_uuid_2(self):
query = 'emails[type eq "Primary"].value eq "001750ca-8202-47cd-b553-c63f4f245940"'
@@ -326,29 +366,16 @@ class UndefinedAttributes(TestCase):
attr_map = {
('emails', 'type', None): 'emails.type',
}
- self.assertSQL(query, attr_map, sql, params)
+ self.assertSQL(query, sql, params, attr_map)
-class AzureQueries(TestCase):
+class AzureQueries(SetupHelper, TestCase):
attr_map = {
('emails', 'type', None): 'emails.type',
('emails', 'value', None): 'emails.value',
('externalId', None, None): 'externalid',
}
- def setUp(self):
- self.lexer = SCIMLexer()
- self.parser = SCIMParser()
- self.transpiler = transpile_sql.Transpiler(self.attr_map)
-
- def assertSQL(self, query, expected_sql, expected_params):
- tokens = self.lexer.tokenize(query)
- ast = self.parser.parse(tokens)
- sql, params = self.transpiler.transpile(ast)
-
- self.assertEqual(expected_sql, sql, query)
- self.assertEqual(expected_params, params, query)
-
def test_email_type_eq_primary_value_eq_uuid(self):
query = 'emails[type eq "Primary"].value eq "001750ca-8202-47cd-b553-c63f4f245940"'
sql = "(emails.type = {a} AND emails.value = {b})"
@@ -368,24 +395,11 @@ class AzureQueries(TestCase):
self.assertSQL(query, sql, params)
-class GitHubBugsQueries(TestCase):
+class GitHubBugsQueries(SetupHelper, TestCase):
attr_map = {
('emails', 'type', None): 'emails.type',
}
- def setUp(self):
- self.lexer = SCIMLexer()
- self.parser = SCIMParser()
- self.transpiler = transpile_sql.Transpiler(self.attr_map)
-
- def assertSQL(self, query, expected_sql, expected_params):
- tokens = self.lexer.tokenize(query)
- ast = self.parser.parse(tokens)
- sql, params = self.transpiler.transpile(ast)
-
- self.assertEqual(expected_sql, sql, query)
- self.assertEqual(expected_params, params, query)
-
def test_g15_ne_op(self):
query = 'emails[type ne "work"]'
sql = "emails.type != {a}"
@@ -405,7 +419,7 @@ class CommandLine(TestCase):
transpile_sql.main(['userName eq "bjensen"'])
result = self.test_stdout.getvalue().strip().split('\n')
expected = [
- 'SQL: username = {a}',
+ 'SQL: UPPER(username) = UPPER({a})',
"PARAMS: {'a': 'bjensen'}"
]
self.assertEqual(result, expected)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 5
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[django-query]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.7",
"reqs_path": [
"docs/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
asgiref==3.7.2
Babel==2.14.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
Django==3.2.25
docutils==0.19
exceptiongroup==1.2.2
idna==3.10
imagesize==1.4.1
importlib-metadata==6.7.0
iniconfig==2.0.0
Jinja2==3.1.6
MarkupSafe==2.1.5
packaging==24.0
pluggy==1.2.0
Pygments==2.17.2
pytest==7.4.4
pytz==2025.2
requests==2.31.0
-e git+https://github.com/15five/scim2-filter-parser.git@c794bf3e50e3cb71bdcf919feb43d11912907dd2#egg=scim2_filter_parser
sly==0.4
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sqlparse==0.4.4
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0
|
name: scim2-filter-parser
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- asgiref==3.7.2
- babel==2.14.0
- charset-normalizer==3.4.1
- django==3.2.25
- docutils==0.19
- exceptiongroup==1.2.2
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- jinja2==3.1.6
- markupsafe==2.1.5
- packaging==24.0
- pluggy==1.2.0
- pygments==2.17.2
- pytest==7.4.4
- pytz==2025.2
- requests==2.31.0
- sly==0.4
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- sqlparse==0.4.4
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- zipp==3.15.0
prefix: /opt/conda/envs/scim2-filter-parser
|
[
"tests/test_query.py::CommandLine::test_command_line",
"tests/test_transpiler.py::RFCExamples::test_schema_username_startswith",
"tests/test_transpiler.py::RFCExamples::test_username_eq",
"tests/test_transpiler.py::RFCExamples::test_username_startswith",
"tests/test_transpiler.py::RFCExamples::test_username_with_more_complex_query",
"tests/test_transpiler.py::CommandLine::test_command_line"
] |
[] |
[
"tests/test_query.py::RFCExamples::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians",
"tests/test_query.py::RFCExamples::test_family_name_contains",
"tests/test_query.py::RFCExamples::test_meta_last_modified_ge",
"tests/test_query.py::RFCExamples::test_meta_last_modified_gt",
"tests/test_query.py::RFCExamples::test_meta_last_modified_le",
"tests/test_query.py::RFCExamples::test_meta_last_modified_lt",
"tests/test_query.py::RFCExamples::test_nickname_eq",
"tests/test_query.py::RFCExamples::test_nickname_startswith",
"tests/test_query.py::RFCExamples::test_schema_username_startswith",
"tests/test_query.py::RFCExamples::test_schemas_eq",
"tests/test_query.py::RFCExamples::test_title_has_value",
"tests/test_query.py::RFCExamples::test_title_has_value_and_user_type_eq",
"tests/test_query.py::RFCExamples::test_title_has_value_or_user_type_eq",
"tests/test_query.py::RFCExamples::test_user_type_eq_and_email_contains_or_email_contains",
"tests/test_query.py::RFCExamples::test_user_type_eq_and_not_email_type_eq",
"tests/test_query.py::RFCExamples::test_user_type_eq_and_not_email_type_eq_work_and_value_contains",
"tests/test_query.py::RFCExamples::test_user_type_ne_and_not_email_contains_or_email_contains",
"tests/test_query.py::AzureQueries::test_email_type_eq_primary_value_eq_uuid",
"tests/test_query.py::AzureQueries::test_external_id_from_azure",
"tests/test_query.py::AzureQueries::test_parse_simple_email_filter_with_uuid",
"tests/test_query.py::GeneralQueries::test_ensure_distinct_rows_fetched",
"tests/test_transpiler.py::RFCExamples::test_attr_paths_are_created",
"tests/test_transpiler.py::RFCExamples::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians",
"tests/test_transpiler.py::RFCExamples::test_family_name_contains",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_ge",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_gt",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_le",
"tests/test_transpiler.py::RFCExamples::test_meta_last_modified_lt",
"tests/test_transpiler.py::RFCExamples::test_nickname_eq",
"tests/test_transpiler.py::RFCExamples::test_nickname_startswith",
"tests/test_transpiler.py::RFCExamples::test_schema_nickname_startswith",
"tests/test_transpiler.py::RFCExamples::test_schemas_eq",
"tests/test_transpiler.py::RFCExamples::test_title_has_value",
"tests/test_transpiler.py::RFCExamples::test_title_has_value_and_user_type_eq",
"tests/test_transpiler.py::RFCExamples::test_title_has_value_or_user_type_eq",
"tests/test_transpiler.py::RFCExamples::test_user_type_eq_and_email_contains_or_email_contains",
"tests/test_transpiler.py::RFCExamples::test_user_type_eq_and_not_email_type_eq",
"tests/test_transpiler.py::RFCExamples::test_user_type_eq_and_not_email_type_eq_work_and_value_contains",
"tests/test_transpiler.py::RFCExamples::test_user_type_ne_and_not_email_contains_or_email_contains",
"tests/test_transpiler.py::UndefinedAttributes::test_email_type_eq_primary_value_eq_uuid_1",
"tests/test_transpiler.py::UndefinedAttributes::test_email_type_eq_primary_value_eq_uuid_2",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_1",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_2",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_3",
"tests/test_transpiler.py::UndefinedAttributes::test_emails_type_eq_work_value_contians_or_ims_type_eq_and_value_contians_4",
"tests/test_transpiler.py::UndefinedAttributes::test_schemas_eq",
"tests/test_transpiler.py::UndefinedAttributes::test_title_has_value_and_user_type_eq_1",
"tests/test_transpiler.py::UndefinedAttributes::test_title_has_value_and_user_type_eq_2",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_email_contains_or_email_contains",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_1",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_2",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_work_and_value_contains_1",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_work_and_value_contains_2",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_eq_and_not_email_type_eq_work_and_value_contains_3",
"tests/test_transpiler.py::UndefinedAttributes::test_user_type_ne_and_not_email_contains_or_email_contains",
"tests/test_transpiler.py::UndefinedAttributes::test_username_eq",
"tests/test_transpiler.py::AzureQueries::test_email_type_eq_primary_value_eq_uuid",
"tests/test_transpiler.py::AzureQueries::test_external_id_from_azure",
"tests/test_transpiler.py::AzureQueries::test_parse_simple_email_filter_with_uuid",
"tests/test_transpiler.py::GitHubBugsQueries::test_g15_ne_op"
] |
[] |
MIT License
| null |
20c__ctl-3
|
879af37647e61767a1ede59ffd353e4cfd27cd6f
|
2019-10-08 09:23:56
|
879af37647e61767a1ede59ffd353e4cfd27cd6f
|
diff --git a/src/ctl/plugins/pypi.py b/src/ctl/plugins/pypi.py
index 5d979af..a6117af 100644
--- a/src/ctl/plugins/pypi.py
+++ b/src/ctl/plugins/pypi.py
@@ -32,7 +32,7 @@ class PyPIPluginConfig(release.ReleasePluginConfig):
config_file = confu.schema.Str(help="path to pypi config file (e.g. ~/.pypirc)")
# PyPI repository name, needs to exist in your pypi config file
- repository = confu.schema.Str(
+ pypi_repository = confu.schema.Str(
help="PyPI repository name - needs to exist " "in your pypi config file",
default="pypi",
)
@@ -55,16 +55,16 @@ class PyPIPlugin(release.ReleasePlugin):
@property
def dist_path(self):
- return os.path.join(self.target.checkout_path, "dist", "*")
+ return os.path.join(self.repository.checkout_path, "dist", "*")
def prepare(self):
super(PyPIPlugin, self).prepare()
self.shell = True
- self.repository = self.get_config("repository")
+ self.pypi_repository = self.get_config("pypi_repository")
self.pypirc_path = os.path.expanduser(self.config.get("config_file"))
self.twine_settings = Settings(
config_file=self.pypirc_path,
- repository_name=self.repository,
+ repository_name=self.pypi_repository,
sign=self.get_config("sign"),
identity=self.get_config("identity"),
sign_with=self.get_config("sign_with"),
diff --git a/src/ctl/plugins/release.py b/src/ctl/plugins/release.py
index bcfa1ce..dcae2f4 100644
--- a/src/ctl/plugins/release.py
+++ b/src/ctl/plugins/release.py
@@ -18,8 +18,8 @@ import ctl.plugins.git
class ReleasePluginConfig(confu.schema.Schema):
- target = confu.schema.Str(
- help="target for release - should be a path "
+ repository = confu.schema.Str(
+ help="repository target for release - should be a path "
"to a python package or the name of a "
"repository type plugin",
cli=False,
@@ -46,16 +46,16 @@ class ReleasePlugin(command.CommandPlugin):
"version",
nargs=1,
type=str,
- help="release version - if target is managed by git, "
+ help="release version - if repository is managed by git, "
"checkout this branch/tag",
)
group.add_argument(
- "target",
+ "repository",
nargs="?",
type=str,
- default=plugin_config.get("target"),
- help=ReleasePluginConfig().target.help,
+ default=plugin_config.get("repository"),
+ help=ReleasePluginConfig().repository.help,
)
sub = parser.add_subparsers(title="Operation", dest="op")
@@ -74,7 +74,7 @@ class ReleasePlugin(command.CommandPlugin):
return {
"group": group,
- "confu_target": op_release_parser,
+ "confu_repository": op_release_parser,
"op_release_parser": op_release_parser,
"op_validate_parser": op_validate_parser,
}
@@ -84,48 +84,48 @@ class ReleasePlugin(command.CommandPlugin):
self.prepare()
self.shell = True
- self.set_target(self.get_config("target"))
+ self.set_repository(self.get_config("repository"))
self.dry_run = kwargs.get("dry")
self.version = kwargs.get("version")[0]
- self.orig_branch = self.target.branch
+ self.orig_branch = self.repository.branch
if self.dry_run:
self.log.info("Doing dry run...")
- self.log.info("Release target: {}".format(self.target))
+ self.log.info("Release repository: {}".format(self.repository))
try:
- self.target.checkout(self.version)
+ self.repository.checkout(self.version)
op = self.get_op(kwargs.get("op"))
op(**kwargs)
finally:
- self.target.checkout(self.orig_branch)
+ self.repository.checkout(self.orig_branch)
- def set_target(self, target):
- if not target:
- raise ValueError("No target specified")
+ def set_repository(self, repository):
+ if not repository:
+ raise ValueError("No repository specified")
try:
- self.target = self.other_plugin(target)
- if not isinstance(self.target, ctl.plugins.repository.RepositoryPlugin):
+ self.repository = self.other_plugin(repository)
+ if not isinstance(self.repository, ctl.plugins.repository.RepositoryPlugin):
raise TypeError(
"The plugin with the name `{}` is not a "
"repository type plugin and cannot be used "
- "as a target".format(target)
+ "as a repository".format(repository)
)
except KeyError:
- self.target = os.path.abspath(target)
- if not os.path.exists(self.target):
+ self.repository = os.path.abspath(repository)
+ if not os.path.exists(self.repository):
raise IOError(
"Target is neither a configured repository "
"plugin nor a valid file path: "
- "{}".format(self.target)
+ "{}".format(self.repository)
)
- self.target = ctl.plugins.git.temporary_plugin(
- self.ctl, "{}__tmp_repo".format(self.plugin_name), self.target
+ self.repository = ctl.plugins.git.temporary_plugin(
+ self.ctl, "{}__tmp_repo".format(self.plugin_name), self.repository
)
- self.cwd = self.target.checkout_path
+ self.cwd = self.repository.checkout_path
@expose("ctl.{plugin_name}.release")
def release(self, **kwargs):
|
PyPI plugin: `target` config attribute should be `repository`
This is so it's in line with the version plugin, which currently uses `repository` to specify the target repository
The pypi plugin currently uses `repository` to specify which PyPI repository to use, this should change to `pypi_repository` as well.
Should do this before tagging 1.0.0 since it's a config schema change
|
20c/ctl
|
diff --git a/tests/test_plugin_pypi.py b/tests/test_plugin_pypi.py
index 20315ad..19813e2 100644
--- a/tests/test_plugin_pypi.py
+++ b/tests/test_plugin_pypi.py
@@ -53,35 +53,35 @@ def test_init():
-def test_set_target_git_path(tmpdir, ctlr):
+def test_set_repository_git_path(tmpdir, ctlr):
"""
- Test setting build target: existing git repo via filepath
+ Test setting build repository: existing git repo via filepath
"""
plugin, git_plugin = instantiate(tmpdir, ctlr)
- plugin.set_target(git_plugin.checkout_path)
+ plugin.set_repository(git_plugin.checkout_path)
assert plugin.dist_path == os.path.join(git_plugin.checkout_path,
"dist", "*")
-def test_set_target_git_plugin(tmpdir, ctlr):
+def test_set_repository_git_plugin(tmpdir, ctlr):
"""
- Test setting build target: existing git plugin
+ Test setting build repository: existing git plugin
"""
plugin, git_plugin = instantiate(tmpdir, ctlr)
- plugin.set_target(git_plugin.plugin_name)
+ plugin.set_repository(git_plugin.plugin_name)
assert plugin.dist_path == os.path.join(git_plugin.checkout_path,
"dist", "*")
-def test_set_target_error(tmpdir, ctlr):
+def test_set_repository_error(tmpdir, ctlr):
"""
- Test setting invalid build target
+ Test setting invalid build repository
"""
plugin, git_plugin = instantiate(tmpdir, ctlr)
@@ -89,17 +89,17 @@ def test_set_target_error(tmpdir, ctlr):
# non existing path / plugin name
with pytest.raises(IOError):
- plugin.set_target("invalid target")
+ plugin.set_repository("invalid repository")
# invalid plugin type
with pytest.raises(TypeError):
- plugin.set_target("test_pypi")
+ plugin.set_repository("test_pypi")
- # no target
+ # no repository
with pytest.raises(ValueError):
- plugin.set_target(None)
+ plugin.set_repository(None)
def test_build_dist(tmpdir, ctlr):
@@ -110,7 +110,7 @@ def test_build_dist(tmpdir, ctlr):
plugin, git_plugin = instantiate(tmpdir, ctlr)
plugin.prepare()
- plugin.set_target(git_plugin.plugin_name)
+ plugin.set_repository(git_plugin.plugin_name)
plugin._build_dist()
assert os.path.exists(os.path.join(git_plugin.checkout_path,
@@ -126,7 +126,7 @@ def test_validate_dist(tmpdir, ctlr):
plugin, git_plugin = instantiate(tmpdir, ctlr)
plugin.prepare()
- plugin.set_target(git_plugin.plugin_name)
+ plugin.set_repository(git_plugin.plugin_name)
plugin._build_dist()
plugin._validate_dist()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 2
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"codecov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"Ctl/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
cfu==1.5.0
charset-normalizer==2.0.12
click==8.0.4
codecov==2.1.13
coverage==6.2
-e git+https://github.com/20c/ctl.git@879af37647e61767a1ede59ffd353e4cfd27cd6f#egg=ctl
future==0.18.3
git-url-parse==1.2.2
grainy==1.8.1
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
munge==0.6.0
packaging==21.3
pbr==6.1.1
pluggy==1.0.0
pluginmgr==0.6.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
PyYAML==6.0.1
requests==2.27.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: ctl
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cfu==1.5.0
- charset-normalizer==2.0.12
- click==8.0.4
- codecov==2.1.13
- coverage==6.2
- future==0.18.3
- git-url-parse==1.2.2
- grainy==1.8.1
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- munge==0.6.0
- packaging==21.3
- pbr==6.1.1
- pluggy==1.0.0
- pluginmgr==0.6.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pyyaml==6.0.1
- requests==2.27.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/ctl
|
[
"tests/test_plugin_pypi.py::test_set_repository_git_path[standard]",
"tests/test_plugin_pypi.py::test_set_repository_git_plugin[standard]",
"tests/test_plugin_pypi.py::test_set_repository_error[standard]"
] |
[
"tests/test_plugin_pypi.py::test_build_dist[standard]",
"tests/test_plugin_pypi.py::test_validate_dist[standard]"
] |
[
"tests/test_plugin_pypi.py::test_init"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.20c_1776_ctl-3
|
|
20c__ctl-7
|
be7f350f8f2d92918922d82fce0266fcd72decd2
|
2019-10-21 11:05:40
|
be7f350f8f2d92918922d82fce0266fcd72decd2
|
diff --git a/Ctl/Pipfile b/Ctl/Pipfile
index 0c7a304..1bd6308 100644
--- a/Ctl/Pipfile
+++ b/Ctl/Pipfile
@@ -14,7 +14,7 @@ tmpl = "==0.3.0"
[packages]
munge = "<1,>=0.4"
-cfu = ">=1.2.0,<2"
+cfu = ">=1.3.0,<2"
grainy = ">=1.4.0,<2"
git-url-parse = ">=1.1.0,<2"
pluginmgr = ">=0.6"
diff --git a/Ctl/requirements.txt b/Ctl/requirements.txt
index b3582c5..0037aaa 100644
--- a/Ctl/requirements.txt
+++ b/Ctl/requirements.txt
@@ -1,5 +1,5 @@
munge >=0.4, <1
-cfu >= 1.2.0, < 2
+cfu >= 1.3.0, < 2
grainy >= 1.4.0, <2
git-url-parse >= 1.1.0, <2
pluginmgr >= 0.6
diff --git a/src/ctl/__init__.py b/src/ctl/__init__.py
index eb4a635..b9616df 100644
--- a/src/ctl/__init__.py
+++ b/src/ctl/__init__.py
@@ -4,6 +4,7 @@ import os
from pkg_resources import get_distribution
import confu.config
+import confu.exceptions
import grainy.core
import copy
import logging
@@ -279,11 +280,14 @@ class Ctl(object):
# def set_config_dir(self):
def __init__(self, ctx=None, config_dir=None, full_init=True):
- self.init_context(ctx=ctx, config_dir=config_dir)
+ self.init_context(ctx=ctx, config_dir=config_dir)
self.init_logging()
- self.init_permissions()
+ if self.config.errors:
+ return self.log_config_issues()
+
+ self.init_permissions()
self.expose_plugin_vars()
if full_init:
@@ -330,8 +334,10 @@ class Ctl(object):
Apply python logging config and create `log` and `usage_log`
properties
"""
+
# allow setting up python logging from ctl config
set_pylogger_config(self.ctx.config.get_nested("ctl", "log"))
+
# instantiate logger
self.log = Log("ctl")
self.usage_log = Log("usage")
diff --git a/src/ctl/plugins/tmp b/src/ctl/plugins/tmp
new file mode 100644
index 0000000..41bd689
--- /dev/null
+++ b/src/ctl/plugins/tmp
@@ -0,0 +1,57 @@
+plugins:
+
+ # plugin that controls the repo we want to install from
+ - type: git
+ name: git_fullctl
+ config:
+ repo_url: [email protected]:fullctl/www.fullctl.com
+
+
+ # copy files
+ - type: copy
+ name: copy_fullctl
+ config:
+ src: {{tmp}}/[email protected]:fullctl/www.fullctl.com
+ dest: {{tmp}}/builds/www.fullctl.com/{{tag}}
+ walk_dirs:
+ - {{src}}/fullctl/website
+ - {{src}}/fullctl/ixportal
+
+
+ # template files
+ - type: template
+ name: template_fullctl
+ config:
+ src: {{tmp}}/[email protected]:fullctl/www.fullctl.com
+ dest: {{tmp}}/builds/www.fullctl.com/{{tag}}/fullctl
+ walk_dirs:
+ - {{src}}Ctl/fullctl/templates
+ vars:
+ - {{src}}/Ctl/fullctl/{{env}}.yaml
+
+
+ # rsync
+ - type: rsync
+ name: rsync_fullctl
+ config:
+ gateways:
+ beta:
+ - host: 127.0.0.1
+ user: fullctl
+
+ # run installation sequence
+ - type: chain
+ name: facsimile
+ config:
+ chains:
+ beta:
+ # stage `git` - checks out the tag passed in the cli
+ - git_fullctl checkout {{tag}}
+ # stage `copy` - copy project files
+ - copy_fullctl beta {{tag}}
+ # stage `template` - build template files
+ - template_fullctl beta {{tag}}
+ # stage `rsync`
+ - rsync_fullctl beta {{tmp}}/builds/www.fullctl.com/{{tag}}
+
+
diff --git a/src/ctl/util/versioning.py b/src/ctl/util/versioning.py
index 22bdb09..23e1390 100644
--- a/src/ctl/util/versioning.py
+++ b/src/ctl/util/versioning.py
@@ -1,5 +1,4 @@
def version_tuple(version):
- print("VERSION", version)
""" Returns a tuple from version string """
return tuple(version.split("."))
@@ -9,27 +8,35 @@ def version_string(version):
return ".".join(["{}".format(v) for v in version])
-def validate_semantic(version):
+def validate_semantic(version, pad=0):
if not isinstance(version, (list, tuple)):
version = version_tuple(version)
- try:
- major, minor, patch, dev = version
- except ValueError:
- major, minor, patch = version
+ parts = len(version)
+
+ if parts < 1:
+ raise ValueError("Semantic version needs to contain at least a major version")
+ if parts > 4:
+ raise ValueError("Semantic version can not contain more than 4 parts")
+
+ if parts < pad:
+ version = tuple(list(version) + [0 for i in range(0, pad - parts)])
return tuple([int(n) for n in version])
def bump_semantic(version, segment):
- version = list(validate_semantic(version))
if segment == "major":
+ version = list(validate_semantic(version))
return (version[0] + 1, 0, 0)
elif segment == "minor":
+ version = list(validate_semantic(version, pad=2))
return (version[0], version[1] + 1, 0)
elif segment == "patch":
+ version = list(validate_semantic(version, pad=3))
return (version[0], version[1], version[2] + 1)
elif segment == "dev":
+ version = list(validate_semantic(version, pad=4))
try:
return (version[0], version[1], version[2], version[3] + 1)
except IndexError:
|
Better error handling for config errors outside of `plugins`
Example: having a schema error in `permissions` exits ctl with traceback that's not very telling as to what is failing
reproduce:
```
permissions:
namespace: ctl
permission: crud
```
|
20c/ctl
|
diff --git a/tests/test_plugin_version.py b/tests/test_plugin_version.py
index 6745c78..4b9617a 100644
--- a/tests/test_plugin_version.py
+++ b/tests/test_plugin_version.py
@@ -138,6 +138,30 @@ def test_bump(tmpdir, ctlr):
plugin.bump(version="invalid", repo="dummy_repo")
+def test_bump_truncated(tmpdir, ctlr):
+ plugin, dummy_repo = instantiate(tmpdir, ctlr)
+ plugin.tag(version="1.0", repo="dummy_repo")
+
+ plugin.bump(version="minor", repo="dummy_repo")
+ assert dummy_repo.version == ("1", "1", "0")
+ assert dummy_repo._tag == "1.1.0"
+
+ plugin.tag(version="1.0", repo="dummy_repo")
+ plugin.bump(version="patch", repo="dummy_repo")
+ assert dummy_repo.version == ("1", "0", "1")
+ assert dummy_repo._tag == "1.0.1"
+
+ plugin.tag(version="2", repo="dummy_repo")
+ plugin.bump(version="patch", repo="dummy_repo")
+ assert dummy_repo.version == ("2", "0", "1")
+ assert dummy_repo._tag == "2.0.1"
+
+ plugin.tag(version="3", repo="dummy_repo")
+ plugin.bump(version="major", repo="dummy_repo")
+ assert dummy_repo.version == ("4", "0", "0")
+ assert dummy_repo._tag == "4.0.0"
+
+
def test_execute(tmpdir, ctlr):
plugin, dummy_repo = instantiate(tmpdir, ctlr)
plugin.execute(op="tag", version="1.0.0", repository="dummy_repo", init=True)
diff --git a/tests/test_util_versioning.py b/tests/test_util_versioning.py
index b89df79..6624816 100644
--- a/tests/test_util_versioning.py
+++ b/tests/test_util_versioning.py
@@ -19,7 +19,7 @@ def test_version_tuple(version, string):
((1, 0, 0), (1, 0, 0), None),
("1.0.0.0", (1, 0, 0, 0), None),
((1, 0, 0, 0), (1, 0, 0, 0), None),
- ("1.0", None, ValueError),
+ ("1.0", (1, 0), None),
("a.b.c", None, ValueError),
],
)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 4
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"Ctl/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
cfu==1.5.0
charset-normalizer==2.0.12
click==8.0.4
coverage==6.2
-e git+https://github.com/20c/ctl.git@be7f350f8f2d92918922d82fce0266fcd72decd2#egg=ctl
future==0.18.3
git-url-parse==1.2.2
grainy==1.8.1
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
munge==0.6.0
packaging==21.3
pbr==6.1.1
pluggy==1.0.0
pluginmgr==0.6.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
PyYAML==6.0.1
requests==2.27.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: ctl
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cfu==1.5.0
- charset-normalizer==2.0.12
- click==8.0.4
- coverage==6.2
- future==0.18.3
- git-url-parse==1.2.2
- grainy==1.8.1
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- munge==0.6.0
- packaging==21.3
- pbr==6.1.1
- pluggy==1.0.0
- pluginmgr==0.6.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pyyaml==6.0.1
- requests==2.27.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/ctl
|
[
"tests/test_plugin_version.py::test_bump_truncated[standard]",
"tests/test_util_versioning.py::test_validate_semantic[1.0-expected4-None]"
] |
[] |
[
"tests/test_plugin_version.py::test_init",
"tests/test_plugin_version.py::test_repository[standard]",
"tests/test_plugin_version.py::test_tag[standard]",
"tests/test_plugin_version.py::test_bump[standard]",
"tests/test_plugin_version.py::test_execute[standard]",
"tests/test_plugin_version.py::test_execute_permissions[permission_denied]",
"tests/test_util_versioning.py::test_version_tuple[version0-1.0.0]",
"tests/test_util_versioning.py::test_validate_semantic[1.0.0-expected0-None]",
"tests/test_util_versioning.py::test_validate_semantic[version1-expected1-None]",
"tests/test_util_versioning.py::test_validate_semantic[1.0.0.0-expected2-None]",
"tests/test_util_versioning.py::test_validate_semantic[version3-expected3-None]",
"tests/test_util_versioning.py::test_validate_semantic[a.b.c-None-ValueError]",
"tests/test_util_versioning.py::test_bump_semantic[1.2.3.4-major-expected0]",
"tests/test_util_versioning.py::test_bump_semantic[1.2.3-minor-expected1]",
"tests/test_util_versioning.py::test_bump_semantic[1.2.3.4-patch-expected2]",
"tests/test_util_versioning.py::test_bump_semantic[1.2.3.4-dev-expected3]"
] |
[] |
Apache License 2.0
| null |
|
20c__munge-15
|
882070dbec6a3600217e406c9501091d8c27feab
|
2021-05-30 00:41:39
|
882070dbec6a3600217e406c9501091d8c27feab
|
lgtm-com[bot]: This pull request **introduces 3 alerts** when merging d7aa2690b71bd7b42f81e7005434d6e5925af783 into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-88a56d100d93b266882122d87962bf72e675324f)
**new alerts:**
* 3 for Unused import
codecov-commenter: # [Codecov](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c) Report
> Merging [#15](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c) (716b825) into [master](https://codecov.io/gh/20c/munge/commit/882070dbec6a3600217e406c9501091d8c27feab?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c) (882070d) will **decrease** coverage by `1.10%`.
> The diff coverage is `61.76%`.
[](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c)
```diff
@@ Coverage Diff @@
## master #15 +/- ##
==========================================
- Coverage 83.05% 81.94% -1.11%
==========================================
Files 13 14 +1
Lines 472 493 +21
==========================================
+ Hits 392 404 +12
- Misses 80 89 +9
```
| [Impacted Files](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c) | Coverage Δ | |
|---|---|---|
| [src/munge/codec/toml\_tomlkit.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2NvZGVjL3RvbWxfdG9tbGtpdC5weQ==) | `25.00% <25.00%> (ø)` | |
| [src/munge/codec/\_\_init\_\_.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2NvZGVjL19faW5pdF9fLnB5) | `97.77% <50.00%> (ø)` | |
| [src/munge/codec/toml.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2NvZGVjL3RvbWwucHk=) | `50.00% <50.00%> (-34.22%)` | :arrow_down: |
| [src/munge/codec/yaml.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2NvZGVjL3lhbWwucHk=) | `84.21% <81.25%> (ø)` | |
| [src/munge/codec/toml\_toml.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2NvZGVjL3RvbWxfdG9tbC5weQ==) | `84.21% <84.21%> (ø)` | |
| [src/munge/base.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2Jhc2UucHk=) | `84.61% <100.00%> (+0.30%)` | :arrow_up: |
| [src/munge/codec/json.py](https://codecov.io/gh/20c/munge/pull/15/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c#diff-c3JjL211bmdlL2NvZGVjL2pzb24ucHk=) | `88.88% <100.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c). Last update [882070d...716b825](https://codecov.io/gh/20c/munge/pull/15?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=20c).
lgtm-com[bot]: This pull request **introduces 3 alerts** when merging 716b825f84f9e10191342a8f0f722e10ef096f6e into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-f607610b86906a14ad80056a38c44879c6062a11)
**new alerts:**
* 3 for Unused import
lgtm-com[bot]: This pull request **introduces 3 alerts** and **fixes 1** when merging 7c3d4f3836c289ae05ec9193b92707eb5337fa8d into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-a36aed7947711b9c1dbcda16d06fc3136e112306)
**new alerts:**
* 3 for Unused import
**fixed alerts:**
* 1 for Unused import
lgtm-com[bot]: This pull request **introduces 3 alerts** and **fixes 1** when merging 5d229691d2eb82a6f5c63f04ae83d0c9a92dc067 into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-7d52adb374215ea7ec747a102c9b5a726927ab49)
**new alerts:**
* 3 for Unused import
**fixed alerts:**
* 1 for Unused import
lgtm-com[bot]: This pull request **introduces 3 alerts** and **fixes 1** when merging b8f6250131b6fcc14277618850495f73749d7043 into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-c0983bc255bd32091fe682120620b915ef8d8332)
**new alerts:**
* 3 for Unused import
**fixed alerts:**
* 1 for Unused import
lgtm-com[bot]: This pull request **introduces 2 alerts** and **fixes 1** when merging ddebdac91a19681ff229d8aaec5d53f3b122542b into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-acd34e70c1c474773ea2b3fc6dff8f71dc48087f)
**new alerts:**
* 2 for Unused import
**fixed alerts:**
* 1 for Unused import
lgtm-com[bot]: This pull request **introduces 2 alerts** and **fixes 1** when merging b83f3e2a80d456f8bf554887f659c67f506bdf41 into 882070dbec6a3600217e406c9501091d8c27feab - [view on LGTM.com](https://lgtm.com/projects/g/20c/munge/rev/pr-0f6630bb33ccdc6e76c60263a4995e61e0349975)
**new alerts:**
* 2 for Unused import
**fixed alerts:**
* 1 for Unused import
|
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index feee7f9..f2b20e7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,4 +1,3 @@
-fail_fast: true
repos:
- repo: local
hooks:
@@ -21,4 +20,12 @@ repos:
name: Black
entry: poetry run black .
language: system
- pass_filenames: false
\ No newline at end of file
+ pass_filenames: false
+# the namespace imports for meta all trigger
+# - repo: local
+# hooks:
+# - id: system
+# name: flake8
+# entry: poetry run flake8 src/
+# language: system
+# pass_filenames: false
\ No newline at end of file
diff --git a/CHANGELOG.yaml b/CHANGELOG.yaml
index 24ed2ba..6cf41c8 100644
--- a/CHANGELOG.yaml
+++ b/CHANGELOG.yaml
@@ -48,7 +48,10 @@ Unreleased:
- download and repo urls to setup.py (#10)
- toml support
- extras
- changed: []
+ - roundtrip support
+ - support for typed codecs (#3)
+ changed:
+ - don't sort keys by default in yaml
deprecated: []
fixed: []
removed: []
diff --git a/poetry.lock b/poetry.lock
index 1215c9a..a48625f 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -66,14 +66,38 @@ typing-extensions = ">=3.7.4"
colorama = ["colorama (>=0.4.3)"]
d = ["aiohttp (>=3.3.2)", "aiohttp-cors"]
+[[package]]
+name = "bleach"
+version = "3.3.0"
+description = "An easy safelist-based HTML-sanitizing tool."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
+[package.dependencies]
+packaging = "*"
+six = ">=1.9.0"
+webencodings = "*"
+
[[package]]
name = "certifi"
-version = "2020.12.5"
+version = "2021.5.30"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
python-versions = "*"
+[[package]]
+name = "cffi"
+version = "1.14.5"
+description = "Foreign Function Interface for Python calling C code."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+pycparser = "*"
+
[[package]]
name = "cfgv"
version = "3.0.0"
@@ -122,6 +146,14 @@ category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+[[package]]
+name = "confu"
+version = "1.7.1"
+description = "Configuration file validation and generation"
+category = "dev"
+optional = false
+python-versions = ">=3.6,<4.0"
+
[[package]]
name = "coverage"
version = "5.5"
@@ -130,11 +162,42 @@ category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
+[package.extras]
+toml = ["toml"]
+
+[[package]]
+name = "cryptography"
+version = "3.4.7"
+description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
[package.dependencies]
-toml = {version = "*", optional = true, markers = "extra == \"toml\""}
+cffi = ">=1.12"
[package.extras]
-toml = ["toml"]
+docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx-rtd-theme"]
+docstest = ["doc8", "pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"]
+pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"]
+sdist = ["setuptools-rust (>=0.11.4)"]
+ssh = ["bcrypt (>=3.1.5)"]
+test = ["pytest (>=6.0)", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"]
+
+[[package]]
+name = "ctl"
+version = "1.0.0"
+description = "Full control of your environment"
+category = "dev"
+optional = false
+python-versions = ">=3.6,<4.0"
+
+[package.dependencies]
+confu = ">=1.4,<2.0"
+git-url-parse = ">=1.1,<2.0"
+grainy = ">=1.4,<2.0"
+munge = ">=1,<2"
+pluginmgr = ">=1,<2"
[[package]]
name = "dataclasses"
@@ -146,12 +209,20 @@ python-versions = ">=3.6, <3.7"
[[package]]
name = "distlib"
-version = "0.3.1"
+version = "0.3.2"
description = "Distribution utilities"
category = "dev"
optional = false
python-versions = "*"
+[[package]]
+name = "docutils"
+version = "0.17.1"
+description = "Docutils -- Python Documentation Utilities"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
[[package]]
name = "filelock"
version = "3.0.12"
@@ -174,6 +245,25 @@ mccabe = ">=0.6.0,<0.7.0"
pycodestyle = ">=2.7.0,<2.8.0"
pyflakes = ">=2.3.0,<2.4.0"
+[[package]]
+name = "future"
+version = "0.18.2"
+description = "Clean single-source support for Python 3 and 2"
+category = "dev"
+optional = false
+python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
+
+[[package]]
+name = "git-url-parse"
+version = "1.2.2"
+description = "git-url-parse - A simple GIT URL parser."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+pbr = "*"
+
[[package]]
name = "gitdb"
version = "4.0.7"
@@ -187,16 +277,24 @@ smmap = ">=3.0.1,<5"
[[package]]
name = "gitpython"
-version = "3.1.17"
+version = "3.1.18"
description = "Python Git Library"
category = "dev"
optional = false
-python-versions = ">=3.5"
+python-versions = ">=3.6"
[package.dependencies]
gitdb = ">=4.0.1,<5"
typing-extensions = {version = ">=3.7.4.0", markers = "python_version < \"3.8\""}
+[[package]]
+name = "grainy"
+version = "1.8.1"
+description = "granular permissions utility"
+category = "dev"
+optional = false
+python-versions = ">=3.6,<4.0"
+
[[package]]
name = "identify"
version = "1.6.2"
@@ -218,7 +316,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "importlib-metadata"
-version = "4.3.1"
+version = "4.5.0"
description = "Read metadata from Python packages"
category = "main"
optional = false
@@ -268,6 +366,57 @@ pipfile_deprecated_finder = ["pipreqs", "requirementslib"]
requirements_deprecated_finder = ["pipreqs", "pip-api"]
colors = ["colorama (>=0.4.3,<0.5.0)"]
+[[package]]
+name = "jeepney"
+version = "0.6.0"
+description = "Low-level, pure Python DBus protocol wrapper."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.extras]
+test = ["pytest", "pytest-trio", "pytest-asyncio", "testpath", "trio"]
+
+[[package]]
+name = "jinja2"
+version = "2.11.3"
+description = "A very fast and expressive template engine."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
+[package.dependencies]
+MarkupSafe = ">=0.23"
+
+[package.extras]
+i18n = ["Babel (>=0.8)"]
+
+[[package]]
+name = "keyring"
+version = "23.0.1"
+description = "Store and access your passwords safely."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+importlib-metadata = ">=3.6"
+jeepney = {version = ">=0.4.2", markers = "sys_platform == \"linux\""}
+pywin32-ctypes = {version = "<0.1.0 || >0.1.0,<0.1.1 || >0.1.1", markers = "sys_platform == \"win32\""}
+SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""}
+
+[package.extras]
+docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
+testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"]
+
+[[package]]
+name = "markupsafe"
+version = "2.0.1"
+description = "Safely add untrusted strings to HTML/XML markup."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
[[package]]
name = "mccabe"
version = "0.6.1"
@@ -335,6 +484,17 @@ category = "dev"
optional = false
python-versions = ">=2.6"
+[[package]]
+name = "pkginfo"
+version = "1.7.0"
+description = "Query metadatdata from sdists / bdists / installed packages."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.extras]
+testing = ["nose", "coverage"]
+
[[package]]
name = "pluggy"
version = "0.13.1"
@@ -349,6 +509,17 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
[package.extras]
dev = ["pre-commit", "tox"]
+[[package]]
+name = "pluginmgr"
+version = "1.0.1"
+description = "lightweight python plugin system supporting config inheritance"
+category = "dev"
+optional = false
+python-versions = ">=3.6,<4.0"
+
+[package.dependencies]
+munge = ">=1.0.0,<2.0.0"
+
[[package]]
name = "pre-commit"
version = "2.1.1"
@@ -383,6 +554,14 @@ category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+[[package]]
+name = "pycparser"
+version = "2.20"
+description = "C parser in Python"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
[[package]]
name = "pyflakes"
version = "2.3.1"
@@ -391,6 +570,14 @@ category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+[[package]]
+name = "pygments"
+version = "2.9.0"
+description = "Pygments is a syntax highlighting package written in Python."
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
[[package]]
name = "pyparsing"
version = "2.4.7"
@@ -423,18 +610,19 @@ testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xm
[[package]]
name = "pytest-cov"
-version = "2.12.0"
+version = "2.12.1"
description = "Pytest plugin for measuring coverage."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[package.dependencies]
-coverage = {version = ">=5.2.1", extras = ["toml"]}
+coverage = ">=5.2.1"
pytest = ">=4.6"
+toml = "*"
[package.extras]
-testing = ["fields", "hunter", "process-tests (==2.0.2)", "six", "pytest-xdist", "virtualenv"]
+testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"]
[[package]]
name = "pyupgrade"
@@ -447,6 +635,14 @@ python-versions = ">=3.6"
[package.dependencies]
tokenize-rt = ">=3.2.0"
+[[package]]
+name = "pywin32-ctypes"
+version = "0.2.0"
+description = ""
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "pyyaml"
version = "5.4.1"
@@ -455,6 +651,23 @@ category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
+[[package]]
+name = "readme-renderer"
+version = "29.0"
+description = "readme_renderer is a library for rendering \"readme\" descriptions for Warehouse"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+bleach = ">=2.1.0"
+docutils = ">=0.13.1"
+Pygments = ">=2.5.1"
+six = "*"
+
+[package.extras]
+md = ["cmarkgfm (>=0.5.0,<0.6.0)"]
+
[[package]]
name = "regex"
version = "2021.4.4"
@@ -481,6 +694,40 @@ urllib3 = ">=1.21.1,<1.27"
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
+[[package]]
+name = "requests-toolbelt"
+version = "0.9.1"
+description = "A utility belt for advanced users of python-requests"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+requests = ">=2.0.1,<3.0.0"
+
+[[package]]
+name = "rfc3986"
+version = "1.5.0"
+description = "Validating URI References per RFC 3986"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.extras]
+idna2008 = ["idna"]
+
+[[package]]
+name = "secretstorage"
+version = "3.3.1"
+description = "Python bindings to FreeDesktop.org Secret Service API"
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+cryptography = ">=2.0"
+jeepney = ">=0.6"
+
[[package]]
name = "six"
version = "1.16.0"
@@ -509,6 +756,17 @@ python-versions = ">=3.6"
importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""}
pbr = ">=2.0.0,<2.1.0 || >2.1.0"
+[[package]]
+name = "tmpl"
+version = "0.3.0"
+description = "template abstraction and helper functions"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+future = "*"
+
[[package]]
name = "tokenize-rt"
version = "3.2.0"
@@ -525,6 +783,14 @@ category = "main"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
+[[package]]
+name = "tomlkit"
+version = "0.7.2"
+description = "Style preserving TOML library"
+category = "main"
+optional = true
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
[[package]]
name = "tox"
version = "3.23.1"
@@ -548,6 +814,38 @@ virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,
docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"]
testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "pytest-xdist (>=1.22.2)", "pathlib2 (>=2.3.3)"]
+[[package]]
+name = "tqdm"
+version = "4.61.1"
+description = "Fast, Extensible Progress Meter"
+category = "dev"
+optional = false
+python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
+
+[package.extras]
+dev = ["py-make (>=0.1.0)", "twine", "wheel"]
+notebook = ["ipywidgets (>=6)"]
+telegram = ["requests"]
+
+[[package]]
+name = "twine"
+version = "3.4.1"
+description = "Collection of utilities for publishing packages on PyPI"
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+colorama = ">=0.4.3"
+importlib-metadata = ">=3.6"
+keyring = ">=15.1"
+pkginfo = ">=1.4.2"
+readme-renderer = ">=21.0"
+requests = ">=2.20"
+requests-toolbelt = ">=0.8.0,<0.9.0 || >0.9.0"
+rfc3986 = ">=1.4.0"
+tqdm = ">=4.14"
+
[[package]]
name = "typed-ast"
version = "1.4.3"
@@ -597,6 +895,14 @@ six = ">=1.9.0,<2"
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"]
testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)", "xonsh (>=0.9.16)"]
+[[package]]
+name = "webencodings"
+version = "0.5.1"
+description = "Character encoding aliases for legacy web content"
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "zipp"
version = "3.4.1"
@@ -611,12 +917,13 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt
[extras]
toml = ["toml"]
+tomlkit = ["tomlkit"]
yaml = ["PyYAML"]
[metadata]
lock-version = "1.1"
python-versions = "^3.6"
-content-hash = "961b75ae9f24db41ba75ea1a5398152cbb8020c68eb38799bd6deeb302f19154"
+content-hash = "58066456f0b29d7e3aaa07220e88fecd984703a8d2b458d92ccdbf69190cb35a"
[metadata.files]
appdirs = [
@@ -638,9 +945,52 @@ bandit = [
black = [
{file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"},
]
+bleach = [
+ {file = "bleach-3.3.0-py2.py3-none-any.whl", hash = "sha256:6123ddc1052673e52bab52cdc955bcb57a015264a1c57d37bea2f6b817af0125"},
+ {file = "bleach-3.3.0.tar.gz", hash = "sha256:98b3170739e5e83dd9dc19633f074727ad848cbedb6026708c8ac2d3b697a433"},
+]
certifi = [
- {file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"},
- {file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"},
+ {file = "certifi-2021.5.30-py2.py3-none-any.whl", hash = "sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8"},
+ {file = "certifi-2021.5.30.tar.gz", hash = "sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee"},
+]
+cffi = [
+ {file = "cffi-1.14.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:bb89f306e5da99f4d922728ddcd6f7fcebb3241fc40edebcb7284d7514741991"},
+ {file = "cffi-1.14.5-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:34eff4b97f3d982fb93e2831e6750127d1355a923ebaeeb565407b3d2f8d41a1"},
+ {file = "cffi-1.14.5-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:99cd03ae7988a93dd00bcd9d0b75e1f6c426063d6f03d2f90b89e29b25b82dfa"},
+ {file = "cffi-1.14.5-cp27-cp27m-win32.whl", hash = "sha256:65fa59693c62cf06e45ddbb822165394a288edce9e276647f0046e1ec26920f3"},
+ {file = "cffi-1.14.5-cp27-cp27m-win_amd64.whl", hash = "sha256:51182f8927c5af975fece87b1b369f722c570fe169f9880764b1ee3bca8347b5"},
+ {file = "cffi-1.14.5-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:43e0b9d9e2c9e5d152946b9c5fe062c151614b262fda2e7b201204de0b99e482"},
+ {file = "cffi-1.14.5-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:cbde590d4faaa07c72bf979734738f328d239913ba3e043b1e98fe9a39f8b2b6"},
+ {file = "cffi-1.14.5-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:5de7970188bb46b7bf9858eb6890aad302577a5f6f75091fd7cdd3ef13ef3045"},
+ {file = "cffi-1.14.5-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:a465da611f6fa124963b91bf432d960a555563efe4ed1cc403ba5077b15370aa"},
+ {file = "cffi-1.14.5-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:d42b11d692e11b6634f7613ad8df5d6d5f8875f5d48939520d351007b3c13406"},
+ {file = "cffi-1.14.5-cp35-cp35m-win32.whl", hash = "sha256:72d8d3ef52c208ee1c7b2e341f7d71c6fd3157138abf1a95166e6165dd5d4369"},
+ {file = "cffi-1.14.5-cp35-cp35m-win_amd64.whl", hash = "sha256:29314480e958fd8aab22e4a58b355b629c59bf5f2ac2492b61e3dc06d8c7a315"},
+ {file = "cffi-1.14.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:3d3dd4c9e559eb172ecf00a2a7517e97d1e96de2a5e610bd9b68cea3925b4892"},
+ {file = "cffi-1.14.5-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:48e1c69bbacfc3d932221851b39d49e81567a4d4aac3b21258d9c24578280058"},
+ {file = "cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:69e395c24fc60aad6bb4fa7e583698ea6cc684648e1ffb7fe85e3c1ca131a7d5"},
+ {file = "cffi-1.14.5-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:9e93e79c2551ff263400e1e4be085a1210e12073a31c2011dbbda14bda0c6132"},
+ {file = "cffi-1.14.5-cp36-cp36m-win32.whl", hash = "sha256:58e3f59d583d413809d60779492342801d6e82fefb89c86a38e040c16883be53"},
+ {file = "cffi-1.14.5-cp36-cp36m-win_amd64.whl", hash = "sha256:005a36f41773e148deac64b08f233873a4d0c18b053d37da83f6af4d9087b813"},
+ {file = "cffi-1.14.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2894f2df484ff56d717bead0a5c2abb6b9d2bf26d6960c4604d5c48bbc30ee73"},
+ {file = "cffi-1.14.5-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:0857f0ae312d855239a55c81ef453ee8fd24136eaba8e87a2eceba644c0d4c06"},
+ {file = "cffi-1.14.5-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:cd2868886d547469123fadc46eac7ea5253ea7fcb139f12e1dfc2bbd406427d1"},
+ {file = "cffi-1.14.5-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:35f27e6eb43380fa080dccf676dece30bef72e4a67617ffda586641cd4508d49"},
+ {file = "cffi-1.14.5-cp37-cp37m-win32.whl", hash = "sha256:9ff227395193126d82e60319a673a037d5de84633f11279e336f9c0f189ecc62"},
+ {file = "cffi-1.14.5-cp37-cp37m-win_amd64.whl", hash = "sha256:9cf8022fb8d07a97c178b02327b284521c7708d7c71a9c9c355c178ac4bbd3d4"},
+ {file = "cffi-1.14.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8b198cec6c72df5289c05b05b8b0969819783f9418e0409865dac47288d2a053"},
+ {file = "cffi-1.14.5-cp38-cp38-manylinux1_i686.whl", hash = "sha256:ad17025d226ee5beec591b52800c11680fca3df50b8b29fe51d882576e039ee0"},
+ {file = "cffi-1.14.5-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:6c97d7350133666fbb5cf4abdc1178c812cb205dc6f41d174a7b0f18fb93337e"},
+ {file = "cffi-1.14.5-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:8ae6299f6c68de06f136f1f9e69458eae58f1dacf10af5c17353eae03aa0d827"},
+ {file = "cffi-1.14.5-cp38-cp38-win32.whl", hash = "sha256:b85eb46a81787c50650f2392b9b4ef23e1f126313b9e0e9013b35c15e4288e2e"},
+ {file = "cffi-1.14.5-cp38-cp38-win_amd64.whl", hash = "sha256:1f436816fc868b098b0d63b8920de7d208c90a67212546d02f84fe78a9c26396"},
+ {file = "cffi-1.14.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1071534bbbf8cbb31b498d5d9db0f274f2f7a865adca4ae429e147ba40f73dea"},
+ {file = "cffi-1.14.5-cp39-cp39-manylinux1_i686.whl", hash = "sha256:9de2e279153a443c656f2defd67769e6d1e4163952b3c622dcea5b08a6405322"},
+ {file = "cffi-1.14.5-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:6e4714cc64f474e4d6e37cfff31a814b509a35cb17de4fb1999907575684479c"},
+ {file = "cffi-1.14.5-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:158d0d15119b4b7ff6b926536763dc0714313aa59e320ddf787502c70c4d4bee"},
+ {file = "cffi-1.14.5-cp39-cp39-win32.whl", hash = "sha256:afb29c1ba2e5a3736f1c301d9d0abe3ec8b86957d04ddfa9d7a6a42b9367e396"},
+ {file = "cffi-1.14.5-cp39-cp39-win_amd64.whl", hash = "sha256:f2d45f97ab6bb54753eab54fffe75aaf3de4ff2341c9daee1987ee1837636f1d"},
+ {file = "cffi-1.14.5.tar.gz", hash = "sha256:fd78e5fee591709f32ef6edb9a015b4aa1a5022598e36227500c8f4e02328d9c"},
]
cfgv = [
{file = "cfgv-3.0.0-py2.py3-none-any.whl", hash = "sha256:f22b426ed59cd2ab2b54ff96608d846c33dfb8766a67f0b4a6ce130ce244414f"},
@@ -663,6 +1013,9 @@ colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
]
+confu = [
+ {file = "confu-1.7.1.tar.gz", hash = "sha256:b2302fac738ee23143fe1768053a1c63216928fa54d1bba2326282d1c0fe6de9"},
+]
coverage = [
{file = "coverage-5.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf"},
{file = "coverage-5.5-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b"},
@@ -717,13 +1070,35 @@ coverage = [
{file = "coverage-5.5-pp37-none-any.whl", hash = "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4"},
{file = "coverage-5.5.tar.gz", hash = "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"},
]
+cryptography = [
+ {file = "cryptography-3.4.7-cp36-abi3-macosx_10_10_x86_64.whl", hash = "sha256:3d8427734c781ea5f1b41d6589c293089704d4759e34597dce91014ac125aad1"},
+ {file = "cryptography-3.4.7-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:8e56e16617872b0957d1c9742a3f94b43533447fd78321514abbe7db216aa250"},
+ {file = "cryptography-3.4.7-cp36-abi3-manylinux2010_x86_64.whl", hash = "sha256:37340614f8a5d2fb9aeea67fd159bfe4f5f4ed535b1090ce8ec428b2f15a11f2"},
+ {file = "cryptography-3.4.7-cp36-abi3-manylinux2014_aarch64.whl", hash = "sha256:240f5c21aef0b73f40bb9f78d2caff73186700bf1bc6b94285699aff98cc16c6"},
+ {file = "cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl", hash = "sha256:1e056c28420c072c5e3cb36e2b23ee55e260cb04eee08f702e0edfec3fb51959"},
+ {file = "cryptography-3.4.7-cp36-abi3-win32.whl", hash = "sha256:0f1212a66329c80d68aeeb39b8a16d54ef57071bf22ff4e521657b27372e327d"},
+ {file = "cryptography-3.4.7-cp36-abi3-win_amd64.whl", hash = "sha256:de4e5f7f68220d92b7637fc99847475b59154b7a1b3868fb7385337af54ac9ca"},
+ {file = "cryptography-3.4.7-pp36-pypy36_pp73-manylinux2010_x86_64.whl", hash = "sha256:26965837447f9c82f1855e0bc8bc4fb910240b6e0d16a664bb722df3b5b06873"},
+ {file = "cryptography-3.4.7-pp36-pypy36_pp73-manylinux2014_x86_64.whl", hash = "sha256:eb8cc2afe8b05acbd84a43905832ec78e7b3873fb124ca190f574dca7389a87d"},
+ {file = "cryptography-3.4.7-pp37-pypy37_pp73-manylinux2010_x86_64.whl", hash = "sha256:7ec5d3b029f5fa2b179325908b9cd93db28ab7b85bb6c1db56b10e0b54235177"},
+ {file = "cryptography-3.4.7-pp37-pypy37_pp73-manylinux2014_x86_64.whl", hash = "sha256:ee77aa129f481be46f8d92a1a7db57269a2f23052d5f2433b4621bb457081cc9"},
+ {file = "cryptography-3.4.7.tar.gz", hash = "sha256:3d10de8116d25649631977cb37da6cbdd2d6fa0e0281d014a5b7d337255ca713"},
+]
+ctl = [
+ {file = "ctl-1.0.0-py3-none-any.whl", hash = "sha256:776d490062c35dd413c929e7f7b4829142b4bf2cc03ddd9002899c0f7da1efaa"},
+ {file = "ctl-1.0.0.tar.gz", hash = "sha256:5e39e9e9505db18e1cd1ecf1f64530e7e900f625e4542545d66b3ad954e003b6"},
+]
dataclasses = [
{file = "dataclasses-0.8-py3-none-any.whl", hash = "sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf"},
{file = "dataclasses-0.8.tar.gz", hash = "sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97"},
]
distlib = [
- {file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"},
- {file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"},
+ {file = "distlib-0.3.2-py2.py3-none-any.whl", hash = "sha256:23e223426b28491b1ced97dc3bbe183027419dfc7982b4fa2f05d5f3ff10711c"},
+ {file = "distlib-0.3.2.zip", hash = "sha256:106fef6dc37dd8c0e2c0a60d3fca3e77460a48907f335fa28420463a6f799736"},
+]
+docutils = [
+ {file = "docutils-0.17.1-py2.py3-none-any.whl", hash = "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"},
+ {file = "docutils-0.17.1.tar.gz", hash = "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"},
]
filelock = [
{file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"},
@@ -733,13 +1108,24 @@ flake8 = [
{file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"},
{file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"},
]
+future = [
+ {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"},
+]
+git-url-parse = [
+ {file = "git-url-parse-1.2.2.tar.gz", hash = "sha256:7b5f4e3aeb1d693afeee67a3bd4ac063f7206c2e8e46e559f0da0da98445f117"},
+ {file = "git_url_parse-1.2.2-py2-none-any.whl", hash = "sha256:9353ff40d69488ff2299b27f40e0350ad87bd5348ea6ea09a1895eda9e5733de"},
+ {file = "git_url_parse-1.2.2-py3-none-any.whl", hash = "sha256:4655ee22f1d8bf7a1eb1066c1da16529b186966c6d8331f7f55686a76a9f7aef"},
+]
gitdb = [
{file = "gitdb-4.0.7-py3-none-any.whl", hash = "sha256:6c4cc71933456991da20917998acbe6cf4fb41eeaab7d6d67fbc05ecd4c865b0"},
{file = "gitdb-4.0.7.tar.gz", hash = "sha256:96bf5c08b157a666fec41129e6d327235284cca4c81e92109260f353ba138005"},
]
gitpython = [
- {file = "GitPython-3.1.17-py3-none-any.whl", hash = "sha256:29fe82050709760081f588dd50ce83504feddbebdc4da6956d02351552b1c135"},
- {file = "GitPython-3.1.17.tar.gz", hash = "sha256:ee24bdc93dce357630764db659edaf6b8d664d4ff5447ccfeedd2dc5c253f41e"},
+ {file = "GitPython-3.1.18-py3-none-any.whl", hash = "sha256:fce760879cd2aebd2991b3542876dc5c4a909b30c9d69dfc488e504a8db37ee8"},
+ {file = "GitPython-3.1.18.tar.gz", hash = "sha256:b838a895977b45ab6f0cc926a9045c8d1c44e2b653c1fcc39fe91f42c6e8f05b"},
+]
+grainy = [
+ {file = "grainy-1.8.1.tar.gz", hash = "sha256:2cfd8d50b3f5cce3c463f3c5e86324442f61a7cd46dfe7b134ee926559e56556"},
]
identify = [
{file = "identify-1.6.2-py2.py3-none-any.whl", hash = "sha256:8f9879b5b7cca553878d31548a419ec2f227d3328da92fe8202bc5e546d5cbc3"},
@@ -750,8 +1136,8 @@ idna = [
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
]
importlib-metadata = [
- {file = "importlib_metadata-4.3.1-py3-none-any.whl", hash = "sha256:c2e27fa8b6c8b34ebfcd4056ae2ca290e36250d1fbeceec85c1c67c711449fac"},
- {file = "importlib_metadata-4.3.1.tar.gz", hash = "sha256:2d932ea08814f745863fd20172fe7de4794ad74567db78f2377343e24520a5b6"},
+ {file = "importlib_metadata-4.5.0-py3-none-any.whl", hash = "sha256:833b26fb89d5de469b24a390e9df088d4e52e4ba33b01dc5e0e4f41b81a16c00"},
+ {file = "importlib_metadata-4.5.0.tar.gz", hash = "sha256:b142cc1dd1342f31ff04bb7d022492b09920cb64fed867cd3ea6f80fe3ebd139"},
]
importlib-resources = [
{file = "importlib_resources-5.1.4-py3-none-any.whl", hash = "sha256:e962bff7440364183203d179d7ae9ad90cb1f2b74dcb84300e88ecc42dca3351"},
@@ -765,6 +1151,54 @@ isort = [
{file = "isort-5.8.0-py3-none-any.whl", hash = "sha256:2bb1680aad211e3c9944dbce1d4ba09a989f04e238296c87fe2139faa26d655d"},
{file = "isort-5.8.0.tar.gz", hash = "sha256:0a943902919f65c5684ac4e0154b1ad4fac6dcaa5d9f3426b732f1c8b5419be6"},
]
+jeepney = [
+ {file = "jeepney-0.6.0-py3-none-any.whl", hash = "sha256:aec56c0eb1691a841795111e184e13cad504f7703b9a64f63020816afa79a8ae"},
+ {file = "jeepney-0.6.0.tar.gz", hash = "sha256:7d59b6622675ca9e993a6bd38de845051d315f8b0c72cca3aef733a20b648657"},
+]
+jinja2 = [
+ {file = "Jinja2-2.11.3-py2.py3-none-any.whl", hash = "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419"},
+ {file = "Jinja2-2.11.3.tar.gz", hash = "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"},
+]
+keyring = [
+ {file = "keyring-23.0.1-py3-none-any.whl", hash = "sha256:8f607d7d1cc502c43a932a275a56fe47db50271904513a379d39df1af277ac48"},
+ {file = "keyring-23.0.1.tar.gz", hash = "sha256:045703609dd3fccfcdb27da201684278823b72af515aedec1a8515719a038cb8"},
+]
+markupsafe = [
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"},
+ {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"},
+]
mccabe = [
{file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"},
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
@@ -813,10 +1247,18 @@ pbr = [
{file = "pbr-5.6.0-py2.py3-none-any.whl", hash = "sha256:c68c661ac5cc81058ac94247278eeda6d2e6aecb3e227b0387c30d277e7ef8d4"},
{file = "pbr-5.6.0.tar.gz", hash = "sha256:42df03e7797b796625b1029c0400279c7c34fd7df24a7d7818a1abb5b38710dd"},
]
+pkginfo = [
+ {file = "pkginfo-1.7.0-py2.py3-none-any.whl", hash = "sha256:9fdbea6495622e022cc72c2e5e1b735218e4ffb2a2a69cde2694a6c1f16afb75"},
+ {file = "pkginfo-1.7.0.tar.gz", hash = "sha256:029a70cb45c6171c329dfc890cde0879f8c52d6f3922794796e06f577bb03db4"},
+]
pluggy = [
{file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"},
{file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"},
]
+pluginmgr = [
+ {file = "pluginmgr-1.0.1-py3-none-any.whl", hash = "sha256:1f24786c2cac55e17f3496bd915b8c336792ecc9edb2b61ea5f73ce3a8a1eec9"},
+ {file = "pluginmgr-1.0.1.tar.gz", hash = "sha256:151c8afe8df535f2e02255433cd3340000b3428018692f0581ff53d6f74c3630"},
+]
pre-commit = [
{file = "pre_commit-2.1.1-py2.py3-none-any.whl", hash = "sha256:09ebe467f43ce24377f8c2f200fe3cd2570d328eb2ce0568c8e96ce19da45fa6"},
{file = "pre_commit-2.1.1.tar.gz", hash = "sha256:f8d555e31e2051892c7f7b3ad9f620bd2c09271d87e9eedb2ad831737d6211eb"},
@@ -829,10 +1271,18 @@ pycodestyle = [
{file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"},
{file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"},
]
+pycparser = [
+ {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"},
+ {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"},
+]
pyflakes = [
{file = "pyflakes-2.3.1-py2.py3-none-any.whl", hash = "sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3"},
{file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"},
]
+pygments = [
+ {file = "Pygments-2.9.0-py3-none-any.whl", hash = "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e"},
+ {file = "Pygments-2.9.0.tar.gz", hash = "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f"},
+]
pyparsing = [
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
@@ -842,13 +1292,17 @@ pytest = [
{file = "pytest-6.2.4.tar.gz", hash = "sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b"},
]
pytest-cov = [
- {file = "pytest-cov-2.12.0.tar.gz", hash = "sha256:8535764137fecce504a49c2b742288e3d34bc09eed298ad65963616cc98fd45e"},
- {file = "pytest_cov-2.12.0-py2.py3-none-any.whl", hash = "sha256:95d4933dcbbacfa377bb60b29801daa30d90c33981ab2a79e9ab4452c165066e"},
+ {file = "pytest-cov-2.12.1.tar.gz", hash = "sha256:261ceeb8c227b726249b376b8526b600f38667ee314f910353fa318caa01f4d7"},
+ {file = "pytest_cov-2.12.1-py2.py3-none-any.whl", hash = "sha256:261bb9e47e65bd099c89c3edf92972865210c36813f80ede5277dceb77a4a62a"},
]
pyupgrade = [
{file = "pyupgrade-2.0.2-py2.py3-none-any.whl", hash = "sha256:3d81ecec17cc6be0db2aca48d3756f4542ecfaa18855d3dfa2962ac6425db9f3"},
{file = "pyupgrade-2.0.2.tar.gz", hash = "sha256:5f26bfc17402f612a675c181f3e7d07542b519d9df67e5d01704c203d0c79523"},
]
+pywin32-ctypes = [
+ {file = "pywin32-ctypes-0.2.0.tar.gz", hash = "sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942"},
+ {file = "pywin32_ctypes-0.2.0-py2.py3-none-any.whl", hash = "sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98"},
+]
pyyaml = [
{file = "PyYAML-5.4.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922"},
{file = "PyYAML-5.4.1-cp27-cp27m-win32.whl", hash = "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393"},
@@ -872,6 +1326,10 @@ pyyaml = [
{file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"},
{file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"},
]
+readme-renderer = [
+ {file = "readme_renderer-29.0-py2.py3-none-any.whl", hash = "sha256:63b4075c6698fcfa78e584930f07f39e05d46f3ec97f65006e430b595ca6348c"},
+ {file = "readme_renderer-29.0.tar.gz", hash = "sha256:92fd5ac2bf8677f310f3303aa4bce5b9d5f9f2094ab98c29f13791d7b805a3db"},
+]
regex = [
{file = "regex-2021.4.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:619d71c59a78b84d7f18891fe914446d07edd48dc8328c8e149cbe0929b4e000"},
{file = "regex-2021.4.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:47bf5bf60cf04d72bf6055ae5927a0bd9016096bf3d742fa50d9bf9f45aa0711"},
@@ -919,6 +1377,18 @@ requests = [
{file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"},
{file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"},
]
+requests-toolbelt = [
+ {file = "requests-toolbelt-0.9.1.tar.gz", hash = "sha256:968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0"},
+ {file = "requests_toolbelt-0.9.1-py2.py3-none-any.whl", hash = "sha256:380606e1d10dc85c3bd47bf5a6095f815ec007be7a8b69c878507068df059e6f"},
+]
+rfc3986 = [
+ {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"},
+ {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"},
+]
+secretstorage = [
+ {file = "SecretStorage-3.3.1-py3-none-any.whl", hash = "sha256:422d82c36172d88d6a0ed5afdec956514b189ddbfb72fefab0c8a1cee4eaf71f"},
+ {file = "SecretStorage-3.3.1.tar.gz", hash = "sha256:fd666c51a6bf200643495a04abb261f83229dcb6fd8472ec393df7ffc8b6f195"},
+]
six = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
@@ -931,6 +1401,9 @@ stevedore = [
{file = "stevedore-3.3.0-py3-none-any.whl", hash = "sha256:50d7b78fbaf0d04cd62411188fa7eedcb03eb7f4c4b37005615ceebe582aa82a"},
{file = "stevedore-3.3.0.tar.gz", hash = "sha256:3a5bbd0652bf552748871eaa73a4a8dc2899786bc497a2aa1fcb4dcdb0debeee"},
]
+tmpl = [
+ {file = "tmpl-0.3.0.tar.gz", hash = "sha256:b334f7f1ead0212ea3a55d6548adcb189a236d68eba5d45f199a73dfdf6b075e"},
+]
tokenize-rt = [
{file = "tokenize_rt-3.2.0-py2.py3-none-any.whl", hash = "sha256:53f5c22d36e5c6f8e3fdbc6cb4dd151d1b3d38cea1b85b5fef6268f153733899"},
{file = "tokenize_rt-3.2.0.tar.gz", hash = "sha256:2f44eee8f620102f8a03c50142795121faf86e020d208896ea7a7047bbe933cf"},
@@ -939,10 +1412,22 @@ toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
]
+tomlkit = [
+ {file = "tomlkit-0.7.2-py2.py3-none-any.whl", hash = "sha256:173ad840fa5d2aac140528ca1933c29791b79a374a0861a80347f42ec9328117"},
+ {file = "tomlkit-0.7.2.tar.gz", hash = "sha256:d7a454f319a7e9bd2e249f239168729327e4dd2d27b17dc68be264ad1ce36754"},
+]
tox = [
{file = "tox-3.23.1-py2.py3-none-any.whl", hash = "sha256:b0b5818049a1c1997599d42012a637a33f24c62ab8187223fdd318fa8522637b"},
{file = "tox-3.23.1.tar.gz", hash = "sha256:307a81ddb82bd463971a273f33e9533a24ed22185f27db8ce3386bff27d324e3"},
]
+tqdm = [
+ {file = "tqdm-4.61.1-py2.py3-none-any.whl", hash = "sha256:aa0c29f03f298951ac6318f7c8ce584e48fa22ec26396e6411e43d038243bdb2"},
+ {file = "tqdm-4.61.1.tar.gz", hash = "sha256:24be966933e942be5f074c29755a95b315c69a91f839a29139bf26ffffe2d3fd"},
+]
+twine = [
+ {file = "twine-3.4.1-py3-none-any.whl", hash = "sha256:16f706f2f1687d7ce30e7effceee40ed0a09b7c33b9abb5ef6434e5551565d83"},
+ {file = "twine-3.4.1.tar.gz", hash = "sha256:a56c985264b991dc8a8f4234eb80c5af87fa8080d0c224ad8f2cd05a2c22e83b"},
+]
typed-ast = [
{file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"},
{file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"},
@@ -988,6 +1473,10 @@ virtualenv = [
{file = "virtualenv-20.4.7-py2.py3-none-any.whl", hash = "sha256:2b0126166ea7c9c3661f5b8e06773d28f83322de7a3ff7d06f0aed18c9de6a76"},
{file = "virtualenv-20.4.7.tar.gz", hash = "sha256:14fdf849f80dbb29a4eb6caa9875d476ee2a5cf76a5f5415fa2f1606010ab467"},
]
+webencodings = [
+ {file = "webencodings-0.5.1-py2.py3-none-any.whl", hash = "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"},
+ {file = "webencodings-0.5.1.tar.gz", hash = "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"},
+]
zipp = [
{file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"},
{file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"},
diff --git a/pyproject.toml b/pyproject.toml
index c917ec0..6256ba6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -2,6 +2,8 @@
name = "munge"
version = "1.1.0"
description = "data manipulation library and client"
+readme = "README.md"
+repository = "https://github.com/20c/munge/"
authors = ["20C <[email protected]>"]
license = "Apache-2.0"
@@ -28,7 +30,7 @@ click = "^8.0.1"
PyYAML = {version = "^5.1", optional = true}
toml = {version = "^0.10.2", optional = true}
-# tomlkit = {version = "^0.7.2", optional = true}
+tomlkit = {version = "^0.7.2", optional = true}
[tool.poetry.dev-dependencies]
pytest = "*"
@@ -46,8 +48,15 @@ pre-commit = "^2"
mypy = "^0.812"
pyupgrade = "^2"
+# ctl
+ctl = "^1.0.0"
+jinja2 = "^2.11.2"
+tmpl = "^0.3.0"
+twine = "^3.3.0"
+
[tool.poetry.extras]
toml = ["toml"]
+tomlkit = ["tomlkit"]
yaml = ["PyYAML"]
[build-system]
diff --git a/src/munge/__init__.py b/src/munge/__init__.py
index de47847..13812b7 100644
--- a/src/munge/__init__.py
+++ b/src/munge/__init__.py
@@ -5,5 +5,8 @@ from .codec import get_codecs # noqa
from .codec import load_datafile # noqa
from .config import Config
-if "MUNGE_EXPLICIT_IMPORT" not in globals():
+if not globals().get("MUNGE_EXPLICIT_IMPORT", False):
from .codec import all # noqa
+else:
+ print(globals())
+ assert 0
diff --git a/src/munge/base.py b/src/munge/base.py
index 01dbdd0..5f70168 100644
--- a/src/munge/base.py
+++ b/src/munge/base.py
@@ -8,6 +8,8 @@ from munge import codec
class Meta(type):
+ """Metadata class to check and register codec classes."""
+
def __init__(cls, name, bases, attrs):
if name == "CodecBase":
super().__init__(name, bases, attrs)
@@ -30,6 +32,7 @@ class Meta(type):
class CodecBase(metaclass=Meta):
supports_dict = False
supports_list = False
+ supports_roundtrip = False
def __init__(self, config=None):
if config:
diff --git a/src/munge/cli.py b/src/munge/cli.py
index 27acc85..fef8676 100644
--- a/src/munge/cli.py
+++ b/src/munge/cli.py
@@ -1,5 +1,3 @@
-import sys
-
import click
import munge
diff --git a/src/munge/codec/__init__.py b/src/munge/codec/__init__.py
index 4964205..3d51a9d 100644
--- a/src/munge/codec/__init__.py
+++ b/src/munge/codec/__init__.py
@@ -11,7 +11,7 @@ def add_codec(exts, cls):
# check for dupe extensions
dupe_exts = {ext for k in list(__codecs.keys()) for ext in k}.intersection(exts)
if dupe_exts:
- raise ValueError("duplicate extension %s" % str(dupe_exts))
+ raise ValueError(f"duplicate extension {str(dupe_exts)}")
__codecs[exts] = cls
@@ -75,9 +75,7 @@ def load_datafile(name, search_path=("."), codecs=get_codecs(), **kwargs):
if not mod:
if "default" in kwargs:
return kwargs["default"]
- raise OSError(
- "file {} not found in search path {}".format(name, str(search_path))
- )
+ raise OSError(f"file {name} not found in search path {str(search_path)}")
(codec, datafile) = mod[0]
return codec().load(open(datafile))
diff --git a/src/munge/codec/django.py b/src/munge/codec/django.py
deleted file mode 100644
index d7d67cc..0000000
--- a/src/munge/codec/django.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from munge.base import CodecBase
-
-# FIXME - remove this file?
-# try:
-# pass
-# # from django.conf import settings
-#
-# except ImportError as exc:
-# pass
-
-
-class Django(CodecBase):
-
- extensions = ["django"]
- __kwargs = {}
-
- def load(self, fobj):
- raise NotImplementedError()
-
- def loads(self, instr):
- raise NotImplementedError()
-
- def dump(self, data, fobj):
- raise NotImplementedError()
-
- def dumps(self, data):
- raise NotImplementedError()
diff --git a/src/munge/codec/json.py b/src/munge/codec/json.py
index 4d4f8e8..a70db89 100644
--- a/src/munge/codec/json.py
+++ b/src/munge/codec/json.py
@@ -17,8 +17,8 @@ class Json(CodecBase):
def load(self, fobj, **kwargs):
return json.load(fobj, **self.__kwargs)
- def loads(self, instr, **kwargs):
- return json.loads(instr, **self.__kwargs)
+ def loads(self, input_string, **kwargs):
+ return json.loads(input_string, **self.__kwargs)
def dump(self, data, fobj, **kwargs):
return json.dump(data, fobj, **kwargs)
diff --git a/src/munge/codec/toml.py b/src/munge/codec/toml.py
index 43faca3..9fb4e61 100644
--- a/src/munge/codec/toml.py
+++ b/src/munge/codec/toml.py
@@ -1,28 +1,16 @@
-from munge.base import CodecBase
+import importlib
+import os
try:
- import toml
-
+ if os.environ.get("MUNGE_TOML_LIBRARY", None):
+ importlib.import_module(f"munge.codec.toml_{os.environ['MUNGE_TOML_LIBRARY']}")
+ else:
+ import munge.codec.toml_tomlkit # noqa isort:skip
+ import munge.codec.toml_toml # noqa
+
+except ValueError as exc:
+ # don't load both toml modules
+ if str(exc).startswith("duplicate extension"):
+ pass
except ImportError:
pass
-
-
-class Toml(CodecBase):
- supports_dict = True
- extensions = ["toml"]
- __kwargs = {}
-
- def set_type(self, name, typ):
- pass
-
- def load(self, fobj, **kwargs):
- return toml.load(fobj, **self.__kwargs)
-
- def loads(self, input_string, **kwargs):
- return toml.loads(input_string, **self.__kwargs)
-
- def dump(self, data, fobj, **kwargs):
- return toml.dump(data, fobj, **kwargs)
-
- def dumps(self, data):
- return toml.dumps(data)
diff --git a/src/munge/codec/toml_toml.py b/src/munge/codec/toml_toml.py
new file mode 100644
index 0000000..0927bb4
--- /dev/null
+++ b/src/munge/codec/toml_toml.py
@@ -0,0 +1,28 @@
+from munge.base import CodecBase
+
+try:
+ import toml
+
+ class Toml(CodecBase):
+ supports_dict = True
+ extensions = ["toml"]
+ __kwargs = {}
+
+ def set_type(self, name, typ):
+ pass
+
+ def load(self, fobj, **kwargs):
+ return toml.load(fobj, **self.__kwargs)
+
+ def loads(self, input_string, **kwargs):
+ return toml.loads(input_string, **self.__kwargs)
+
+ def dump(self, data, fobj, **kwargs):
+ return toml.dump(data, fobj, **kwargs)
+
+ def dumps(self, data):
+ return toml.dumps(data)
+
+
+except ImportError:
+ pass
diff --git a/src/munge/codec/toml_tomlkit.py b/src/munge/codec/toml_tomlkit.py
new file mode 100644
index 0000000..f18b189
--- /dev/null
+++ b/src/munge/codec/toml_tomlkit.py
@@ -0,0 +1,29 @@
+from munge.base import CodecBase
+
+try:
+ import tomlkit
+
+ class TomlKit(CodecBase):
+ supports_dict = True
+ supports_roundtrip = True
+ extensions = ["toml"]
+ __kwargs = {}
+
+ def set_type(self, name, typ):
+ pass
+
+ def load(self, fobj, **kwargs):
+ return self.loads(fobj.read(), **self.__kwargs)
+
+ def loads(self, input_string, **kwargs):
+ return tomlkit.loads(input_string, **self.__kwargs)
+
+ def dump(self, data, fobj, **kwargs):
+ return fobj.write(self.dumps(data, **kwargs))
+
+ def dumps(self, data, **kwargs):
+ return tomlkit.dumps(data)
+
+
+except ImportError:
+ pass
diff --git a/src/munge/codec/yaml.py b/src/munge/codec/yaml.py
index 229ac10..aeac8cb 100644
--- a/src/munge/codec/yaml.py
+++ b/src/munge/codec/yaml.py
@@ -3,26 +3,28 @@ from munge.base import CodecBase
try:
import yaml
-except ImportError:
- pass
+ class Yaml(CodecBase):
+ supports_dict = True
+ supports_list = True
+ extensions = ["yaml", "yml"]
+ def set_type(self, name, typ):
+ pass
-class Yaml(CodecBase):
- supports_dict = True
- supports_list = True
- extensions = ["yaml", "yml"]
+ def load(self, *args, **kwargs):
+ return yaml.safe_load(*args, **kwargs)
- def set_type(self, name, typ):
- pass
+ def loads(self, *args, **kwargs):
+ return self.load(*args, **kwargs)
- def load(self, *args, **kwargs):
- return yaml.safe_load(*args, **kwargs)
+ def dump(self, data, fobj):
+ return fobj.write(
+ yaml.safe_dump(data, default_flow_style=False, sort_keys=False)
+ )
- def loads(self, *args, **kwargs):
- return self.load(*args, **kwargs)
+ def dumps(self, data):
+ return yaml.safe_dump(data, default_flow_style=False, sort_keys=False)
- def dump(self, data, fobj):
- return fobj.write(yaml.safe_dump(data, default_flow_style=False))
- def dumps(self, data):
- return yaml.safe_dump(data, default_flow_style=False)
+except ImportError:
+ pass
diff --git a/tox.ini b/tox.ini
index aea00ae..e3562af 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,3 +1,18 @@
+[flake8]
+extend-ignore = E501
+exclude = [
+ .git,
+ .venv,
+ .tox,
+ __pycache__,
+ build,
+ dist
+ ]
+
+max-line-length = 80
+max-complexity = 18
+select = B,C,E,F,W,T4,B9
+
[pytest]
norecursedirs = .facsimile data gen .tox
@@ -15,4 +30,4 @@ setenv =
deps = -r{toxinidir}/Ctl/requirements.txt
-r{toxinidir}/Ctl/requirements-test.txt
commands =
- py.test -vv --cov-report=term-missing --cov={envsitepackagesdir}/munge tests/
+ pytest -vv --cov-report=term-missing --cov={envsitepackagesdir}/munge tests/
|
add round trip support
For formats that libraries exist.
|
20c/munge
|
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 93ac1a6..22e2143 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -71,8 +71,8 @@ jobs:
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
# install dependencies if cache does not exist
- name: Check cache and install dependencies
- run: poetry install
- if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
+ run: poetry install -E tomlkit -E yaml
+# tmp disable cache if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run tests
run: |
source .venv/bin/activate
diff --git a/tests/data/conf0/config.toml b/tests/data/conf0/config.toml
new file mode 100644
index 0000000..a775602
--- /dev/null
+++ b/tests/data/conf0/config.toml
@@ -0,0 +1,5 @@
+[addrbook.site0]
+url = "https://example.com/data.json"
+user = "user"
+password = "secr3t"
+timeout = 60
diff --git a/tests/data/conf0/config.yaml b/tests/data/conf0/config.yaml
deleted file mode 100644
index cc6fc98..0000000
--- a/tests/data/conf0/config.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-addrbook:
- site0:
- url: https://example.com/data.json
- user: user
- password: secr3t
- timeout: 60
-
diff --git a/tests/data/dict0.toml b/tests/data/dict0.toml
index 8816b8e..f8d09bf 100644
--- a/tests/data/dict0.toml
+++ b/tests/data/dict0.toml
@@ -1,4 +1,5 @@
[munge]
-list0 = [ "item0", "item1",]
-int0 = 42
+# list0
+list0 = ["item0", "item1"]
+int0 = 42 # the answer to everything
str0 = "str0"
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 44c9201..d660dac 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -18,5 +18,5 @@ def test_cli():
rv = runner.invoke(munge.cli.main, ["--list-codecs"])
assert 0 == rv.exit_code
- rv = runner.invoke(munge.cli.main, [os.path.join(data_dir, "dict0.yml"), "json:"])
+ rv = runner.invoke(munge.cli.main, [os.path.join(data_dir, "dict0.toml"), "json:"])
assert 0 == rv.exit_code
diff --git a/tests/test_codecs.py b/tests/test_codecs.py
index 4b44284..6bb34c5 100644
--- a/tests/test_codecs.py
+++ b/tests/test_codecs.py
@@ -14,6 +14,7 @@ data_dir = os.path.join(this_dir, "data")
test_codecs = []
for tags, cls in list(munge.get_codecs().items()):
if any(name in ("json", "toml", "yaml") for name in tags):
+ print(f"appending codec {cls.extension}")
test_codecs.append(cls)
@@ -134,14 +135,34 @@ def test_loadu(codec, dataset):
def test_dump(codec, dataset, tmpdir):
- # XXX normalize
obj = codec.cls()
if not obj.supports_data(dataset.expected):
return
dstfile = tmpdir.join("dump" + obj.extension)
obj.dump(dataset.expected, dstfile.open("w"))
- assert dataset.expected == obj.load(dstfile.open())
- # assert codec.open_file(dataset.filename).read() == dstfile.read()
+ with dstfile.open() as fobj:
+ assert dataset.expected == obj.load(fobj)
+
+
+def test_roundtrip(codec, dataset, tmpdir):
+ obj = codec.cls()
+ if not obj.supports_data(dataset.expected):
+ return
+ if not obj.supports_roundtrip:
+ return
+
+ data = obj.load(open(codec.find_file(dataset.filename)))
+ for section in dataset.expected:
+ for k, v in dataset.expected[section].items():
+ data[section][k] = v
+
+ dumped = obj.dumps(data)
+ print(f"dumping: {dumped}")
+
+ dstfile = tmpdir.join("dump" + obj.extension)
+ obj.dump(data, dstfile.open("w"))
+ with dstfile.open() as fobj:
+ assert codec.open_file(dataset.filename).read() == fobj.read()
def test_dumps(codec, dataset, tmpdir):
@@ -190,7 +211,7 @@ def test_load_datafile(codec, dataset):
if not obj.supports_data(dataset.expected):
return
- # XXX move the nonexistant tests to their own function so they're not repeatedly called
+ # TODO move the nonexistant tests to their own function so they're not repeatedly called
with pytest.raises(IOError):
munge.load_datafile("nonexistant", data_dir)
diff --git a/tests/test_config.py b/tests/test_config.py
index 7c5c2ad..6781609 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -13,39 +13,31 @@ from munge import config
test_dir = os.path.relpath(os.path.dirname(__file__))
data_dir = os.path.join(test_dir, "data")
conf0_dir = os.path.join(data_dir, "conf0")
-extra_schemes = {"tyam": {"type": "yaml", "cls": munge.get_codec("yaml")}}
+extra_schemes = {"tyam": {"type": "toml", "cls": munge.get_codec("toml")}}
def test_parse_url():
- # django = munge.get_codec("django")
mysql = munge.get_codec("mysql")
json = munge.get_codec("json")
- yaml = munge.get_codec("yaml")
+ toml = munge.get_codec("toml")
# fail on empty
with pytest.raises(ValueError):
config.parse_url("")
- conf = config.parse_url("yaml:test")
- conf = config.parse_url("yaml:test")
- assert yaml == conf.cls
+ conf = config.parse_url("toml:test")
+ conf = config.parse_url("toml:test")
+ assert toml == conf.cls
assert "test" == conf.url.path
- conf = config.parse_url("test.yaml")
- assert yaml == conf.cls
- assert "test.yaml" == conf.url.path
+ conf = config.parse_url("test.toml")
+ assert toml == conf.cls
+ assert "test.toml" == conf.url.path
conf = config.parse_url("tyam:test", extra_schemes)
- assert yaml == conf.cls
+ assert toml == conf.cls
assert "test" == conf.url.path
- # conf = config.parse_url(
- # "django:///home/user/project/settings_dir.settings?app_name/model"
- # )
- # assert django == conf.cls
- # assert "/home/user/project/settings_dir.settings" == conf.url.path
- # assert "app_name/model" == conf.url.query
-
conf = config.parse_url("json:http://example.com/test.txt")
assert json == conf.cls
assert "http://example.com/test.txt" == conf.url.path
@@ -70,7 +62,7 @@ conf0_data = {
class DefaultConfig(munge.Config):
- defaults = {"config": default_config, "config_dir": "~/.mungeX", "codec": "yaml"}
+ defaults = {"config": default_config, "config_dir": "~/.mungeX", "codec": "toml"}
class Defaults:
config = default_config
@@ -255,7 +247,7 @@ def test_config_write(conf, tmpdir):
type(conf)().write()
cdir = tmpdir.mkdir(type(conf).__name__)
- conf.write(str(cdir), "yaml")
+ conf.write(str(cdir), "toml")
# create an exact copy
kwargs = conf._defaults.copy()
diff --git a/tests/test_globals.py b/tests/test_globals.py
new file mode 100644
index 0000000..69b4e5a
--- /dev/null
+++ b/tests/test_globals.py
@@ -0,0 +1,23 @@
+import importlib
+import os
+import sys
+
+
+def unload_munge():
+ for key in list(sys.modules.keys()):
+ if key.startswith("munge"):
+ del sys.modules[key]
+
+
+def test_toml_library():
+ import munge
+
+ codec = munge.get_codec("toml")
+ assert codec.supports_roundtrip
+
+ os.environ["MUNGE_TOML_LIBRARY"] = "toml"
+ unload_munge()
+ import munge
+
+ codec = munge.get_codec("toml")
+ assert not codec.supports_roundtrip
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_removed_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 3
},
"num_modified_files": 12
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[toml,yaml]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"codecov",
"coverage",
"tox"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"Ctl/requirements.txt",
"Ctl/requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
cachetools==5.5.2
certifi==2025.1.31
chardet==5.2.0
charset-normalizer==3.4.1
click==8.1.8
codecov==2.1.13
colorama==0.4.6
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
idna==3.10
iniconfig==2.1.0
-e git+https://github.com/20c/munge.git@882070dbec6a3600217e406c9501091d8c27feab#egg=munge
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pyproject-api==1.9.0
pytest==8.3.5
pytest-cov==6.0.0
PyYAML==5.4.1
requests==2.32.3
toml==0.10.2
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
|
name: munge
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- cachetools==5.5.2
- certifi==2025.1.31
- chardet==5.2.0
- charset-normalizer==3.4.1
- click==8.1.8
- codecov==2.1.13
- colorama==0.4.6
- coverage==7.8.0
- distlib==0.3.9
- exceptiongroup==1.2.2
- filelock==3.18.0
- idna==3.10
- iniconfig==2.1.0
- munge==1.1.0
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-cov==6.0.0
- pyyaml==5.4.1
- requests==2.32.3
- toml==0.10.2
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
prefix: /opt/conda/envs/munge
|
[
"tests/test_codecs.py::test_roundtrip[Json-Datadict0]",
"tests/test_codecs.py::test_roundtrip[Json-Datalist0]",
"tests/test_codecs.py::test_roundtrip[Toml-Datadict0]",
"tests/test_codecs.py::test_roundtrip[Yaml-Datalist0]",
"tests/test_codecs.py::test_roundtrip[Yaml-Datadict0]"
] |
[
"tests/test_globals.py::test_toml_library"
] |
[
"tests/test_cli.py::test_cli",
"tests/test_codecs.py::test_codec_registry",
"tests/test_codecs.py::test_extesion[Json-Datadict0]",
"tests/test_codecs.py::test_open[Json-Datadict0]",
"tests/test_codecs.py::test_load[Json-Datadict0]",
"tests/test_codecs.py::test_loads[Json-Datadict0]",
"tests/test_codecs.py::test_loadu[Json-Datadict0]",
"tests/test_codecs.py::test_dump[Json-Datadict0]",
"tests/test_codecs.py::test_dumps[Json-Datadict0]",
"tests/test_codecs.py::test_dumpu[Json-Datadict0]",
"tests/test_codecs.py::test_find_datafile[Json-Datadict0]",
"tests/test_codecs.py::test_load_datafile[Json-Datadict0]",
"tests/test_codecs.py::test_extesion[Json-Datalist0]",
"tests/test_codecs.py::test_open[Json-Datalist0]",
"tests/test_codecs.py::test_load[Json-Datalist0]",
"tests/test_codecs.py::test_loads[Json-Datalist0]",
"tests/test_codecs.py::test_loadu[Json-Datalist0]",
"tests/test_codecs.py::test_dump[Json-Datalist0]",
"tests/test_codecs.py::test_dumps[Json-Datalist0]",
"tests/test_codecs.py::test_dumpu[Json-Datalist0]",
"tests/test_codecs.py::test_find_datafile[Json-Datalist0]",
"tests/test_codecs.py::test_load_datafile[Json-Datalist0]",
"tests/test_codecs.py::test_extesion[Toml-Datalist0]",
"tests/test_codecs.py::test_open[Toml-Datalist0]",
"tests/test_codecs.py::test_load[Toml-Datalist0]",
"tests/test_codecs.py::test_loads[Toml-Datalist0]",
"tests/test_codecs.py::test_loadu[Toml-Datalist0]",
"tests/test_codecs.py::test_dump[Toml-Datalist0]",
"tests/test_codecs.py::test_roundtrip[Toml-Datalist0]",
"tests/test_codecs.py::test_dumps[Toml-Datalist0]",
"tests/test_codecs.py::test_dumpu[Toml-Datalist0]",
"tests/test_codecs.py::test_find_datafile[Toml-Datalist0]",
"tests/test_codecs.py::test_load_datafile[Toml-Datalist0]",
"tests/test_codecs.py::test_extesion[Toml-Datadict0]",
"tests/test_codecs.py::test_open[Toml-Datadict0]",
"tests/test_codecs.py::test_load[Toml-Datadict0]",
"tests/test_codecs.py::test_loads[Toml-Datadict0]",
"tests/test_codecs.py::test_loadu[Toml-Datadict0]",
"tests/test_codecs.py::test_dump[Toml-Datadict0]",
"tests/test_codecs.py::test_dumps[Toml-Datadict0]",
"tests/test_codecs.py::test_dumpu[Toml-Datadict0]",
"tests/test_codecs.py::test_find_datafile[Toml-Datadict0]",
"tests/test_codecs.py::test_load_datafile[Toml-Datadict0]",
"tests/test_codecs.py::test_extesion[Yaml-Datalist0]",
"tests/test_codecs.py::test_open[Yaml-Datalist0]",
"tests/test_codecs.py::test_load[Yaml-Datalist0]",
"tests/test_codecs.py::test_loads[Yaml-Datalist0]",
"tests/test_codecs.py::test_loadu[Yaml-Datalist0]",
"tests/test_codecs.py::test_dump[Yaml-Datalist0]",
"tests/test_codecs.py::test_dumps[Yaml-Datalist0]",
"tests/test_codecs.py::test_dumpu[Yaml-Datalist0]",
"tests/test_codecs.py::test_find_datafile[Yaml-Datalist0]",
"tests/test_codecs.py::test_load_datafile[Yaml-Datalist0]",
"tests/test_codecs.py::test_extesion[Yaml-Datadict0]",
"tests/test_codecs.py::test_open[Yaml-Datadict0]",
"tests/test_codecs.py::test_load[Yaml-Datadict0]",
"tests/test_codecs.py::test_loads[Yaml-Datadict0]",
"tests/test_codecs.py::test_loadu[Yaml-Datadict0]",
"tests/test_codecs.py::test_dump[Yaml-Datadict0]",
"tests/test_codecs.py::test_dumps[Yaml-Datadict0]",
"tests/test_codecs.py::test_dumpu[Yaml-Datadict0]",
"tests/test_codecs.py::test_find_datafile[Yaml-Datadict0]",
"tests/test_codecs.py::test_load_datafile[Yaml-Datadict0]",
"tests/test_config.py::test_parse_url",
"tests/test_config.py::test_derived_config_obj[mk_base_conf]",
"tests/test_config.py::test_config_obj[mk_base_conf]",
"tests/test_config.py::test_config_clear[mk_base_conf]",
"tests/test_config.py::test_config_write[mk_base_conf]",
"tests/test_config.py::test_derived_config_obj[mk_derived_conf]",
"tests/test_config.py::test_config_obj[mk_derived_conf]",
"tests/test_config.py::test_config_clear[mk_derived_conf]",
"tests/test_config.py::test_config_write[mk_derived_conf]",
"tests/test_config.py::test_base_config_read",
"tests/test_config.py::test_config_copy",
"tests/test_config.py::test_config_defaults",
"tests/test_config.py::test_base_config_clear",
"tests/test_config.py::test_base_config_ctor_try_read",
"tests/test_config.py::test_base_config_ctor_try_read2",
"tests/test_config.py::test_base_config_mapping",
"tests/test_config.py::test_conf0[mk_base_conf0]",
"tests/test_config.py::test_conf0[mk_base_conf0_init]",
"tests/test_config.py::test_conf0[mk_base_conf0_init_data]",
"tests/test_config.py::test_conf0[mk_derived_conf0]"
] |
[] |
Apache License 2.0
| null |
2gis__k8s-handle-120
|
0ce48ecc5cd78eac5894241468a53080c3ccec64
|
2020-03-18 13:04:21
|
0ce48ecc5cd78eac5894241468a53080c3ccec64
|
diff --git a/k8s_handle/templating.py b/k8s_handle/templating.py
index 7f2d6b7..445a09e 100644
--- a/k8s_handle/templating.py
+++ b/k8s_handle/templating.py
@@ -195,7 +195,10 @@ class Renderer:
@staticmethod
def _evaluate_tags(tags, only_tags, skip_tags):
- if only_tags is None and skip_tags is None:
- return True
+ if only_tags and tags.isdisjoint(only_tags):
+ return False
- return tags.isdisjoint(skip_tags or []) and not tags.isdisjoint(only_tags or tags)
+ if skip_tags and not tags.isdisjoint(skip_tags):
+ return False
+
+ return True
|
skip-tags does not work
Hello,
it seems `--skip-tags` does not work. Steps to reproduce:
```
git clone [email protected]:2gis/k8s-handle-example.git
```
Edit config.yaml, add some tag
```
staging:
templates:
- template: configmap.yaml.j2
- template: deployment.yaml.j2
- template: service.yaml.j2
tags: manual
```
Render is empty:
```
$ docker run --rm -v `pwd`:/tmp -w /tmp 2gis/k8s-handle k8s-handle render -s staging --skip-tags manual
_(_)_ wWWWw _
@@@@ (_)@(_) vVVVv _ @@@@ (___) _(_)_
@@()@@ wWWWw (_)\ (___) _(_)_ @@()@@ Y (_)@(_)
@@@@ (___) `|/ Y (_)@(_) @@@@ \|/ (_)
/ Y \| \|/ /(_) \| |/ |
\ | \ |/ | / \ | / \|/ |/ \| \|/
\|// \|/// \|// \|/// \|/// \|// |// \|//
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
|
2gis/k8s-handle
|
diff --git a/tests/test_templating.py b/tests/test_templating.py
index cd1ecfe..6a46a01 100644
--- a/tests/test_templating.py
+++ b/tests/test_templating.py
@@ -111,6 +111,9 @@ class TestTemplating(unittest.TestCase):
self.assertFalse(r._evaluate_tags(tags, only_tags=['tag1'], skip_tags=['tag1']))
self.assertFalse(r._evaluate_tags(tags, only_tags=None, skip_tags=['tag1']))
self.assertTrue(r._evaluate_tags(tags, only_tags=None, skip_tags=['tag4']))
+ tags = set()
+ self.assertFalse(r._evaluate_tags(tags, only_tags=['tag4'], skip_tags=None))
+ self.assertTrue(r._evaluate_tags(tags, only_tags=None, skip_tags=['tag4']))
def test_get_template_tags(self):
r = templating.Renderer(os.path.join(os.path.dirname(__file__), 'templates_tests'))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.10
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
cachetools==4.2.4
certifi==2021.5.30
chardet==3.0.4
coverage==6.2
execnet==1.9.0
google-auth==2.22.0
idna==2.8
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==2.10.1
-e git+https://github.com/2gis/k8s-handle.git@0ce48ecc5cd78eac5894241468a53080c3ccec64#egg=k8s_handle
kubernetes==10.0.1
MarkupSafe==2.0.1
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
PyYAML==5.1
requests==2.22.0
requests-oauthlib==2.0.0
rsa==4.9
semver==2.8.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.25.11
websocket-client==1.3.1
zipp==3.6.0
|
name: k8s-handle
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cachetools==4.2.4
- chardet==3.0.4
- coverage==6.2
- execnet==1.9.0
- google-auth==2.22.0
- idna==2.8
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==2.10.1
- kubernetes==10.0.1
- markupsafe==2.0.1
- oauthlib==3.2.2
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pyasn1-modules==0.3.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- python-dateutil==2.9.0.post0
- pyyaml==5.1
- requests==2.22.0
- requests-oauthlib==2.0.0
- rsa==4.9
- semver==2.8.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.25.11
- websocket-client==1.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/k8s-handle
|
[
"tests/test_templating.py::TestTemplating::test_evaluate_tags"
] |
[] |
[
"tests/test_templating.py::TestTemplating::test_filters",
"tests/test_templating.py::TestTemplating::test_generate_group_templates",
"tests/test_templating.py::TestTemplating::test_generate_templates",
"tests/test_templating.py::TestTemplating::test_generate_templates_with_kubectl_section",
"tests/test_templating.py::TestTemplating::test_get_template_tags",
"tests/test_templating.py::TestTemplating::test_get_template_tags_unexpected_type",
"tests/test_templating.py::TestTemplating::test_io_2709",
"tests/test_templating.py::TestTemplating::test_no_templates_in_kubectl",
"tests/test_templating.py::TestTemplating::test_none_context",
"tests/test_templating.py::TestTemplating::test_render_not_existent_template",
"tests/test_templating.py::TestTemplating::test_renderer_init",
"tests/test_templating.py::TestTemplating::test_templates_regex",
"tests/test_templating.py::TestTemplating::test_templates_regex_parse_failed"
] |
[] |
Apache License 2.0
| null |
|
2gis__k8s-handle-73
|
dec5c73ec1bcd694bd45651901d68cd933721b3e
|
2019-01-11 19:57:42
|
dec5c73ec1bcd694bd45651901d68cd933721b3e
|
codecov-io: # [Codecov](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=h1) Report
> Merging [#73](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=desc) into [master](https://codecov.io/gh/2gis/k8s-handle/commit/e727854bd0493af8f836abf496582f53c2d9c711?src=pr&el=desc) will **decrease** coverage by `0.06%`.
> The diff coverage is `100%`.
[](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #73 +/- ##
==========================================
- Coverage 73.9% 73.84% -0.07%
==========================================
Files 8 8
Lines 801 799 -2
==========================================
- Hits 592 590 -2
Misses 209 209
```
| [Impacted Files](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [config.py](https://codecov.io/gh/2gis/k8s-handle/pull/73/diff?src=pr&el=tree#diff-Y29uZmlnLnB5) | `100% <100%> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=footer). Last update [e727854...cdb67cc](https://codecov.io/gh/2gis/k8s-handle/pull/73?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
otherNoscript: ууупс, не в ту ветку
dekhtyarev: @otherNoscript , привет!
Обнови PR с мастера, пжлста. У нас произошли некоторые изменения в рамках #70
|
diff --git a/.dockerignore b/.dockerignore
index d3f33a2..fea1e67 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -6,5 +6,10 @@ Dockerfile*
.gitignore
.idea/
.tox/
+.travis.yml
+tox.ini
__pychache__
htmlcov/
+tests/
+*.png
+
diff --git a/k8s_handle/config.py b/k8s_handle/config.py
index acbf34f..6c2564f 100644
--- a/k8s_handle/config.py
+++ b/k8s_handle/config.py
@@ -13,7 +13,7 @@ from k8s_handle.templating import b64decode
log = logging.getLogger(__name__)
INCLUDE_RE = re.compile(r'{{\s?file\s?=\s?\'(?P<file>[^\']*)\'\s?}}')
-CUSTOM_ENV_RE = re.compile(r'^(?P<prefix>.*){{\s*env\s*=\s*\'(?P<env>[^\']*)\'\s*}}(?P<postfix>.*)$') # noqa
+CUSTOM_ENV_RE = r'{{\s*env\s*=\s*\'([^\']*)\'\s*}}'
KEY_USE_KUBECONFIG = 'use_kubeconfig'
KEY_K8S_MASTER_URI = 'k8s_master_uri'
@@ -113,19 +113,15 @@ def _process_variable(variable):
if matches:
return load_yaml(matches.groupdict().get('file'))
- matches = CUSTOM_ENV_RE.match(variable)
+ try:
+ return re.sub(CUSTOM_ENV_RE, lambda m: os.environ[m.group(1)], variable)
- if matches:
- prefix = matches.groupdict().get('prefix')
- env_var_name = matches.groupdict().get('env')
- postfix = matches.groupdict().get('postfix')
-
- if os.environ.get(env_var_name) is None and settings.GET_ENVIRON_STRICT:
- raise RuntimeError('Environment variable "{}" is not set'.format(env_var_name))
-
- return prefix + os.environ.get(env_var_name, '') + postfix
+ except KeyError as err:
+ log.debug('Environment variable "{}" is not set'.format(err.args[0]))
+ if settings.GET_ENVIRON_STRICT:
+ raise RuntimeError('Environment variable "{}" is not set'.format(err.args[0]))
- return variable
+ return re.sub(CUSTOM_ENV_RE, lambda m: os.environ.get(m.group(1), ''), variable)
def _update_single_variable(value, include_history):
diff --git a/k8s_handle/filesystem.py b/k8s_handle/filesystem.py
index 5d200eb..7993290 100644
--- a/k8s_handle/filesystem.py
+++ b/k8s_handle/filesystem.py
@@ -17,7 +17,7 @@ class InvalidYamlError(Exception):
def load_yaml(path):
try:
with open(path) as f:
- return yaml.load(f.read())
+ return yaml.safe_load(f.read())
except Exception as e:
raise InvalidYamlError("file '{}' doesn't contain valid yaml: {}".format(
path, e))
diff --git a/k8s_handle/templating.py b/k8s_handle/templating.py
index 2a5c441..7476f07 100644
--- a/k8s_handle/templating.py
+++ b/k8s_handle/templating.py
@@ -19,7 +19,7 @@ log = logging.getLogger(__name__)
def get_template_contexts(file_path):
with open(file_path) as f:
try:
- contexts = yaml.load_all(f.read())
+ contexts = yaml.safe_load_all(f.read())
except Exception as e:
raise RuntimeError('Unable to load yaml file: {}, {}'.format(file_path, e))
|
It is not possible to concatenate several environment variables into one value
Привет.
Столкнулся с невозможностью одновременного использования нескольких переменных окружения при объявлении переменной в config.yaml. Небольшой пример:
Мы при развертывании сервиса иногда создаем более одного деплоя, registry используем как приватные так и публичные, да еще и registry приватных у нас несколько. Так же при каждом деплое у нас выбирается образ по тэгу в git. Для того, что бы не создавать множество шаблонов деплоя, мы сделали один универсальный, в цикле которого добавляем все необходимые образы. По этому все образы объявляются в config.yaml
```yaml
common:
deployments:
service_name:
containers:
app:
image: "{{ env='CI_REGISTRY' }}/service-image:{{ env='TAG' }}"
nginx:
image: "{{ env='CI_REGISTRY' }}/custom-nginx:configmap"
```
Так вот при такой записи в случае с образом nginx все ОК, в случае с контейнером app после создания манифеста имеем "{{ env='CI_REGISTRY' }}/service-image:1.0.0". Заглянул в код и понял, что в текущей реализации не получится из нескольких переменных окружения получить нужное нам имя образа.
|
2gis/k8s-handle
|
diff --git a/tests/test_config.py b/tests/test_config.py
index 2f2e2b3..ce3e228 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -118,13 +118,17 @@ class TestContextGeneration(unittest.TestCase):
'section1-key4': [0, 1, 2, 3],
'section1-key5': "{{ env='CUSTOM_ENV' }}",
'section1-key6': "{{ file='tests/fixtures/include.yaml' }}",
+ 'section1-key7': "{{ env='CUSTOM_ENV'}} = {{ env='CUSTOM_ENV' }}",
+ 'section1-key8': "{{ env='NULL_VAR' }}-{{ env='CUSTOM_ENV' }}"
}
},
'section2': [
{},
'var2',
'var3',
- '{{ env=\'CUSTOM_ENV\' }}'
+ '{{ env=\'CUSTOM_ENV\' }}',
+ '{{ env=\'CUSTOM_ENV\' }} = {{ env=\'CUSTOM_ENV\' }}',
+ '{{ env=\'NULL_VAR\' }}-{{ env=\'CUSTOM_ENV\' }}'
],
'section3': [0, 1, 2, 3, 4]
}
@@ -137,13 +141,17 @@ class TestContextGeneration(unittest.TestCase):
'section1-key4': [0, 1, 2, 3],
'section1-key5': 'My value',
'section1-key6': {'ha_ha': 'included_var'},
+ 'section1-key7': 'My value = My value',
+ 'section1-key8': "-My value"
}
},
'section2': [
{},
'var2',
'var3',
- 'My value'
+ 'My value',
+ 'My value = My value',
+ '-My value'
],
'section3': [0, 1, 2, 3, 4]
}
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 4
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==1.2.7
attrs==22.2.0
cachetools==4.2.4
certifi==2021.5.30
cffi==1.15.1
chardet==3.0.4
coverage==6.2
cryptography==40.0.2
execnet==1.9.0
google-auth==2.22.0
idna==2.7
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==2.10
-e git+https://github.com/2gis/k8s-handle.git@dec5c73ec1bcd694bd45651901d68cd933721b3e#egg=k8s_handle
kubernetes==7.0.0
MarkupSafe==2.0.1
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
PyJWT==2.4.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
PyYAML==3.13
requests==2.20.1
requests-oauthlib==2.0.0
rsa==4.9
semver==2.8.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.24.3
websocket-client==1.3.1
zipp==3.6.0
|
name: k8s-handle
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==1.2.7
- attrs==22.2.0
- cachetools==4.2.4
- cffi==1.15.1
- chardet==3.0.4
- coverage==6.2
- cryptography==40.0.2
- execnet==1.9.0
- google-auth==2.22.0
- idna==2.7
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==2.10
- kubernetes==7.0.0
- markupsafe==2.0.1
- oauthlib==3.2.2
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pyasn1-modules==0.3.0
- pycparser==2.21
- pyjwt==2.4.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- python-dateutil==2.9.0.post0
- pyyaml==3.13
- requests==2.20.1
- requests-oauthlib==2.0.0
- rsa==4.9
- semver==2.8.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.24.3
- websocket-client==1.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/k8s-handle
|
[
"tests/test_config.py::TestContextGeneration::test_context_update_recursion"
] |
[] |
[
"tests/test_config.py::TestContextGeneration::test_check_empty_var",
"tests/test_config.py::TestContextGeneration::test_common_section",
"tests/test_config.py::TestContextGeneration::test_concatination_with_env",
"tests/test_config.py::TestContextGeneration::test_config_incorrect",
"tests/test_config.py::TestContextGeneration::test_config_is_empty",
"tests/test_config.py::TestContextGeneration::test_config_not_exist",
"tests/test_config.py::TestContextGeneration::test_context_update_section",
"tests/test_config.py::TestContextGeneration::test_dashes_in_var_names",
"tests/test_config.py::TestContextGeneration::test_env_var_in_include_2_levels_dont_set",
"tests/test_config.py::TestContextGeneration::test_env_var_in_include_dont_set",
"tests/test_config.py::TestContextGeneration::test_env_var_in_section1_dont_set",
"tests/test_config.py::TestContextGeneration::test_env_var_in_section2_dont_set",
"tests/test_config.py::TestContextGeneration::test_infinite_recursion_loop",
"tests/test_config.py::TestContextGeneration::test_merge_section_options",
"tests/test_config.py::TestContextGeneration::test_no_templates",
"tests/test_config.py::TestContextGeneration::test_not_existed_section",
"tests/test_config.py::TestContextGeneration::test_recursive_vars",
"tests/test_config.py::TestPriorityEvaluation::test_environment_deprecated",
"tests/test_config.py::TestPriorityEvaluation::test_first_none_argument",
"tests/test_config.py::TestPriorityEvaluation::test_first_priority",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_k8s_ca",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_token",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_uri",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_success",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_namespace_default"
] |
[] |
Apache License 2.0
| null |
2gis__k8s-handle-84
|
92f764f44301bcd406d588a4db5cf0333fc1ccc2
|
2019-02-12 04:05:12
|
b9a79303b69d7ba25ab015c938df53ffe1e26962
|
diff --git a/k8s_handle/config.py b/k8s_handle/config.py
index df08de4..17cdb33 100644
--- a/k8s_handle/config.py
+++ b/k8s_handle/config.py
@@ -156,6 +156,9 @@ def _update_context_recursively(context, include_history=[]):
def load_context_section(section):
+ if not section:
+ raise RuntimeError('Empty section specification is not allowed')
+
if section == settings.COMMON_SECTION_NAME:
raise RuntimeError('Section "{}" is not intended to deploy'.format(settings.COMMON_SECTION_NAME))
@@ -163,7 +166,8 @@ def load_context_section(section):
if context is None:
raise RuntimeError('Config file "{}" is empty'.format(settings.CONFIG_FILE))
- if section and section not in context:
+
+ if section not in context:
raise RuntimeError('Section "{}" not found in config file "{}"'.format(section, settings.CONFIG_FILE))
# delete all sections except common and used section
|
Empty section passes validation
Empty section string (-s "") passes validation and causes not wrapped KeyError.
|
2gis/k8s-handle
|
diff --git a/tests/test_config.py b/tests/test_config.py
index ce3e228..82e978e 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -65,6 +65,11 @@ class TestContextGeneration(unittest.TestCase):
config.load_context_section('no_templates_section')
self.assertTrue('Section "templates" or "kubectl" not found in config file' in str(context.exception))
+ def test_empty_section(self):
+ with self.assertRaises(RuntimeError) as context:
+ config.load_context_section('')
+ self.assertEqual('Empty section specification is not allowed', str(context.exception))
+
def test_common_section(self):
with self.assertRaises(RuntimeError) as context:
config.load_context_section(settings.COMMON_SECTION_NAME)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"flake8",
"coveralls",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==1.2.7
attrs==22.2.0
cachetools==4.2.4
certifi==2021.5.30
cffi==1.15.1
chardet==3.0.4
coverage==6.2
coveralls==3.3.1
cryptography==40.0.2
docopt==0.6.2
flake8==5.0.4
google-auth==2.22.0
idna==2.7
importlib-metadata==4.2.0
iniconfig==1.1.1
Jinja2==2.10
-e git+https://github.com/2gis/k8s-handle.git@92f764f44301bcd406d588a4db5cf0333fc1ccc2#egg=k8s_handle
kubernetes==7.0.0
MarkupSafe==2.0.1
mccabe==0.7.0
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
PyJWT==2.4.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==3.13
requests==2.20.1
requests-oauthlib==2.0.0
rsa==4.9
semver==2.8.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.24.3
websocket-client==1.3.1
zipp==3.6.0
|
name: k8s-handle
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==1.2.7
- attrs==22.2.0
- cachetools==4.2.4
- cffi==1.15.1
- chardet==3.0.4
- coverage==6.2
- coveralls==3.3.1
- cryptography==40.0.2
- docopt==0.6.2
- flake8==5.0.4
- google-auth==2.22.0
- idna==2.7
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- jinja2==2.10
- kubernetes==7.0.0
- markupsafe==2.0.1
- mccabe==0.7.0
- oauthlib==3.2.2
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pyasn1-modules==0.3.0
- pycodestyle==2.9.1
- pycparser==2.21
- pyflakes==2.5.0
- pyjwt==2.4.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyyaml==3.13
- requests==2.20.1
- requests-oauthlib==2.0.0
- rsa==4.9
- semver==2.8.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.24.3
- websocket-client==1.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/k8s-handle
|
[
"tests/test_config.py::TestContextGeneration::test_empty_section"
] |
[] |
[
"tests/test_config.py::TestContextGeneration::test_check_empty_var",
"tests/test_config.py::TestContextGeneration::test_common_section",
"tests/test_config.py::TestContextGeneration::test_concatination_with_env",
"tests/test_config.py::TestContextGeneration::test_config_incorrect",
"tests/test_config.py::TestContextGeneration::test_config_is_empty",
"tests/test_config.py::TestContextGeneration::test_config_not_exist",
"tests/test_config.py::TestContextGeneration::test_context_update_recursion",
"tests/test_config.py::TestContextGeneration::test_context_update_section",
"tests/test_config.py::TestContextGeneration::test_dashes_in_var_names",
"tests/test_config.py::TestContextGeneration::test_env_var_in_include_2_levels_dont_set",
"tests/test_config.py::TestContextGeneration::test_env_var_in_include_dont_set",
"tests/test_config.py::TestContextGeneration::test_env_var_in_section1_dont_set",
"tests/test_config.py::TestContextGeneration::test_env_var_in_section2_dont_set",
"tests/test_config.py::TestContextGeneration::test_infinite_recursion_loop",
"tests/test_config.py::TestContextGeneration::test_merge_section_options",
"tests/test_config.py::TestContextGeneration::test_no_templates",
"tests/test_config.py::TestContextGeneration::test_not_existed_section",
"tests/test_config.py::TestContextGeneration::test_recursive_vars",
"tests/test_config.py::TestPriorityEvaluation::test_environment_deprecated",
"tests/test_config.py::TestPriorityEvaluation::test_first_none_argument",
"tests/test_config.py::TestPriorityEvaluation::test_first_priority",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_k8s_ca",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_token",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_uri",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_success",
"tests/test_config.py::TestPriorityEvaluation::test_k8s_namespace_default"
] |
[] |
Apache License 2.0
| null |
|
2gis__k8s-handle-93
|
081dee8bde857ef20d287669ac35d16f9e879fc1
|
2019-04-05 09:11:36
|
bfaedd11c9c45683f34a3dd007719d495b94dd73
|
codecov-io: # [Codecov](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=h1) Report
> Merging [#93](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=desc) into [master](https://codecov.io/gh/2gis/k8s-handle/commit/081dee8bde857ef20d287669ac35d16f9e879fc1?src=pr&el=desc) will **decrease** coverage by `1.63%`.
> The diff coverage is `75.51%`.
[](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #93 +/- ##
==========================================
- Coverage 85.34% 83.71% -1.64%
==========================================
Files 12 15 +3
Lines 1208 1308 +100
==========================================
+ Hits 1031 1095 +64
- Misses 177 213 +36
```
| [Impacted Files](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [k8s\_handle/k8s/test\_adapter.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9rOHMvdGVzdF9hZGFwdGVyLnB5) | `100% <100%> (ø)` | :arrow_up: |
| [k8s\_handle/\_\_init\_\_.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9fX2luaXRfXy5weQ==) | `46.66% <100%> (+0.39%)` | :arrow_up: |
| [k8s\_handle/templating.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS90ZW1wbGF0aW5nLnB5) | `91.52% <100%> (-0.08%)` | :arrow_down: |
| [k8s\_handle/exceptions.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9leGNlcHRpb25zLnB5) | `100% <100%> (ø)` | |
| [k8s\_handle/k8s/test\_provisioner.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9rOHMvdGVzdF9wcm92aXNpb25lci5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [k8s\_handle/transforms.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS90cmFuc2Zvcm1zLnB5) | `100% <100%> (ø)` | |
| [k8s\_handle/k8s/deprecation\_checker.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9rOHMvZGVwcmVjYXRpb25fY2hlY2tlci5weQ==) | `92.85% <100%> (-0.25%)` | :arrow_down: |
| [k8s\_handle/filesystem.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9maWxlc3lzdGVtLnB5) | `83.33% <100%> (-0.67%)` | :arrow_down: |
| [k8s\_handle/k8s/test\_deprecation\_checker.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9rOHMvdGVzdF9kZXByZWNhdGlvbl9jaGVja2VyLnB5) | `100% <100%> (ø)` | :arrow_up: |
| [k8s\_handle/k8s/adapters.py](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree#diff-azhzX2hhbmRsZS9rOHMvYWRhcHRlcnMucHk=) | `60.38% <60.38%> (ø)` | |
| ... and [4 more](https://codecov.io/gh/2gis/k8s-handle/pull/93/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=footer). Last update [081dee8...98e2bd4](https://codecov.io/gh/2gis/k8s-handle/pull/93?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
dekhtyarev: @furiousassault , я посмотрел MR.
Но я не уверен, что смогу адекватно найти в нём какие-то ошибки или проблемы. Поэтому давай подождём ещё ревьюверов(особенно @rvadim и @FreakyGranny )
|
diff --git a/README.md b/README.md
index 7596e92..4cafe9d 100644
--- a/README.md
+++ b/README.md
@@ -586,4 +586,13 @@ $ k8s-handle delete -r service.yaml --use-kubeconfig
2019-02-15 14:24:06 INFO:k8s_handle.k8s.resource:Using namespace "test"
2019-02-15 14:24:06 INFO:k8s_handle.k8s.resource:Trying to delete Service "k8s-handle-example"
2019-02-15 14:24:06 INFO:k8s_handle.k8s.resource:Service "k8s-handle-example" deleted
-```
\ No newline at end of file
+```
+
+### Custom resource definitions and custom resources
+Since version 0.5.5 k8s-handle supports Custom resource definition (CRD) and custom resource (CR) kinds.
+If your deployment involves use of such kinds, make sure that CRD was deployed before CR and check correctness of the CRD's scope.
+
+Currently, in the case of a custom resource deployment, k8s-handle takes into account only the namespace
+specified in the `metadata.namespace` field of the spec, in order to distinguish whether CR should be deployed/removed via namespaced API or not, without additional markers or flags.
+
+Default k8s_namespace (taken from CLI, env or context) **is not applied** to such resources. Therefore, in order to create namespaced CR, one should explicitly set `metadata.namespace` field of that resource's spec.
diff --git a/k8s_handle/__init__.py b/k8s_handle/__init__.py
index aed0a37..2eb47a4 100644
--- a/k8s_handle/__init__.py
+++ b/k8s_handle/__init__.py
@@ -11,9 +11,10 @@ from kubernetes.config import list_kube_config_contexts, load_kube_config
from k8s_handle import config
from k8s_handle import settings
from k8s_handle import templating
+from k8s_handle.exceptions import DeprecationError, ProvisioningError
from k8s_handle.filesystem import InvalidYamlError
-from k8s_handle.k8s.deprecation_checker import ApiDeprecationChecker, DeprecationError
-from k8s_handle.k8s.resource import Provisioner, ProvisioningError
+from k8s_handle.k8s.deprecation_checker import ApiDeprecationChecker
+from k8s_handle.k8s.provisioner import Provisioner
COMMAND_DEPLOY = 'deploy'
COMMAND_DESTROY = 'destroy'
diff --git a/k8s_handle/exceptions.py b/k8s_handle/exceptions.py
new file mode 100644
index 0000000..1ac1f1f
--- /dev/null
+++ b/k8s_handle/exceptions.py
@@ -0,0 +1,14 @@
+class ProvisioningError(Exception):
+ pass
+
+
+class DeprecationError(Exception):
+ pass
+
+
+class InvalidYamlError(Exception):
+ pass
+
+
+class TemplateRenderingError(Exception):
+ pass
diff --git a/k8s_handle/filesystem.py b/k8s_handle/filesystem.py
index 7993290..9a6a3d7 100644
--- a/k8s_handle/filesystem.py
+++ b/k8s_handle/filesystem.py
@@ -5,15 +5,13 @@ import tempfile
import yaml
+from k8s_handle.exceptions import InvalidYamlError
+
# furiousassault RE: it's not a good practice to log from utility function
# maybe we should pass os.remove failure silently, it doesn't seem so important
log = logging.getLogger(__name__)
-class InvalidYamlError(Exception):
- pass
-
-
def load_yaml(path):
try:
with open(path) as f:
diff --git a/k8s_handle/k8s/adapters.py b/k8s_handle/k8s/adapters.py
new file mode 100644
index 0000000..e8ec4ce
--- /dev/null
+++ b/k8s_handle/k8s/adapters.py
@@ -0,0 +1,295 @@
+import logging
+
+from kubernetes import client
+from kubernetes.client.rest import ApiException
+
+from k8s_handle import settings
+from k8s_handle.exceptions import ProvisioningError
+from k8s_handle.transforms import add_indent, split_str_by_capital_letters
+from .api_extensions import ResourcesAPI
+from .mocks import K8sClientMock
+
+log = logging.getLogger(__name__)
+
+
+class Adapter:
+ api_versions = {
+ 'apps/v1beta1': client.AppsV1beta1Api,
+ 'v1': client.CoreV1Api,
+ 'extensions/v1beta1': client.ExtensionsV1beta1Api,
+ 'batch/v1': client.BatchV1Api,
+ 'batch/v2alpha1': client.BatchV2alpha1Api,
+ 'batch/v1beta1': client.BatchV1beta1Api,
+ 'policy/v1beta1': client.PolicyV1beta1Api,
+ 'storage.k8s.io/v1': client.StorageV1Api,
+ 'apps/v1': client.AppsV1Api,
+ 'autoscaling/v1': client.AutoscalingV1Api,
+ 'rbac.authorization.k8s.io/v1': client.RbacAuthorizationV1Api,
+ 'scheduling.k8s.io/v1alpha1': client.SchedulingV1alpha1Api,
+ 'scheduling.k8s.io/v1beta1': client.SchedulingV1beta1Api,
+ 'networking.k8s.io/v1': client.NetworkingV1Api,
+ 'apiextensions.k8s.io/v1beta1': client.ApiextensionsV1beta1Api,
+ }
+ kinds_builtin = [
+ 'ConfigMap', 'CronJob', 'DaemonSet', 'Deployment', 'Endpoints',
+ 'Ingress', 'Job', 'Namespace', 'PodDisruptionBudget', 'ResourceQuota',
+ 'Secret', 'Service', 'ServiceAccount', 'StatefulSet', 'StorageClass',
+ 'PersistentVolume', 'PersistentVolumeClaim', 'HorizontalPodAutoscaler',
+ 'Role', 'RoleBinding', 'ClusterRole', 'ClusterRoleBinding', 'CustomResourceDefinition',
+ 'PriorityClass', 'PodSecurityPolicy', 'LimitRange', 'NetworkPolicy'
+ ]
+
+ def __init__(self, spec):
+ self.body = spec
+ self.kind = spec.get('kind', "")
+ self.name = spec.get('metadata', {}).get('name')
+ self.namespace = spec.get('metadata', {}).get('namespace', "") or settings.K8S_NAMESPACE
+
+ @staticmethod
+ def get_instance(spec, api_custom_objects=None, api_resources=None):
+ # due to https://github.com/kubernetes-client/python/issues/387
+ if spec.get('kind') in Adapter.kinds_builtin:
+ if spec.get('apiVersion') == 'test/test':
+ return AdapterBuiltinKind(spec, K8sClientMock(spec.get('metadata', {}).get('name')))
+
+ api = Adapter.api_versions.get(spec.get('apiVersion'))
+
+ if not api:
+ return None
+
+ return AdapterBuiltinKind(spec, api())
+
+ api_custom_objects = api_custom_objects or client.CustomObjectsApi()
+ api_resources = api_resources or ResourcesAPI()
+ return AdapterCustomKind(spec, api_custom_objects, api_resources)
+
+
+class AdapterBuiltinKind(Adapter):
+ def __init__(self, spec, api=None):
+ super().__init__(spec)
+ self.kind = split_str_by_capital_letters(spec['kind'])
+ self.replicas = spec.get('spec', {}).get('replicas')
+ self.api = api
+
+ def get(self):
+ try:
+ if hasattr(self.api, "read_namespaced_{}".format(self.kind)):
+ response = getattr(self.api, 'read_namespaced_{}'.format(self.kind))(
+ self.name, namespace=self.namespace)
+ else:
+ response = getattr(self.api, 'read_{}'.format(self.kind))(self.name)
+ except ApiException as e:
+ if e.reason == 'Not Found':
+ return None
+ log.error('Exception when calling "read_namespaced_{}": {}'.format(self.kind, add_indent(e.body)))
+ raise ProvisioningError(e)
+
+ return response
+
+ def get_pods_by_selector(self, label_selector):
+ try:
+ if not isinstance(self.api, K8sClientMock):
+ self.api = client.CoreV1Api()
+
+ return self.api.list_namespaced_pod(
+ namespace=self.namespace, label_selector='job-name={}'.format(label_selector))
+
+ except ApiException as e:
+ log.error('Exception when calling CoreV1Api->list_namespaced_pod: {}', e)
+ raise e
+
+ def read_pod_status(self, name):
+ try:
+ if not isinstance(self.api, K8sClientMock):
+ self.api = client.CoreV1Api()
+
+ return self.api.read_namespaced_pod_status(name, namespace=self.namespace)
+ except ApiException as e:
+ log.error('Exception when calling CoreV1Api->read_namespaced_pod_status: {}', e)
+ raise e
+
+ def read_pod_logs(self, name, container):
+ log.info('Read logs for pod "{}", container "{}"'.format(name, container))
+ try:
+ if not isinstance(self.api, K8sClientMock):
+ self.api = client.CoreV1Api()
+ if settings.COUNT_LOG_LINES:
+ return self.api.read_namespaced_pod_log(name, namespace=self.namespace, timestamps=True,
+ tail_lines=settings.COUNT_LOG_LINES, container=container)
+ return self.api.read_namespaced_pod_log(name, namespace=self.namespace, timestamps=True,
+ container=container)
+ except ApiException as e:
+ log.error('Exception when calling CoreV1Api->read_namespaced_pod_log: {}', e)
+ raise e
+
+ def create(self):
+ try:
+ if hasattr(self.api, "create_namespaced_{}".format(self.kind)):
+ return getattr(self.api, 'create_namespaced_{}'.format(self.kind))(
+ body=self.body, namespace=self.namespace)
+
+ return getattr(self.api, 'create_{}'.format(self.kind))(body=self.body)
+ except ApiException as e:
+ log.error('Exception when calling "create_namespaced_{}": {}'.format(self.kind, add_indent(e.body)))
+ raise ProvisioningError(e)
+ except ValueError as e:
+ log.error(e)
+ # WORKAROUND https://github.com/kubernetes-client/python/issues/466
+ # also https://github.com/kubernetes-client/gen/issues/52
+ if self.kind not in ['pod_disruption_budget', 'custom_resource_definition']:
+ raise e
+
+ def replace(self, parameters):
+ try:
+ if self.kind in ['custom_resource_definition']:
+ self.body['metadata']['resourceVersion'] = parameters['resourceVersion']
+ return self.api.replace_custom_resource_definition(
+ self.name, self.body,
+ )
+
+ if self.kind in ['service', 'service_account']:
+ if 'spec' in self.body:
+ self.body['spec']['ports'] = parameters.get('ports')
+
+ return getattr(self.api, 'patch_namespaced_{}'.format(self.kind))(
+ name=self.name, body=self.body, namespace=self.namespace
+ )
+
+ if hasattr(self.api, "replace_namespaced_{}".format(self.kind)):
+ return getattr(self.api, 'replace_namespaced_{}'.format(self.kind))(
+ name=self.name, body=self.body, namespace=self.namespace)
+
+ return getattr(self.api, 'replace_{}'.format(self.kind))(
+ name=self.name, body=self.body)
+ except ApiException as e:
+ log.error('Exception when calling "replace_namespaced_{}": {}'.format(self.kind, add_indent(e.body)))
+ raise ProvisioningError(e)
+
+ def delete(self):
+ try:
+ if hasattr(self.api, "delete_namespaced_{}".format(self.kind)):
+ return getattr(self.api, 'delete_namespaced_{}'.format(self.kind))(
+ name=self.name, body=client.V1DeleteOptions(propagation_policy='Foreground'),
+ namespace=self.namespace)
+
+ return getattr(self.api, 'delete_{}'.format(self.kind))(
+ name=self.name, body=client.V1DeleteOptions(propagation_policy='Foreground'))
+ except ApiException as e:
+ if e.reason == 'Not Found':
+ return None
+ log.error('Exception when calling "delete_namespaced_{}": {}'.format(self.kind, add_indent(e.body)))
+ raise ProvisioningError(e)
+
+
+class AdapterCustomKind(Adapter):
+ def __init__(self, spec, api_custom_objects, api_resources):
+ super().__init__(spec)
+ self.api = api_custom_objects
+ self.api_resources = api_resources
+ self.plural = None
+
+ try:
+ api_version_splitted = spec.get('apiVersion').split('/', 1)
+ self.group = api_version_splitted[0]
+ self.version = api_version_splitted[1]
+ except (IndexError, AttributeError):
+ self.group = None
+ self.version = None
+
+ resources_list = self.api_resources.list_api_resource_arbitrary(self.group, self.version)
+
+ if not resources_list:
+ return
+
+ for resource in resources_list.resources:
+ if resource.kind != self.kind:
+ continue
+
+ self.plural = resource.name
+
+ if not resource.namespaced:
+ self.namespace = ""
+
+ break
+
+ def get(self):
+ self._validate()
+
+ try:
+ if self.namespace:
+ return self.api.get_namespaced_custom_object(
+ self.group, self.version, self.namespace, self.plural, self.name
+ )
+
+ return self.api.get_cluster_custom_object(self.group, self.version, self.plural, self.name)
+
+ except ApiException as e:
+ if e.reason == 'Not Found':
+ return None
+
+ log.error('{}'.format(add_indent(e.body)))
+ raise ProvisioningError(e)
+
+ def create(self):
+ self._validate()
+
+ try:
+ if self.namespace:
+ return self.api.create_namespaced_custom_object(
+ self.group, self.version, self.namespace, self.plural, self.body
+ )
+
+ return self.api.create_cluster_custom_object(self.group, self.version, self.plural, self.body)
+
+ except ApiException as e:
+ log.error('{}'.format(add_indent(e.body)))
+ raise ProvisioningError(e)
+
+ def delete(self):
+ self._validate()
+
+ try:
+ if self.namespace:
+ return self.api.delete_namespaced_custom_object(
+ self.group, self.version, self.namespace, self.plural, self.name,
+ client.V1DeleteOptions(propagation_policy='Foreground')
+ )
+
+ return self.api.delete_cluster_custom_object(
+ self.group, self.version, self.plural, self.name,
+ client.V1DeleteOptions(propagation_policy='Foreground')
+ )
+
+ except ApiException as e:
+ if e.reason == 'Not Found':
+ return None
+
+ log.error(
+ '{}'.format(add_indent(e.body)))
+ raise ProvisioningError(e)
+
+ def replace(self, _):
+ self._validate()
+
+ try:
+ if self.namespace:
+ return self.api.patch_namespaced_custom_object(
+ self.group, self.version, self.namespace, self.plural, self.name, self.body
+ )
+
+ return self.api.patch_cluster_custom_object(
+ self.group, self.version, self.plural, self.name, self.body
+ )
+ except ApiException as e:
+ log.error('{}'.format(add_indent(e.body)))
+ raise ProvisioningError(e)
+
+ def _validate(self):
+ if not self.plural:
+ raise RuntimeError("No valid plural name of resource definition discovered")
+
+ if not self.group:
+ raise RuntimeError("No valid resource definition group discovered")
+
+ if not self.version:
+ raise RuntimeError("No valid version of resource definition supplied")
diff --git a/k8s_handle/k8s/api_extensions.py b/k8s_handle/k8s/api_extensions.py
new file mode 100644
index 0000000..e52b59b
--- /dev/null
+++ b/k8s_handle/k8s/api_extensions.py
@@ -0,0 +1,44 @@
+import logging
+
+from kubernetes import client
+from kubernetes.client.rest import ApiException
+
+from k8s_handle.exceptions import ProvisioningError
+from k8s_handle.transforms import add_indent
+
+log = logging.getLogger(__name__)
+
+
+class ResourcesAPI(client.ApisApi):
+ def list_api_resource_arbitrary(self, group, version):
+ try:
+ return self.api_client.call_api(
+ '/apis/{}/{}'.format(group, version), 'GET',
+ {},
+ [],
+ {
+ 'Accept': self.api_client.select_header_accept(
+ ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']
+ ),
+ 'Content-Type': self.api_client.select_header_content_type(
+ ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']
+ )
+ },
+ body=None,
+ post_params=[],
+ files={},
+ response_type='V1APIResourceList',
+ auth_settings=['BearerToken'],
+ async_req=None,
+ _return_http_data_only=True,
+ _preload_content=True,
+ _request_timeout=None,
+ collection_formats={}
+ )
+ except ApiException as e:
+ if e.reason == 'Not Found':
+ log.error('The resource definition with the specified group and version was not found')
+ return None
+
+ log.error('{}'.format(add_indent(e.body)))
+ raise ProvisioningError(e)
diff --git a/k8s_handle/k8s/deprecation_checker.py b/k8s_handle/k8s/deprecation_checker.py
index 6d44f57..adc2b07 100644
--- a/k8s_handle/k8s/deprecation_checker.py
+++ b/k8s_handle/k8s/deprecation_checker.py
@@ -3,14 +3,11 @@ import logging
import semver
from k8s_handle.templating import get_template_contexts
+from k8s_handle.exceptions import DeprecationError
log = logging.getLogger(__name__)
-class DeprecationError(Exception):
- pass
-
-
class ApiDeprecationChecker:
def __init__(self, server_version):
self.server_version = server_version
diff --git a/k8s_handle/k8s/mocks.py b/k8s_handle/k8s/mocks.py
index 3efea1f..f57b13a 100644
--- a/k8s_handle/k8s/mocks.py
+++ b/k8s_handle/k8s/mocks.py
@@ -1,6 +1,8 @@
-from kubernetes.client.rest import ApiException
from collections import namedtuple
+from kubernetes.client import V1APIResourceList
+from kubernetes.client.rest import ApiException
+
class K8sClientMock:
def __init__(self, name=None):
@@ -289,3 +291,21 @@ class ServicePort:
self.target_port = port
else:
self.target_port = port
+
+
+class CustomObjectsAPIMock:
+ pass
+
+
+class ResourcesAPIMock:
+ def __init__(self, api_version=None, group_version=None, resources=None):
+ self._resources = resources
+ self._api_version = api_version
+ self._group_version = group_version
+ self._kind = 'APIResourceList'
+
+ def list_api_resource_arbitrary(self, group, version):
+ if not self._resources or self._group_version != '{}/{}'.format(group, version):
+ return None
+
+ return V1APIResourceList(self._api_version, self._group_version, self._kind, self._resources)
diff --git a/k8s_handle/k8s/resource.py b/k8s_handle/k8s/provisioner.py
similarity index 59%
rename from k8s_handle/k8s/resource.py
rename to k8s_handle/k8s/provisioner.py
index eda2ecd..a8f35dc 100644
--- a/k8s_handle/k8s/resource.py
+++ b/k8s_handle/k8s/provisioner.py
@@ -1,32 +1,18 @@
-import json
import logging
-import re
from time import sleep
-from kubernetes import client
from kubernetes.client.models.v1_label_selector import V1LabelSelector
from kubernetes.client.models.v1_label_selector_requirement import V1LabelSelectorRequirement
from kubernetes.client.models.v1_resource_requirements import V1ResourceRequirements
-from kubernetes.client.rest import ApiException
from k8s_handle import settings
from k8s_handle.templating import get_template_contexts
-from .mocks import K8sClientMock
+from k8s_handle.transforms import split_str_by_capital_letters
+from .adapters import Adapter
log = logging.getLogger(__name__)
-class ProvisioningError(Exception):
- pass
-
-
-def _split_str_by_capital_letters(item):
- # upper the first letter
- item = item[0].upper() + item[1:]
- # transform 'Service' to 'service', 'CronJob' to 'cron_job', 'TargetPort' to 'target_port', etc.
- return '_'.join(re.findall(r'[A-Z][^A-Z]*', item)).lower()
-
-
class Provisioner:
def __init__(self, command, sync_mode, show_logs):
self.command = command
@@ -41,7 +27,7 @@ class Provisioner:
@staticmethod
def _ports_are_equal(old_port, new_port):
for new_key in new_port.keys():
- old_key = _split_str_by_capital_letters(new_key)
+ old_key = split_str_by_capital_letters(new_key)
if getattr(old_port, old_key, None) != new_port.get(new_key, None):
return False
return True
@@ -156,7 +142,7 @@ class Provisioner:
def _is_pvc_specs_equals(self, old_obj, new_dict):
for new_key in new_dict.keys():
- old_key = _split_str_by_capital_letters(new_key)
+ old_key = split_str_by_capital_letters(new_key)
# if template has some new attributes
if not hasattr(old_obj, old_key):
@@ -186,69 +172,74 @@ class Provisioner:
self._deploy(template_body, file_path)
def _deploy(self, template_body, file_path):
- kube_client = Adapter(template_body)
- log.info('Using namespace "{}"'.format(kube_client.namespace))
+ kube_client = Adapter.get_instance(template_body)
- if kube_client.api is None:
- raise RuntimeError('Unknown apiVersion "{}" in template "{}"'.format(template_body['apiVersion'],
- file_path))
+ if not kube_client:
+ raise RuntimeError(
+ 'Unknown apiVersion "{}" in template "{}"'.format(
+ template_body['apiVersion'],
+ file_path
+ )
+ )
+
+ log.info('Using namespace "{}"'.format(kube_client.namespace))
+ resource = kube_client.get()
- if kube_client.get() is None:
+ if resource is None:
log.info('{} "{}" does not exist, create it'.format(template_body['kind'], kube_client.name))
kube_client.create()
else:
log.info('{} "{}" already exists, replace it'.format(template_body['kind'], kube_client.name))
+ parameters = {}
- apply_ports = None
if template_body['kind'] == 'Service':
- resource = kube_client.get()
-
missing_annotations, missing_labels = \
self._get_missing_annotations_and_labels(resource.metadata, template_body['metadata'])
- apply_ports = self._get_apply_ports(resource.spec, template_body['spec'])
+ parameters['ports'] = self._get_apply_ports(resource.spec, template_body['spec'])
self._notify_about_missing_items_in_template(missing_annotations, 'annotation')
self._notify_about_missing_items_in_template(missing_labels, 'label')
- if len(apply_ports) != 0:
- log.info('Next ports will be apply: {}'.format(apply_ports))
+ if parameters['ports']:
+ log.info('Next ports will be applied: {}'.format(parameters['ports']))
if template_body['kind'] == 'PersistentVolumeClaim':
- resource = kube_client.get()
if self._is_pvc_specs_equals(resource.spec, template_body['spec']):
log.info('PersistentVolumeClaim is not changed')
return
if template_body['kind'] == 'PersistentVolume':
- resource = kube_client.get()
if resource.status.phase in ['Bound', 'Released']:
log.warning('PersistentVolume has "{}" status, skip replacing'.format(resource.status.phase))
return
- kube_client.replace(apply_ports)
+ if template_body['kind'] == 'CustomResourceDefinition':
+ parameters['resourceVersion'] = resource.metadata.resource_version
- if template_body['kind'] == 'Deployment' and self.sync_mode:
- self._wait_deployment_complete(kube_client,
- tries=settings.CHECK_STATUS_TRIES,
- timeout=settings.CHECK_STATUS_TIMEOUT)
+ kube_client.replace(parameters)
- if template_body['kind'] == 'StatefulSet' and self.sync_mode:
- self._wait_statefulset_complete(kube_client,
- tries=settings.CHECK_STATUS_TRIES,
- timeout=settings.CHECK_STATUS_TIMEOUT)
+ if self.sync_mode:
+ if template_body['kind'] == 'Deployment':
+ self._wait_deployment_complete(kube_client,
+ tries=settings.CHECK_STATUS_TRIES,
+ timeout=settings.CHECK_STATUS_TIMEOUT)
+
+ if template_body['kind'] == 'StatefulSet':
+ self._wait_statefulset_complete(kube_client,
+ tries=settings.CHECK_STATUS_TRIES,
+ timeout=settings.CHECK_STATUS_TIMEOUT)
- if template_body['kind'] == 'DaemonSet' and self.sync_mode:
- self._wait_daemonset_complete(kube_client,
- tries=settings.CHECK_STATUS_TRIES,
- timeout=settings.CHECK_STATUS_TIMEOUT)
+ if template_body['kind'] == 'DaemonSet':
+ self._wait_daemonset_complete(kube_client,
+ tries=settings.CHECK_STATUS_TRIES,
+ timeout=settings.CHECK_STATUS_TIMEOUT)
- if template_body['kind'] == 'Job' and self.sync_mode:
- return self._wait_job_complete(kube_client,
- tries=settings.CHECK_STATUS_TRIES,
- timeout=settings.CHECK_STATUS_TIMEOUT)
+ if template_body['kind'] == 'Job':
+ return self._wait_job_complete(kube_client,
+ tries=settings.CHECK_STATUS_TRIES,
+ timeout=settings.CHECK_STATUS_TIMEOUT)
if template_body['kind'] == 'Job' and self.show_logs:
- log.info("Got into section")
pod_name, pod_containers = self._get_pod_name_and_containers_by_selector(
kube_client,
template_body['metadata']['name'],
@@ -278,27 +269,38 @@ class Provisioner:
self._destroy(template_body, file_path)
def _destroy(self, template_body, file_path):
- kube_client = Adapter(template_body)
+ kube_client = Adapter.get_instance(template_body)
+
+ if not kube_client:
+ raise RuntimeError(
+ 'Unknown apiVersion "{}" in template "{}"'.format(
+ template_body['apiVersion'],
+ file_path
+ )
+ )
+
log.info('Using namespace "{}"'.format(kube_client.namespace))
log.info('Trying to delete {} "{}"'.format(template_body['kind'], kube_client.name))
- if kube_client.api is None:
- raise RuntimeError('Unknown apiVersion "{}" in template "{}"'.format(template_body['apiVersion'],
- file_path))
-
response = kube_client.delete()
+
if response is None:
+ log.info("{} {} is not found".format(template_body['kind'], kube_client.name))
return
- if response.message is not None:
+ # custom objects api response is a simple dictionary without message field
+ if hasattr(response, 'message') and response.message is not None:
raise RuntimeError('{} "{}" deletion failed: {}'.format(
template_body['kind'], kube_client.name, response.message))
- else:
- if self.sync_mode:
- self._wait_destruction_complete(kube_client, template_body['kind'],
- tries=settings.CHECK_STATUS_TRIES,
- timeout=settings.CHECK_STATUS_TIMEOUT)
- log.info('{} "{}" deleted'.format(template_body['kind'], kube_client.name))
+ if isinstance(response, dict) and not response.get('metadata', {}).get('deletionTimestamp'):
+ raise RuntimeError('{} "{}" deletion failed: {}'.format(template_body['kind'], kube_client.name, response))
+
+ if self.sync_mode:
+ self._wait_destruction_complete(kube_client, template_body['kind'],
+ tries=settings.CHECK_STATUS_TRIES,
+ timeout=settings.CHECK_STATUS_TIMEOUT)
+
+ log.info('{} "{}" has been deleted'.format(template_body['kind'], kube_client.name))
@staticmethod
def _get_pod_name_and_containers_by_selector(kube_client, selector, tries, timeout):
@@ -415,164 +417,3 @@ class Provisioner:
'next attempt in {} sec.'.format(kind, i + 1, timeout))
raise RuntimeError('{} destruction not completed for {} tries'.format(kind, tries))
-
-
-class Adapter:
- client_version_mapping = {
- 'apps/v1beta1': client.AppsV1beta1Api,
- 'v1': client.CoreV1Api,
- 'extensions/v1beta1': client.ExtensionsV1beta1Api,
- 'batch/v1': client.BatchV1Api,
- 'batch/v2alpha1': client.BatchV2alpha1Api,
- 'batch/v1beta1': client.BatchV1beta1Api,
- 'policy/v1beta1': client.PolicyV1beta1Api,
- 'storage.k8s.io/v1': client.StorageV1Api,
- 'apps/v1': client.AppsV1Api,
- 'autoscaling/v1': client.AutoscalingV1Api,
- 'rbac.authorization.k8s.io/v1': client.RbacAuthorizationV1Api,
- 'scheduling.k8s.io/v1alpha1': client.SchedulingV1alpha1Api,
- 'scheduling.k8s.io/v1beta1': client.SchedulingV1beta1Api,
- 'networking.k8s.io/v1': client.NetworkingV1Api,
- 'apiextensions.k8s.io/v1beta1': client.ApiextensionsV1beta1Api,
- }
-
- def __init__(self, spec, api=None):
- self.kind = self._get_app_kind(spec['kind'])
- self.name = spec['metadata']['name']
- self.body = spec
- self.replicas = None if 'spec' not in spec or 'replicas' not in spec['spec'] else spec['spec']['replicas']
- self.namespace = spec['metadata']['namespace'] if 'namespace' in spec['metadata'] else settings.K8S_NAMESPACE
- self.api = api or self._detect_api_object(spec['apiVersion'])
-
- def _detect_api_object(self, api_version):
- # Due to https://github.com/kubernetes-client/python/issues/387
- if api_version == 'test/test':
- return K8sClientMock(self.name)
-
- api = self.client_version_mapping.get(api_version)
-
- if not api:
- return None
-
- return api()
-
- @staticmethod
- def _get_app_kind(kind):
- if kind not in ['ConfigMap', 'CronJob', 'DaemonSet', 'Deployment', 'Endpoints',
- 'Ingress', 'Job', 'Namespace', 'PodDisruptionBudget', 'ResourceQuota',
- 'Secret', 'Service', 'ServiceAccount', 'StatefulSet', 'StorageClass',
- 'PersistentVolume', 'PersistentVolumeClaim', 'HorizontalPodAutoscaler',
- 'Role', 'RoleBinding', 'ClusterRole', 'ClusterRoleBinding', 'CustomResourceDefinition',
- 'PriorityClass', 'PodSecurityPolicy', 'LimitRange', 'NetworkPolicy']:
- raise RuntimeError('Unknown kind "{}" in generated file'.format(kind))
-
- return _split_str_by_capital_letters(kind)
-
- def get(self):
- try:
- if hasattr(self.api, "read_namespaced_{}".format(self.kind)):
- response = getattr(self.api, 'read_namespaced_{}'.format(self.kind))(
- self.name, namespace=self.namespace)
- else:
- response = getattr(self.api, 'read_{}'.format(self.kind))(self.name)
- except ApiException as e:
- if e.reason == 'Not Found':
- return None
- log.error('Exception when calling "read_namespaced_{}": {}'.format(self.kind, self._add_indent(e.body)))
- raise ProvisioningError(e)
-
- return response
-
- def get_pods_by_selector(self, label_selector):
- try:
- if not isinstance(self.api, K8sClientMock):
- self.api = client.CoreV1Api()
-
- return self.api.list_namespaced_pod(
- namespace=self.namespace, label_selector='job-name={}'.format(label_selector))
-
- except ApiException as e:
- log.error('Exception when calling CoreV1Api->list_namespaced_pod: {}', e)
- raise e
-
- def read_pod_status(self, name):
- try:
- if not isinstance(self.api, K8sClientMock):
- self.api = client.CoreV1Api()
-
- return self.api.read_namespaced_pod_status(name, namespace=self.namespace)
- except ApiException as e:
- log.error('Exception when calling CoreV1Api->read_namespaced_pod_status: {}', e)
- raise e
-
- def read_pod_logs(self, name, container):
- log.info('Read logs for pod "{}", container "{}"'.format(name, container))
- try:
- if not isinstance(self.api, K8sClientMock):
- self.api = client.CoreV1Api()
- if settings.COUNT_LOG_LINES:
- return self.api.read_namespaced_pod_log(name, namespace=self.namespace, timestamps=True,
- tail_lines=settings.COUNT_LOG_LINES, container=container)
- return self.api.read_namespaced_pod_log(name, namespace=self.namespace, timestamps=True,
- container=container)
- except ApiException as e:
- log.error('Exception when calling CoreV1Api->read_namespaced_pod_log: {}', e)
- raise e
-
- def create(self):
- try:
- if hasattr(self.api, "create_namespaced_{}".format(self.kind)):
- return getattr(self.api, 'create_namespaced_{}'.format(self.kind))(
- body=self.body, namespace=self.namespace)
-
- return getattr(self.api, 'create_{}'.format(self.kind))(body=self.body)
- except ApiException as e:
- log.error('Exception when calling "create_namespaced_{}": {}'.format(self.kind, self._add_indent(e.body)))
- raise ProvisioningError(e)
- except ValueError as e:
- log.error(e)
- # WORKAROUND https://github.com/kubernetes-client/python/issues/466
- # also https://github.com/kubernetes-client/gen/issues/52
- if self.kind not in ['pod_disruption_budget', 'custom_resource_definition']:
- raise e
-
- def replace(self, ports=None):
- try:
- if self.kind in ['service', 'service_account', ]:
- if ports is not None:
- self.body['spec']['ports'] = ports
- return getattr(self.api, 'patch_namespaced_{}'.format(self.kind))(
- name=self.name, body=self.body, namespace=self.namespace
- )
-
- if hasattr(self.api, "replace_namespaced_{}".format(self.kind)):
- return getattr(self.api, 'replace_namespaced_{}'.format(self.kind))(
- name=self.name, body=self.body, namespace=self.namespace)
-
- return getattr(self.api, 'replace_{}'.format(self.kind))(
- name=self.name, body=self.body)
- except ApiException as e:
- log.error('Exception when calling "replace_namespaced_{}": {}'.format(self.kind, self._add_indent(e.body)))
- raise ProvisioningError(e)
-
- def delete(self):
- try:
- if hasattr(self.api, "delete_namespaced_{}".format(self.kind)):
- return getattr(self.api, 'delete_namespaced_{}'.format(self.kind))(
- name=self.name, body=client.V1DeleteOptions(propagation_policy='Foreground'),
- namespace=self.namespace)
-
- return getattr(self.api, 'delete_{}'.format(self.kind))(
- name=self.name, body=client.V1DeleteOptions(propagation_policy='Foreground'))
- except ApiException as e:
- if e.reason == 'Not Found':
- return None
- log.error('Exception when calling "delete_namespaced_{}": {}'.format(self.kind, self._add_indent(e.body)))
- raise ProvisioningError(e)
-
- @staticmethod
- def _add_indent(json_str):
- try:
- return json.dumps(json.loads(json_str), indent=4)
- except: # NOQA
- return json_str
diff --git a/k8s_handle/templating.py b/k8s_handle/templating.py
index 64457ce..f0ed22c 100644
--- a/k8s_handle/templating.py
+++ b/k8s_handle/templating.py
@@ -10,11 +10,7 @@ from jinja2 import Environment, FileSystemLoader, StrictUndefined
from jinja2.exceptions import TemplateNotFound, TemplateSyntaxError, UndefinedError
from k8s_handle import settings
-
-
-class TemplateRenderingError(Exception):
- pass
-
+from k8s_handle.exceptions import TemplateRenderingError
log = logging.getLogger(__name__)
diff --git a/k8s_handle/transforms.py b/k8s_handle/transforms.py
new file mode 100644
index 0000000..d178d3d
--- /dev/null
+++ b/k8s_handle/transforms.py
@@ -0,0 +1,16 @@
+import json
+import re
+
+
+def split_str_by_capital_letters(item):
+ # upper the first letter
+ item = item[0].upper() + item[1:]
+ # transform 'Service' to 'service', 'CronJob' to 'cron_job', 'TargetPort' to 'target_port', etc.
+ return '_'.join(re.findall(r'[A-Z][^A-Z]*', item)).lower()
+
+
+def add_indent(json_str):
+ try:
+ return json.dumps(json.loads(json_str), indent=4)
+ except: # NOQA
+ return json_str
|
Add custom resources support
After #85 will be done we will want to deploy our [custom resources](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#create-custom-objects) too.
Example ([link](https://docs.cert-manager.io/en/latest/tasks/issuing-certificates/index.html#creating-certificate-resources)):
```yaml
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: example-com
spec:
secretName: example-com-tls
duration: 2160h # 90d
renewBefore: 360h # 15d
commonName: example.com
dnsNames:
- example.com
- www.example.com
issuerRef:
name: ca-issuer
# We can reference ClusterIssuers by changing the kind here.
# The default value is Issuer (i.e. a locally namespaced Issuer)
kind: Issuer
```
|
2gis/k8s-handle
|
diff --git a/k8s_handle/k8s/test_adapter.py b/k8s_handle/k8s/test_adapters.py
similarity index 53%
rename from k8s_handle/k8s/test_adapter.py
rename to k8s_handle/k8s/test_adapters.py
index 0111676..435212b 100644
--- a/k8s_handle/k8s/test_adapter.py
+++ b/k8s_handle/k8s/test_adapters.py
@@ -1,31 +1,28 @@
import unittest
-from .resource import Adapter
-from .mocks import K8sClientMock
-from .resource import ProvisioningError
+from kubernetes.client import V1APIResource
+from k8s_handle.exceptions import ProvisioningError
+from k8s_handle.transforms import split_str_by_capital_letters
+from .adapters import Adapter, AdapterBuiltinKind, AdapterCustomKind
+from .mocks import K8sClientMock, CustomObjectsAPIMock, ResourcesAPIMock
-class TestAdapter(unittest.TestCase):
+class TestAdapterBuiltInKind(unittest.TestCase):
def test_get_app_kind(self):
- self.assertEqual(Adapter._get_app_kind('ConfigMap'), 'config_map')
- self.assertEqual(Adapter._get_app_kind('Namespace'), 'namespace')
- self.assertEqual(Adapter._get_app_kind('PodDisruptionBudget'), 'pod_disruption_budget')
-
- def test_app_kind_invalid(self):
- with self.assertRaises(RuntimeError) as context:
- Adapter(spec={'kind': 'UnknownKind', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
- self.assertTrue('Unknown kind "UnknownKind" in generated file' in str(context.exception))
+ self.assertEqual(split_str_by_capital_letters('ConfigMap'), 'config_map')
+ self.assertEqual(split_str_by_capital_letters('Namespace'), 'namespace')
+ self.assertEqual(split_str_by_capital_letters('PodDisruptionBudget'), 'pod_disruption_budget')
def test_app_get_fail(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'Deployment', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
deployment.get()
self.assertTrue('Get deployment fail' in str(context.exception))
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'StorageClass', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
@@ -33,27 +30,27 @@ class TestAdapter(unittest.TestCase):
self.assertTrue('Get storage class fail' in str(context.exception))
def test_app_get_not_found(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock('404'),
spec={'kind': 'Deployment', 'metadata': {'name': '404'}, 'spec': {'replicas': 1}})
res = deployment.get()
self.assertEqual(res, None)
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock('404'),
spec={'kind': 'StorageClass', 'metadata': {'name': '404'}, 'spec': {'replicas': 1}})
res = storage.get()
self.assertEqual(res, None)
def test_app_get(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock(),
spec={'kind': 'Deployment', 'metadata': {'name': 'test'}, 'spec': {'replicas': 1}})
res = deployment.get()
self.assertEqual(res.metadata, {'key1': 'value1'})
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock(),
spec={'kind': 'StorageClass', 'metadata': {'name': 'test'}, 'spec': {'replicas': 1}})
res = storage.get()
@@ -61,14 +58,14 @@ class TestAdapter(unittest.TestCase):
self.assertEqual(res.metadata, {'key1': 'value1'})
def test_app_create_fail(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'Deployment', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
deployment.create()
self.assertTrue('Create deployment fail' in str(context.exception))
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'StorageClass', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
@@ -76,62 +73,62 @@ class TestAdapter(unittest.TestCase):
self.assertTrue('Create storage class fail' in str(context.exception))
def test_app_create(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock(''),
spec={'kind': 'Deployment', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
res = deployment.create()
self.assertEqual(res, {'key1': 'value1'})
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock(''),
spec={'kind': 'StorageClass', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
res = storage.create()
self.assertEqual(res, {'key1': 'value1'})
def test_app_replace_fail(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'Deployment', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
- deployment.replace()
+ deployment.replace({})
self.assertTrue('Replace deployment fail' in str(context.exception))
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'StorageClass', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
- storage.replace()
+ storage.replace({})
self.assertTrue('Replace storage class fail' in str(context.exception))
def test_app_replace(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock(''),
spec={'kind': 'Deployment', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
- res = deployment.replace()
+ res = deployment.replace({})
self.assertEqual(res, {'key1': 'value1'})
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock(''),
spec={'kind': 'StorageClass', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
- res = storage.replace()
+ res = storage.replace({})
self.assertEqual(res, {'key1': 'value1'})
def test_app_replace_service(self):
- deployment = Adapter(
+ deployment = AdapterBuiltinKind(
api=K8sClientMock(''),
spec={'kind': 'Service', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
- res = deployment.replace()
+ res = deployment.replace({})
self.assertEqual(res, {'key1': 'value1'})
def test_app_delete_fail(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'Deployment', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
client.delete()
self.assertTrue('Delete deployment fail' in str(context.exception))
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock('fail'),
spec={'kind': 'StorageClass', 'metadata': {'name': 'fail'}, 'spec': {'replicas': 1}})
with self.assertRaises(ProvisioningError) as context:
@@ -139,29 +136,122 @@ class TestAdapter(unittest.TestCase):
self.assertTrue('Delete storage class fail' in str(context.exception))
def test_app_delete_not_found(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('404'),
spec={'kind': 'Deployment', 'metadata': {'name': '404'}, 'spec': {'replicas': 1}})
res = client.delete()
self.assertEqual(res, None)
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock('404'),
spec={'kind': 'StorageClass', 'metadata': {'name': '404'}, 'spec': {'replicas': 1}})
res = storage.delete()
self.assertEqual(res, None)
def test_app_delete(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock(),
spec={'kind': 'Deployment', 'metadata': {'name': 'test'}, 'spec': {'replicas': 1}})
res = client.delete()
self.assertEqual(res, {'key1': 'value1'})
- storage = Adapter(
+ storage = AdapterBuiltinKind(
api=K8sClientMock(),
spec={'kind': 'StorageClass', 'metadata': {'name': 'test'}, 'spec': {'replicas': 1}})
res = storage.delete()
self.assertEqual(res, {'key1': 'value1'})
+
+
+class TestAdapter(unittest.TestCase):
+ def test_get_instance_custom(self):
+ self.assertIsInstance(
+ Adapter.get_instance({'kind': "CustomKind"}, CustomObjectsAPIMock(), ResourcesAPIMock()),
+ AdapterCustomKind
+ )
+ self.assertIsInstance(
+ Adapter.get_instance({'kind': "CustomKind"}, CustomObjectsAPIMock(), ResourcesAPIMock()),
+ AdapterCustomKind
+ )
+
+ def test_get_instance_test(self):
+ self.assertIsInstance(
+ Adapter.get_instance(
+ {
+ 'kind': Adapter.kinds_builtin[0],
+ 'apiVersion': 'test/test'
+ }
+ ).api, K8sClientMock)
+
+ def test_get_instance_builtin(self):
+ self.assertIsInstance(
+ Adapter.get_instance(
+ {
+ 'kind': Adapter.kinds_builtin[0],
+ 'apiVersion': 'apps/v1beta1'
+ }
+ ), AdapterBuiltinKind)
+
+ def test_get_instance_negative(self):
+ self.assertIsNone(
+ Adapter.get_instance(
+ {
+ 'kind': Adapter.kinds_builtin[0],
+ 'apiVersion': 'unknown'
+ }
+ )
+ )
+
+
+class TestAdapterCustomKind(unittest.TestCase):
+ @staticmethod
+ def _resources_api_mock():
+ return ResourcesAPIMock(
+ 'version',
+ 'group/version',
+ [V1APIResource(None, 'group', 'kind', 'kinds', True, [], 'kind', [])]
+ )
+
+ def test_initialization_positive(self):
+ adapter = Adapter.get_instance(
+ {
+ 'kind': 'kind',
+ 'apiVersion': 'group/version',
+ 'metadata': {
+ "namespace": 'test_namespace'
+ }
+ }, CustomObjectsAPIMock(), TestAdapterCustomKind._resources_api_mock()
+ )
+ self.assertEqual(adapter.kind, 'kind')
+ self.assertEqual(adapter.namespace, 'test_namespace')
+ self.assertEqual(adapter.group, 'group')
+ self.assertEqual(adapter.version, 'version')
+ self.assertEqual(adapter.plural, 'kinds')
+ self.assertIsInstance(adapter.api, CustomObjectsAPIMock)
+
+ def test_initialization_kind_missing(self):
+ adapter = Adapter.get_instance({}, CustomObjectsAPIMock(), TestAdapterCustomKind._resources_api_mock())
+ self.assertFalse(adapter.kind)
+ self.assertFalse(adapter.plural)
+
+ def test_initialization_api_version_invalid(self):
+ adapter = Adapter.get_instance({}, CustomObjectsAPIMock(), TestAdapterCustomKind._resources_api_mock())
+ self.assertFalse(adapter.group)
+ self.assertFalse(adapter.version)
+
+ adapter = Adapter.get_instance(
+ {'apiVersion': 'noslash'},
+ CustomObjectsAPIMock(),
+ TestAdapterCustomKind._resources_api_mock()
+ )
+ self.assertFalse(adapter.group)
+ self.assertFalse(adapter.version)
+
+ adapter = Adapter.get_instance(
+ {'apiVersion': 'domain/version/something'},
+ CustomObjectsAPIMock(),
+ ResourcesAPIMock()
+ )
+ self.assertEqual(adapter.group, 'domain')
+ self.assertEqual(adapter.version, 'version/something')
diff --git a/k8s_handle/k8s/test_deprecation_checker.py b/k8s_handle/k8s/test_deprecation_checker.py
index 1c8d5ad..0e8faf9 100644
--- a/k8s_handle/k8s/test_deprecation_checker.py
+++ b/k8s_handle/k8s/test_deprecation_checker.py
@@ -1,6 +1,7 @@
import unittest
-from k8s_handle.k8s.deprecation_checker import ApiDeprecationChecker, DeprecationError
+from k8s_handle.exceptions import DeprecationError
+from k8s_handle.k8s.deprecation_checker import ApiDeprecationChecker
class TestApiDeprecationChecker(unittest.TestCase):
diff --git a/k8s_handle/k8s/test_provisioner.py b/k8s_handle/k8s/test_provisioner.py
index f6a4810..4df954e 100644
--- a/k8s_handle/k8s/test_provisioner.py
+++ b/k8s_handle/k8s/test_provisioner.py
@@ -1,14 +1,14 @@
import unittest
from k8s_handle import settings
+from k8s_handle.exceptions import ProvisioningError
from k8s_handle.templating import get_template_contexts
+from .adapters import AdapterBuiltinKind
from .mocks import K8sClientMock
from .mocks import ServiceMetadata
from .mocks import ServicePort
from .mocks import ServiceSpec
-from .resource import Adapter
-from .resource import Provisioner
-from .resource import ProvisioningError
+from .provisioner import Provisioner
class TestProvisioner(unittest.TestCase):
@@ -16,7 +16,7 @@ class TestProvisioner(unittest.TestCase):
settings.GET_ENVIRON_STRICT = False
def test_deployment_wait_complete_fail(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('test1'),
spec={'kind': 'Deployment', 'metadata': {'name': 'test1'}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
@@ -24,69 +24,69 @@ class TestProvisioner(unittest.TestCase):
self.assertTrue('Deployment not completed for 1 tries' in str(context.exception), context.exception)
def test_deployment_wait_complete(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('test2'),
spec={'kind': 'Deployment', 'metadata': {'name': 'test1'}, 'spec': {'replicas': 1}})
Provisioner('deploy', False, None)._wait_deployment_complete(client, tries=1, timeout=0)
def test_statefulset_wait_complete_fail(self):
- client = Adapter(api=K8sClientMock('test1'),
- spec={'kind': 'StatefulSet', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test1'),
+ spec={'kind': 'StatefulSet', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
Provisioner('deploy', False, None)._wait_statefulset_complete(client, tries=1, timeout=0)
self.assertTrue('StatefulSet not completed for 1 tries' in str(context.exception), context.exception)
def test_statefulset_wait_complete(self):
- client = Adapter(api=K8sClientMock('test2'),
- spec={'kind': 'StatefulSet', 'metadata': {'name': ''}, 'spec': {'replicas': 3}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test2'),
+ spec={'kind': 'StatefulSet', 'metadata': {'name': ''}, 'spec': {'replicas': 3}})
Provisioner('deploy', False, None)._wait_statefulset_complete(client, tries=1, timeout=0)
def test_daemonset_wait_complete_fail(self):
- client = Adapter(api=K8sClientMock('test1'),
- spec={'kind': 'DaemonSet', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test1'),
+ spec={'kind': 'DaemonSet', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
Provisioner('deploy', False, None)._wait_daemonset_complete(client, tries=1, timeout=0)
self.assertTrue('DaemonSet not completed for 1 tries' in str(context.exception), context.exception)
def test_daemonset_wait_complete(self):
- client = Adapter(api=K8sClientMock('test2'),
- spec={'kind': 'DaemonSet', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test2'),
+ spec={'kind': 'DaemonSet', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
Provisioner('deploy', False, None)._wait_daemonset_complete(client, tries=1, timeout=0)
def test_job_wait_complete_fail(self):
- client = Adapter(api=K8sClientMock('test1'),
- spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test1'),
+ spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
Provisioner('deploy', False, None)._wait_job_complete(client, tries=1, timeout=0)
self.assertTrue('Job running failed' in str(context.exception))
def test_job_wait_complete_conditions_fail(self):
- client = Adapter(api=K8sClientMock('test2'),
- spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test2'),
+ spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
Provisioner('deploy', False, None)._wait_job_complete(client, tries=1, timeout=0)
self.assertTrue('Job not completed for 1 tries' in str(context.exception), context.exception)
def test_job_wait_complete(self):
- client = Adapter(api=K8sClientMock('test3'),
- spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test3'),
+ spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
Provisioner('deploy', False, None)._wait_job_complete(client, tries=1, timeout=0)
def test_ns_from_template(self):
- client = Adapter(api=K8sClientMock('test'),
- spec={'kind': 'Job', 'metadata': {'name': '', 'namespace': 'test'},
- 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test'),
+ spec={'kind': 'Job', 'metadata': {'name': '', 'namespace': 'test'},
+ 'spec': {'replicas': 1}})
self.assertEqual(client.namespace, 'test')
def test_ns_from_config(self):
settings.K8S_NAMESPACE = 'namespace'
- client = Adapter(api=K8sClientMock('test'),
- spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
+ client = AdapterBuiltinKind(api=K8sClientMock('test'),
+ spec={'kind': 'Job', 'metadata': {'name': ''}, 'spec': {'replicas': 1}})
self.assertEqual(client.namespace, 'namespace')
def test_deployment_destruction_wait_fail(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('test1'),
spec={'kind': 'Deployment', 'metadata': {'name': 'test1'}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
@@ -94,13 +94,13 @@ class TestProvisioner(unittest.TestCase):
self.assertTrue('Deployment destruction not completed for 1 tries' in str(context.exception), context.exception)
def test_deployment_destruction_wait_success(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('404'),
spec={'kind': 'Deployment', 'metadata': {'name': 'test1'}, 'spec': {'replicas': 1}})
Provisioner('destroy', False, None)._wait_destruction_complete(client, 'Deployment', tries=1, timeout=0)
def test_job_destruction_wait_fail(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('test1'),
spec={'kind': 'Job', 'metadata': {'name': 'test1'}, 'spec': {'replicas': 1}})
with self.assertRaises(RuntimeError) as context:
@@ -108,7 +108,7 @@ class TestProvisioner(unittest.TestCase):
self.assertTrue('Job destruction not completed for 1 tries' in str(context.exception), context.exception)
def test_job_destruction_wait_success(self):
- client = Adapter(
+ client = AdapterBuiltinKind(
api=K8sClientMock('404'),
spec={'kind': 'Job', 'metadata': {'name': 'test1'}, 'spec': {'replicas': 1}})
Provisioner('destroy', False, None)._wait_destruction_complete(client, 'Job', tries=1, timeout=0)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_issue_reference",
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 7
}
|
0.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==1.2.7
attrs==22.2.0
cachetools==4.2.4
certifi==2021.5.30
cffi==1.15.1
chardet==3.0.4
cryptography==40.0.2
google-auth==2.22.0
idna==2.7
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==2.10
-e git+https://github.com/2gis/k8s-handle.git@081dee8bde857ef20d287669ac35d16f9e879fc1#egg=k8s_handle
kubernetes==7.0.0
MarkupSafe==2.0.1
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
PyJWT==2.4.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==5.1
requests==2.20.1
requests-oauthlib==2.0.0
rsa==4.9
semver==2.8.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.24.3
websocket-client==1.3.1
zipp==3.6.0
|
name: k8s-handle
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==1.2.7
- attrs==22.2.0
- cachetools==4.2.4
- cffi==1.15.1
- chardet==3.0.4
- cryptography==40.0.2
- google-auth==2.22.0
- idna==2.7
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==2.10
- kubernetes==7.0.0
- markupsafe==2.0.1
- oauthlib==3.2.2
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pyasn1-modules==0.3.0
- pycparser==2.21
- pyjwt==2.4.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyyaml==5.1
- requests==2.20.1
- requests-oauthlib==2.0.0
- rsa==4.9
- semver==2.8.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.24.3
- websocket-client==1.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/k8s-handle
|
[
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_create",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_create_fail",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_delete",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_delete_fail",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_delete_not_found",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_get",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_get_fail",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_get_not_found",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_replace",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_replace_fail",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_app_replace_service",
"k8s_handle/k8s/test_adapters.py::TestAdapterBuiltInKind::test_get_app_kind",
"k8s_handle/k8s/test_adapters.py::TestAdapter::test_get_instance_builtin",
"k8s_handle/k8s/test_adapters.py::TestAdapter::test_get_instance_custom",
"k8s_handle/k8s/test_adapters.py::TestAdapter::test_get_instance_negative",
"k8s_handle/k8s/test_adapters.py::TestAdapter::test_get_instance_test",
"k8s_handle/k8s/test_adapters.py::TestAdapterCustomKind::test_initialization_api_version_invalid",
"k8s_handle/k8s/test_adapters.py::TestAdapterCustomKind::test_initialization_kind_missing",
"k8s_handle/k8s/test_adapters.py::TestAdapterCustomKind::test_initialization_positive",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_kind_not_in_list",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_is_deprecated",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_is_deprecated_equal",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_is_unsupported",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_is_unsupported_equal",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_no_until",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_not_deprecated_yet",
"k8s_handle/k8s/test_deprecation_checker.py::TestApiDeprecationChecker::test_version_not_in_list",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_daemonset_wait_complete",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_daemonset_wait_complete_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deploy_create",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deploy_replace",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deploy_unknown_api",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deployment_destruction_wait_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deployment_destruction_wait_success",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deployment_wait_complete",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_deployment_wait_complete_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_destroy_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_destroy_not_found",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_destroy_success",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_destroy_unknown_api",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case1",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case2",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case3",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case4",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case5",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case6",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case7",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_apply_ports_case8",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_get_template_contexts",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_job_destruction_wait_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_job_destruction_wait_success",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_job_wait_complete",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_job_wait_complete_conditions_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_job_wait_complete_fail",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_missing_annotation_strict",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_missing_annotations_and_labels",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_missing_labels_strict",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_missing_ports_strict",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_no_annotations_in_service_metadata",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_no_annotations_in_template",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_no_missing_annotations_and_labels",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_ns_from_config",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_ns_from_template",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_pvc_replace_equals",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_pvc_replace_new_attribute",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_pvc_replace_not_equals",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_service_replace",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_service_replace_no_ports",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_statefulset_wait_complete",
"k8s_handle/k8s/test_provisioner.py::TestProvisioner::test_statefulset_wait_complete_fail",
"k8s_handle/k8s/test_provisioner.py::TestKubeObject::test_replicas_equal",
"k8s_handle/k8s/test_provisioner.py::TestKubeObject::test_replicas_greater",
"k8s_handle/k8s/test_provisioner.py::TestKubeObject::test_replicas_not_equal",
"k8s_handle/k8s/test_provisioner.py::TestKubeObject::test_replicas_with_hpa_not_equal"
] |
[] |
[] |
[] |
Apache License 2.0
| null |
3YOURMIND__django-migration-linter-113
|
799957a5564e8ca1ea20d7cf643abbc21db4e40f
|
2020-06-12 08:01:19
|
9c4788d851bdacc0ff2c5877a7e9568892af6530
|
diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py
index 31f8fea..c5ea333 100644
--- a/django_migration_linter/migration_linter.py
+++ b/django_migration_linter/migration_linter.py
@@ -289,8 +289,13 @@ class MigrationLinter(object):
@classmethod
def read_migrations_list(cls, migrations_file_path):
+ """
+ Returning an empty list is different from returning None here.
+ None: no file was specified and we should consider all migrations
+ Empty list: no migration found in the file and we should consider no migration
+ """
if not migrations_file_path:
- return []
+ return None
migrations = []
try:
@@ -300,7 +305,14 @@ class MigrationLinter(object):
app_label, name = split_migration_path(line)
migrations.append((app_label, name))
except IOError:
- logger.warning("Migrations list path not found %s", migrations_file_path)
+ logger.exception("Migrations list path not found %s", migrations_file_path)
+ raise Exception("Error while reading migrations list file")
+
+ if not migrations:
+ logger.info(
+ "No valid migration paths found in the migrations file %s",
+ migrations_file_path,
+ )
return migrations
def _gather_migrations_git(self, git_commit_id, migrations_list=None):
@@ -315,7 +327,7 @@ class MigrationLinter(object):
# Only gather lines that include added migrations
if self.is_migration_file(line):
app_label, name = split_migration_path(line)
- if not migrations_list or (app_label, name) in migrations_list:
+ if migrations_list is None or (app_label, name) in migrations_list:
migration = self.migration_loader.disk_migrations[app_label, name]
migrations.append(migration)
diff_process.wait()
@@ -334,7 +346,7 @@ class MigrationLinter(object):
migration,
) in self.migration_loader.disk_migrations.items():
if app_label not in DJANGO_APPS_WITH_MIGRATIONS: # Prune Django apps
- if not migrations_list or (app_label, name) in migrations_list:
+ if migrations_list is None or (app_label, name) in migrations_list:
yield migration
def should_ignore_migration(self, app_label, migration_name, operations=()):
|
Bug: --include-migrations-from argument being ignored
In version 2.2.2, using the `--include-migration-from` argument and specifying a migration .py file will not work and `lintmigrations` will run on all migration files.
On [line 299](https://github.com/3YOURMIND/django-migration-linter/blob/799957a5564e8ca1ea20d7cf643abbc21db4e40f/django_migration_linter/migration_linter.py#L299) of `migration_linter.py` the method `is_migration_file` is being called with every line of the `migrations_file_path` file instead of the filename `migrations_file_path`
|
3YOURMIND/django-migration-linter
|
diff --git a/tests/unit/test_linter.py b/tests/unit/test_linter.py
index 392a43c..d086fbe 100644
--- a/tests/unit/test_linter.py
+++ b/tests/unit/test_linter.py
@@ -88,8 +88,12 @@ class LinterFunctionsTestCase(unittest.TestCase):
def test_read_migrations_unknown_file(self):
file_path = "unknown_file"
- migration_list = MigrationLinter.read_migrations_list(file_path)
- self.assertEqual([], migration_list)
+ with self.assertRaises(Exception):
+ MigrationLinter.read_migrations_list(file_path)
+
+ def test_read_migrations_no_file(self):
+ migration_list = MigrationLinter.read_migrations_list(None)
+ self.assertIsNone(migration_list)
def test_read_migrations_empty_file(self):
with tempfile.NamedTemporaryFile() as tmp:
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
2.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
asgiref==3.4.1
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
Django==3.2.25
-e git+https://github.com/3YOURMIND/django-migration-linter.git@799957a5564e8ca1ea20d7cf643abbc21db4e40f#egg=django_migration_linter
execnet==1.9.0
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
pytz==2025.2
six==1.17.0
sqlparse==0.4.4
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: django-migration-linter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- asgiref==3.4.1
- attrs==22.2.0
- coverage==6.2
- django==3.2.25
- execnet==1.9.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- pytz==2025.2
- six==1.17.0
- sqlparse==0.4.4
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/django-migration-linter
|
[
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_read_migrations_no_file",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_read_migrations_unknown_file"
] |
[
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_exclude_migration_tests",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_gather_all_migrations",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_gather_migrations_with_list",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_get_sql",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_has_errors",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_ignore_applied_migrations",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_ignore_migration_exclude_apps",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_ignore_migration_full_name",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_ignore_migration_include_apps",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_ignore_migration_name_contains",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_ignore_unapplied_migrations"
] |
[
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_read_migrations_empty_file",
"tests/unit/test_linter.py::LinterFunctionsTestCase::test_read_migrations_from_file"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.3yourmind_1776_django-migration-linter-113
|
|
3YOURMIND__django-migration-linter-156
|
a119b4ba1fdfd27bf950e109771c6fd3e41d48dc
|
2021-06-11 20:55:03
|
12255d9af4be14738b4c783045362c035e4a0cd6
|
codecov-commenter: # [Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#156](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (3392da1) into [main](https://codecov.io/gh/3YOURMIND/django-migration-linter/commit/a119b4ba1fdfd27bf950e109771c6fd3e41d48dc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (a119b4b) will **increase** coverage by `0.08%`.
> The diff coverage is `91.66%`.
[](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)
```diff
@@ Coverage Diff @@
## main #156 +/- ##
==========================================
+ Coverage 93.03% 93.11% +0.08%
==========================================
Files 77 77
Lines 1593 1627 +34
==========================================
+ Hits 1482 1515 +33
- Misses 111 112 +1
```
| [Impacted Files](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | |
|---|---|---|
| [django\_migration\_linter/sql\_analyser/mysql.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL215c3FsLnB5) | `91.66% <ø> (ø)` | |
| [django\_migration\_linter/sql\_analyser/sqlite.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL3NxbGl0ZS5weQ==) | `95.65% <ø> (ø)` | |
| [django\_migration\_linter/migration\_linter.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvbWlncmF0aW9uX2xpbnRlci5weQ==) | `82.50% <60.00%> (-0.56%)` | :arrow_down: |
| [django\_migration\_linter/sql\_analyser/analyser.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL2FuYWx5c2VyLnB5) | `94.11% <100.00%> (ø)` | |
| [django\_migration\_linter/sql\_analyser/base.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL2Jhc2UucHk=) | `100.00% <100.00%> (ø)` | |
| [django\_migration\_linter/sql\_analyser/postgresql.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL3Bvc3RncmVzcWwucHk=) | `100.00% <100.00%> (ø)` | |
| [tests/unit/test\_sql\_analyser.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvdW5pdC90ZXN0X3NxbF9hbmFseXNlci5weQ==) | `100.00% <100.00%> (ø)` | |
| [django\_migration\_linter/sql\_analyser/utils.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL3V0aWxzLnB5) | `100.00% <0.00%> (+15.38%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Last update [a119b4b...3392da1](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/156?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
David-Wobrock: Thanks for the review @skarzi ! :muscle: Feel free to comment more, but be aware that I'm still working on this branch.
So it might still get quite some changes ;)
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75223f0..1ee0f0b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,9 @@
* the positional argument `GIT_COMMIT_ID` becomes an optional argument with the named parameter ` --git-commit-id [GIT_COMMIT_ID]`
* the `lintmigrations` command takes now two positional arguments: `lintmigrations [app_label] [migration_name]`
+New features:
+* raise warning when create or dropping an index in a non-concurrent manner using postgresql
+
Miscellaneous:
* Add complete and working support for `toml` configuration files
* Add code coverage to the linter
diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py
index 3ce96ae..c83a9ea 100644
--- a/django_migration_linter/migration_linter.py
+++ b/django_migration_linter/migration_linter.py
@@ -159,17 +159,19 @@ class MigrationLinter(object):
return
sql_statements = self.get_sql(app_label, migration_name)
- errors, ignored = analyse_sql_statements(
+ errors, ignored, warnings = analyse_sql_statements(
sql_statements,
settings.DATABASES[self.database]["ENGINE"],
self.exclude_migration_tests,
)
- err, ignored_data, warnings = self.analyse_data_migration(migration)
+ err, ignored_data, warnings_data = self.analyse_data_migration(migration)
if err:
errors += err
if ignored_data:
ignored += ignored_data
+ if warnings_data:
+ warnings += warnings_data
if self.warnings_as_errors:
errors += warnings
@@ -616,7 +618,7 @@ class MigrationLinter(object):
else:
sql_statements.append(runsql.sql)
- sql_errors, sql_ignored = analyse_sql_statements(
+ sql_errors, sql_ignored, sql_warnings = analyse_sql_statements(
sql_statements,
settings.DATABASES[self.database]["ENGINE"],
self.exclude_migration_tests,
@@ -625,6 +627,8 @@ class MigrationLinter(object):
error += sql_errors
if sql_ignored:
ignored += sql_ignored
+ if sql_warnings:
+ warning += sql_warnings
# And analysse the reverse SQL
if runsql.reversible and runsql.reverse_sql != RunSQL.noop:
@@ -644,7 +648,7 @@ class MigrationLinter(object):
else:
sql_statements.append(runsql.reverse_sql)
- sql_errors, sql_ignored = analyse_sql_statements(
+ sql_errors, sql_ignored, sql_warnings = analyse_sql_statements(
sql_statements,
settings.DATABASES[self.database]["ENGINE"],
self.exclude_migration_tests,
@@ -653,5 +657,7 @@ class MigrationLinter(object):
error += sql_errors
if sql_ignored:
ignored += sql_ignored
+ if sql_warnings:
+ warning += sql_warnings
return error, ignored, warning
diff --git a/django_migration_linter/sql_analyser/analyser.py b/django_migration_linter/sql_analyser/analyser.py
index d69f873..d98610a 100644
--- a/django_migration_linter/sql_analyser/analyser.py
+++ b/django_migration_linter/sql_analyser/analyser.py
@@ -29,4 +29,4 @@ def analyse_sql_statements(
):
sql_analyser = get_sql_analyser(database_vendor, exclude_migration_tests)
sql_analyser.analyse(sql_statements)
- return sql_analyser.errors, sql_analyser.ignored
+ return sql_analyser.errors, sql_analyser.ignored, sql_analyser.warnings
diff --git a/django_migration_linter/sql_analyser/base.py b/django_migration_linter/sql_analyser/base.py
index 4b60ebf..584ebbc 100644
--- a/django_migration_linter/sql_analyser/base.py
+++ b/django_migration_linter/sql_analyser/base.py
@@ -48,24 +48,28 @@ class BaseAnalyser(object):
or re.search("ALTER TABLE .* RENAME TO", sql),
"msg": "RENAMING tables",
"mode": "one_liner",
+ "type": "error",
},
{
"code": "NOT_NULL",
"fn": has_not_null_column,
"msg": "NOT NULL constraint on columns",
"mode": "transaction",
+ "type": "error",
},
{
"code": "DROP_COLUMN",
"fn": lambda sql, **kw: re.search("DROP COLUMN", sql),
"msg": "DROPPING columns",
"mode": "one_liner",
+ "type": "error",
},
{
"code": "DROP_TABLE",
"fn": lambda sql, **kw: sql.startswith("DROP TABLE"),
"msg": "DROPPING table",
"mode": "one_liner",
+ "type": "error",
},
{
"code": "RENAME_COLUMN",
@@ -73,6 +77,7 @@ class BaseAnalyser(object):
or re.search("ALTER TABLE .* RENAME COLUMN", sql),
"msg": "RENAMING columns",
"mode": "one_liner",
+ "type": "error",
},
{
"code": "ALTER_COLUMN",
@@ -84,12 +89,14 @@ class BaseAnalyser(object):
"You may ignore this migration.)"
),
"mode": "one_liner",
+ "type": "error",
},
{
"code": "ADD_UNIQUE",
"fn": has_add_unique,
"msg": "ADDING unique constraint",
"mode": "transaction",
+ "type": "error",
},
]
@@ -98,6 +105,7 @@ class BaseAnalyser(object):
def __init__(self, exclude_migration_tests):
self.exclude_migration_tests = exclude_migration_tests or []
self.errors = []
+ self.warnings = []
self.ignored = []
self.migration_tests = update_migration_tests(
self.base_migration_tests, self.migration_tests
@@ -113,21 +121,26 @@ class BaseAnalyser(object):
@property
def one_line_migration_tests(self):
- return [test for test in self.migration_tests if test["mode"] == "one_liner"]
+ return (test for test in self.migration_tests if test["mode"] == "one_liner")
@property
def transaction_migration_tests(self):
- return [test for test in self.migration_tests if test["mode"] == "transaction"]
+ return (test for test in self.migration_tests if test["mode"] == "transaction")
def _test_sql(self, test, sql):
if test["fn"](sql, errors=self.errors):
- err = self.build_error_dict(migration_test=test, sql_statement=sql)
if test["code"] in self.exclude_migration_tests:
- logger.debug("Testing %s -- IGNORED", sql)
- self.ignored.append(err)
+ action = "IGNORED"
+ list_to_add = self.ignored
+ elif test["type"] == "warning":
+ action = "WARNING"
+ list_to_add = self.warnings
else:
- logger.debug("Testing %s -- ERROR", sql)
- self.errors.append(err)
+ action = "ERROR"
+ list_to_add = self.errors
+ logger.debug("Testing %s -- %s", sql, action)
+ err = self.build_error_dict(migration_test=test, sql_statement=sql)
+ list_to_add.append(err)
else:
logger.debug("Testing %s -- PASSED", sql)
diff --git a/django_migration_linter/sql_analyser/mysql.py b/django_migration_linter/sql_analyser/mysql.py
index 4178c32..487a85e 100644
--- a/django_migration_linter/sql_analyser/mysql.py
+++ b/django_migration_linter/sql_analyser/mysql.py
@@ -11,6 +11,7 @@ class MySqlAnalyser(BaseAnalyser):
"ALTER TABLE .* MODIFY .* (?!NULL);?$", sql
),
"mode": "one_liner",
+ "type": "error",
}
]
diff --git a/django_migration_linter/sql_analyser/postgresql.py b/django_migration_linter/sql_analyser/postgresql.py
index 5da16c2..140aba3 100644
--- a/django_migration_linter/sql_analyser/postgresql.py
+++ b/django_migration_linter/sql_analyser/postgresql.py
@@ -1,5 +1,31 @@
+import re
+
from .base import BaseAnalyser
class PostgresqlAnalyser(BaseAnalyser):
- migration_tests = []
+ migration_tests = [
+ {
+ "code": "CREATE_INDEX",
+ "fn": lambda sql, **kw: re.search("CREATE (UNIQUE )?INDEX", sql)
+ and not re.search("INDEX CONCURRENTLY", sql),
+ "msg": "CREATE INDEX locks table",
+ "mode": "one_liner",
+ "type": "warning",
+ },
+ {
+ "code": "DROP_INDEX",
+ "fn": lambda sql, **kw: re.search("DROP INDEX", sql)
+ and not re.search("INDEX CONCURRENTLY", sql),
+ "msg": "DROP INDEX locks table",
+ "mode": "one_liner",
+ "type": "warning",
+ },
+ {
+ "code": "REINDEX",
+ "fn": lambda sql, **kw: sql.startswith("REINDEX"),
+ "msg": "REINDEX locks table",
+ "mode": "one_liner",
+ "type": "warning",
+ },
+ ]
diff --git a/django_migration_linter/sql_analyser/sqlite.py b/django_migration_linter/sql_analyser/sqlite.py
index 21503c6..9a947d1 100644
--- a/django_migration_linter/sql_analyser/sqlite.py
+++ b/django_migration_linter/sql_analyser/sqlite.py
@@ -27,6 +27,7 @@ class SqliteAnalyser(BaseAnalyser):
"fn": lambda sql, **kw: re.search("ALTER TABLE .* RENAME TO", sql)
and "__old" not in sql
and "new__" not in sql,
+ "type": "error",
},
{
"code": "DROP_TABLE",
@@ -37,6 +38,7 @@ class SqliteAnalyser(BaseAnalyser):
and not any(sql.startswith("CREATE TABLE") for sql in sql_statements),
"msg": "DROPPING table",
"mode": "transaction",
+ "type": "error",
},
{
"code": "NOT_NULL",
@@ -50,8 +52,14 @@ class SqliteAnalyser(BaseAnalyser):
for sql in sql_statements
),
"mode": "transaction",
+ "type": "error",
+ },
+ {
+ "code": "ADD_UNIQUE",
+ "fn": has_add_unique,
+ "mode": "transaction",
+ "type": "error",
},
- {"code": "ADD_UNIQUE", "fn": has_add_unique, "mode": "transaction"},
]
@staticmethod
diff --git a/docs/incompatibilities.md b/docs/incompatibilities.md
index 4f7b0ef..883a79f 100644
--- a/docs/incompatibilities.md
+++ b/docs/incompatibilities.md
@@ -39,3 +39,6 @@ You can ignore check through the `--exclude-migration-test` option and specifyin
|`RUNPYTHON_MODEL_IMPORT` | Missing apps.get_model() calls for model
|`RUNPYTHON_MODEL_VARIABLE_NAME` | The model variable name is different from the model class itself
|`RUNSQL_REVERSIBLE` | RunSQL data migration is not reversible (missing reverse SQL)
+|`CREATE_INDEX` | (Postgresql specific) Creating an index without the concurrent keyword will lock the table and may generate downtime
+|`DROP_INDEX` | (Postgresql specific) Dropping an index without the concurrent keyword will lock the table and may generate downtime
+|`REINDEX` | (Postgresql specific) Reindexing will lock the table and may generate downtime
|
Raise backend specific deployment implications
For instance, certain operations will potentially lock a table, which can have implications during deployment (lots of operations require the table => we don't acquire the lock waiting to migrate / one we have the lock, long migration, locking the table and making production hang)
https://github.com/yandex/zero-downtime-migrations might be interesting to help out for these warnings
|
3YOURMIND/django-migration-linter
|
diff --git a/tests/unit/test_sql_analyser.py b/tests/unit/test_sql_analyser.py
index 4b646ca..bb30d99 100644
--- a/tests/unit/test_sql_analyser.py
+++ b/tests/unit/test_sql_analyser.py
@@ -13,14 +13,22 @@ class SqlAnalyserTestCase(unittest.TestCase):
sql_statements=sql, database_vendor=self.database_vendor
)
- def assertValidSql(self, sql):
- errors, _ = self.analyse_sql(sql)
+ def assertValidSql(self, sql, allow_warnings=False):
+ errors, _, warnings = self.analyse_sql(sql)
self.assertEqual(0, len(errors), "Found errors in sql: {}".format(errors))
+ if not allow_warnings:
+ self.assertEqual(
+ 0, len(warnings), "Found warnings in sql: {}".format(errors)
+ )
def assertBackwardIncompatibleSql(self, sql):
- errors, _ = self.analyse_sql(sql)
+ errors, _, _ = self.analyse_sql(sql)
self.assertNotEqual(0, len(errors), "Found no errors in sql")
+ def assertWarningSql(self, sql):
+ _, _, warnings = self.analyse_sql(sql)
+ self.assertNotEqual(0, len(warnings), "Found no warnings in sql")
+
class MySqlAnalyserTestCase(SqlAnalyserTestCase):
database_vendor = "mysql"
@@ -183,7 +191,7 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
'CREATE INDEX "app_add_manytomany_field_b_many_to_many_b_id_953b185b" ON "app_add_manytomany_field_b_many_to_many"("b_id");',
'CREATE INDEX "app_add_manytomany_field_b_many_to_many_a_id_4b44832a" ON "app_add_manytomany_field_b_many_to_many"("a_id");',
]
- self.assertValidSql(sql)
+ self.assertValidSql(sql, allow_warnings=True)
def test_make_column_not_null_with_django_default(self):
sql = [
@@ -203,3 +211,29 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
'ALTER TABLE "app_drop_default_a" ALTER COLUMN "col" SET DEFAULT `\'empty\';',
]
self.assertValidSql(sql)
+
+ def test_create_index_non_concurrently(self):
+ sql = "CREATE INDEX ON films ((lower(title)));"
+ self.assertWarningSql(sql)
+ sql = "CREATE UNIQUE INDEX title_idx ON films (title);"
+ self.assertWarningSql(sql)
+
+ def test_create_index_concurrently(self):
+ sql = "CREATE INDEX CONCURRENTLY ON films (lower(title));"
+ self.assertValidSql(sql)
+ sql = "CREATE UNIQUE INDEX CONCURRENTLY title_idx ON films (title);"
+ self.assertValidSql(sql)
+
+ def test_drop_index_non_concurrently(self):
+ sql = "DROP INDEX ON films"
+ self.assertWarningSql(sql)
+
+ def test_drop_index_concurrently(self):
+ sql = "DROP INDEX CONCURRENTLY ON films;"
+ self.assertValidSql(sql)
+
+ def test_reindex(self):
+ sql = "REINDEX INDEX my_index;"
+ self.assertWarningSql(sql)
+ sql = "REINDEX TABLE my_table;"
+ self.assertWarningSql(sql)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 8
}
|
2.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
asgiref==3.8.1
coverage==7.8.0
Django==4.2.20
-e git+https://github.com/3YOURMIND/django-migration-linter.git@a119b4ba1fdfd27bf950e109771c6fd3e41d48dc#egg=django_migration_linter
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
six==1.17.0
sqlparse==0.5.3
toml==0.10.2
tomli==2.2.1
typing_extensions==4.13.0
|
name: django-migration-linter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- asgiref==3.8.1
- coverage==7.8.0
- django==4.2.20
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- six==1.17.0
- sqlparse==0.5.3
- toml==0.10.2
- tomli==2.2.1
- typing-extensions==4.13.0
prefix: /opt/conda/envs/django-migration-linter
|
[
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_not_null",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_not_null_followed_by_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_make_column_not_null_with_django_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_make_column_not_null_with_lib_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_add_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_alter_column_after_django22",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_create_table_with_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_rename_table",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_non_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_index_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_index_non_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_make_column_not_null_with_django_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_make_column_not_null_with_lib_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_not_null_followed_by_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_reindex",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_unique_together"
] |
[] |
[] |
[] |
Apache License 2.0
| null |
3YOURMIND__django-migration-linter-186
|
aef3db3e4198d06c38bc4b0874e72ed657891eea
|
2021-12-20 21:27:38
|
aef3db3e4198d06c38bc4b0874e72ed657891eea
|
codecov-commenter: # [Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#186](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (5e2e5c1) into [main](https://codecov.io/gh/3YOURMIND/django-migration-linter/commit/aef3db3e4198d06c38bc4b0874e72ed657891eea?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (aef3db3) will **increase** coverage by `0.08%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)
```diff
@@ Coverage Diff @@
## main #186 +/- ##
==========================================
+ Coverage 93.32% 93.40% +0.08%
==========================================
Files 77 77
Lines 1633 1653 +20
==========================================
+ Hits 1524 1544 +20
Misses 109 109
```
| [Impacted Files](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | |
|---|---|---|
| [django\_migration\_linter/sql\_analyser/postgresql.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL3Bvc3RncmVzcWwucHk=) | `100.00% <100.00%> (ø)` | |
| [tests/unit/test\_sql\_analyser.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvdW5pdC90ZXN0X3NxbF9hbmFseXNlci5weQ==) | `100.00% <100.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Last update [aef3db3...5e2e5c1](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/186?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1ec8e5..15fefc0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,8 @@
-## 4.0.0
+## 4.0.0 (unreleased)
- Drop support for Python 2.7 and 3.5
- Drop support for Django 1.11, 2.0, 2.1, 3.0
+- Fix index creation detection when table is being created in the transaction (issue #178)
## 3.0.1
diff --git a/django_migration_linter/sql_analyser/postgresql.py b/django_migration_linter/sql_analyser/postgresql.py
index 140aba3..3eb18a5 100644
--- a/django_migration_linter/sql_analyser/postgresql.py
+++ b/django_migration_linter/sql_analyser/postgresql.py
@@ -3,14 +3,32 @@ import re
from .base import BaseAnalyser
+def has_create_index(sql_statements, **kwargs):
+ regex_result = None
+ for sql in sql_statements:
+ regex_result = re.search(r"CREATE (UNIQUE )?INDEX.*ON (.*) \(", sql)
+ if re.search("INDEX CONCURRENTLY", sql):
+ regex_result = None
+ elif regex_result:
+ break
+ if not regex_result:
+ return False
+
+ concerned_table = regex_result.group(2)
+ table_is_added_in_transaction = any(
+ sql.startswith("CREATE TABLE {}".format(concerned_table))
+ for sql in sql_statements
+ )
+ return not table_is_added_in_transaction
+
+
class PostgresqlAnalyser(BaseAnalyser):
migration_tests = [
{
"code": "CREATE_INDEX",
- "fn": lambda sql, **kw: re.search("CREATE (UNIQUE )?INDEX", sql)
- and not re.search("INDEX CONCURRENTLY", sql),
+ "fn": has_create_index,
"msg": "CREATE INDEX locks table",
- "mode": "one_liner",
+ "mode": "transaction",
"type": "warning",
},
{
|
Linter fails on CREATE INDEX when creating a new table
Here is an example `CreateModel` from Django:
```python
migrations.CreateModel(
name='ShipmentMetadataAlert',
fields=[
('deleted_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('created_at', common.fields.CreatedField(default=django.utils.timezone.now, editable=False)),
('updated_at', common.fields.LastModifiedField(default=django.utils.timezone.now, editable=False)),
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
('message', models.TextField(blank=True, null=True)),
('level', models.CharField(blank=True, choices=[('HIGH', 'high'), ('MEDIUM', 'medium'), ('LOW', 'low')], max_length=16, null=True)),
('type', models.CharField(blank=True, choices=[('MOBILE_DEVICE_ALERT', 'MOBILE_DEVICE_ALERT'), ('NON_ACTIVE_CARRIER', 'NON_ACTIVE_CARRIER'), ('OTHER', 'OTHER')], max_length=32, null=True)),
('subtype', models.CharField(blank=True, choices=[('DRIVER_PERMISSIONS', 'DRIVER_PERMISSIONS'), ('DRIVER_LOCATION', 'DRIVER_LOCATION'), ('OTHER', 'OTHER')], max_length=32, null=True)),
('occurred_at', models.DateTimeField(null=True)),
('clear_alert_job_id', models.UUIDField(default=None, null=True)),
('metadata', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='alerts', to='shipments.ShipmentMetadata')),
],
options={
'abstract': False,
}
)
```
Here are the SQL statements that this spits out in `sqlmigrate`:
```sql
BEGIN;
--
-- Create model ShipmentMetadataAlert
--
CREATE TABLE "shipments_shipmentmetadataalert" ("deleted_at" timestamp with time zone NULL, "created_at" timestamp with time zone NOT NULL, "updated_at" timestamp with time zone NOT NULL, "id" uuid NOT NULL PRIMARY KEY, "message" text NULL, "level" varchar(16) NULL, "type" varchar(32) NULL, "subtype" varchar(32) NULL, "occurred_at" timestamp with time zone NULL, "clear_alert_job_id" uuid NULL, "metadata_id" uuid NOT NULL);
ALTER TABLE "shipments_shipmentmetadataalert" ADD CONSTRAINT "shipments_shipmentme_metadata_id_f20850e8_fk_shipments" FOREIGN KEY ("metadata_id") REFERENCES "shipments_shipmentmetadata" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "shipments_shipmentmetadataalert_deleted_at_c9a93342" ON "shipments_shipmentmetadataalert" ("deleted_at");
CREATE INDEX "shipments_shipmentmetadataalert_metadata_id_f20850e8" ON "shipments_shipmentmetadataalert" ("metadata_id");
COMMIT;
```
This is an error from the linter as it outputs the error `CREATE INDEX locks table`. But the table is being created within the migration, it just needs to recognize that.
It seems like the `CREATE INDEX` detection should work the same way that the `ADD_UNIQUE` detection works where it detects that the create table is happening in the same migration:
https://github.com/3YOURMIND/django-migration-linter/blob/db71a9db23746f64d41d681f3fecb9b066c87338/django_migration_linter/sql_analyser/base.py#L26-L40
|
3YOURMIND/django-migration-linter
|
diff --git a/tests/unit/test_sql_analyser.py b/tests/unit/test_sql_analyser.py
index 00dd50e..65ab7f0 100644
--- a/tests/unit/test_sql_analyser.py
+++ b/tests/unit/test_sql_analyser.py
@@ -233,6 +233,23 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
sql = "CREATE UNIQUE INDEX title_idx ON films (title);"
self.assertWarningSql(sql)
+ def test_create_index_non_concurrently_with_table_creation(self):
+ sql = [
+ 'CREATE TABLE "films" ("title" text);',
+ 'CREATE INDEX ON "films" ((lower("title")));',
+ ]
+ self.assertValidSql(sql)
+ sql = [
+ 'CREATE TABLE "some_table" ("title" text);',
+ 'CREATE INDEX ON "films" ((lower("title")));',
+ ]
+ self.assertWarningSql(sql)
+ sql = [
+ 'CREATE TABLE "films" ("title" text);',
+ 'CREATE INDEX ON "some_table" ((lower("title")));',
+ ]
+ self.assertWarningSql(sql)
+
def test_create_index_concurrently(self):
sql = "CREATE INDEX CONCURRENTLY ON films (lower(title));"
self.assertValidSql(sql)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
3.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
asgiref==3.8.1
black==21.12b0
click==8.1.8
coverage==7.8.0
Django==4.2.20
-e git+https://github.com/3YOURMIND/django-migration-linter.git@aef3db3e4198d06c38bc4b0874e72ed657891eea#egg=django_migration_linter
exceptiongroup==1.2.2
execnet==2.1.1
flake8==4.0.1
iniconfig==2.1.0
isort==5.10.1
mccabe==0.6.1
mypy-extensions==1.0.0
packaging==24.2
pathspec==0.12.1
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.8.0
pyflakes==2.4.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
sqlparse==0.5.3
toml==0.10.2
tomli==1.2.3
typing_extensions==4.13.0
|
name: django-migration-linter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- asgiref==3.8.1
- black==21.12b0
- click==8.1.8
- coverage==7.8.0
- django==4.2.20
- exceptiongroup==1.2.2
- execnet==2.1.1
- flake8==4.0.1
- iniconfig==2.1.0
- isort==5.10.1
- mccabe==0.6.1
- mypy-extensions==1.0.0
- packaging==24.2
- pathspec==0.12.1
- platformdirs==4.3.7
- pluggy==1.5.0
- pycodestyle==2.8.0
- pyflakes==2.4.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- sqlparse==0.5.3
- toml==0.10.2
- tomli==1.2.3
- typing-extensions==4.13.0
prefix: /opt/conda/envs/django-migration-linter
|
[
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_non_concurrently_with_table_creation"
] |
[] |
[
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_not_null",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_not_null_followed_by_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_make_column_not_null_with_django_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_make_column_not_null_with_lib_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_add_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_alter_column_after_django22",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_create_table_with_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_rename_table",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_non_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_index_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_index_non_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_field_to_not_null_with_dropped_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_make_column_not_null_with_django_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_make_column_not_null_with_lib_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_not_null_followed_by_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_onetoonefield_to_not_null",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_reindex",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_unique_together"
] |
[] |
Apache License 2.0
| null |
3YOURMIND__django-migration-linter-222
|
3baf9487bde6ae27c3ba7623a410ab6c39bb0584
|
2022-07-09 13:34:11
|
366d16b01a72d0baa54fef55761d846b0f05b8dd
|
codecov-commenter: # [Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#222](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (2114d61) into [main](https://codecov.io/gh/3YOURMIND/django-migration-linter/commit/3baf9487bde6ae27c3ba7623a410ab6c39bb0584?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (3baf948) will **decrease** coverage by `0.17%`.
> The diff coverage is `71.42%`.
```diff
@@ Coverage Diff @@
## main #222 +/- ##
==========================================
- Coverage 93.60% 93.43% -0.18%
==========================================
Files 79 79
Lines 1815 1828 +13
==========================================
+ Hits 1699 1708 +9
- Misses 116 120 +4
```
| [Impacted Files](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | |
|---|---|---|
| [tests/functional/test\_data\_migrations.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvZnVuY3Rpb25hbC90ZXN0X2RhdGFfbWlncmF0aW9ucy5weQ==) | `78.65% <66.66%> (-0.87%)` | :arrow_down: |
| [django\_migration\_linter/migration\_linter.py](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvbWlncmF0aW9uX2xpbnRlci5weQ==) | `84.75% <100.00%> (+0.04%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Last update [3baf948...2114d61](https://codecov.io/gh/3YOURMIND/django-migration-linter/pull/222?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1b5213..300fe00 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 4.1.1 (unreleased)
+
+- Fixed `RunPython` model import check when using a `through` object like `MyModel.many_to_many.through.objects.filter(...)` (issue #218)
+
## 4.1.0
- Allow configuring logging for `makemigrations` command and unify behaviour with `lintmigrations` (issue #207)
diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py
index f4b1695..99e72f9 100644
--- a/django_migration_linter/migration_linter.py
+++ b/django_migration_linter/migration_linter.py
@@ -531,7 +531,7 @@ class MigrationLinter(object):
@staticmethod
def get_runpython_model_import_issues(code):
- model_object_regex = re.compile(r"[^a-zA-Z]?([a-zA-Z0-9]+?)\.objects")
+ model_object_regex = re.compile(r"[^a-zA-Z0-9._]?([a-zA-Z0-9._]+?)\.objects")
function_name = code.__name__
source_code = inspect.getsource(code)
@@ -539,6 +539,7 @@ class MigrationLinter(object):
called_models = model_object_regex.findall(source_code)
issues = []
for model in called_models:
+ model = model.split(".", 1)[0]
has_get_model_call = (
re.search(
r"{}.*= +\w+\.get_model\(".format(model),
|
Linter failing when using django 'through'
### through doc
https://docs.djangoproject.com/en/4.0/ref/models/fields/#django.db.models.ManyToManyField.through
### Example code
```
def forwards_func(apps, schema_editor):
Question = apps.get_model("solution", "Question")
...
Question.many_to_may.through.objects.bulk_create(...) <- this line?
...
```
### Example Error
```
(fs_solution, 0002_my_migration)... ERR (cached)
'forwards_func': Could not find an 'apps.get_model("...", "through")' call. Importing the model directly is incorrect for data migrations.
```
|
3YOURMIND/django-migration-linter
|
diff --git a/tests/functional/test_data_migrations.py b/tests/functional/test_data_migrations.py
index 5478eff..2bb039c 100644
--- a/tests/functional/test_data_migrations.py
+++ b/tests/functional/test_data_migrations.py
@@ -137,7 +137,7 @@ class DataMigrationModelImportTestCase(unittest.TestCase):
def test_not_overlapping_model_name(self):
"""
- Correct for the import error, but should raise a warning
+ Correct for the import error, but should raise a warning.
"""
def forward_method(apps, schema_editor):
@@ -159,7 +159,7 @@ class DataMigrationModelImportTestCase(unittest.TestCase):
def test_not_overlapping_one_param(self):
"""
- Not an error, but should raise a warning
+ Not an error, but should raise a warning.
"""
def forward_method(apps, schema_editor):
@@ -170,6 +170,24 @@ class DataMigrationModelImportTestCase(unittest.TestCase):
issues = MigrationLinter.get_runpython_model_import_issues(forward_method)
self.assertEqual(0, len(issues))
+ def test_m2m_through_orm_usage(self):
+ def forward_method(apps, schema_editor):
+ MyModel = apps.get_model("myapp", "MyModel")
+
+ MyModel.many_to_many.through.objects.filter(id=1).first()
+
+ issues = MigrationLinter.get_runpython_model_import_issues(forward_method)
+ self.assertEqual(0, len(issues))
+
+ def test_missing_m2m_through_orm(self):
+ def forward_method(apps, schema_editor):
+ from tests.test_project.app_data_migrations.models import MyModel
+
+ MyModel.many_to_many.through.objects.filter(id=1).first()
+
+ issues = MigrationLinter.get_runpython_model_import_issues(forward_method)
+ self.assertEqual(1, len(issues))
+
class DataMigrationModelVariableNamingTestCase(unittest.TestCase):
def test_same_variable_name(self):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
4.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
asgiref==3.8.1
black==22.6.0
click==8.1.8
coverage==7.8.0
Django==4.2.20
-e git+https://github.com/3YOURMIND/django-migration-linter.git@3baf9487bde6ae27c3ba7623a410ab6c39bb0584#egg=django_migration_linter
exceptiongroup==1.2.2
execnet==2.1.1
flake8==4.0.1
iniconfig==2.1.0
isort==5.10.1
mccabe==0.6.1
mypy-extensions==1.0.0
packaging==24.2
pathspec==0.12.1
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.8.0
pyflakes==2.4.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
sqlparse==0.5.3
toml==0.10.2
tomli==2.2.1
typing_extensions==4.13.0
|
name: django-migration-linter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- asgiref==3.8.1
- black==22.6.0
- click==8.1.8
- coverage==7.8.0
- django==4.2.20
- exceptiongroup==1.2.2
- execnet==2.1.1
- flake8==4.0.1
- iniconfig==2.1.0
- isort==5.10.1
- mccabe==0.6.1
- mypy-extensions==1.0.0
- packaging==24.2
- pathspec==0.12.1
- platformdirs==4.3.7
- pluggy==1.5.0
- pycodestyle==2.8.0
- pyflakes==2.4.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- sqlparse==0.5.3
- toml==0.10.2
- tomli==2.2.1
- typing-extensions==4.13.0
prefix: /opt/conda/envs/django-migration-linter
|
[
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_m2m_through_orm_usage"
] |
[
"tests/functional/test_data_migrations.py::DataMigrationDetectionTestCase::test_all_warnings_as_errors",
"tests/functional/test_data_migrations.py::DataMigrationDetectionTestCase::test_exclude_warning_from_test",
"tests/functional/test_data_migrations.py::DataMigrationDetectionTestCase::test_reverse_data_migration",
"tests/functional/test_data_migrations.py::DataMigrationDetectionTestCase::test_reverse_data_migration_ignore",
"tests/functional/test_data_migrations.py::DataMigrationDetectionTestCase::test_warnings_as_errors_tests_matches",
"tests/functional/test_data_migrations.py::DataMigrationDetectionTestCase::test_warnings_as_errors_tests_no_match",
"tests/functional/test_data_migrations.py::RunSQLMigrationTestCase::test_missing_reserve_migration",
"tests/functional/test_data_migrations.py::RunSQLMigrationTestCase::test_sql_linting_error",
"tests/functional/test_data_migrations.py::RunSQLMigrationTestCase::test_sql_linting_error_args",
"tests/functional/test_data_migrations.py::RunSQLMigrationTestCase::test_sql_linting_error_array"
] |
[
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_correct_get_model_import",
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_correct_one_param_get_model_import",
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_missing_get_model_import",
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_missing_m2m_through_orm",
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_not_overlapping_model_name",
"tests/functional/test_data_migrations.py::DataMigrationModelImportTestCase::test_not_overlapping_one_param",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_correct_variable_name_one_param_multiline",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_diff_variable_name_multiline",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_diff_variable_name_multiline2",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_different_variable_name",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_different_variable_name_one_param",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_different_variable_name_one_param_multiline",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_same_variable_name",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_same_variable_name_multiline",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_same_variable_name_multiline2",
"tests/functional/test_data_migrations.py::DataMigrationModelVariableNamingTestCase::test_same_variable_name_one_param"
] |
[] |
Apache License 2.0
| null |
3YOURMIND__django-migration-linter-258
|
366d16b01a72d0baa54fef55761d846b0f05b8dd
|
2023-07-03 18:35:18
|
366d16b01a72d0baa54fef55761d846b0f05b8dd
|
codecov-commenter: ## [Codecov](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/pull/258?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
Patch coverage: **`100.00`**% and no project coverage change.
> Comparison is base [(`366d16b`)](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/commit/366d16b01a72d0baa54fef55761d846b0f05b8dd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) 93.94% compared to head [(`02cabab`)](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/pull/258?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) 93.95%.
:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #258 +/- ##
=======================================
Coverage 93.94% 93.95%
=======================================
Files 77 77
Lines 1966 1969 +3
=======================================
+ Hits 1847 1850 +3
Misses 119 119
```
| [Impacted Files](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/pull/258?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | |
|---|---|---|
| [django\_migration\_linter/sql\_analyser/base.py](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/pull/258?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGphbmdvX21pZ3JhdGlvbl9saW50ZXIvc3FsX2FuYWx5c2VyL2Jhc2UucHk=) | `100.00% <ø> (ø)` | |
| [tests/unit/test\_sql\_analyser.py](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/pull/258?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvdW5pdC90ZXN0X3NxbF9hbmFseXNlci5weQ==) | `100.00% <100.00%> (ø)` | |
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/3YOURMIND/django-migration-linter/pull/258?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3069d91..beafd65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,10 +4,21 @@
Instead, the linter crashes and lets the `sqlmigrate` error raise, in order to avoid letting a problematic migration pass.
One common reason for such an error is the SQL generation which requires the database to be actually migrated in order to fetch actual constraint names from it.
The crash is a sign to double-check the migration. But if you are certain the migration is safe, you can ignore it (issue #209)
+
+Features:
+
- Fixed `RunPython` model import check when using a `through` object like `MyModel.many_to_many.through.objects.filter(...)` (issue #218)
- Mark the `IgnoreMigration` operation as `elidable=True`
+
+Bug:
+
+- Don't detect not nullable field on partial index creation (issue #250)
+
+Miscellaneous:
+
- Add support for Python 3.11
- Add support for Django 4.1
+- Add support for Django 4.2
- Drop support for Django 2.2
- Internally rename "migration tests" to "migration checks"
- Add dataclasses internally instead of custom dicts
diff --git a/django_migration_linter/sql_analyser/base.py b/django_migration_linter/sql_analyser/base.py
index 2fa0646..131652e 100644
--- a/django_migration_linter/sql_analyser/base.py
+++ b/django_migration_linter/sql_analyser/base.py
@@ -40,7 +40,8 @@ def has_not_null_column(sql_statements: list[str], **kwargs) -> bool:
ends_with_default = False
return (
any(
- re.search("(?<!DROP )NOT NULL", sql) and not sql.startswith("CREATE TABLE")
+ re.search("(?<!DROP )NOT NULL", sql)
+ and not (sql.startswith("CREATE TABLE") or sql.startswith("CREATE INDEX"))
for sql in sql_statements
)
and ends_with_default is False
|
Adding an index with a NOT NULL condition incorrectly triggers NOT_NULL rule
Adding an index with a `WHERE` clause including `NOT NULL` gets flagged as a `NOT NULL constraint on columns` error.
## Steps to reproduce
The follow migration operation:
```python
AddIndexConcurrently(
model_name="prediction",
index=models.Index(
condition=models.Q(
("data_deleted_at__isnull", True),
("delete_data_after__isnull", False),
),
fields=["delete_data_after"],
name="delete_data_after_idx",
),
),
```
Generates the following SQL:
```sql
CREATE INDEX CONCURRENTLY "delete_data_after_idx" ON "models_prediction" ("delete_data_after") WHERE ("data_deleted_at" IS NULL AND "delete_data_after" IS NOT NULL);
```
When linted this is flagged as an error because of the `NOT NULL`, when it ought to be a safe operation.
## Investigation
Looking at the condition used for this rule, I think it might just need to permit `CREATE INDEX` requests:
```python
re.search("(?<!DROP )NOT NULL", sql) and not sql.startswith("CREATE TABLE") and not sql.startswith("CREATE INDEX")
```
https://github.com/3YOURMIND/django-migration-linter/blob/202a6d9d5dea83528cb52fd7481a5a0565cc6f83/django_migration_linter/sql_analyser/base.py#L43
|
3YOURMIND/django-migration-linter
|
diff --git a/tests/unit/test_sql_analyser.py b/tests/unit/test_sql_analyser.py
index d7349fc..012d53c 100644
--- a/tests/unit/test_sql_analyser.py
+++ b/tests/unit/test_sql_analyser.py
@@ -297,6 +297,10 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
sql = "CREATE UNIQUE INDEX CONCURRENTLY title_idx ON films (title);"
self.assertValidSql(sql)
+ def test_create_index_concurrently_where(self):
+ sql = 'CREATE INDEX CONCURRENTLY "index_name" ON "table_name" ("a_column") WHERE ("some_column" IS NOT NULL);'
+ self.assertValidSql(sql)
+
def test_drop_index_non_concurrently(self):
sql = "DROP INDEX ON films"
self.assertWarningSql(sql)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 2
}
|
4.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio"
],
"pre_install": [],
"python": "3.9",
"reqs_path": [
"requirements/dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
asgiref==3.8.1
coverage==7.8.0
Django==4.2.20
-e git+https://github.com/3YOURMIND/django-migration-linter.git@366d16b01a72d0baa54fef55761d846b0f05b8dd#egg=django_migration_linter
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
sqlparse==0.5.3
toml==0.10.2
tomli==2.2.1
typing_extensions==4.13.0
|
name: django-migration-linter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- asgiref==3.8.1
- coverage==7.8.0
- django==4.2.20
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- sqlparse==0.5.3
- toml==0.10.2
- tomli==2.2.1
- typing-extensions==4.13.0
prefix: /opt/conda/envs/django-migration-linter
|
[
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_concurrently_where"
] |
[] |
[
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_not_null",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_add_not_null_followed_by_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_make_column_not_null_with_django_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_make_column_not_null_with_lib_default",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_unique_index",
"tests/unit/test_sql_analyser.py::MySqlAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_add_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_alter_column_after_django22",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_create_table_with_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_rename_table",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_unique_index",
"tests/unit/test_sql_analyser.py::SqliteAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_add_many_to_many_field",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_alter_column",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_non_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_create_index_non_concurrently_with_table_creation",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_index_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_index_non_concurrently",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_drop_not_null",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_field_to_not_null_with_dropped_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_make_column_not_null_with_django_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_make_column_not_null_with_lib_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_not_null_followed_by_default",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_onetoonefield_to_not_null",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_reindex",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_unique_index",
"tests/unit/test_sql_analyser.py::PostgresqlAnalyserTestCase::test_unique_together",
"tests/unit/test_sql_analyser.py::SqlUtilsTestCase::test_unknown_analyser_string",
"tests/unit/test_sql_analyser.py::SqlUtilsTestCase::test_unsupported_db_vendor"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.3yourmind_1776_django-migration-linter-258
|
3YOURMIND__django-migration-linter-47
|
fbf0f4419336fcb1235fa57f5575ad2593354e44
|
2019-01-21 21:29:34
|
3591a4422a34b718cd3400266ac6f92c8421e82a
|
diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py
index f9c0ab1..03c2054 100644
--- a/django_migration_linter/migration_linter.py
+++ b/django_migration_linter/migration_linter.py
@@ -20,7 +20,7 @@ from subprocess import Popen, PIPE
import sys
from .cache import Cache
-from .constants import DEFAULT_CACHE_PATH, MIGRATION_FOLDER_NAME
+from .constants import DEFAULT_CACHE_PATH, MIGRATION_FOLDER_NAME, __version__
from .migration import Migration
from .utils import is_directory, is_django_project, clean_bytes_to_str
from .sql_analyser import analyse_sql_statements
@@ -287,6 +287,9 @@ def _main():
action="store_true",
help="print more information during execution",
)
+ parser.add_argument(
+ "--version", "-V", action="version", version="%(prog)s {}".format(__version__)
+ )
parser.add_argument(
"--database",
type=str,
|
Add --version option
Pretty straightforward. Have a `--version` that prints the current version of the linter.
|
3YOURMIND/django-migration-linter
|
diff --git a/tests/functional/test_cmd_line_call.py b/tests/functional/test_cmd_line_call.py
index a2861fa..47d7944 100644
--- a/tests/functional/test_cmd_line_call.py
+++ b/tests/functional/test_cmd_line_call.py
@@ -16,7 +16,7 @@ import os
import shutil
import unittest
from subprocess import Popen, PIPE
-from django_migration_linter import utils, DEFAULT_CACHE_PATH
+from django_migration_linter import utils, DEFAULT_CACHE_PATH, constants
from tests import fixtures
import sys
@@ -274,3 +274,25 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
self.assertTrue(lines[0].endswith('ERR'))
self.assertTrue(lines[2].endswith('OK'))
self.assertTrue(lines[3].startswith('*** Summary'))
+
+
+class VersionOptionLinterFromCommandLineTest(CallLinterFromCommandLineTest):
+ def test_call_with_version_option(self):
+ cmd = "{} --version".format(self.linter_exec)
+ process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
+ process.wait()
+ self.assertEqual(process.returncode, 0)
+ process_read_stream = process.stderr if sys.version_info.major == 2 else process.stdout
+ lines = list(map(utils.clean_bytes_to_str, process_read_stream.readlines()))
+ self.assertEqual(len(lines), 1)
+ self.assertEqual(lines[0], "django-migration-linter {}".format(constants.__version__))
+
+ def test_call_with_short_version_option(self):
+ cmd = "{} -V".format(self.linter_exec)
+ process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
+ process.wait()
+ self.assertEqual(process.returncode, 0)
+ process_read_stream = process.stderr if sys.version_info.major == 2 else process.stdout
+ lines = list(map(utils.clean_bytes_to_str, process_read_stream.readlines()))
+ self.assertEqual(len(lines), 1)
+ self.assertEqual(lines[0], "django-migration-linter {}".format(constants.__version__))
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 1
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"django-fake-database-backends"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.3
asgiref==3.4.1
attrs==22.2.0
certifi==2021.5.30
distlib==0.3.9
Django==3.2.25
django-fake-database-backends==0.1.1
-e git+https://github.com/3YOURMIND/django-migration-linter.git@fbf0f4419336fcb1235fa57f5575ad2593354e44#egg=django_migration_linter
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytz==2025.2
six==1.17.0
sqlparse==0.4.4
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
virtualenv==20.17.1
zipp==3.6.0
|
name: django-migration-linter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.3
- asgiref==3.4.1
- attrs==22.2.0
- distlib==0.3.9
- django==3.2.25
- django-fake-database-backends==0.1.1
- filelock==3.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytz==2025.2
- six==1.17.0
- sqlparse==0.4.4
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- typing-extensions==4.1.1
- virtualenv==20.17.1
- zipp==3.6.0
prefix: /opt/conda/envs/django-migration-linter
|
[
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_with_short_version_option",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_with_version_option"
] |
[
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_from_within_project",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_cache_path",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_exclude_apps",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_git_id",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_ignore_name",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_ignore_name_contains",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_no_cache",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_working",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_with_deleted_migrations",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_project_non_git_root",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_project_non_git_root_ko",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_from_within_project",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_cache_path",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_exclude_apps",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_git_id",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_ignore_name",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_ignore_name_contains",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_no_cache",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_working",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_with_deleted_migrations",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_project_non_git_root",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_project_non_git_root_ko"
] |
[
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_cache",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_errors",
"tests/functional/test_cmd_line_call.py::CallLinterFromCommandLineTest::test_call_linter_cmd_line_include_apps",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_cache",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_errors",
"tests/functional/test_cmd_line_call.py::VersionOptionLinterFromCommandLineTest::test_call_linter_cmd_line_include_apps"
] |
[] |
Apache License 2.0
| null |
|
42DIGITAL__bqtools-11
|
98ce0de1d976f33cf04217ef50f864f74bd5ed52
|
2019-06-11 11:55:50
|
98ce0de1d976f33cf04217ef50f864f74bd5ed52
|
diff --git a/fourtytwo/bqtools/__init__.py b/fourtytwo/bqtools/__init__.py
index 9542242..136e18c 100644
--- a/fourtytwo/bqtools/__init__.py
+++ b/fourtytwo/bqtools/__init__.py
@@ -104,14 +104,21 @@ class BQTable(object):
def __init__(self, schema=None, data=None):
if DEBUG:
logging.debug('bqtools.BQTable.__init__')
-
+
self.schema = schema if schema else []
self.data = data if data else []
- #def __repr__(self):
- # pass
+ def __repr__(self):
+ schema_shape = len(self.schema)
+ if len(self.data) > 0:
+ data_shape = (len(self.data[0]), len(self.data))
+ else:
+ data_shape = (0,)
+ return '<bqtools.BQTable(shape_schema={}, shape_data={})>'.format(schema_shape, data_shape)
def __eq__(self, other):
+ if not isinstance(other, BQTable):
+ raise TypeError('other must be of type BQTable')
return self.schema == other.schema and self.data == other.data
def __setattr__(self, name, value):
@@ -146,13 +153,18 @@ class BQTable(object):
new_schema.append(bigquery.SchemaField(**field))
if self.schema and new_schema and new_schema != self.schema:
- data = self._move_columns(new_schema)
+ # TODO Handle appends to schema
+ # if len(new_schema) > len(self.schema)
+ data = self._move_columns(schema=new_schema)
else:
data = self.data
-
- data = self._typecheck(schema=new_schema, data=data)
- object.__setattr__(self, '_schema', new_schema)
- object.__setattr__(self, '_data', data)
+
+ if data:
+ data = self._typecheck(schema=new_schema, data=data)
+ object.__setattr__(self, '_schema', new_schema)
+ object.__setattr__(self, '_data', data)
+ else:
+ object.__setattr__(self, '_schema', new_schema)
def _set_data(self, data):
if DEBUG:
@@ -160,14 +172,14 @@ class BQTable(object):
if data and isinstance(data, list):
if isinstance(data[0], dict):
- data = _rows_to_columns(data, self.schema)
- data = self._typecheck(data=data)
+ data = _rows_to_columns(rows=data, schema=self.schema)
+ data = self._typecheck(data=data)
object.__setattr__(self, '_data', data)
def _move_columns(self, schema):
if DEBUG:
logging.debug('bqtools.BQTable._move_columns()')
-
+
old_field_names = [field.name for field in self.schema]
new_field_names = [field.name for field in schema]
column_order = [old_field_names.index(name) for name in new_field_names]
@@ -219,8 +231,8 @@ class BQTable(object):
self._rename_columns(mapping=columns)
def append(self, rows):
- append_columns = _rows_to_columns(rows, self.schema)
- data = self.data
+ append_columns = _rows_to_columns(rows=rows, schema=self.schema)
+ data = self.data if self.data else [[] for n in range(len(self.schema))]
for index in range(len(data)):
data[index] += append_columns[index]
self.data = data
|
append data to empty table.data fails - required for schema_only
```python
>>> from fourtytwo import bqtools
>>> table = bqtools.read_bq(table_ref='project.dataset.table', schema_only=True)
>>> table.append([])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/bqtools/fourtytwo/bqtools/__init__.py", line 224, in append
for index in range(len(data)):
TypeError: object of type 'NoneType' has no len()
```
File "/bqtools/fourtytwo/bqtools/\_\_init\_\_.py", line 224, in append:
```python
def append(self, rows):
append_columns = _rows_to_columns(rows, self.schema)
data = self.data
for index in range(len(data)):
data[index] += append_columns[index]
```
Probably replace range(len(data)) with range(len(self.schema))
|
42DIGITAL/bqtools
|
diff --git a/tests/test_bqtools.py b/tests/test_bqtools.py
index 0202f79..f990c0c 100644
--- a/tests/test_bqtools.py
+++ b/tests/test_bqtools.py
@@ -1,6 +1,6 @@
from fourtytwo import bqtools
-def test_bqorm_construct_columns():
+def test_bqtools_construct_columns():
schema = [
{'name': 'number', 'field_type': 'INTEGER'},
{'name': 'text', 'field_type': 'STRING'},
@@ -12,7 +12,7 @@ def test_bqorm_construct_columns():
assert len(table.data) == 2
assert len(table.rows()) == 4
-def test_bqorm_construct_rows_dicts():
+def test_bqtools_construct_rows_dicts():
schema = [
{'name': 'number', 'field_type': 'INTEGER'},
{'name': 'text', 'field_type': 'STRING'},
@@ -28,3 +28,46 @@ def test_bqorm_construct_rows_dicts():
assert len(table.schema) == 2
assert len(table.data) == 2
assert len(table.rows()) == 4
+
+def test_bqtools_append_list():
+ schema = [
+ {'name': 'number', 'field_type': 'INTEGER'},
+ {'name': 'text', 'field_type': 'STRING'},
+ ]
+ table = bqtools.BQTable(schema=schema)
+ table.append([[1, 'a'], [2, 'b']])
+ assert len(table.data) == 2
+ assert len(table.rows()) == 2
+
+def test_bqtools_append_dict():
+ schema = [
+ {'name': 'number', 'field_type': 'INTEGER'},
+ {'name': 'text', 'field_type': 'STRING'},
+ ]
+ table = bqtools.BQTable(schema=schema)
+ table.append([
+ {'number': 1, 'text': 'a'},
+ {'number': 2, 'text': 'b'}
+ ])
+ assert len(table.data) == 2
+ assert len(table.rows()) == 2
+
+def test_bqtools_append_schema():
+ schema = [
+ {'name': 'number', 'field_type': 'INTEGER'},
+ {'name': 'text', 'field_type': 'STRING'},
+ ]
+ rows = [
+ {'number': 1, 'text': 'a'},
+ {'number': 2, 'text': 'b'},
+ {'number': 3, 'text': 'c'},
+ {'number': 4, 'text': 'd'},
+ ]
+ table = bqtools.BQTable(schema=schema, data=rows)
+
+ table.schema += [{'name': 'test', 'field_type': 'STRING'}]
+ table.schema = table.schema + [{'name': 'test', 'field_type': 'STRING'}]
+ assert len(table.schema) == 3
+ assert len(table.data) == 3
+ assert len(table.rows()) == 4
+
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/42DIGITAL/bqtools.git@98ce0de1d976f33cf04217ef50f864f74bd5ed52#egg=bqtools
cachetools==5.5.2
certifi==2025.1.31
charset-normalizer==3.4.1
exceptiongroup==1.2.2
google-api-core==2.24.2
google-auth==2.38.0
google-cloud-bigquery==3.31.0
google-cloud-core==2.4.3
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
grpcio==1.71.0
grpcio-status==1.71.0
idna==3.10
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pandas==2.2.3
pluggy==1.5.0
proto-plus==1.26.1
protobuf==5.29.4
pyasn1==0.6.1
pyasn1_modules==0.4.2
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.32.3
rsa==4.9
six==1.17.0
tomli==2.2.1
tzdata==2025.2
urllib3==2.3.0
|
name: bqtools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- cachetools==5.5.2
- certifi==2025.1.31
- charset-normalizer==3.4.1
- exceptiongroup==1.2.2
- google-api-core==2.24.2
- google-auth==2.38.0
- google-cloud-bigquery==3.31.0
- google-cloud-core==2.4.3
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- grpcio==1.71.0
- grpcio-status==1.71.0
- idna==3.10
- iniconfig==2.1.0
- numpy==2.0.2
- packaging==24.2
- pandas==2.2.3
- pluggy==1.5.0
- proto-plus==1.26.1
- protobuf==5.29.4
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pytz==2025.2
- requests==2.32.3
- rsa==4.9
- six==1.17.0
- tomli==2.2.1
- tzdata==2025.2
- urllib3==2.3.0
prefix: /opt/conda/envs/bqtools
|
[
"tests/test_bqtools.py::test_bqtools_append_list",
"tests/test_bqtools.py::test_bqtools_append_dict"
] |
[
"tests/test_bqtools.py::test_bqtools_append_schema"
] |
[
"tests/test_bqtools.py::test_bqtools_construct_columns",
"tests/test_bqtools.py::test_bqtools_construct_rows_dicts"
] |
[] |
MIT License
| null |
|
4Catalyzer__flask-resty-248
|
ac43163453fab1b23434d29f71a3c1b34b251c0a
|
2019-04-06 20:23:05
|
ac43163453fab1b23434d29f71a3c1b34b251c0a
|
diff --git a/.travis.yml b/.travis.yml
index 708e4a9..00ffb59 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,16 +4,21 @@ services:
- postgresql
matrix:
include:
- - { python: "2.7", env: "TOXENV=py-full DATABASE_URL=postgres://localhost/travis_ci_test" }
- - { python: "3.5", env: "TOXENV=py-full DATABASE_URL=postgres://localhost/travis_ci_test" }
- - { python: "3.6", env: "TOXENV=py-full DATABASE_URL=postgres://localhost/travis_ci_test" }
- - { python: "3.7", env: "TOXENV=py-full DATABASE_URL=postgres://localhost/travis_ci_test" }
+ - { python: "2.7", env: "TOXENV=py-full-marshmallow2 DATABASE_URL=postgres://localhost/travis_ci_test" }
+ - { python: "3.5", env: "TOXENV=py-full-marshmallow2 DATABASE_URL=postgres://localhost/travis_ci_test" }
+ - { python: "3.6", env: "TOXENV=py-full-marshmallow2 DATABASE_URL=postgres://localhost/travis_ci_test" }
+ - { python: "3.7", env: "TOXENV=py-full-marshmallow2 DATABASE_URL=postgres://localhost/travis_ci_test" }
- - { python: "2.7", env: "TOXENV=py-base" }
- - { python: "3.6", env: "TOXENV=py-base" }
+ - { python: "2.7", env: "TOXENV=py-base-marshmallow2" }
+ - { python: "3.6", env: "TOXENV=py-base-marshmallow2" }
- - { python: "pypy2.7-6.0", env: "TOXENV=py-full" }
- - { python: "pypy3.5-6.0", env: "TOXENV=py-full" }
+ - { python: "2.7", env: "TOXENV=py-full-marshmallow3" }
+ - { python: "3.6", env: "TOXENV=py-full-marshmallow3" }
+ - { python: "2.7", env: "TOXENV=py-base-marshmallow3" }
+ - { python: "3.6", env: "TOXENV=py-base-marshmallow3" }
+
+ - { python: "pypy2.7-6.0", env: "TOXENV=py-full-marshmallow2" }
+ - { python: "pypy3.5-6.0", env: "TOXENV=py-full-marshmallow2" }
cache:
directories:
diff --git a/README.md b/README.md
index 91e22ef..3da8ccd 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Flask-RESTy [![Travis][build-badge]][build] [![PyPI][pypi-badge]][pypi]
+# Flask-RESTy [![Travis][build-badge]][build] [![PyPI][pypi-badge]][pypi] [![marshmallow 2/3 compatible][marshmallow-badge]][marshmallow-upgrading]
Building blocks for REST APIs for [Flask](http://flask.pocoo.org/).
[![Codecov][codecov-badge]][codecov]
@@ -79,3 +79,6 @@ class WidgetSchema(TableSchema):
[codecov-badge]: https://img.shields.io/codecov/c/github/4Catalyzer/flask-resty/master.svg
[codecov]: https://codecov.io/gh/4Catalyzer/flask-resty
+
+[marshmallow-badge]: https://badgen.net/badge/marshmallow/2,3?list=1
+[marshmallow-upgrading]: https://marshmallow.readthedocs.io/en/latest/upgrading.html
diff --git a/flask_resty/compat.py b/flask_resty/compat.py
index 76a767c..4f86e88 100644
--- a/flask_resty/compat.py
+++ b/flask_resty/compat.py
@@ -1,8 +1,11 @@
import sys
+import marshmallow
+
# -----------------------------------------------------------------------------
PY2 = int(sys.version_info[0]) == 2
+MA2 = int(marshmallow.__version__[0]) == 2
# -----------------------------------------------------------------------------
@@ -10,3 +13,23 @@ if PY2:
basestring = basestring # noqa: F821
else:
basestring = (str, bytes)
+
+
+def _strict_run(method, obj_or_data, **kwargs):
+ result = method(obj_or_data, **kwargs)
+ if MA2: # Make marshmallow 2 schemas behave like marshmallow 3
+ data, errors = result
+ if errors:
+ raise marshmallow.ValidationError(errors, data=data)
+ else:
+ data = result
+
+ return data
+
+
+def schema_load(schema, in_data, **kwargs):
+ return _strict_run(schema.load, in_data, **kwargs)
+
+
+def schema_dump(schema, obj, **kwargs):
+ return _strict_run(schema.dump, obj, **kwargs)
diff --git a/flask_resty/fields.py b/flask_resty/fields.py
index 1c2f370..e1ee7f2 100644
--- a/flask_resty/fields.py
+++ b/flask_resty/fields.py
@@ -1,19 +1,18 @@
-from marshmallow import fields, ValidationError
+from marshmallow import fields
import marshmallow.utils
+from .compat import schema_load
+
# -----------------------------------------------------------------------------
class RelatedItem(fields.Nested):
- def _deserialize(self, value, attr, data):
+ def _deserialize(self, value, *args, **kwargs):
if self.many and not marshmallow.utils.is_collection(value):
self.fail('type', input=value, type=value.__class__.__name__)
# Do partial load of related item, as we only need the id.
- data, errors = self.schema.load(value, partial=True)
- if errors:
- raise ValidationError(errors, data=data)
- return data
+ return schema_load(self.schema, value, partial=True)
def _validate_missing(self, value):
# Do not display detailed error data on required fields in nested
diff --git a/flask_resty/view.py b/flask_resty/view.py
index fc6043b..a263919 100644
--- a/flask_resty/view.py
+++ b/flask_resty/view.py
@@ -2,7 +2,7 @@ import itertools
import flask
from flask.views import MethodView
-from marshmallow import fields
+from marshmallow import fields, ValidationError
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import Load
from sqlalchemy.orm.exc import NoResultFound
@@ -11,6 +11,7 @@ from werkzeug.exceptions import NotFound
from . import meta
from .authentication import NoOpAuthentication
from .authorization import NoOpAuthorization
+from .compat import MA2, schema_dump, schema_load
from .decorators import request_cached_property
from .exceptions import ApiError
from .spec import ApiViewDeclaration, ModelViewDeclaration
@@ -36,7 +37,7 @@ class ApiView(MethodView):
return super(ApiView, self).dispatch_request(*args, **kwargs)
def serialize(self, item, **kwargs):
- return self.serializer.dump(item, **kwargs).data
+ return schema_dump(self.serializer, item, **kwargs)
@settable_property
def serializer(self):
@@ -111,11 +112,12 @@ class ApiView(MethodView):
return data_raw
def deserialize(self, data_raw, expected_id=None, **kwargs):
- data, errors = self.deserializer.load(data_raw, **kwargs)
- if errors:
+ try:
+ data = schema_load(self.deserializer, data_raw, **kwargs)
+ except ValidationError as e:
raise ApiError(422, *(
self.format_validation_error(error)
- for error in iter_validation_errors(errors)
+ for error in iter_validation_errors(e.messages)
))
self.validate_request_id(data, expected_id)
@@ -170,8 +172,11 @@ class ApiView(MethodView):
for field_name, field in self.args_schema.fields.items():
if field_name in args:
args_key = field_name
- elif field.load_from and field.load_from in args:
+ elif MA2 and field.load_from and field.load_from in args:
args_key = field.load_from
+ elif not MA2 and field.data_key and field.data_key in args:
+ args_key = field.data_key
+ field_name = field.data_key
else:
continue
@@ -187,11 +192,12 @@ class ApiView(MethodView):
return isinstance(field, fields.List)
def deserialize_args(self, data_raw, **kwargs):
- data, errors = self.args_schema.load(data_raw, **kwargs)
- if errors:
+ try:
+ data = schema_load(self.args_schema, data_raw, **kwargs)
+ except ValidationError as e:
raise ApiError(422, *(
self.format_parameter_validation_error(message, parameter)
- for parameter, messages in errors.items()
+ for parameter, messages in e.messages.items()
for message in messages
))
diff --git a/tox.ini b/tox.ini
index 2a92706..8f5f3b3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,9 +1,12 @@
[tox]
-envlist = py{27,35,37}-{base,full}
+envlist = py{27,35,37}-{base,full}-marshmallow{2,3}
[testenv]
passenv = DATABASE_URL
usedevelop = True
+deps =
+ marshmallow2: marshmallow>=2.2.0,<3.0.0
+ marshmallow3: marshmallow>=3.0.0rc5,<4.0.0
extras =
tests
full: apispec,jwt
|
Support Marshmallow 3
[From here](https://marshmallow.readthedocs.io/en/latest/upgrading.html#schemas-are-always-strict):
> Schema().load and Schema().dump don’t return a (data, errors) tuple any more. Only data is returned.
|
4Catalyzer/flask-resty
|
diff --git a/tests/test_args.py b/tests/test_args.py
index 827aa4c..900b617 100644
--- a/tests/test_args.py
+++ b/tests/test_args.py
@@ -2,6 +2,7 @@ from marshmallow import fields, Schema
import pytest
from flask_resty import Api, ApiView
+from flask_resty.compat import MA2
from flask_resty.testing import assert_response
# -----------------------------------------------------------------------------
@@ -13,10 +14,14 @@ def schemas():
name = fields.String(required=True)
class NameListSchema(Schema):
- names = fields.List(fields.String(), load_from='name', required=True)
+ field_kwargs = {
+ 'load_from' if MA2 else 'data_key': 'name',
+ 'required': True,
+ }
+ names = fields.List(fields.String(), **field_kwargs)
class NameDefaultSchema(Schema):
- name = fields.String(required=True, missing='foo')
+ name = fields.String(missing='foo')
return {
'name': NameSchema(),
diff --git a/tests/test_fields.py b/tests/test_fields.py
index 559a4b8..7d76758 100644
--- a/tests/test_fields.py
+++ b/tests/test_fields.py
@@ -1,7 +1,8 @@
-from marshmallow import fields, Schema
+from marshmallow import fields, Schema, ValidationError
import pytest
from flask_resty import RelatedItem
+from flask_resty.compat import schema_dump, schema_load
# -----------------------------------------------------------------------------
@@ -40,7 +41,7 @@ def error_messages():
def test_dump_single(single_schema):
- data, errors = single_schema.dump({
+ data = schema_dump(single_schema, {
'child': {
'id': 1,
'name': "Foo",
@@ -53,11 +54,10 @@ def test_dump_single(single_schema):
'name': "Foo",
},
}
- assert not errors
def test_dump_many(many_schema):
- data, errors = many_schema.dump({
+ data = schema_dump(many_schema, {
'children': [
{
'id': 1,
@@ -82,11 +82,10 @@ def test_dump_many(many_schema):
},
],
}
- assert not errors
def test_load_single(single_schema):
- data, errors = single_schema.load({
+ data = schema_load(single_schema, {
'child': {
'id': '1',
},
@@ -97,11 +96,10 @@ def test_load_single(single_schema):
'id': 1,
},
}
- assert not errors
def test_load_many(many_schema):
- data, errors = many_schema.load({
+ data = schema_load(many_schema, {
'children': [
{
'id': '1',
@@ -122,29 +120,30 @@ def test_load_many(many_schema):
},
],
}
- assert not errors
# -----------------------------------------------------------------------------
def test_error_load_single_missing(single_schema, error_messages):
- data, errors = single_schema.load({})
+ with pytest.raises(ValidationError) as excinfo:
+ schema_load(single_schema, {})
- assert not data
+ errors = excinfo.value.messages
assert errors == {
'child': [error_messages['required']],
}
def test_error_load_single_field_type(single_schema):
- data, errors = single_schema.load({
- 'child': {
- 'id': 'foo',
- },
- })
+ with pytest.raises(ValidationError) as excinfo:
+ schema_load(single_schema, {
+ 'child': {
+ 'id': 'foo',
+ },
+ })
- assert not data
+ errors = excinfo.value.messages
assert errors == {
'child': {
'id': [fields.Integer().error_messages['invalid']],
@@ -153,22 +152,24 @@ def test_error_load_single_field_type(single_schema):
def test_error_load_many_missing(many_schema, error_messages):
- data, errors = many_schema.load({})
+ with pytest.raises(ValidationError) as excinfo:
+ schema_load(many_schema, {})
- assert not data
+ errors = excinfo.value.messages
assert errors == {
'children': [error_messages['required']],
}
def test_error_load_many_type(many_schema, error_messages):
- data, errors = many_schema.load({
- 'children': {
- 'id': 1,
- },
- })
+ with pytest.raises(ValidationError) as excinfo:
+ schema_load(many_schema, {
+ 'children': {
+ 'id': 1,
+ },
+ })
- assert not data
+ errors = excinfo.value.messages
assert errors == {
'children': [error_messages['type']],
}
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 6
}
|
0.20
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
click==8.0.4
coverage==6.2
dataclasses==0.8
execnet==1.9.0
Flask==2.0.3
-e git+https://github.com/4Catalyzer/flask-resty.git@ac43163453fab1b23434d29f71a3c1b34b251c0a#egg=Flask_RESTy
Flask-SQLAlchemy==2.5.1
greenlet==2.0.2
importlib-metadata==4.8.3
iniconfig==1.1.1
itsdangerous==2.0.1
Jinja2==3.0.3
MarkupSafe==2.0.1
marshmallow==3.14.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
SQLAlchemy==1.4.54
tomli==1.2.3
typing_extensions==4.1.1
Werkzeug==2.0.3
zipp==3.6.0
|
name: flask-resty
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- click==8.0.4
- coverage==6.2
- dataclasses==0.8
- execnet==1.9.0
- flask==2.0.3
- flask-sqlalchemy==2.5.1
- greenlet==2.0.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- itsdangerous==2.0.1
- jinja2==3.0.3
- markupsafe==2.0.1
- marshmallow==3.14.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- sqlalchemy==1.4.54
- tomli==1.2.3
- typing-extensions==4.1.1
- werkzeug==2.0.3
- zipp==3.6.0
prefix: /opt/conda/envs/flask-resty
|
[
"tests/test_args.py::test_get_name_one",
"tests/test_args.py::test_get_name_extra",
"tests/test_args.py::test_get_names_one",
"tests/test_args.py::test_get_names_many",
"tests/test_args.py::test_get_name_default",
"tests/test_args.py::test_get_name_default_specified",
"tests/test_args.py::test_caching",
"tests/test_args.py::test_error_get_name_missing",
"tests/test_args.py::test_error_get_name_many",
"tests/test_args.py::test_error_get_names_missing",
"tests/test_fields.py::test_dump_single",
"tests/test_fields.py::test_dump_many",
"tests/test_fields.py::test_load_single",
"tests/test_fields.py::test_load_many",
"tests/test_fields.py::test_error_load_single_missing",
"tests/test_fields.py::test_error_load_single_field_type",
"tests/test_fields.py::test_error_load_many_missing",
"tests/test_fields.py::test_error_load_many_type"
] |
[] |
[] |
[] |
MIT License
| null |
|
4degrees__clique-26
|
a89507304acce5931f940c34025a6547fa8227b5
|
2016-04-30 17:21:04
|
a89507304acce5931f940c34025a6547fa8227b5
|
diff --git a/source/clique/collection.py b/source/clique/collection.py
index 0c3b296..db9276c 100644
--- a/source/clique/collection.py
+++ b/source/clique/collection.py
@@ -251,15 +251,25 @@ class Collection(object):
else:
data['padding'] = '%d'
- if self.indexes:
+ if '{holes}' in pattern:
data['holes'] = self.holes().format('{ranges}')
+ if '{range}' in pattern or '{ranges}' in pattern:
indexes = list(self.indexes)
- if len(indexes) == 1:
+ indexes_count = len(indexes)
+
+ if indexes_count == 0:
+ data['range'] = ''
+
+ elif indexes_count == 1:
data['range'] = '{0}'.format(indexes[0])
+
else:
- data['range'] = '{0}-{1}'.format(indexes[0], indexes[-1])
+ data['range'] = '{0}-{1}'.format(
+ indexes[0], indexes[-1]
+ )
+ if '{ranges}' in pattern:
separated = self.separate()
if len(separated) > 1:
ranges = [collection.format('{range}')
@@ -270,11 +280,6 @@ class Collection(object):
data['ranges'] = ', '.join(ranges)
- else:
- data['holes'] = ''
- data['range'] = ''
- data['ranges'] = ''
-
return pattern.format(**data)
def is_contiguous(self):
|
collection.format hits maximum recursion depth for collections with lots of holes.
The following code gives an example.
```python
paths = ["name.{0:04d}.jpg".format(x) for x in range(2000)[::2]]
collection = clique.assemble(paths)[0][0]
collection.format("{head}####{tail}")
```
|
4degrees/clique
|
diff --git a/test/unit/test_collection.py b/test/unit/test_collection.py
index ce4daa7..11cb01e 100644
--- a/test/unit/test_collection.py
+++ b/test/unit/test_collection.py
@@ -2,6 +2,7 @@
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
+import sys
import inspect
import pytest
@@ -242,7 +243,6 @@ def test_remove_non_member():
(PaddedCollection, '{range}', '1-12'),
(PaddedCollection, '{ranges}', '1-3, 7, 9-12'),
(PaddedCollection, '{holes}', '4-6, 8'),
-
])
def test_format(CollectionCls, pattern, expected):
'''Format collection according to pattern.'''
@@ -250,6 +250,25 @@ def test_format(CollectionCls, pattern, expected):
assert collection.format(pattern) == expected
+def test_format_sparse_collection():
+ '''Format sparse collection without recursion error.'''
+ recursion_limit = sys.getrecursionlimit()
+ recursion_error_occurred = False
+
+ try:
+ collection = PaddedCollection(
+ indexes=set(range(0, recursion_limit * 2, 2))
+ )
+ collection.format()
+ except RuntimeError as error:
+ if 'maximum recursion depth exceeded' in str(error):
+ recursion_error_occurred = True
+ else:
+ raise
+
+ assert not recursion_error_occurred
+
+
@pytest.mark.parametrize(('collection', 'expected'), [
(PaddedCollection(indexes=set([])), True),
(PaddedCollection(indexes=set([1])), True),
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 1
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest>=2.3.5"
],
"pre_install": null,
"python": "2.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/4degrees/clique.git@a89507304acce5931f940c34025a6547fa8227b5#egg=Clique
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: clique
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/clique
|
[
"test/unit/test_collection.py::test_format_sparse_collection"
] |
[
"test/unit/test_collection.py::test_change_property[head-diff_head.-^diff\\\\_head\\\\.(?P<index>(?P<padding>0*)\\\\d+?)\\\\.tail$-diff_head.1.tail]",
"test/unit/test_collection.py::test_change_property[tail-.diff_tail-^head\\\\.(?P<index>(?P<padding>0*)\\\\d+?)\\\\.diff\\\\_tail$-head.1.diff_tail]"
] |
[
"test/unit/test_collection.py::test_change_property[padding-4-^head\\\\.(?P<index>(?P<padding>0*)\\\\d+?)\\\\.tail$-head.0001.tail]",
"test/unit/test_collection.py::test_unsettable_indexes",
"test/unit/test_collection.py::test_str",
"test/unit/test_collection.py::test_repr",
"test/unit/test_collection.py::test_iterator[unpadded-collection]",
"test/unit/test_collection.py::test_iterator[padded-collection]",
"test/unit/test_collection.py::test_contains[valid",
"test/unit/test_collection.py::test_contains[different",
"test/unit/test_collection.py::test_contains[non-member",
"test/unit/test_collection.py::test_comparisons[equal]",
"test/unit/test_collection.py::test_comparisons[different",
"test/unit/test_collection.py::test_not_implemented_comparison",
"test/unit/test_collection.py::test_match[different",
"test/unit/test_collection.py::test_match[unpadded-collection:unpadded",
"test/unit/test_collection.py::test_match[unpadded-collection:padded",
"test/unit/test_collection.py::test_match[padded-collection:padded",
"test/unit/test_collection.py::test_match[padded-collection:unpadded",
"test/unit/test_collection.py::test_add[unpadded-collection:unpadded",
"test/unit/test_collection.py::test_add[unpadded-collection:padded",
"test/unit/test_collection.py::test_add[padded-collection:padded",
"test/unit/test_collection.py::test_add[padded-collection:unpadded",
"test/unit/test_collection.py::test_add_duplicate",
"test/unit/test_collection.py::test_remove",
"test/unit/test_collection.py::test_remove_non_member",
"test/unit/test_collection.py::test_format[PaddedCollection-{head}-/head.]",
"test/unit/test_collection.py::test_format[PaddedCollection-{padding}-%04d]",
"test/unit/test_collection.py::test_format[UnpaddedCollection-{padding}-%d]",
"test/unit/test_collection.py::test_format[PaddedCollection-{tail}-.ext]",
"test/unit/test_collection.py::test_format[PaddedCollection-{range}-1-12]",
"test/unit/test_collection.py::test_format[PaddedCollection-{ranges}-1-3,",
"test/unit/test_collection.py::test_format[PaddedCollection-{holes}-4-6,",
"test/unit/test_collection.py::test_is_contiguous[empty]",
"test/unit/test_collection.py::test_is_contiguous[single]",
"test/unit/test_collection.py::test_is_contiguous[contiguous",
"test/unit/test_collection.py::test_is_contiguous[non-contiguous]",
"test/unit/test_collection.py::test_holes[empty]",
"test/unit/test_collection.py::test_holes[single",
"test/unit/test_collection.py::test_holes[contiguous",
"test/unit/test_collection.py::test_holes[missing",
"test/unit/test_collection.py::test_holes[range",
"test/unit/test_collection.py::test_holes[multiple",
"test/unit/test_collection.py::test_is_compatible[compatible]",
"test/unit/test_collection.py::test_is_compatible[incompatible",
"test/unit/test_collection.py::test_compatible_merge[both",
"test/unit/test_collection.py::test_compatible_merge[complimentary]",
"test/unit/test_collection.py::test_compatible_merge[duplicates]",
"test/unit/test_collection.py::test_incompatible_merge[incompatible",
"test/unit/test_collection.py::test_separate[empty]",
"test/unit/test_collection.py::test_separate[single",
"test/unit/test_collection.py::test_separate[contiguous",
"test/unit/test_collection.py::test_separate[non-contiguous",
"test/unit/test_collection.py::test_escaping_expression"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.4degrees_1776_clique-26
|
|
6si__shipwright-79
|
7d3ccf39acc79bb6d33a787e773227358764dd2c
|
2016-08-22 09:51:49
|
7d3ccf39acc79bb6d33a787e773227358764dd2c
|
diff --git a/CHANGES.rst b/CHANGES.rst
index f034d37..89cf5f1 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,7 +1,8 @@
0.5.1 (unreleased)
------------------
-- Nothing changed yet.
+- Add --pull-cache to pull images from repository before building.
+ (`Issue #49 <https://github.com/6si/shipwright/issues/49>`_).
0.5.0 (2016-08-19)
diff --git a/shipwright/base.py b/shipwright/base.py
index 213d597..421f1af 100644
--- a/shipwright/base.py
+++ b/shipwright/base.py
@@ -4,10 +4,11 @@ from . import build, dependencies, docker, push
class Shipwright(object):
- def __init__(self, source_control, docker_client, tags):
+ def __init__(self, source_control, docker_client, tags, pull_cache=False):
self.source_control = source_control
self.docker_client = docker_client
self.tags = tags
+ self._pull_cache = pull_cache
def targets(self):
return self.source_control.targets()
@@ -18,7 +19,10 @@ class Shipwright(object):
return self._build(this_ref_str, targets)
def _build(self, this_ref_str, targets):
- for evt in build.do_build(self.docker_client, this_ref_str, targets):
+ client = self.docker_client
+ pull_cache = self._pull_cache
+ ref = this_ref_str
+ for evt in build.do_build(client, ref, targets, pull_cache):
yield evt
# now that we're built and tagged all the images.
diff --git a/shipwright/build.py b/shipwright/build.py
index 707d4f9..4ee1558 100644
--- a/shipwright/build.py
+++ b/shipwright/build.py
@@ -13,7 +13,7 @@ def _merge(d1, d2):
return d
-def do_build(client, build_ref, targets):
+def do_build(client, build_ref, targets, pull_cache):
"""
Generic function for building multiple images while
notifying a callback function with output produced.
@@ -39,11 +39,11 @@ def do_build(client, build_ref, targets):
parent_ref = None
if target.parent:
parent_ref = build_index.get(target.parent)
- for evt in build(client, parent_ref, target):
+ for evt in build(client, parent_ref, target, pull_cache):
yield evt
-def build(client, parent_ref, image):
+def build(client, parent_ref, image, pull_cache):
"""
builds the given image tagged with <build_ref> and ensures that
it depends on it's parent if it's part of this build group (shares
@@ -62,7 +62,25 @@ def build(client, parent_ref, image):
built_tags = docker.last_built_from_docker(client, image.name)
if image.ref in built_tags:
- return []
+ return
+
+ if pull_cache:
+ pull_evts = client.pull(
+ repository=image.name,
+ tag=image.ref,
+ stream=True,
+ )
+
+ failed = False
+ for evt in pull_evts:
+ event = process_event_(evt)
+ if 'error' in event:
+ failed = True
+ else:
+ yield event
+
+ if not failed:
+ return
build_evts = client.build(
fileobj=mkcontext(parent_ref, image.path),
@@ -73,4 +91,5 @@ def build(client, parent_ref, image):
dockerfile=os.path.basename(image.path),
)
- return (process_event_(evt) for evt in build_evts)
+ for evt in build_evts:
+ yield process_event_(evt)
diff --git a/shipwright/cli.py b/shipwright/cli.py
index 24f6f78..82eaf50 100644
--- a/shipwright/cli.py
+++ b/shipwright/cli.py
@@ -109,6 +109,11 @@ def argparser():
help='Build working tree, including uncommited and untracked changes',
action='store_true',
)
+ common.add_argument(
+ '--pull-cache',
+ help='When building try to pull previously built images',
+ action='store_true',
+ )
a_arg(
common, '-d', '--dependants',
help='Build DEPENDANTS and all its dependants',
@@ -157,7 +162,6 @@ def old_style_arg_dict(namespace):
'--exclude': _flatten(ns.exclude),
'--help': False,
'--no-build': getattr(ns, 'no_build', False),
- '--dirty': getattr(ns, 'dirty', False),
'--upto': _flatten(ns.upto),
'--x-assert-hostname': ns.x_assert_hostname,
'-H': ns.docker_host,
@@ -237,8 +241,10 @@ def run(path, arguments, client_cfg, environ, new_style_args=None):
if new_style_args is None:
dirty = False
+ pull_cache = False
else:
dirty = new_style_args.dirty
+ pull_cache = new_style_args.pull_cache
namespace = config['namespace']
name_map = config.get('names', {})
@@ -249,7 +255,7 @@ def run(path, arguments, client_cfg, environ, new_style_args=None):
'to commit these changes, re-run with the --dirty flag.'
)
- sw = Shipwright(scm, client, arguments['tags'])
+ sw = Shipwright(scm, client, arguments['tags'], pull_cache)
command = getattr(sw, command_name)
show_progress = sys.stdout.isatty()
|
docker pull all images for current branch and master before building
Because our buildserver forgets the docker cache between builds we pull the previous build for all the images.
it would be great if we could get shipwright to do it.
Otherwise a command like "shipright images" which lists all the images that shipwright *would* build would let us write our own command to do this.
|
6si/shipwright
|
diff --git a/tests/integration/test_docker_builds.py b/tests/integration/test_docker_builds.py
index 00aa6be..3a22616 100644
--- a/tests/integration/test_docker_builds.py
+++ b/tests/integration/test_docker_builds.py
@@ -12,7 +12,7 @@ from .utils import commit_untracked, create_repo, get_defaults
def default_args():
- return argparse.Namespace(dirty=False)
+ return argparse.Namespace(dirty=False, pull_cache=False)
def test_sample(tmpdir, docker_client):
@@ -734,3 +734,85 @@ def test_build_with_repo_digest(tmpdir, docker_client, registry):
)
for image in old_images:
cli.remove_image(image, force=True)
+
+
+def test_docker_buld_pull_cache(tmpdir, docker_client, registry):
+ path = str(tmpdir.join('shipwright-localhost-sample'))
+ source = pkg_resources.resource_filename(
+ __name__,
+ 'examples/shipwright-localhost-sample',
+ )
+ repo = create_repo(path, source)
+ tag = repo.head.ref.commit.hexsha[:12]
+
+ client_cfg = docker_utils.kwargs_from_env()
+ cli = docker_client
+
+ defaults = get_defaults()
+ defaults['push'] = True
+ try:
+ shipw_cli.run(
+ path=path,
+ client_cfg=client_cfg,
+ arguments=defaults,
+ environ={},
+ )
+
+ # Remove the build images:
+ old_images = (
+ cli.images(name='localhost:5000/service1', quiet=True) +
+ cli.images(name='localhost:5000/shared', quiet=True) +
+ cli.images(name='localhost:5000/base', quiet=True)
+ )
+ for image in old_images:
+ cli.remove_image(image, force=True)
+
+ images_after_delete = (
+ cli.images(name='localhost:5000/service1') +
+ cli.images(name='localhost:5000/shared') +
+ cli.images(name='localhost:5000/base')
+ )
+ assert images_after_delete == []
+
+ args = default_args()
+ args.pull_cache = True
+
+ shipw_cli.run(
+ path=path,
+ client_cfg=client_cfg,
+ arguments=defaults,
+ environ={},
+ new_style_args=args,
+ )
+
+ service1, shared, base = (
+ cli.images(name='localhost:5000/service1') +
+ cli.images(name='localhost:5000/shared') +
+ cli.images(name='localhost:5000/base')
+ )
+
+ assert set(service1['RepoTags']) == {
+ 'localhost:5000/service1:master',
+ 'localhost:5000/service1:latest',
+ 'localhost:5000/service1:' + tag,
+ }
+
+ assert set(shared['RepoTags']) == {
+ 'localhost:5000/shared:master',
+ 'localhost:5000/shared:latest',
+ 'localhost:5000/shared:' + tag,
+ }
+
+ assert set(base['RepoTags']) == {
+ 'localhost:5000/base:master',
+ 'localhost:5000/base:latest',
+ 'localhost:5000/base:' + tag,
+ }
+ finally:
+ old_images = (
+ cli.images(name='localhost:5000/service1', quiet=True) +
+ cli.images(name='localhost:5000/shared', quiet=True) +
+ cli.images(name='localhost:5000/base', quiet=True)
+ )
+ for image in old_images:
+ cli.remove_image(image, force=True)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 260eb92..064f931 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -16,7 +16,6 @@ def get_defaults():
'--exclude': [],
'--help': False,
'--no-build': False,
- '--dirty': False,
'--upto': [],
'--x-assert-hostname': False,
'-H': None,
@@ -90,7 +89,6 @@ def test_args():
'--exclude': [],
'--help': False,
'--no-build': False,
- '--dirty': False,
'--upto': [],
'--x-assert-hostname': True,
'-H': None,
@@ -105,7 +103,7 @@ def test_args_2():
args = [
'--account=x', '--x-assert-hostname', 'build',
'-d', 'foo', 'bar',
- '-t', 'foo', '--dirty',
+ '-t', 'foo', '--dirty', '--pull-cache',
]
parser = cli.argparser()
arguments = cli.old_style_arg_dict(parser.parse_args(args))
@@ -118,7 +116,6 @@ def test_args_2():
'--exclude': [],
'--help': False,
'--no-build': False,
- '--dirty': True,
'--upto': [],
'--x-assert-hostname': True,
'-H': None,
@@ -142,7 +139,6 @@ def test_args_base():
'--exclude': [],
'--help': False,
'--no-build': False,
- '--dirty': False,
'--upto': [],
'--x-assert-hostname': False,
'-H': None,
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 4
}
|
0.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
docker-py==1.10.6
docker-pycreds==0.4.0
exceptiongroup==1.2.2
gitdb2==2.0.6
GitPython==2.1.15
idna==3.10
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
requests==2.32.3
-e git+https://github.com/6si/shipwright.git@7d3ccf39acc79bb6d33a787e773227358764dd2c#egg=shipwright
six==1.17.0
smmap==5.0.2
smmap2==3.0.1
tomli==2.2.1
urllib3==2.3.0
websocket-client==1.8.0
|
name: shipwright
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- docker-py==1.10.6
- docker-pycreds==0.4.0
- exceptiongroup==1.2.2
- gitdb2==2.0.6
- gitpython==2.1.15
- idna==3.10
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cov==6.0.0
- requests==2.32.3
- six==1.17.0
- smmap==5.0.2
- smmap2==3.0.1
- tomli==2.2.1
- urllib3==2.3.0
- websocket-client==1.8.0
prefix: /opt/conda/envs/shipwright
|
[
"tests/test_cli.py::test_args",
"tests/test_cli.py::test_args_2",
"tests/test_cli.py::test_args_base"
] |
[
"tests/integration/test_docker_builds.py::test_sample",
"tests/integration/test_docker_builds.py::test_multi_dockerfile",
"tests/integration/test_docker_builds.py::test_clean_tree_avoids_rebuild",
"tests/integration/test_docker_builds.py::test_clean_tree_avoids_rebuild_new_image_definition",
"tests/integration/test_docker_builds.py::test_dump_file",
"tests/integration/test_docker_builds.py::test_exclude",
"tests/integration/test_docker_builds.py::test_exact",
"tests/integration/test_docker_builds.py::test_dirty_flag",
"tests/integration/test_docker_builds.py::test_exit_on_failure_but_build_completes",
"tests/integration/test_docker_builds.py::test_short_name_target",
"tests/integration/test_docker_builds.py::test_child_inherits_parents_build_tag"
] |
[
"tests/integration/test_docker_builds.py::test_dirty_fails_without_flag",
"tests/test_cli.py::test_without_json_manifest",
"tests/test_cli.py::test_push_also_builds",
"tests/test_cli.py::test_assert_hostname"
] |
[] |
Apache License 2.0
| null |
|
AI-SDC__AI-SDC-94
|
a42a2110ade262a7d699d5b71cfccbc787290d5d
|
2023-01-11 15:57:56
|
bad75b95d6e3f07b5c9b95aac741d46da4c3b6ef
|
diff --git a/aisdc/attacks/report.py b/aisdc/attacks/report.py
index 12b3887..515c709 100644
--- a/aisdc/attacks/report.py
+++ b/aisdc/attacks/report.py
@@ -1,4 +1,5 @@
"""Code for automatic report generation"""
+import abc
import json
import numpy as np
@@ -83,6 +84,8 @@ class NumpyArrayEncoder(json.JSONEncoder):
return int(o)
if isinstance(o, np.int32):
return int(o)
+ if isinstance(o, abc.ABCMeta):
+ return str(o)
return json.JSONEncoder.default(self, o)
diff --git a/aisdc/attacks/worst_case_attack.py b/aisdc/attacks/worst_case_attack.py
index 28e6512..361822c 100644
--- a/aisdc/attacks/worst_case_attack.py
+++ b/aisdc/attacks/worst_case_attack.py
@@ -14,6 +14,7 @@ from typing import Any
import numpy as np
import sklearn
from sklearn.ensemble import RandomForestClassifier
+from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from aisdc.attacks import metrics, report
@@ -40,7 +41,14 @@ class WorstCaseAttackArgs:
self.__dict__["in_sample_filename"] = None
self.__dict__["out_sample_filename"] = None
self.__dict__["report_name"] = None
+ self.__dict__["include_model_correct_feature"] = False
self.__dict__["sort_probs"] = True
+ self.__dict__["mia_attack_model"] = RandomForestClassifier
+ self.__dict__["mia_attack_model_hyp"] = {
+ "min_samples_split": 20,
+ "min_samples_leaf": 10,
+ "max_depth": 5,
+ }
self.__dict__.update(kwargs)
def __str__(self):
@@ -83,7 +91,20 @@ class WorstCaseAttack(Attack):
"""
train_preds = target_model.predict_proba(dataset.x_train)
test_preds = target_model.predict_proba(dataset.x_test)
- self.attack_from_preds(train_preds, test_preds)
+ train_correct = None
+ test_correct = None
+ if self.args.include_model_correct_feature:
+ train_correct = 1 * (
+ dataset.y_train == target_model.predict(dataset.x_train)
+ )
+ test_correct = 1 * (dataset.y_test == target_model.predict(dataset.x_test))
+
+ self.attack_from_preds(
+ train_preds,
+ test_preds,
+ train_correct=train_correct,
+ test_correct=test_correct,
+ )
def attack_from_prediction_files(self):
"""Start an attack from saved prediction files
@@ -98,7 +119,11 @@ class WorstCaseAttack(Attack):
self.attack_from_preds(train_preds, test_preds)
def attack_from_preds( # pylint: disable=too-many-locals
- self, train_preds: np.ndarray, test_preds: np.ndarray
+ self,
+ train_preds: np.ndarray,
+ test_preds: np.ndarray,
+ train_correct: np.ndarray = None,
+ test_correct: np.ndarray = None,
) -> None:
"""
Runs the attack based upon the predictions in train_preds and test_preds, and the params
@@ -115,7 +140,13 @@ class WorstCaseAttack(Attack):
"""
logger = logging.getLogger("attack-from-preds")
logger.info("Running main attack repetitions")
- self.attack_metrics = self.run_attack_reps(train_preds, test_preds)
+ self.attack_metrics = self.run_attack_reps(
+ train_preds,
+ test_preds,
+ train_correct=train_correct,
+ test_correct=test_correct,
+ )
+
if self.args.n_dummy_reps > 0:
logger.info("Running dummy attack reps")
self.dummy_attack_metrics = []
@@ -130,7 +161,11 @@ class WorstCaseAttack(Attack):
logger.info("Finished running attacks")
def _prepare_attack_data(
- self, train_preds: np.ndarray, test_preds: np.ndarray
+ self,
+ train_preds: np.ndarray,
+ test_preds: np.ndarray,
+ train_correct: np.ndarray = None,
+ test_correct: np.ndarray = None,
) -> tuple[np.ndarray, np.ndarray]:
"""Prepare training data and labels for attack model
Combines the train and test preds into a single numpy array (optionally) sorting each
@@ -143,12 +178,23 @@ class WorstCaseAttack(Attack):
test_preds = -np.sort(-test_preds, axis=1)
logger.info("Creating MIA data")
+
+ if self.args.include_model_correct_feature and train_correct is not None:
+ train_preds = np.hstack((train_preds, train_correct[:, None]))
+ test_preds = np.hstack((test_preds, test_correct[:, None]))
+
mi_x = np.vstack((train_preds, test_preds))
mi_y = np.hstack((np.ones(len(train_preds)), np.zeros(len(test_preds))))
return (mi_x, mi_y)
- def run_attack_reps(self, train_preds: np.ndarray, test_preds: np.ndarray) -> list:
+ def run_attack_reps( # pylint: disable = too-many-locals
+ self,
+ train_preds: np.ndarray,
+ test_preds: np.ndarray,
+ train_correct: np.ndarray = None,
+ test_correct: np.ndarray = None,
+ ) -> list:
"""
Run actual attack reps from train and test predictions
@@ -167,8 +213,9 @@ class WorstCaseAttack(Attack):
self.args.set_param("n_rows_in", len(train_preds))
self.args.set_param("n_rows_out", len(test_preds))
logger = logging.getLogger("attack-reps")
-
- mi_x, mi_y = self._prepare_attack_data(train_preds, test_preds)
+ mi_x, mi_y = self._prepare_attack_data(
+ train_preds, test_preds, train_correct, test_correct
+ )
mia_metrics = []
for rep in range(self.args.n_reps):
@@ -176,13 +223,25 @@ class WorstCaseAttack(Attack):
mi_train_x, mi_test_x, mi_train_y, mi_test_y = train_test_split(
mi_x, mi_y, test_size=self.args.test_prop, stratify=mi_y
)
- attack_classifier = RandomForestClassifier()
+ attack_classifier = self.args.mia_attack_model(
+ **self.args.mia_attack_model_hyp
+ )
attack_classifier.fit(mi_train_x, mi_train_y)
mia_metrics.append(
metrics.get_metrics(attack_classifier, mi_test_x, mi_test_y)
)
+ if self.args.include_model_correct_feature and train_correct is not None:
+ # Compute the Yeom TPR and FPR
+ yeom_preds = mi_test_x[:, -1]
+ tn, fp, fn, tp = confusion_matrix(mi_test_y, yeom_preds).ravel()
+ mia_metrics[-1]["yeom_tpr"] = tp / (tp + fn)
+ mia_metrics[-1]["yeom_fpr"] = fp / (fp + tn)
+ mia_metrics[-1]["yeom_advantage"] = (
+ mia_metrics[-1]["yeom_tpr"] - mia_metrics[-1]["yeom_fpr"]
+ )
+
logger.info("Finished simulating attacks")
return mia_metrics
@@ -554,6 +613,21 @@ def main():
help=("P-value threshold for significance testing. Default = %(default)f"),
)
+ # Not currently possible from the command line as we cannot compute the correctness
+ # of predictions. Possibly to be added in the future
+ # attack_parser.add_argument(
+ # "--include-correct",
+ # action="store",
+ # type=bool,
+ # required=False,
+ # default=False,
+ # dest='include_model_correct_feature',
+ # help=(
+ # "Whether or not to include an additional feature into the MIA attack model that "
+ # "holds whether or not the target model made a correct predicion for each example."
+ # ),
+ # )
+
attack_parser.add_argument(
"--sort-probs",
action="store",
|
Add option to include target model error into attacks as a feature
Whether or not the target model classifies an example correctly provides some signal that could be of use to an attacker. We currently do not use this in the attacks, but should include an option to allow it.
The 0/1 loss between the predicted class and the actual class (binary feature) should be added for the worst case attack.
|
AI-SDC/AI-SDC
|
diff --git a/tests/test_worst_case_attack.py b/tests/test_worst_case_attack.py
index 02cdb73..cdf11e6 100644
--- a/tests/test_worst_case_attack.py
+++ b/tests/test_worst_case_attack.py
@@ -6,6 +6,7 @@ import sys
from unittest.mock import patch
import numpy as np
+import pytest
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
@@ -65,6 +66,39 @@ def test_report_worstcase():
_ = attack_obj.make_report()
+def test_attack_with_correct_feature():
+ """Test the attack when the model correctness feature is used"""
+ X, y = load_breast_cancer(return_X_y=True, as_frame=False)
+ train_X, test_X, train_y, test_y = train_test_split(X, y, test_size=0.3)
+ dataset_obj = dataset.Data()
+ dataset_obj.add_processed_data(train_X, train_y, test_X, test_y)
+
+ target_model = SVC(gamma=0.1, probability=True)
+ target_model.fit(train_X, train_y)
+
+ args = worst_case_attack.WorstCaseAttackArgs(
+ # How many attacks to run -- in each the attack model is trained on a different
+ # subset of the data
+ n_reps=1,
+ n_dummy_reps=1,
+ p_thresh=0.05,
+ in_sample_filename=None,
+ out_sample_filename=None,
+ test_prop=0.5,
+ report_name="test-1rep",
+ include_model_correct_feature=True,
+ )
+
+ # with multiple reps
+ attack_obj = worst_case_attack.WorstCaseAttack(args)
+ attack_obj.attack(dataset_obj, target_model)
+
+ # Check that attack_metrics has the Yeom metrics
+ assert "yeom_tpr" in attack_obj.attack_metrics[0]
+ assert "yeom_fpr" in attack_obj.attack_metrics[0]
+ assert "yeom_advantage" in attack_obj.attack_metrics[0]
+
+
def test_attack_from_predictions():
"""checks code that runs attacks from predictions"""
@@ -177,6 +211,67 @@ def test_attack_data_prep():
np.testing.assert_array_equal(mi_x, np.array([[1, 0], [0, 1], [2, 0], [0, 2]]))
+def test_attack_data_prep_with_correct_feature():
+ """test the method that prepares the attack data.
+ This time, testing that the model correctness values are added, are always
+ the final feature, and are not included in the sorting"""
+ args = worst_case_attack.WorstCaseAttackArgs(include_model_correct_feature=True)
+ attack_obj = worst_case_attack.WorstCaseAttack(args)
+ train_preds = np.array([[1, 0], [0, 1]], int)
+ test_preds = np.array([[2, 0], [0, 2]], int)
+ train_correct = np.array([1, 0], int)
+ test_correct = np.array([0, 1], int)
+
+ mi_x, mi_y = attack_obj._prepare_attack_data( # pylint: disable=protected-access
+ train_preds, test_preds, train_correct=train_correct, test_correct=test_correct
+ )
+ np.testing.assert_array_equal(mi_y, np.array([1, 1, 0, 0], np.int))
+ # Test the x data produced. Each row should be sorted in descending order
+ np.testing.assert_array_equal(
+ mi_x, np.array([[1, 0, 1], [1, 0, 0], [2, 0, 0], [2, 0, 1]])
+ )
+
+ # With sort_probs = False, the rows of x should not be sorted
+ args = worst_case_attack.WorstCaseAttackArgs(
+ sort_probs=False, include_model_correct_feature=True
+ )
+ attack_obj = worst_case_attack.WorstCaseAttack(args)
+ mi_x, mi_y = attack_obj._prepare_attack_data( # pylint: disable=protected-access
+ train_preds, test_preds, train_correct=train_correct, test_correct=test_correct
+ )
+ np.testing.assert_array_equal(mi_y, np.array([1, 1, 0, 0], np.int))
+ np.testing.assert_array_equal(
+ mi_x, np.array([[1, 0, 1], [0, 1, 0], [2, 0, 0], [0, 2, 1]])
+ )
+
+
+def test_non_rf_mia():
+ """Tests that it is possible to set the attack model via the args
+ In this case, we set as a SVC. But we set probability to false. If the code does
+ indeed try and use the SVC (as we want) it will fail as it will try and access
+ the predict_proba which won't work if probability=False. Hence, if the code throws
+ an AttributeError we now it *is* trying to use the SVC"""
+
+ args = worst_case_attack.WorstCaseAttackArgs(
+ mia_attack_model=SVC,
+ mia_attack_model_hyp={"kernel": "rbf", "probability": False},
+ )
+
+ X, y = load_breast_cancer(return_X_y=True, as_frame=False)
+ train_X, test_X, train_y, test_y = train_test_split(X, y, test_size=0.3)
+ dataset_obj = dataset.Data()
+ dataset_obj.add_processed_data(train_X, train_y, test_X, test_y)
+
+ target_model = SVC(gamma=0.1, probability=True)
+ target_model.fit(train_X, train_y)
+ ytr_pred = target_model.predict_proba(train_X)
+ yte_pred = target_model.predict_proba(test_X)
+
+ attack_obj = worst_case_attack.WorstCaseAttack(args)
+ with pytest.raises(AttributeError):
+ attack_obj.attack_from_preds(ytr_pred, yte_pred)
+
+
def test_main():
"""test invocation via command line"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
absl-py==1.4.0
-e git+https://github.com/AI-SDC/AI-SDC.git@a42a2110ade262a7d699d5b71cfccbc787290d5d#egg=aisdc
array_record==0.5.1
astunparse==1.6.3
attrs==21.4.0
cachetools==5.5.2
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
cloudpickle==3.1.1
contourpy==1.3.0
cycler==0.12.1
decorator==5.2.1
dictdiffer==0.9.0
dill==0.3.9
dm-tree==0.1.8
dp-accounting==0.4.2
etils==1.5.2
exceptiongroup==1.2.2
flatbuffers==25.2.10
fonttools==4.56.0
fpdf==1.7.2
fsspec==2025.3.1
gast==0.4.0
google-auth==2.38.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
googleapis-common-protos==1.63.1
grpcio==1.71.0
h5py==3.13.0
idna==3.10
immutabledict==2.2.5
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
joblib==1.1.1
keras==2.10.0
Keras-Preprocessing==1.1.2
kiwisolver==1.4.7
libclang==18.1.1
Markdown==3.7
MarkupSafe==3.0.2
matplotlib==3.9.4
mpmath==1.3.0
multiprocess==0.70.12.2
numpy==1.26.4
oauthlib==3.2.2
opt_einsum==3.4.0
packaging==22.0
pandas==1.5.3
parameterized==0.9.0
patsy==1.0.1
pillow==11.1.0
pluggy==1.5.0
promise==2.3
protobuf==3.19.6
psutil==7.0.0
pyasn1==0.6.1
pyasn1_modules==0.4.2
pyparsing==3.2.3
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.32.3
requests-oauthlib==2.0.0
rsa==4.9
scikit-learn==1.1.3
scipy==1.13.1
six==1.17.0
statsmodels==0.14.4
tensorboard==2.10.1
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.10.1
tensorflow-datasets==4.9.0
tensorflow-estimator==2.10.0
tensorflow-io-gcs-filesystem==0.37.1
tensorflow-metadata==1.13.0
tensorflow-privacy==0.8.10
tensorflow-probability==0.20.1
termcolor==3.0.0
threadpoolctl==3.6.0
toml==0.10.2
tomli==2.2.1
tqdm==4.67.1
typing_extensions==4.13.0
urllib3==2.3.0
Werkzeug==3.1.3
wrapt==1.17.2
zipp==3.21.0
|
name: AI-SDC
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- absl-py==1.4.0
- array-record==0.5.1
- astunparse==1.6.3
- attrs==21.4.0
- cachetools==5.5.2
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- cloudpickle==3.1.1
- contourpy==1.3.0
- cycler==0.12.1
- decorator==5.2.1
- dictdiffer==0.9.0
- dill==0.3.9
- dm-tree==0.1.8
- dp-accounting==0.4.2
- etils==1.5.2
- exceptiongroup==1.2.2
- flatbuffers==25.2.10
- fonttools==4.56.0
- fpdf==1.7.2
- fsspec==2025.3.1
- gast==0.4.0
- google-auth==2.38.0
- google-auth-oauthlib==0.4.6
- google-pasta==0.2.0
- googleapis-common-protos==1.63.1
- grpcio==1.71.0
- h5py==3.13.0
- idna==3.10
- immutabledict==2.2.5
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- joblib==1.1.1
- keras==2.10.0
- keras-preprocessing==1.1.2
- kiwisolver==1.4.7
- libclang==18.1.1
- markdown==3.7
- markupsafe==3.0.2
- matplotlib==3.9.4
- mpmath==1.3.0
- multiprocess==0.70.12.2
- numpy==1.26.4
- oauthlib==3.2.2
- opt-einsum==3.4.0
- packaging==22.0
- pandas==1.5.3
- parameterized==0.9.0
- patsy==1.0.1
- pillow==11.1.0
- pluggy==1.5.0
- promise==2.3
- protobuf==3.19.6
- psutil==7.0.0
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pyparsing==3.2.3
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pytz==2025.2
- requests==2.32.3
- requests-oauthlib==2.0.0
- rsa==4.9
- scikit-learn==1.1.3
- scipy==1.13.1
- six==1.17.0
- statsmodels==0.14.4
- tensorboard==2.10.1
- tensorboard-data-server==0.6.1
- tensorboard-plugin-wit==1.8.1
- tensorflow==2.10.1
- tensorflow-datasets==4.9.0
- tensorflow-estimator==2.10.0
- tensorflow-io-gcs-filesystem==0.37.1
- tensorflow-metadata==1.13.0
- tensorflow-privacy==0.8.10
- tensorflow-probability==0.20.1
- termcolor==3.0.0
- threadpoolctl==3.6.0
- toml==0.10.2
- tomli==2.2.1
- tqdm==4.67.1
- typing-extensions==4.13.0
- urllib3==2.3.0
- werkzeug==3.1.3
- wrapt==1.17.2
- zipp==3.21.0
prefix: /opt/conda/envs/AI-SDC
|
[
"tests/test_worst_case_attack.py::test_attack_with_correct_feature",
"tests/test_worst_case_attack.py::test_non_rf_mia"
] |
[
"tests/test_worst_case_attack.py::test_attack_data_prep",
"tests/test_worst_case_attack.py::test_attack_data_prep_with_correct_feature"
] |
[
"tests/test_worst_case_attack.py::test_report_worstcase",
"tests/test_worst_case_attack.py::test_attack_from_predictions",
"tests/test_worst_case_attack.py::test_attack_from_predictions_no_dummy",
"tests/test_worst_case_attack.py::test_dummy_data",
"tests/test_worst_case_attack.py::test_main",
"tests/test_worst_case_attack.py::test_cleanup"
] |
[] |
MIT License
| null |
|
AI4S2S__lilio-49
|
329a736d26915944744a4235c11497718e0d7832
|
2023-03-08 14:31:11
|
329a736d26915944744a4235c11497718e0d7832
|
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_lilio&pullRequest=49)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list)
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_lilio&pullRequest=49)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list)
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_lilio&pullRequest=49)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list)
BSchilperoort: I saw that pandas also [supports adding attributes to `DataFrame`s](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.attrs.html), however this features is marked as "experimental" and can change without warning, so it might still be too early to support this.
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_lilio&pullRequest=49)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=49&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=49&metric=new_duplicated_lines_density&view=list)
BSchilperoort: Thanks for the review and suggestion!
|
diff --git a/lilio/__init__.py b/lilio/__init__.py
index f00a7de..ef989aa 100644
--- a/lilio/__init__.py
+++ b/lilio/__init__.py
@@ -62,8 +62,8 @@ Example:
"""
import logging
-from . import calendar_shifter
-from . import traintest
+from lilio import calendar_shifter
+from lilio import traintest
from .calendar import Calendar
from .calendar import Interval
from .calendar_shorthands import daily_calendar
diff --git a/lilio/_attrs.py b/lilio/_attrs.py
new file mode 100644
index 0000000..155ae00
--- /dev/null
+++ b/lilio/_attrs.py
@@ -0,0 +1,52 @@
+from datetime import datetime
+from datetime import timezone
+from typing import Union
+import xarray as xr
+import lilio
+from lilio.calendar import Calendar
+
+
+def add_attrs(data: Union[xr.DataArray, xr.Dataset], calendar: Calendar) -> None:
+ """Update resampled xarray data with the Calendar's attributes and provenance."""
+ history = (
+ f"{datetime.now(timezone.utc):%Y-%m-%d %H:%M:%S %Z} - "
+ "Resampled with a Lilio calendar. "
+ "See: https://github.com/AI4S2S/lilio\n"
+ )
+ if "history" in data.attrs.keys():
+ history += data.attrs["history"]
+
+ data.attrs = {
+ **data.attrs, # Keep original attrs. Conflicts will be overwritten attrs below:
+ "lilio_version": lilio.__version__,
+ "lilio_calendar_anchor_date": calendar.anchor,
+ "lilio_calendar_code": str(calendar),
+ "history": history,
+ }
+
+ data["anchor_year"].attrs = {
+ "name": "anchor year",
+ "units": "year",
+ "description": (
+ "The anchor date is the start of the period you want to forecast, and is "
+ "an abstract date and does not include a year. "
+ "Anchor years are used to create a full date with the anchor date "
+ f"(here: {calendar.anchor})."
+ ),
+ }
+ data["i_interval"].attrs = {
+ "name": "interval index",
+ "units": "-",
+ "description": (
+ "The index of each Lilio Calendar interval. Positive values denote "
+ "intervals after the anchor date (targets), while negative values "
+ "represent intervals before the anchor date (precursors)."
+ ),
+ }
+ data["is_target"].attrs = {
+ "name": "Target flag",
+ "description": (
+ "Denotes if an interval was marked as a target interval in the"
+ " Lilio Calendar."
+ ),
+ }
diff --git a/lilio/calendar.py b/lilio/calendar.py
index 95279cc..0b32e06 100644
--- a/lilio/calendar.py
+++ b/lilio/calendar.py
@@ -10,8 +10,8 @@ from typing import Union
import pandas as pd
import xarray as xr
from pandas.tseries.offsets import DateOffset
-from . import _plot
-from . import utils
+from lilio import _plot
+from lilio import utils
_MappingYears = Tuple[Literal["years"], int, int]
diff --git a/lilio/calendar_shifter.py b/lilio/calendar_shifter.py
index e7fce9c..ce30769 100644
--- a/lilio/calendar_shifter.py
+++ b/lilio/calendar_shifter.py
@@ -4,8 +4,8 @@ from typing import Dict
from typing import List
from typing import Union
import xarray as xr
-from . import calendar
-from . import utils
+from lilio import calendar
+from lilio import utils
from .resampling import resample
diff --git a/lilio/resampling.py b/lilio/resampling.py
index f3a449c..2d29ce0 100644
--- a/lilio/resampling.py
+++ b/lilio/resampling.py
@@ -7,8 +7,9 @@ from typing import overload
import numpy as np
import pandas as pd
import xarray as xr
+from lilio import utils
+from lilio._attrs import add_attrs
from lilio.calendar import Calendar
-from . import utils
# List of numpy statistical methods, with a single input argument and a single output.
@@ -356,5 +357,11 @@ def resample(
resampled_data = _mark_target_period(resampled_data)
if isinstance(input_data, xr.DataArray):
- return resampled_data[da_name]
+ resampled_dataarray = resampled_data[da_name]
+ resampled_dataarray.attrs = input_data.attrs
+ add_attrs(resampled_dataarray, calendar)
+ return resampled_dataarray
+ if isinstance(input_data, xr.Dataset):
+ resampled_data.attrs = input_data.attrs
+ add_attrs(resampled_data, calendar)
return resampled_data
diff --git a/pyproject.toml b/pyproject.toml
index 52b93b5..7ae6b05 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -128,7 +128,7 @@ select = [
"F", # pyflakes
"B", # flake8-bugbear
"D", # pydocstyle
- "C", # mccabe complexity
+ "C90", # mccabe complexity
# "I", # isort (autosort not working correctly, disabled for now).
"N", # PEP8-naming
"UP", # pyupgrade (upgrade syntax to current syntax)
@@ -140,12 +140,13 @@ extend-select = [
"D401", # First line should be in imperative mood
"D400", # First line should end in a period.
"D404", # First word of the docstring should not be 'This'
+ "TID252", # No relative imports (not pep8 compliant)
]
ignore = [
"PLR2004", # magic value used in comparsion (i.e. `if ndays == 28: month_is_feb`).
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
-fixable = ["A", "B", "C", "D", "E", "F"]
+fixable = ["A", "B", "C90", "D", "E", "F", "TID252"]
unfixable = []
line-length = 88
exclude = ["docs", "build"]
|
Add (more) attributes to xarray `resample` output
As xarray uses the structure of netCDF files, there is quite a lot of space to add extra information, in the form of "attributes".
For provenance and traceability, we can make use of this in Lilio. This can consist of, but is not limited to:
- Adding attributes to all coordinates to explain what they are (e.g. anchor_year). [left_bound and right_bound currently do have a description in the attrs](https://github.com/AI4S2S/lilio/blob/d0923997b4fd8cdb7ea41712006f6055ae7deb0d/lilio/utils.py#L167-L174).
- Adding the calendar itself to the xr.Dataset/xr.DataArray main attrs.
|
AI4S2S/lilio
|
diff --git a/tests/test_resample.py b/tests/test_resample.py
index 59fed6b..b50380f 100644
--- a/tests/test_resample.py
+++ b/tests/test_resample.py
@@ -209,6 +209,45 @@ class TestResample:
with pytest.warns(UserWarning):
resample(cal, dataset)
+ def test_dataset_attrs(self, dummy_calendar, dummy_dataset):
+ dataset, _ = dummy_dataset
+ dataset.attrs = {"history": "test_history", "other_attrs": "abc"}
+ cal = dummy_calendar.map_years(2020, 2025)
+ resampled = resample(cal, dataset)
+
+ expected_attrs = [
+ "lilio_version",
+ "lilio_calendar_anchor_date",
+ "lilio_calendar_code",
+ ]
+
+ assert "test_history" in resampled.attrs["history"]
+ assert "other_attrs" in resampled.attrs.keys()
+ for att in expected_attrs:
+ assert att in resampled.attrs.keys()
+
+ def test_dataarray_attrs(self, dummy_calendar, dummy_dataarray):
+ """This is a copy of the previous test, but with dataarray input.
+
+ Sadly, fixtures aren't compatible with parameterize. Refactoring the fixtures
+ could solve this.
+ """
+ dataarray, _ = dummy_dataarray
+ dataarray.attrs = {"history": "test_history", "other_attrs": "abc"}
+ cal = dummy_calendar.map_years(2020, 2025)
+ resampled = resample(cal, dataarray)
+
+ expected_attrs = [
+ "lilio_version",
+ "lilio_calendar_anchor_date",
+ "lilio_calendar_code",
+ ]
+
+ assert "test_history" in resampled.attrs["history"]
+ assert "other_attrs" in resampled.attrs.keys()
+ for att in expected_attrs:
+ assert att in resampled.attrs.keys()
+
TOO_LOW_FREQ_ERR = r".*lower time resolution than the calendar.*"
TOO_LOW_FREQ_WARN = r".*input data frequency is very close to the Calendar's freq.*"
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 5
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
anyio==4.9.0
backports.tarfile==1.2.0
black==25.1.0
bump2version==1.0.1
certifi==2025.1.31
cffi==1.17.1
cftime==1.6.4.post1
click==8.1.8
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
distlib==0.3.9
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
fonttools==4.56.0
h11==0.14.0
hatch==1.14.0
hatchling==1.27.0
httpcore==1.0.7
httpx==0.28.1
hyperlink==21.0.0
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==6.0.1
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
joblib==1.4.2
keyring==25.6.0
kiwisolver==1.4.7
-e git+https://github.com/AI4S2S/lilio.git@329a736d26915944744a4235c11497718e0d7832#egg=lilio
markdown-it-py==3.0.0
matplotlib==3.9.4
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
netCDF4==1.7.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pathspec==0.12.1
pexpect==4.9.0
pillow==11.1.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
ptyprocess==0.7.0
pycparser==2.22
Pygments==2.19.1
pyparsing==3.2.3
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
rich==14.0.0
ruff==0.11.2
scikit-learn==1.6.1
scipy==1.13.1
SecretStorage==3.3.3
shellingham==1.5.4
six==1.17.0
sniffio==1.3.1
threadpoolctl==3.6.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
tomli_w==1.2.0
tomlkit==0.13.2
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
userpath==1.9.2
uv==0.6.11
virtualenv==20.29.3
xarray==2024.7.0
zipp==3.21.0
zstandard==0.23.0
|
name: lilio
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- anyio==4.9.0
- backports-tarfile==1.2.0
- black==25.1.0
- bump2version==1.0.1
- certifi==2025.1.31
- cffi==1.17.1
- cftime==1.6.4.post1
- click==8.1.8
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- distlib==0.3.9
- filelock==3.18.0
- fonttools==4.56.0
- h11==0.14.0
- hatch==1.14.0
- hatchling==1.27.0
- httpcore==1.0.7
- httpx==0.28.1
- hyperlink==21.0.0
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- isort==6.0.1
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- joblib==1.4.2
- keyring==25.6.0
- kiwisolver==1.4.7
- lilio==0.3.1
- markdown-it-py==3.0.0
- matplotlib==3.9.4
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- netcdf4==1.7.2
- numpy==2.0.2
- pandas==2.2.3
- pathspec==0.12.1
- pexpect==4.9.0
- pillow==11.1.0
- platformdirs==4.3.7
- ptyprocess==0.7.0
- pycparser==2.22
- pygments==2.19.1
- pyparsing==3.2.3
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- rich==14.0.0
- ruff==0.11.2
- scikit-learn==1.6.1
- scipy==1.13.1
- secretstorage==3.3.3
- shellingham==1.5.4
- six==1.17.0
- sniffio==1.3.1
- threadpoolctl==3.6.0
- tomli-w==1.2.0
- tomlkit==0.13.2
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- userpath==1.9.2
- uv==0.6.11
- virtualenv==20.29.3
- xarray==2024.7.0
- zipp==3.21.0
- zstandard==0.23.0
prefix: /opt/conda/envs/lilio
|
[
"tests/test_resample.py::TestResample::test_dataset_attrs[20151020]",
"tests/test_resample.py::TestResample::test_dataset_attrs[20191015]",
"tests/test_resample.py::TestResample::test_dataarray_attrs[20151020]",
"tests/test_resample.py::TestResample::test_dataarray_attrs[20191015]"
] |
[
"tests/test_resample.py::TestResampleChecks::test_month_freq_data"
] |
[
"tests/test_resample.py::TestResample::test_non_mapped_calendar",
"tests/test_resample.py::TestResample::test_nontime_index[20151020]",
"tests/test_resample.py::TestResample::test_nontime_index[20191015]",
"tests/test_resample.py::TestResample::test_series[20151020]",
"tests/test_resample.py::TestResample::test_series[20191015]",
"tests/test_resample.py::TestResample::test_unnamed_series[20151020]",
"tests/test_resample.py::TestResample::test_unnamed_series[20191015]",
"tests/test_resample.py::TestResample::test_dataframe[20151020]",
"tests/test_resample.py::TestResample::test_dataframe[20191015]",
"tests/test_resample.py::TestResample::test_dataarray[20151020]",
"tests/test_resample.py::TestResample::test_dataarray[20191015]",
"tests/test_resample.py::TestResample::test_dataset[20151020]",
"tests/test_resample.py::TestResample::test_dataset[20191015]",
"tests/test_resample.py::TestResample::test_multidim_dataset",
"tests/test_resample.py::TestResample::test_target_period_dataframe[1-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[1-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[2-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[2-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[1-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[1-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[2-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[2-20191015]",
"tests/test_resample.py::TestResample::test_allow_overlap_dataframe",
"tests/test_resample.py::TestResample::test_1day_freq_dataframe",
"tests/test_resample.py::TestResample::test_to_netcdf[20151020]",
"tests/test_resample.py::TestResample::test_to_netcdf[20191015]",
"tests/test_resample.py::TestResample::test_overlapping",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[20191015]",
"tests/test_resample.py::TestResampleChecks::test_low_freq_warning_dataframe",
"tests/test_resample.py::TestResampleChecks::test_too_low_freq_dataframe",
"tests/test_resample.py::TestResampleChecks::test_low_freq_warning_dataset",
"tests/test_resample.py::TestResampleChecks::test_too_low_freq_dataset",
"tests/test_resample.py::TestResampleChecks::test_low_freq_month_fmt_dataframe",
"tests/test_resample.py::TestResampleChecks::test_reserved_names_dataframe",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[mean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[min]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[max]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[median]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[std]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[var]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[ptp]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanmean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanmedian]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanstd]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanvar]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[sum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nansum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[size]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[count_nonzero]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[mean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[min]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[max]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[median]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[std]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[var]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[ptp]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanmean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanmedian]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanstd]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanvar]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[sum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nansum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[size]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[count_nonzero]",
"tests/test_resample.py::TestResampleMethods::test_func_input_dataframe",
"tests/test_resample.py::TestResampleMethods::test_func_input_dataset"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.ai4s2s_1776_lilio-49
|
AI4S2S__lilio-58
|
416ea560d41b57502cf204fbf4e65e79c21373bf
|
2023-05-30 06:43:39
|
416ea560d41b57502cf204fbf4e65e79c21373bf
|
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_lilio&pullRequest=58)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_duplicated_lines_density&view=list)
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_lilio&pullRequest=58)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_lilio&pullRequest=58&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_lilio&pullRequest=58&metric=new_duplicated_lines_density&view=list)
|
diff --git a/lilio/calendar.py b/lilio/calendar.py
index c288ebb..93ee1db 100644
--- a/lilio/calendar.py
+++ b/lilio/calendar.py
@@ -206,10 +206,15 @@ class Calendar:
self._set_mapping(mapping)
@property
- def n_targets(self):
+ def n_targets(self) -> int:
"""Return the number of targets."""
return len(self.targets)
+ @property
+ def n_precursors(self) -> int:
+ """Return the number of precursors."""
+ return len(self.precursors)
+
@property
def anchor(self):
"""Return the anchor."""
diff --git a/lilio/resampling.py b/lilio/resampling.py
index b426dbd..aa729d5 100644
--- a/lilio/resampling.py
+++ b/lilio/resampling.py
@@ -335,6 +335,8 @@ def resample(
"""
if calendar.mapping is None:
raise ValueError("Generate a calendar map before calling resample")
+ if calendar.n_targets + calendar.n_precursors == 0:
+ raise ValueError("The calendar has no intervals: resampling is not possible.")
if isinstance(how, str):
_check_valid_resampling_methods(how)
|
Unclear error message when an empty calendar is passed to `resample` function.
When executing the following code:
```py
import lilio
from lilio import Calendar
import xarray as xr
ds = xr.load_dataset(path_to_data) # just some sample data
cal = Calendar("12-25")
# note that no intervals are added to the calendar
# cal.add_intervals("target", length="7d")
# cal.add_intervals("precursor", length="7d")
cal.map_to_data(ds)
data_resampled = lilio.resample(cal, ds)
```
This will trigger the following `ValueError`
```py
File [~/AI4S2S/lilio/lilio/resampling.py:342](https://vscode-remote+wsl-002bubuntu-002d20-002e04.vscode-resource.vscode-cdn.net/home/yangliu/AI4S2S/lilio/docs/notebooks/~/AI4S2S/lilio/lilio/resampling.py:342), in resample(calendar, input_data, how)
340 _check_valid_resampling_methods(how)
341 utils.check_timeseries(input_data)
--> 342 utils.check_input_frequency(calendar, input_data)
343 utils.check_reserved_names(input_data)
345 if isinstance(input_data, (pd.Series, pd.DataFrame)):
File [~/AI4S2S/lilio/lilio/utils.py:158](https://vscode-remote+wsl-002bubuntu-002d20-002e04.vscode-resource.vscode-cdn.net/home/yangliu/AI4S2S/lilio/docs/notebooks/~/AI4S2S/lilio/lilio/utils.py:158), in check_input_frequency(calendar, data)
151 """Compare the frequency of (input) data to the frequency of the calendar.
152
153 Note: Pandas and xarray have the builtin function `infer_freq`, but this function is
154 not robust enough for our purpose, so we have to manually infer the frequency if the
155 builtin one fails.
156 """
157 data_freq = infer_input_data_freq(data)
--> 158 calendar_freq = get_smallest_calendar_freq(calendar)
160 if calendar_freq < data_freq:
161 raise ValueError(
162 "The data is of a lower time resolution than the calendar. "
163 "This would lead to incorrect data and/or NaN values in the resampled data."
(...)
167 f"{str(calendar_freq)}"
168 )
File [~/AI4S2S/lilio/lilio/utils.py:145](https://vscode-remote+wsl-002bubuntu-002d20-002e04.vscode-resource.vscode-cdn.net/home/yangliu/AI4S2S/lilio/docs/notebooks/~/AI4S2S/lilio/lilio/utils.py:145), in get_smallest_calendar_freq(calendar)
143 lengthstr = [replace_month_length(ln) if ln[-1] == "M" else ln for ln in lengthstr]
144 lengths = [pd.Timedelta(ln) for ln in lengthstr]
--> 145 return min(lengths)
ValueError: min() arg is an empty sequence
```
The error message is not informative. It should remind the user to add intervals to the calendar. This needs to be fixed in the check for `resample` function, in `utils` module.
|
AI4S2S/lilio
|
diff --git a/tests/test_resample.py b/tests/test_resample.py
index c39bd68..b68441f 100644
--- a/tests/test_resample.py
+++ b/tests/test_resample.py
@@ -326,6 +326,24 @@ class TestResampleChecks:
with pytest.raises(ValueError, match=r".*reserved names..*"):
resample(cal, dummy_dataframe.rename(columns={"data1": "anchor_year"}))
+ def test_empty_calendar(self, dummy_dataframe):
+ cal = Calendar(anchor="Jan")
+ cal.map_to_data(dummy_dataframe)
+ with pytest.raises(ValueError, match=r".*calendar has no intervals.*"):
+ resample(cal, dummy_dataframe)
+
+ def test_single_target(self, dummy_dataframe):
+ cal = Calendar(anchor="Jan")
+ cal.add_intervals("target", length="7d")
+ cal.map_to_data(dummy_dataframe)
+ resample(cal, dummy_dataframe)
+
+ def test_single_precursor(self, dummy_dataframe):
+ cal = Calendar(anchor="Jan")
+ cal.add_intervals("precursor", length="7d")
+ cal.map_to_data(dummy_dataframe)
+ resample(cal, dummy_dataframe)
+
class TestResampleMethods:
"""Test alternative resampling methods.
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 2
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": null,
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
anyio==4.9.0
backports.tarfile==1.2.0
black==25.1.0
bump2version==1.0.1
certifi==2025.1.31
cffi==1.17.1
cftime==1.6.4.post1
click==8.1.8
cloudpickle==3.1.1
contourpy==1.3.0
coverage==7.8.0
cryptography==44.0.2
cycler==0.12.1
dask==2024.8.0
distlib==0.3.9
distributed==2024.8.0
exceptiongroup==1.2.2
filelock==3.18.0
fonttools==4.56.0
fsspec==2025.3.1
h11==0.14.0
hatch==1.14.0
hatchling==1.27.0
httpcore==1.0.7
httpx==0.28.1
hyperlink==21.0.0
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
isort==6.0.1
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
Jinja2==3.1.6
joblib==1.4.2
keyring==25.6.0
kiwisolver==1.4.7
-e git+https://github.com/AI4S2S/lilio.git@416ea560d41b57502cf204fbf4e65e79c21373bf#egg=lilio
locket==1.0.0
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.9.4
mdurl==0.1.2
more-itertools==10.6.0
msgpack==1.1.0
mypy==1.15.0
mypy-extensions==1.0.0
netCDF4==1.7.2
numpy==2.0.2
packaging==24.2
pandas==2.2.3
partd==1.4.2
pathspec==0.12.1
pexpect==4.9.0
pillow==11.1.0
platformdirs==4.3.7
pluggy==1.5.0
psutil==7.0.0
ptyprocess==0.7.0
pycparser==2.22
Pygments==2.19.1
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
rich==14.0.0
ruff==0.11.2
scikit-learn==1.6.1
scipy==1.13.1
SecretStorage==3.3.3
shellingham==1.5.4
six==1.17.0
sniffio==1.3.1
sortedcontainers==2.4.0
tblib==3.1.0
threadpoolctl==3.6.0
tomli==2.2.1
tomli_w==1.2.0
tomlkit==0.13.2
toolz==1.0.0
tornado==6.4.2
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
userpath==1.9.2
uv==0.6.11
virtualenv==20.29.3
xarray==2024.7.0
zict==3.0.0
zipp==3.21.0
zstandard==0.23.0
|
name: lilio
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- anyio==4.9.0
- backports-tarfile==1.2.0
- black==25.1.0
- bump2version==1.0.1
- certifi==2025.1.31
- cffi==1.17.1
- cftime==1.6.4.post1
- click==8.1.8
- cloudpickle==3.1.1
- contourpy==1.3.0
- coverage==7.8.0
- cryptography==44.0.2
- cycler==0.12.1
- dask==2024.8.0
- distlib==0.3.9
- distributed==2024.8.0
- exceptiongroup==1.2.2
- filelock==3.18.0
- fonttools==4.56.0
- fsspec==2025.3.1
- h11==0.14.0
- hatch==1.14.0
- hatchling==1.27.0
- httpcore==1.0.7
- httpx==0.28.1
- hyperlink==21.0.0
- idna==3.10
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- isort==6.0.1
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jinja2==3.1.6
- joblib==1.4.2
- keyring==25.6.0
- kiwisolver==1.4.7
- lilio==0.4.0
- locket==1.0.0
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- matplotlib==3.9.4
- mdurl==0.1.2
- more-itertools==10.6.0
- msgpack==1.1.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- netcdf4==1.7.2
- numpy==2.0.2
- packaging==24.2
- pandas==2.2.3
- partd==1.4.2
- pathspec==0.12.1
- pexpect==4.9.0
- pillow==11.1.0
- platformdirs==4.3.7
- pluggy==1.5.0
- psutil==7.0.0
- ptyprocess==0.7.0
- pycparser==2.22
- pygments==2.19.1
- pyparsing==3.2.3
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- rich==14.0.0
- ruff==0.11.2
- scikit-learn==1.6.1
- scipy==1.13.1
- secretstorage==3.3.3
- shellingham==1.5.4
- six==1.17.0
- sniffio==1.3.1
- sortedcontainers==2.4.0
- tblib==3.1.0
- threadpoolctl==3.6.0
- tomli==2.2.1
- tomli-w==1.2.0
- tomlkit==0.13.2
- toolz==1.0.0
- tornado==6.4.2
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- userpath==1.9.2
- uv==0.6.11
- virtualenv==20.29.3
- xarray==2024.7.0
- zict==3.0.0
- zipp==3.21.0
- zstandard==0.23.0
prefix: /opt/conda/envs/lilio
|
[
"tests/test_resample.py::TestResampleChecks::test_empty_calendar"
] |
[
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[20191015]",
"tests/test_resample.py::TestResampleChecks::test_month_freq_data"
] |
[
"tests/test_resample.py::TestResample::test_non_mapped_calendar",
"tests/test_resample.py::TestResample::test_nontime_index[20151020]",
"tests/test_resample.py::TestResample::test_nontime_index[20191015]",
"tests/test_resample.py::TestResample::test_series[20151020]",
"tests/test_resample.py::TestResample::test_series[20191015]",
"tests/test_resample.py::TestResample::test_unnamed_series[20151020]",
"tests/test_resample.py::TestResample::test_unnamed_series[20191015]",
"tests/test_resample.py::TestResample::test_dataframe[20151020]",
"tests/test_resample.py::TestResample::test_dataframe[20191015]",
"tests/test_resample.py::TestResample::test_dataarray[20151020]",
"tests/test_resample.py::TestResample::test_dataarray[20191015]",
"tests/test_resample.py::TestResample::test_dataset[20151020]",
"tests/test_resample.py::TestResample::test_dataset[20191015]",
"tests/test_resample.py::TestResample::test_multidim_dataset",
"tests/test_resample.py::TestResample::test_target_period_dataframe[1-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[1-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[2-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[2-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[1-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[1-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[2-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[2-20191015]",
"tests/test_resample.py::TestResample::test_allow_overlap_dataframe",
"tests/test_resample.py::TestResample::test_1day_freq_dataframe",
"tests/test_resample.py::TestResample::test_to_netcdf[20151020]",
"tests/test_resample.py::TestResample::test_to_netcdf[20191015]",
"tests/test_resample.py::TestResample::test_overlapping",
"tests/test_resample.py::TestResample::test_dataset_attrs[20151020]",
"tests/test_resample.py::TestResample::test_dataset_attrs[20191015]",
"tests/test_resample.py::TestResample::test_dataarray_attrs[20151020]",
"tests/test_resample.py::TestResample::test_dataarray_attrs[20191015]",
"tests/test_resample.py::TestResampleChecks::test_low_freq_warning_dataframe",
"tests/test_resample.py::TestResampleChecks::test_too_low_freq_dataframe",
"tests/test_resample.py::TestResampleChecks::test_low_freq_warning_dataset",
"tests/test_resample.py::TestResampleChecks::test_too_low_freq_dataset",
"tests/test_resample.py::TestResampleChecks::test_low_freq_month_fmt_dataframe",
"tests/test_resample.py::TestResampleChecks::test_reserved_names_dataframe",
"tests/test_resample.py::TestResampleChecks::test_single_target",
"tests/test_resample.py::TestResampleChecks::test_single_precursor",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[mean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[min]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[max]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[median]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[std]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[var]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[ptp]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanmean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanmedian]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanstd]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nanvar]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[sum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[nansum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[size]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataframe[count_nonzero]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[mean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[min]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[max]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[median]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[std]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[var]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[ptp]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanmean]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanmedian]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanstd]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nanvar]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[sum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[nansum]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[size]",
"tests/test_resample.py::TestResampleMethods::test_all_methods_dataset[count_nonzero]",
"tests/test_resample.py::TestResampleMethods::test_func_input_dataframe",
"tests/test_resample.py::TestResampleMethods::test_func_input_dataset",
"tests/test_resample.py::TestResampleDask::test_dask_resample"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.ai4s2s_1776_lilio-58
|
AI4S2S__s2spy-106
|
81682c3a15708eb9fccb705796b134933001afb4
|
2022-09-26 07:07:57
|
74a971101a64b7d0024cfdfd5ad9382c12752760
|
diff --git a/notebooks/tutorial_RGDR.ipynb b/notebooks/tutorial_RGDR.ipynb
index 84f5228..0f8213a 100644
--- a/notebooks/tutorial_RGDR.ipynb
+++ b/notebooks/tutorial_RGDR.ipynb
@@ -76,14 +76,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Using `.plot_correlation` we can see the correlation and p-value map of the target timeseries and precursor field:"
+ "Using `.preview_correlation` we can visualize the correlation and p-value map of the target timeseries and precursor field, for a single lag.\n",
+ "\n",
+ "In this case we use lag `1`."
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 7,
"metadata": {},
"outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[<matplotlib.collections.QuadMesh at 0x1a0501cb6d0>,\n",
+ " <matplotlib.collections.QuadMesh at 0x1a063a29270>]"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ },
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArwAAACqCAYAAABPqpzsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAnM0lEQVR4nO3de5gdVZnv8e+vOwkhIQExGEISCEJAAblG1EEF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ruB7wNExP2S7k/Pv53k9tptaeIdBdw+iOuYmbUD52wb1tzgtTxsKNnvZnB/Z128NvRmdB3lBdwQEccM4ppmZsOJc7a1PY/htUb9P+BjkjolbUfy7f2uKuUfAt4oaVp6/LEK5dYB40qOlwMHpPsfLjl/K/BxAEl7AXun5+8guR23a/qzsZJ2q+cXMjNrY87ZNqy5wWuNugq4H7gP+B3w5Yh4tlLhiHgZ+DzwW0kLSZLkS2WKXgqcLOleSbsA3waOl3QvybizXv8BbCVpKclYr4XpdZ4D5gCXpLfMbgfeNJhf1MysDThn27CmiGh2DDZMSNoqItanTwCfBzwSEec2Oy4zM9ucc7a1E/fw2lD6bPpAxAPA1iRPAJuZWTE5Z1vbcA+vmZmZmbU19/CamZmZWVtzg9fMzMzM2pobvGZmZmbW1tzgNTMzM7O25gavmZmZmbU1N3jNzMzMrK39f+qLTKkPu+CbAAAAAElFTkSuQmCC",
@@ -99,23 +112,33 @@
],
"source": [
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
- "_ = rgdr.plot_correlation(precursor_field, target_timeseries, lag=1, ax1=ax1, ax2=ax2)"
+ "rgdr.preview_correlation(precursor_field, target_timeseries, lag=1, ax1=ax1, ax2=ax2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can compare two RGDR initializations to preview what the effect on the generated clusters will be.\n",
+ "Using the preview utilities we can compare two RGDR setups, and see what the effect on the generated clusters will be.\n",
"\n",
"Note that the second figure has an extra cluster, due to the minimum area argument having a smaller value."
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 6,
"metadata": {},
"outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "<matplotlib.collections.QuadMesh at 0x1a063c76b60>"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ },
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAsoAAACqCAYAAAC0/WkzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwb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60v6Rm9fKCIiBZLZkdMQxrKMV2nAkuBK4CfAx+xfdt4C9t+CHgfcKakSynC9Y9dFj0B+LCkyyVtD3wJeK+kyynG1Y34V2ADSddSjGW7tNzOH4B3AMeXh/YuAJ41kw8aEdECyeyIaZDtqmuIWULSBrYfKM+o/jrwG9tHVl1XREQ8XjI7Ij3KMVzvLk8UuRp4IsUZ1RERUU/J7Jj10qMcEREREdFFepQjIiIiIrpIQzkiIiIioos0lCMiIiIiukhDOSIiIiKiizSUIyIiIiK6SEM5IiIiIqKL/w8vMXfrLf0D1gAAAABJRU5ErkJggg==",
@@ -132,17 +155,21 @@
"source": [
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
"\n",
- "_ = rgdr.plot_clusters(precursor_field, target_timeseries, lag=1, ax=ax1)\n",
+ "RGDR(eps_km=600, min_area_km2=3000**2).preview_clusters(precursor_field,\n",
+ " target_timeseries,\n",
+ " lag=1, ax=ax1)\n",
"\n",
- "_ = RGDR(eps_km=600, min_area_km2=None).plot_clusters(precursor_field, target_timeseries,\n",
- " lag=1, ax=ax2)"
+ "RGDR(eps_km=600, min_area_km2=None).preview_clusters(precursor_field,\n",
+ " target_timeseries,\n",
+ " lag=1, ax=ax2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "With `.fit` the RGDR clustering can be fit to a precursor field.\n",
+ "Once you are satisfied with the selected paramters, the `.fit` method can be used to fit the RGDR clustering to a precursor field.\n",
+ "\n",
"`.transform` can then be used to return the data reduced to clusters:"
]
},
@@ -515,7 +542,7 @@
" longitude (cluster_labels) float64 223.9 185.4 221.8 190.2 217.8 219.3\n",
"Attributes:\n",
" data: Clustered data with Response Guided Dimensionality Reduction.\n",
- " coordinates: Latitudes and longitudes are geographical centers associate...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 39</li><li><span class='xr-has-index'>cluster_labels</span>: 6</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-ebb62979-6703-4d4f-9e66-216747b50a2f' class='xr-array-in' type='checkbox' ><label for='section-ebb62979-6703-4d4f-9e66-216747b50a2f' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>290.8 298.9 287.8 296.6 286.0 284.9 ... 298.2 288.4 296.6 286.9 285.1</span></div><div class='xr-array-data'><pre>array([[290.79588914, 298.94548042, 287.83356654, 296.5913755 ,\n",
+ " coordinates: Latitudes and longitudes are geographical centers associate...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 39</li><li><span class='xr-has-index'>cluster_labels</span>: 6</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-b9814065-77d7-499d-bf20-524974fa3294' class='xr-array-in' type='checkbox' ><label for='section-b9814065-77d7-499d-bf20-524974fa3294' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>290.8 298.9 287.8 296.6 286.0 284.9 ... 298.2 288.4 296.6 286.9 285.1</span></div><div class='xr-array-data'><pre>array([[290.79588914, 298.94548042, 287.83356654, 296.5913755 ,\n",
" 286.03044129, 284.87776786],\n",
" [290.970545 , 298.92119198, 288.55306112, 296.90258837,\n",
" 286.41065088, 285.21587978],\n",
@@ -555,13 +582,13 @@
" [291.45966391, 299.19568083, 288.59732323, 296.99780806,\n",
" 286.61949986, 284.98540926],\n",
" [291.37066195, 298.21053747, 288.43352188, 296.60848274,\n",
- " 286.90046576, 285.06801918]])</pre></div></div></li><li class='xr-section-item'><input id='section-3a5d483f-c7dd-4c8e-89c9-63da712b7ba6' class='xr-section-summary-in' type='checkbox' checked><label for='section-3a5d483f-c7dd-4c8e-89c9-63da712b7ba6' class='xr-section-summary' >Coordinates: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>1980 1981 1982 ... 2016 2017 2018</div><input id='attrs-8e70b916-84d8-40d9-918a-209ea4c71272' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-8e70b916-84d8-40d9-918a-209ea4c71272' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a088dd2e-4ea3-49c5-b26a-bec2841de5d3' class='xr-var-data-in' type='checkbox'><label for='data-a088dd2e-4ea3-49c5-b26a-bec2841de5d3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,\n",
+ " 286.90046576, 285.06801918]])</pre></div></div></li><li class='xr-section-item'><input id='section-8ab02218-59be-4b93-a221-54e4749a4c78' class='xr-section-summary-in' type='checkbox' checked><label for='section-8ab02218-59be-4b93-a221-54e4749a4c78' class='xr-section-summary' >Coordinates: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>1980 1981 1982 ... 2016 2017 2018</div><input id='attrs-e7d9a151-f6d5-4bdc-8098-860833f05ce3' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e7d9a151-f6d5-4bdc-8098-860833f05ce3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4933660f-689b-4cff-bf5a-9f595f3ddc32' class='xr-var-data-in' type='checkbox'><label for='data-4933660f-689b-4cff-bf5a-9f595f3ddc32' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,\n",
" 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,\n",
" 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015,\n",
- " 2016, 2017, 2018])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'><U20</div><div class='xr-var-preview xr-preview'>'lag:1_cluster:-2' ... 'lag:4_cl...</div><input id='attrs-3951033c-4bfd-451e-9fb2-0927e2b3c321' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3951033c-4bfd-451e-9fb2-0927e2b3c321' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d6752cfe-c010-420c-855e-8b2ebd984b5f' class='xr-var-data-in' type='checkbox'><label for='data-d6752cfe-c010-420c-855e-8b2ebd984b5f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['lag:1_cluster:-2', 'lag:1_cluster:1', 'lag:2_cluster:-1',\n",
- " 'lag:2_cluster:1', 'lag:3_cluster:-1', 'lag:4_cluster:-2'], dtype='<U20')</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>36.05 29.44 37.33 29.58 38.14 39.78</div><input id='attrs-1e9d0a47-a70a-4a4a-a32d-6fdabbe7af38' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1e9d0a47-a70a-4a4a-a32d-6fdabbe7af38' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d7b33e7f-ab59-4715-8dac-97820938005b' class='xr-var-data-in' type='checkbox'><label for='data-d7b33e7f-ab59-4715-8dac-97820938005b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([36.0508552 , 29.4398051 , 37.33257702, 29.58134561, 38.13773082,\n",
- " 39.78162825])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>223.9 185.4 221.8 190.2 217.8 219.3</div><input id='attrs-140e577b-192d-4ef3-aa46-3cacf76cf2b5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-140e577b-192d-4ef3-aa46-3cacf76cf2b5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1a127e1f-5fae-4c9a-b627-bda596ae2de7' class='xr-var-data-in' type='checkbox'><label for='data-1a127e1f-5fae-4c9a-b627-bda596ae2de7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([223.86658208, 185.40970765, 221.82516648, 190.20336403,\n",
- " 217.7810629 , 219.30300121])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-52ed9bea-fa67-4733-a041-2bd5da86e1af' class='xr-section-summary-in' type='checkbox' checked><label for='section-52ed9bea-fa67-4733-a041-2bd5da86e1af' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>data :</span></dt><dd>Clustered data with Response Guided Dimensionality Reduction.</dd><dt><span>coordinates :</span></dt><dd>Latitudes and longitudes are geographical centers associated with clusters.</dd></dl></div></li></ul></div></div>"
+ " 2016, 2017, 2018])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'><U20</div><div class='xr-var-preview xr-preview'>'lag:1_cluster:-2' ... 'lag:4_cl...</div><input id='attrs-a3775c40-6ebc-4a42-bf0e-e3037a18ad11' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-a3775c40-6ebc-4a42-bf0e-e3037a18ad11' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2c65aa63-0d9f-479a-9a52-6235fdbe351c' class='xr-var-data-in' type='checkbox'><label for='data-2c65aa63-0d9f-479a-9a52-6235fdbe351c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['lag:1_cluster:-2', 'lag:1_cluster:1', 'lag:2_cluster:-1',\n",
+ " 'lag:2_cluster:1', 'lag:3_cluster:-1', 'lag:4_cluster:-2'], dtype='<U20')</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>36.05 29.44 37.33 29.58 38.14 39.78</div><input id='attrs-5ec3591f-c5c0-42d9-a37e-83f52120d27f' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5ec3591f-c5c0-42d9-a37e-83f52120d27f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b117a3f9-382c-430a-a83c-273c78962a08' class='xr-var-data-in' type='checkbox'><label for='data-b117a3f9-382c-430a-a83c-273c78962a08' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([36.0508552 , 29.4398051 , 37.33257702, 29.58134561, 38.13773082,\n",
+ " 39.78162825])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>223.9 185.4 221.8 190.2 217.8 219.3</div><input id='attrs-b30326c1-962c-4973-abcb-0fffdd76751c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b30326c1-962c-4973-abcb-0fffdd76751c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ca106886-bf06-4ac2-a980-c3df7cff353c' class='xr-var-data-in' type='checkbox'><label for='data-ca106886-bf06-4ac2-a980-c3df7cff353c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([223.86658208, 185.40970765, 221.82516648, 190.20336403,\n",
+ " 217.7810629 , 219.30300121])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-df1be5c8-b32f-4819-812f-7c3936f2b85e' class='xr-section-summary-in' type='checkbox' checked><label for='section-df1be5c8-b32f-4819-812f-7c3936f2b85e' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>data :</span></dt><dd>Clustered data with Response Guided Dimensionality Reduction.</dd><dt><span>coordinates :</span></dt><dd>Latitudes and longitudes are geographical centers associated with clusters.</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'sst' (anchor_year: 39, cluster_labels: 6)>\n",
@@ -632,59 +659,471 @@
"plt.legend()"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The `RGDR` object will also contain the correlation maps, p-values, and cluster maps.\n",
+ "\n",
+ "These are all `xr.DataArray` objects, and can easily be plot using the builtin methods:"
+ ]
+ },
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
+ "text/html": [
+ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
+ "<defs>\n",
+ "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
+ "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
+ "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
+ "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
+ "</symbol>\n",
+ "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
+ "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
+ "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
+ "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
+ "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
+ "</symbol>\n",
+ "</defs>\n",
+ "</svg>\n",
+ "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
+ " *\n",
+ " */\n",
+ "\n",
+ ":root {\n",
+ " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
+ " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
+ " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
+ " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
+ " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
+ " --xr-background-color: var(--jp-layout-color0, white);\n",
+ " --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
+ " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
+ "}\n",
+ "\n",
+ "html[theme=dark],\n",
+ "body[data-theme=dark],\n",
+ "body.vscode-dark {\n",
+ " --xr-font-color0: rgba(255, 255, 255, 1);\n",
+ " --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
+ " --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
+ " --xr-border-color: #1F1F1F;\n",
+ " --xr-disabled-color: #515151;\n",
+ " --xr-background-color: #111111;\n",
+ " --xr-background-color-row-even: #111111;\n",
+ " --xr-background-color-row-odd: #313131;\n",
+ "}\n",
+ "\n",
+ ".xr-wrap {\n",
+ " display: block !important;\n",
+ " min-width: 300px;\n",
+ " max-width: 700px;\n",
+ "}\n",
+ "\n",
+ ".xr-text-repr-fallback {\n",
+ " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-header {\n",
+ " padding-top: 6px;\n",
+ " padding-bottom: 6px;\n",
+ " margin-bottom: 4px;\n",
+ " border-bottom: solid 1px var(--xr-border-color);\n",
+ "}\n",
+ "\n",
+ ".xr-header > div,\n",
+ ".xr-header > ul {\n",
+ " display: inline;\n",
+ " margin-top: 0;\n",
+ " margin-bottom: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-obj-type,\n",
+ ".xr-array-name {\n",
+ " margin-left: 2px;\n",
+ " margin-right: 10px;\n",
+ "}\n",
+ "\n",
+ ".xr-obj-type {\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-sections {\n",
+ " padding-left: 0 !important;\n",
+ " display: grid;\n",
+ " grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
+ "}\n",
+ "\n",
+ ".xr-section-item {\n",
+ " display: contents;\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input {\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input + label {\n",
+ " color: var(--xr-disabled-color);\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input:enabled + label {\n",
+ " cursor: pointer;\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input:enabled + label:hover {\n",
+ " color: var(--xr-font-color0);\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary {\n",
+ " grid-column: 1;\n",
+ " color: var(--xr-font-color2);\n",
+ " font-weight: 500;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary > span {\n",
+ " display: inline-block;\n",
+ " padding-left: 0.5em;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:disabled + label {\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in + label:before {\n",
+ " display: inline-block;\n",
+ " content: '►';\n",
+ " font-size: 11px;\n",
+ " width: 15px;\n",
+ " text-align: center;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:disabled + label:before {\n",
+ " color: var(--xr-disabled-color);\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:checked + label:before {\n",
+ " content: '▼';\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:checked + label > span {\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary,\n",
+ ".xr-section-inline-details {\n",
+ " padding-top: 4px;\n",
+ " padding-bottom: 4px;\n",
+ "}\n",
+ "\n",
+ ".xr-section-inline-details {\n",
+ " grid-column: 2 / -1;\n",
+ "}\n",
+ "\n",
+ ".xr-section-details {\n",
+ " display: none;\n",
+ " grid-column: 1 / -1;\n",
+ " margin-bottom: 5px;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:checked ~ .xr-section-details {\n",
+ " display: contents;\n",
+ "}\n",
+ "\n",
+ ".xr-array-wrap {\n",
+ " grid-column: 1 / -1;\n",
+ " display: grid;\n",
+ " grid-template-columns: 20px auto;\n",
+ "}\n",
+ "\n",
+ ".xr-array-wrap > label {\n",
+ " grid-column: 1;\n",
+ " vertical-align: top;\n",
+ "}\n",
+ "\n",
+ ".xr-preview {\n",
+ " color: var(--xr-font-color3);\n",
+ "}\n",
+ "\n",
+ ".xr-array-preview,\n",
+ ".xr-array-data {\n",
+ " padding: 0 5px !important;\n",
+ " grid-column: 2;\n",
+ "}\n",
+ "\n",
+ ".xr-array-data,\n",
+ ".xr-array-in:checked ~ .xr-array-preview {\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-array-in:checked ~ .xr-array-data,\n",
+ ".xr-array-preview {\n",
+ " display: inline-block;\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list {\n",
+ " display: inline-block !important;\n",
+ " list-style: none;\n",
+ " padding: 0 !important;\n",
+ " margin: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list li {\n",
+ " display: inline-block;\n",
+ " padding: 0;\n",
+ " margin: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list:before {\n",
+ " content: '(';\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list:after {\n",
+ " content: ')';\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list li:not(:last-child):after {\n",
+ " content: ',';\n",
+ " padding-right: 5px;\n",
+ "}\n",
+ "\n",
+ ".xr-has-index {\n",
+ " font-weight: bold;\n",
+ "}\n",
+ "\n",
+ ".xr-var-list,\n",
+ ".xr-var-item {\n",
+ " display: contents;\n",
+ "}\n",
+ "\n",
+ ".xr-var-item > div,\n",
+ ".xr-var-item label,\n",
+ ".xr-var-item > .xr-var-name span {\n",
+ " background-color: var(--xr-background-color-row-even);\n",
+ " margin-bottom: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-var-item > .xr-var-name:hover span {\n",
+ " padding-right: 5px;\n",
+ "}\n",
+ "\n",
+ ".xr-var-list > li:nth-child(odd) > div,\n",
+ ".xr-var-list > li:nth-child(odd) > label,\n",
+ ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
+ " background-color: var(--xr-background-color-row-odd);\n",
+ "}\n",
+ "\n",
+ ".xr-var-name {\n",
+ " grid-column: 1;\n",
+ "}\n",
+ "\n",
+ ".xr-var-dims {\n",
+ " grid-column: 2;\n",
+ "}\n",
+ "\n",
+ ".xr-var-dtype {\n",
+ " grid-column: 3;\n",
+ " text-align: right;\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-var-preview {\n",
+ " grid-column: 4;\n",
+ "}\n",
+ "\n",
+ ".xr-var-name,\n",
+ ".xr-var-dims,\n",
+ ".xr-var-dtype,\n",
+ ".xr-preview,\n",
+ ".xr-attrs dt {\n",
+ " white-space: nowrap;\n",
+ " overflow: hidden;\n",
+ " text-overflow: ellipsis;\n",
+ " padding-right: 10px;\n",
+ "}\n",
+ "\n",
+ ".xr-var-name:hover,\n",
+ ".xr-var-dims:hover,\n",
+ ".xr-var-dtype:hover,\n",
+ ".xr-attrs dt:hover {\n",
+ " overflow: visible;\n",
+ " width: auto;\n",
+ " z-index: 1;\n",
+ "}\n",
+ "\n",
+ ".xr-var-attrs,\n",
+ ".xr-var-data {\n",
+ " display: none;\n",
+ " background-color: var(--xr-background-color) !important;\n",
+ " padding-bottom: 5px !important;\n",
+ "}\n",
+ "\n",
+ ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
+ ".xr-var-data-in:checked ~ .xr-var-data {\n",
+ " display: block;\n",
+ "}\n",
+ "\n",
+ ".xr-var-data > table {\n",
+ " float: right;\n",
+ "}\n",
+ "\n",
+ ".xr-var-name span,\n",
+ ".xr-var-data,\n",
+ ".xr-attrs {\n",
+ " padding-left: 25px !important;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs,\n",
+ ".xr-var-attrs,\n",
+ ".xr-var-data {\n",
+ " grid-column: 1 / -1;\n",
+ "}\n",
+ "\n",
+ "dl.xr-attrs {\n",
+ " padding: 0;\n",
+ " margin: 0;\n",
+ " display: grid;\n",
+ " grid-template-columns: 125px auto;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dt,\n",
+ ".xr-attrs dd {\n",
+ " padding: 0;\n",
+ " margin: 0;\n",
+ " float: left;\n",
+ " padding-right: 10px;\n",
+ " width: auto;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dt {\n",
+ " font-weight: normal;\n",
+ " grid-column: 1;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dt:hover span {\n",
+ " display: inline-block;\n",
+ " background: var(--xr-background-color);\n",
+ " padding-right: 10px;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dd {\n",
+ " grid-column: 2;\n",
+ " white-space: pre-wrap;\n",
+ " word-break: break-all;\n",
+ "}\n",
+ "\n",
+ ".xr-icon-database,\n",
+ ".xr-icon-file-text2 {\n",
+ " display: inline-block;\n",
+ " vertical-align: middle;\n",
+ " width: 1em;\n",
+ " height: 1.5em !important;\n",
+ " stroke-width: 0;\n",
+ " stroke: currentColor;\n",
+ " fill: currentColor;\n",
+ "}\n",
+ "</style><pre class='xr-text-repr-fallback'><xarray.DataArray (latitude: 5, longitude: 13, i_interval: 4)>\n",
+ "0.01618 -0.2187 -0.2194 -0.2663 0.02414 ... -0.3984 -0.38 -0.3063 -0.1126\n",
+ "Coordinates:\n",
+ " * i_interval (i_interval) int64 1 2 3 4\n",
+ " * latitude (latitude) float64 47.5 42.5 37.5 32.5 27.5\n",
+ " * longitude (longitude) float64 177.5 182.5 187.5 ... 227.5 232.5 237.5\n",
+ " area (latitude) float64 3.34e+06 3.645e+06 ... 4.169e+06 4.385e+06\n",
+ " tfreq int64 5\n",
+ " n_clusters int64 6\n",
+ " cluster int64 3</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'></div><ul class='xr-dim-list'><li><span class='xr-has-index'>latitude</span>: 5</li><li><span class='xr-has-index'>longitude</span>: 13</li><li><span class='xr-has-index'>i_interval</span>: 4</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-420d8bed-40b7-4777-abcf-2c09c8b76ead' class='xr-array-in' type='checkbox' ><label for='section-420d8bed-40b7-4777-abcf-2c09c8b76ead' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>0.01618 -0.2187 -0.2194 -0.2663 ... -0.3984 -0.38 -0.3063 -0.1126</span></div><div class='xr-array-data'><pre>array([[[ 0.01617516, -0.21868534, -0.21941745, -0.26630719],\n",
+ " [ 0.02414245, -0.12315571, -0.21464621, -0.18191947],\n",
+ " [-0.1105048 , -0.23253951, -0.4007449 , -0.25372747],\n",
+ " [-0.24520611, -0.35037825, -0.46371192, -0.35772739],\n",
+ " [-0.32824171, -0.4534247 , -0.46975605, -0.3473753 ],\n",
+ " [-0.323078 , -0.43326205, -0.41748415, -0.29461981],\n",
+ " [-0.30660624, -0.34313136, -0.34457092, -0.28702518],\n",
+ " [-0.38616188, -0.34666184, -0.37666874, -0.37721962],\n",
+ " [-0.3822271 , -0.33402403, -0.30240485, -0.32951966],\n",
+ " [-0.36827501, -0.41554246, -0.28493204, -0.33065629],\n",
+ " [-0.28047128, -0.27858467, -0.19205284, -0.27627975],\n",
+ " [-0.10757776, -0.2545805 , -0.15956299, -0.12823108],\n",
+ " [ nan, nan, nan, nan]],\n",
+ "\n",
+ " [[-0.02842247, -0.12801465, -0.1379688 , -0.19425886],\n",
+ " [ 0.00598683, -0.0124359 , -0.0967947 , -0.10557213],\n",
+ " [ 0.00479765, -0.09888618, -0.13544553, -0.1265711 ],\n",
+ " [ 0.01930277, -0.06881219, -0.16586661, -0.2325628 ],\n",
+ " [-0.01405595, -0.1865748 , -0.22187587, -0.25983436],\n",
+ " [ 0.01204043, -0.26110484, -0.28542316, -0.29141342],\n",
+ "...\n",
+ " [-0.18490648, -0.12178649, -0.12912278, -0.29769152],\n",
+ " [-0.24043321, -0.27218421, -0.25308925, -0.3604698 ],\n",
+ " [-0.29061517, -0.38322784, -0.34714351, -0.39152915],\n",
+ " [-0.35707131, -0.54341488, -0.46870146, -0.3338985 ],\n",
+ " [-0.26357851, -0.48241304, -0.36081808, -0.155657 ],\n",
+ " [-0.27768413, -0.32115578, -0.26949376, -0.10772449]],\n",
+ "\n",
+ " [[ 0.42487447, 0.50036829, 0.20242345, 0.01770287],\n",
+ " [ 0.34211447, 0.4839066 , 0.2784725 , 0.00806344],\n",
+ " [ 0.3433933 , 0.43694834, 0.3199787 , 0.14065339],\n",
+ " [ 0.18648733, 0.35050515, 0.33449607, 0.13369711],\n",
+ " [ 0.04340644, 0.25401412, 0.29487164, 0.1233588 ],\n",
+ " [-0.10334886, 0.09830805, 0.26352384, 0.0517264 ],\n",
+ " [-0.17111999, -0.08694884, 0.16013368, -0.01373979],\n",
+ " [-0.24750864, -0.25987983, -0.08067427, -0.06523411],\n",
+ " [-0.35825522, -0.39384288, -0.31606223, -0.1921587 ],\n",
+ " [-0.41354082, -0.4202639 , -0.34898835, -0.11634853],\n",
+ " [-0.37029449, -0.43487533, -0.35672934, -0.1791453 ],\n",
+ " [-0.40753351, -0.42768064, -0.34349675, -0.21013388],\n",
+ " [-0.39836497, -0.37996126, -0.3062787 , -0.11258559]]])</pre></div></div></li><li class='xr-section-item'><input id='section-fa2fda83-c99e-417a-8f36-df966d53fc7f' class='xr-section-summary-in' type='checkbox' checked><label for='section-fa2fda83-c99e-417a-8f36-df966d53fc7f' class='xr-section-summary' >Coordinates: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>i_interval</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1 2 3 4</div><input id='attrs-05b3da1b-4dbc-4156-9810-fc5c2536ae1b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-05b3da1b-4dbc-4156-9810-fc5c2536ae1b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4750df8e-ff1d-49cf-8c3a-73e1781348ff' class='xr-var-data-in' type='checkbox'><label for='data-4750df8e-ff1d-49cf-8c3a-73e1781348ff' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([1, 2, 3, 4], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>latitude</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>47.5 42.5 37.5 32.5 27.5</div><input id='attrs-5dc96415-86e8-47db-83c9-2ba4a1c1daa6' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5dc96415-86e8-47db-83c9-2ba4a1c1daa6' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2edfc74c-d2b8-42bd-a888-fb5bc152816c' class='xr-var-data-in' type='checkbox'><label for='data-2edfc74c-d2b8-42bd-a888-fb5bc152816c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([47.5, 42.5, 37.5, 32.5, 27.5])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>longitude</span></div><div class='xr-var-dims'>(longitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>177.5 182.5 187.5 ... 232.5 237.5</div><input id='attrs-eb1cc3e1-d454-4e45-8b8e-147c60eab798' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-eb1cc3e1-d454-4e45-8b8e-147c60eab798' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6243d329-5917-4487-90b6-680c4621ee68' class='xr-var-data-in' type='checkbox'><label for='data-6243d329-5917-4487-90b6-680c4621ee68' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([177.5, 182.5, 187.5, 192.5, 197.5, 202.5, 207.5, 212.5, 217.5, 222.5,\n",
+ " 227.5, 232.5, 237.5])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>area</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>3.34e+06 3.645e+06 ... 4.385e+06</div><input id='attrs-61c0ee69-fbcc-47fe-8498-3f24bf3a405a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-61c0ee69-fbcc-47fe-8498-3f24bf3a405a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-00f507f0-341a-4c02-8721-40b9b0ab92f8' class='xr-var-data-in' type='checkbox'><label for='data-00f507f0-341a-4c02-8721-40b9b0ab92f8' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([3339800.84283772, 3644753.05166713, 3921966.48901128,\n",
+ " 4169331.39322594, 4384965.16802703])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>tfreq</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>5</div><input id='attrs-8c0f5aac-772d-4c8e-8e28-d05843c168d0' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-8c0f5aac-772d-4c8e-8e28-d05843c168d0' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-98695b91-dd7e-401b-9167-a67d74ab8e62' class='xr-var-data-in' type='checkbox'><label for='data-98695b91-dd7e-401b-9167-a67d74ab8e62' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(5, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>n_clusters</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>6</div><input id='attrs-ccf5d767-d518-4df4-8e1b-47e31111af9c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ccf5d767-d518-4df4-8e1b-47e31111af9c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e11d594d-5e70-4bfb-b766-84db0639c9db' class='xr-var-data-in' type='checkbox'><label for='data-e11d594d-5e70-4bfb-b766-84db0639c9db' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(6, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>cluster</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>3</div><input id='attrs-56288bf7-23ee-4a56-a121-e561a5fb98f1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-56288bf7-23ee-4a56-a121-e561a5fb98f1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-19ac81fa-703f-4610-80e3-f932c99d5df1' class='xr-var-data-in' type='checkbox'><label for='data-19ac81fa-703f-4610-80e3-f932c99d5df1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(3, dtype=int64)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-60650f8e-73b5-4cda-adda-8dc4aed5eb47' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-60650f8e-73b5-4cda-adda-8dc4aed5eb47' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
+ ],
"text/plain": [
- "<matplotlib.collections.QuadMesh at 0x1c0c3f197b0>"
+ "<xarray.DataArray (latitude: 5, longitude: 13, i_interval: 4)>\n",
+ "0.01618 -0.2187 -0.2194 -0.2663 0.02414 ... -0.3984 -0.38 -0.3063 -0.1126\n",
+ "Coordinates:\n",
+ " * i_interval (i_interval) int64 1 2 3 4\n",
+ " * latitude (latitude) float64 47.5 42.5 37.5 32.5 27.5\n",
+ " * longitude (longitude) float64 177.5 182.5 187.5 ... 227.5 232.5 237.5\n",
+ " area (latitude) float64 3.34e+06 3.645e+06 ... 4.169e+06 4.385e+06\n",
+ " tfreq int64 5\n",
+ " n_clusters int64 6\n",
+ " cluster int64 3"
]
},
- "execution_count": 7,
+ "execution_count": 18,
"metadata": {},
"output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEWCAYAAAByqrw/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAns0lEQVR4nO3de5wcZZ3v8c93BsI1ECAYAomAElRARIygK4JHQAGVsMcLghdY8WSR5RzWK0F8sYji4mXFdRdXsnhhFURE0Yjcr165hKvciYCSEMEgdxBI8j1/VA10Oj3TPTPV0z2d7/v1qtdUVT/91K9rZn791FNVT8k2ERHRO/o6HUBERFQriT0ioscksUdE9Jgk9oiIHpPEHhHRY5LYIyJ6TNcldkm3SHpTkzKflnTK2EQ0OpIul/ThTscxFElrSfq5pEcl/ajT8YwHkr4r6fOdjmO8kvQmSQs7HUev6rrEbntb25c3KfMF2y0lS0nHSvp+JcF1CUn/S9JlZSK+d5jvPVjSr+tWvwuYAmxk+91VxVm18kvyb5KeKKc7Oh3TaIyn5CbpCEn3SHpS0m2Stu50TDG4rkvs3UbSap2OoYEngW8Dn6yovs2BO20vbfRil+2Dw22vW04v63QwnTRWv5fyiPMQ4G3AusDbgSVjse0Yma5L7JLulbRHkzLPt8IlbSHJkg6S9CdJSyQdXb62F/BpYP+yhXdjuX59Sd+StFjSIkmfl9RfvnawpN9IOlHSQ8DnJD0iabua7W8s6WlJL5K0gaRzJP1F0sPl/LQ27R4AbF9t+3vA3cN5n6RXAN8EXl/uj0ckfRY4hhf20SEN9sGxktaQ9JVyHz8g6ZuS1qqp+5Pl/rxf0ofK38lWVX7u0Shb+58rP9fjki6UNLmF9+0i6bflvrpP0sENyqx0FFT7+SXtI+nWcruLJH1C0jrAecCmNUcg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/PAA8AF3TpvlxA0Qc8sO6bnYpziBh/TDGm003AzylOqHbV77uuzL28cFVMR/6/Oz1lSIGIiB6zKnXFRESsEpLYIyJ6TBJ7RESPSWKPiOgxSewRET0miT3aStITbahzX0lzyvn9JG0zgjouV92ojxG9Iok9xh3b82yfUC7uRzECYUSUkthjTJR3/n1Z0s0qxpvfv1z/prL1fJaKcclPK+8uRNI+5bpryzG1zynXHyzpPyX9HbAvxeBuN0h6aW1LXNLk8hZzJK0l6QxJt0k6G1irJra3qBgH/zpJPyrHIYkYt9r5MOuIWv8b2AF4FTAZuEbSwBDFrwa2pRj24TfAGyTNB04GdrV9j6Qf1Fdo+7eS5gHn2D4LoPxOaOQjwFO2XyFpe+C6svxkiuEb9rD9pKQjgY8Bx1XwmSM6Iok9xsouwA9sL6MYROwK4LXAY8DVthcCSLoB2AJ4ArjbxVjkUAzBMHsU298V+DqA7Zsk3VSufx1FV85vyi+FCcDvRrGdiI5LYo9u8EzN/DJG93e5lBe6GNdsobyAi2wfMIptRnSV9LHHWPkVsL+kfkkbU7Sghxqt8A7gJeXDFAD2H6Tc4xRj1w+4F3hNOf+umvW/BA4EkLQdsH25/kqKrp+tytfWkbR1Kx8oolslscdYOZtiRL4bgUuBT7kYVrUh208DhwHnlw8eeRx4tEHRM4BPSrpe0kspno71EUnXU/TlD/gvYF1Jt1H0n19bbucvwMHAD8rumd8BLx/NB43otIzuGF1L0rq2nyivkjkJuMv2iZ2OK6LbpcUe3ez/lCdTb6F4APnJnQ0nYnxIiz0iosekxR4R0WOS2CMiekwSe0REj0lij4joMUnsERE95v8D1NwfwBbM8aAAAAAASUVORK5CYII=",
- "text/plain": [
- "<Figure size 432x288 with 2 Axes>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
}
],
"source": [
- "# visualize correlation map after RGDR().fit(precursor_field, target_timeseries)\n",
- "rgdr.corr_map[0].plot()"
+ "# View the contents of the corr_map DataArray:\n",
+ "rgdr.corr_map"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "<matplotlib.collections.QuadMesh at 0x1c0c3e0e620>"
+ "<matplotlib.collections.QuadMesh at 0x1a068ef16f0>"
]
},
- "execution_count": 8,
+ "execution_count": 27,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAEWCAYAAABG030jAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAic0lEQVR4nO3deZwcVb338c83AYRAIEIAA4kGWVRANhHcrnARFRABH3HBjSjPjcvFBzckiC9kEa/bFfVefCQqiAoiIGhENpVFL7IlECJJWAKEJUQwQCAsZpn87h/nDCmanumeSdV01+T7fr3qNV3Vp0/9umbmV6dOnapSRGBmZvUxotMBmJnZwDhxm5nVjBO3mVnNOHGbmdWME7eZWc04cZuZ1UzXJW5JsyXt3aLMlyT9eGgiWj2Srpb0fzsdR38krSfpd5KekHR+p+OpA0k/lfTVTsdRV5L2lvRgp+Ooq65L3BGxQ0Rc3aLM1yKirWQo6QRJvygluC4h6V8lXZUT7fwBfnaSpP9pWHwosDmwSUS8p6w4y5Z3gv+U9FSe7uh0TKujTslL0lGS7pX0tKS5krbrdExrsq5L3N1G0lqdjqGJp4EzgKNLqu9lwJ0RsaLZm122DY6MiA3y9IpOB9NJQ/V7yUeMRwDvADYADgQWDcW6rbmuS9yS5kvat0WZ51rRkiZKCkmHS7pf0iJJx+X39gO+BLwvt9Buzcs3kvQTSQslLZD0VUkj83uTJF0r6VRJjwInS1osacfC+jeV9KykzSS9WNLFkv4h6fH8enxFmweAiLgxIn4O3DOQz0l6FfBD4PV5eyyWdCJwPKu20RFNtsEJkl4k6dt5Gz8s6YeS1ivUfXTeng9J+lj+nWxT5vdeHbm1fnL+X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iIg5lMpWRERExBxKZSsiIiJiDv1/IiIGryeuimkAAAAASUVORK5CYII=",
"text/plain": [
- "<Figure size 432x288 with 2 Axes>"
+ "<Figure size 720x216 with 4 Axes>"
]
},
"metadata": {
@@ -694,30 +1133,32 @@
}
],
"source": [
- "# visualize p-values map\n",
- "rgdr.pval_map[0].plot()"
+ "fig, (ax1, ax2) = plt.subplots(figsize=(10, 3), ncols=2)\n",
+ "\n",
+ "# Visualize correlation map after RGDR().fit(precursor_field, target_timeseries)\n",
+ "rgdr.corr_map.sel(i_interval=1).plot(ax=ax1)\n",
+ "\n",
+ "# Visualize p-values map\n",
+ "rgdr.pval_map.sel(i_interval=1).plot(ax=ax2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The cluster maps can also be visualized. Note that clusters can differ between lags."
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAABCUAAACqCAYAAACaofWMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsa0lEQVR4nO3deZglZX33//dnmAFUQFAQkSW4KxpFHJcnaqLGfUWfuBCjEheixkvQxD1XXKJ5YhKFEJPoPG644RqiPxQVI7g9Ksq+aVxABUFEQXEDZub7+6Oq5XTRy+npPkt1v1/XVddU1anlvuuc8+npu++6K1WFJEmSJEnSuK2bdAEkSZIkSdLaZKOEJEmSJEmaCBslJEmSJEnSRNgoIUmSJEmSJsJGCUmSJEmSNBE2SkiSJEmSpInoVaNEknOT3H+RbV6R5G3jKdHyJDk5ybMmXQ7NzfenH8wFjZPvTz+YCxon359+MBc0TkkuTPKgSZejL3rVKFFVd6qqkxfZ5u+raqgvaJJXJ3nvihRuSiR5QJKTkvw8yYVL3PfQJF8aUd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bkg8kOT/JccANBsr2kCRfSXJakg8n2Wm8V0dam8wFSV3mgqQuc0HTav2kC6AlezxwIHBXYHfg60m+0L52N+BOwI+ALwP3SfIN4K3AH1bVBUmO7R6wqv5fko8Dx1fVRwDaHJrLc4FfV9Udk9wFOK3dfnfgb4AHVdWvkrwUeBHw2hWos6SFmQuSuswFSV3mgqaSjRL9c1/g2KraAvw4yeeBewC/AE6pqosAkpwB7A/8EvheVV3Q7n8scNgyzv+HwNEAVXVWkrPa9fem6bb15TaItge+sozzSBqeuSCpy1yQ1GUuaCrZKLG6XD0wv4Xlvb+bue72nh2H2D7AiVV1yDLOKWnlmQuSuswFSV3mgibGMSX654vAk5Jsl2QPmhbHUxbY/lvArZLs3y4/aZ7trgJ2Hli+ELh7O/8nA+u/APwpQJI7A3dp13+VppvXbdrXbpTkdsNUSNKymQuSuswFSV3mgqaSjRL9cxxwFnAm8DngJVV16XwbV9VvgOcBn0pyKk1o/HyOTT8AvDjJ6UluDfwz8Nwkp9PcczbjP4CdkpxPc5/Xqe15fgIcChzbdsX6CnCH5VRU0tDMBUld5oKkLnNBUylVNekyaMSS7FRVv2xH0f034NtVdeSkyyVpcswFSV3mgqQuc0HjYE+JteHZ7YA15wI3phlFV9LaZi5I6jIXJHWZCxo5e0pIkiRJkqSJsKeEJEmSJEmaCBslJEmSJEnSRNgoIUmSJEmSJsJGCUmSJEmSNBE2SkiSJEmSpImwUUKSJEmSJE3E/w/hh2d8pEaHnQAAAABJRU5ErkJggg==",
"text/plain": [
- "<matplotlib.collections.QuadMesh at 0x1c0c298fdc0>"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEWCAYAAACJ0YulAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmp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ure size 1296x144 with 8 Axes>"
]
},
"metadata": {
@@ -727,11 +1168,22 @@
}
],
"source": [
- "# visualize clusters\n",
"from s2spy.rgdr.utils import cluster_labels_to_ints\n",
"cluster_map = cluster_labels_to_ints(rgdr.cluster_map.copy())\n",
- "cluster_map.cluster_labels[0].plot()"
+ "\n",
+ "fig, axes = plt.subplots(figsize=(18, 2), ncols=4)\n",
+ "\n",
+ "# Loop through lag 1 -> 4\n",
+ "for i, ax in zip((1, 2, 3, 4), axes):\n",
+ " cluster_map.cluster_labels.sel(i_interval=i).plot(ax=ax, cmap='RdYlBu', vmin=-2, vmax=2)"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
diff --git a/s2spy/rgdr/rgdr.py b/s2spy/rgdr/rgdr.py
index 239f73c..605add3 100644
--- a/s2spy/rgdr/rgdr.py
+++ b/s2spy/rgdr/rgdr.py
@@ -392,7 +392,7 @@ class RGDR:
corr, p_val = self.get_correlation(precursor, timeseries)
return masked_spherical_dbscan(precursor, corr, p_val, self._dbscan_params)
- def plot_correlation( # pylint: disable=too-many-arguments
+ def preview_correlation( # pylint: disable=too-many-arguments
self,
precursor: xr.DataArray,
timeseries: xr.DataArray,
@@ -444,7 +444,7 @@ class RGDR:
return [plot1, plot2]
- def plot_clusters(
+ def preview_clusters(
self,
precursor: xr.DataArray,
timeseries: xr.DataArray,
|
Merge the plotting functionalities in RGDR module
Currently in RGDR module, there are two ways to plot the clusters:
- Preview the clusters by `RGDR(...).plot_clusters(precursor_field, target_timeseries)`
- Plotting clusters after fitting and transforming `cluster_map.cluster_labels[0].plot()`
The first option was designed to let the user have a quick check and preview the clusters. But it can cause confusion. We can merge these two functionalities and ask the user to `fit/transform` first and then `plot` the clusters.
|
AI4S2S/s2spy
|
diff --git a/tests/test_rgdr/test_rgdr.py b/tests/test_rgdr/test_rgdr.py
index 4c719eb..fcdf93b 100644
--- a/tests/test_rgdr/test_rgdr.py
+++ b/tests/test_rgdr/test_rgdr.py
@@ -221,38 +221,38 @@ class TestRGDR:
"lag:2_cluster:1", "lag:3_cluster:-1"])
np.testing.assert_array_equal(clustered_data["cluster_labels"], cluster_labels)
- def test_corr_plot(self, dummy_rgdr, example_field, example_target):
- dummy_rgdr.plot_correlation(example_field, example_target)
+ def test_corr_preview(self, dummy_rgdr, example_field, example_target):
+ dummy_rgdr.preview_correlation(example_field, example_target)
- def test_corr_plot_multiple_lags(
+ def test_corr_preview_multiple_lags(
self, dummy_rgdr, example_field_multiple_lags, example_target
):
- dummy_rgdr.plot_correlation(example_field_multiple_lags, example_target, lag=1)
+ dummy_rgdr.preview_correlation(example_field_multiple_lags, example_target, lag=1)
- def test_corr_plot_multiple_lags_fail(
+ def test_corr_preview_multiple_lags_fail(
self, dummy_rgdr, example_field_multiple_lags, example_target
):
with pytest.raises(ValueError):
- dummy_rgdr.plot_correlation(example_field_multiple_lags, example_target)
+ dummy_rgdr.preview_correlation(example_field_multiple_lags, example_target)
def test_corr_plot_ax(self, dummy_rgdr, example_field, example_target):
_, (ax1, ax2) = plt.subplots(ncols=2)
- dummy_rgdr.plot_correlation(example_field, example_target, ax1=ax1, ax2=ax2)
+ dummy_rgdr.preview_correlation(example_field, example_target, ax1=ax1, ax2=ax2)
def test_cluster_plot(self, dummy_rgdr, example_field, example_target):
- dummy_rgdr.plot_clusters(example_field, example_target)
+ dummy_rgdr.preview_clusters(example_field, example_target)
- def test_cluster_plot_multiple_lags(
+ def test_cluster_preview_multiple_lags(
self, dummy_rgdr, example_field_multiple_lags, example_target
):
- dummy_rgdr.plot_clusters(example_field_multiple_lags, example_target, lag=1)
+ dummy_rgdr.preview_clusters(example_field_multiple_lags, example_target, lag=1)
- def test_cluster_plot_multiple_lags_fail(
+ def test_cluster_preview_multiple_lags_fail(
self, dummy_rgdr, example_field_multiple_lags, example_target
):
with pytest.raises(ValueError):
- dummy_rgdr.plot_clusters(example_field_multiple_lags, example_target)
+ dummy_rgdr.preview_clusters(example_field_multiple_lags, example_target)
def test_cluster_plot_ax(self, dummy_rgdr, example_field, example_target):
_, ax = plt.subplots()
- dummy_rgdr.plot_clusters(example_field, example_target, ax=ax)
+ dummy_rgdr.preview_clusters(example_field, example_target, ax=ax)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": -1,
"issue_text_score": 0,
"test_score": -1
},
"num_modified_files": 2
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
astroid==3.3.9
babel==2.17.0
build==1.2.2.post1
bump2version==1.0.1
cachetools==5.5.2
certifi==2025.1.31
cftime==1.6.4.post1
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dill==0.3.9
distlib==0.3.9
docutils==0.21.2
dodgy==0.2.1
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
flake8==7.2.0
flake8-polyfill==1.0.2
fonttools==4.56.0
gitdb==4.0.12
GitPython==3.1.44
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==6.0.1
Jinja2==3.1.6
joblib==1.4.2
kiwisolver==1.4.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.9.4
mccabe==0.7.0
mdit-py-plugins==0.4.2
mdurl==0.1.2
mypy==1.15.0
mypy-extensions==1.0.0
myst-parser==3.0.1
netCDF4==1.7.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pep8-naming==0.10.0
pillow==11.1.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prospector==1.16.1
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.2
Pygments==2.19.1
pylint==3.3.6
pylint-celery==0.3
pylint-django==2.6.1
pylint-plugin-utils==0.8.2
pyparsing==3.2.3
pyproject-api==1.9.0
pyproject_hooks==1.2.0
pyroma==4.2
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
requirements-detector==1.3.2
-e git+https://github.com/AI4S2S/s2spy.git@81682c3a15708eb9fccb705796b134933001afb4#egg=s2spy
scikit-learn==1.6.1
scipy==1.13.1
semver==3.0.4
setoptconf-tmp==0.3.1
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-autoapi==3.6.0
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stdlib-list==0.11.1
threadpoolctl==3.6.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
tox==4.25.0
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
virtualenv==20.29.3
xarray==2024.7.0
zipp==3.21.0
|
name: s2spy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- astroid==3.3.9
- babel==2.17.0
- build==1.2.2.post1
- bump2version==1.0.1
- cachetools==5.5.2
- certifi==2025.1.31
- cftime==1.6.4.post1
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dill==0.3.9
- distlib==0.3.9
- docutils==0.21.2
- dodgy==0.2.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-polyfill==1.0.2
- fonttools==4.56.0
- gitdb==4.0.12
- gitpython==3.1.44
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- isort==6.0.1
- jinja2==3.1.6
- joblib==1.4.2
- kiwisolver==1.4.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- matplotlib==3.9.4
- mccabe==0.7.0
- mdit-py-plugins==0.4.2
- mdurl==0.1.2
- mypy==1.15.0
- mypy-extensions==1.0.0
- myst-parser==3.0.1
- netcdf4==1.7.2
- numpy==2.0.2
- pandas==2.2.3
- pep8-naming==0.10.0
- pillow==11.1.0
- platformdirs==4.3.7
- prospector==1.16.1
- pycodestyle==2.13.0
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygments==2.19.1
- pylint==3.3.6
- pylint-celery==0.3
- pylint-django==2.6.1
- pylint-plugin-utils==0.8.2
- pyparsing==3.2.3
- pyproject-api==1.9.0
- pyproject-hooks==1.2.0
- pyroma==4.2
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- requirements-detector==1.3.2
- s2spy==0.2.1
- scikit-learn==1.6.1
- scipy==1.13.1
- semver==3.0.4
- setoptconf-tmp==0.3.1
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-autoapi==3.6.0
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- stdlib-list==0.11.1
- threadpoolctl==3.6.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- tox==4.25.0
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- virtualenv==20.29.3
- xarray==2024.7.0
- zipp==3.21.0
prefix: /opt/conda/envs/s2spy
|
[
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_preview",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_preview_multiple_lags",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_preview_multiple_lags_fail",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_plot_ax",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_plot",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_preview_multiple_lags",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_preview_multiple_lags_fail",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_plot_ax"
] |
[] |
[
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr_nan",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_field_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dims",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_partial_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_regression",
"tests/test_rgdr/test_rgdr.py::TestDBSCAN::test_dbscan",
"tests/test_rgdr/test_rgdr.py::TestDBSCAN::test_dbscan_min_area",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_init",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform_before_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform_fits",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform_multiple_lags"
] |
[] |
Apache License 2.0
| null |
|
AI4S2S__s2spy-153
|
74a971101a64b7d0024cfdfd5ad9382c12752760
|
2023-01-03 13:28:03
|
74a971101a64b7d0024cfdfd5ad9382c12752760
|
sonarcloud[bot]: SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=AI4S2S_ai4s2s&pullRequest=153)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list) [77.0% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list)
review-notebook-app[bot]: Check out this pull request on <a href="https://app.reviewnb.com/AI4S2S/s2spy/pull/153"><img align="absmiddle" alt="ReviewNB" height="28" class="BotMessageButtonImage" src="https://raw.githubusercontent.com/ReviewNB/support/master/images/button_reviewnb.png"/></a>
See visual diffs & provide feedback on Jupyter Notebooks.
---
<i>Powered by <a href='https://www.reviewnb.com/?utm_source=gh'>ReviewNB</a></i>
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_ai4s2s&pullRequest=153)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list) [81.4% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list)
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_ai4s2s&pullRequest=153)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list) [81.4% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list)
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=AI4S2S_ai4s2s&pullRequest=153)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=AI4S2S_ai4s2s&pullRequest=153&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list) [96.5% Coverage](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=AI4S2S_ai4s2s&pullRequest=153&metric=new_duplicated_lines_density&view=list)
BSchilperoort: > I briefly looked over the code and examples, looks very good! The modified functionality makes sense to me.
>
> I was wondering whether the example illustration for multiple targets also has a source file (for easy adaptation later on). Also, in the example notebook, I think it would be helpful to have a similar explanatory figure for the single target interval.
Thanks for the review, Peter. Good point about adding the source file (and illustration for the single-target case). I have converted the ppt file to svg files, and added the single-target illustration.
|
diff --git a/notebooks/example_label_alignment_RGDR.ipynb b/notebooks/example_label_alignment_RGDR.ipynb
index b0c4fd4..efd6eaf 100644
--- a/notebooks/example_label_alignment_RGDR.ipynb
+++ b/notebooks/example_label_alignment_RGDR.ipynb
@@ -41,12 +41,11 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "As precursor we select the 'sst' DataArray, at `i_interval=-5` (5th interval before the anchor).\n",
- "\n",
- "The target is the (preclustered) 'st' DataArray, at the first target interval."
+ "As precursor we select the 'sst' DataArray. The target is the (preclustered) 'st' DataArray."
]
},
{
@@ -55,8 +54,8 @@
"metadata": {},
"outputs": [],
"source": [
- "precursor = field_resampled['sst'].sel(i_interval=-5)\n",
- "target = target_resampled['ts'].sel(i_interval=1)"
+ "precursor = field_resampled['sst']\n",
+ "target = target_resampled['ts']"
]
},
{
@@ -80,7 +79,7 @@
"shufflesplit = ShuffleSplit(n_splits=n_splits, test_size=0.25, random_state = seed)\n",
"cv = s2spy.traintest.TrainTestSplit(shufflesplit)\n",
"\n",
- "rgdrs = [RGDR(eps_km=800, alpha=0.10, min_area_km2=0) for _ in range(n_splits)]"
+ "rgdrs = [RGDR(target_intervals=1, lag=5, eps_km=800, alpha=0.10, min_area_km2=0) for _ in range(n_splits)]"
]
},
{
@@ -119,7 +118,7 @@
"outputs": [
{
"data": {
- "image/png": "iVBORw0KG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7xdD00/AJ4qaf9y/HXzLPcIsKxl/E7gOeXrV7dMXwO8AUDSM4FDy+lXU5xCfFo5bxdJv1VlhyImWPIctUgF30wXUfSCdCPwf4F3uOjScE62fwO8BbhM0lqK4P9yjkVXA38p6XpJBwIfBk6RdD3FtcEZnwCWSrqN4nrc2vJ9fga8GbigPM13FfD0fnY0YgIkz1GL9CY3JiQttf1o2Qr348Dttj9ad7kionvJcwxCjuDHx5+XjXRuBZ5A0Qo3IkZT8hx9yxF8RETEGMoRfERExBhKBR8RETGGUsFHRESMoVTwERERYygVfERExBj6/3SKbW2ZzBkwAAAAAElFTkSuQmCC",
"text/plain": [
"<Figure size 576x288 with 8 Axes>"
]
@@ -183,10 +182,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "['i_interval:-5_cluster:-1']\n",
- "['i_interval:-5_cluster:-1' 'i_interval:-5_cluster:1']\n",
- "['i_interval:-5_cluster:-1']\n",
- "['i_interval:-5_cluster:-1' 'i_interval:-5_cluster:-2']\n"
+ "[-1]\n",
+ "[-1 1]\n",
+ "[-1]\n",
+ "[-2 -1]\n"
]
}
],
@@ -216,7 +215,7 @@
"['A']\n",
"['A' 'C']\n",
"['A']\n",
- "['B' 'A']\n"
+ "['A' 'B']\n"
]
}
],
@@ -241,7 +240,7 @@
"outputs": [
{
"data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfgAAAEWCAYAAACKZoWNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAABC40lEQVR4nO3debgcVZ3/8ffnZicLCUkIIQQSFkGWyBLZZBEEIaiADgqIAi7DiKM/0FFkcRRngBE3EHWEKArKEgFFEASEMYCyZ4FAiKzZE4EAIQtku/f7+6POvanc20v1WtXd39fz1HO7a+k+1X0/fbqrTp0jM8M555xzzaUt7QI455xzrvq8gnfOOeeakFfwzjn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2XMuvwGMkxre5xl5XM8/l0HR4mPVs676Gv9djiNYvYdNZt4T6LZhyc5WKti/NcrM9joINvVWtmZtaCWmkXvZmZmaXcwJuZmbUgN/BmZmYtyA28mZlZC3IDb2Zm1oLcwBeIpJfqsMzTJV2YPj5T0gFVLON2SZNrXZtZK3OeLW9u4FtcRNwUEV9Pn55J0vuTmTUh59kq4Qa+gNK7KX1D0oOSHpD0rnT8G9Jf379Q0jfzNekdm5B0WjputpJ+jX+bjv+ApO9JOgY4HfiGkn629y79JS9pTHr7RiRtJ2mapAWSbgC2K6ntTZLukjRH0vXpvZ7NrA/Os+WllXqTayVvB14LvAYYA9wraWY67RDgQJLbed4JvE7SLOBy4LiIWCjp2i0XGBF/kXQT8NuI+AWANu9NqdR5wMsR8Q+SJgFz0tePAb4AnBQRayR9Fvgk8B81WGezVuU8Wy7cwBfTscC1EdFJ0lnFHcDhwIvAPRGxDEDSfcCewEvAE5H0xwzJ7T/PHcD7HwdcChAR8yTNS8cfRbJL8M70y2Qb4K4BvI9ZO3CeLRdu4JvPupLHnQzsM9zIpsM022Z4vYDpEXH2AN7TzDZxnq1ufAy+mP4EvEvSIEljSX6Bl+uh6WFgL0l7ps/f1cfrVgMjSp4vAg5LH59VMn4m8B4ASQcBk9Lxd5PsQtwnnTZM0quzrJBZG3OeLRdu4IvpBpJekO4H/hf4TCRdGvYqIl4BPgrcKmk2SfBf6OWl04BPS5oraW/gm8B5kuaSHBvs9gNguKQFJMfjZqfv8wzwAeDadDffXcD+A1lRszbgPFsu3Jtci5A0PCJeSs/C/T7waER8O++6zKxyzrPVgrfgW8e/pCfpzAe2JzkL18yak/NsA+YteDMzsxbkLXgzM7MW5AbezMysBbmBNzMza0Fu4M3MzFqQG3gzM7MW9P8DZjr7z6RODxIAAAAASUVORK5CYII=",
"text/plain": [
"<Figure size 576x288 with 8 Axes>"
]
diff --git a/notebooks/multiple_targets_rgdr.svg b/notebooks/multiple_targets_rgdr.svg
new file mode 100644
index 0000000..584321c
--- /dev/null
+++ b/notebooks/multiple_targets_rgdr.svg
@@ -0,0 +1,710 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ width="778.995"
+ height="318.71094"
+ overflow="hidden"
+ version="1.1"
+ id="svg1025"
+ sodipodi:docname="multiple_targets_rgdr.svg"
+ inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview1027"
+ pagecolor="#ffffff"
+ bordercolor="#000000"
+ borderopacity="0.25"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="1.890625"
+ inkscape:cx="428.42975"
+ inkscape:cy="142.28099"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ inkscape:window-x="1552"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg1025" />
+ <defs
+ id="defs839">
+ <clipPath
+ id="clip0">
+ <rect
+ x="0"
+ y="0"
+ width="1280"
+ height="720"
+ id="rect836" />
+ </clipPath>
+ </defs>
+ <g
+ clip-path="url(#clip0)"
+ id="g1023"
+ transform="translate(-108.83834,-380.6875)">
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(284.324,422)"
+ id="text843">If</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="700"
+ font-size="24px"
+ transform="translate(303.158,422)"
+ id="text845">lag</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(337.658,422)"
+ id="text847">= 2:</text>
+ <path
+ d="m 294.5,445.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 238.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 H 299.167 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path849" />
+ <path
+ d="m 502.5,448.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path851" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ transform="translate(515.061,459)"
+ id="text853">2</text>
+ <path
+ d="m 301.5,448.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path855" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(311.732,459)"
+ id="text857">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(317.399,459)"
+ id="text859">4</text>
+ <path
+ d="m 341.5,448.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path861" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(351.998,459)"
+ id="text863">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(357.665,459)"
+ id="text865">3</text>
+ <path
+ d="m 382.5,448.5 c 0,-1.657 1.343,-3 3,-3 h 26 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -26 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path867" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(392.264,459)"
+ id="text869">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(397.93,459)"
+ id="text871">2</text>
+ <path
+ d="m 422.5,448.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path873" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(432.53,459)"
+ id="text875">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(438.196,459)"
+ id="text877">1</text>
+ <path
+ d="m 462.5,448.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path879" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ transform="translate(474.795,459)"
+ id="text881">1</text>
+ <path
+ d="m 373.5,480.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 82.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -82.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path883" />
+ <path
+ d="m 423.5,484.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path885" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ transform="translate(436.225,495)"
+ id="text887">2</text>
+ <path
+ d="m 383.5,483.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path889" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ transform="translate(395.959,494)"
+ id="text891">1</text>
+ <rect
+ x="377.5"
+ y="431.5"
+ width="83"
+ height="82"
+ stroke="#000000"
+ stroke-width="1.33333"
+ stroke-linecap="square"
+ stroke-miterlimit="8"
+ stroke-dasharray="4, 1.33333"
+ fill="none"
+ id="rect893" />
+ <path
+ d="M 0,-0.333333 H 75.8406 L 75.8922,42.9539 75.2255,42.9547 75.1743,3.97073e-4 75.5077,0.333333 H 0 Z m 79.5047,41.801733 -3.69,8.1477 -4.3041,-7.8406 z"
+ transform="matrix(0,1,1,0,419.5,513.5)"
+ id="path895" />
+ <path
+ d="m 521.5,565.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 78.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -78.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path897" />
+ <path
+ d="m 521.5,601.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 78.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -78.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path899" />
+ <path
+ d="m 568.5,604.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path901" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(580.584,615)"
+ id="text903">2</text>
+ <path
+ d="m 528.5,604.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path905" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(540.318,615)"
+ id="text907">1</text>
+ <path
+ d="m 612.5,565.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 78.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -78.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path909" />
+ <path
+ d="m 612.5,601.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 78.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -78.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path911" />
+ <path
+ d="m 659.5,604.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path913" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(671.837,615)"
+ id="text915">0</text>
+ <path
+ d="m 619.5,604.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path917" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(631.571,615)"
+ id="text919">1</text>
+ <path
+ d="m 703.5,565.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 78.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -78.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path921" />
+ <path
+ d="m 703.5,601.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 78.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -78.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path923" />
+ <path
+ d="m 751.5,604.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path925" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(763.09,615)"
+ id="text927">0</text>
+ <path
+ d="m 710.5,604.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path929" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(722.824,615)"
+ id="text931">1</text>
+ <path
+ d="m 795.5,565.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 78.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -78.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path933" />
+ <path
+ d="m 795.5,601.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 78.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -78.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path935" />
+ <path
+ d="m 842.5,604.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path937" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(854.417,615)"
+ id="text939">0</text>
+ <path
+ d="m 802.5,604.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path941" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(814.151,615)"
+ id="text943">1</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(483.714,582)"
+ id="text945">X =</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(483.714,616)"
+ id="text947">Y =</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(495.954,667)"
+ id="text949">Calculate: pearsonr(X, Y)</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(495.954,696)"
+ id="text951">i.e.,</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(536.954,696)"
+ id="text953">flatten the intervals</text>
+ <rect
+ x="515.5"
+ y="557.5"
+ width="372"
+ height="35"
+ stroke="#2f528f"
+ stroke-width="0.666667"
+ stroke-linecap="square"
+ stroke-miterlimit="8"
+ stroke-dasharray="2, 0.666667"
+ fill="none"
+ id="rect955" />
+ <rect
+ x="515.5"
+ y="593.5"
+ width="372"
+ height="35"
+ stroke="#2f528f"
+ stroke-width="0.666667"
+ stroke-linecap="square"
+ stroke-miterlimit="8"
+ stroke-dasharray="2, 0.666667"
+ fill="none"
+ id="rect957" />
+ <path
+ d="m 529.5,569.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path959" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(539.54,579)"
+ id="text961">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(545.206,579)"
+ id="text963">2</text>
+ <path
+ d="m 569.5,569.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.565 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.268 -2.833,-2.833 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path965" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(579.805,579)"
+ id="text967">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(585.472,579)"
+ id="text969">1</text>
+ <path
+ d="m 619.5,569.5 c 0,-1.657 1.343,-3 3,-3 h 26 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -26 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path971" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(629.319,580)"
+ id="text973">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(634.985,580)"
+ id="text975">2</text>
+ <path
+ d="m 659.5,569.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path977" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(669.584,580)"
+ id="text979">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(675.251,580)"
+ id="text981">1</text>
+ <path
+ d="m 710.5,569.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path983" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(720.863,579)"
+ id="text985">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(726.53,579)"
+ id="text987">2</text>
+ <path
+ d="m 750.5,569.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path989" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(761.129,579)"
+ id="text991">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(766.796,579)"
+ id="text993">1</text>
+ <path
+ d="m 800.5,569.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path995" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(810.642,580)"
+ id="text997">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(816.309,580)"
+ id="text999">2</text>
+ <path
+ d="m 840.5,569.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path1001" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(850.908,580)"
+ id="text1003">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(856.575,580)"
+ id="text1005">1</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(141.205,459)"
+ id="text1007">Precursor field</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(161.1,496)"
+ id="text1009">Target data</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(444.233,546)"
+ id="text1011">anchor year</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(554.198,547)"
+ id="text1013">2016</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(644.85,547)"
+ id="text1015">2017</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(734.95,547)"
+ id="text1017">2018</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(824.435,547)"
+ id="text1019">2019</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="700"
+ font-size="24px"
+ transform="translate(107.186,397)"
+ id="text1021">Multiple targets</text>
+ </g>
+</svg>
diff --git a/notebooks/single_target_RGDR.svg b/notebooks/single_target_RGDR.svg
new file mode 100644
index 0000000..11a921a
--- /dev/null
+++ b/notebooks/single_target_RGDR.svg
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ width="681.32947"
+ height="287.94186"
+ overflow="hidden"
+ version="1.1"
+ id="svg299"
+ sodipodi:docname="single_interval_illustration.svg"
+ inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview301"
+ pagecolor="#ffffff"
+ bordercolor="#000000"
+ borderopacity="0.25"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="1.598847"
+ inkscape:cx="368.39047"
+ inkscape:cy="78.80679"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ inkscape:window-x="1552"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g297" />
+ <defs
+ id="defs159">
+ <clipPath
+ id="clip0">
+ <rect
+ x="0"
+ y="0"
+ width="1280"
+ height="720"
+ id="rect156" />
+ </clipPath>
+ </defs>
+ <g
+ clip-path="url(#clip0)"
+ id="g297"
+ transform="translate(-23.855587,-35.323769)">
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(250.975,74)"
+ id="text163">If</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="700"
+ font-size="24px"
+ transform="translate(269.808,74)"
+ id="text165">lag</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(304.308,74)"
+ id="text167">= 2:</text>
+ <path
+ d="m 261.5,97.1669 c 0,-2.5774 2.089,-4.6668 4.667,-4.6668 h 238.666 c 2.578,0 4.667,2.0894 4.667,4.6668 v 18.6661 c 0,2.578 -2.089,4.667 -4.667,4.667 H 266.167 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path169" />
+ <path
+ d="m 469.5,100.5 c 0,-1.6568 1.343,-2.9999 3,-2.9999 h 27 c 1.657,0 3,1.3431 3,2.9999 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path171" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ transform="translate(481.711,111)"
+ id="text173">2</text>
+ <path
+ d="m 268.5,100.5 c 0,-1.6568 1.343,-2.9999 3,-2.9999 h 26 c 1.657,0 3,1.3431 3,2.9999 v 12 c 0,1.657 -1.343,3 -3,3 h -26 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path175" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(278.383,110)"
+ id="text177">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(284.049,110)"
+ id="text179">4</text>
+ <path
+ d="m 308.5,100.5 c 0,-1.6568 1.343,-2.9999 3,-2.9999 h 27 c 1.657,0 3,1.3431 3,2.9999 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path181" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(318.648,110)"
+ id="text183">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(324.315,110)"
+ id="text185">3</text>
+ <path
+ d="m 348.5,100.5 c 0,-1.6568 1.343,-2.9999 3,-2.9999 h 27 c 1.657,0 3,1.3431 3,2.9999 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path187" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(358.914,110)"
+ id="text189">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(364.581,110)"
+ id="text191">2</text>
+ <path
+ d="m 388.5,100.5 c 0,-1.6568 1.343,-2.9999 3,-2.9999 h 27 c 1.657,0 3,1.3431 3,2.9999 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path193" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(399.18,110)"
+ id="text195">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(404.847,110)"
+ id="text197">1</text>
+ <path
+ d="m 429.5,100.333 c 0,-1.5644 1.269,-2.8329 2.833,-2.8329 h 27.334 c 1.565,0 2.833,1.2685 2.833,2.8329 v 11.334 c 0,1.564 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.269 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path199" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ transform="translate(441.446,110)"
+ id="text201">1</text>
+ <path
+ d="m 384.57083,131.31307 c 0,-2.67451 1.97016,-4.84298 4.40006,-4.84298 h 32.16879 c 2.4299,0 4.40006,2.16847 4.40006,4.84298 v 19.37386 c 0,2.67451 -1.97016,4.84298 -4.40006,4.84298 h -32.16879 c -2.4299,0 -4.40006,-2.16847 -4.40006,-4.84298 z"
+ stroke="#787878"
+ stroke-width="1.27352"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path203" />
+ <path
+ d="m 388.83661,134.5 c 0,-1.657 1.343,-3 3,-3 h 26 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -26 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path205" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="13px"
+ id="text207"
+ x="401.38101"
+ y="145">2</text>
+ <rect
+ x="382.5"
+ y="83.500099"
+ width="45"
+ height="82"
+ stroke="#000000"
+ stroke-width="1.33333"
+ stroke-linecap="square"
+ stroke-miterlimit="8"
+ stroke-dasharray="4, 1.33333"
+ fill="none"
+ id="rect209" />
+ <path
+ d="M 0,-0.333333 H 76.6417 L 76.5586,29.2226 75.8919,29.2208 75.9741,-9.36961e-4 76.3074,0.333333 H 0 Z M 80.2998,28.1373 75.8146,35.8757 72.315,27.6445 Z"
+ transform="matrix(0,1,1,0,405.5,165.5)"
+ id="path211" />
+ <path
+ d="m 493.5,217.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 36.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -36.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path213" />
+ <path
+ d="m 493.5,252.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 36.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -36.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path215" />
+ <path
+ d="m 498.5,256.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.564 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.269 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path217" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(510.735,267)"
+ id="text219">2</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ id="text221"
+ x="407.93799"
+ y="204">anchor year</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(455.965,234)"
+ id="text223">X =</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(455.965,268)"
+ id="text225">Y =</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(468.205,319)"
+ id="text227">Calculate: pearsonr(X, Y</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(699.478,319)"
+ id="text229">)</text>
+ <rect
+ x="487.5"
+ y="209.5"
+ width="211"
+ height="35"
+ stroke="#2f528f"
+ stroke-width="0.666667"
+ stroke-linecap="square"
+ stroke-miterlimit="8"
+ stroke-dasharray="2, 0.666667"
+ fill="none"
+ id="rect231" />
+ <rect
+ x="487.5"
+ y="245.5"
+ width="211"
+ height="34"
+ stroke="#2f528f"
+ stroke-width="0.666667"
+ stroke-linecap="square"
+ stroke-miterlimit="8"
+ stroke-dasharray="2, 0.666667"
+ fill="none"
+ id="rect233" />
+ <path
+ d="m 498.5,220.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path235" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(509.068,231)"
+ id="text237">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(514.735,231)"
+ id="text239">1</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(107.855,111)"
+ id="text241">Precursor field</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="24px"
+ transform="translate(127.751,148)"
+ id="text243">Target data</text>
+ <path
+ d="m 544.5,217.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 35.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -35.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path245" />
+ <path
+ d="m 544.5,252.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 35.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -35.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path247" />
+ <path
+ d="m 549.5,256.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.564 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.269 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path249" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(561.264,267)"
+ id="text251">2</text>
+ <path
+ d="m 549.5,220.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path253" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(559.597,231)"
+ id="text255">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(565.264,231)"
+ id="text257">1</text>
+ <path
+ d="m 595.5,217.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 36.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -36.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path259" />
+ <path
+ d="m 595.5,252.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 36.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -36.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path261" />
+ <path
+ d="m 600.5,256.333 c 0,-1.564 1.269,-2.833 2.833,-2.833 h 27.334 c 1.565,0 2.833,1.269 2.833,2.833 v 11.334 c 0,1.564 -1.268,2.833 -2.833,2.833 h -27.334 c -1.564,0 -2.833,-1.269 -2.833,-2.833 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path263" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(612.724,267)"
+ id="text265">2</text>
+ <path
+ d="m 600.5,220.5 c 0,-1.657 1.343,-3 3,-3 h 27 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -27 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path267" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(611.057,231)"
+ id="text269">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(616.724,231)"
+ id="text271">1</text>
+ <path
+ d="m 646.5,217.167 c 0,-2.578 2.089,-4.667 4.667,-4.667 h 36.666 c 2.578,0 4.667,2.089 4.667,4.667 v 18.666 c 0,2.578 -2.089,4.667 -4.667,4.667 h -36.666 c -2.578,0 -4.667,-2.089 -4.667,-4.667 z"
+ stroke="#2f528f"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#4472c4"
+ fill-rule="evenodd"
+ id="path273" />
+ <path
+ d="m 646.5,252.333 c 0,-2.669 2.164,-4.833 4.833,-4.833 h 36.334 c 2.669,0 4.833,2.164 4.833,4.833 v 19.334 c 0,2.669 -2.164,4.833 -4.833,4.833 h -36.334 c -2.669,0 -4.833,-2.164 -4.833,-4.833 z"
+ stroke="#787878"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#a5a5a5"
+ fill-rule="evenodd"
+ id="path275" />
+ <path
+ d="m 652.5,255.5 c 0,-1.657 1.343,-3 3,-3 h 26 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -26 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#507e32"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#70ad47"
+ fill-rule="evenodd"
+ id="path277" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="15px"
+ transform="translate(663.923,266)"
+ id="text279">2</text>
+ <path
+ d="m 652.5,220.5 c 0,-1.657 1.343,-3 3,-3 h 26 c 1.657,0 3,1.343 3,3 v 12 c 0,1.657 -1.343,3 -3,3 h -26 c -1.657,0 -3,-1.343 -3,-3 z"
+ stroke="#bc8c00"
+ stroke-width="1.33333"
+ stroke-miterlimit="8"
+ fill="#ffc000"
+ fill-rule="evenodd"
+ id="path281" />
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(662.256,230)"
+ id="text283">-</text>
+ <text
+ fill="#ffffff"
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="14px"
+ transform="translate(667.923,230)"
+ id="text285">1</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(504.553,204)"
+ id="text287">2016</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(555.206,204)"
+ id="text289">2017</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(607.304,204)"
+ id="text291">2018</text>
+ <text
+ font-family="Consolas, Consolas_MSFontService, sans-serif"
+ font-weight="400"
+ font-size="12px"
+ transform="translate(657.289,204)"
+ id="text293">2019</text>
+ <text
+ font-family="Calibri, Calibri_MSFontService, sans-serif"
+ font-weight="700"
+ font-size="24px"
+ id="text295"
+ x="23.117306"
+ y="51.636269">Single target</text>
+ </g>
+</svg>
diff --git a/notebooks/tutorial_RGDR.ipynb b/notebooks/tutorial_RGDR.ipynb
index d5e54cd..b57122d 100644
--- a/notebooks/tutorial_RGDR.ipynb
+++ b/notebooks/tutorial_RGDR.ipynb
@@ -10,7 +10,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -22,15 +22,16 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "First we will load in some example data, and resample them using the `AdventCalendar`."
+ "First we will load in some example data, and resample them using `s2spy`'s `Calendar`."
]
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -48,22 +49,27 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAg0AAAEWCAYAAADl4aRRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAuYUlEQVR4nO3deXhV1bnH8e+bMAkJkwQQUCFKSAJClAhqnYcCtw4UtI6gtSJXqxZnrVVRe1Fvi23R3qo4ovZqUWod6oBa9dpalCEiEBAMooVEZhJGE/LeP/Y+9BAy7JCcJMDv8zznyT57r73Wu/ZBz3vWHpa5OyIiIiI1SWrsAERERGTPoKRBREREIlHSICIiIpEoaRAREZFIlDSIiIhIJEoaREREJBIlDZIQZuZmdmgC6r3EzD6q73oTrbrjYWZvmNnF9dROz7CtZlVs/7mZPVYfbSVabWI1s6fM7JeJjklkX6ekQapkZheY2Uwz22hmheGX27GNHdfext2HufvTu7OvmX1lZqfWoq0J7n5Zotsxs/Fm9mxt24m3u7GKSOIoaZBKmdl1wG+BCUAX4CDgf4CzGjGsOqnq17c0PfqsRJomJQ2yCzNrB9wN/NTdp7n7JncvdfdX3f3GsMwgM/vYzNaHoxAPmVmLKupraWa/NrOvzexbM3vYzPYLt51oZv8ys+vNbGVY14/j9t3fzF4xs2Iz+wQ4pELdvzOzb8Lts8zsuLht483sRTN71syKgUsqie19M7ss7v2O0x8W+E0YV7GZfW5m/WrqU7j9xrAvK8zs0hqO944YYu2Hda8zs6VmNqyK/Z4hSOZeDUeDborbfGEY22ozu63CMXk2XG4VHps14ef4qZl1idJO7HOrUO4rMzvVzIYCPwfODct/Fm7vFn6Wa81siZmNqRDXTp9VxdEKM5tqZkVmtsHMPjSzvtUdVxGpf0oapDJHA62AP1dTZjtwLdApLH8Kc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igpKUn66quvmo8fP777rFmz8tPS0sqOO+64jGeeeab9qFGj1m/ZsiVp8ODBmyZPnlzjg6Q6depUtmDBgvz77rsv7b777uvywgsvLBs9evSqlJSU7bEnQ55xxhm9rrvuum+HDBmycfHixS2GDBnSu6CgYD7A4sWLW82YMWNhSkqK33XXXZ2fe+65jrm5uSuWLVvWfOXKlc2PP/74zWvXrk369NNPFzZv3pyXX3459aabburx1ltvfbm7n0HU0xNJwOqwfIaZZbj7h7vbqIiISFTbtm1LyszMzAYYPHhwyc9+9rPV77zzTkr//v03ZWZmfgfwzjvvtF24cGHrV155pQNASUlJ8oIFC1pNnz697UUXXbQ6NqNkly5dttfU3nHHHVccK3fUUUdtGjt2bM/S0tKks88+e90xxxyz5fXXX2971FFHlXTr1q0M4Nxzz137wQcfpIwaNWp9cnIyl1xyybrqWwhccMEF6wAGDRq0ORZ3RX//+9/bLl68eL/Y+40bNybHJsQaOnTo+pSUFIdgmu3TTjst4ze/+c2KKVOmdDjjjDPWAaxduzb53HPP7fXVV1+1MjMvLS3dZTbO2qgxaTCz+4FzgflAbBpPB5Q0iIhIwsVf0xCvdevWO6aWdnebOHHi1yNHjtzp1v433nijbWV1NmvWzLdvD/KHzZs37/RFGl/vsGHDNn744YeLXnrppXaXXnppr6uuuurb9u3bV5l4tGjRojz+OobqtGrVymOxVDa1dtgvZs+end+6detdHk/Qpk2bHXH26tWrtH379mUzZszYb9q0aR0ffvjhZQA333xz9xNOOKFk+vTpXy5atKjFySef3CdScFWIck3DcKCPu//A3c8IX2fWpVEREZH6dNppp234wx/+kLZt2zYDmDt3bsvi4uKkIUOGFD/77LOdYndcxE5PHHjggds++eSTNgDPPfdclVNOf/HFFy169OhRev31168ePXr0qtmzZ7c+7rjjNs2YMSO1sLCwWVlZGVOnTu144oknbqyPfqSmpm4vKSnZcQrl2GOPLb733ns7x97/4x//2K/yPWHkyJFrJ0yY0LWkpCR58ODBWwCKi4uTe/To8R3AI4880qmqfaOKkjQUAA1zWaaIiMhu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/z2PyICn3P3WWIXNrDnBCFK+u39pZuOB5lFFIs+Q2kt8fxf2t/yOOMp8LY54vy4KLHL34/anfhGRymhOkTRa4cjPQwSnq5zg1Ngady8HRhKMOkQ8CYwBcPfCcP9MYLm7TyJ4Yne/Sg6Twr+f7H0h8KG7FwMrzOzcsB4zs/6V7PsRcJKZdQjnCF0AzKik3HvAORZMHI/M7eleoUwkodgYjlRVeYVXaBpwpZk1idRbTfn/Ay4Ky54MbAzbWpWZwHnh/KUuwClxxFsCtAqXlwDpZnZceNymZtanuoaJiFRGI0XS2BxsZgUEp8rKCOaq3Bdu+z3wkpmNAt4ianTD3deZWRHBqauIHwIjzawUWAtMqOR4O4CBZvZzgtGo88L1FwF/CNc3JXj69/zoHd19jZmNBT4gGBF5w91fqXgAdy8M63nHgtsLlAI/IXhqeqTMVjObTHDV1lrg46o6KfQowSnEBWEbJwMPVlF+PPC4mS0AdgKXxHGMvxDMPyokmD/1jzjifRJ4yMx2AccRJEyTzKwNwd+0+wlOtYmI7BcL/oMsIlUxsxbAJ8DR7r4t2fGIiEjN0+kzkWqY2feAIuABJUQiIg2XRopERERE0EiRiIiICKCkSERERARQUiQiIiICKCkSERERAZQUiYiIiADw/2o7xLDkA7+rAAAAAElFTkSuQmCC",
"text/plain": [
- "<Figure size 700x400 with 1 Axes>"
+ "<Figure size 504x288 with 1 Axes>"
]
},
- "metadata": {},
+ "metadata": {
+ "needs_background": "light"
+ },
"output_type": "display_data"
}
],
"source": [
- "cal = s2spy.time.AdventCalendar(\"8-2\", freq=\"30d\")\n",
+ "cal = s2spy.time.Calendar(anchor=\"08-01\")\n",
+ "cal.add_intervals(\"target\", length=\"1W\", n=4)\n",
+ "cal.add_intervals(\"precursor\", length=\"1W\", n=4)\n",
+ "\n",
"cal = cal.map_to_data(field)\n",
"cal.visualize(n_years=3, relative_dates=True)\n",
"_ = plt.title(\"Calendar used in this tutorial\")"
@@ -78,72 +84,97 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
- "field_resampled = s2spy.time.resample(cal, field)\n",
- "target_resampled = s2spy.time.resample(cal, target)"
+ "field_resampled: xr.Dataset = s2spy.time.resample(cal, field)\n",
+ "target_resampled: xr.Dataset = s2spy.time.resample(cal, target)"
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "### The target timeseries comes from already pre-clustered land surface temperature data."
+ "### The target timeseries comes from already pre-clustered land surface temperature data.\n",
+ "RGDR requires `DataArray`s as input, as otherwise it is ambiguous which variable should be used.\n",
+ "\n",
+ "When initializing RGDR, the target interval(s) and lag have to be specified as well.\n",
+ "The precursor interval(s) will be determined from the target intervals and lag.\n",
+ "The maximum possible lag will depend on the number of available precursor intervals.\n",
+ "\n",
+ "In the illustration you see the algorithm that is used to calculate the correlation in RGDR, when you specify a single target interval:\n",
+ "\n",
+ "\n",
+ "\n",
+ "Below we use the first target interval, and a lag of `4`. This makes the precursor interval index `-4`. An example with multiple targets follows later."
]
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": 5,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[-4]"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "target_timeseries = target_resampled.sel(cluster=3).ts.sel(i_interval=1)\n",
- "precursor_field = field_resampled.sst.sel(i_interval=slice(-4,-1)) # Multiple i_intervals: -1 through -4\n",
+ "target_timeseries = target_resampled.sel(cluster=3)[\"ts\"]\n",
+ "precursor_field = field_resampled[\"sst\"]\n",
"\n",
- "rgdr = RGDR(eps_km=600, alpha=0.10, min_area_km2=0)"
+ "target_intervals = 1\n",
+ "lag = 4\n",
+ "rgdr = RGDR(\n",
+ " target_intervals=target_intervals,\n",
+ " lag=lag,\n",
+ " eps_km=600,\n",
+ " alpha=0.05,\n",
+ " min_area_km2=0\n",
+ ")\n",
+ "rgdr.precursor_intervals"
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "Using `.preview_correlation` we can visualize the correlation and p-value map of the target timeseries and precursor field, for a single i_interval.\n",
+ "Using `.preview_correlation` we can visualize the correlation and p-value map of the target timeseries and precursor field.\n",
"\n",
- "In this case we use i_interval `-1`."
+ "The red hashing shows where p-value `<` alpha"
]
},
{
"cell_type": "code",
- "execution_count": 29,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAArwAAACqCAYAAABPqpzsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAA70UlEQVR4nO3deZxcVZ3//9e7qreE7GlCyMKiBhAR2Yal9TsqoqJfBWZYBJeBEYmAOCiOCqOjgvId1JnB3RCUERWBkIw/I+IgIshoCJuyLxJZFEjSpLOQkKWX+vz+uLeSW5VablXd6lr683w8zoOqW/ee+nTTOf3pU+eej8wM55xzzjnn2lWq0QE455xzzjlXT57wOuecc865tuYJr3POOeeca2ue8DrnnHPOubbmCa9zzjnnnGtrnvA655xzzrm25gmvazhJb5L0XA3XL5D0r0nG5JxzrjKSfiDpS42Ow7lCOhodgHOVkHQG8CEze0P2mJmd3biInHPOOdfsfIbXJUrSTn9EFTrmnHPOOTdaPOF1OSTNlfTfkl6UNCDpW5JSkj4r6VlJ/ZJ+KGlyeP5ekkzSmZL+AvxG0hmSfi/pckkDwBckdUv6d0l/kbQ6XIYwrkgMF0r6s6SNkh6V9Hfh8VcDC4CjJG2StD48nvMxmqSzJK2QtFbSUkmzIq+ZpLMlPSlpvaRvS1LdvqHOOdcEJD0j6aJwTF0n6b8k9RQ47zFJ74o87wh/HxwSPr9B0ipJGyTdIek1Rd7vDEm/yztmkl4VPo79O8G5JHjC67aTlAZuBJ4F9gJmA9cBZ4TtzcArgAnAt/Iuf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AxMjzZ4BDw8cnRY7fAbwXQNIBwIHh8eUEH8e9KnxtF0n7xPmCnHOujfmY7cY0T3hdtX4KPAg8APwG+JSZrSp2spltAc4F/kfSfQSD5IYCp14HfFLSHyW9Evh34BxJfyRYd5b1XWCCpMcI1nrdF77Pi8AZwLXhR2Z3AvvV8oU651wb8DHbjWkys0bH4MYISRPMbFN4B/C3gSfN7PJGx+Wcc25nPma7duIzvG40nRXeEPEIMJngDmDnnHPNycds1zZ8htc555xzzrU1n+F1zjnnnHNtzRNe55xzzjnX1jzhdc4555xzbc0TXuecc84519Y84XXOOeecc23NE17nnHPOOdfW/n+0HW38+5qNVQAAAABJRU5ErkJggg==",
"text/plain": [
- "[<matplotlib.collections.QuadMesh at 0x1429e2cd3f0>,\n",
- " <matplotlib.collections.QuadMesh at 0x1429e347d90>]"
+ "<Figure size 864x144 with 4 Axes>"
]
},
- "execution_count": 29,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAArwAAACqCAYAAABPqpzsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAnM0lEQVR4nO3de5gdVZnv8e+vOwkhIQExGEISCEJAAblG1EEFATUwmuCMF1DPEEUz4jBHYURgcDwKMoPiiHrkGY0MCopclTGDIDdBjgy3BAKGhEuAAIGQEAKYKCTp7vf8UdWwu7Nvvbuqd+3dv8/z1JOq6rVXvb1p3r32qlVrKSIwMzMzM2tXHc0OwMzMzMwsT27wmpmZmVlbc4PXzMzMzNqaG7xmZmZm1tbc4DUzMzOztuYGr5mZmZm1NTd4rekkHSJpxSBe/0NJ/5JlTGZmNjCSfirpG82Ow6ycEc0OwGwgJM0BPhMR7+w9FxGfa15EZmZmVnTu4bVMSdrsS1S5c2ZmZmZDxQ1e60PSVEm/kvScpOcl/UBS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Eec2Oy4zM9ucc7a1E/fw2lD6bPpAxAPA1iRPAJuZWTE5Z1vbcA+vmZmZmbU19/CamZmZWVtzg9fMzMzM2pobvGZmZmbW1tzgNTMzM7O25gavmZmZmbU1N3jNzMzMrK39f+qLTKkPu+CbAAAAAElFTkSuQmCC",
- "text/plain": [
- "<Figure size 1200x200 with 4 Axes>"
- ]
+ "metadata": {
+ "needs_background": "light"
},
- "metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
- "rgdr.preview_correlation(precursor_field, target_timeseries, i_interval=-1, ax1=ax1, ax2=ax2)"
+ "_ = rgdr.preview_correlation(precursor_field, target_timeseries, ax1=ax1, ax2=ax2)\n",
+ "rgdr.fit(precursor_field, target_timeseries)"
]
},
{
@@ -157,56 +188,76 @@
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "<matplotlib.collections.QuadMesh at 0x142b3f82ef0>"
+ "<matplotlib.collections.QuadMesh at 0x2602845d6c0>"
]
},
- "execution_count": 30,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAsoAAACqCAYAAAC0/WkzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAjyUlEQVR4nO3deZQdZb3u8e+TEAZDAoEgMgfBCRABI8QjKKIiogJ6RERUHHOc1gEVBMSlqOAVJxD1qjmioiIoIBcOyhCPIMMhDIEwJaBAghAmQUaVTP27f9TbUN3s7t7dvWvXsJ/PWrW6qnbVrt+u7Dz9dtVbVYoIzMzMzMxsoAllF2BmZmZmVkVuKJuZmZmZteCGspmZmZlZC24om5mZmZm14IaymZmZmVkLbiibmZmZmbXghvIoSLpF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HfUTE2EpnR8zNJnUHiNZ6ObA38DRgMXCxpPPK7+0DPIXiNrQ/Aw6QdAnwFeDPbK+UdMKGb2j7/0o6AzjT9ikAZV/381bgj7afLGkv4LLy9Yspbi/7XNt/kPQ+4F3Ax4bwM0dEtFU6O2IOMlCOuXomcILtdcCvJf0YeAZwD3CR7ZsBJK0AdgXuA260vbJc/gRg6TzW/2fAsQC2r5R0ZTl/f4rdgD8rC3sz4Px5rCciogvS2RFzkIFyVOGBnsfrmN/v2VoeOkRoiwFeL2C57dfMY50REeMknR0xhRyjHHP1E+BVkhZK2p5ia8FF07z+58DjJO1aPn/VFK+7F9i65/kq4Onl41f0zD8P+EsASU8F9irnX0Cx23CP8ntbSnrCID9QRESHpbMj5iAD5Zir04ArgSuAfwfea/v2qV5s+z+BtwFnS7qUolx/3+elJwLvkXS5pN2BzwBvlXQ5xXF1E74EbCXpOopj2S4t1/Mb4PXACeWuvfOBJ83nB42I6IB0dsQcyHbdGWJMSNrK9n3lGdVfBH5h+5i6c0VExMbS2RHZohyj9abyRJFrgEdQnFEdERHNlM6OsZctyhERERERfWSLckREREREHxkoR0RERET0kYFyREREREQfGShHRERERPSRgXJERERERB8ZKEdERERE9PH/AY+uZwHuJkYLAAAAAElFTkSuQmCC",
"text/plain": [
- "<Figure size 1200x200 with 4 Axes>"
+ "<Figure size 864x144 with 4 Axes>"
]
},
- "metadata": {},
+ "metadata": {
+ "needs_background": "light"
+ },
"output_type": "display_data"
}
],
"source": [
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
"\n",
- "RGDR(eps_km=600, alpha=0.10, min_area_km2=500**2).preview_clusters(\n",
- " precursor_field,\n",
- " target_timeseries,\n",
- " i_interval=-3, ax=ax1)\n",
+ "RGDR(\n",
+ " target_intervals, lag,\n",
+ " eps_km=600, alpha=0.01, min_area_km2=600**2\n",
+ ").preview_clusters(precursor_field, target_timeseries, ax=ax1, vmin=-2, vmax=2)\n",
"\n",
- "RGDR(eps_km=600, alpha=0.10, min_area_km2=None).preview_clusters(\n",
- " precursor_field,\n",
- " target_timeseries,\n",
- " i_interval=-3, ax=ax2)"
+ "RGDR(\n",
+ " target_intervals, lag,\n",
+ " eps_km=600, alpha=0.01, min_area_km2=None\n",
+ ").preview_clusters(precursor_field, target_timeseries, ax=ax2, vmin=-2, vmax=2)\n"
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "Once you are satisfied with the selected paramters, the `.fit` method can be used to fit the RGDR clustering to a precursor field.\n",
+ "Once you are satisfied with the selected parameters, the `.fit` method can be used to fit the RGDR clustering to a precursor field.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "rgdr.fit(precursor_field, target_timeseries)"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "`.transform` can then be used to return the data reduced to clusters.\n",
"\n",
- "`.transform` can then be used to return the data reduced to clusters:"
+ "Note that only the data for the specified precursor interval index (`-4`) is returned:"
]
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
@@ -473,11 +524,6 @@
" grid-column: 4;\n",
"}\n",
"\n",
- ".xr-index-preview {\n",
- " grid-column: 2 / 5;\n",
- " color: var(--xr-font-color2);\n",
- "}\n",
- "\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
@@ -499,16 +545,14 @@
"}\n",
"\n",
".xr-var-attrs,\n",
- ".xr-var-data,\n",
- ".xr-index-data {\n",
+ ".xr-var-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
- ".xr-var-data-in:checked ~ .xr-var-data,\n",
- ".xr-index-data-in:checked ~ .xr-index-data {\n",
+ ".xr-var-data-in:checked ~ .xr-var-data {\n",
" display: block;\n",
"}\n",
"\n",
@@ -518,16 +562,13 @@
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
- ".xr-index-name div,\n",
- ".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
- ".xr-var-data,\n",
- ".xr-index-data {\n",
+ ".xr-var-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
@@ -565,8 +606,7 @@
"}\n",
"\n",
".xr-icon-database,\n",
- ".xr-icon-file-text2,\n",
- ".xr-no-icon {\n",
+ ".xr-icon-file-text2 {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
@@ -575,129 +615,134 @@
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
- "</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'sst' (anchor_year: 39, cluster_labels: 8)>\n",
- "287.8 295.4 286.4 291.3 277.1 278.3 ... 285.5 291.1 276.2 277.2 282.9 282.6\n",
+ "</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'sst' (anchor_year: 40, i_interval: 1, cluster_labels: 5)>\n",
+ "292.6 288.8 285.7 292.2 295.8 293.0 ... 296.1 292.2 289.7 286.0 292.0 296.1\n",
"Coordinates:\n",
- " * anchor_year (anchor_year) int64 2018 2017 2016 2015 ... 1982 1981 1980\n",
- " * cluster_labels (cluster_labels) <U32 'i_interval:-1_cluster:-1' ... 'i_i...\n",
- " latitude (cluster_labels) float64 38.64 31.13 38.88 ... 42.53 43.03\n",
- " longitude (cluster_labels) float64 218.1 186.8 219.2 ... 219.2 217.5\n",
+ " * anchor_year (anchor_year) int64 2018 2017 2016 2015 ... 1981 1980 1979\n",
+ " * i_interval (i_interval) int64 -4\n",
+ " target (i_interval) bool False\n",
+ " * cluster_labels (cluster_labels) int16 -3 -2 -1 1 2\n",
+ " latitude (cluster_labels) float64 28.7 37.5 45.58 37.5 32.5\n",
+ " longitude (cluster_labels) float64 233.7 232.5 215.4 180.0 195.0\n",
"Attributes:\n",
" data: Clustered data with Response Guided Dimensionality Reduction.\n",
- " coordinates: Latitudes and longitudes are geographical centers associate...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 39</li><li><span class='xr-has-index'>cluster_labels</span>: 6</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-17cb0257-dc1c-42df-a1f6-2a2d489ee7df' class='xr-array-in' type='checkbox' ><label for='section-17cb0257-dc1c-42df-a1f6-2a2d489ee7df' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>291.4 298.2 288.4 296.6 286.9 285.1 ... 298.9 287.8 296.6 286.0 284.9</span></div><div class='xr-array-data'><pre>array([[291.37066195, 298.21053747, 288.43352188, 296.60848274,\n",
- " 286.90046576, 285.06801918],\n",
- " [291.45966391, 299.19568083, 288.59732323, 296.99780806,\n",
- " 286.61949986, 284.98540926],\n",
- " [291.91085874, 298.89195415, 289.25948746, 296.46499542,\n",
- " 287.04384111, 285.45310605],\n",
- " [293.32741257, 298.91044985, 289.77576952, 296.28250604,\n",
- " 287.36028116, 286.22768626],\n",
- " [292.3259726 , 299.48610574, 289.2110373 , 296.53067801,\n",
- " 287.49833021, 286.25535463],\n",
- " [291.99974208, 299.04325189, 288.62988464, 297.33760943,\n",
- " 287.24689238, 285.63134742],\n",
- " [290.34711093, 299.320106 , 287.57482541, 297.90456269,\n",
- " 286.10235052, 284.79830112],\n",
- " [290.48853941, 299.65241405, 287.49144993, 298.35400031,\n",
- " 286.18180894, 284.64238114],\n",
- " [290.70922506, 299.69018872, 287.76165755, 297.16978009,\n",
- " 286.06129633, 284.49058091],\n",
- " [291.91882282, 299.30649003, 289.03807993, 296.61841539,\n",
- " 286.86319553, 285.41171316],\n",
+ " coordinates: Latitudes and longitudes are geographical centers associate...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 40</li><li><span class='xr-has-index'>i_interval</span>: 1</li><li><span class='xr-has-index'>cluster_labels</span>: 5</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-b174c8ef-4a97-4183-bbae-0071de395f9a' class='xr-array-in' type='checkbox' ><label for='section-b174c8ef-4a97-4183-bbae-0071de395f9a' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>292.6 288.8 285.7 292.2 295.8 293.0 ... 292.2 289.7 286.0 292.0 296.1</span></div><div class='xr-array-data'><pre>array([[[292.64360842, 288.83886719, 285.69343776, 292.18593924,\n",
+ " 295.78289032]],\n",
+ "\n",
+ " [[292.95298255, 288.98946272, 285.44787169, 292.703319 ,\n",
+ " 296.40889304]],\n",
+ "\n",
+ " [[293.43979268, 289.64865112, 286.11178587, 293.12209865,\n",
+ " 295.74627577]],\n",
+ "\n",
+ " [[295.21637352, 290.48266602, 287.87270857, 291.64146205,\n",
+ " 295.859072 ]],\n",
+ "\n",
+ " [[292.67704122, 290.12355695, 286.76372838, 291.76468985,\n",
+ " 297.28726959]],\n",
+ "\n",
+ " [[292.91546231, 289.75571551, 286.47284713, 293.70135934,\n",
+ " 296.4305736 ]],\n",
+ "\n",
+ " [[291.78717907, 288.1461574 , 284.13377209, 293.47771345,\n",
+ " 297.18304116]],\n",
"...\n",
- " [290.99960169, 298.35675492, 288.43398779, 296.56159793,\n",
- " 286.77823224, 285.46594319],\n",
- " [290.80443321, 299.61375876, 287.73813437, 297.72830858,\n",
- " 285.91317401, 284.66681325],\n",
- " [290.26277142, 298.495829 , 287.68074275, 294.90712055,\n",
- " 286.11305079, 285.06475995],\n",
- " [291.11538436, 298.51701671, 288.42280444, 295.87495752,\n",
- " 286.59086822, 285.47541953],\n",
- " [291.31511491, 298.06875363, 288.30114902, 296.60273768,\n",
- " 286.36983148, 285.23982798],\n",
- " [291.08960917, 299.35080249, 288.1596998 , 297.99213155,\n",
- " 286.72862973, 285.2133661 ],\n",
- " [290.0762239 , 298.98291705, 287.73584298, 296.41157889,\n",
- " 285.86096977, 284.26479301],\n",
- " [290.71731703, 297.71694295, 287.67598112, 294.73800866,\n",
- " 285.88040068, 284.63316991],\n",
- " [290.970545 , 298.92119198, 288.55306112, 296.90258837,\n",
- " 286.41065088, 285.21587978],\n",
- " [290.79588914, 298.94548042, 287.83356654, 296.5913755 ,\n",
- " 286.03044129, 284.87776786]])</pre></div></div></li><li class='xr-section-item'><input id='section-a9951cc5-0486-436e-b53b-cf9a56244778' class='xr-section-summary-in' type='checkbox' checked><label for='section-a9951cc5-0486-436e-b53b-cf9a56244778' class='xr-section-summary' >Coordinates: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2018 2017 2016 ... 1982 1981 1980</div><input id='attrs-3a10bea3-a945-4c75-9a9c-c1bf569c1842' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3a10bea3-a945-4c75-9a9c-c1bf569c1842' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-64784064-90ab-4e5d-bb25-d68edf6ce76c' class='xr-var-data-in' type='checkbox'><label for='data-64784064-90ab-4e5d-bb25-d68edf6ce76c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007,\n",
+ " [[293.63715878, 289.76275635, 285.09576475, 292.27376883,\n",
+ " 295.43231092]],\n",
+ "\n",
+ " [[291.99310375, 288.2394104 , 284.89413012, 290.64766366,\n",
+ " 297.45475878]],\n",
+ "\n",
+ " [[291.7683638 , 288.8591701 , 284.45586965, 291.0320173 ,\n",
+ " 296.97395979]],\n",
+ "\n",
+ " [[292.04618863, 288.69692993, 284.74314085, 290.97675868,\n",
+ " 294.98297119]],\n",
+ "\n",
+ " [[293.04918065, 289.23656355, 284.82654826, 291.44362749,\n",
+ " 296.55028207]],\n",
+ "\n",
+ " [[291.88359926, 288.49036952, 285.1243235 , 293.42803737,\n",
+ " 296.09576852]],\n",
+ "\n",
+ " [[292.20558477, 289.72281756, 285.97866954, 292.00179618,\n",
+ " 296.0643267 ]]])</pre></div></div></li><li class='xr-section-item'><input id='section-8284e4ac-4b19-465b-b915-4024901a5fc6' class='xr-section-summary-in' type='checkbox' checked><label for='section-8284e4ac-4b19-465b-b915-4024901a5fc6' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2018 2017 2016 ... 1981 1980 1979</div><input id='attrs-6e6f762c-5044-4ee7-a495-9c1378d7d012' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6e6f762c-5044-4ee7-a495-9c1378d7d012' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-df565c35-532e-469c-b1db-6412c027c430' class='xr-var-data-in' type='checkbox'><label for='data-df565c35-532e-469c-b1db-6412c027c430' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007,\n",
" 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995,\n",
" 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983,\n",
- " 1982, 1981, 1980], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'><U32</div><div class='xr-var-preview xr-preview'>'i_interval:-1_cluster:-2' ... '...</div><input id='attrs-9a10e615-e0db-4969-be1e-ee46133d7a27' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-9a10e615-e0db-4969-be1e-ee46133d7a27' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-fc0fe756-1bf4-4a1f-bd0b-174601772d29' class='xr-var-data-in' type='checkbox'><label for='data-fc0fe756-1bf4-4a1f-bd0b-174601772d29' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['i_interval:-1_cluster:-2', 'i_interval:-1_cluster:1',\n",
- " 'i_interval:-2_cluster:-1', 'i_interval:-2_cluster:1',\n",
- " 'i_interval:-3_cluster:-1', 'i_interval:-4_cluster:-2'], dtype='<U32')</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>36.05 29.44 37.33 29.58 38.14 39.78</div><input id='attrs-9115d808-4d5c-423e-a8c2-20f7857287df' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-9115d808-4d5c-423e-a8c2-20f7857287df' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b6f2deb0-905a-4a6f-a2f0-5337086321dd' class='xr-var-data-in' type='checkbox'><label for='data-b6f2deb0-905a-4a6f-a2f0-5337086321dd' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([36.0508552 , 29.4398051 , 37.33257702, 29.58134561, 38.13773082,\n",
- " 39.78162825])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>223.9 185.4 221.8 190.2 217.8 219.3</div><input id='attrs-ba1e2f3b-8e0e-4020-8c40-bd54172e602a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ba1e2f3b-8e0e-4020-8c40-bd54172e602a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1099093b-2c6a-48fa-b835-092a034d2fe6' class='xr-var-data-in' type='checkbox'><label for='data-1099093b-2c6a-48fa-b835-092a034d2fe6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([223.86658208, 185.40970765, 221.82516648, 190.20336403,\n",
- " 217.7810629 , 219.30300121])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-9ad3b7b3-e410-40ce-8094-9c511aeb58ce' class='xr-section-summary-in' type='checkbox' checked><label for='section-9ad3b7b3-e410-40ce-8094-9c511aeb58ce' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>data :</span></dt><dd>Clustered data with Response Guided Dimensionality Reduction.</dd><dt><span>coordinates :</span></dt><dd>Latitudes and longitudes are geographical centers associated with clusters.</dd></dl></div></li></ul></div></div>"
+ " 1982, 1981, 1980, 1979], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>i_interval</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>-4</div><input id='attrs-e6c73670-8c4a-4942-99e1-9e005efb2a6d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e6c73670-8c4a-4942-99e1-9e005efb2a6d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-72db7d5c-86b4-4a25-8945-ff1d73a1517c' class='xr-var-data-in' type='checkbox'><label for='data-72db7d5c-86b4-4a25-8945-ff1d73a1517c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-4], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>target</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>False</div><input id='attrs-be3b826e-f9c0-402f-b944-5fe70f5e20f9' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-be3b826e-f9c0-402f-b944-5fe70f5e20f9' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4c76b370-0cdc-4eca-b004-87657e14e616' class='xr-var-data-in' type='checkbox'><label for='data-4c76b370-0cdc-4eca-b004-87657e14e616' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([False])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>int16</div><div class='xr-var-preview xr-preview'>-3 -2 -1 1 2</div><input id='attrs-4dcadffa-2aba-4da8-8e8c-d9b90647716a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-4dcadffa-2aba-4da8-8e8c-d9b90647716a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-aac1953d-6981-4060-8c13-819d3665bbf1' class='xr-var-data-in' type='checkbox'><label for='data-aac1953d-6981-4060-8c13-819d3665bbf1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-3, -2, -1, 1, 2], dtype=int16)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>28.7 37.5 45.58 37.5 32.5</div><input id='attrs-70aca189-af8f-4b0a-81f5-0b3aa214b038' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-70aca189-af8f-4b0a-81f5-0b3aa214b038' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b7edcc9c-421e-4f83-a7ff-458fa16715d7' class='xr-var-data-in' type='checkbox'><label for='data-b7edcc9c-421e-4f83-a7ff-458fa16715d7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([28.70332394, 37.5 , 45.57956704, 37.5 , 32.5 ])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>233.7 232.5 215.4 180.0 195.0</div><input id='attrs-ee029c0c-a39a-4e99-9b6b-a91ee285b98c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ee029c0c-a39a-4e99-9b6b-a91ee285b98c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-eb8a1f37-81ec-40ce-9afd-108065ec2073' class='xr-var-data-in' type='checkbox'><label for='data-eb8a1f37-81ec-40ce-9afd-108065ec2073' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([233.70332394, 232.5 , 215.38064945, 180. ,\n",
+ " 195. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c0ccb294-85cc-4b38-850d-9a086589337b' class='xr-section-summary-in' type='checkbox' checked><label for='section-c0ccb294-85cc-4b38-850d-9a086589337b' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>data :</span></dt><dd>Clustered data with Response Guided Dimensionality Reduction.</dd><dt><span>coordinates :</span></dt><dd>Latitudes and longitudes are geographical centers associated with clusters.</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
- "<xarray.DataArray 'sst' (anchor_year: 39, cluster_labels: 8)>\n",
- "287.8 295.4 286.4 291.3 277.1 278.3 ... 285.5 291.1 276.2 277.2 282.9 282.6\n",
+ "<xarray.DataArray 'sst' (anchor_year: 40, i_interval: 1, cluster_labels: 5)>\n",
+ "292.6 288.8 285.7 292.2 295.8 293.0 ... 296.1 292.2 289.7 286.0 292.0 296.1\n",
"Coordinates:\n",
- " * anchor_year (anchor_year) int64 2018 2017 2016 2015 ... 1982 1981 1980\n",
- " * cluster_labels (cluster_labels) <U32 'i_interval:-1_cluster:-1' ... 'i_i...\n",
- " latitude (cluster_labels) float64 38.64 31.13 38.88 ... 42.53 43.03\n",
- " longitude (cluster_labels) float64 218.1 186.8 219.2 ... 219.2 217.5\n",
+ " * anchor_year (anchor_year) int64 2018 2017 2016 2015 ... 1981 1980 1979\n",
+ " * i_interval (i_interval) int64 -4\n",
+ " target (i_interval) bool False\n",
+ " * cluster_labels (cluster_labels) int16 -3 -2 -1 1 2\n",
+ " latitude (cluster_labels) float64 28.7 37.5 45.58 37.5 32.5\n",
+ " longitude (cluster_labels) float64 233.7 232.5 215.4 180.0 195.0\n",
"Attributes:\n",
" data: Clustered data with Response Guided Dimensionality Reduction.\n",
" coordinates: Latitudes and longitudes are geographical centers associate..."
]
},
- "execution_count": 31,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "rgdr.fit(precursor_field, target_timeseries)\n",
"clustered_data = rgdr.transform(precursor_field)\n",
"xr.set_options(display_expand_data=False) # Hide the full data repr\n",
"clustered_data"
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "Now we can plot the data for each cluster:"
+ "Now we can plot the data for each cluster (blue for positively correlated lcusters, red for negatively correlated ones):"
]
},
{
"cell_type": "code",
- "execution_count": 33,
+ "execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "<matplotlib.legend.Legend at 0x142b08f5810>"
+ "[<matplotlib.lines.Line2D at 0x26028538430>]"
]
},
- "execution_count": 33,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEXCAYAAACzhgONAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAABy50lEQVR4nO2dd5gb5bW436PtvXt37S3uFWNjmw6hE0JICAFCCiVAGrnkJvcmuSH3pt3kl37TeyFAEkIIvfduwOCCey9re3vvffX9/vhmdrValdGu2trf+zx6JI1mRkcjac6cLkopDAaDwWDwhyvWAhgMBoMhvjGKwmAwGAwBMYrCYDAYDAExisJgMBgMATGKwmAwGAwBMYrCYDAYDAExisJgMBgMATGKIoqIyMdFZG2s5QiEiFSJyIUO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U5QAUEwqhzf49AzhFSukXQrwIuICg7BW+CjPwZ78n6nEYbRrbQHQme1JK+aqeYF6NJkD3jtBmGLdIKRfHecmdwM+llH/VX/Pdwb6XQjEYVAhIMdHIAZr1i/9sNPnsZPwTuAZACGHV7/LjIqVsBZqFEKfpmy4BXkq0fwIeQJtBcJ9+zDZgnxDiQt0GIYRYFPW7GJr2l/Y9kEIxUpQDUEw0ngZsQoh30eSh3xhg/y8Da4QQb6OFeuYOsP+lwK1CiLeAxcD3h2jfQ2jD3h+O2nYxcKUQwpALNkZcfhctNLQFaBzi+ygUA6LkoBWKMUQIcQFwvpQyZWMoFYrhonIACsUYIYS4E20m7NnptkWhAOUAFIqUI4S4Gbiwz+ZHpJRfSoc9CkUiVAhIoVAoJikqCaxQKBSTFOUAFAqFYpKiHIBCoVBMUpQDUCgUiknK/weoG3cVl7TIIQAAAABJRU5ErkJggg==",
"text/plain": [
- "<Figure size 640x480 with 1 Axes>"
+ "<Figure size 432x288 with 1 Axes>"
]
},
- "metadata": {},
+ "metadata": {
+ "needs_background": "light"
+ },
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
- "\n",
- "clustered_data -= clustered_data.mean(dim='anchor_year')\n",
- "clustered_data.sel(cluster_labels=\"i_interval:-1_cluster:1\").plot.line(x='anchor_year', label='pos. corr')\n",
- "clustered_data.sel(cluster_labels=\"i_interval:-1_cluster:-1\").plot.line(x='anchor_year', label='neg. corr')\n",
- "plt.legend()"
+ "clustered_data = clustered_data - clustered_data.mean(dim=\"anchor_year\")\n",
+ "kwargs = {'x': 'anchor_year', 'add_legend': False}\n",
+ "clustered_data.sel(cluster_labels=1).plot.line(c='tab:blue', **kwargs)\n",
+ "clustered_data.sel(cluster_labels=2).plot.line(c='tab:blue', **kwargs)\n",
+ "clustered_data.sel(cluster_labels=-1).plot.line(c='tab:red', **kwargs)\n",
+ "clustered_data.sel(cluster_labels=-2).plot.line(c='tab:red', **kwargs)\n",
+ "clustered_data.sel(cluster_labels=-3).plot.line(c='tab:red', **kwargs)"
]
},
{
@@ -711,7 +756,7 @@
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": 11,
"metadata": {},
"outputs": [
{
@@ -978,11 +1023,6 @@
" grid-column: 4;\n",
"}\n",
"\n",
- ".xr-index-preview {\n",
- " grid-column: 2 / 5;\n",
- " color: var(--xr-font-color2);\n",
- "}\n",
- "\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
@@ -1004,16 +1044,14 @@
"}\n",
"\n",
".xr-var-attrs,\n",
- ".xr-var-data,\n",
- ".xr-index-data {\n",
+ ".xr-var-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
- ".xr-var-data-in:checked ~ .xr-var-data,\n",
- ".xr-index-data-in:checked ~ .xr-index-data {\n",
+ ".xr-var-data-in:checked ~ .xr-var-data {\n",
" display: block;\n",
"}\n",
"\n",
@@ -1023,16 +1061,13 @@
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
- ".xr-index-name div,\n",
- ".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
- ".xr-var-data,\n",
- ".xr-index-data {\n",
+ ".xr-var-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
@@ -1070,8 +1105,7 @@
"}\n",
"\n",
".xr-icon-database,\n",
- ".xr-icon-file-text2,\n",
- ".xr-no-icon {\n",
+ ".xr-icon-file-text2 {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
@@ -1080,73 +1114,45 @@
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
- "</style><pre class='xr-text-repr-fallback'><xarray.DataArray (i_interval: 4, latitude: 5, longitude: 13)>\n",
- "-0.1352 -0.1545 -0.2249 -0.208 -0.1531 ... -0.3452 -0.3065 -0.3574 -0.4362\n",
+ "</style><pre class='xr-text-repr-fallback'><xarray.DataArray (latitude: 5, longitude: 13)>\n",
+ "0.2697 0.2123 0.0529 -0.1931 -0.3189 ... -0.1533 -0.246 -0.3174 -0.4126 -0.4341\n",
"Coordinates:\n",
- " * i_interval (i_interval) int64 -4 -3 -2 -1\n",
" * latitude (latitude) float64 47.5 42.5 37.5 32.5 27.5\n",
" * longitude (longitude) float64 177.5 182.5 187.5 ... 227.5 232.5 237.5\n",
- " area (latitude) float64 3.34e+06 3.645e+06 ... 4.169e+06 4.385e+06\n",
+ " area (latitude) float64 2.088e+05 2.278e+05 ... 2.606e+05 2.741e+05\n",
+ " cluster int64 3\n",
" tfreq int64 5\n",
- " n_clusters int64 6\n",
- " cluster int64 3</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'></div><ul class='xr-dim-list'><li><span class='xr-has-index'>latitude</span>: 5</li><li><span class='xr-has-index'>longitude</span>: 13</li><li><span class='xr-has-index'>i_interval</span>: 4</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-fa45b6e9-cf75-4240-8308-26bb56909d3f' class='xr-array-in' type='checkbox' ><label for='section-fa45b6e9-cf75-4240-8308-26bb56909d3f' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>-0.2663 -0.2194 -0.2187 0.01618 ... -0.1126 -0.3063 -0.38 -0.3984</span></div><div class='xr-array-data'><pre>array([[[-0.26630719, -0.21941745, -0.21868534, 0.01617516],\n",
- " [-0.18191947, -0.21464621, -0.12315571, 0.02414245],\n",
- " [-0.25372747, -0.4007449 , -0.23253951, -0.1105048 ],\n",
- " [-0.35772739, -0.46371192, -0.35037825, -0.24520611],\n",
- " [-0.3473753 , -0.46975605, -0.4534247 , -0.32824171],\n",
- " [-0.29461981, -0.41748415, -0.43326205, -0.323078 ],\n",
- " [-0.28702518, -0.34457092, -0.34313136, -0.30660624],\n",
- " [-0.37721962, -0.37666874, -0.34666184, -0.38616188],\n",
- " [-0.32951966, -0.30240485, -0.33402403, -0.3822271 ],\n",
- " [-0.33065629, -0.28493204, -0.41554246, -0.36827501],\n",
- " [-0.27627975, -0.19205284, -0.27858467, -0.28047128],\n",
- " [-0.12823108, -0.15956299, -0.2545805 , -0.10757776],\n",
- " [ nan, nan, nan, nan]],\n",
- "\n",
- " [[-0.19425886, -0.1379688 , -0.12801465, -0.02842247],\n",
- " [-0.10557213, -0.0967947 , -0.0124359 , 0.00598683],\n",
- " [-0.1265711 , -0.13544553, -0.09888618, 0.00479765],\n",
- " [-0.2325628 , -0.16586661, -0.06881219, 0.01930277],\n",
- " [-0.25983436, -0.22187587, -0.1865748 , -0.01405595],\n",
- " [-0.29141342, -0.28542316, -0.26110484, 0.01204043],\n",
- "...\n",
- " [-0.29769152, -0.12912278, -0.12178649, -0.18490648],\n",
- " [-0.3604698 , -0.25308925, -0.27218421, -0.24043321],\n",
- " [-0.39152915, -0.34714351, -0.38322784, -0.29061517],\n",
- " [-0.3338985 , -0.46870146, -0.54341488, -0.35707131],\n",
- " [-0.155657 , -0.36081808, -0.48241304, -0.26357851],\n",
- " [-0.10772449, -0.26949376, -0.32115578, -0.27768413]],\n",
- "\n",
- " [[ 0.01770287, 0.20242345, 0.50036829, 0.42487447],\n",
- " [ 0.00806344, 0.2784725 , 0.4839066 , 0.34211447],\n",
- " [ 0.14065339, 0.3199787 , 0.43694834, 0.3433933 ],\n",
- " [ 0.13369711, 0.33449607, 0.35050515, 0.18648733],\n",
- " [ 0.1233588 , 0.29487164, 0.25401412, 0.04340644],\n",
- " [ 0.0517264 , 0.26352384, 0.09830805, -0.10334886],\n",
- " [-0.01373979, 0.16013368, -0.08694884, -0.17111999],\n",
- " [-0.06523411, -0.08067427, -0.25987983, -0.24750864],\n",
- " [-0.1921587 , -0.31606223, -0.39384288, -0.35825522],\n",
- " [-0.11634853, -0.34898835, -0.4202639 , -0.41354082],\n",
- " [-0.1791453 , -0.35672934, -0.43487533, -0.37029449],\n",
- " [-0.21013388, -0.34349675, -0.42768064, -0.40753351],\n",
- " [-0.11258559, -0.3062787 , -0.37996126, -0.39836497]]])</pre></div></div></li><li class='xr-section-item'><input id='section-d06045e8-3005-4c23-ab82-e290c9446f5e' class='xr-section-summary-in' type='checkbox' checked><label for='section-d06045e8-3005-4c23-ab82-e290c9446f5e' class='xr-section-summary' >Coordinates: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>i_interval</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>-4 -3 -2 -1</div><input id='attrs-471585e4-f049-4260-8677-55835d20a817' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-471585e4-f049-4260-8677-55835d20a817' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b9e9b499-ca71-42dc-a483-e563f93dc911' class='xr-var-data-in' type='checkbox'><label for='data-b9e9b499-ca71-42dc-a483-e563f93dc911' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-4, -3, -2, -1], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>latitude</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>47.5 42.5 37.5 32.5 27.5</div><input id='attrs-9473b146-36c8-4625-b2e1-591f8aaa974a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-9473b146-36c8-4625-b2e1-591f8aaa974a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cd6a3a0a-79e1-443e-a6f2-c4a87e164c70' class='xr-var-data-in' type='checkbox'><label for='data-cd6a3a0a-79e1-443e-a6f2-c4a87e164c70' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([47.5, 42.5, 37.5, 32.5, 27.5])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>longitude</span></div><div class='xr-var-dims'>(longitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>177.5 182.5 187.5 ... 232.5 237.5</div><input id='attrs-adf341d9-183c-48d8-a0c9-b0b9f41dfc73' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-adf341d9-183c-48d8-a0c9-b0b9f41dfc73' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a40df185-f83c-4960-8345-e4780e7ca0df' class='xr-var-data-in' type='checkbox'><label for='data-a40df185-f83c-4960-8345-e4780e7ca0df' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([177.5, 182.5, 187.5, 192.5, 197.5, 202.5, 207.5, 212.5, 217.5, 222.5,\n",
- " 227.5, 232.5, 237.5])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>area</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>3.34e+06 3.645e+06 ... 4.385e+06</div><input id='attrs-74543780-07e8-4100-a0b5-915271fd3e54' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-74543780-07e8-4100-a0b5-915271fd3e54' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d74a0b22-1a27-4820-9357-1a448c3aa184' class='xr-var-data-in' type='checkbox'><label for='data-d74a0b22-1a27-4820-9357-1a448c3aa184' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([3339800.84283772, 3644753.05166713, 3921966.48901128,\n",
- " 4169331.39322594, 4384965.16802703])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>tfreq</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>5</div><input id='attrs-bc584487-8b3e-49d8-98de-45ccf7fec656' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-bc584487-8b3e-49d8-98de-45ccf7fec656' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4c02e7dc-67f5-4a67-8f17-9e98f38fac0f' class='xr-var-data-in' type='checkbox'><label for='data-4c02e7dc-67f5-4a67-8f17-9e98f38fac0f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(5, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>n_clusters</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>6</div><input id='attrs-1f9a8de0-45c6-43b5-9d24-ffd3e2fdcddb' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1f9a8de0-45c6-43b5-9d24-ffd3e2fdcddb' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3a8f9552-aa30-42df-9d51-05c6c6b1e8ab' class='xr-var-data-in' type='checkbox'><label for='data-3a8f9552-aa30-42df-9d51-05c6c6b1e8ab' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(6, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>cluster</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>3</div><input id='attrs-50abc10b-0c4f-47a1-8575-ec4c3a4017f7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-50abc10b-0c4f-47a1-8575-ec4c3a4017f7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-70f820bc-b408-4c83-b006-476eb2bf9d33' class='xr-var-data-in' type='checkbox'><label for='data-70f820bc-b408-4c83-b006-476eb2bf9d33' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(3, dtype=int64)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-eb5c026b-afc3-497e-88a0-b25754150310' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-eb5c026b-afc3-497e-88a0-b25754150310' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
+ " n_clusters int64 6</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'></div><ul class='xr-dim-list'><li><span class='xr-has-index'>latitude</span>: 5</li><li><span class='xr-has-index'>longitude</span>: 13</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-14114774-aab0-40e6-aa62-d77f68145afb' class='xr-array-in' type='checkbox' ><label for='section-14114774-aab0-40e6-aa62-d77f68145afb' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>0.2697 0.2123 0.0529 -0.1931 ... -0.246 -0.3174 -0.4126 -0.4341</span></div><div class='xr-array-data'><pre>array([[ 0.26973879, 0.21227671, 0.05289627, -0.19309815, -0.31889021,\n",
+ " -0.47274522, -0.55472119, -0.53583813, -0.56565047, -0.53421202,\n",
+ " -0.41056264, -0.2310342 , nan],\n",
+ " [ 0.2037804 , 0.26253778, 0.19418173, 0.06666334, -0.08516656,\n",
+ " -0.18050655, -0.27848657, -0.35489399, -0.41916154, -0.47261077,\n",
+ " -0.31655439, -0.12650094, nan],\n",
+ " [ 0.40535219, 0.32321764, 0.16911906, 0.11556145, 0.08321155,\n",
+ " 0.07836849, 0.10415046, -0.0085853 , -0.16056509, -0.1003596 ,\n",
+ " -0.22329525, -0.3465616 , nan],\n",
+ " [ 0.2630065 , 0.26032401, 0.35231884, 0.40363035, 0.40450999,\n",
+ " 0.31832834, 0.18927728, 0.09921395, 0.01973299, -0.05579345,\n",
+ " -0.24113899, -0.30901333, -0.43695491],\n",
+ " [ 0.21990857, 0.19720435, 0.12089699, 0.10531533, 0.07945109,\n",
+ " 0.01934902, -0.0193646 , -0.10691568, -0.15330192, -0.24602795,\n",
+ " -0.31735925, -0.41262283, -0.43411288]])</pre></div></div></li><li class='xr-section-item'><input id='section-e3a869ff-d54c-4ac9-a9e6-f5d9b52bff02' class='xr-section-summary-in' type='checkbox' checked><label for='section-e3a869ff-d54c-4ac9-a9e6-f5d9b52bff02' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>latitude</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>47.5 42.5 37.5 32.5 27.5</div><input id='attrs-573c8629-c58c-4535-9d78-3a87f9ffd9b6' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-573c8629-c58c-4535-9d78-3a87f9ffd9b6' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1d0ea2a0-ec6b-4cd3-a6d3-34789c2826d7' class='xr-var-data-in' type='checkbox'><label for='data-1d0ea2a0-ec6b-4cd3-a6d3-34789c2826d7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([47.5, 42.5, 37.5, 32.5, 27.5])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>longitude</span></div><div class='xr-var-dims'>(longitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>177.5 182.5 187.5 ... 232.5 237.5</div><input id='attrs-e99ecefd-7768-4d79-879c-fcf7154e577a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e99ecefd-7768-4d79-879c-fcf7154e577a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-70b134f8-544e-45a5-91a4-1cdf5e7bef52' class='xr-var-data-in' type='checkbox'><label for='data-70b134f8-544e-45a5-91a4-1cdf5e7bef52' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([177.5, 182.5, 187.5, 192.5, 197.5, 202.5, 207.5, 212.5, 217.5, 222.5,\n",
+ " 227.5, 232.5, 237.5])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>area</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>2.088e+05 2.278e+05 ... 2.741e+05</div><input id='attrs-e9d32b8c-7b02-48b7-ae63-4c636bebf5c1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e9d32b8c-7b02-48b7-ae63-4c636bebf5c1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d228b03e-f29b-41a1-8bca-e0407ddfd06d' class='xr-var-data-in' type='checkbox'><label for='data-d228b03e-f29b-41a1-8bca-e0407ddfd06d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([208767.02150832, 227829.22531495, 245157.51114987, 260620.0002948 ,\n",
+ " 274099.01387082])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>cluster</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>3</div><input id='attrs-ecf81775-cda5-434f-8c7a-36eaebcefd6b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ecf81775-cda5-434f-8c7a-36eaebcefd6b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9eff327f-c005-41ca-8b65-741de3454c50' class='xr-var-data-in' type='checkbox'><label for='data-9eff327f-c005-41ca-8b65-741de3454c50' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(3, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>tfreq</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-c5d2ef2c-39db-4f0d-b39a-a72e28803262' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c5d2ef2c-39db-4f0d-b39a-a72e28803262' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-98838557-31ab-4b2b-9b28-abad9eb77c4c' class='xr-var-data-in' type='checkbox'><label for='data-98838557-31ab-4b2b-9b28-abad9eb77c4c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(5, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>n_clusters</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-52592435-3ae0-4243-b411-9a0d91357019' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-52592435-3ae0-4243-b411-9a0d91357019' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-51e2c7eb-6e36-4511-b92a-52a820d7ec7c' class='xr-var-data-in' type='checkbox'><label for='data-51e2c7eb-6e36-4511-b92a-52a820d7ec7c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(6, dtype=int64)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-aa1963e0-4c33-4751-8373-182fb245b730' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-aa1963e0-4c33-4751-8373-182fb245b730' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
- "<xarray.DataArray (i_interval: 4, latitude: 5, longitude: 13)>\n",
- "-0.1352 -0.1545 -0.2249 -0.208 -0.1531 ... -0.3452 -0.3065 -0.3574 -0.4362\n",
+ "<xarray.DataArray (latitude: 5, longitude: 13)>\n",
+ "0.2697 0.2123 0.0529 -0.1931 -0.3189 ... -0.1533 -0.246 -0.3174 -0.4126 -0.4341\n",
"Coordinates:\n",
- " * i_interval (i_interval) int64 -4 -3 -2 -1\n",
" * latitude (latitude) float64 47.5 42.5 37.5 32.5 27.5\n",
" * longitude (longitude) float64 177.5 182.5 187.5 ... 227.5 232.5 237.5\n",
- " area (latitude) float64 3.34e+06 3.645e+06 ... 4.169e+06 4.385e+06\n",
- " tfreq int64 5\n",
- " n_clusters int64 6\n",
- " cluster int64 3"
+ " area (latitude) float64 2.088e+05 2.278e+05 ... 2.606e+05 2.741e+05\n",
+ " cluster int64 3\n",
+ " tfreq int64 ...\n",
+ " n_clusters int64 ..."
]
},
- "execution_count": 34,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -1158,27 +1164,29 @@
},
{
"cell_type": "code",
- "execution_count": 35,
+ "execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "<matplotlib.collections.QuadMesh at 0x142b417fd90>"
+ "<matplotlib.collections.QuadMesh at 0x260285b71c0>"
]
},
- "execution_count": 35,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAloAAADgCAYAAADblcjQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAt60lEQVR4nO3de7gcVZ3u8e+7dxIgEAgQDCEJhKsOIHIJ4CgKh4sCKmFGlIsozKCMOJyj4g1khkEEB9QRhzOMx4gIgoqAohkIIHIR5ZpwFcItBISEQAwQBIEke+/f+aNq73R2+l69u6u738/z1JOq6lpVq6p7/7Jq1aq1FBGYmZmZWeP1tDoDZmZmZp3KBS0zMzOzEeKClpmZmdkIcUHLzMzMbIS4oGVmZmY2QlzQMjMzMxshFQtakh6WtE+Fbb4q6YJGZWokSbpF0idbnY9aSTpB0guSXpO0cavzk3eS9pG0sNX5aGeSnpa0f6vzkZVjWD44htXGMSy7vMSwigWtiNghIm6psM03IqKqP3xJp0u6tMr8tSVJYyRdmX7JUSnIF0kfkrYpWB4NfAd4X0SsFxEvNjbHjSHpWEn9aSAdnPZpdb6yyMsfaiWSdpV0a3r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W1BnM+sNjl/WVdy4Ko99gB9ExADZwqjXALsDfwFuiIhlAJIWA7OBVcA9EXFvyv8D4Lgc138D8A2AiFgiaUnavhdZt/xvU2CbAPw+x3XMrPc4fllXcePKAJ6veD1Avs/FWl683TypgeMFXBER785xTTMrL8cvKxyPuSqP/waOkNQvaVOyb2K1Vla/E3i5pNnp/RFVjnsamFrxfimwW3p9WMX2a4H3AEh6DbBT2n4dWTf+tmnfFEnbN1IhMysNxy/rKm5clcfFZCuR3wL8GvhMRDxc7eCI+CvwUeAXkhaRBaGnRjj0AuAESTdLegXwFeAjkm4mGxsx5FvA+pLuIBuPsChd5zHgGOAHqav998AOeSpqZj3H8cu6iiKi02WwgpK0fkSsSk/fnAncFRFf63S5zMzqcfyyTnLPldXyoTRA9DZgA7Knb8zMuoHjl3WMe67MzMzMWsg9V2ZmZmYt5MaVmZmZWQu5cWVmZmbWQm5cmZmZmbWQG1dmZmZmLeTGlZmZmVkL/X8FHWZpDajbbwAAAABJRU5ErkJggg==",
"text/plain": [
- "<Figure size 1000x300 with 4 Axes>"
+ "<Figure size 720x216 with 4 Axes>"
]
},
- "metadata": {},
+ "metadata": {
+ "needs_background": "light"
+ },
"output_type": "display_data"
}
],
@@ -1186,44 +1194,572 @@
"fig, (ax1, ax2) = plt.subplots(figsize=(10, 3), ncols=2)\n",
"\n",
"# Visualize correlation map after RGDR().fit(precursor_field, target_timeseries)\n",
- "rgdr.corr_map.sel(i_interval=-1).plot(ax=ax1)\n",
+ "rgdr.corr_map.plot(ax=ax1)\n",
"\n",
"# Visualize p-values map\n",
- "rgdr.pval_map.sel(i_interval=-1).plot(ax=ax2)"
+ "rgdr.pval_map.plot(ax=ax2)"
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "The cluster maps can also be visualized. Note that clusters can differ between i_intervals."
+ "The cluster maps can also be visualized:"
]
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
- "image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FyR1mQuSuswFjY1zSvTPl4GnJNkqyW40PY7fnOP47wG3T7Jfu/2UWY67FthxYPtC4F7t+hMH9n8J+DOAJHcDDmj3f51mmNcd28e2T/L7wzRI0qKZC5K6zAVJXeaCJpKdEv1zPHA2cBbwBeDlVXXZbAdX1e+A5wOfSXI6TWj8aoZDjwVeluTbSe4AvA14XpJv01xzNuVfgB2SnE9zndfpbTm/AA4HjmmHYn0NuMtiGippaOaCpC5zQVKXuaCJlKoadx00Ykl2qKpft7Povhv4QVUdNe56SRofc0FSl7kgqctc0HJwpMTq8JfthDXfAW5JM4uupNXNXJDUZS5I6jIXNHKOlJAkSZIkSWPhSAlJkiRJkjQWdkpIkiRJkqSxsFNCkiRJkiSNhZ0SkiRJkiRpLOyUkCRJkiRJY2GnhCRJkiRJGov/C4uALPF6OswTAAAAAElFTkSuQmCC",
"text/plain": [
- "<Figure size 1800x200 with 8 Axes>"
+ "<matplotlib.collections.QuadMesh at 0x2602868b7c0>"
]
},
+ "execution_count": 13,
"metadata": {},
+ "output_type": "execute_result"
+ },
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAhQklEQVR4nO3de5RdZX3/8fdnkgiWiwETY+QiQRBEiggRaaWKiBaoJWhFobaC2qZFXSBaBUoXXlk/rBcslSWmagVFkIvRiEFBhFJbuSQQwl0jl5KAYJCr3JLM5/fH3nNyOJyZ2TNzrpPPa629Zl+evfd3ziTznWc/z34e2SYiIgJgoNsBRERE70hSiIiImiSFiIioSVKIiIiaJIWIiKhJUoiIiJq2JgVJd0m6UdIySUvKfVtKulTSr8uvW7QzhoiIbpG0jaTLJd0i6WZJxzQpI0mnSVohabmkPboR65BO1BTeaHt323PL7eOBy2zvCFxWb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J10t6GcWsekdJup6i7WLIV4FNJd1K0V6wtLzP74AjgXPKR0q/BHaeyDca0c8ySmr0LEmb2n687I10OvBr26d2O66IySw1hehlf182PN8MvICiN1JEtFFqChERUZOaQkRE1CQpRERETZJCRETUJClERERNkkJERNT8f02VfG9i8qu3AAAAAElFTkSuQmCC",
+ "text/plain": [
+ "<Figure size 432x288 with 2 Axes>"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
"output_type": "display_data"
}
],
"source": [
- "from s2spy.rgdr.utils import cluster_labels_to_ints\n",
- "cluster_map = cluster_labels_to_ints(rgdr.cluster_map.copy())\n",
+ "rgdr.cluster_map.plot(cmap='RdYlBu', vmin=-2, vmax=2)"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Multiple target intervals\n",
+ "\n",
+ "As mentioned earlier, with RGDR you can also analyse the correlation of multiple intervals at once.\n",
+ "\n",
+ "Instead of a simple correlation, this is more akin to a cross-correlation operation.\n",
"\n",
- "fig, axes = plt.subplots(figsize=(18, 2), ncols=4)\n",
+ "When you select multiple target intervals, these will be correlated with the same number of precursor intervals, shifted by the `lag` value.\n",
"\n",
- "# Loop through i_interval -1 -> -4\n",
- "for i, ax in zip((-1, -2, -3, -4), axes):\n",
- " cluster_map.cluster_labels.sel(i_interval=i).plot(ax=ax, cmap='RdYlBu', vmin=-2, vmax=2)"
+ "As an illustration, see the image below:\n",
+ "\n",
+ "\n",
+ "\n",
+ "Now let's see it in action:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[-4, -3, -2, -1]"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "target_intervals = [1, 2, 3, 4]\n",
+ "lag = 4\n",
+ "rgdr = RGDR(\n",
+ " target_intervals=target_intervals,\n",
+ " lag=lag,\n",
+ " eps_km=600,\n",
+ " alpha=0.05,\n",
+ " min_area_km2=0\n",
+ ")\n",
+ "rgdr.precursor_intervals"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAArwAAACqCAYAAABPqpzsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAA7/ElEQVR4nO3deZxcZZ3v8c+3qtdsZF8BQUUBF0AYCI0zrjODjoIOi6JeRZHgguJyVRh1BnW8oo6yCAoBGTdQA9FrxmUUFccrTdg0oGwaEdkSknQSCFk66arf/eOck5yq1HKq6lTX0r/363VeVJ0+9dTTTeWpb516zvOTmeGcc84551y3yrS6A84555xzzjWTB17nnHPOOdfVPPA655xzzrmu5oHXOeecc851NQ+8zjnnnHOuq3ngdc4555xzXc0Dr2s5SS+W9EgDj79c0sfT7JNzzrnaSPqapH9vdT+cK6Wn1R1wrhaSTgfebmYvjPaZ2Tta1yPnnHPOtTs/w+tSJWmvD1Gl9jnnnHPOjRcPvK6ApP0kfU/Sekkjki6VlJH0MUl/lbRO0jck7RMef4Akk3SGpIeAX0o6XdJNki6UNAKcL6lf0n9IekjS4+E0hMEyfThX0p8lbZF0j6TXhvsPAS4HjpX0lKTN4f6Cr9EknSlptaSNklZIWhj7mUl6h6Q/Sdos6TJJatof1Dnn2oCkByWdF46pmyT9p6SBEsfdK+lVsfs94fvBC8L710laK+kJSb+W9Jwyz3e6pN8U7TNJzwxvJ35PcC4NHnjdbpKywA+BvwIHAIuA7wCnh9tLgKcDU4BLix7+IuAQ4B/D+8cADwDzgE8DFwDPAg4Hnhm2/a9luvJn4G+BfYBPAN+StMDM7gXeAdxsZlPMbHqJ3+GlwGeAU4EF4e/ynaLDXgX8DfD88Lh/xDnnut8bC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F3AncAvgQ+b2dpyB5vZduBdwH9LuoNgkHyixKHfAT4k6XeSngH8B/BOSb8jmHcW+QowRdK9BHO97gifZz1wOvDt8Cuzm4GDG/lFnXOuC/iY7SY0mVmr++AmCElTzOyp8Argy4A/mdmFre6Xc865vfmY7bqJn+F14+nM8IKIu4F9CK4Ads451558zHZdw8/wOuecc865ruZneJ1zzjnnXFfzwOucc84557qaB17nnHPOOdfVPPA655xzzrmu5oHXOeecc851NQ+8zjnnnHOuq/1/r/MJceZEHtkAAAAASUVORK5CYII=",
+ "text/plain": [
+ "<Figure size 864x144 with 4 Axes>"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
+ "_ = rgdr.preview_correlation(precursor_field, target_timeseries, ax1=ax1, ax2=ax2)\n",
+ "rgdr.fit(precursor_field, target_timeseries)"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Note that the transformed data now has all four precursor intervals:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
+ "<defs>\n",
+ "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
+ "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
+ "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
+ "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
+ "</symbol>\n",
+ "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
+ "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
+ "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
+ "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
+ "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
+ "</symbol>\n",
+ "</defs>\n",
+ "</svg>\n",
+ "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
+ " *\n",
+ " */\n",
+ "\n",
+ ":root {\n",
+ " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
+ " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
+ " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
+ " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
+ " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
+ " --xr-background-color: var(--jp-layout-color0, white);\n",
+ " --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
+ " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
+ "}\n",
+ "\n",
+ "html[theme=dark],\n",
+ "body[data-theme=dark],\n",
+ "body.vscode-dark {\n",
+ " --xr-font-color0: rgba(255, 255, 255, 1);\n",
+ " --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
+ " --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
+ " --xr-border-color: #1F1F1F;\n",
+ " --xr-disabled-color: #515151;\n",
+ " --xr-background-color: #111111;\n",
+ " --xr-background-color-row-even: #111111;\n",
+ " --xr-background-color-row-odd: #313131;\n",
+ "}\n",
+ "\n",
+ ".xr-wrap {\n",
+ " display: block !important;\n",
+ " min-width: 300px;\n",
+ " max-width: 700px;\n",
+ "}\n",
+ "\n",
+ ".xr-text-repr-fallback {\n",
+ " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-header {\n",
+ " padding-top: 6px;\n",
+ " padding-bottom: 6px;\n",
+ " margin-bottom: 4px;\n",
+ " border-bottom: solid 1px var(--xr-border-color);\n",
+ "}\n",
+ "\n",
+ ".xr-header > div,\n",
+ ".xr-header > ul {\n",
+ " display: inline;\n",
+ " margin-top: 0;\n",
+ " margin-bottom: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-obj-type,\n",
+ ".xr-array-name {\n",
+ " margin-left: 2px;\n",
+ " margin-right: 10px;\n",
+ "}\n",
+ "\n",
+ ".xr-obj-type {\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-sections {\n",
+ " padding-left: 0 !important;\n",
+ " display: grid;\n",
+ " grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
+ "}\n",
+ "\n",
+ ".xr-section-item {\n",
+ " display: contents;\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input {\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input + label {\n",
+ " color: var(--xr-disabled-color);\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input:enabled + label {\n",
+ " cursor: pointer;\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-section-item input:enabled + label:hover {\n",
+ " color: var(--xr-font-color0);\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary {\n",
+ " grid-column: 1;\n",
+ " color: var(--xr-font-color2);\n",
+ " font-weight: 500;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary > span {\n",
+ " display: inline-block;\n",
+ " padding-left: 0.5em;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:disabled + label {\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in + label:before {\n",
+ " display: inline-block;\n",
+ " content: '►';\n",
+ " font-size: 11px;\n",
+ " width: 15px;\n",
+ " text-align: center;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:disabled + label:before {\n",
+ " color: var(--xr-disabled-color);\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:checked + label:before {\n",
+ " content: '▼';\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:checked + label > span {\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary,\n",
+ ".xr-section-inline-details {\n",
+ " padding-top: 4px;\n",
+ " padding-bottom: 4px;\n",
+ "}\n",
+ "\n",
+ ".xr-section-inline-details {\n",
+ " grid-column: 2 / -1;\n",
+ "}\n",
+ "\n",
+ ".xr-section-details {\n",
+ " display: none;\n",
+ " grid-column: 1 / -1;\n",
+ " margin-bottom: 5px;\n",
+ "}\n",
+ "\n",
+ ".xr-section-summary-in:checked ~ .xr-section-details {\n",
+ " display: contents;\n",
+ "}\n",
+ "\n",
+ ".xr-array-wrap {\n",
+ " grid-column: 1 / -1;\n",
+ " display: grid;\n",
+ " grid-template-columns: 20px auto;\n",
+ "}\n",
+ "\n",
+ ".xr-array-wrap > label {\n",
+ " grid-column: 1;\n",
+ " vertical-align: top;\n",
+ "}\n",
+ "\n",
+ ".xr-preview {\n",
+ " color: var(--xr-font-color3);\n",
+ "}\n",
+ "\n",
+ ".xr-array-preview,\n",
+ ".xr-array-data {\n",
+ " padding: 0 5px !important;\n",
+ " grid-column: 2;\n",
+ "}\n",
+ "\n",
+ ".xr-array-data,\n",
+ ".xr-array-in:checked ~ .xr-array-preview {\n",
+ " display: none;\n",
+ "}\n",
+ "\n",
+ ".xr-array-in:checked ~ .xr-array-data,\n",
+ ".xr-array-preview {\n",
+ " display: inline-block;\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list {\n",
+ " display: inline-block !important;\n",
+ " list-style: none;\n",
+ " padding: 0 !important;\n",
+ " margin: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list li {\n",
+ " display: inline-block;\n",
+ " padding: 0;\n",
+ " margin: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list:before {\n",
+ " content: '(';\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list:after {\n",
+ " content: ')';\n",
+ "}\n",
+ "\n",
+ ".xr-dim-list li:not(:last-child):after {\n",
+ " content: ',';\n",
+ " padding-right: 5px;\n",
+ "}\n",
+ "\n",
+ ".xr-has-index {\n",
+ " font-weight: bold;\n",
+ "}\n",
+ "\n",
+ ".xr-var-list,\n",
+ ".xr-var-item {\n",
+ " display: contents;\n",
+ "}\n",
+ "\n",
+ ".xr-var-item > div,\n",
+ ".xr-var-item label,\n",
+ ".xr-var-item > .xr-var-name span {\n",
+ " background-color: var(--xr-background-color-row-even);\n",
+ " margin-bottom: 0;\n",
+ "}\n",
+ "\n",
+ ".xr-var-item > .xr-var-name:hover span {\n",
+ " padding-right: 5px;\n",
+ "}\n",
+ "\n",
+ ".xr-var-list > li:nth-child(odd) > div,\n",
+ ".xr-var-list > li:nth-child(odd) > label,\n",
+ ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
+ " background-color: var(--xr-background-color-row-odd);\n",
+ "}\n",
+ "\n",
+ ".xr-var-name {\n",
+ " grid-column: 1;\n",
+ "}\n",
+ "\n",
+ ".xr-var-dims {\n",
+ " grid-column: 2;\n",
+ "}\n",
+ "\n",
+ ".xr-var-dtype {\n",
+ " grid-column: 3;\n",
+ " text-align: right;\n",
+ " color: var(--xr-font-color2);\n",
+ "}\n",
+ "\n",
+ ".xr-var-preview {\n",
+ " grid-column: 4;\n",
+ "}\n",
+ "\n",
+ ".xr-var-name,\n",
+ ".xr-var-dims,\n",
+ ".xr-var-dtype,\n",
+ ".xr-preview,\n",
+ ".xr-attrs dt {\n",
+ " white-space: nowrap;\n",
+ " overflow: hidden;\n",
+ " text-overflow: ellipsis;\n",
+ " padding-right: 10px;\n",
+ "}\n",
+ "\n",
+ ".xr-var-name:hover,\n",
+ ".xr-var-dims:hover,\n",
+ ".xr-var-dtype:hover,\n",
+ ".xr-attrs dt:hover {\n",
+ " overflow: visible;\n",
+ " width: auto;\n",
+ " z-index: 1;\n",
+ "}\n",
+ "\n",
+ ".xr-var-attrs,\n",
+ ".xr-var-data {\n",
+ " display: none;\n",
+ " background-color: var(--xr-background-color) !important;\n",
+ " padding-bottom: 5px !important;\n",
+ "}\n",
+ "\n",
+ ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
+ ".xr-var-data-in:checked ~ .xr-var-data {\n",
+ " display: block;\n",
+ "}\n",
+ "\n",
+ ".xr-var-data > table {\n",
+ " float: right;\n",
+ "}\n",
+ "\n",
+ ".xr-var-name span,\n",
+ ".xr-var-data,\n",
+ ".xr-attrs {\n",
+ " padding-left: 25px !important;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs,\n",
+ ".xr-var-attrs,\n",
+ ".xr-var-data {\n",
+ " grid-column: 1 / -1;\n",
+ "}\n",
+ "\n",
+ "dl.xr-attrs {\n",
+ " padding: 0;\n",
+ " margin: 0;\n",
+ " display: grid;\n",
+ " grid-template-columns: 125px auto;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dt,\n",
+ ".xr-attrs dd {\n",
+ " padding: 0;\n",
+ " margin: 0;\n",
+ " float: left;\n",
+ " padding-right: 10px;\n",
+ " width: auto;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dt {\n",
+ " font-weight: normal;\n",
+ " grid-column: 1;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dt:hover span {\n",
+ " display: inline-block;\n",
+ " background: var(--xr-background-color);\n",
+ " padding-right: 10px;\n",
+ "}\n",
+ "\n",
+ ".xr-attrs dd {\n",
+ " grid-column: 2;\n",
+ " white-space: pre-wrap;\n",
+ " word-break: break-all;\n",
+ "}\n",
+ "\n",
+ ".xr-icon-database,\n",
+ ".xr-icon-file-text2 {\n",
+ " display: inline-block;\n",
+ " vertical-align: middle;\n",
+ " width: 1em;\n",
+ " height: 1.5em !important;\n",
+ " stroke-width: 0;\n",
+ " stroke: currentColor;\n",
+ " fill: currentColor;\n",
+ "}\n",
+ "</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'sst' (anchor_year: 40, i_interval: 4, cluster_labels: 2)>\n",
+ "289.6 298.0 289.9 297.8 290.6 297.9 ... 290.1 297.4 290.7 297.6 291.1 298.2\n",
+ "Coordinates:\n",
+ " * anchor_year (anchor_year) int64 2018 2017 2016 2015 ... 1981 1980 1979\n",
+ " * i_interval (i_interval) int64 -4 -3 -2 -1\n",
+ " target (i_interval) bool False False False False\n",
+ " * cluster_labels (cluster_labels) int16 -1 1\n",
+ " latitude (cluster_labels) float64 38.05 29.58\n",
+ " longitude (cluster_labels) float64 221.1 188.1\n",
+ "Attributes:\n",
+ " data: Clustered data with Response Guided Dimensionality Reduction.\n",
+ " coordinates: Latitudes and longitudes are geographical centers associate...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 40</li><li><span class='xr-has-index'>i_interval</span>: 4</li><li><span class='xr-has-index'>cluster_labels</span>: 2</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-8a118852-8385-43d8-ad4b-8095acf06cdb' class='xr-array-in' type='checkbox' ><label for='section-8a118852-8385-43d8-ad4b-8095acf06cdb' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>289.6 298.0 289.9 297.8 290.6 297.9 ... 297.4 290.7 297.6 291.1 298.2</span></div><div class='xr-array-data'><pre>array([[[289.5783292 , 297.97253854],\n",
+ " [289.9437494 , 297.84123593],\n",
+ " [290.59375437, 297.87556143],\n",
+ " [291.14586621, 298.14905515]],\n",
+ "\n",
+ " [[289.58515932, 298.52527274],\n",
+ " [290.05585833, 298.87564332],\n",
+ " [290.58959074, 298.95332217],\n",
+ " [291.0557513 , 299.2138487 ]],\n",
+ "\n",
+ " [[290.15395151, 297.94216929],\n",
+ " [290.51146981, 298.33819147],\n",
+ " [290.94559058, 298.60726164],\n",
+ " [291.58073576, 298.61821901]],\n",
+ "\n",
+ " [[291.69750902, 297.84277249],\n",
+ " [291.80184887, 298.48058434],\n",
+ " [291.99959682, 299.09760852],\n",
+ " [292.36201799, 298.96715692]],\n",
+ "\n",
+ "...\n",
+ "\n",
+ " [[288.75208738, 296.54021412],\n",
+ " [289.36292891, 297.22635236],\n",
+ " [289.59244458, 297.71173429],\n",
+ " [290.34015463, 298.25471266]],\n",
+ "\n",
+ " [[289.30640172, 298.24357205],\n",
+ " [289.51077876, 299.19472633],\n",
+ " [289.96666198, 298.38401708],\n",
+ " [290.32748515, 299.00638299]],\n",
+ "\n",
+ " [[288.69719671, 298.00652225],\n",
+ " [289.64060397, 298.52628344],\n",
+ " [290.04893905, 298.8792455 ],\n",
+ " [290.52763796, 299.06176483]],\n",
+ "\n",
+ " [[289.46465551, 297.27006951],\n",
+ " [290.14110504, 297.406225 ],\n",
+ " [290.72314837, 297.64015827],\n",
+ " [291.09759615, 298.20393399]]])</pre></div></div></li><li class='xr-section-item'><input id='section-08c13ac5-16d0-490b-84f9-1ecaecf335ea' class='xr-section-summary-in' type='checkbox' checked><label for='section-08c13ac5-16d0-490b-84f9-1ecaecf335ea' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2018 2017 2016 ... 1981 1980 1979</div><input id='attrs-7b94777b-fdfa-4a82-83a5-a92b7b434440' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7b94777b-fdfa-4a82-83a5-a92b7b434440' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-080d3f09-77c0-4597-8b08-112b239a2636' class='xr-var-data-in' type='checkbox'><label for='data-080d3f09-77c0-4597-8b08-112b239a2636' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007,\n",
+ " 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995,\n",
+ " 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983,\n",
+ " 1982, 1981, 1980, 1979], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>i_interval</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>-4 -3 -2 -1</div><input id='attrs-ac4a2564-720a-433e-948d-fca1624a3298' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ac4a2564-720a-433e-948d-fca1624a3298' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-03019e5f-0351-42d7-ad37-453f04af9836' class='xr-var-data-in' type='checkbox'><label for='data-03019e5f-0351-42d7-ad37-453f04af9836' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-4, -3, -2, -1], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>target</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>False False False False</div><input id='attrs-e1d3babf-0dfa-4089-94aa-7eb0bc6cb418' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e1d3babf-0dfa-4089-94aa-7eb0bc6cb418' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a862fc75-0a69-4ffb-b3f7-f8d46fb2ca33' class='xr-var-data-in' type='checkbox'><label for='data-a862fc75-0a69-4ffb-b3f7-f8d46fb2ca33' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([False, False, False, False])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>int16</div><div class='xr-var-preview xr-preview'>-1 1</div><input id='attrs-7326887e-1985-4080-9fa9-6c0d27ff8807' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7326887e-1985-4080-9fa9-6c0d27ff8807' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-74d94f87-c069-4d25-a7bb-7a06b75cdf65' class='xr-var-data-in' type='checkbox'><label for='data-74d94f87-c069-4d25-a7bb-7a06b75cdf65' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-1, 1], dtype=int16)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>38.05 29.58</div><input id='attrs-27c1034b-6ee2-4899-95bf-579b5843e244' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-27c1034b-6ee2-4899-95bf-579b5843e244' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-33e5b00a-86e0-469e-aedc-589454fa5b37' class='xr-var-data-in' type='checkbox'><label for='data-33e5b00a-86e0-469e-aedc-589454fa5b37' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([38.04510914, 29.58134561])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>221.1 188.1</div><input id='attrs-98a77891-383d-4b25-be74-07faad3f6751' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-98a77891-383d-4b25-be74-07faad3f6751' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-72a9cfb2-553b-4d56-a138-3670d0a9a291' class='xr-var-data-in' type='checkbox'><label for='data-72a9cfb2-553b-4d56-a138-3670d0a9a291' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([221.11227597, 188.12201842])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-f3ebff15-f332-4b44-9854-055b081525cd' class='xr-section-summary-in' type='checkbox' checked><label for='section-f3ebff15-f332-4b44-9854-055b081525cd' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>data :</span></dt><dd>Clustered data with Response Guided Dimensionality Reduction.</dd><dt><span>coordinates :</span></dt><dd>Latitudes and longitudes are geographical centers associated with clusters.</dd></dl></div></li></ul></div></div>"
+ ],
+ "text/plain": [
+ "<xarray.DataArray 'sst' (anchor_year: 40, i_interval: 4, cluster_labels: 2)>\n",
+ "289.6 298.0 289.9 297.8 290.6 297.9 ... 290.1 297.4 290.7 297.6 291.1 298.2\n",
+ "Coordinates:\n",
+ " * anchor_year (anchor_year) int64 2018 2017 2016 2015 ... 1981 1980 1979\n",
+ " * i_interval (i_interval) int64 -4 -3 -2 -1\n",
+ " target (i_interval) bool False False False False\n",
+ " * cluster_labels (cluster_labels) int16 -1 1\n",
+ " latitude (cluster_labels) float64 38.05 29.58\n",
+ " longitude (cluster_labels) float64 221.1 188.1\n",
+ "Attributes:\n",
+ " data: Clustered data with Response Guided Dimensionality Reduction.\n",
+ " coordinates: Latitudes and longitudes are geographical centers associate..."
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "clustered_data = rgdr.transform(precursor_field)\n",
+ "clustered_data"
]
},
{
diff --git a/pyproject.toml b/pyproject.toml
index 7bcebb3..34d5704 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,6 +10,14 @@ branch = true
source = ["s2spy"]
command_line = "-m pytest"
+[tool.coverage.report]
+exclude_lines = [
+ "pragma: no cover",
+ "@overload",
+ "if TYPE_CHECKING:",
+ "if typing.TYPE_CHECKING:"
+]
+
[tool.tox]
legacy_tox_ini = """
diff --git a/s2spy/_resample.py b/s2spy/_resample.py
index 866cdb2..d64463a 100644
--- a/s2spy/_resample.py
+++ b/s2spy/_resample.py
@@ -1,10 +1,20 @@
+from typing import TYPE_CHECKING
from typing import Union
+from typing import overload
import numpy as np
import pandas as pd
import xarray as xr
from . import utils
+if TYPE_CHECKING:
+ from s2spy.time import AdventCalendar
+ from s2spy.time import Calendar
+ from s2spy.time import MonthlyCalendar
+ from s2spy.time import WeeklyCalendar
+ Calendars = Union[Calendar, AdventCalendar, WeeklyCalendar, MonthlyCalendar]
+
+
PandasData = (pd.Series, pd.DataFrame)
XArrayData = (xr.DataArray, xr.Dataset)
@@ -209,8 +219,24 @@ def resample_dataset(calendar, input_data: xr.Dataset) -> xr.Dataset:
return data.transpose("anchor_year", "i_interval", ...)
+@overload
+def resample(
+ mapped_calendar: "Calendars",
+ input_data: Union[xr.DataArray, xr.Dataset]
+) -> xr.Dataset:
+ ...
+
+
+@overload
+def resample(
+ mapped_calendar: "Calendars",
+ input_data: Union[pd.Series, pd.DataFrame]
+) -> pd.DataFrame:
+ ...
+
+
def resample(
- mapped_calendar,
+ mapped_calendar: "Calendars",
input_data: Union[pd.Series, pd.DataFrame, xr.DataArray, xr.Dataset],
) -> Union[pd.DataFrame, xr.Dataset]:
"""Resample input data to the calendar frequency.
diff --git a/s2spy/rgdr/label_alignment.py b/s2spy/rgdr/label_alignment.py
index e3ba3d2..63b0784 100644
--- a/s2spy/rgdr/label_alignment.py
+++ b/s2spy/rgdr/label_alignment.py
@@ -10,7 +10,6 @@ from typing import Tuple
import numpy as np
import pandas as pd
import xarray as xr
-from s2spy.rgdr import utils
if TYPE_CHECKING:
@@ -240,8 +239,8 @@ def remove_overlapping_clusters(clusters: Set) -> Set:
def name_clusters(clusters: Set) -> Dict:
"""Gives each cluster a unique name.
- Note: the first 52 names will be from A - Z, and a - z. If more than 52 clusters are
- present, these will get names with two uppercase letters.
+ Note: the first 26 names will be from A - Z. If more than 26 clusters are present,
+ these will get names with two uppercase letters (AA - ZZ).
Args:
clusters: A set of different clusters. Each element is a list of clusters and
@@ -358,15 +357,14 @@ def _rename_datasets(
A list of the input clustered data, with the labels renamed.
"""
renamed = []
- for split, _rgdr in enumerate(rgdr_list):
+ for split, _ in enumerate(rgdr_list):
# A copy is required to not modify labels of the input data
data = copy(clustered_data[split])
- labels = data["cluster_labels"].values
- i_interval = str(_rgdr.cluster_map["i_interval"].values) # type: ignore
+ labels = data["cluster_labels"].values.astype("U2")
for cl in renaming_dict[split]:
- if f"i_interval:{i_interval}_cluster:{cl[0]}" not in labels:
+ if f"{cl[0]}" not in labels:
break
- labels[labels == f"i_interval:{i_interval}_cluster:{cl[0]}"] = cl[1]
+ labels[labels == f"{cl[0]}"] = cl[1]
data["cluster_labels"] = labels
renamed.append(data)
return renamed
@@ -375,7 +373,7 @@ def _rename_datasets(
def rename_labels(
rgdr_list: List["RGDR"], clustered_data: List[xr.DataArray]
) -> List[xr.DataArray]:
- """Renames labels of clustered data over different splits to have similar names.
+ """Returns a new object with renamed cluster labels aligned over different splits.
To aid in users comparing the clustering over different splits, this function tries
to match the clusters over different splits, and give clusters that are in the same
@@ -392,11 +390,10 @@ def rename_labels(
"""
n_splits = len(rgdr_list)
cluster_maps = [
- utils.cluster_labels_to_ints(
- rgdr_list[split].cluster_map.reset_coords() # type: ignore
- )
+ rgdr_list[split].cluster_map.reset_coords() # type: ignore
for split in range(n_splits)
]
+
cluster_map_ds = xr.concat(cluster_maps, dim="split")
clusters = get_overlapping_clusters(cluster_map_ds["cluster_labels"])
diff --git a/s2spy/rgdr/rgdr.py b/s2spy/rgdr/rgdr.py
index 5e85c22..ee676bb 100644
--- a/s2spy/rgdr/rgdr.py
+++ b/s2spy/rgdr/rgdr.py
@@ -1,14 +1,15 @@
"""Response Guided Dimensionality Reduction."""
import warnings
+from os import linesep
from typing import List
from typing import Optional
from typing import Tuple
-from typing import Type
from typing import TypeVar
-import matplotlib as mpl
+from typing import Union
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
+from matplotlib.collections import QuadMesh
from scipy.stats import pearsonr as _pearsonr
from sklearn.cluster import DBSCAN
from . import utils
@@ -80,7 +81,7 @@ def remove_small_area_clusters(ds: XrType, min_area_km2: float) -> XrType:
valid_clusters = np.array([c for c, a in zip(clusters, areas) if a > min_area_km2])
ds["cluster_labels"] = ds["cluster_labels"].where(
- np.isin(ds["cluster_labels"], valid_clusters), "0"
+ np.isin(ds["cluster_labels"], valid_clusters), 0
)
return ds
@@ -106,42 +107,29 @@ def add_gridcell_area(data: xr.DataArray):
def assert_clusters_present(data: xr.DataArray) -> None:
"""Asserts that any (non-'0') clusters are present in the data."""
- if "i_interval" in data.dims:
- n_clusters = np.zeros(data["i_interval"].size)
- for i, _ in enumerate(n_clusters):
- n_clusters[i] = np.unique(data.sel(i_interval=data["i_interval"][i]).cluster_labels).size
-
- if np.any(n_clusters == 1): # A single cluster is the '0' (leftovers) cluster.
- empty_lags = data["i_interval"].values[n_clusters == 1]
- warnings.warn(
- f"No significant clusters found in i_interval(s): i_interval={empty_lags}."
- )
-
- elif np.unique(data.cluster_labels).size == 1:
+ if np.unique(data.cluster_labels).size == 1:
warnings.warn("No significant clusters found in the input DataArray")
def _get_dbscan_clusters(
- data: xr.Dataset, coords: np.ndarray, i_interval: int, dbscan_params: dict
+ data: xr.Dataset, coords: np.ndarray, dbscan_params: dict
) -> np.ndarray:
"""Generates the DBSCAN cluster labels based on the correlation and p-value.
Args:
- data (xr.DataArray): DataArray of the precursor field, of only a single
+ data: DataArray of the precursor field, of only a single
i_interval. Requires the 'latitude' and 'longitude' dimensions to be stacked
into a "coords" dimension.
- coords (np.ndarray): 2-D array containing the coordinates of each (lat, lon) grid
+ coords: 2-D array containing the coordinates of each (lat, lon) grid
point, in radians.
- i_interval (int): The i_interval value of the input data.
- dbscan_params (dict): Dictionary containing the elements 'alpha', 'eps',
+ dbscan_params: Dictionary containing the elements 'alpha', 'eps',
'min_area_km2'. See the documentation of RGDR for more information.
Returns:
np.ndarray: 1-D array of the same length as `coords`, containing cluster labels
for every coordinate."""
- labels = np.zeros(len(coords), dtype="<U32")
- labels[:] = "0"
+ labels = np.zeros(len(coords), dtype=int)
for sign, sign_mask in zip([1, -1], [data["corr"] >= 0, data["corr"] < 0]):
mask = np.logical_and(data["p_val"] < dbscan_params["alpha"], sign_mask)
@@ -154,8 +142,7 @@ def _get_dbscan_clusters(
metric="haversine",
).fit(coords[mask])
- cluster_labels = sign * (db.labels_ + 1)
- labels[mask] = [f"i_interval:{i_interval}_cluster:{int(lbl)}" for lbl in cluster_labels]
+ labels[mask] = sign * (db.labels_ + 1)
return labels
@@ -187,27 +174,15 @@ def _find_clusters(
data = precursor.to_dataset()
data["corr"], data["p_val"] = corr, p_val # Will require less tracking of indices
- if "i_interval" not in data.dims:
- data = data.expand_dims("i_interval")
- i_intervals = data["i_interval"].values
-
data = data.stack(coord=["latitude", "longitude"])
coords = np.asarray(data["coord"].values.tolist())
coords = np.radians(coords)
- # Prepare labels, default value is 0 (not in cluster)
- labels = np.zeros((len(i_intervals), len(coords)), dtype="<U32")
-
- for i, i_interval in enumerate(i_intervals):
- labels[i] = _get_dbscan_clusters(
- data.sel(i_interval=i_interval), coords, i_interval, dbscan_params
- )
+ labels = _get_dbscan_clusters(data, coords, dbscan_params)
precursor = precursor.stack(coord=["latitude", "longitude"])
- if "i_interval" not in precursor.dims:
- precursor["cluster_labels"] = ("coord", labels[0])
- else:
- precursor["cluster_labels"] = (("i_interval", "coord"), labels)
+ precursor["cluster_labels"] = ("coord", labels)
+ precursor["cluster_labels"] = precursor["cluster_labels"].astype("int16")
precursor = precursor.unstack(("coord"))
return precursor
@@ -240,13 +215,11 @@ def masked_spherical_dbscan(
xr.DataArray: Precursor data grouped by the DBSCAN clusters.
"""
precursor = add_gridcell_area(precursor)
-
precursor = _find_clusters(precursor, corr, p_val, dbscan_params)
if dbscan_params["min_area"] is not None:
precursor = remove_small_area_clusters(precursor, dbscan_params["min_area"])
- # Make sure a cluster is present in each i_interval
assert_clusters_present(precursor)
return precursor
@@ -323,11 +296,31 @@ def regression(field, target):
raise NotImplementedError
+def stack_input_data(precursor, target, precursor_intervals, target_intervals):
+ target = target.sel(i_interval=target_intervals).stack(
+ anch_int=["anchor_year", "i_interval"]
+ )
+ precursor = precursor.sel(i_interval=precursor_intervals).stack(
+ anch_int=["anchor_year", "i_interval"]
+ )
+
+ precursor = precursor.drop_vars({"anchor_year", "anch_int", "i_interval"})
+ target = target.drop_vars({"anchor_year", "anch_int", "i_interval"})
+
+ precursor["anch_int"] = range(precursor["anch_int"].size)
+ target["anch_int"] = range(target["anch_int"].size)
+
+ return precursor, target
+
+
class RGDR:
"""Response Guided Dimensionality Reduction."""
+ # pylint: disable=too-many-arguments
def __init__(
self,
+ target_intervals: Union[int, List[int]],
+ lag: int,
eps_km: float,
alpha: float,
min_area_km2: Optional[float] = None,
@@ -338,6 +331,13 @@ class RGDR:
target timeseries.
Args:
+ target_intervals: The target interval indices which should be correlated
+ with the precursors. Input in the form of "[1, 2, 3]" or "1"
+ The precursor intervals will be determined based on the `lag` kwarg.
+ lag: The lag between the precursor and target intervals to compute the
+ correlation, akin to lag in cross-correlation. E.g. if the target
+ intervals are [1, 2], and lag is 2, the precursor intervals will be
+ [-2, -1]
alpha (float): p-value below which the correlation is considered significant
enough for a location to be included in a cluster.
eps_km (float): The maximum distance (in km) between two grid cells for them
@@ -355,28 +355,72 @@ class RGDR:
smaller than this minimum area will be discarded.
Attributes:
- corr_map (float): correlation coefficient map of given precursor field and
+ corr_map: correlation coefficient map of given precursor field and
target series.
- pval_map (float): p-values map of correlation
- cluster_map (U32): cluster labels for precursor field masked by p-values
+ pval_map: p-values map of correlation
+ cluster_map: cluster labels for precursor field masked by p-values
"""
- self.corr_map: xr.DataArray
- self.pval_map: xr.DataArray
- self.cluster_map = None
- self._area = None
+ self._lag = lag
self._dbscan_params = {"eps": eps_km, "alpha": alpha, "min_area": min_area_km2}
+ self._target_intervals = (
+ [target_intervals]
+ if isinstance(target_intervals, int)
+ else target_intervals
+ )
+ self._precursor_intervals = utils.intervals_subtract(
+ self._target_intervals, lag
+ )
+
+ self._corr_map: Union[None, xr.DataArray] = None
+ self._pval_map: Union[None, xr.DataArray] = None
+ self._cluster_map: Union[None, xr.DataArray] = None
+
+ self._area = None
+
+ @property
+ def target_intervals(self) -> List[int]:
+ return self._target_intervals
+
+ @property
+ def precursor_intervals(self) -> List[int]:
+ return self._precursor_intervals
+
+ @property
+ def cluster_map(self) -> xr.DataArray:
+ if self._cluster_map is None:
+ raise ValueError(
+ "No cluster map exists yet, .fit() has to be called first."
+ )
+ return self._cluster_map
+
+ @property
+ def pval_map(self) -> xr.DataArray:
+ if self._pval_map is None:
+ raise ValueError(
+ "No p-value map exists yet, .fit() has to be called first."
+ )
+ return self._pval_map
+
+ @property
+ def corr_map(self) -> xr.DataArray:
+ if self._corr_map is None:
+ raise ValueError(
+ "No correlation map exists yet, .fit() has to be called first."
+ )
+ return self._corr_map
+
def get_correlation(
self,
precursor: xr.DataArray,
- timeseries: xr.DataArray,
+ target: xr.DataArray,
) -> Tuple[xr.DataArray, xr.DataArray]:
- """Calculates the correlation and p-value between input precursor and timeseries.
+ """Calculates the correlation and p-value between input precursor and target.
Args:
precursor: Precursor field data with the dimensions
'latitude', 'longitude', and 'anchor_year'
- timeseries: Timeseries data with only the dimension 'anchor_year'
+ target: Timeseries data with only the dimension 'anchor_year'
Returns:
(correlation, p_value): DataArrays containing the correlation and p-value.
@@ -384,62 +428,59 @@ class RGDR:
if not isinstance(precursor, xr.DataArray):
raise ValueError("Please provide an xr.DataArray, not a dataset")
- return correlation(precursor, timeseries, corr_dim="anchor_year")
+ p, t = stack_input_data(
+ precursor, target, self._precursor_intervals, self._target_intervals
+ )
+
+ return correlation(p, t, corr_dim="anch_int")
def get_clusters(
self,
precursor: xr.DataArray,
- timeseries: xr.DataArray,
+ target: xr.DataArray,
) -> xr.DataArray:
"""Generates clusters for the precursor data.
Args:
precursor: Precursor field data with the dimensions
- 'latitude', 'longitude', and 'anchor_year'
- timeseries: Timeseries data with only the dimension 'anchor_year'
+ 'latitude', 'longitude', 'anchor_year', and 'i_interval'
+ target: Target timeseries data with only the dimensions 'anchor_year' and
+ 'i_interval'
Returns:
DataArray containing the clusters as masks.
"""
- corr, p_val = self.get_correlation(precursor, timeseries)
+ corr, p_val = self.get_correlation(precursor, target)
return masked_spherical_dbscan(precursor, corr, p_val, self._dbscan_params)
- def preview_correlation( # pylint: disable=too-many-arguments
+ def preview_correlation(
self,
precursor: xr.DataArray,
- timeseries: xr.DataArray,
- i_interval: Optional[int] = None,
+ target: xr.DataArray,
+ add_alpha_hatch: bool = True,
ax1: Optional[plt.Axes] = None,
ax2: Optional[plt.Axes] = None,
- ) -> List[Type[mpl.collections.QuadMesh]]:
+ ) -> List[QuadMesh]:
"""Generates a figure showing the correlation and p-value results with the
initiated RGDR class and input precursor field.
Args:
precursor: Precursor field data with the dimensions
- 'latitude', 'longitude', and 'anchor_year'
- timeseries: Timeseries data with only the dimension 'anchor_year'
- i_interval: The i_interval which should be plotted. Required if the precursor
- has the dimension "i_interval".
- ax1: a matplotlib axis handle to plot
- the correlation values into. If None, an axis handle will be created
- instead.
- ax2: a matplotlib axis handle to plot
- the p-values into. If None, an axis handle will be created instead.
+ 'latitude', 'longitude', 'anchor_year', and 'i_interval'
+ target: Target timeseries data with only the dimensions 'anchor_year' and
+ 'i_interval'
+ add_alpha_hatch: Adds a red hatching when the p-value is lower than the
+ RGDR's 'alpha' value.
+ ax1: a matplotlib axis handle to plot the correlation values into.
+ If None, an axis handle will be created instead.
+ ax2: a matplotlib axis handle to plot the p-values into. If None, an axis
+ handle will be created instead.
Returns:
- List[mpl.collections.QuadMesh]: List of matplotlib artists.
+ List of matplotlib QuadMesh artists.
"""
- if "i_interval" in precursor.dims:
- if i_interval is None:
- raise ValueError(
- "Precursor contains multiple intervals, please provide"
- " the i_interval which should be plotted."
- )
- precursor = precursor.sel(i_interval=i_interval)
-
- corr, p_val = self.get_correlation(precursor, timeseries)
+ corr, p_val = self.get_correlation(precursor, target)
if (ax1 is None) and (ax2 is None):
_, (ax1, ax2) = plt.subplots(ncols=2)
@@ -448,8 +489,19 @@ class RGDR:
"Either pass axis handles for both ax1 and ax2, or pass neither."
)
- plot1 = corr.plot.pcolormesh(ax=ax1, cmap="viridis") # type: ignore
- plot2 = p_val.plot.pcolormesh(ax=ax2, cmap="viridis") # type: ignore
+ plot1 = corr.plot.pcolormesh(ax=ax1, cmap="coolwarm") # type: ignore
+ plot2 = p_val.plot.pcolormesh(ax=ax2, cmap="viridis_r", vmin=0, vmax=1) # type: ignore
+
+ if add_alpha_hatch:
+ coords = plot2.get_coordinates()
+ plt.rcParams["hatch.color"] = "r"
+ plt.pcolor(
+ coords[:, :, 0],
+ coords[:, :, 1],
+ p_val.where(p_val < self._dbscan_params["alpha"]).values,
+ hatch="x",
+ alpha=0.0,
+ )
ax1.set_title("correlation")
ax2.set_title("p-value")
@@ -459,44 +511,34 @@ class RGDR:
def preview_clusters(
self,
precursor: xr.DataArray,
- timeseries: xr.DataArray,
- i_interval: Optional[int] = None,
+ target: xr.DataArray,
ax: Optional[plt.Axes] = None,
- **kwargs
- ) -> Type[mpl.collections.QuadMesh]:
+ **kwargs,
+ ) -> QuadMesh:
"""Generates a figure showing the clusters resulting from the initiated RGDR
class and input precursor field.
Args:
precursor: Precursor field data with the dimensions
- 'latitude', 'longitude', and 'anchor_year'
- timeseries: Timeseries data with only the dimension 'anchor_year'
- i_interval: The i_interval which should be plotted. Required if the precursor
- has the dimension "i_interval".
+ 'latitude', 'longitude', 'anchor_year', and 'i_interval'
+ target: Target timeseries data with only the dimensions 'anchor_year' and
+ 'i_interval'
ax (plt.Axes, optional): a matplotlib axis handle to plot the clusters
into. If None, an axis handle will be created instead.
Returns:
- matplotlib.collections.QuadMesh: Matplotlib artist.
+ Matplotlib QuadMesh artist.
"""
if ax is None:
_, ax = plt.subplots()
- clusters = self.get_clusters(precursor, timeseries)
+ clusters = self.get_clusters(precursor, target)
- if "i_interval" in precursor.dims:
- if i_interval is None:
- raise ValueError(
- "Precursor contains multiple intervals, please provide"
- " the i_interval which should be plotted."
- )
- clusters = clusters.sel(i_interval=i_interval)
+ return clusters["cluster_labels"].plot(
+ cmap="viridis", ax=ax, **kwargs
+ ) # type: ignore
- clusters = utils.cluster_labels_to_ints(clusters)
-
- return clusters["cluster_labels"].plot(cmap="viridis", ax=ax, **kwargs)
-
- def fit(self, precursor: xr.DataArray, timeseries: xr.DataArray):
+ def fit(self, precursor: xr.DataArray, target: xr.DataArray):
"""Fits RGDR clusters to precursor data.
Performs DBSCAN clustering on a prepared DataArray, and then groups the data by
@@ -513,28 +555,26 @@ class RGDR:
the label '0'.
Args:
- precursor: Precursor field data with the dimensions 'latitude', 'longitude',
- and 'anchor_year'
- timeseries: Timeseries data with only the dimension 'anchor_year', which
- will be correlated with the precursor field.
+ precursor: Precursor field data with the dimensions
+ 'latitude', 'longitude', 'anchor_year', and 'i_interval'
+ target: Target timeseries data with only the dimensions 'anchor_year' and
+ 'i_interval', which will be correlated with the precursor field.
Returns:
xr.DataArray: The precursor data, with the latitute and longitude dimensions
reduced to clusters.
"""
- corr, p_val = correlation(precursor, timeseries, corr_dim="anchor_year")
+ corr, p_val = self.get_correlation(precursor, target)
masked_data = masked_spherical_dbscan(
precursor, corr, p_val, self._dbscan_params
)
- self.corr_map = corr
- self.pval_map = p_val
- self.cluster_map = masked_data.cluster_labels
+ self._corr_map = corr
+ self._pval_map = p_val
+ self._cluster_map = masked_data.cluster_labels
self._area = masked_data.area
- return self
-
def transform(self, data: xr.DataArray) -> xr.DataArray:
"""Apply RGDR on the input data, based on the previous fit.
@@ -546,6 +586,7 @@ class RGDR:
raise ValueError(
"Transform requires the model to be fit on other data first"
)
+ data = data.sel(i_interval=self._precursor_intervals)
data["cluster_labels"] = self.cluster_map
data["area"] = self._area
@@ -556,11 +597,15 @@ class RGDR:
# Add the geographical centers for later alignment between, e.g., splits
reduced_data = utils.geographical_cluster_center(data, reduced_data)
# Include explanations about geographical centers as attributes
- reduced_data.attrs['data'] = "Clustered data with Response Guided Dimensionality Reduction."
- reduced_data.attrs['coordinates'] = "Latitudes and longitudes are geographical centers associated with clusters."
+ reduced_data.attrs[
+ "data"
+ ] = "Clustered data with Response Guided Dimensionality Reduction."
+ reduced_data.attrs[
+ "coordinates"
+ ] = "Latitudes and longitudes are geographical centers associated with clusters."
# Remove the '0' cluster
- reduced_data = reduced_data.where(reduced_data["cluster_labels"] != "0").dropna(
+ reduced_data = reduced_data.where(reduced_data["cluster_labels"] != 0).dropna(
dim="cluster_labels"
)
@@ -582,3 +627,18 @@ class RGDR:
self.fit(precursor, timeseries)
return self.transform(precursor)
+
+ def __repr__(self) -> str:
+ """String representation of the RGDR transformer."""
+ props = [
+ ("target_intervals", repr(self.target_intervals)),
+ ("lag", repr(self._lag)),
+ ("eps_km", repr(self._dbscan_params["eps"])),
+ ("alpha", repr(self._dbscan_params["alpha"])),
+ ("min_area_km2", repr(self._dbscan_params["min_area"])),
+ ]
+
+ propstr = f"{linesep}\t" + f",{linesep}\t".join(
+ [f"{k}={v}" for k, v in props]
+ ) # sourcery skip: use-fstring-for-concatenation
+ return f"{self.__class__.__name__}({propstr}{linesep})".replace("\t", " ")
diff --git a/s2spy/rgdr/utils.py b/s2spy/rgdr/utils.py
index b06dd61..b7c7ee8 100644
--- a/s2spy/rgdr/utils.py
+++ b/s2spy/rgdr/utils.py
@@ -1,3 +1,4 @@
+from typing import List
from typing import TypeVar
import numpy as np
import xarray as xr
@@ -14,12 +15,13 @@ def weighted_groupby(
(https://github.com/pydata/xarray/pull/5480), but this branch was never merged.
Args:
- ds (xr.DataArray or xr.Dataset): Data containing the coordinates or variables
+ ds: Data containing the coordinates or variables
specified in the `groupby` and `weight` kwargs.
- groupby (str): Coordinate which should be used to make the groups.
- weight (str): Variable in the Dataset containing the weights that should be used.
- method (str): Method that should be used to reduce the dataset, by default
- 'mean'. Supports any of xarray's builtin methods, e.g. median, min, max.
+ groupby: Coordinate which should be used to make the groups.
+ weight: Variable in the Dataset containing the weights that should be used.
+ method: Method that should be used to reduce the dataset, by default
+ 'mean'. Supports any of xarray's builtin methods, e.g. 'median', 'min',
+ 'max'.
Returns:
Same as input: Dataset reduced using the `groupby` coordinate, using weights =
@@ -30,15 +32,13 @@ def weighted_groupby(
# find stacked dim name
group0 = list(groups)[0][1]
dims = list(group0.dims)
- stacked_dims = [
- dim for dim in dims if "stacked_" in str(dim)
- ] # str() is just for mypy
+ stacked_dims = [dim for dim in dims if "stacked_" in str(dim)]
reduced_groups = [
getattr(g.weighted(g[weight]), method)(dim=stacked_dims) for _, g in groups
]
- reduced_data: XrType
- reduced_data = xr.concat(reduced_groups, dim=groupby)
+
+ reduced_data: XrType = xr.concat(reduced_groups, dim=groupby)
if isinstance(reduced_data, xr.DataArray): # Add back the labels of the groupby dim
reduced_data[groupby] = np.unique(ds[groupby])
@@ -73,16 +73,12 @@ def geographical_cluster_center(
)
if "i_interval" in cluster_area.dims:
- cluster_area = cluster_area.dropna('i_interval', how='all')
+ cluster_area = cluster_area.dropna("i_interval", how="all")
cluster_area = cluster_area.dropna("coords")
# Area weighted mean to get the geographical center of the cluster
- cluster_lats[i] = (
- cluster_area["latitude"].weighted(cluster_area).mean().item()
- )
- cluster_lons[i] = (
- cluster_area["longitude"].weighted(cluster_area).mean().item()
- )
+ cluster_lats[i] = cluster_area["latitude"].weighted(cluster_area).mean().item()
+ cluster_lons[i] = cluster_area["longitude"].weighted(cluster_area).mean().item()
reduced_data["latitude"] = ("cluster_labels", cluster_lats)
reduced_data["longitude"] = ("cluster_labels", cluster_lons)
@@ -90,23 +86,13 @@ def geographical_cluster_center(
return reduced_data
-def cluster_labels_to_ints(clustered_data: xr.DataArray) -> xr.DataArray:
- """Converts the labels of already clustered data to integers.
-
- Args:
- clustered_data: Data already clustered and grouped by cluster.
-
- Returns:
- Same as input, but with the labels converted to integers
- """
- un_labels = np.unique(clustered_data.cluster_labels)
- label_vals = [int(lb[-2:].replace(":","")) for lb in un_labels]
- label_lookup = dict(zip(un_labels, label_vals))
+def intervals_subtract(intervals: List[int], n: int) -> List[int]:
+ """Subtracts n from the interval indices, skipping 0."""
+ if n < 0:
+ raise ValueError("Lag values below 0 are not supported")
- clustered_data['cluster_labels'] = xr.apply_ufunc(
- lambda val: label_lookup[val],
- clustered_data['cluster_labels'],
- vectorize=True
- )
-
- return clustered_data
+ lag_intervals = [i - n for i in intervals]
+ # pylint: disable=chained-comparison
+ return [
+ i - 1 if (i <= 0 and j > 0) else i for i, j in zip(lag_intervals, intervals)
+ ]
|
Supporting multiple target intervals in `map_correlation`.
Currently `rgdr`'s `map_correlation` implementation will calculate the correlation coefficient and p-value between precursor data and target data. It will calculate this over the `anchor_year` dim, for every dimension in the input data (e.g. `latitude`, `longitude`, `i_interval`).
However, it does not take into account the Calendar's `n_targets`, more specifically the case where multiple intervals are labelled as target.
A wrapper function is required to handle this. In the case of multiple target intervals, the precursor data and field data for those intervals are flattened over the `i_interval` dimension.
The following image serves as a visualization for this concept:
[](https://nlesc.sharepoint.com/:p:/s/team-beta/EZHgy9Agmd5EieXKWuAUhLgB2eCOxRZaIRfDuStLq8b23w?e=53nCDX)
|
AI4S2S/s2spy
|
diff --git a/tests/test_rgdr/test_alignment.py b/tests/test_rgdr/test_alignment.py
index 8cff79a..69bd451 100644
--- a/tests/test_rgdr/test_alignment.py
+++ b/tests/test_rgdr/test_alignment.py
@@ -1,5 +1,4 @@
import numpy as np
-import pandas as pd
import pytest
import xarray as xr
from sklearn.model_selection import ShuffleSplit
@@ -138,14 +137,13 @@ def raw_field():
@pytest.fixture(autouse=True, scope="class")
def example_field(raw_field, dummy_calendar):
cal = dummy_calendar.map_to_data(raw_field)
- return resample(cal, raw_field).sst.sel(i_interval=-5)
+ return resample(cal, raw_field).sst
@pytest.fixture(autouse=True, scope="class")
def example_target(raw_target, raw_field, dummy_calendar):
cal = dummy_calendar.map_to_data(raw_field)
- return resample(cal, raw_target).ts.sel(i_interval=1)
-
+ return resample(cal, raw_target).ts
def test_alignment_example(example_field, example_target):
seed = 1 #same 'randomness'
@@ -154,11 +152,19 @@ def test_alignment_example(example_field, example_target):
shufflesplit = ShuffleSplit(n_splits=n_splits, test_size=0.25, random_state = seed)
cv = s2spy.traintest.TrainTestSplit(shufflesplit)
- rgdrs = [RGDR(eps_km=800, alpha=0.10, min_area_km2=0) for _ in range(n_splits)]
+ rgdrs = [
+ RGDR(
+ target_intervals=[1],
+ lag=5,
+ eps_km=800,
+ alpha=0.10,
+ min_area_km2=0
+ ) for _ in range(n_splits)
+ ]
target_timeseries_splits = []
precursor_field_splits = []
- for x_train, x_test, y_train, y_test in cv.split(example_field, y=example_target):
+ for x_train, _, _, _ in cv.split(example_field, y=example_target):
target_timeseries_splits.append(
example_target.sel(anchor_year=x_train["anchor_year"].values))
precursor_field_splits.append(
@@ -174,7 +180,7 @@ def test_alignment_example(example_field, example_target):
clustered_precursors
)
- expected = [['A'], ['A', 'C'], ['A'], ['B', 'A']]
+ expected = [['A'], ['A', 'C'], ['A'], ['A', 'B']]
clusters_list = [list(el.cluster_labels.values) for el in aligned_precursors]
- print(clusters_list)
+
assert expected == clusters_list
diff --git a/tests/test_rgdr/test_rgdr.py b/tests/test_rgdr/test_rgdr.py
index c396ae7..5a9170e 100644
--- a/tests/test_rgdr/test_rgdr.py
+++ b/tests/test_rgdr/test_rgdr.py
@@ -8,7 +8,7 @@ import xarray as xr
from s2spy import RGDR
from s2spy.rgdr import rgdr
from s2spy.rgdr import utils
-from s2spy.time import AdventCalendar
+from s2spy.time import Calendar
from s2spy.time import resample
@@ -24,7 +24,10 @@ matplotlib.use("Agg")
@pytest.fixture(autouse=True, scope="class")
def dummy_calendar():
- return AdventCalendar(anchor="8-2", freq="30d")
+ cal = Calendar(anchor="08-01")
+ cal.add_intervals("target", length="1M", n=4)
+ cal.add_intervals("precursor", length="1M", n=4)
+ return cal
@pytest.fixture(autouse=True, scope="module")
@@ -40,37 +43,35 @@ def raw_field():
@pytest.fixture(autouse=True, scope="class")
-def example_field(raw_field, dummy_calendar):
+def example_precursor_field(raw_field, dummy_calendar):
cal = dummy_calendar.map_to_data(raw_field)
- return resample(cal, raw_field).sst.sel(i_interval=-1)
+ return resample(cal, raw_field).sst
@pytest.fixture(autouse=True, scope="class")
-def example_field_multiple_lags(raw_field, dummy_calendar):
+def example_target_timeseries(raw_target, raw_field, dummy_calendar):
cal = dummy_calendar.map_to_data(raw_field)
- return resample(cal, raw_field).sst.sel(i_interval=slice(-3, -1))
-
-
[email protected](autouse=True, scope="class")
-def example_target(raw_target, raw_field, dummy_calendar):
- cal = dummy_calendar.map_to_data(raw_field)
- return resample(cal, raw_target).ts.sel(i_interval=1)
+ return resample(cal, raw_target).ts
@pytest.fixture(scope="class")
-def example_corr(example_target, example_field):
- return rgdr.correlation(example_field, example_target, corr_dim="anchor_year")
+def example_corr(example_target_timeseries, example_precursor_field):
+ return rgdr.correlation(
+ example_precursor_field.sel(i_interval=-4),
+ example_target_timeseries.sel(i_interval=1),
+ corr_dim="anchor_year"
+ )
@pytest.fixture(autouse=True, scope="class")
def expected_labels():
return np.array(
[
- [0.0, 0.0, 0.0, 0.0, -1.0, -1.0, 0.0, -2.0, -2.0, -2.0, 0.0, 0.0, 0.0],
- [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, -2.0, -2.0, 0.0, 0.0],
- [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, -2.0, -2.0, 0.0, 0.0],
- [0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, 0.0, 0.0],
- [1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, -2.0, -2.0, -2.0, -2.0],
+ [ 0, 0, 0, -1, -1, 0, 0, -2, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
]
)
@@ -78,18 +79,32 @@ def expected_labels():
class TestUtils:
"""Validates the various utility functions used in RGDR"""
- testdata = [ # lat, dlat, dlon, area
+ testdata_spherical_area = [ # lat, dlat, dlon, area
(-1, 2, 2, 49500),
(45, 5, 5, 218500),
(45, 5, 2.5, 109250)
]
- @pytest.mark.parametrize("lat,dlat,dlon,expected", testdata)
+ @pytest.mark.parametrize("lat, dlat, dlon, expected", testdata_spherical_area)
def test_spherical_area(self, lat, dlat, dlon, expected):
np.testing.assert_allclose(
rgdr.spherical_area(lat, dlat, dlon), expected, rtol=0.05
)
+ testdata_intervals = [ # target_intervals, lag, precursor_intervals
+ ([2], 1, [1]),
+ ([1], 1, [-1]),
+ ([-1], 1, [-2]),
+ ([1, 2, 3, 4], 4, [-4, -3, -2, -1]),
+ ]
+ @pytest.mark.parametrize("intervals, lag, expected", testdata_intervals)
+ def test_intervals_subtract(self, intervals, lag, expected):
+ assert utils.intervals_subtract(intervals, lag) == expected
+
+ def test_intervals_subtract_neg(self):
+ with pytest.raises(ValueError):
+ utils.intervals_subtract([1], -1)
+
class TestCorrelation:
"""Validates that the correlation ufunc works, as well as the input checks."""
@@ -113,12 +128,12 @@ class TestCorrelation:
return dummy_dataarray.isel(lat=0, lon=0).drop_vars(["lat", "lon"])
def test_pearsonr(self):
- result = rgdr._pearsonr_nan([0, 0, 1], [0, 1, 1])
+ result = rgdr._pearsonr_nan([0, 0, 1], [0, 1, 1]) # type: ignore
expected = (0.5, 0.66666667)
np.testing.assert_array_almost_equal(result, expected)
def test_pearsonr_nan(self):
- result = rgdr._pearsonr_nan([np.nan, 0, 1], [0, 1, 1])
+ result = rgdr._pearsonr_nan([np.nan, 0, 1], [0, 1, 1]) # type: ignore
expected = (np.nan, np.nan)
np.testing.assert_array_almost_equal(result, expected)
@@ -165,124 +180,130 @@ class TestDBSCAN:
@pytest.fixture(autouse=True)
def dummy_dbscan_params(self):
- return {"alpha": 0.05, "eps": 600, "min_area": None}
+ return {"alpha": 0.025, "eps": 600, "min_area": None}
def test_dbscan(
- self, example_corr, example_field, dummy_dbscan_params, expected_labels
+ self, example_corr, example_precursor_field, dummy_dbscan_params, expected_labels
):
+
corr, p_val = example_corr
clusters = rgdr.masked_spherical_dbscan(
- example_field, corr, p_val, dummy_dbscan_params
+ example_precursor_field, corr, p_val, dummy_dbscan_params
)
- clusters = utils.cluster_labels_to_ints(clusters)
np.testing.assert_array_equal(clusters["cluster_labels"], expected_labels)
def test_dbscan_min_area(
- self, example_corr, example_field, dummy_dbscan_params, expected_labels
+ self, example_corr, example_precursor_field, dummy_dbscan_params, expected_labels
):
corr, p_val = example_corr
dbscan_params = dummy_dbscan_params
dbscan_params["min_area"] = 1000**2
clusters = rgdr.masked_spherical_dbscan(
- example_field, corr, p_val, dbscan_params
+ example_precursor_field, corr, p_val, dbscan_params
)
- clusters = utils.cluster_labels_to_ints(clusters)
expected_labels[expected_labels == -1] = 0 # Small -1 cluster is missing
np.testing.assert_array_equal(clusters["cluster_labels"], expected_labels)
+rgdr_test_config = dict(
+ target_intervals=[1],
+ lag=4,
+ eps_km=600,
+ alpha=0.025,
+ min_area_km2=0
+)
+
+
class TestRGDR:
"""Test RGDR and its methods."""
@pytest.fixture(autouse=True)
def dummy_rgdr(self):
- return RGDR(eps_km=600, alpha=0.05, min_area_km2=1000**2)
+ return RGDR(**rgdr_test_config) # type: ignore
def test_init(self):
- rgdr = RGDR(eps_km=600, alpha=0.05, min_area_km2=1000**2)
+ rgdr = RGDR(**rgdr_test_config) # type: ignore
assert isinstance(rgdr, RGDR)
- def test_transform_before_fit(self, dummy_rgdr, example_field):
+ def test_target_intervals(self, dummy_rgdr):
+ assert dummy_rgdr.target_intervals == [1]
+
+ def test_precursor_intervals(self, dummy_rgdr):
+ assert dummy_rgdr.precursor_intervals == [-4]
+
+ def test_repr(self, dummy_rgdr):
+ eval(repr(dummy_rgdr)) # pylint: disable=eval-used
+
+ @pytest.mark.parametrize("prop", ("cluster_map", "pval_map", "corr_map"))
+ def test_fitted_properties_err(self, dummy_rgdr, prop):
+ with pytest.raises(ValueError):
+ getattr(dummy_rgdr, prop)
+
+ def test_transform_before_fit(self, dummy_rgdr, example_precursor_field):
"Should fail as RGDR first has to be fit to (training) data."
with pytest.raises(ValueError):
- dummy_rgdr.transform(example_field)
+ dummy_rgdr.transform(example_precursor_field)
- def test_fit(self, dummy_rgdr, example_field, example_target):
- dummy_rgdr.fit(example_field, example_target)
+ def test_fit(self, dummy_rgdr, example_precursor_field, example_target_timeseries):
+ dummy_rgdr.fit(example_precursor_field, example_target_timeseries)
assert dummy_rgdr._area is not None
- def test_transform(self, dummy_rgdr, example_field, example_target):
- dummy_rgdr.fit(example_field, example_target)
- clustered_data = dummy_rgdr.transform(example_field)
- clustered_data = utils.cluster_labels_to_ints(clustered_data)
- expected_labels = np.array([-2, 1])
+ def test_transform(self, dummy_rgdr, example_precursor_field, example_target_timeseries):
+ dummy_rgdr.fit(example_precursor_field, example_target_timeseries)
+ clustered_data = dummy_rgdr.transform(example_precursor_field)
+
+ expected_labels = np.array([-2, -1], dtype='int16')
np.testing.assert_array_equal(clustered_data["cluster_labels"], expected_labels)
- def test_fit_transform_fits(self, example_field, example_target):
+ def test_fit_transform_fits(self, example_precursor_field, example_target_timeseries):
# Ensures that after fit_transform, the rgdr object is fit.
- rgdr = RGDR(eps_km=600, alpha=0.05)
- _ = rgdr.fit_transform(example_field, example_target)
+ rgdr = RGDR(**rgdr_test_config) # type: ignore
+ _ = rgdr.fit_transform(example_precursor_field, example_target_timeseries)
assert rgdr._area is not None
- def test_fit_transform(self, example_field, example_target):
- rgdr = RGDR(eps_km=600, alpha=0.05, min_area_km2=1000**2)
- clustered_data = rgdr.fit_transform(example_field, example_target)
+ def test_fit_transform(self, example_precursor_field, example_target_timeseries):
+ rgdr = RGDR(**rgdr_test_config) # type: ignore
+ clustered_data = rgdr.fit_transform(example_precursor_field, example_target_timeseries)
expected_labels = np.array(
- ["i_interval:-1_cluster:-2", "i_interval:-1_cluster:1"]
+ [-2, -1], dtype='int16'
)
np.testing.assert_array_equal(clustered_data["cluster_labels"], expected_labels)
- def test_fit_transform_multiple_lags(
- self, example_field_multiple_lags, example_target
- ):
- rgdr = RGDR(eps_km=600, alpha=0.05)
- clustered_data = rgdr.fit_transform(example_field_multiple_lags, example_target)
- expected_labels = np.array(
- [
- "i_interval:-1_cluster:-1", "i_interval:-1_cluster:-2",
- "i_interval:-1_cluster:1", "i_interval:-2_cluster:-1",
- "i_interval:-2_cluster:1", "i_interval:-3_cluster:-1",
- "i_interval:-3_cluster:1"
- ]
- )
- np.testing.assert_array_equal(clustered_data["cluster_labels"], expected_labels)
+ @pytest.mark.parametrize("prop", ("cluster_map", "pval_map", "corr_map"))
+ def test_fitted_properties(self, dummy_rgdr, example_precursor_field, example_target_timeseries, prop):
+ dummy_rgdr.fit(example_precursor_field, example_target_timeseries)
+ getattr(dummy_rgdr, prop)
- def test_corr_preview(self, dummy_rgdr, example_field, example_target):
- dummy_rgdr.preview_correlation(example_field, example_target)
-
- def test_corr_preview_multiple_lags(
- self, dummy_rgdr, example_field_multiple_lags, example_target
- ):
- dummy_rgdr.preview_correlation(example_field_multiple_lags, example_target, i_interval=-1)
-
- def test_corr_preview_multiple_lags_fail(
- self, dummy_rgdr, example_field_multiple_lags, example_target
- ):
- with pytest.raises(ValueError):
- dummy_rgdr.preview_correlation(example_field_multiple_lags, example_target)
+ def test_corr_preview(self, dummy_rgdr, example_precursor_field, example_target_timeseries):
+ dummy_rgdr.preview_correlation(example_precursor_field, example_target_timeseries)
- def test_corr_plot_ax(self, dummy_rgdr, example_field, example_target):
+ def test_corr_plot_ax(self, dummy_rgdr, example_precursor_field, example_target_timeseries):
_, (ax1, ax2) = plt.subplots(ncols=2)
- dummy_rgdr.preview_correlation(example_field, example_target, ax1=ax1, ax2=ax2)
+ dummy_rgdr.preview_correlation(example_precursor_field, example_target_timeseries, ax1=ax1, ax2=ax2)
- def test_cluster_plot(self, dummy_rgdr, example_field, example_target):
- dummy_rgdr.preview_clusters(example_field, example_target)
+ def test_cluster_plot(self, dummy_rgdr, example_precursor_field, example_target_timeseries):
+ dummy_rgdr.preview_clusters(example_precursor_field, example_target_timeseries)
- def test_cluster_preview_multiple_lags(
- self, dummy_rgdr, example_field_multiple_lags, example_target
- ):
- dummy_rgdr.preview_clusters(example_field_multiple_lags, example_target, i_interval=-1)
+ def test_cluster_plot_ax(self, dummy_rgdr, example_precursor_field, example_target_timeseries):
+ _, ax = plt.subplots()
+ dummy_rgdr.preview_clusters(example_precursor_field, example_target_timeseries, ax=ax)
+
+ def test_multiple_targets(self, example_precursor_field, example_target_timeseries):
+ rgdr = RGDR(
+ target_intervals=[1, 2],
+ lag=4,
+ eps_km=600,
+ alpha=0.025,
+ min_area_km2=0
+ )
- def test_cluster_preview_multiple_lags_fail(
- self, dummy_rgdr, example_field_multiple_lags, example_target
- ):
- with pytest.raises(ValueError):
- dummy_rgdr.preview_clusters(example_field_multiple_lags, example_target)
+ clustered_data = rgdr.fit_transform(example_precursor_field, example_target_timeseries)
- def test_cluster_plot_ax(self, dummy_rgdr, example_field, example_target):
- _, ax = plt.subplots()
- dummy_rgdr.preview_clusters(example_field, example_target, ax=ax)
+ expected_labels = np.array(
+ [-2, -1], dtype='int16'
+ )
+ np.testing.assert_array_equal(clustered_data["cluster_labels"], expected_labels)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": -1,
"issue_text_score": 0,
"test_score": -1
},
"num_modified_files": 7
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
astroid==2.13.5
babel==2.17.0
bokeh==2.4.3
build==1.2.2.post1
bump2version==1.0.1
cachetools==5.5.2
certifi==2025.1.31
cftime==1.6.4.post1
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dill==0.3.9
distlib==0.3.9
docutils==0.21.2
dodgy==0.2.1
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
flake8==4.0.1
flake8-polyfill==1.0.2
fonttools==4.56.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==5.13.2
Jinja2==3.1.6
joblib==1.4.2
kiwisolver==1.4.7
lazy-object-proxy==1.10.0
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.9.4
mccabe==0.6.1
mdit-py-plugins==0.4.2
mdurl==0.1.2
mypy==0.981
mypy-extensions==1.0.0
myst-parser==3.0.1
netCDF4==1.7.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pep8-naming==0.10.0
pillow==11.1.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prospector==1.7.7
pycodestyle==2.8.0
pydocstyle==6.3.0
pyflakes==2.4.0
Pygments==2.19.1
pylint==2.15.6
pylint-celery==0.3
pylint-django==2.5.3
pylint-flask==0.6
pylint-plugin-utils==0.7
pyparsing==3.2.3
pyproject-api==1.9.0
pyproject_hooks==1.2.0
pyroma==4.2
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
requirements-detector==0.7
-e git+https://github.com/AI4S2S/s2spy.git@74a971101a64b7d0024cfdfd5ad9382c12752760#egg=s2spy
scikit-learn==1.6.1
scipy==1.13.1
setoptconf-tmp==0.3.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-autoapi==3.6.0
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stdlib-list==0.11.1
threadpoolctl==3.6.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
tornado==6.4.2
tox==4.25.0
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
virtualenv==20.29.3
wrapt==1.17.2
xarray==2024.7.0
zipp==3.21.0
|
name: s2spy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- astroid==2.13.5
- babel==2.17.0
- bokeh==2.4.3
- build==1.2.2.post1
- bump2version==1.0.1
- cachetools==5.5.2
- certifi==2025.1.31
- cftime==1.6.4.post1
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dill==0.3.9
- distlib==0.3.9
- docutils==0.21.2
- dodgy==0.2.1
- filelock==3.18.0
- flake8==4.0.1
- flake8-polyfill==1.0.2
- fonttools==4.56.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- isort==5.13.2
- jinja2==3.1.6
- joblib==1.4.2
- kiwisolver==1.4.7
- lazy-object-proxy==1.10.0
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- matplotlib==3.9.4
- mccabe==0.6.1
- mdit-py-plugins==0.4.2
- mdurl==0.1.2
- mypy==0.981
- mypy-extensions==1.0.0
- myst-parser==3.0.1
- netcdf4==1.7.2
- numpy==2.0.2
- pandas==2.2.3
- pep8-naming==0.10.0
- pillow==11.1.0
- platformdirs==4.3.7
- prospector==1.7.7
- pycodestyle==2.8.0
- pydocstyle==6.3.0
- pyflakes==2.4.0
- pygments==2.19.1
- pylint==2.15.6
- pylint-celery==0.3
- pylint-django==2.5.3
- pylint-flask==0.6
- pylint-plugin-utils==0.7
- pyparsing==3.2.3
- pyproject-api==1.9.0
- pyproject-hooks==1.2.0
- pyroma==4.2
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- requirements-detector==0.7
- s2spy==0.2.1
- scikit-learn==1.6.1
- scipy==1.13.1
- setoptconf-tmp==0.3.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-autoapi==3.6.0
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- stdlib-list==0.11.1
- threadpoolctl==3.6.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- tornado==6.4.2
- tox==4.25.0
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- virtualenv==20.29.3
- wrapt==1.17.2
- xarray==2024.7.0
- zipp==3.21.0
prefix: /opt/conda/envs/s2spy
|
[
"tests/test_rgdr/test_alignment.py::test_alignment_example",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_intervals_subtract[intervals0-1-expected0]",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_intervals_subtract[intervals1-1-expected1]",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_intervals_subtract[intervals2-1-expected2]",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_intervals_subtract[intervals3-4-expected3]",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_intervals_subtract_neg",
"tests/test_rgdr/test_rgdr.py::TestDBSCAN::test_dbscan",
"tests/test_rgdr/test_rgdr.py::TestDBSCAN::test_dbscan_min_area",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_init",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_target_intervals",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_precursor_intervals",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_repr",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fitted_properties_err[cluster_map]",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fitted_properties_err[pval_map]",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fitted_properties_err[corr_map]",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform_before_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform_fits",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fitted_properties[cluster_map]",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fitted_properties[pval_map]",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fitted_properties[corr_map]",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_preview",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_plot_ax",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_plot",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_plot_ax",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_multiple_targets"
] |
[] |
[
"tests/test_rgdr/test_alignment.py::TestAlignmentSubfunctions::test_df_to_full_sets",
"tests/test_rgdr/test_alignment.py::TestAlignmentSubfunctions::test_remove_subsets",
"tests/test_rgdr/test_alignment.py::TestAlignmentSubfunctions::test_remove_overlapping_clusters",
"tests/test_rgdr/test_alignment.py::TestAlignmentSubfunctions::test_name_clusters",
"tests/test_rgdr/test_alignment.py::TestAlignmentSubfunctions::test_create_renaming_dict",
"tests/test_rgdr/test_alignment.py::TestAlignmentSubfunctions::test_ensure_unique_names",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_spherical_area[-1-2-2-49500]",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_spherical_area[45-5-5-218500]",
"tests/test_rgdr/test_rgdr.py::TestUtils::test_spherical_area[45-5-2.5-109250]",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr_nan",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_field_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dims",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_partial_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_regression"
] |
[] |
Apache License 2.0
| null |
AI4S2S__s2spy-60
|
43de2489c0bab3d2923ffeda93ae2749f9a0acca
|
2022-07-28 08:39:00
|
43de2489c0bab3d2923ffeda93ae2749f9a0acca
|
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c97e78a..552d693 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -45,10 +45,10 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v3
- - name: Set up Python 3.9
+ - name: Set up Python 3.10
uses: actions/setup-python@v3
with:
- python-version: 3.9
+ python-version: "3.10"
- name: Python info
shell: bash -l {0}
run: |
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
index bc5d691..d62d63c 100644
--- a/.github/workflows/sonarcloud.yml
+++ b/.github/workflows/sonarcloud.yml
@@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
- python-version: 3.9
+ python-version: "3.10"
- name: Python info
shell: bash -l {0}
run: |
diff --git a/.prospector.yml b/.prospector.yml
index 1b6e066..a59dca9 100644
--- a/.prospector.yml
+++ b/.prospector.yml
@@ -11,6 +11,7 @@ member-warnings: false
ignore-paths:
- docs
+ - build
pyroma:
run: true
@@ -31,4 +32,10 @@ pydocstyle:
pyflakes:
disable: [
F401, # unused import: already checked by pylint
- ]
\ No newline at end of file
+ ]
+
+mypy:
+ # see https://github.com/PyCQA/prospector/issues/313
+ run: true
+ options:
+ ignore-missing-imports: true
diff --git a/notebooks/tutorial_resampling_data.ipynb b/notebooks/tutorial_resampling_data.ipynb
index 526db64..4efb00e 100644
--- a/notebooks/tutorial_resampling_data.ipynb
+++ b/notebooks/tutorial_resampling_data.ipynb
@@ -11,27 +11,27 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "2017-10-20 0.690068\n",
- "2017-11-04 0.620426\n",
- "2017-11-19 0.896097\n",
- "2017-12-04 0.991774\n",
- "2017-12-19 0.491445\n",
+ "2017-10-20 0.763931\n",
+ "2017-11-04 0.249611\n",
+ "2017-11-19 0.923058\n",
+ "2017-12-04 0.183058\n",
+ "2017-12-19 0.376686\n",
" ... \n",
- "2021-07-31 0.159423\n",
- "2021-08-15 0.935054\n",
- "2021-08-30 0.212585\n",
- "2021-09-14 0.631784\n",
- "2021-09-29 0.338130\n",
+ "2021-07-31 0.114857\n",
+ "2021-08-15 0.621289\n",
+ "2021-08-30 0.899957\n",
+ "2021-09-14 0.773970\n",
+ "2021-09-29 0.173069\n",
"Freq: 15D, Length: 97, dtype: float64"
]
},
- "execution_count": 2,
+ "execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
@@ -60,7 +60,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 2,
"metadata": {},
"outputs": [
{
@@ -91,28 +91,28 @@
" <tbody>\n",
" <tr>\n",
" <th>2017-10-20</th>\n",
- " <td>0.690068</td>\n",
- " <td>0.690068</td>\n",
+ " <td>0.763931</td>\n",
+ " <td>0.763931</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2017-11-04</th>\n",
- " <td>0.620426</td>\n",
- " <td>0.620426</td>\n",
+ " <td>0.249611</td>\n",
+ " <td>0.249611</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2017-11-19</th>\n",
- " <td>0.896097</td>\n",
- " <td>0.896097</td>\n",
+ " <td>0.923058</td>\n",
+ " <td>0.923058</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2017-12-04</th>\n",
- " <td>0.991774</td>\n",
- " <td>0.991774</td>\n",
+ " <td>0.183058</td>\n",
+ " <td>0.183058</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2017-12-19</th>\n",
- " <td>0.491445</td>\n",
- " <td>0.491445</td>\n",
+ " <td>0.376686</td>\n",
+ " <td>0.376686</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
@@ -121,28 +121,28 @@
" </tr>\n",
" <tr>\n",
" <th>2021-07-31</th>\n",
- " <td>0.159423</td>\n",
- " <td>0.159423</td>\n",
+ " <td>0.114857</td>\n",
+ " <td>0.114857</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2021-08-15</th>\n",
- " <td>0.935054</td>\n",
- " <td>0.935054</td>\n",
+ " <td>0.621289</td>\n",
+ " <td>0.621289</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2021-08-30</th>\n",
- " <td>0.212585</td>\n",
- " <td>0.212585</td>\n",
+ " <td>0.899957</td>\n",
+ " <td>0.899957</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2021-09-14</th>\n",
- " <td>0.631784</td>\n",
- " <td>0.631784</td>\n",
+ " <td>0.773970</td>\n",
+ " <td>0.773970</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2021-09-29</th>\n",
- " <td>0.338130</td>\n",
- " <td>0.338130</td>\n",
+ " <td>0.173069</td>\n",
+ " <td>0.173069</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@@ -151,22 +151,22 @@
],
"text/plain": [
" data1 data2\n",
- "2017-10-20 0.690068 0.690068\n",
- "2017-11-04 0.620426 0.620426\n",
- "2017-11-19 0.896097 0.896097\n",
- "2017-12-04 0.991774 0.991774\n",
- "2017-12-19 0.491445 0.491445\n",
+ "2017-10-20 0.763931 0.763931\n",
+ "2017-11-04 0.249611 0.249611\n",
+ "2017-11-19 0.923058 0.923058\n",
+ "2017-12-04 0.183058 0.183058\n",
+ "2017-12-19 0.376686 0.376686\n",
"... ... ...\n",
- "2021-07-31 0.159423 0.159423\n",
- "2021-08-15 0.935054 0.935054\n",
- "2021-08-30 0.212585 0.212585\n",
- "2021-09-14 0.631784 0.631784\n",
- "2021-09-29 0.338130 0.338130\n",
+ "2021-07-31 0.114857 0.114857\n",
+ "2021-08-15 0.621289 0.621289\n",
+ "2021-08-30 0.899957 0.899957\n",
+ "2021-09-14 0.773970 0.773970\n",
+ "2021-09-29 0.173069 0.173069\n",
"\n",
"[97 rows x 2 columns]"
]
},
- "execution_count": 3,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -180,66 +180,40 @@
"metadata": {},
"source": [
"To resample we need to set up an advent calendar with the anchor date and frequency. \n",
- "(Passing n_targets is optional, default is 1. This means i_interval = 0 is the target period. The marked target periods will show up in map_years in future versions.)"
+ "(Passing n_targets is optional, default is 1. This means i_interval = 0 is the target period.)"
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "anchor_year i_interval\n",
- "2020 0 (2020-07-17, 2020-10-15]\n",
- " 1 (2020-04-18, 2020-07-17]\n",
- " 2 (2020-01-19, 2020-04-18]\n",
- " 3 (2019-10-21, 2020-01-19]\n",
- "2019 0 (2019-07-17, 2019-10-15]\n",
- " 1 (2019-04-18, 2019-07-17]\n",
- " 2 (2019-01-18, 2019-04-18]\n",
- " 3 (2018-10-20, 2019-01-18]\n",
- "2018 0 (2018-07-17, 2018-10-15]\n",
- " 1 (2018-04-18, 2018-07-17]\n",
- " 2 (2018-01-18, 2018-04-18]\n",
- " 3 (2017-10-20, 2018-01-18]\n",
- "2017 0 (2017-07-17, 2017-10-15]\n",
- " 1 (2017-04-18, 2017-07-17]\n",
- " 2 (2017-01-18, 2017-04-18]\n",
- " 3 (2016-10-20, 2017-01-18]\n",
- "2016 0 (2016-07-17, 2016-10-15]\n",
- " 1 (2016-04-18, 2016-07-17]\n",
- " 2 (2016-01-19, 2016-04-18]\n",
- " 3 (2015-10-21, 2016-01-19]\n",
- "2015 0 (2015-07-17, 2015-10-15]\n",
- " 1 (2015-04-18, 2015-07-17]\n",
- " 2 (2015-01-18, 2015-04-18]\n",
- " 3 (2014-10-20, 2015-01-18]\n",
- "dtype: interval"
+ "AdventCalendar(month=10, day=15, freq=90d, n_targets=1, max_lag=None)"
]
},
- "execution_count": 4,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "calendar = s2spy.time.AdventCalendar(anchor_date=(10, 15), freq='90d')\n",
- "calendar.map_years(2015, 2020).flat"
+ "calendar = s2spy.time.AdventCalendar(anchor=(10, 15), freq='90d')\n",
+ "calendar.map_years(2018, 2020)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "Next we pass the example data to the `resample` method of the calendar.\n",
- "(Here the target shows up as a column.)"
+ "Next we pass the example data to the `resample` function. This requires a mapped calendar and the input data.\n"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 4,
"metadata": {},
"outputs": [
{
@@ -276,7 +250,7 @@
" <td>2018</td>\n",
" <td>0</td>\n",
" <td>(2018-07-17, 2018-10-15]</td>\n",
- " <td>0.472704</td>\n",
+ " <td>0.478348</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
@@ -284,7 +258,7 @@
" <td>2018</td>\n",
" <td>1</td>\n",
" <td>(2018-04-18, 2018-07-17]</td>\n",
- " <td>0.467270</td>\n",
+ " <td>0.640158</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -292,7 +266,7 @@
" <td>2018</td>\n",
" <td>2</td>\n",
" <td>(2018-01-18, 2018-04-18]</td>\n",
- " <td>0.518639</td>\n",
+ " <td>0.400760</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -300,7 +274,7 @@
" <td>2018</td>\n",
" <td>3</td>\n",
" <td>(2017-10-20, 2018-01-18]</td>\n",
- " <td>0.790256</td>\n",
+ " <td>0.460397</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -308,7 +282,7 @@
" <td>2019</td>\n",
" <td>0</td>\n",
" <td>(2019-07-17, 2019-10-15]</td>\n",
- " <td>0.404145</td>\n",
+ " <td>0.440918</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
@@ -316,7 +290,7 @@
" <td>2019</td>\n",
" <td>1</td>\n",
" <td>(2019-04-18, 2019-07-17]</td>\n",
- " <td>0.634694</td>\n",
+ " <td>0.403817</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -324,7 +298,7 @@
" <td>2019</td>\n",
" <td>2</td>\n",
" <td>(2019-01-18, 2019-04-18]</td>\n",
- " <td>0.811495</td>\n",
+ " <td>0.516905</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -332,7 +306,7 @@
" <td>2019</td>\n",
" <td>3</td>\n",
" <td>(2018-10-20, 2019-01-18]</td>\n",
- " <td>0.562892</td>\n",
+ " <td>0.371559</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -340,7 +314,7 @@
" <td>2020</td>\n",
" <td>0</td>\n",
" <td>(2020-07-17, 2020-10-15]</td>\n",
- " <td>0.621562</td>\n",
+ " <td>0.497199</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
@@ -348,7 +322,7 @@
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>(2020-04-18, 2020-07-17]</td>\n",
- " <td>0.632471</td>\n",
+ " <td>0.370229</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -356,7 +330,7 @@
" <td>2020</td>\n",
" <td>2</td>\n",
" <td>(2020-01-19, 2020-04-18]</td>\n",
- " <td>0.722433</td>\n",
+ " <td>0.374970</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -364,7 +338,7 @@
" <td>2020</td>\n",
" <td>3</td>\n",
" <td>(2019-10-21, 2020-01-19]</td>\n",
- " <td>0.275573</td>\n",
+ " <td>0.310996</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
@@ -373,27 +347,27 @@
],
"text/plain": [
" anchor_year i_interval interval mean_data target\n",
- "0 2018 0 (2018-07-17, 2018-10-15] 0.472704 True\n",
- "1 2018 1 (2018-04-18, 2018-07-17] 0.467270 False\n",
- "2 2018 2 (2018-01-18, 2018-04-18] 0.518639 False\n",
- "3 2018 3 (2017-10-20, 2018-01-18] 0.790256 False\n",
- "4 2019 0 (2019-07-17, 2019-10-15] 0.404145 True\n",
- "5 2019 1 (2019-04-18, 2019-07-17] 0.634694 False\n",
- "6 2019 2 (2019-01-18, 2019-04-18] 0.811495 False\n",
- "7 2019 3 (2018-10-20, 2019-01-18] 0.562892 False\n",
- "8 2020 0 (2020-07-17, 2020-10-15] 0.621562 True\n",
- "9 2020 1 (2020-04-18, 2020-07-17] 0.632471 False\n",
- "10 2020 2 (2020-01-19, 2020-04-18] 0.722433 False\n",
- "11 2020 3 (2019-10-21, 2020-01-19] 0.275573 False"
+ "0 2018 0 (2018-07-17, 2018-10-15] 0.478348 True\n",
+ "1 2018 1 (2018-04-18, 2018-07-17] 0.640158 False\n",
+ "2 2018 2 (2018-01-18, 2018-04-18] 0.400760 False\n",
+ "3 2018 3 (2017-10-20, 2018-01-18] 0.460397 False\n",
+ "4 2019 0 (2019-07-17, 2019-10-15] 0.440918 True\n",
+ "5 2019 1 (2019-04-18, 2019-07-17] 0.403817 False\n",
+ "6 2019 2 (2019-01-18, 2019-04-18] 0.516905 False\n",
+ "7 2019 3 (2018-10-20, 2019-01-18] 0.371559 False\n",
+ "8 2020 0 (2020-07-17, 2020-10-15] 0.497199 True\n",
+ "9 2020 1 (2020-04-18, 2020-07-17] 0.370229 False\n",
+ "10 2020 2 (2020-01-19, 2020-04-18] 0.374970 False\n",
+ "11 2020 3 (2019-10-21, 2020-01-19] 0.310996 False"
]
},
- "execution_count": 5,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "resampled_series = calendar.resample(example_series)\n",
+ "resampled_series = s2spy.time.resample(calendar, example_series)\n",
"resampled_series"
]
},
@@ -408,7 +382,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -446,8 +420,8 @@
" <td>2018</td>\n",
" <td>0</td>\n",
" <td>(2018-07-17, 2018-10-15]</td>\n",
- " <td>0.472704</td>\n",
- " <td>0.472704</td>\n",
+ " <td>0.478348</td>\n",
+ " <td>0.478348</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
@@ -455,8 +429,8 @@
" <td>2018</td>\n",
" <td>1</td>\n",
" <td>(2018-04-18, 2018-07-17]</td>\n",
- " <td>0.467270</td>\n",
- " <td>0.467270</td>\n",
+ " <td>0.640158</td>\n",
+ " <td>0.640158</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -464,8 +438,8 @@
" <td>2018</td>\n",
" <td>2</td>\n",
" <td>(2018-01-18, 2018-04-18]</td>\n",
- " <td>0.518639</td>\n",
- " <td>0.518639</td>\n",
+ " <td>0.400760</td>\n",
+ " <td>0.400760</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -473,8 +447,8 @@
" <td>2018</td>\n",
" <td>3</td>\n",
" <td>(2017-10-20, 2018-01-18]</td>\n",
- " <td>0.790256</td>\n",
- " <td>0.790256</td>\n",
+ " <td>0.460397</td>\n",
+ " <td>0.460397</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -482,8 +456,8 @@
" <td>2019</td>\n",
" <td>0</td>\n",
" <td>(2019-07-17, 2019-10-15]</td>\n",
- " <td>0.404145</td>\n",
- " <td>0.404145</td>\n",
+ " <td>0.440918</td>\n",
+ " <td>0.440918</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
@@ -491,8 +465,8 @@
" <td>2019</td>\n",
" <td>1</td>\n",
" <td>(2019-04-18, 2019-07-17]</td>\n",
- " <td>0.634694</td>\n",
- " <td>0.634694</td>\n",
+ " <td>0.403817</td>\n",
+ " <td>0.403817</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -500,8 +474,8 @@
" <td>2019</td>\n",
" <td>2</td>\n",
" <td>(2019-01-18, 2019-04-18]</td>\n",
- " <td>0.811495</td>\n",
- " <td>0.811495</td>\n",
+ " <td>0.516905</td>\n",
+ " <td>0.516905</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -509,8 +483,8 @@
" <td>2019</td>\n",
" <td>3</td>\n",
" <td>(2018-10-20, 2019-01-18]</td>\n",
- " <td>0.562892</td>\n",
- " <td>0.562892</td>\n",
+ " <td>0.371559</td>\n",
+ " <td>0.371559</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -518,8 +492,8 @@
" <td>2020</td>\n",
" <td>0</td>\n",
" <td>(2020-07-17, 2020-10-15]</td>\n",
- " <td>0.621562</td>\n",
- " <td>0.621562</td>\n",
+ " <td>0.497199</td>\n",
+ " <td>0.497199</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
@@ -527,8 +501,8 @@
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>(2020-04-18, 2020-07-17]</td>\n",
- " <td>0.632471</td>\n",
- " <td>0.632471</td>\n",
+ " <td>0.370229</td>\n",
+ " <td>0.370229</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -536,8 +510,8 @@
" <td>2020</td>\n",
" <td>2</td>\n",
" <td>(2020-01-19, 2020-04-18]</td>\n",
- " <td>0.722433</td>\n",
- " <td>0.722433</td>\n",
+ " <td>0.374970</td>\n",
+ " <td>0.374970</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
@@ -545,8 +519,8 @@
" <td>2020</td>\n",
" <td>3</td>\n",
" <td>(2019-10-21, 2020-01-19]</td>\n",
- " <td>0.275573</td>\n",
- " <td>0.275573</td>\n",
+ " <td>0.310996</td>\n",
+ " <td>0.310996</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
@@ -555,18 +529,18 @@
],
"text/plain": [
" anchor_year i_interval interval data1 data2 \\\n",
- "0 2018 0 (2018-07-17, 2018-10-15] 0.472704 0.472704 \n",
- "1 2018 1 (2018-04-18, 2018-07-17] 0.467270 0.467270 \n",
- "2 2018 2 (2018-01-18, 2018-04-18] 0.518639 0.518639 \n",
- "3 2018 3 (2017-10-20, 2018-01-18] 0.790256 0.790256 \n",
- "4 2019 0 (2019-07-17, 2019-10-15] 0.404145 0.404145 \n",
- "5 2019 1 (2019-04-18, 2019-07-17] 0.634694 0.634694 \n",
- "6 2019 2 (2019-01-18, 2019-04-18] 0.811495 0.811495 \n",
- "7 2019 3 (2018-10-20, 2019-01-18] 0.562892 0.562892 \n",
- "8 2020 0 (2020-07-17, 2020-10-15] 0.621562 0.621562 \n",
- "9 2020 1 (2020-04-18, 2020-07-17] 0.632471 0.632471 \n",
- "10 2020 2 (2020-01-19, 2020-04-18] 0.722433 0.722433 \n",
- "11 2020 3 (2019-10-21, 2020-01-19] 0.275573 0.275573 \n",
+ "0 2018 0 (2018-07-17, 2018-10-15] 0.478348 0.478348 \n",
+ "1 2018 1 (2018-04-18, 2018-07-17] 0.640158 0.640158 \n",
+ "2 2018 2 (2018-01-18, 2018-04-18] 0.400760 0.400760 \n",
+ "3 2018 3 (2017-10-20, 2018-01-18] 0.460397 0.460397 \n",
+ "4 2019 0 (2019-07-17, 2019-10-15] 0.440918 0.440918 \n",
+ "5 2019 1 (2019-04-18, 2019-07-17] 0.403817 0.403817 \n",
+ "6 2019 2 (2019-01-18, 2019-04-18] 0.516905 0.516905 \n",
+ "7 2019 3 (2018-10-20, 2019-01-18] 0.371559 0.371559 \n",
+ "8 2020 0 (2020-07-17, 2020-10-15] 0.497199 0.497199 \n",
+ "9 2020 1 (2020-04-18, 2020-07-17] 0.370229 0.370229 \n",
+ "10 2020 2 (2020-01-19, 2020-04-18] 0.374970 0.374970 \n",
+ "11 2020 3 (2019-10-21, 2020-01-19] 0.310996 0.310996 \n",
"\n",
" target \n",
"0 True \n",
@@ -583,13 +557,13 @@
"11 False "
]
},
- "execution_count": 6,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "resampled_dataframe = calendar.resample(example_dataframe)\n",
+ "resampled_dataframe = s2spy.time.resample(calendar, example_dataframe)\n",
"resampled_dataframe"
]
},
@@ -602,7 +576,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
@@ -970,9 +944,9 @@
" temperature (x, y, time) float64 29.11 18.2 22.83 ... 1.746 7.116 3.225\n",
" precipitation (x, y, time) float64 5.25 7.506 3.335 ... 7.359 1.415 8.659\n",
"Attributes:\n",
- " description: Weather related data.</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-f5bea966-16a6-4d6b-b80d-a6da76a3c365' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-f5bea966-16a6-4d6b-b80d-a6da76a3c365' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span>x</span>: 2</li><li><span>y</span>: 2</li><li><span class='xr-has-index'>time</span>: 97</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-15f79c16-d0b7-482f-9a8e-8c048c666837' class='xr-section-summary-in' type='checkbox' checked><label for='section-15f79c16-d0b7-482f-9a8e-8c048c666837' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-99.83 -99.32 -99.79 -99.23</div><input id='attrs-0b267206-2eee-4799-ac81-64fa89200fe5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0b267206-2eee-4799-ac81-64fa89200fe5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-86fdb6b0-e3ce-4e1c-b000-0f8d69b825a2' class='xr-var-data-in' type='checkbox'><label for='data-86fdb6b0-e3ce-4e1c-b000-0f8d69b825a2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-99.83, -99.32],\n",
- " [-99.79, -99.23]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>42.25 42.21 42.63 42.59</div><input id='attrs-889f5f9d-c9c0-40c3-982d-e9007546e462' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-889f5f9d-c9c0-40c3-982d-e9007546e462' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a3a17748-4499-4983-920f-f93d6d95b6d1' class='xr-var-data-in' type='checkbox'><label for='data-a3a17748-4499-4983-920f-f93d6d95b6d1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[42.25, 42.21],\n",
- " [42.63, 42.59]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2017-10-20 ... 2021-09-29</div><input id='attrs-63faf94f-2d99-4856-97fa-53f7d5876c2d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-63faf94f-2d99-4856-97fa-53f7d5876c2d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5e288df3-28a3-42b4-8c4b-d58ab98b37d3' class='xr-var-data-in' type='checkbox'><label for='data-5e288df3-28a3-42b4-8c4b-d58ab98b37d3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['2017-10-20T00:00:00.000000000', '2017-11-04T00:00:00.000000000',\n",
+ " description: Weather related data.</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-441267d9-4df1-4eaa-ac79-759d15b4a99c' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-441267d9-4df1-4eaa-ac79-759d15b4a99c' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span>x</span>: 2</li><li><span>y</span>: 2</li><li><span class='xr-has-index'>time</span>: 97</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-d55ac5df-9ecf-4599-b118-478d276101cb' class='xr-section-summary-in' type='checkbox' checked><label for='section-d55ac5df-9ecf-4599-b118-478d276101cb' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-99.83 -99.32 -99.79 -99.23</div><input id='attrs-ced9bf14-d4f7-4ec6-86c5-f42cf77cc53d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ced9bf14-d4f7-4ec6-86c5-f42cf77cc53d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0ca90cb8-14e9-487a-8a80-192a71317a55' class='xr-var-data-in' type='checkbox'><label for='data-0ca90cb8-14e9-487a-8a80-192a71317a55' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-99.83, -99.32],\n",
+ " [-99.79, -99.23]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>42.25 42.21 42.63 42.59</div><input id='attrs-994ea888-682e-4aac-bc45-5d173cfdd649' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-994ea888-682e-4aac-bc45-5d173cfdd649' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2cdb1aa9-6dba-48cd-b8f3-12dde35045f4' class='xr-var-data-in' type='checkbox'><label for='data-2cdb1aa9-6dba-48cd-b8f3-12dde35045f4' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[42.25, 42.21],\n",
+ " [42.63, 42.59]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2017-10-20 ... 2021-09-29</div><input id='attrs-04699b5d-e3c8-4b2c-8c50-b9e6344a6d79' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-04699b5d-e3c8-4b2c-8c50-b9e6344a6d79' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a1b91e8b-b2b3-4d07-983e-f94510890732' class='xr-var-data-in' type='checkbox'><label for='data-a1b91e8b-b2b3-4d07-983e-f94510890732' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['2017-10-20T00:00:00.000000000', '2017-11-04T00:00:00.000000000',\n",
" '2017-11-19T00:00:00.000000000', '2017-12-04T00:00:00.000000000',\n",
" '2017-12-19T00:00:00.000000000', '2018-01-03T00:00:00.000000000',\n",
" '2018-01-18T00:00:00.000000000', '2018-02-02T00:00:00.000000000',\n",
@@ -1020,7 +994,7 @@
" '2021-07-01T00:00:00.000000000', '2021-07-16T00:00:00.000000000',\n",
" '2021-07-31T00:00:00.000000000', '2021-08-15T00:00:00.000000000',\n",
" '2021-08-30T00:00:00.000000000', '2021-09-14T00:00:00.000000000',\n",
- " '2021-09-29T00:00:00.000000000'], dtype='datetime64[ns]')</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-80974c05-7256-4dbd-9949-8ae29a6ff440' class='xr-section-summary-in' type='checkbox' checked><label for='section-80974c05-7256-4dbd-9949-8ae29a6ff440' class='xr-section-summary' >Data variables: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>temperature</span></div><div class='xr-var-dims'>(x, y, time)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>29.11 18.2 22.83 ... 7.116 3.225</div><input id='attrs-74d1e2c4-add0-43e0-a7a0-cb9c10932607' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-74d1e2c4-add0-43e0-a7a0-cb9c10932607' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ea83a464-9ac9-4dcd-a7b2-075d79700784' class='xr-var-data-in' type='checkbox'><label for='data-ea83a464-9ac9-4dcd-a7b2-075d79700784' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[29.11241877, 18.20125767, 22.82990387, 32.92714559,\n",
+ " '2021-09-29T00:00:00.000000000'], dtype='datetime64[ns]')</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-8d2d7f19-ecb0-48ea-9097-9e705993811f' class='xr-section-summary-in' type='checkbox' checked><label for='section-8d2d7f19-ecb0-48ea-9097-9e705993811f' class='xr-section-summary' >Data variables: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>temperature</span></div><div class='xr-var-dims'>(x, y, time)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>29.11 18.2 22.83 ... 7.116 3.225</div><input id='attrs-ff285823-f135-41e0-ae32-2b7d6c46647e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ff285823-f135-41e0-ae32-2b7d6c46647e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a36589c8-dfa3-430b-9f28-439b77729768' class='xr-var-data-in' type='checkbox'><label for='data-a36589c8-dfa3-430b-9f28-439b77729768' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[29.11241877, 18.20125767, 22.82990387, 32.92714559,\n",
" 29.94046392, 7.18177696, 22.60070734, 13.78914233,\n",
" 14.17424919, 18.28478802, 16.15234857, 26.63418806,\n",
" 21.0883018 , 15.97340013, 18.55090586, 17.66939462,\n",
@@ -1060,7 +1034,7 @@
" 18.95069421, 20.14651572, 2.43501273, 13.34477059,\n",
" 22.0414313 , 1.41515344, 18.0982438 , -3.04451384,\n",
" 6.81994525, 15.30904441, 1.74627918, 7.1159141 ,\n",
- " 3.22531994]]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>precipitation</span></div><div class='xr-var-dims'>(x, y, time)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.25 7.506 3.335 ... 1.415 8.659</div><input id='attrs-b802c2e5-f8e9-4e7a-9f8d-4c89d7759da3' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b802c2e5-f8e9-4e7a-9f8d-4c89d7759da3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5fbf765c-b8a9-40c4-b53c-2e69388b1e3a' class='xr-var-data-in' type='checkbox'><label for='data-5fbf765c-b8a9-40c4-b53c-2e69388b1e3a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[5.24970442e+00, 7.50595023e+00, 3.33507466e+00, 9.24158767e+00,\n",
+ " 3.22531994]]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>precipitation</span></div><div class='xr-var-dims'>(x, y, time)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.25 7.506 3.335 ... 1.415 8.659</div><input id='attrs-1dad454b-a6bc-410c-9a42-ee7d2c7e432a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1dad454b-a6bc-410c-9a42-ee7d2c7e432a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-180b95e4-a62d-4f3b-b8d7-699c583cadb3' class='xr-var-data-in' type='checkbox'><label for='data-180b95e4-a62d-4f3b-b8d7-699c583cadb3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[5.24970442e+00, 7.50595023e+00, 3.33507466e+00, 9.24158767e+00,\n",
" 8.62318547e+00, 4.86902960e-01, 2.53642524e+00, 4.46135513e+00,\n",
" 1.04627889e+00, 3.48475989e+00, 7.40097526e+00, 6.80514481e+00,\n",
" 6.22384429e+00, 7.10528403e+00, 2.04923687e+00, 3.41698115e+00,\n",
@@ -1100,7 +1074,7 @@
" 3.57346880e+00, 9.14970770e+00, 7.31744185e+00, 7.27546991e+00,\n",
" 2.89913450e+00, 5.77709424e+00, 7.79179433e+00, 7.95590369e+00,\n",
" 3.44530461e+00, 7.70872757e+00, 7.35893897e+00, 1.41506486e+00,\n",
- " 8.65945469e+00]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-919710d0-7005-4a88-9c6c-ee73e89b4ef7' class='xr-section-summary-in' type='checkbox' checked><label for='section-919710d0-7005-4a88-9c6c-ee73e89b4ef7' class='xr-section-summary' >Attributes: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>description :</span></dt><dd>Weather related data.</dd></dl></div></li></ul></div></div>"
+ " 8.65945469e+00]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-3b74134c-f046-4eb6-9b11-bdb3afcde945' class='xr-section-summary-in' type='checkbox' checked><label for='section-3b74134c-f046-4eb6-9b11-bdb3afcde945' class='xr-section-summary' >Attributes: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>description :</span></dt><dd>Weather related data.</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
@@ -1117,7 +1091,7 @@
" description: Weather related data."
]
},
- "execution_count": 7,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -1167,7 +1141,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
@@ -1537,9 +1511,9 @@
"Dimensions without coordinates: x, y\n",
"Data variables:\n",
" temperature (anchor_year, i_interval, x, y) float64 14.52 17.14 ... 12.32\n",
- " precipitation (anchor_year, i_interval, x, y) float64 3.224 6.534 ... 5.705</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-85f569bc-957b-4733-b64c-310d4e30ad27' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-85f569bc-957b-4733-b64c-310d4e30ad27' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 3</li><li><span class='xr-has-index'>i_interval</span>: 4</li><li><span>x</span>: 2</li><li><span>y</span>: 2</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-54627ece-901f-4141-8e60-f518cdcf6d97' class='xr-section-summary-in' type='checkbox' checked><label for='section-54627ece-901f-4141-8e60-f518cdcf6d97' class='xr-section-summary' >Coordinates: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>index</span></div><div class='xr-var-dims'>(anchor_year, i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 6 7 8 9 10 11</div><input id='attrs-1a87111a-9447-47c7-bff1-7707ed61d740' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1a87111a-9447-47c7-bff1-7707ed61d740' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-12c7311c-d341-416c-94ea-d9dcbf434f24' class='xr-var-data-in' type='checkbox'><label for='data-12c7311c-d341-416c-94ea-d9dcbf434f24' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[ 0, 1, 2, 3],\n",
+ " precipitation (anchor_year, i_interval, x, y) float64 3.224 6.534 ... 5.705</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-6d52c501-5e17-4b53-abc1-078ed304775c' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-6d52c501-5e17-4b53-abc1-078ed304775c' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>anchor_year</span>: 3</li><li><span class='xr-has-index'>i_interval</span>: 4</li><li><span>x</span>: 2</li><li><span>y</span>: 2</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-370df202-dc76-4d2b-8938-b148d1968057' class='xr-section-summary-in' type='checkbox' checked><label for='section-370df202-dc76-4d2b-8938-b148d1968057' class='xr-section-summary' >Coordinates: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>index</span></div><div class='xr-var-dims'>(anchor_year, i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 6 7 8 9 10 11</div><input id='attrs-14063db9-10e6-4727-9ef7-04a219ce94c6' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-14063db9-10e6-4727-9ef7-04a219ce94c6' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-23a26821-07a8-42b3-a00e-a2e5a89a5abf' class='xr-var-data-in' type='checkbox'><label for='data-23a26821-07a8-42b3-a00e-a2e5a89a5abf' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[ 0, 1, 2, 3],\n",
" [ 4, 5, 6, 7],\n",
- " [ 8, 9, 10, 11]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>interval</span></div><div class='xr-var-dims'>(anchor_year, i_interval)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>(2018-07-17, 2018-10-15] ... (20...</div><input id='attrs-627783b7-6885-4165-b8a4-a4df306e7948' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-627783b7-6885-4165-b8a4-a4df306e7948' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b508c609-d5ab-4af2-aa96-914326337801' class='xr-var-data-in' type='checkbox'><label for='data-b508c609-d5ab-4af2-aa96-914326337801' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[Interval('2018-07-17', '2018-10-15', closed='right'),\n",
+ " [ 8, 9, 10, 11]], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>interval</span></div><div class='xr-var-dims'>(anchor_year, i_interval)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>(2018-07-17, 2018-10-15] ... (20...</div><input id='attrs-4c26f79c-e675-41e9-85a8-0bc76d2d45b6' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-4c26f79c-e675-41e9-85a8-0bc76d2d45b6' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cd013903-727a-4a8a-9193-2862795a3f33' class='xr-var-data-in' type='checkbox'><label for='data-cd013903-727a-4a8a-9193-2862795a3f33' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[Interval('2018-07-17', '2018-10-15', closed='right'),\n",
" Interval('2018-04-18', '2018-07-17', closed='right'),\n",
" Interval('2018-01-18', '2018-04-18', closed='right'),\n",
" Interval('2017-10-20', '2018-01-18', closed='right')],\n",
@@ -1551,9 +1525,9 @@
" Interval('2020-04-18', '2020-07-17', closed='right'),\n",
" Interval('2020-01-19', '2020-04-18', closed='right'),\n",
" Interval('2019-10-21', '2020-01-19', closed='right')]],\n",
- " dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-99.83 -99.32 -99.79 -99.23</div><input id='attrs-eb27d48e-748b-4ad5-8581-82dc1dd01df1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-eb27d48e-748b-4ad5-8581-82dc1dd01df1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9b950220-78b3-405d-a340-bea8101b6609' class='xr-var-data-in' type='checkbox'><label for='data-9b950220-78b3-405d-a340-bea8101b6609' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-99.83, -99.32],\n",
- " [-99.79, -99.23]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>42.25 42.21 42.63 42.59</div><input id='attrs-b820f629-779c-4c31-ae88-d82b3fd057c5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b820f629-779c-4c31-ae88-d82b3fd057c5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-67e5cb56-24be-4492-b51d-5f11e6e2de3a' class='xr-var-data-in' type='checkbox'><label for='data-67e5cb56-24be-4492-b51d-5f11e6e2de3a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[42.25, 42.21],\n",
- " [42.63, 42.59]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2018 2019 2020</div><input id='attrs-6faef08d-26dc-48f9-a80a-5cb45e254eb7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6faef08d-26dc-48f9-a80a-5cb45e254eb7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e709378f-cad7-41d7-9a1e-855c739e3e8f' class='xr-var-data-in' type='checkbox'><label for='data-e709378f-cad7-41d7-9a1e-855c739e3e8f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([2018, 2019, 2020])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>i_interval</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-ae4490b8-9acb-4517-ab78-74d19a324253' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ae4490b8-9acb-4517-ab78-74d19a324253' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2f121496-6c12-4a0c-8a69-8d722b4f0ec4' class='xr-var-data-in' type='checkbox'><label for='data-2f121496-6c12-4a0c-8a69-8d722b4f0ec4' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>target</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>True False False False</div><input id='attrs-99a055bb-c671-44f7-bebe-0eeffa5466e1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-99a055bb-c671-44f7-bebe-0eeffa5466e1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7fcad944-abb4-4735-8a6a-4b04f401c55f' class='xr-var-data-in' type='checkbox'><label for='data-7fcad944-abb4-4735-8a6a-4b04f401c55f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ True, False, False, False])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-e46a589a-0fdf-4c70-ba7a-e776e0bcdda7' class='xr-section-summary-in' type='checkbox' checked><label for='section-e46a589a-0fdf-4c70-ba7a-e776e0bcdda7' class='xr-section-summary' >Data variables: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>temperature</span></div><div class='xr-var-dims'>(anchor_year, i_interval, x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>14.52 17.14 16.07 ... 13.85 12.32</div><input id='attrs-241c1133-f9f4-42e3-9505-91c59f9819bc' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-241c1133-f9f4-42e3-9505-91c59f9819bc' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-919f405a-89af-4cc7-8061-f1dbc2842e5d' class='xr-var-data-in' type='checkbox'><label for='data-919f405a-89af-4cc7-8061-f1dbc2842e5d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[[14.51807846, 17.14073688],\n",
+ " dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-99.83 -99.32 -99.79 -99.23</div><input id='attrs-5d18999a-11e7-4ecb-af4e-7da58be62020' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5d18999a-11e7-4ecb-af4e-7da58be62020' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d867670d-efa0-4f52-b537-f5e6c4e1d11c' class='xr-var-data-in' type='checkbox'><label for='data-d867670d-efa0-4f52-b537-f5e6c4e1d11c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-99.83, -99.32],\n",
+ " [-99.79, -99.23]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>42.25 42.21 42.63 42.59</div><input id='attrs-38fa4498-1e03-4f70-830c-0c10eb9b8d38' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-38fa4498-1e03-4f70-830c-0c10eb9b8d38' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0f4c351f-ac59-4eb4-b8db-7a7899fe8336' class='xr-var-data-in' type='checkbox'><label for='data-0f4c351f-ac59-4eb4-b8db-7a7899fe8336' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[42.25, 42.21],\n",
+ " [42.63, 42.59]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2018 2019 2020</div><input id='attrs-1b788e67-9419-4bf8-aae5-f756359a52dc' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1b788e67-9419-4bf8-aae5-f756359a52dc' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d92d4f7d-5466-4476-8da3-33a3ef0df3dc' class='xr-var-data-in' type='checkbox'><label for='data-d92d4f7d-5466-4476-8da3-33a3ef0df3dc' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([2018, 2019, 2020], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>i_interval</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-bd2901d5-e071-4f68-a0c9-67df5c62b5dc' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-bd2901d5-e071-4f68-a0c9-67df5c62b5dc' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-8f806add-f44a-4902-ab17-dcadbe741158' class='xr-var-data-in' type='checkbox'><label for='data-8f806add-f44a-4902-ab17-dcadbe741158' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>target</span></div><div class='xr-var-dims'>(i_interval)</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>True False False False</div><input id='attrs-663e5390-f3fc-40ab-a947-0fae4be215ef' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-663e5390-f3fc-40ab-a947-0fae4be215ef' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a16fb8b4-d7fb-4ecb-9cb7-8dcc0fe5bcf0' class='xr-var-data-in' type='checkbox'><label for='data-a16fb8b4-d7fb-4ecb-9cb7-8dcc0fe5bcf0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ True, False, False, False])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-6153fdf2-453e-4206-a6cd-43846a61a697' class='xr-section-summary-in' type='checkbox' checked><label for='section-6153fdf2-453e-4206-a6cd-43846a61a697' class='xr-section-summary' >Data variables: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>temperature</span></div><div class='xr-var-dims'>(anchor_year, i_interval, x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>14.52 17.14 16.07 ... 13.85 12.32</div><input id='attrs-ec2615c3-b6bc-4837-a9d7-08941a2e50bb' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ec2615c3-b6bc-4837-a9d7-08941a2e50bb' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b7a0722d-36b1-4132-bd6c-5eba9efe990f' class='xr-var-data-in' type='checkbox'><label for='data-b7a0722d-36b1-4132-bd6c-5eba9efe990f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[[14.51807846, 17.14073688],\n",
" [16.06736697, 13.39468062]],\n",
"\n",
" [[18.33493478, 20.80919455],\n",
@@ -1589,7 +1563,7 @@
" [13.65735477, 13.02433449]],\n",
"\n",
" [[11.74543481, 15.09573755],\n",
- " [13.84770432, 12.32257394]]]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>precipitation</span></div><div class='xr-var-dims'>(anchor_year, i_interval, x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>3.224 6.534 5.071 ... 5.762 5.705</div><input id='attrs-534e2b2b-962e-45d5-aac5-a1460254471e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-534e2b2b-962e-45d5-aac5-a1460254471e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-14a97d31-a544-44d3-9563-09cf26f94bcb' class='xr-var-data-in' type='checkbox'><label for='data-14a97d31-a544-44d3-9563-09cf26f94bcb' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[[3.22395354, 6.53411827],\n",
+ " [13.84770432, 12.32257394]]]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>precipitation</span></div><div class='xr-var-dims'>(anchor_year, i_interval, x, y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>3.224 6.534 5.071 ... 5.762 5.705</div><input id='attrs-a7cce781-335f-4435-99e9-8b8e64614113' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-a7cce781-335f-4435-99e9-8b8e64614113' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3142930a-b2bd-4c3c-aecd-115f8beb0eab' class='xr-var-data-in' type='checkbox'><label for='data-3142930a-b2bd-4c3c-aecd-115f8beb0eab' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[[3.22395354, 6.53411827],\n",
" [5.07125996, 3.45648475]],\n",
"\n",
" [[5.59384251, 4.6572203 ],\n",
@@ -1625,7 +1599,7 @@
" [5.86267549, 5.35799785]],\n",
"\n",
" [[3.4530543 , 4.08126979],\n",
- " [5.76219244, 5.70498641]]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-ed1d0d28-7622-4294-98f0-d090348ce612' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-ed1d0d28-7622-4294-98f0-d090348ce612' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
+ " [5.76219244, 5.70498641]]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-84d959d5-3cfb-4420-a221-76da3fd5c328' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-84d959d5-3cfb-4420-a221-76da3fd5c328' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
@@ -1644,13 +1618,13 @@
" precipitation (anchor_year, i_interval, x, y) float64 3.224 6.534 ... 5.705"
]
},
- "execution_count": 8,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "ds_r = calendar.resample(ds)\n",
+ "ds_r = s2spy.time.resample(calendar, ds)\n",
"ds_r"
]
},
@@ -1664,7 +1638,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3.9.13 ('s2spy')",
+ "display_name": "Python 3.10.5 ('ai4s2s')",
"language": "python",
"name": "python3"
},
@@ -1678,12 +1652,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.13"
+ "version": "3.10.5"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
- "hash": "4c8901add0872cf59113c57929fb99881a7f0f46837d8b99712d7db552e5b9e5"
+ "hash": "a87ac8a6238ac8fffcd070769ea0ffc634a0ba702c52b706c3554dda7777b3fd"
}
}
},
diff --git a/notebooks/tutorial_time.ipynb b/notebooks/tutorial_time.ipynb
index ce20d21..149fa99 100644
--- a/notebooks/tutorial_time.ipynb
+++ b/notebooks/tutorial_time.ipynb
@@ -9,7 +9,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -18,6 +18,25 @@
"import s2spy.time"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "AdventCalendar(month=12, day=31, freq=7d, n_targets=1, max_lag=None)\n"
+ ]
+ }
+ ],
+ "source": [
+ "calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq=\"7d\")\n",
+ "calendar\n",
+ "print(calendar)"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -27,25 +46,22 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
- "text/html": [
- "AdventCalendar(month=11, day=30, freq=90d)"
- ],
"text/plain": [
- "AdventCalendar(month=11, day=30, freq=90d)"
+ "AdventCalendar(month=11, day=30, freq=90d, n_targets=1, max_lag=None)"
]
},
- "execution_count": 17,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "calendar = s2spy.time.AdventCalendar(anchor_date=(11, 30), freq='90d', n_targets=1)\n",
+ "calendar = s2spy.time.AdventCalendar(anchor=(11, 30), freq='90d', n_targets=1)\n",
"calendar"
]
},
@@ -58,7 +74,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 4,
"metadata": {},
"outputs": [
{
@@ -117,14 +133,14 @@
"2020 (2020-03-05, 2020-06-03] (2019-12-06, 2020-03-05] "
]
},
- "execution_count": 18,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "intervals = calendar.map_years(2020, 2020)\n",
- "intervals"
+ "calendar = calendar.map_years(2020, 2020)\n",
+ "calendar.show()"
]
},
{
@@ -136,7 +152,7 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -213,14 +229,14 @@
"2020 (2020-03-05, 2020-06-03] (2019-12-06, 2020-03-05] "
]
},
- "execution_count": 19,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "intervals = calendar.map_years(2020, 2022)\n",
- "intervals"
+ "calendar = calendar.map_years(2020, 2022)\n",
+ "calendar.show()"
]
},
{
@@ -232,7 +248,7 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
@@ -254,7 +270,7 @@
"dtype: interval"
]
},
- "execution_count": 20,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -273,7 +289,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
@@ -312,6 +328,13 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
+ " <th>2022</th>\n",
+ " <td>(2022-09-01, 2022-11-30]</td>\n",
+ " <td>(2022-06-03, 2022-09-01]</td>\n",
+ " <td>(2022-03-05, 2022-06-03]</td>\n",
+ " <td>(2021-12-05, 2022-03-05]</td>\n",
+ " </tr>\n",
+ " <tr>\n",
" <th>2021</th>\n",
" <td>(2021-09-01, 2021-11-30]</td>\n",
" <td>(2021-06-03, 2021-09-01]</td>\n",
@@ -325,20 +348,6 @@
" <td>(2020-03-05, 2020-06-03]</td>\n",
" <td>(2019-12-06, 2020-03-05]</td>\n",
" </tr>\n",
- " <tr>\n",
- " <th>2019</th>\n",
- " <td>(2019-09-01, 2019-11-30]</td>\n",
- " <td>(2019-06-03, 2019-09-01]</td>\n",
- " <td>(2019-03-05, 2019-06-03]</td>\n",
- " <td>(2018-12-05, 2019-03-05]</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2018</th>\n",
- " <td>(2018-09-01, 2018-11-30]</td>\n",
- " <td>(2018-06-03, 2018-09-01]</td>\n",
- " <td>(2018-03-05, 2018-06-03]</td>\n",
- " <td>(2017-12-05, 2018-03-05]</td>\n",
- " </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
@@ -346,20 +355,18 @@
"text/plain": [
"i_interval (target) 0 1 \\\n",
"anchor_year \n",
+ "2022 (2022-09-01, 2022-11-30] (2022-06-03, 2022-09-01] \n",
"2021 (2021-09-01, 2021-11-30] (2021-06-03, 2021-09-01] \n",
"2020 (2020-09-01, 2020-11-30] (2020-06-03, 2020-09-01] \n",
- "2019 (2019-09-01, 2019-11-30] (2019-06-03, 2019-09-01] \n",
- "2018 (2018-09-01, 2018-11-30] (2018-06-03, 2018-09-01] \n",
"\n",
"i_interval 2 3 \n",
"anchor_year \n",
+ "2022 (2022-03-05, 2022-06-03] (2021-12-05, 2022-03-05] \n",
"2021 (2021-03-05, 2021-06-03] (2020-12-05, 2021-03-05] \n",
- "2020 (2020-03-05, 2020-06-03] (2019-12-06, 2020-03-05] \n",
- "2019 (2019-03-05, 2019-06-03] (2018-12-05, 2019-03-05] \n",
- "2018 (2018-03-05, 2018-06-03] (2017-12-05, 2018-03-05] "
+ "2020 (2020-03-05, 2020-06-03] (2019-12-06, 2020-03-05] "
]
},
- "execution_count": 21,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -371,17 +378,21 @@
"# generate input data\n",
"test_data = pd.Series(var, index=time_index)\n",
"# map year to data\n",
- "intervals = calendar.map_to_data(test_data)\n",
- "intervals"
+ "calendar = calendar.map_to_data(test_data)\n",
+ "calendar.show()"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
- "interpreter": {
- "hash": "e7604e8ec5f09e490e10161e37a4725039efd3ab703d81b1b8a1e00d6741866c"
- },
"kernelspec": {
- "display_name": "Python 3.8.5 ('base')",
+ "display_name": "Python 3.10.5 ('ai4s2s')",
"language": "python",
"name": "python3"
},
@@ -395,9 +406,14 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.5"
+ "version": "3.10.5"
},
- "orig_nbformat": 4
+ "orig_nbformat": 4,
+ "vscode": {
+ "interpreter": {
+ "hash": "a87ac8a6238ac8fffcd070769ea0ffc634a0ba702c52b706c3554dda7777b3fd"
+ }
+ }
},
"nbformat": 4,
"nbformat_minor": 2
diff --git a/s2spy/__init__.py b/s2spy/__init__.py
index b372190..edb7084 100644
--- a/s2spy/__init__.py
+++ b/s2spy/__init__.py
@@ -16,3 +16,5 @@ logging.getLogger(__name__).addHandler(logging.NullHandler())
__author__ = "Yang Liu"
__email__ = "[email protected]"
__version__ = "0.1.0"
+
+__all__ = ["dimensionality", "time", "traintest", "RGDR"]
diff --git a/s2spy/_base_calendar.py b/s2spy/_base_calendar.py
new file mode 100644
index 0000000..4f1f880
--- /dev/null
+++ b/s2spy/_base_calendar.py
@@ -0,0 +1,228 @@
+"""BaseCalendar is a template for specific implementations of different calendars.
+
+The BaseCalendar includes most methods required for all calendar operations, except for
+a set of abstract methods (e.g., __init__, _get_anchor, ...). These will have to be
+customized for each specific calendar.
+"""
+from abc import ABC
+from abc import abstractmethod
+from typing import Union
+import numpy as np
+import pandas as pd
+import xarray as xr
+from . import utils
+
+
+PandasData = (pd.Series, pd.DataFrame)
+XArrayData = (xr.DataArray, xr.Dataset)
+
+
+class BaseCalendar(ABC):
+ """Base calendar class which serves as a template for specific implementations."""
+
+ _mapping = None
+
+ @abstractmethod
+ def __init__(self, anchor, freq, n_targets: int = 1, max_lag: int = None):
+ """For initializing calendars, the following four variables will be required."""
+ self.n_targets = n_targets
+ self.max_lag = max_lag
+ self.anchor = anchor
+ self.freq = freq
+
+ @abstractmethod
+ def _get_anchor(self, year: int) -> pd.Timestamp:
+ """Method to generate an anchor timestamp for your specific calendar.
+
+ The method should return the exact timestamp of the end of the anchor_year's
+ 0 interval, e.g., for the AdventCalendar:
+ pd.Timestamp(year, self.month, self.day)
+
+ Args:
+ year (int): anchor year for which the anchor timestamp should be generated
+
+ Returns:
+ pd.Timestamp: Timestamp at the end of the anchor_years interval 0.
+ """
+ return pd.Timestamp()
+
+ def _map_year(self, year: int) -> pd.Series:
+ """Internal routine to return a concrete IntervalIndex for the given year.
+
+ Since our calendars are used to study periodic events, they are first
+ instantiated without specific year(s). This method adds a specific year
+ to the calendar and returns an intervalindex, mapping the
+ Calendar to the given year.
+
+ Intended for internal use, in conjunction with map_years or map_to_data.
+
+ Args:
+ year: The year for which the Calendar will be realized
+
+ Returns:
+ Pandas Series filled with Intervals of the calendar's frequency, counting
+ backwards from the calendar's achor.
+ """
+ year_intervals = pd.interval_range(
+ end=self._get_anchor(year),
+ periods=self._get_nintervals(),
+ freq=self.freq,
+ )
+
+ year_intervals = pd.Series(year_intervals[::-1], name=str(year))
+ year_intervals.index.name = "i_interval"
+ return year_intervals
+
+ def _get_nintervals(self) -> int:
+ """Calculates the number of intervals that should be generated by _map year.
+
+ Returns:
+ int: Number of intervals for one anchor year.
+ """
+ periods_per_year = pd.Timedelta("365days") / pd.to_timedelta(self.freq)
+ return (
+ (self.max_lag + self.n_targets) if self.max_lag else int(periods_per_year)
+ )
+
+ def _get_skip_nyears(self) -> int:
+ """Determine how many years need to be skipped to avoid overlapping data.
+
+ Required to prevent information leakage between anchor years.
+
+ Returns:
+ int: Number of years that need to be skipped.
+ """
+ nintervals = self._get_nintervals()
+ periods_per_year = pd.Timedelta("365days") / pd.to_timedelta(self.freq)
+
+ return (
+ (np.ceil(nintervals / periods_per_year).astype(int) - 1)
+ if self.max_lag
+ else 0
+ )
+
+ def map_years(self, start: int, end: int):
+ """Adds a start and end year mapping to the calendar.
+
+ If the start and end years are the same, the intervals for only that single
+ year are returned by calendar.get_intervals().
+
+ Args:
+ start: The first year for which the calendar will be realized
+ end: The last year for which the calendar will be realized
+
+ Returns:
+ The calendar mapped to the input start and end year.
+ """
+ self._first_year = start
+ self._last_year = end
+ self._mapping = "years"
+ return self
+
+ def map_to_data(
+ self,
+ input_data: Union[pd.Series, pd.DataFrame, xr.Dataset, xr.DataArray],
+ ):
+ """Map the calendar to input data period.
+
+ Stores the first and last intervals of the input data to the calendar, so that
+ the intervals can cover the data to the greatest extent.
+
+ Args:
+ input_data: Input data for datetime mapping. Its index must be either
+ pandas.DatetimeIndex, or an xarray `time` coordinate with datetime
+ data.
+
+ Returns:
+ The calendar mapped to the input data period.
+ """
+ utils.check_timeseries(input_data)
+
+ # check the datetime order of input data
+ if isinstance(input_data, PandasData):
+ self._first_timestamp = input_data.index.min()
+ self._last_timestamp = input_data.index.max()
+ else:
+ self._first_timestamp = pd.Timestamp(input_data.time.min().values)
+ self._last_timestamp = pd.Timestamp(input_data.time.max().values)
+
+ self._mapping = "data"
+
+ return self
+
+ def _set_year_range_from_timestamps(self):
+ map_first_year = self._first_timestamp.year
+ map_last_year = self._last_timestamp.year
+
+ # ensure that the input data could always cover the advent calendar
+ # last date check
+ if self._map_year(map_last_year).iloc[0].right > self._last_timestamp:
+ map_last_year -= 1
+ # first date check
+ if self._map_year(map_first_year).iloc[-1].left < self._first_timestamp:
+ map_first_year += 1
+
+ # map year(s) and generate year realized advent calendar
+ if map_last_year >= map_first_year:
+ self._first_year = map_first_year
+ self._last_year = map_last_year
+ else:
+ raise ValueError(
+ "The input data could not cover the target advent calendar."
+ )
+
+ return self
+
+ def _label_targets(self, intervals: pd.DataFrame) -> pd.DataFrame:
+ """Adds target labels to the header row of the intervals.
+
+ Args:
+ intervals (pd.Dataframe): Dataframe with intervals.
+
+ Returns:
+ pd.Dataframe: Dataframe with target periods labelled.
+ """
+ return intervals.rename(
+ columns={i: f"(target) {i}" for i in range(self.n_targets)}
+ )
+
+ def get_intervals(self) -> pd.DataFrame:
+ """Method to retrieve updated intervals from the Calendar object."""
+ if self._mapping is None:
+ raise ValueError(
+ "Cannot retrieve intervals without map_years or "
+ "map_to_data having configured the calendar."
+ )
+ if self._mapping == "data":
+ self._set_year_range_from_timestamps()
+
+ year_range = range(
+ self._last_year, self._first_year - 1, -(self._get_skip_nyears() + 1)
+ )
+
+ intervals = pd.concat([self._map_year(year) for year in year_range], axis=1).T
+
+ intervals.index.name = "anchor_year"
+ return intervals
+
+ def show(self) -> pd.DataFrame:
+ """Displays the intervals the Calendar will generate for the current setup.
+
+ Returns:
+ pd.Dataframe: Dataframe containing the calendar intervals, with the target
+ periods labelled.
+ """
+ return self._label_targets(self.get_intervals())
+
+ def __repr__(self) -> str:
+ """String representation of the Calendar."""
+ props = ", ".join(
+ [f"{k}={v}" for k, v in self.__dict__.items() if not k.startswith("_")]
+ )
+ calendar_name = self.__class__.__name__
+ return f"{calendar_name}({props})"
+
+ @property
+ def flat(self) -> pd.DataFrame:
+ """Returns the flattened intervals."""
+ return self.get_intervals().stack()
diff --git a/s2spy/_resample.py b/s2spy/_resample.py
new file mode 100644
index 0000000..b61130f
--- /dev/null
+++ b/s2spy/_resample.py
@@ -0,0 +1,243 @@
+import warnings
+from typing import Union
+import numpy as np
+import pandas as pd
+import xarray as xr
+from . import utils
+
+
+PandasData = (pd.Series, pd.DataFrame)
+XArrayData = (xr.DataArray, xr.Dataset)
+
+
+def mark_target_period(
+ calendar, input_data: Union[pd.DataFrame, xr.Dataset]
+) -> Union[pd.DataFrame, xr.Dataset]:
+ """Mark interval periods that fall within the given number of target periods.
+
+ Pass a pandas Series/DataFrame with an 'i_interval' column, or an xarray
+ DataArray/Dataset with an 'i_interval' coordinate axis. It will return an
+ object with an added column in the Series/DataFrame or an
+ added coordinate axis in the DataSet called 'target'. This is a boolean
+ indicating whether the index time interval is a target period or not. This is
+ determined by the instance variable 'n_targets'.
+
+ Args:
+ input_data: Input data for resampling. For a Pandas object, one of its
+ columns must be called 'i_interval'. An xarray object requires a coordinate
+ axis named 'i_interval' containing an interval counter for every period.
+
+ Returns:
+ Input data with boolean marked target periods, similar data format as
+ given inputs.
+ """
+ if isinstance(input_data, PandasData):
+ input_data["target"] = np.zeros(input_data.index.size, dtype=bool)
+ input_data["target"] = input_data["target"].where(
+ input_data["i_interval"] >= calendar.n_targets, other=True
+ )
+
+ else:
+ # input data is xr.Dataset
+ target = input_data["i_interval"] < calendar.n_targets
+ input_data = input_data.assign_coords(coords={"target": target})
+
+ return input_data
+
+
+def resample_bins_constructor(
+ intervals: Union[pd.Series, pd.DataFrame]
+) -> pd.DataFrame:
+ """Restructures the interval object into a tidy DataFrame.
+
+ Args:
+ intervals: the output interval `pd.Series` or `pd.DataFrame` from the
+ `map_to_data` function.
+
+ Returns:
+ Pandas DataFrame with 'anchor_year', 'i_interval', and 'interval' as
+ columns.
+ """
+ # Make a tidy dataframe where the intervals are linked to the anchor year
+ if isinstance(intervals, pd.DataFrame):
+ bins = intervals.copy()
+ bins.index.rename("anchor_year", inplace=True)
+ bins = bins.melt(
+ var_name="i_interval", value_name="interval", ignore_index=False
+ )
+ bins = bins.sort_values(by=["anchor_year", "i_interval"])
+ else:
+ # Massage the dataframe into the same tidy format for a single year
+ bins = pd.DataFrame(intervals)
+ bins = bins.melt(
+ var_name="anchor_year", value_name="interval", ignore_index=False
+ )
+ bins.index.rename("i_interval", inplace=True)
+ bins = bins.reset_index()
+
+ return bins
+
+
+def resample_pandas(
+ calendar, input_data: Union[pd.Series, pd.DataFrame]
+) -> pd.DataFrame:
+ """Internal function to handle resampling of Pandas data.
+
+ Args:
+ input_data (pd.Series or pd.DataFrame): Data provided by the user to the
+ `resample` function
+
+ Returns:
+ pd.DataFrame: DataFrame containing the intervals and data resampled to
+ these intervals.
+ """
+ bins = resample_bins_constructor(calendar.get_intervals())
+
+ interval_index = pd.IntervalIndex(bins["interval"])
+ interval_groups = interval_index.get_indexer(input_data.index)
+ interval_means = input_data.groupby(interval_groups).mean()
+
+ # drop the -1 index, as it represents data outside of all intervals
+ interval_means = interval_means.loc[0:]
+
+ if isinstance(input_data, pd.DataFrame):
+ for name in input_data.keys():
+ bins[name] = interval_means[name].values
+ else:
+ name = "mean_data" if input_data.name is None else input_data.name
+ bins[name] = interval_means.values
+
+ return bins
+
+
+def resample_xarray(
+ calendar, input_data: Union[xr.DataArray, xr.Dataset]
+) -> xr.Dataset:
+ """Internal function to handle resampling of xarray data.
+
+ Args:
+ input_data (xr.DataArray or xr.Dataset): Data provided by the user to the
+ `resample` function
+
+ Returns:
+ xr.Dataset: Dataset containing the intervals and data resampled to
+ these intervals.
+ """
+ bins = resample_bins_constructor(calendar.get_intervals())
+
+ # Create the indexer to connect the input data with the intervals
+ interval_index = pd.IntervalIndex(bins["interval"])
+ interval_groups = interval_index.get_indexer(input_data["time"])
+ interval_means = input_data.groupby(
+ xr.IndexVariable("time", interval_groups)
+ ).mean()
+ interval_means = interval_means.rename({"time": "index"})
+
+ # drop the indices below 0, as it represents data outside of all intervals
+ interval_means = interval_means.sel(index=slice(0, None))
+
+ # Turn the bins dataframe into an xarray object and merge the data means into it
+ bins = bins.to_xarray()
+ if isinstance(interval_means, xr.DataArray) and interval_means.name is None:
+ interval_means = interval_means.rename("mean_values")
+ bins = xr.merge([bins, interval_means])
+
+ bins["anchor_year"] = bins["anchor_year"].astype(int)
+
+ # Turn the anchor year and interval count into coordinates
+ bins = bins.assign_coords(
+ {"anchor_year": bins["anchor_year"], "i_interval": bins["i_interval"]}
+ )
+ # Also make the intervals themselves a coordinate so they are not lost when
+ # grabbing a variable from the resampled dataset.
+ bins = bins.set_coords("interval")
+
+ # Reshaping the dataset to have the anchor_year and i_interval as dimensions.
+ # set anchor_year or i_interval as the main dimension
+ # (otherwise index is kept as dimension)
+ bins = bins.swap_dims({"index": "anchor_year"})
+ bins = bins.set_index(ai=("anchor_year", "i_interval"))
+ bins = bins.unstack()
+ bins = bins.transpose("anchor_year", "i_interval", ...)
+
+ return bins
+
+
+def resample(
+ mapped_calendar,
+ input_data: Union[pd.Series, pd.DataFrame, xr.DataArray, xr.Dataset],
+) -> Union[pd.DataFrame, xr.Dataset]:
+ """Resample input data to the calendar frequency.
+
+ Pass a pandas Series/DataFrame with a datetime axis, or an
+ xarray DataArray/Dataset with a datetime coordinate called 'time'.
+ It will return the same object with the datetimes resampled onto
+ the Calendar's Index by binning the data into the Calendar's intervals
+ and calculating the mean of each bin.
+
+ Note: this function is intended for upscaling operations, which means
+ the calendar frequency is larger than the original frequency of input data (e.g.
+ `freq` is "7days" and the input is daily data). It supports downscaling
+ operations but the user need to be careful since the returned values may contain
+ "NaN".
+
+ Args:
+ mapped_calendar: Calendar object with either a map_year or map_to_data mapping.
+ input_data: Input data for resampling. For a Pandas object its index must be
+ either a pandas.DatetimeIndex. An xarray object requires a dimension
+ named 'time' containing datetime values.
+
+ Raises:
+ UserWarning: If the calendar frequency is smaller than the frequency of
+ input data
+
+ Returns:
+ Input data resampled based on the calendar frequency, similar data format as
+ given inputs.
+
+ Example:
+ Assuming the input data is pd.DataFrame containing random values with index
+ from 2021-11-11 to 2021-11-01 at daily frequency.
+
+ >>> import s2spy.time
+ >>> import pandas as pd
+ >>> import numpy as np
+ >>> cal = s2spy.time.AdventCalendar(freq='180d')
+ >>> time_index = pd.date_range('20191201', '20211231', freq='1d')
+ >>> var = np.arange(len(time_index))
+ >>> input_data = pd.Series(var, index=time_index)
+ >>> cal = cal.map_to_data(input_data)
+ >>> bins = s2spy.time.resample(cal, input_data)
+ >>> bins # doctest: +NORMALIZE_WHITESPACE
+ anchor_year i_interval interval mean_data target
+ 0 2020 0 (2020-06-03, 2020-11-30] 275.5 True
+ 1 2020 1 (2019-12-06, 2020-06-03] 95.5 False
+ 2 2021 0 (2021-06-03, 2021-11-30] 640.5 True
+ 3 2021 1 (2020-12-05, 2021-06-03] 460.5 False
+
+ """
+ if mapped_calendar.get_intervals() is None:
+ raise ValueError("Generate a calendar map before calling resample")
+
+ utils.check_timeseries(input_data)
+
+ if isinstance(input_data, PandasData):
+ # raise a warning for upscaling
+ # target frequency must be larger than the (absolute) input frequency
+ if input_data.index.freq:
+ input_freq = input_data.index.freq
+ input_freq = input_freq if input_freq.n > 0 else -input_freq
+ if pd.Timedelta(mapped_calendar.freq) < input_freq:
+ warnings.warn(
+ """Target frequency is smaller than the original frequency.
+ The resampled data will contain NaN values, as there is no data
+ available within all intervals."""
+ )
+
+ resampled_data = resample_pandas(mapped_calendar, input_data)
+
+ else:
+ resampled_data = resample_xarray(mapped_calendar, input_data)
+
+ # mark target periods before returning the resampled data
+ return mark_target_period(mapped_calendar, resampled_data)
diff --git a/s2spy/rgdr/_rgdr.py b/s2spy/rgdr/_rgdr.py
index ff89f25..55b258e 100644
--- a/s2spy/rgdr/_rgdr.py
+++ b/s2spy/rgdr/_rgdr.py
@@ -66,7 +66,7 @@ def spherical_area(latitude: float, dlat: float, dlon: float = None) -> float:
return spherical_area * surface_area_earth_km2
-def cluster_area(ds: xr.Dataset, cluster_label: float) -> float:
+def cluster_area(ds: xr.Dataset, cluster_label: float) -> np.ndarray:
"""Determines the total area of a cluster. Requires the input dataset to have the
variables `area` and `cluster_labels`.
@@ -125,7 +125,7 @@ def weighted_groupby(ds: xr.Dataset, groupby: str, weight: str, method: str = "m
# find stacked dim name:
group_dims = list(groups)[0][1].dims # Get ds of first group
- stacked_dims = [dim for dim in group_dims.keys() if "stacked_" in dim]
+ stacked_dims = [dim for dim in group_dims.keys() if "stacked_" in dim] # type: ignore
reduced_data = [
getattr(g.weighted(g[weight]), method)(dim=stacked_dims) for _, g in groups
diff --git a/s2spy/time.py b/s2spy/time.py
index 8ae4a72..288c4d5 100644
--- a/s2spy/time.py
+++ b/s2spy/time.py
@@ -9,27 +9,26 @@ attention to the treatment of adjacent cycles, we avoid information leakage
between train and test sets.
Example:
-
>>> import s2spy.time
>>>
>>> # Countdown the weeks until New Year's Eve
- >>> calendar = s2spy.time.AdventCalendar(anchor_date=(12, 31), freq="7d")
+ >>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq="7d")
>>> calendar
- AdventCalendar(month=12, day=31, freq=7d)
- >>> print(calendar)
- 52 periods of 7d leading up to 12/31.
+ AdventCalendar(month=12, day=31, freq=7d, n_targets=1, max_lag=None)
>>> # Get the 180-day periods leading up to New Year's eve for the year 2020
- >>> calendar = s2spy.time.AdventCalendar(anchor_date=(12, 31), freq='180d')
- >>> calendar.map_years(2020, 2020) # doctest: +NORMALIZE_WHITESPACE
+ >>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq='180d')
+ >>> calendar = calendar.map_years(2020, 2020)
+ >>> calendar.show() # doctest: +NORMALIZE_WHITESPACE
i_interval (target) 0 1
anchor_year
2020 (2020-07-04, 2020-12-31] (2020-01-06, 2020-07-04]
>>> # Get the 180-day periods leading up to New Year's eve for 2020 - 2022 inclusive.
- >>> calendar = s2spy.time.AdventCalendar(anchor_date=(12, 31), freq='180d')
+ >>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq='180d')
+ >>> calendar = calendar.map_years(2020, 2022)
>>> # note the leap year:
- >>> calendar.map_years(2020, 2022) # doctest: +NORMALIZE_WHITESPACE
+ >>> calendar.show() # doctest: +NORMALIZE_WHITESPACE
i_interval (target) 0 1
anchor_year
2022 (2022-07-04, 2022-12-31] (2022-01-05, 2022-07-04]
@@ -48,24 +47,35 @@ Example:
dtype: interval
"""
-import warnings
+import calendar as pycalendar
+import re
+from typing import Optional
from typing import Tuple
-from typing import Union
import numpy as np
import pandas as pd
import xarray as xr
+from ._base_calendar import BaseCalendar
+from ._resample import resample # pylint: disable=unused-import
PandasData = (pd.Series, pd.DataFrame)
XArrayData = (xr.DataArray, xr.Dataset)
+month_mapping_dict = {
+ **{v.upper(): k for k, v in enumerate(pycalendar.month_abbr)},
+ **{v.upper(): k for k, v in enumerate(pycalendar.month_name)},
+}
+
-class AdventCalendar:
+class AdventCalendar(BaseCalendar):
"""Countdown time to anticipated anchor date or period of interest."""
def __init__(
- self, anchor_date: Tuple[int, int] = (11, 30), freq: str = "7d",
- n_targets: int = 1, max_lag: int = None
+ self,
+ anchor: Tuple[int, int] = (11, 30),
+ freq: str = "7d",
+ n_targets: int = 1,
+ max_lag: Optional[int] = None,
) -> None:
"""Instantiate a basic calendar with minimal configuration.
@@ -74,7 +84,7 @@ class AdventCalendar:
cycle time of one year.
Args:
- anchor_date: Tuple of the form (month, day). Effectively the origin
+ anchor: Tuple of the form (month, day). Effectively the origin
of the calendar. It will countdown until this date.
freq: Frequency of the calendar.
n_targets: integer specifying the number of target intervals in a period.
@@ -90,430 +100,219 @@ class AdventCalendar:
eve.
>>> import s2spy.time
- >>> calendar = s2spy.time.AdventCalendar(anchor_date=(12, 31), freq="7d")
+ >>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq="7d")
>>> calendar
- AdventCalendar(month=12, day=31, freq=7d)
- >>> print(calendar)
- "52 periods of 7d leading up to 12/31."
+ AdventCalendar(month=12, day=31, freq=7d, n_targets=1, max_lag=None)
"""
- self.month = anchor_date[0]
- self.day = anchor_date[1]
+ if not re.fullmatch(r"\d*d", freq):
+ raise ValueError("Please input a frequency in the form of '10d'")
+ self.month = anchor[0]
+ self.day = anchor[1]
self.freq = freq
- self._n_intervals = pd.Timedelta("365days") // pd.to_timedelta(freq)
- self._n_targets = n_targets
- self._traintest = None
- self._intervals = None
-
- periods_per_year = pd.Timedelta("365days") / pd.to_timedelta(freq)
- # Determine the amount of intervals, and number of anchor years to skip
- if max_lag:
- self._n_intervals = max_lag + self._n_targets
- self._skip_years = np.ceil(self._n_intervals /
- periods_per_year).astype(int) - 1
- else:
- self._n_intervals = int(periods_per_year)
- self._skip_years = 0
-
- def _map_year(self, year: int) -> pd.Series:
- """Internal routine to return a concrete IntervalIndex for the given year.
-
- Since the AdventCalendar represents a periodic event, it is first
- instantiated without a specific year. This method adds a specific year
- to the calendar and returns an intervalindex, applying the
- AdvenctCalendar to this specific year.
+ self.n_targets = n_targets
+ self.max_lag = max_lag
+
+ def _get_anchor(self, year: int) -> pd.Timestamp:
+ """Generates a timestamp for the end of interval 0 in year.
Args:
- year: The year for which the AdventCalendar will be realized
+ year (int): anchor year for which the anchor timestamp should be generated
Returns:
- Pandas Series filled with Intervals of the calendar's frequency, counting
- backwards from the calendar's anchor_date.
+ pd.Timestamp: Timestamp at the end of the anchor_years interval 0.
"""
- anchor = pd.Timestamp(year, self.month, self.day)
- intervals = pd.interval_range(
- end=anchor, periods=self._n_intervals, freq=self.freq
- )
- intervals = pd.Series(intervals[::-1], name=str(year))
- intervals.index.name = "i_interval"
- return intervals
+ return pd.Timestamp(year, self.month, self.day)
- def map_years(self, start: int = 1979, end: int = 2020) -> pd.DataFrame:
- """Return a periodic IntervalIndex for the given years.
- If the start and end years are the same, the Intervals for only that single
- year are returned.
- Args:
- start: The first year for which the calendar will be realized
- end: The last year for which the calendar will be realized
+class MonthlyCalendar(BaseCalendar):
+ """Countdown time to anticipated anchor month, in steps of whole months."""
- Returns:
- Pandas DataFrame filled with Intervals of the calendar's frequency,
- counting backwards from the calendar's anchor_date.
+ def __init__(
+ self,
+ anchor: str = "Dec",
+ freq: str = "1M",
+ n_targets: int = 1,
+ max_lag: Optional[int] = None,
+ ) -> None:
+ """Instantiate a basic monthly calendar with minimal configuration.
+
+ Set up the calendar with given freq ending exactly on the anchor month.
+ The index will extend back in time as many periods as fit within the
+ cycle time of one year.
+
+ Args:
+ anchor: Str in the form 'January' or 'Jan'. Effectively the origin
+ of the calendar. It will countdown up to this month.
+ freq: Frequency of the calendar, in the form '1M', '2M', etc.
+ n_targets: integer specifying the number of target intervals in a period.
+ max_lag: Maximum number of lag periods after the target period. If `None`,
+ the maximum lag will be determined by how many fit in each anchor year.
+ If a maximum lag is provided, the intervals can either only cover part
+ of the year, or extend over multiple years. In case of a large max_lag
+ number where the intervals extend over multiple years, anchor years will
+ be skipped to avoid overlapping intervals.
Example:
+ Instantiate a calendar counting down the quarters (3 month periods) until
+ december.
>>> import s2spy.time
- >>> calendar = s2spy.time.AdventCalendar(anchor_date=(12, 31), freq='180d')
- >>> # note the leap year:
- >>> calendar.map_years(2020, 2022) # doctest: +NORMALIZE_WHITESPACE
- i_interval (target) 0 1
- anchor_year
- 2022 (2022-07-04, 2022-12-31] (2022-01-05, 2022-07-04]
- 2021 (2021-07-04, 2021-12-31] (2021-01-05, 2021-07-04]
- 2020 (2020-07-04, 2020-12-31] (2020-01-06, 2020-07-04]
-
- >>> # To get a stacked representation:
- >>> calendar.map_years(2020, 2022).flat
- anchor_year i_interval
- 2022 0 (2022-07-04, 2022-12-31]
- 1 (2022-01-05, 2022-07-04]
- 2021 0 (2021-07-04, 2021-12-31]
- 1 (2021-01-05, 2021-07-04]
- 2020 0 (2020-07-04, 2020-12-31]
- 1 (2020-01-06, 2020-07-04]
- dtype: interval
+ >>> calendar = s2spy.time.MonthlyCalendar(anchor='Dec', freq="3M")
+ >>> calendar
+ MonthlyCalendar(month=12, freq=3M, n_targets=1, max_lag=None)
"""
- year_range = range(end, start - 1, -(self._skip_years + 1))
+ if not re.fullmatch(r"\d*M", freq):
+ raise ValueError("Please input a frequency in the form of '2M'")
+ self.month = month_mapping_dict[anchor.upper()]
+ self.freq = freq
+ self.n_targets = n_targets
+ self.max_lag = max_lag
- self._intervals = pd.concat(
- [self._map_year(year) for year in year_range], axis=1
- ).T
+ def _get_anchor(self, year: int) -> pd.Timestamp:
+ """Generates a timestamp for the end of interval 0 in year.
- self._intervals.index.name = "anchor_year"
+ Args:
+ year (int): anchor year for which the anchor timestamp should be generated
- return self
+ Returns:
+ pd.Timestamp: Timestamp at the end of the anchor_years interval 0.
+ """
+ return pd.Timestamp(year, self.month, 1) + pd.tseries.offsets.MonthEnd(0)
- def map_to_data(
- self, input_data: Union[pd.Series, pd.DataFrame, xr.Dataset, xr.DataArray],
- ) -> Union[pd.DataFrame, xr.Dataset]:
- """Map the calendar to input data period.
+ def _get_nintervals(self) -> int:
+ """Calculates the number of intervals that should be generated by _map year.
- Get datetime range from input data and generate corresponding interval index.
- This method guarantees that the generated interval (calendar) indices would be
- covered by the input
- data.
- Args:
- input_data: Input data for datetime mapping. Its index must be either
- pandas.DatetimeIndex, or an xarray `time` coordinate with datetime
- data.
Returns:
- Pandas DataFrame or xarray Dataset filled with Intervals of the calendar's
- frequency. (see also ``map_years``)
+ int: Number of intervals for one anchor year.
"""
- # check the datetime order of input data
- if isinstance(input_data, PandasData):
- first_timestamp = input_data.index.min()
- last_timestamp = input_data.index.max()
- map_last_year = last_timestamp.year
- map_first_year = first_timestamp.year
- elif isinstance(input_data, XArrayData):
- first_timestamp = input_data.time.min()
- last_timestamp = input_data.time.max()
- map_last_year = last_timestamp.dt.year.values
- map_first_year = first_timestamp.dt.year.values
- else:
- raise ValueError(
- "incompatible input data format, please pass a pandas or xarray object"
- )
-
- # ensure that the input data could always cover the advent calendar
- # last date check
- if self._map_year(map_last_year).iloc[0].right > last_timestamp:
- map_last_year -= 1
- # first date check
- if self._map_year(map_first_year).iloc[-1].left < first_timestamp:
- map_first_year += 1
-
- # map year(s) and generate year realized advent calendar
- if map_last_year >= map_first_year:
- self.map_years(map_first_year, map_last_year)
- else:
- raise ValueError(
- "The input data could not cover the target advent calendar."
- )
-
- return self
-
- def _resample_bins_constructor(
- self, intervals: Union[pd.Series, pd.DataFrame]
- ) -> pd.DataFrame:
- """
- Restructures the interval object into a tidy DataFrame.
+ periods_per_year = 12 / int(self.freq.replace("M", ""))
+ return (
+ (self.max_lag + self.n_targets) if self.max_lag else int(periods_per_year)
+ )
- Args:
- intervals: the output interval `pd.Series` or `pd.DataFrame` from the
- `map_to_data` function.
+ def _get_skip_nyears(self) -> int:
+ """Determine how many years need to be skipped to avoid overlapping data.
+
+ Required to prevent information leakage between anchor years.
Returns:
- Pandas DataFrame with 'anchor_year', 'i_interval', and 'interval' as
- columns.
+ int: Number of years that need to be skipped.
"""
- # Make a tidy dataframe where the intervals are linked to the anchor year
- if isinstance(intervals, pd.DataFrame):
- bins = intervals.copy()
- bins.index.rename("anchor_year", inplace=True)
- bins = bins.melt(
- var_name="i_interval", value_name="interval", ignore_index=False
- )
- bins = bins.sort_values(by=["anchor_year", "i_interval"])
- else:
- # Massage the dataframe into the same tidy format for a single year
- bins = pd.DataFrame(intervals)
- bins = bins.melt(
- var_name="anchor_year", value_name="interval", ignore_index=False
- )
- bins.index.rename("i_interval", inplace=True)
- bins = bins.reset_index()
-
- return bins
-
- def _resample_pandas(
- self, input_data: Union[pd.Series, pd.DataFrame]
- ) -> pd.DataFrame:
- """Internal function to handle resampling of Pandas data.
+ nmonths = int(self.freq.replace("M", ""))
+ return (np.ceil(nmonths / 12) - 1) if self.max_lag else 0
+
+ def _interval_as_month(self, interval):
+ """Turns an interval with pandas Timestamp values to a formatted string.
+
+ The string will contain the years and months, for a more intuitive
+ representation to the user.
Args:
- input_data (pd.Series or pd.DataFrame): Data provided by the user to the
- `resample` function
+ interval (pd.Interval): Pandas interval.
Returns:
- pd.DataFrame: DataFrame containing the intervals and data resampled to
- these intervals.
+ str: String in the form of '(2020 Jan, 2020 Feb]'
"""
+ left = interval.left.strftime("%Y %b")
+ right = interval.right.strftime("%Y %b")
+ return f"({left}, {right}]"
- self.map_to_data(input_data)
- bins = self._resample_bins_constructor(self._intervals)
+ def show(self) -> pd.DataFrame:
+ """Displays the intervals the Calendar will generate for the current setup.
- interval_index = pd.IntervalIndex(bins["interval"])
- interval_groups = interval_index.get_indexer(input_data.index)
- interval_means = input_data.groupby(interval_groups).mean()
+ Returns:
+ pd.Dataframe: Dataframe containing the calendar intervals, with the target
+ periods labelled.
+ """
+ return self._label_targets(self.get_intervals()).applymap(
+ self._interval_as_month
+ )
- # drop the -1 index, as it represents data outside of all intervals
- interval_means = interval_means.loc[0:]
- if isinstance(input_data, pd.DataFrame):
- for name in input_data.keys():
- bins[name] = interval_means[name].values
- else:
- name = "mean_data" if input_data.name is None else input_data.name
- bins[name] = interval_means.values
+class WeeklyCalendar(BaseCalendar):
+ """Countdown time to anticipated anchor week number, in steps of calendar weeks."""
- return bins
+ def __init__(
+ self,
+ anchor: int,
+ freq: str = "1W",
+ n_targets: int = 1,
+ max_lag: Optional[int] = None,
+ ) -> None:
+ """Instantiate a basic week number calendar with minimal configuration.
- def _resample_xarray(
- self, input_data: Union[xr.DataArray, xr.Dataset]
- ) -> xr.Dataset:
- """Internal function to handle resampling of xarray data.
+ Set up the calendar with given freq ending exactly on the anchor week.
+ The index will extend back in time as many weeks as fit within the
+ cycle time of one year (i.e. 52).
+ Note that the difference between this calendar and the AdventCalendar revolves
+ around the use of calendar weeks (Monday - Sunday), instead of 7-day periods.
Args:
- input_data (xr.DataArray or xr.Dataset): Data provided by the user to the
- `resample` function
+ anchor: Int denoting the week number. Effectively the origin of the calendar.
+ It will countdown until this week.
+ freq: Frequency of the calendar, e.g. '2W'.
+ n_targets: integer specifying the number of target intervals in a period.
+ max_lag: Maximum number of lag periods after the target period. If `None`,
+ the maximum lag will be determined by how many fit in each anchor year.
+ If a maximum lag is provided, the intervals can either only cover part
+ of the year, or extend over multiple years. In case of a large max_lag
+ number where the intervals extend over multiple years, anchor years will
+ be skipped to avoid overlapping intervals.
- Returns:
- xr.Dataset: Dataset containing the intervals and data resampled to
- these intervals."""
-
- self.map_to_data(input_data)
- bins = self._resample_bins_constructor(self._intervals)
-
- # Create the indexer to connect the input data with the intervals
- interval_index = pd.IntervalIndex(bins["interval"])
- interval_groups = interval_index.get_indexer(input_data["time"])
- interval_means = input_data.groupby(
- xr.IndexVariable("time", interval_groups)
- ).mean()
- interval_means = interval_means.rename({"time": "index"})
-
- # drop the indices below 0, as it represents data outside of all intervals
- interval_means = interval_means.sel(index=slice(0, None))
-
- # Turn the bins dataframe into an xarray object and merge the data means into it
- bins = bins.to_xarray()
- if isinstance(input_data, xr.Dataset):
- bins = xr.merge([bins, interval_means])
- else:
- if interval_means.name is None:
- interval_means = interval_means.rename("mean_values")
- bins = xr.merge([bins, interval_means])
- bins["anchor_year"] = bins["anchor_year"].astype(int)
-
- # Turn the anchor year and interval count into coordinates
- bins = bins.assign_coords(
- {"anchor_year": bins["anchor_year"], "i_interval": bins["i_interval"]}
- )
- # Also make the intervals themselves a coordinate so they are not lost when
- # grabbing a variable from the resampled dataset.
- bins = bins.set_coords('interval')
-
- # Reshaping the dataset to have the anchor_year and i_interval as dimensions.
- # set anchor_year or i_interval as the main dimension
- # (otherwise index is kept as dimension)
- bins = bins.swap_dims({'index': 'anchor_year'})
- bins = bins.set_index(ai=('anchor_year', 'i_interval'))
- bins = bins.unstack()
- bins = bins.transpose("anchor_year", "i_interval", ...)
-
- return bins
-
- def resample(
- self, input_data: Union[pd.Series, pd.DataFrame, xr.DataArray, xr.Dataset]
- ) -> Union[pd.DataFrame, xr.Dataset]:
- """Resample input data to the calendar frequency.
-
- Pass a pandas Series/DataFrame with a datetime axis, or an
- xarray DataArray/Dataset with a datetime coordinate called 'time'.
- It will return the same object with the datetimes resampled onto
- the Calendar's Index by binning the data into the Calendar's intervals
- and calculating the mean of each bin.
-
- Note: this function is intended for upscaling operations, which means
- the calendar frequency is larger than the original frequency of input data (e.g.
- `freq` is "7days" and the input is daily data). It supports downscaling
- operations but the user need to be careful since the returned values may contain
- "NaN".
+ Example:
+ Instantiate a calendar counting down the weeks until week number 40.
- Args:
- input_data: Input data for resampling. For a Pandas object its index must be
- either a pandas.DatetimeIndex. An xarray object requires a dimension
- named 'time' containing datetime values.
+ >>> import s2spy.time
+ >>> calendar = s2spy.time.WeeklyCalendar(anchor=40, freq="1W")
+ >>> calendar
+ WeeklyCalendar(week=40, freq=1W, n_targets=1, max_lag=None)
- Raises:
- UserWarning: If the calendar frequency is smaller than the frequency of
- input data
+ """
+ if not re.fullmatch(r"\d*W", freq):
+ raise ValueError("Please input a frequency in the form of '4W'")
- Returns:
- Input data resampled based on the calendar frequency, similar data format as
- given inputs.
+ self.week = anchor
+ self.freq = freq
+ self.n_targets = n_targets
+ self.max_lag = max_lag
- Example:
- Assuming the input data is pd.DataFrame containing random values with index
- from 2021-11-11 to 2021-11-01 at daily frequency.
+ def _get_anchor(self, year: int) -> pd.Timestamp:
+ """Generates a timestamp for the end of interval 0 in year.
- >>> import s2spy.time
- >>> import pandas as pd
- >>> import numpy as np
- >>> cal = s2spy.time.AdventCalendar(freq='180d')
- >>> time_index = pd.date_range('20191201', '20211231', freq='1d')
- >>> var = np.arange(len(time_index))
- >>> input_data = pd.Series(var, index=time_index)
- >>> bins = cal.resample(input_data)
- >>> bins
- anchor_year i_interval interval mean_data target
- 0 2020 0 (2020-06-03, 2020-11-30] 275.5 True
- 1 2020 1 (2019-12-06, 2020-06-03] 95.5 False
- 2 2021 0 (2021-06-03, 2021-11-30] 640.5 True
- 3 2021 1 (2020-12-05, 2021-06-03] 460.5 False
+ Args:
+ year (int): anchor year for which the anchor timestamp should be generated
+ Returns:
+ pd.Timestamp: Timestamp at the end of the anchor_years interval 0.
"""
- if not isinstance(input_data, PandasData + XArrayData):
- raise ValueError("The input data is neither a pandas or xarray object")
-
- if isinstance(input_data, PandasData):
- if not isinstance(input_data.index, pd.DatetimeIndex):
- raise ValueError("The input data does not have a datetime index.")
-
- # raise a warning for upscaling
- # target frequency must be larger than the (absolute) input frequency
- if input_data.index.freq:
- input_freq = input_data.index.freq
- input_freq = input_freq if input_freq.n > 0 else -input_freq
- if pd.Timedelta(self.freq) < input_freq:
- warnings.warn(
- """Target frequency is smaller than the original frequency.
- The resampled data will contain NaN values, as there is no data
- available within all intervals."""
- )
-
- resampled_data = self._resample_pandas(input_data)
-
- # Data must be xarray
- else:
- if "time" not in input_data.dims:
- raise ValueError(
- "The input DataArray/Dataset does not contain a `time` dimension"
- )
- if not xr.core.common.is_np_datetime_like(input_data["time"].dtype):
- raise ValueError("The `time` dimension is not of a datetime format")
-
- resampled_data = self._resample_xarray(input_data)
-
- # mark target periods before returning the resampled data
- return self._mark_target_period(resampled_data)
-
- def _label_targets(self, intervals):
- return intervals.rename(
- columns={i: f'(target) {i}' for i in range(self._n_targets)})
-
- def __str__(self):
- return f"{self._n_intervals} periods of {self.freq} leading up to {self.month}/{self.day}."
-
- def __repr__(self):
- if self._intervals is not None:
- return repr(self._label_targets(self._intervals))
-
- props = ", ".join(
- [f"{k}={v}" for k, v in self.__dict__.items() if not k.startswith("_")]
- )
- return f"AdventCalendar({props})"
+ # Day 0 of a weeknumber is sunday. Weeks start on monday (strftime functionality)
+ return pd.to_datetime(f"{year}-{self.week}-0", format="%Y-%W-%w")
- def _repr_html_(self):
- """For jupyter notebook to load html compatiable version of __repr__."""
- if self._intervals is not None:
- # pylint: disable=protected-access
- return self._label_targets(self._intervals)._repr_html_()
+ def _interval_as_weeknr(self, interval: pd.Interval) -> str:
+ """Turns an interval with pandas Timestamp values to a formatted string.
- props = ", ".join(
- [f"{k}={v}" for k, v in self.__dict__.items() if not k.startswith("_")]
- )
- return f"AdventCalendar({props})"
-
- @property
- def flat(self):
- if self._intervals is not None:
- return self._intervals.stack()
- raise ValueError("The calendar is not initialized with intervals yet."
- "use `map_years` or `map_to_data` methods to set it up.")
-
- def discard(self, max_lag): # or "set_max_lag"
- """Only keep indices up to the given max lag."""
- # or think of a nicer way to discard unneeded info
- raise NotImplementedError
-
- def _mark_target_period(
- self, input_data: Union[pd.DataFrame, xr.Dataset]
- ) -> Union[pd.DataFrame, xr.Dataset]:
- """Mark interval periods that fall within the given number of target periods.
-
- Pass a pandas Series/DataFrame with an 'i_interval' column, or an xarray
- DataArray/Dataset with an 'i_interval' coordinate axis. It will return an
- object with an added column in the Series/DataFrame or an
- added coordinate axis in the DataSet called 'target'. This is a boolean
- indicating whether the index time interval is a target period or not. This is
- determined by the instance variable 'n_targets'.
+ The string will contain the years and week numbers, for a more intuitive
+ representation to the user.
Args:
- input_data: Input data for resampling. For a Pandas object, one of its
- columns must be called 'i_interval'. An xarray object requires a coordinate
- axis named 'i_interval' containing an interval counter for every period.
+ interval (pd.Interval): Pandas interval.
Returns:
- Input data with boolean marked target periods, similar data format as
- given inputs.
+ str: String in the form of '(2020-50, 2020-51]'
"""
- if isinstance(input_data, PandasData):
- input_data['target'] = np.zeros(input_data.index.size, dtype=bool)
- input_data['target'] = input_data['target'].where(
- input_data['i_interval'] >= self._n_targets, other=True)
-
- else:
- #input data is xr.Dataset
- target = input_data['i_interval'] < self._n_targets
- input_data = input_data.assign_coords(coords={'target': target})
+ left = interval.left.strftime("%Y-W%W")
+ right = interval.right.strftime("%Y-W%W")
+ return f"({left}, {right}]"
- return input_data
+ def show(self) -> pd.DataFrame:
+ """Displays the intervals the Calendar will generate for the current setup.
- def get_lagged_indices(self, lag=1): # noqa
- """Return indices shifted backward by given lag."""
- raise NotImplementedError
+ Returns:
+ pd.Dataframe: Dataframe containing the calendar intervals, with the target
+ periods labelled.
+ """
+ return self._label_targets(self.get_intervals()).applymap(
+ self._interval_as_weeknr
+ )
diff --git a/s2spy/utils.py b/s2spy/utils.py
new file mode 100644
index 0000000..4f88764
--- /dev/null
+++ b/s2spy/utils.py
@@ -0,0 +1,38 @@
+import pandas as pd
+import xarray as xr
+
+
+PandasData = (pd.Series, pd.DataFrame)
+XArrayData = (xr.DataArray, xr.Dataset)
+
+
+def check_timeseries(data) -> None:
+ """Utility function to check input data.
+
+ Checks if:
+ - Input data is pd.Dataframe/pd.Series/xr.Dataset/xr.DataArray.
+ - Input data has a time index (pd), or a dim named `time` containing datetime
+ values
+ """
+ if not isinstance(data, PandasData + XArrayData):
+ raise ValueError("The input data is neither a pandas or xarray object")
+ if isinstance(data, PandasData):
+ check_time_dim_pandas(data)
+ elif isinstance(data, XArrayData):
+ check_time_dim_xarray(data)
+
+
+def check_time_dim_xarray(data) -> None:
+ """Utility function to check if xarray data has a time dimensions with time data."""
+ if "time" not in data.dims:
+ raise ValueError(
+ "The input DataArray/Dataset does not contain a `time` dimension"
+ )
+ if not xr.core.common.is_np_datetime_like(data["time"].dtype):
+ raise ValueError("The `time` dimension is not of a datetime format")
+
+
+def check_time_dim_pandas(data) -> None:
+ """Utility function to check if pandas data has an index with time data."""
+ if not isinstance(data.index, pd.DatetimeIndex):
+ raise ValueError("The input data does not have a datetime index.")
diff --git a/setup.cfg b/setup.cfg
index a4b9330..af69c11 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -48,15 +48,16 @@ install_requires =
dev =
bump2version
coverage [toml]
- prospector[with_pyroma]
isort
+ mypy
+ myst_parser
+ prospector[with_pyroma]
pytest
pytest-cov
sphinx
sphinx_rtd_theme
sphinx-autoapi
tox
- myst_parser
publishing =
twine
wheel
|
Unintuitive behavior when passing weekly frequencies to calendar.
When passing a pandas frequency to the AdventCalendar such as '2W', Pandas uses calendar weeks to generate the intervals. This causes the situation where the anchor date is not always in an interval.
Example below:
```python
import s2s.time
calendar = s2s.time.AdventCalendar(anchor_date=(5, 10), freq='20W')
calendar.map_years(2019, 2020)
```
returns;
```
>>> i_interval 0 1
>>> anchor_year
>>> 2020 (2019-12-22, 2020-05-10] (2019-08-04, 2019-12-22]
>>> 2019 (2018-12-16, 2019-05-05] (2018-07-29, 2018-12-16]
```
Expected behavior: raise an error when frequencies such as calendar week are passed.
|
AI4S2S/s2spy
|
diff --git a/s2spy/traintest.py b/s2spy/traintest.py
index a513369..16173be 100644
--- a/s2spy/traintest.py
+++ b/s2spy/traintest.py
@@ -3,6 +3,7 @@
A collection of train/test splitting approaches for cross-validation.
"""
from typing import Optional
+from typing import Type
from typing import Union
import numpy as np
import pandas as pd
@@ -10,11 +11,8 @@ import xarray as xr
from sklearn.model_selection._split import BaseCrossValidator
-SplitterClass = BaseCrossValidator
-
-
def split_groups(
- splitter: SplitterClass,
+ splitter: Type[BaseCrossValidator],
data: Union[xr.Dataset, pd.DataFrame],
key: Optional[str] = "anchor_year",
):
diff --git a/tests/test_dimensionality.py b/tests/test_dimensionality.py
index 054a731..77d4505 100644
--- a/tests/test_dimensionality.py
+++ b/tests/test_dimensionality.py
@@ -7,8 +7,8 @@ import s2spy.dimensionality
class TestDimensionality:
def test_RGDR(self):
with pytest.raises(NotImplementedError):
- s2spy.dimensionality.rgdr('series')
-
+ s2spy.dimensionality.rgdr("series")
+
def test_PCA(self):
with pytest.raises(NotImplementedError):
s2spy.dimensionality.pca()
diff --git a/tests/test_rgdr/test_rgdr.py b/tests/test_rgdr/test_rgdr.py
index bf646ba..155b431 100644
--- a/tests/test_rgdr/test_rgdr.py
+++ b/tests/test_rgdr/test_rgdr.py
@@ -6,6 +6,7 @@ import xarray as xr
from s2spy import RGDR
from s2spy.rgdr import _rgdr
from s2spy.time import AdventCalendar
+from s2spy.time import resample
# pylint: disable=protected-access
@@ -104,7 +105,7 @@ test_file_path = "./tests/test_rgdr/test_data"
class TestMapRegions:
@pytest.fixture(autouse=True)
def dummy_calendar(self):
- return AdventCalendar(anchor_date=(8, 31), freq="30d")
+ return AdventCalendar(anchor=(8, 31), freq="30d")
@pytest.fixture(autouse=True)
def example_target(self):
@@ -120,8 +121,9 @@ class TestMapRegions:
@pytest.fixture(autouse=True)
def example_corr(self, dummy_calendar, example_target, example_field):
- field = dummy_calendar.resample(example_field)
- target = dummy_calendar.resample(example_target)
+ cal = dummy_calendar.map_to_data(example_field)
+ field = resample(cal, example_field)
+ target = resample(cal, example_target)
field["corr"], field["p_val"] = _rgdr.correlation(
field.sst, target.ts.sel(i_interval=0), corr_dim="anchor_year"
diff --git a/tests/test_time.py b/tests/test_time.py
index a103647..7690288 100644
--- a/tests/test_time.py
+++ b/tests/test_time.py
@@ -5,9 +5,9 @@ import pandas as pd
import pytest
import xarray as xr
from s2spy.time import AdventCalendar
-
-
-# pylint: disable=protected-access
+from s2spy.time import MonthlyCalendar
+from s2spy.time import WeeklyCalendar
+from s2spy.time import resample
def interval(start, end):
@@ -17,9 +17,10 @@ def interval(start, end):
class TestAdventCalendar:
"""Test AdventCalendar methods."""
+
@pytest.fixture(autouse=True)
def dummy_calendar(self):
- cal = AdventCalendar(anchor_date=(12, 31), freq="240d")
+ cal = AdventCalendar(anchor=(12, 31), freq="240d")
cal.map_years(2021, 2021)
return cal
@@ -29,46 +30,115 @@ class TestAdventCalendar:
def test_repr(self):
cal = AdventCalendar()
- assert repr(cal) == "AdventCalendar(month=11, day=30, freq=7d)"
+ assert repr(cal) == (
+ "AdventCalendar(month=11, day=30, freq=7d, n_targets=1, max_lag=None)"
+ )
- def test_repr_with_intervals(self, dummy_calendar):
- expected_calendar_repr = ('i_interval (target) 0\n'
- 'anchor_year \n'
- '2021 (2021-05-05, 2021-12-31]')
+ def test_show(self, dummy_calendar):
+ expected_calendar_repr = (
+ "i_interval (target) 0\n anchor_year \n 2021 (2021-05-05, 2021-12-31]"
+ )
expected_calendar_repr = expected_calendar_repr.replace(" ", "")
- assert repr(dummy_calendar).replace(" ", "") == expected_calendar_repr
+ assert repr(dummy_calendar.show()).replace(" ", "") == expected_calendar_repr
- def test_str(self):
- cal = AdventCalendar()
- assert str(cal) == "52 periods of 7d leading up to 11/30."
+ def test_flat(self):
+ expected = np.array([interval("2021-05-05", "2021-12-31")])
+ cal = AdventCalendar(anchor=(12, 31), freq="240d")
+ cal.map_years(2021, 2021)
+ assert np.array_equal(cal.flat, expected)
- def test_discard(self):
+ def test_no_intervals(self):
cal = AdventCalendar()
+ with pytest.raises(ValueError):
+ cal.get_intervals()
- with pytest.raises(NotImplementedError):
- cal.discard(max_lag=5)
+ def test_incorrect_freq(self):
+ with pytest.raises(ValueError):
+ AdventCalendar(freq='2W')
- def test_get_lagged_indices(self):
- cal = AdventCalendar()
+class TestMonthlyCalendar:
+ """Test MonthlyCalendar methods."""
+
+ @pytest.fixture(autouse=True)
+ def dummy_calendar(self):
+ cal = MonthlyCalendar(anchor='Dec', freq="8M")
+ cal.map_years(2021, 2021)
+ return cal
+
+ def test_init(self):
+ cal = MonthlyCalendar(anchor='Dec', freq="2M")
+ assert isinstance(cal, MonthlyCalendar)
+
+ def test_repr(self):
+ cal = MonthlyCalendar(anchor='Dec', freq="2M")
+ assert repr(cal) == (
+ "MonthlyCalendar(month=12, freq=2M, n_targets=1, max_lag=None)"
+ )
- with pytest.raises(NotImplementedError):
- cal.get_lagged_indices()
+ def test_show(self, dummy_calendar):
+ expected_calendar_repr = (
+ "i_interval (target) 0\n anchor_year \n 2021 (2021 Apr, 2021 Dec]"
+ )
+ expected_calendar_repr = expected_calendar_repr.replace(" ", "")
+ assert repr(dummy_calendar.show()).replace(" ", "") == expected_calendar_repr
def test_flat(self, dummy_calendar):
- expected = np.array([interval("2021-05-05", "2021-12-31")])
- cal = AdventCalendar(anchor_date=(12, 31), freq="240d")
+ expected = np.array([interval("2021-04-30", "2021-12-31")])
+ assert np.array_equal(dummy_calendar.flat, expected)
+
+ def test_no_intervals(self):
+ cal = MonthlyCalendar()
+ with pytest.raises(ValueError):
+ cal.get_intervals()
+
+ def test_incorrect_freq(self):
+ with pytest.raises(ValueError):
+ MonthlyCalendar(freq='2d')
+
+class TestWeeklyCalendar:
+ """Test WeeklyCalendar methods."""
+
+ @pytest.fixture(autouse=True)
+ def dummy_calendar(self):
+ cal = WeeklyCalendar(anchor=48, freq="30W")
cal.map_years(2021, 2021)
+ return cal
+
+ def test_init(self):
+ cal = WeeklyCalendar(anchor=48, freq="30W")
+ assert isinstance(cal, WeeklyCalendar)
+
+ def test_repr(self):
+ cal = WeeklyCalendar(anchor=48, freq="30W")
+ assert repr(cal) == (
+ "WeeklyCalendar(week=48, freq=30W, n_targets=1, max_lag=None)"
+ )
+
+ def test_show(self, dummy_calendar):
+ expected_calendar_repr = (
+ "i_interval (target) 0\n anchor_year \n 2021 (2021-W18, 2021-W48]"
+ )
+ expected_calendar_repr = expected_calendar_repr.replace(" ", "")
+ assert repr(dummy_calendar.show()).replace(" ", "") == expected_calendar_repr
+
+ def test_flat(self, dummy_calendar):
+ expected = np.array([interval("2021-05-09", "2021-12-05")])
assert np.array_equal(dummy_calendar.flat, expected)
- def test_flat_no_intervals(self):
- cal = AdventCalendar()
+ def test_no_intervals(self):
+ cal = WeeklyCalendar(anchor=40)
with pytest.raises(ValueError):
- cal.flat # pylint: disable=pointless-statement
+ cal.get_intervals()
+
+ def test_incorrect_freq(self):
+ with pytest.raises(ValueError):
+ WeeklyCalendar(anchor=40, freq='2d')
class TestMap:
"""Test map to year(s)/data methods"""
+
def test_map_years(self):
- cal = AdventCalendar(anchor_date=(12, 31), freq="180d")
+ cal = AdventCalendar(anchor=(12, 31), freq="180d")
cal.map_years(2020, 2021)
expected = np.array(
[
@@ -82,58 +152,64 @@ class TestMap:
],
]
)
- assert np.array_equal(cal._intervals, expected)
+ assert np.array_equal(cal.get_intervals(), expected)
def test_map_years_single(self):
- cal = AdventCalendar(anchor_date=(12, 31), freq="180d")
+ cal = AdventCalendar(anchor=(12, 31), freq="180d")
cal.map_years(2020, 2020)
- expected = np.array([
+ expected = np.array(
[
- interval("2020-07-04", "2020-12-31"),
- interval("2020-01-06", "2020-07-04"),
+ [
+ interval("2020-07-04", "2020-12-31"),
+ interval("2020-01-06", "2020-07-04"),
+ ]
]
- ])
- assert np.array_equal(cal._intervals, expected)
+ )
+ assert np.array_equal(cal.get_intervals(), expected)
def test_map_to_data_edge_case_last_year(self):
# test the edge value when the input could not cover the anchor date
- cal = AdventCalendar(anchor_date=(10, 15), freq='180d')
+ cal = AdventCalendar(anchor=(10, 15), freq="180d")
# single year covered
- time_index = pd.date_range('20191020', '20211001', freq='60d')
+ time_index = pd.date_range("20191020", "20211001", freq="60d")
test_data = np.random.random(len(time_index))
timeseries = pd.Series(test_data, index=time_index)
cal.map_to_data(timeseries)
- expected = np.array([
+ expected = np.array(
[
- interval("2020-04-18", "2020-10-15"),
- interval("2019-10-21", "2020-04-18"),
+ [
+ interval("2020-04-18", "2020-10-15"),
+ interval("2019-10-21", "2020-04-18"),
+ ]
]
- ])
- assert np.array_equal(cal._intervals, expected)
+ )
+ assert np.array_equal(cal.get_intervals(), expected)
def test_map_to_data_single_year_coverage(self):
# test the single year coverage
- cal = AdventCalendar(anchor_date=(12, 31), freq='180d')
+ cal = AdventCalendar(anchor=(12, 31), freq="180d")
# multiple years covered
- time_index = pd.date_range('20210101', '20211231', freq='7d')
+ time_index = pd.date_range("20210101", "20211231", freq="7d")
test_data = np.random.random(len(time_index))
timeseries = pd.Series(test_data, index=time_index)
cal.map_to_data(timeseries)
- expected = np.array([
+ expected = np.array(
[
- interval("2021-07-04", "2021-12-31"),
- interval("2021-01-05", "2021-07-04"),
+ [
+ interval("2021-07-04", "2021-12-31"),
+ interval("2021-01-05", "2021-07-04"),
+ ]
]
- ])
+ )
- assert np.array_equal(cal._intervals, expected)
+ assert np.array_equal(cal.get_intervals(), expected)
def test_map_to_data_edge_case_first_year(self):
# test the edge value when the input covers the anchor date
- cal = AdventCalendar(anchor_date=(10, 15), freq='180d')
+ cal = AdventCalendar(anchor=(10, 15), freq="180d")
# multiple years covered
- time_index = pd.date_range('20191010', '20211225', freq='60d')
+ time_index = pd.date_range("20191010", "20211225", freq="60d")
test_data = np.random.random(len(time_index))
timeseries = pd.Series(test_data, index=time_index)
cal.map_to_data(timeseries)
@@ -151,42 +227,42 @@ class TestMap:
]
)
- assert np.array_equal(cal._intervals, expected)
+ assert np.array_equal(cal.get_intervals(), expected)
- def test_map_to_data_value_error(self):
- # test when the input data is not sufficient to cover one year
- cal = AdventCalendar(anchor_date=(10, 15), freq='180d')
- with pytest.raises(ValueError):
- time_index = pd.date_range('20201020', '20211001', freq='60d')
- test_data = np.random.random(len(time_index))
- timeseries = pd.Series(test_data, index=time_index)
- cal.map_to_data(timeseries)
+ # def test_map_to_data_value_error(self):
+ # # test when the input data is not sufficient to cover one year
+ # cal = AdventCalendar(anchor=(10, 15), freq='180d')
+ # with pytest.raises(ValueError):
+ # time_index = pd.date_range('20201020', '20211001', freq='60d')
+ # test_data = np.random.random(len(time_index))
+ # timeseries = pd.Series(test_data, index=time_index)
+ # cal.map_to_data(timeseries)
def test_map_to_data_input_time_backward(self):
# test when the input data has reverse order time index
- cal = AdventCalendar(anchor_date=(10, 15), freq='180d')
- time_index = pd.date_range('20201010', '20211225', freq='60d')
+ cal = AdventCalendar(anchor=(10, 15), freq="180d")
+ time_index = pd.date_range("20201010", "20211225", freq="60d")
test_data = np.random.random(len(time_index))
timeseries = pd.Series(test_data, index=time_index[::-1])
cal.map_to_data(timeseries)
- expected = np.array([
+ expected = np.array(
[
- interval("2021-04-18", "2021-10-15"),
- interval("2020-10-20", "2021-04-18"),
+ [
+ interval("2021-04-18", "2021-10-15"),
+ interval("2020-10-20", "2021-04-18"),
+ ]
]
- ])
+ )
- assert np.array_equal(cal._intervals, expected)
+ assert np.array_equal(cal.get_intervals(), expected)
def test_map_to_data_xarray_input(self):
# test when the input data has reverse order time index
- cal = AdventCalendar(anchor_date=(10, 15), freq='180d')
- time_index = pd.date_range('20201010', '20211225', freq='60d')
+ cal = AdventCalendar(anchor=(10, 15), freq="180d")
+ time_index = pd.date_range("20201010", "20211225", freq="60d")
test_data = np.random.random(len(time_index))
- dataarray = xr.DataArray(
- data=test_data,
- coords={'time': time_index})
+ dataarray = xr.DataArray(data=test_data, coords={"time": time_index})
cal.map_to_data(dataarray)
expected = np.array(
@@ -196,39 +272,60 @@ class TestMap:
]
)
- assert np.all(cal._intervals == expected)
+ assert np.all(cal.get_intervals() == expected)
+
+ def test_missing_time_dim(self):
+ cal = AdventCalendar(anchor=(10, 15), freq="180d")
+ time_index = pd.date_range("20191020", "20211001", freq="60d")
+ test_data = np.random.random(len(time_index))
+ dataframe = pd.DataFrame(test_data, index=time_index)
+ dataset = dataframe.to_xarray()
+ with pytest.raises(ValueError):
+ cal.map_to_data(dataset)
+
+ def test_non_time_dim(self):
+ cal = AdventCalendar(anchor=(10, 15), freq="180d")
+ time_index = pd.date_range("20191020", "20211001", freq="60d")
+ test_data = np.random.random(len(time_index))
+ dataframe = pd.DataFrame(test_data, index=time_index)
+ dataset = dataframe.to_xarray().rename({"index": "time"})
+ dataset["time"] = np.arange(dataset["time"].size)
+ with pytest.raises(ValueError):
+ cal.map_to_data(dataset)
# Note: add more test cases for different number of target periods!
- max_lag_edge_cases = [(73, ['2019'], 74),
- (72, ['2019', '2018'], 73)]
+ max_lag_edge_cases = [(73, ["2019"], 74), (72, ["2019", "2018"], 73)]
# Test the edge cases of max_lag; where the max_lag just fits in exactly 365 days,
# and where the max_lag just causes the calendar to skip a year
@pytest.mark.parametrize("max_lag,expected_index,expected_size", max_lag_edge_cases)
def test_max_lag_skip_years(self, max_lag, expected_index, expected_size):
- calendar = AdventCalendar(anchor_date=(12, 31), freq="5d", max_lag=max_lag)
+ calendar = AdventCalendar(anchor=(12, 31), freq="5d", max_lag=max_lag)
calendar = calendar.map_years(2018, 2019)
- np.testing.assert_array_equal(calendar._intervals.index.values, expected_index)
- assert calendar._intervals.iloc[0].size == expected_size
+ np.testing.assert_array_equal(
+ calendar.get_intervals().index.values, expected_index
+ )
+ assert calendar.get_intervals().iloc[0].size == expected_size
class TestResample:
"""Test resample methods."""
+
# Define all required inputs as fixtures:
@pytest.fixture(autouse=True)
def dummy_calendar(self):
- return AdventCalendar(anchor_date=(10, 15), freq="180d")
+ return AdventCalendar(anchor=(10, 15), freq="180d")
- @pytest.fixture(autouse=True, params=[1,2,3])
+ @pytest.fixture(autouse=True, params=[1, 2, 3])
def dummy_calendar_targets(self, request):
- return AdventCalendar(anchor_date=(5, 10), freq="100D", n_targets=request.param)
+ return AdventCalendar(anchor=(5, 10), freq="100d", n_targets=request.param)
@pytest.fixture(params=["20151020", "20191020"])
def dummy_series(self, request):
time_index = pd.date_range(request.param, "20211001", freq="60d")
test_data = np.random.random(len(time_index))
expected = np.array([test_data[4:7].mean(), test_data[1:4].mean()])
- series = pd.Series(test_data, index=time_index, name='data1')
+ series = pd.Series(test_data, index=time_index, name="data1")
return series, expected
@pytest.fixture
@@ -240,76 +337,73 @@ class TestResample:
def dummy_dataarray(self, dummy_series):
series, expected = dummy_series
dataarray = series.to_xarray()
- dataarray = dataarray.rename({'index': 'time'})
+ dataarray = dataarray.rename({"index": "time"})
return dataarray, expected
@pytest.fixture
def dummy_dataset(self, dummy_dataframe):
dataframe, expected = dummy_dataframe
- dataset = dataframe.to_xarray().rename({'index': 'time'})
+ dataset = dataframe.to_xarray().rename({"index": "time"})
return dataset, expected
# Tests start here:
+ def test_non_mapped_calendar(self, dummy_calendar):
+ with pytest.raises(ValueError):
+ resample(dummy_calendar, None)
+
def test_nontime_index(self, dummy_calendar, dummy_series):
series, _ = dummy_series
+ cal = dummy_calendar.map_to_data(series)
series = series.reset_index()
with pytest.raises(ValueError):
- dummy_calendar.resample(series)
+ resample(cal, series)
def test_series(self, dummy_calendar, dummy_series):
series, expected = dummy_series
- resampled_data = dummy_calendar.resample(series)
- np.testing.assert_allclose(
- resampled_data['data1'].iloc[:2], expected)
+ cal = dummy_calendar.map_to_data(series)
+ resampled_data = resample(cal, series)
+ np.testing.assert_allclose(resampled_data["data1"].iloc[:2], expected)
def test_unnamed_series(self, dummy_calendar, dummy_series):
series, expected = dummy_series
series.name = None
- resampled_data = dummy_calendar.resample(series)
- np.testing.assert_allclose(
- resampled_data["mean_data"].iloc[:2], expected)
+ cal = dummy_calendar.map_to_data(series)
+ resampled_data = resample(cal, series)
+ np.testing.assert_allclose(resampled_data["mean_data"].iloc[:2], expected)
def test_dataframe(self, dummy_calendar, dummy_dataframe):
dataframe, expected = dummy_dataframe
- resampled_data = dummy_calendar.resample(dataframe)
+ cal = dummy_calendar.map_to_data(dataframe)
+ resampled_data = resample(cal, dataframe)
np.testing.assert_allclose(resampled_data["data1"].iloc[:2], expected)
def test_dataarray(self, dummy_calendar, dummy_dataarray):
dataarray, expected = dummy_dataarray
- resampled_data = dummy_calendar.resample(dataarray)
+ cal = dummy_calendar.map_to_data(dataarray)
+ resampled_data = resample(cal, dataarray)
testing_vals = resampled_data["data1"].isel(anchor_year=0)
np.testing.assert_allclose(testing_vals, expected)
def test_dataset(self, dummy_calendar, dummy_dataset):
dataset, expected = dummy_dataset
- resampled_data = dummy_calendar.resample(dataset)
+ cal = dummy_calendar.map_to_data(dataset)
+ resampled_data = resample(cal, dataset)
testing_vals = resampled_data["data1"].isel(anchor_year=0)
np.testing.assert_allclose(testing_vals, expected)
- def test_missing_time_dim(self, dummy_calendar, dummy_dataset):
- dataset, _ = dummy_dataset
- with pytest.raises(ValueError):
- dummy_calendar.resample(dataset.rename({'time': 'index'}))
-
- def test_non_time_dim(self, dummy_calendar, dummy_dataset):
- dataset, _ = dummy_dataset
- dataset['time'] = np.arange(dataset['time'].size)
- with pytest.raises(ValueError):
- dummy_calendar.resample(dataset)
-
def test_target_period_dataframe(self, dummy_calendar_targets, dummy_dataframe):
df, _ = dummy_dataframe
- resampled_data = dummy_calendar_targets.resample(df)
+ calendar = dummy_calendar_targets.map_to_data(df)
+ resampled_data = resample(calendar, df)
expected = np.zeros(resampled_data.index.size, dtype=bool)
- # pylint: disable=protected-access
- for i in range(dummy_calendar_targets._n_targets):
+ for i in range(calendar.n_targets):
expected[i::3] = True
- np.testing.assert_array_equal(resampled_data['target'].values, expected)
+ np.testing.assert_array_equal(resampled_data["target"].values, expected)
def test_target_period_dataset(self, dummy_calendar_targets, dummy_dataset):
ds, _ = dummy_dataset
- resampled_data = dummy_calendar_targets.resample(ds)
+ calendar = dummy_calendar_targets.map_to_data(ds)
+ resampled_data = resample(calendar, ds)
expected = np.zeros(3, dtype=bool)
- # pylint: disable=protected-access
- expected[:dummy_calendar_targets._n_targets] = True
- np.testing.assert_array_equal(resampled_data['target'].values, expected)
+ expected[: dummy_calendar_targets.n_targets] = True
+ np.testing.assert_array_equal(resampled_data["target"].values, expected)
diff --git a/tests/test_traintest.py b/tests/test_traintest.py
index 7fc2241..4f7e60a 100644
--- a/tests/test_traintest.py
+++ b/tests/test_traintest.py
@@ -6,14 +6,14 @@ import pytest
from sklearn.model_selection import KFold
import s2spy.traintest
from s2spy.time import AdventCalendar
+from s2spy.time import resample
class TestTrainTest:
# Define all required inputs as fixtures:
@pytest.fixture(autouse=True)
def dummy_calendar(self):
- cal = AdventCalendar(anchor_date=(10, 15), freq="180d")
- return cal.map_years(2019, 2021)
+ return AdventCalendar(anchor=(10, 15), freq="180d")
@pytest.fixture(autouse=True)
def dummy_dataframe(self):
@@ -36,30 +36,35 @@ class TestTrainTest:
return dummy_dataframe_short.to_xarray().rename({"index": "time"})
def test_kfold_df(self, dummy_calendar, dummy_dataframe):
- df = dummy_calendar.resample(dummy_dataframe)
+ mapped_calendar = dummy_calendar.map_to_data(dummy_dataframe)
+ df = resample(mapped_calendar, dummy_dataframe)
df = s2spy.traintest.split_groups(KFold(n_splits=2), df)
expected_group = ["test", "test", "train", "train"]
assert np.array_equal(df["split_0"].values, expected_group)
def test_kfold_ds(self, dummy_calendar, dummy_dataset):
- ds = dummy_calendar.resample(dummy_dataset)
+ mapped_calendar = dummy_calendar.map_to_data(dummy_dataset)
+ ds = resample(mapped_calendar, dummy_dataset)
ds = s2spy.traintest.split_groups(KFold(n_splits=2), ds)
expected_group = ["test", "train"]
assert np.array_equal(ds.traintest.values[0], expected_group)
def test_kfold_df_short(self, dummy_calendar, dummy_dataframe_short):
"Should fail as there is only a single anchor year: no splits can be made"
- df = dummy_calendar.resample(dummy_dataframe_short)
+ mapped_calendar = dummy_calendar.map_to_data(dummy_dataframe_short)
+ df = resample(mapped_calendar, dummy_dataframe_short)
with pytest.raises(ValueError):
df = s2spy.traintest.split_groups(KFold(n_splits=2), df)
def test_kfold_ds_short(self, dummy_calendar, dummy_dataset_short):
"Should fail as there is only a single anchor year: no splits can be made"
- ds = dummy_calendar.resample(dummy_dataset_short)
+ mapped_calendar = dummy_calendar.map_to_data(dummy_dataset_short)
+ ds = resample(mapped_calendar, dummy_dataset_short)
with pytest.raises(ValueError):
ds = s2spy.traintest.split_groups(KFold(n_splits=2), ds)
def test_alternative_key(self, dummy_calendar, dummy_dataset):
- ds = dummy_calendar.resample(dummy_dataset)
- ds = s2spy.traintest.split_groups(KFold(n_splits=2), ds, key='i_interval')
- assert 'i_interval' in ds.traintest.dims
\ No newline at end of file
+ mapped_calendar = dummy_calendar.map_to_data(dummy_dataset)
+ ds = resample(mapped_calendar, dummy_dataset)
+ ds = s2spy.traintest.split_groups(KFold(n_splits=2), ds, key="i_interval")
+ assert "i_interval" in ds.traintest.dims
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 9
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
astroid==3.3.9
babel==2.17.0
build==1.2.2.post1
bump2version==1.0.1
cachetools==5.5.2
certifi==2025.1.31
cftime==1.6.4.post1
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.8.0
dill==0.3.9
distlib==0.3.9
docutils==0.21.2
dodgy==0.2.1
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
flake8==7.2.0
flake8-polyfill==1.0.2
gitdb==4.0.12
GitPython==3.1.44
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==6.0.1
Jinja2==3.1.6
joblib==1.4.2
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mccabe==0.7.0
mdit-py-plugins==0.4.2
mdurl==0.1.2
myst-parser==3.0.1
netCDF4==1.7.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pep8-naming==0.10.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prospector==1.16.1
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.1
Pygments==2.19.1
pylint==3.3.6
pylint-celery==0.3
pylint-django==2.6.1
pylint-plugin-utils==0.8.2
pyproject-api==1.9.0
pyproject_hooks==1.2.0
pyroma==4.2
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
requirements-detector==1.3.2
-e git+https://github.com/AI4S2S/s2spy.git@43de2489c0bab3d2923ffeda93ae2749f9a0acca#egg=s2spy
scikit-learn==1.6.1
scipy==1.13.1
semver==3.0.4
setoptconf-tmp==0.3.1
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-autoapi==3.6.0
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stdlib-list==0.11.1
threadpoolctl==3.6.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
tox==4.25.0
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
virtualenv==20.29.3
xarray==2024.7.0
zipp==3.21.0
|
name: s2spy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- astroid==3.3.9
- babel==2.17.0
- build==1.2.2.post1
- bump2version==1.0.1
- cachetools==5.5.2
- certifi==2025.1.31
- cftime==1.6.4.post1
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- coverage==7.8.0
- dill==0.3.9
- distlib==0.3.9
- docutils==0.21.2
- dodgy==0.2.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-polyfill==1.0.2
- gitdb==4.0.12
- gitpython==3.1.44
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- isort==6.0.1
- jinja2==3.1.6
- joblib==1.4.2
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mccabe==0.7.0
- mdit-py-plugins==0.4.2
- mdurl==0.1.2
- myst-parser==3.0.1
- netcdf4==1.7.2
- numpy==2.0.2
- pandas==2.2.3
- pep8-naming==0.10.0
- platformdirs==4.3.7
- prospector==1.16.1
- pycodestyle==2.13.0
- pydocstyle==6.3.0
- pyflakes==3.3.1
- pygments==2.19.1
- pylint==3.3.6
- pylint-celery==0.3
- pylint-django==2.6.1
- pylint-plugin-utils==0.8.2
- pyproject-api==1.9.0
- pyproject-hooks==1.2.0
- pyroma==4.2
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- requirements-detector==1.3.2
- s2spy==0.1.0
- scikit-learn==1.6.1
- scipy==1.13.1
- semver==3.0.4
- setoptconf-tmp==0.3.1
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-autoapi==3.6.0
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- stdlib-list==0.11.1
- threadpoolctl==3.6.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- tox==4.25.0
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- virtualenv==20.29.3
- xarray==2024.7.0
- zipp==3.21.0
prefix: /opt/conda/envs/s2spy
|
[
"tests/test_dimensionality.py::TestDimensionality::test_RGDR",
"tests/test_dimensionality.py::TestDimensionality::test_PCA",
"tests/test_dimensionality.py::TestDimensionality::test_MCA",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_init",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr_nan",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_field_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dims",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_partial_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_regression",
"tests/test_rgdr/test_rgdr.py::TestMapRegions::test_dbscan",
"tests/test_rgdr/test_rgdr.py::TestMapRegions::test_dbscan_min_area",
"tests/test_rgdr/test_rgdr.py::TestMapRegions::test_cluster",
"tests/test_time.py::TestAdventCalendar::test_init",
"tests/test_time.py::TestAdventCalendar::test_repr",
"tests/test_time.py::TestAdventCalendar::test_flat",
"tests/test_time.py::TestAdventCalendar::test_no_intervals",
"tests/test_time.py::TestAdventCalendar::test_incorrect_freq",
"tests/test_time.py::TestMonthlyCalendar::test_init",
"tests/test_time.py::TestMonthlyCalendar::test_repr",
"tests/test_time.py::TestMonthlyCalendar::test_show",
"tests/test_time.py::TestMonthlyCalendar::test_flat",
"tests/test_time.py::TestMonthlyCalendar::test_no_intervals",
"tests/test_time.py::TestMonthlyCalendar::test_incorrect_freq",
"tests/test_time.py::TestWeeklyCalendar::test_init",
"tests/test_time.py::TestWeeklyCalendar::test_repr",
"tests/test_time.py::TestWeeklyCalendar::test_show",
"tests/test_time.py::TestWeeklyCalendar::test_flat",
"tests/test_time.py::TestWeeklyCalendar::test_no_intervals",
"tests/test_time.py::TestWeeklyCalendar::test_incorrect_freq",
"tests/test_time.py::TestMap::test_map_years",
"tests/test_time.py::TestMap::test_map_years_single",
"tests/test_time.py::TestMap::test_map_to_data_edge_case_last_year",
"tests/test_time.py::TestMap::test_map_to_data_single_year_coverage",
"tests/test_time.py::TestMap::test_map_to_data_edge_case_first_year",
"tests/test_time.py::TestMap::test_map_to_data_input_time_backward",
"tests/test_time.py::TestMap::test_map_to_data_xarray_input",
"tests/test_time.py::TestMap::test_missing_time_dim",
"tests/test_time.py::TestMap::test_non_time_dim",
"tests/test_time.py::TestMap::test_max_lag_skip_years[73-expected_index0-74]",
"tests/test_time.py::TestMap::test_max_lag_skip_years[72-expected_index1-73]",
"tests/test_time.py::TestResample::test_non_mapped_calendar[1]",
"tests/test_time.py::TestResample::test_non_mapped_calendar[2]",
"tests/test_time.py::TestResample::test_non_mapped_calendar[3]",
"tests/test_time.py::TestResample::test_nontime_index[1-20151020]",
"tests/test_time.py::TestResample::test_nontime_index[1-20191020]",
"tests/test_time.py::TestResample::test_nontime_index[2-20151020]",
"tests/test_time.py::TestResample::test_nontime_index[2-20191020]",
"tests/test_time.py::TestResample::test_nontime_index[3-20151020]",
"tests/test_time.py::TestResample::test_nontime_index[3-20191020]",
"tests/test_time.py::TestResample::test_series[1-20151020]",
"tests/test_time.py::TestResample::test_series[1-20191020]",
"tests/test_time.py::TestResample::test_series[2-20151020]",
"tests/test_time.py::TestResample::test_series[2-20191020]",
"tests/test_time.py::TestResample::test_series[3-20151020]",
"tests/test_time.py::TestResample::test_series[3-20191020]",
"tests/test_time.py::TestResample::test_unnamed_series[1-20151020]",
"tests/test_time.py::TestResample::test_unnamed_series[1-20191020]",
"tests/test_time.py::TestResample::test_unnamed_series[2-20151020]",
"tests/test_time.py::TestResample::test_unnamed_series[2-20191020]",
"tests/test_time.py::TestResample::test_unnamed_series[3-20151020]",
"tests/test_time.py::TestResample::test_unnamed_series[3-20191020]",
"tests/test_time.py::TestResample::test_dataframe[1-20151020]",
"tests/test_time.py::TestResample::test_dataframe[1-20191020]",
"tests/test_time.py::TestResample::test_dataframe[2-20151020]",
"tests/test_time.py::TestResample::test_dataframe[2-20191020]",
"tests/test_time.py::TestResample::test_dataframe[3-20151020]",
"tests/test_time.py::TestResample::test_dataframe[3-20191020]",
"tests/test_time.py::TestResample::test_dataarray[1-20151020]",
"tests/test_time.py::TestResample::test_dataarray[1-20191020]",
"tests/test_time.py::TestResample::test_dataarray[2-20151020]",
"tests/test_time.py::TestResample::test_dataarray[2-20191020]",
"tests/test_time.py::TestResample::test_dataarray[3-20151020]",
"tests/test_time.py::TestResample::test_dataarray[3-20191020]",
"tests/test_time.py::TestResample::test_dataset[1-20151020]",
"tests/test_time.py::TestResample::test_dataset[1-20191020]",
"tests/test_time.py::TestResample::test_dataset[2-20151020]",
"tests/test_time.py::TestResample::test_dataset[2-20191020]",
"tests/test_time.py::TestResample::test_dataset[3-20151020]",
"tests/test_time.py::TestResample::test_dataset[3-20191020]",
"tests/test_time.py::TestResample::test_target_period_dataframe[1-20151020]",
"tests/test_time.py::TestResample::test_target_period_dataframe[1-20191020]",
"tests/test_time.py::TestResample::test_target_period_dataframe[2-20151020]",
"tests/test_time.py::TestResample::test_target_period_dataframe[2-20191020]",
"tests/test_time.py::TestResample::test_target_period_dataframe[3-20151020]",
"tests/test_time.py::TestResample::test_target_period_dataframe[3-20191020]",
"tests/test_time.py::TestResample::test_target_period_dataset[1-20151020]",
"tests/test_time.py::TestResample::test_target_period_dataset[1-20191020]",
"tests/test_time.py::TestResample::test_target_period_dataset[2-20151020]",
"tests/test_time.py::TestResample::test_target_period_dataset[2-20191020]",
"tests/test_time.py::TestResample::test_target_period_dataset[3-20151020]",
"tests/test_time.py::TestResample::test_target_period_dataset[3-20191020]",
"tests/test_traintest.py::TestTrainTest::test_kfold_df",
"tests/test_traintest.py::TestTrainTest::test_kfold_ds",
"tests/test_traintest.py::TestTrainTest::test_kfold_df_short",
"tests/test_traintest.py::TestTrainTest::test_kfold_ds_short",
"tests/test_traintest.py::TestTrainTest::test_alternative_key"
] |
[
"tests/test_time.py::TestAdventCalendar::test_show"
] |
[] |
[] |
Apache License 2.0
| null |
|
AI4S2S__s2spy-77
|
c254e11f1a64aaa52593e3848b71207421a16c61
|
2022-08-12 09:19:57
|
c254e11f1a64aaa52593e3848b71207421a16c61
|
diff --git a/notebooks/tutorial_time.ipynb b/notebooks/tutorial_time.ipynb
index 149fa99..4cdcf45 100644
--- a/notebooks/tutorial_time.ipynb
+++ b/notebooks/tutorial_time.ipynb
@@ -27,7 +27,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "AdventCalendar(month=12, day=31, freq=7d, n_targets=1, max_lag=None)\n"
+ "AdventCalendar(month=12, day=31, freq=7d, n_targets=1)\n"
]
}
],
@@ -52,7 +52,7 @@
{
"data": {
"text/plain": [
- "AdventCalendar(month=11, day=30, freq=90d, n_targets=1, max_lag=None)"
+ "AdventCalendar(month=11, day=30, freq=90d, n_targets=1)"
]
},
"execution_count": 3,
@@ -284,7 +284,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Map the calendar to the input data."
+ "Set the maximum lag"
]
},
{
@@ -316,14 +316,12 @@
" <th>(target) 0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
- " <th>3</th>\n",
" </tr>\n",
" <tr>\n",
" <th>anchor_year</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
- " <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
@@ -332,21 +330,18 @@
" <td>(2022-09-01, 2022-11-30]</td>\n",
" <td>(2022-06-03, 2022-09-01]</td>\n",
" <td>(2022-03-05, 2022-06-03]</td>\n",
- " <td>(2021-12-05, 2022-03-05]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2021</th>\n",
" <td>(2021-09-01, 2021-11-30]</td>\n",
" <td>(2021-06-03, 2021-09-01]</td>\n",
" <td>(2021-03-05, 2021-06-03]</td>\n",
- " <td>(2020-12-05, 2021-03-05]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2020</th>\n",
" <td>(2020-09-01, 2020-11-30]</td>\n",
" <td>(2020-06-03, 2020-09-01]</td>\n",
" <td>(2020-03-05, 2020-06-03]</td>\n",
- " <td>(2019-12-06, 2020-03-05]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@@ -359,11 +354,11 @@
"2021 (2021-09-01, 2021-11-30] (2021-06-03, 2021-09-01] \n",
"2020 (2020-09-01, 2020-11-30] (2020-06-03, 2020-09-01] \n",
"\n",
- "i_interval 2 3 \n",
- "anchor_year \n",
- "2022 (2022-03-05, 2022-06-03] (2021-12-05, 2022-03-05] \n",
- "2021 (2021-03-05, 2021-06-03] (2020-12-05, 2021-03-05] \n",
- "2020 (2020-03-05, 2020-06-03] (2019-12-06, 2020-03-05] "
+ "i_interval 2 \n",
+ "anchor_year \n",
+ "2022 (2022-03-05, 2022-06-03] \n",
+ "2021 (2021-03-05, 2021-06-03] \n",
+ "2020 (2020-03-05, 2020-06-03] "
]
},
"execution_count": 7,
@@ -371,6 +366,105 @@
"output_type": "execute_result"
}
],
+ "source": [
+ "calendar.set_max_lag(2)\n",
+ "calendar.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Map the calendar to the input data."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div>\n",
+ "<style scoped>\n",
+ " .dataframe tbody tr th:only-of-type {\n",
+ " vertical-align: middle;\n",
+ " }\n",
+ "\n",
+ " .dataframe tbody tr th {\n",
+ " vertical-align: top;\n",
+ " }\n",
+ "\n",
+ " .dataframe thead th {\n",
+ " text-align: right;\n",
+ " }\n",
+ "</style>\n",
+ "<table border=\"1\" class=\"dataframe\">\n",
+ " <thead>\n",
+ " <tr style=\"text-align: right;\">\n",
+ " <th>i_interval</th>\n",
+ " <th>(target) 0</th>\n",
+ " <th>1</th>\n",
+ " <th>2</th>\n",
+ " </tr>\n",
+ " <tr>\n",
+ " <th>anchor_year</th>\n",
+ " <th></th>\n",
+ " <th></th>\n",
+ " <th></th>\n",
+ " </tr>\n",
+ " </thead>\n",
+ " <tbody>\n",
+ " <tr>\n",
+ " <th>2021</th>\n",
+ " <td>(2021-09-01, 2021-11-30]</td>\n",
+ " <td>(2021-06-03, 2021-09-01]</td>\n",
+ " <td>(2021-03-05, 2021-06-03]</td>\n",
+ " </tr>\n",
+ " <tr>\n",
+ " <th>2020</th>\n",
+ " <td>(2020-09-01, 2020-11-30]</td>\n",
+ " <td>(2020-06-03, 2020-09-01]</td>\n",
+ " <td>(2020-03-05, 2020-06-03]</td>\n",
+ " </tr>\n",
+ " <tr>\n",
+ " <th>2019</th>\n",
+ " <td>(2019-09-01, 2019-11-30]</td>\n",
+ " <td>(2019-06-03, 2019-09-01]</td>\n",
+ " <td>(2019-03-05, 2019-06-03]</td>\n",
+ " </tr>\n",
+ " <tr>\n",
+ " <th>2018</th>\n",
+ " <td>(2018-09-01, 2018-11-30]</td>\n",
+ " <td>(2018-06-03, 2018-09-01]</td>\n",
+ " <td>(2018-03-05, 2018-06-03]</td>\n",
+ " </tr>\n",
+ " </tbody>\n",
+ "</table>\n",
+ "</div>"
+ ],
+ "text/plain": [
+ "i_interval (target) 0 1 \\\n",
+ "anchor_year \n",
+ "2021 (2021-09-01, 2021-11-30] (2021-06-03, 2021-09-01] \n",
+ "2020 (2020-09-01, 2020-11-30] (2020-06-03, 2020-09-01] \n",
+ "2019 (2019-09-01, 2019-11-30] (2019-06-03, 2019-09-01] \n",
+ "2018 (2018-09-01, 2018-11-30] (2018-06-03, 2018-09-01] \n",
+ "\n",
+ "i_interval 2 \n",
+ "anchor_year \n",
+ "2021 (2021-03-05, 2021-06-03] \n",
+ "2020 (2020-03-05, 2020-06-03] \n",
+ "2019 (2019-03-05, 2019-06-03] \n",
+ "2018 (2018-03-05, 2018-06-03] "
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# create dummy data for testing\n",
"time_index = pd.date_range('20171110', '20211211', freq='10d')\n",
diff --git a/s2spy/_base_calendar.py b/s2spy/_base_calendar.py
index 4f1f880..27e5896 100644
--- a/s2spy/_base_calendar.py
+++ b/s2spy/_base_calendar.py
@@ -23,13 +23,20 @@ class BaseCalendar(ABC):
_mapping = None
@abstractmethod
- def __init__(self, anchor, freq, n_targets: int = 1, max_lag: int = None):
- """For initializing calendars, the following four variables will be required."""
+ def __init__(
+ self,
+ anchor,
+ freq,
+ n_targets: int = 1,
+ ):
+ """For initializing calendars, the following five variables will be required."""
self.n_targets = n_targets
- self.max_lag = max_lag
self.anchor = anchor
self.freq = freq
+ self._max_lag = 0
+ self._allow_overlap = False
+
@abstractmethod
def _get_anchor(self, year: int) -> pd.Timestamp:
"""Method to generate an anchor timestamp for your specific calendar.
@@ -46,6 +53,31 @@ class BaseCalendar(ABC):
"""
return pd.Timestamp()
+ def set_max_lag(self, max_lag: int, allow_overlap: bool = False) -> None:
+ """Set the maximum lag of a calendar.
+
+ Sets the maximum number of lag periods after the target period. If `0`,
+ the maximum lag will be determined by how many fit in each anchor year.
+ If a maximum lag is provided, the intervals can either only cover part
+ of the year, or extend over multiple years. In case of a large max_lag
+ number where the intervals extend over multiple years, anchor years will
+ be skipped to avoid overlapping intervals. To allow overlapping
+ intervals, use the `allow_overlap` kwarg.
+
+ Args:
+ max_lag: Maximum number of lag periods after the target period.
+ allow_overlap: Allows intervals to overlap between anchor years, if the
+ max_lag is set to a high enough number that intervals extend over
+ multiple years. `False` by default, to avoid train/test information
+ leakage.
+ """
+ if (max_lag < 0) or (max_lag % 1 > 0):
+ raise ValueError("Max lag should be an integer with a value of 0 or greater"
+ f", not {max_lag} of type {type(max_lag)}.")
+
+ self._max_lag = max_lag
+ self._allow_overlap = allow_overlap
+
def _map_year(self, year: int) -> pd.Series:
"""Internal routine to return a concrete IntervalIndex for the given year.
@@ -81,7 +113,7 @@ class BaseCalendar(ABC):
"""
periods_per_year = pd.Timedelta("365days") / pd.to_timedelta(self.freq)
return (
- (self.max_lag + self.n_targets) if self.max_lag else int(periods_per_year)
+ (self._max_lag + self.n_targets) if self._max_lag > 0 else int(periods_per_year)
)
def _get_skip_nyears(self) -> int:
@@ -96,9 +128,9 @@ class BaseCalendar(ABC):
periods_per_year = pd.Timedelta("365days") / pd.to_timedelta(self.freq)
return (
- (np.ceil(nintervals / periods_per_year).astype(int) - 1)
- if self.max_lag
- else 0
+ 0
+ if self._max_lag > 0 and self._allow_overlap
+ else int(np.ceil(nintervals / periods_per_year).astype(int) - 1)
)
def map_years(self, start: int, end: int):
@@ -114,6 +146,9 @@ class BaseCalendar(ABC):
Returns:
The calendar mapped to the input start and end year.
"""
+ if start > end:
+ raise ValueError("The start year cannot be greater than the end year")
+
self._first_year = start
self._last_year = end
self._mapping = "years"
@@ -151,21 +186,21 @@ class BaseCalendar(ABC):
return self
def _set_year_range_from_timestamps(self):
- map_first_year = self._first_timestamp.year
- map_last_year = self._last_timestamp.year
+ min_year = self._first_timestamp.year
+ max_year = self._last_timestamp.year
# ensure that the input data could always cover the advent calendar
# last date check
- if self._map_year(map_last_year).iloc[0].right > self._last_timestamp:
- map_last_year -= 1
+ if self._map_year(max_year).iloc[0].right > self._last_timestamp:
+ max_year -= 1
# first date check
- if self._map_year(map_first_year).iloc[-1].left < self._first_timestamp:
- map_first_year += 1
+ while self._map_year(min_year).iloc[-1].right <= self._first_timestamp:
+ min_year += 1
# map year(s) and generate year realized advent calendar
- if map_last_year >= map_first_year:
- self._first_year = map_first_year
- self._last_year = map_last_year
+ if max_year >= min_year:
+ self._first_year = min_year
+ self._last_year = max_year
else:
raise ValueError(
"The input data could not cover the target advent calendar."
diff --git a/s2spy/_resample.py b/s2spy/_resample.py
index b61130f..646d9b5 100644
--- a/s2spy/_resample.py
+++ b/s2spy/_resample.py
@@ -1,4 +1,3 @@
-import warnings
from typing import Union
import numpy as np
import pandas as pd
@@ -97,8 +96,8 @@ def resample_pandas(
interval_groups = interval_index.get_indexer(input_data.index)
interval_means = input_data.groupby(interval_groups).mean()
- # drop the -1 index, as it represents data outside of all intervals
- interval_means = interval_means.loc[0:]
+ # Reindex the intervals. Empty intervals will contain NaN values.
+ interval_means = interval_means.reindex(np.arange(len(interval_index)))
if isinstance(input_data, pd.DataFrame):
for name in input_data.keys():
@@ -220,24 +219,14 @@ def resample(
raise ValueError("Generate a calendar map before calling resample")
utils.check_timeseries(input_data)
+ utils.check_input_frequency(mapped_calendar, input_data)
if isinstance(input_data, PandasData):
- # raise a warning for upscaling
- # target frequency must be larger than the (absolute) input frequency
- if input_data.index.freq:
- input_freq = input_data.index.freq
- input_freq = input_freq if input_freq.n > 0 else -input_freq
- if pd.Timedelta(mapped_calendar.freq) < input_freq:
- warnings.warn(
- """Target frequency is smaller than the original frequency.
- The resampled data will contain NaN values, as there is no data
- available within all intervals."""
- )
-
resampled_data = resample_pandas(mapped_calendar, input_data)
-
else:
resampled_data = resample_xarray(mapped_calendar, input_data)
+ utils.check_empty_intervals(resampled_data)
+
# mark target periods before returning the resampled data
return mark_target_period(mapped_calendar, resampled_data)
diff --git a/s2spy/time.py b/s2spy/time.py
index 288c4d5..667f611 100644
--- a/s2spy/time.py
+++ b/s2spy/time.py
@@ -14,7 +14,7 @@ Example:
>>> # Countdown the weeks until New Year's Eve
>>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq="7d")
>>> calendar
- AdventCalendar(month=12, day=31, freq=7d, n_targets=1, max_lag=None)
+ AdventCalendar(month=12, day=31, freq=7d, n_targets=1)
>>> # Get the 180-day periods leading up to New Year's eve for the year 2020
>>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq='180d')
@@ -49,7 +49,6 @@ Example:
"""
import calendar as pycalendar
import re
-from typing import Optional
from typing import Tuple
import numpy as np
import pandas as pd
@@ -75,7 +74,6 @@ class AdventCalendar(BaseCalendar):
anchor: Tuple[int, int] = (11, 30),
freq: str = "7d",
n_targets: int = 1,
- max_lag: Optional[int] = None,
) -> None:
"""Instantiate a basic calendar with minimal configuration.
@@ -88,12 +86,6 @@ class AdventCalendar(BaseCalendar):
of the calendar. It will countdown until this date.
freq: Frequency of the calendar.
n_targets: integer specifying the number of target intervals in a period.
- max_lag: Maximum number of lag periods after the target period. If `None`,
- the maximum lag will be determined by how many fit in each anchor year.
- If a maximum lag is provided, the intervals can either only cover part
- of the year, or extend over multiple years. In case of a large max_lag
- number where the intervals extend over multiple years, anchor years will
- be skipped to avoid overlapping intervals.
Example:
Instantiate a calendar counting down the weeks until new-year's
@@ -102,7 +94,7 @@ class AdventCalendar(BaseCalendar):
>>> import s2spy.time
>>> calendar = s2spy.time.AdventCalendar(anchor=(12, 31), freq="7d")
>>> calendar
- AdventCalendar(month=12, day=31, freq=7d, n_targets=1, max_lag=None)
+ AdventCalendar(month=12, day=31, freq=7d, n_targets=1)
"""
if not re.fullmatch(r"\d*d", freq):
@@ -111,7 +103,9 @@ class AdventCalendar(BaseCalendar):
self.day = anchor[1]
self.freq = freq
self.n_targets = n_targets
- self.max_lag = max_lag
+
+ self._max_lag:int = 0
+ self._allow_overlap: bool = False
def _get_anchor(self, year: int) -> pd.Timestamp:
"""Generates a timestamp for the end of interval 0 in year.
@@ -133,7 +127,6 @@ class MonthlyCalendar(BaseCalendar):
anchor: str = "Dec",
freq: str = "1M",
n_targets: int = 1,
- max_lag: Optional[int] = None,
) -> None:
"""Instantiate a basic monthly calendar with minimal configuration.
@@ -146,12 +139,6 @@ class MonthlyCalendar(BaseCalendar):
of the calendar. It will countdown up to this month.
freq: Frequency of the calendar, in the form '1M', '2M', etc.
n_targets: integer specifying the number of target intervals in a period.
- max_lag: Maximum number of lag periods after the target period. If `None`,
- the maximum lag will be determined by how many fit in each anchor year.
- If a maximum lag is provided, the intervals can either only cover part
- of the year, or extend over multiple years. In case of a large max_lag
- number where the intervals extend over multiple years, anchor years will
- be skipped to avoid overlapping intervals.
Example:
Instantiate a calendar counting down the quarters (3 month periods) until
@@ -160,15 +147,17 @@ class MonthlyCalendar(BaseCalendar):
>>> import s2spy.time
>>> calendar = s2spy.time.MonthlyCalendar(anchor='Dec', freq="3M")
>>> calendar
- MonthlyCalendar(month=12, freq=3M, n_targets=1, max_lag=None)
+ MonthlyCalendar(month=12, freq=3M, n_targets=1)
"""
if not re.fullmatch(r"\d*M", freq):
raise ValueError("Please input a frequency in the form of '2M'")
+
self.month = month_mapping_dict[anchor.upper()]
self.freq = freq
self.n_targets = n_targets
- self.max_lag = max_lag
+ self._max_lag = 0
+ self._allow_overlap = False
def _get_anchor(self, year: int) -> pd.Timestamp:
"""Generates a timestamp for the end of interval 0 in year.
@@ -189,7 +178,7 @@ class MonthlyCalendar(BaseCalendar):
"""
periods_per_year = 12 / int(self.freq.replace("M", ""))
return (
- (self.max_lag + self.n_targets) if self.max_lag else int(periods_per_year)
+ (self._max_lag + self.n_targets) if self._max_lag > 0 else int(periods_per_year)
)
def _get_skip_nyears(self) -> int:
@@ -201,7 +190,11 @@ class MonthlyCalendar(BaseCalendar):
int: Number of years that need to be skipped.
"""
nmonths = int(self.freq.replace("M", ""))
- return (np.ceil(nmonths / 12) - 1) if self.max_lag else 0
+ return (
+ 0
+ if self._max_lag > 0 and self._allow_overlap
+ else int(np.ceil(nmonths / 12) - 1)
+ )
def _interval_as_month(self, interval):
"""Turns an interval with pandas Timestamp values to a formatted string.
@@ -239,7 +232,6 @@ class WeeklyCalendar(BaseCalendar):
anchor: int,
freq: str = "1W",
n_targets: int = 1,
- max_lag: Optional[int] = None,
) -> None:
"""Instantiate a basic week number calendar with minimal configuration.
@@ -254,12 +246,6 @@ class WeeklyCalendar(BaseCalendar):
It will countdown until this week.
freq: Frequency of the calendar, e.g. '2W'.
n_targets: integer specifying the number of target intervals in a period.
- max_lag: Maximum number of lag periods after the target period. If `None`,
- the maximum lag will be determined by how many fit in each anchor year.
- If a maximum lag is provided, the intervals can either only cover part
- of the year, or extend over multiple years. In case of a large max_lag
- number where the intervals extend over multiple years, anchor years will
- be skipped to avoid overlapping intervals.
Example:
Instantiate a calendar counting down the weeks until week number 40.
@@ -267,7 +253,7 @@ class WeeklyCalendar(BaseCalendar):
>>> import s2spy.time
>>> calendar = s2spy.time.WeeklyCalendar(anchor=40, freq="1W")
>>> calendar
- WeeklyCalendar(week=40, freq=1W, n_targets=1, max_lag=None)
+ WeeklyCalendar(week=40, freq=1W, n_targets=1)
"""
if not re.fullmatch(r"\d*W", freq):
@@ -276,7 +262,9 @@ class WeeklyCalendar(BaseCalendar):
self.week = anchor
self.freq = freq
self.n_targets = n_targets
- self.max_lag = max_lag
+
+ self._max_lag: int = 0
+ self._allow_overlap: bool = False
def _get_anchor(self, year: int) -> pd.Timestamp:
"""Generates a timestamp for the end of interval 0 in year.
diff --git a/s2spy/utils.py b/s2spy/utils.py
index 4f88764..e090f19 100644
--- a/s2spy/utils.py
+++ b/s2spy/utils.py
@@ -1,3 +1,7 @@
+import re
+import warnings
+from typing import Union
+import numpy as np
import pandas as pd
import xarray as xr
@@ -36,3 +40,63 @@ def check_time_dim_pandas(data) -> None:
"""Utility function to check if pandas data has an index with time data."""
if not isinstance(data.index, pd.DatetimeIndex):
raise ValueError("The input data does not have a datetime index.")
+
+
+def check_empty_intervals(data: Union[pd.DataFrame, xr.Dataset]) -> None:
+ """Utility to check for empty intervals in data.
+
+ Note: For the Dataset, all values within a certain interval, anchor_year combination
+ have to be NaN, to allow for, e.g., empty gridcells in a latitude/longitude grid.
+
+ Args:
+ data (Union[pd.DataFrame, xr.Dataset]): Data that should be checked for empty
+ intervals. Should be done after resampling the data.
+
+ Raises:
+ UserWarning: If the data is insufficient.
+
+ Returns:
+ None
+ """
+ if isinstance(data, pd.DataFrame) and not np.any(np.isnan(data.iloc[:, 3:])):
+ return None
+ if isinstance(data, xr.Dataset) and not any(
+ data[var].isnull().any(dim=["i_interval", "anchor_year"]).all()
+ for var in data.data_vars
+ ):
+ return None
+
+ warnings.warn(
+ "The input data could not fully cover the calendar's intervals. "
+ "Intervals without available data will contain NaN values."
+ )
+ return None
+
+
+def check_input_frequency(calendar, data):
+ """Checks the frequency of (input) data.
+
+ Note: Pandas and xarray have the builtin function `infer_freq`, but this function is
+ not robust enough for our purpose, so we have to manually infer the frequency if the
+ builtin one fails.
+ """
+ if isinstance(data, PandasData):
+ data_freq = pd.infer_freq(data.index)
+ if data_freq is None: # Manually infer the frequency
+ data_freq = np.min(data.index.values[1:] - data.index.values[:-1])
+ else:
+ data_freq = xr.infer_freq(data.time)
+ if data_freq is None: # Manually infer the frequency
+ data_freq = (data.time.values[1:] - data.time.values[:-1]).min()
+
+ if isinstance(data_freq, str):
+ data_freq.replace("-", "")
+ if not re.match(r'\d+\D', data_freq):
+ data_freq = '1' + data_freq
+
+ if pd.Timedelta(calendar.freq) < pd.Timedelta(data_freq):
+ warnings.warn(
+ """Target frequency is smaller than the original frequency.
+ The resampled data will contain NaN values, as there is no data
+ available within all intervals."""
+ )
|
Dealing with mismatch between calendar map and data time extent
PR #60 changes resample so that it takes a mapped calendar and resamples the input data based on those intervals.
However, this will require some extra checks and data handling to prevent user error;
- [ ] Add check to see if the data can fully cover the calendar, and warn the user if it cannot.
- [ ] Ensure that if Pandas data is insufficient to cover the calendar, NaNs will be used for the empty intervals
- [ ] Add tests to ensure that both the warning & the NaN filling goes correctly
The second task already works for the xarray implementation, but not yet for Pandas data.
Related to #26
|
AI4S2S/s2spy
|
diff --git a/tests/test_resample.py b/tests/test_resample.py
new file mode 100644
index 0000000..8a811a3
--- /dev/null
+++ b/tests/test_resample.py
@@ -0,0 +1,155 @@
+"""Tests for s2spy.time's resample module.
+"""
+import numpy as np
+import pandas as pd
+import pytest
+from s2spy.time import AdventCalendar
+from s2spy.time import resample
+
+class TestResample:
+ """Test resample methods."""
+
+ # Define all required inputs as fixtures:
+ @pytest.fixture(autouse=True)
+ def dummy_calendar(self):
+ return AdventCalendar(anchor=(10, 15), freq="180d")
+
+ @pytest.fixture(autouse=True, params=[1, 2, 3])
+ def dummy_calendar_targets(self, request):
+ return AdventCalendar(anchor=(5, 10), freq="100d", n_targets=request.param)
+
+ @pytest.fixture(params=["20151020", "20191015"])
+ def dummy_series(self, request):
+ time_index = pd.date_range(request.param, "20211001", freq="60d")
+ test_data = np.random.random(len(time_index))
+ expected = np.array([test_data[4:7].mean(), test_data[1:4].mean()])
+ series = pd.Series(test_data, index=time_index, name="data1")
+ return series, expected
+
+ @pytest.fixture
+ def dummy_dataframe(self, dummy_series):
+ series, expected = dummy_series
+ return pd.DataFrame(series), expected
+
+ @pytest.fixture
+ def dummy_dataarray(self, dummy_series):
+ series, expected = dummy_series
+ dataarray = series.to_xarray()
+ dataarray = dataarray.rename({"index": "time"})
+ return dataarray, expected
+
+ @pytest.fixture
+ def dummy_dataset(self, dummy_dataframe):
+ dataframe, expected = dummy_dataframe
+ dataset = dataframe.to_xarray().rename({"index": "time"})
+ return dataset, expected
+
+ # Tests start here:
+ def test_non_mapped_calendar(self, dummy_calendar):
+ with pytest.raises(ValueError):
+ resample(dummy_calendar, None)
+
+ def test_nontime_index(self, dummy_calendar, dummy_series):
+ series, _ = dummy_series
+ cal = dummy_calendar.map_to_data(series)
+ series = series.reset_index()
+ with pytest.raises(ValueError):
+ resample(cal, series)
+
+ def test_series(self, dummy_calendar, dummy_series):
+ series, expected = dummy_series
+ cal = dummy_calendar.map_to_data(series)
+ resampled_data = resample(cal, series)
+ np.testing.assert_allclose(resampled_data["data1"].iloc[:2], expected)
+
+ def test_unnamed_series(self, dummy_calendar, dummy_series):
+ series, expected = dummy_series
+ series.name = None
+ cal = dummy_calendar.map_to_data(series)
+ resampled_data = resample(cal, series)
+ np.testing.assert_allclose(resampled_data["mean_data"].iloc[:2], expected)
+
+ def test_dataframe(self, dummy_calendar, dummy_dataframe):
+ dataframe, expected = dummy_dataframe
+ cal = dummy_calendar.map_to_data(dataframe)
+ resampled_data = resample(cal, dataframe)
+ np.testing.assert_allclose(resampled_data["data1"].iloc[:2], expected)
+
+ def test_dataarray(self, dummy_calendar, dummy_dataarray):
+ dataarray, expected = dummy_dataarray
+ cal = dummy_calendar.map_to_data(dataarray)
+ resampled_data = resample(cal, dataarray)
+ testing_vals = resampled_data["data1"].isel(anchor_year=0)
+ np.testing.assert_allclose(testing_vals, expected)
+
+ def test_dataset(self, dummy_calendar, dummy_dataset):
+ dataset, expected = dummy_dataset
+ cal = dummy_calendar.map_to_data(dataset)
+ resampled_data = resample(cal, dataset)
+ testing_vals = resampled_data["data1"].isel(anchor_year=0)
+ np.testing.assert_allclose(testing_vals, expected)
+
+ def test_target_period_dataframe(self, dummy_calendar_targets, dummy_dataframe):
+ df, _ = dummy_dataframe
+ calendar = dummy_calendar_targets.map_to_data(df)
+ resampled_data = resample(calendar, df)
+ expected = np.zeros(resampled_data.index.size, dtype=bool)
+ for i in range(calendar.n_targets):
+ expected[i::3] = True
+ np.testing.assert_array_equal(resampled_data["target"].values, expected)
+
+ def test_target_period_dataset(self, dummy_calendar_targets, dummy_dataset):
+ ds, _ = dummy_dataset
+ calendar = dummy_calendar_targets.map_to_data(ds)
+ resampled_data = resample(calendar, ds)
+ expected = np.zeros(3, dtype=bool)
+ expected[: dummy_calendar_targets.n_targets] = True
+ np.testing.assert_array_equal(resampled_data["target"].values, expected)
+
+ def test_allow_overlap_dataframe(self):
+ calendar = AdventCalendar(anchor=(10, 15), freq="100d")
+ calendar.set_max_lag(5, allow_overlap=True)
+ time_index = pd.date_range("20151101", "20211101", freq="50d")
+ test_data = np.random.random(len(time_index))
+ series = pd.Series(test_data, index=time_index)
+ calendar.map_to_data(series)
+ intervals = calendar.get_intervals()
+ # 4 anchor years are expected if overlap is allowed
+ assert len(intervals.index) == 4
+
+ # Test data for missing intervals, too low frequency.
+ def test_missing_intervals_dataframe(self, dummy_calendar, dummy_dataframe):
+ dataframe, _ = dummy_dataframe
+ cal = dummy_calendar.map_years(2020, 2025)
+ with pytest.warns(UserWarning):
+ resample(cal, dataframe)
+
+ def test_missing_intervals_dataset(self, dummy_calendar, dummy_dataset):
+ dataset, _ = dummy_dataset
+ cal = dummy_calendar.map_years(2020, 2025)
+ with pytest.warns(UserWarning):
+ resample(cal, dataset)
+
+ def test_low_freq_dataframe(self, dummy_dataframe):
+ cal = AdventCalendar(anchor=(10, 15), freq="1d")
+ dataframe, _ = dummy_dataframe
+ cal = cal.map_to_data(dataframe)
+ with pytest.warns(UserWarning):
+ resample(cal, dataframe)
+
+ def test_low_freq_dataset(self, dummy_dataset):
+ cal = AdventCalendar(anchor=(10, 15), freq="1d")
+ dataset, _ = dummy_dataset
+ cal = cal.map_to_data(dataset)
+ with pytest.warns(UserWarning):
+ resample(cal, dataset)
+
+ def test_1day_freq_dataframe(self):
+ # Will test the regular expression match and pre-pending of '1' in the
+ # check_input_frequency utility function
+ calendar = AdventCalendar(anchor=(10, 15), freq="1d")
+ time_index = pd.date_range("20191101", "20211101", freq="1d")
+ test_data = np.random.random(len(time_index))
+ series = pd.Series(test_data, index=time_index, name="data1")
+ calendar.map_to_data(series)
+ calendar.get_intervals()
diff --git a/tests/test_time.py b/tests/test_time.py
index 7690288..6d2c083 100644
--- a/tests/test_time.py
+++ b/tests/test_time.py
@@ -7,7 +7,6 @@ import xarray as xr
from s2spy.time import AdventCalendar
from s2spy.time import MonthlyCalendar
from s2spy.time import WeeklyCalendar
-from s2spy.time import resample
def interval(start, end):
@@ -31,7 +30,7 @@ class TestAdventCalendar:
def test_repr(self):
cal = AdventCalendar()
assert repr(cal) == (
- "AdventCalendar(month=11, day=30, freq=7d, n_targets=1, max_lag=None)"
+ "AdventCalendar(month=11, day=30, freq=7d, n_targets=1)"
)
def test_show(self, dummy_calendar):
@@ -56,6 +55,16 @@ class TestAdventCalendar:
with pytest.raises(ValueError):
AdventCalendar(freq='2W')
+ def test_set_max_lag(self):
+ cal = AdventCalendar()
+ cal.set_max_lag(max_lag=5)
+
+ def test_set_max_lag_incorrect_val(self):
+ cal = AdventCalendar()
+ with pytest.raises(ValueError):
+ cal.set_max_lag(-1)
+
+
class TestMonthlyCalendar:
"""Test MonthlyCalendar methods."""
@@ -72,7 +81,7 @@ class TestMonthlyCalendar:
def test_repr(self):
cal = MonthlyCalendar(anchor='Dec', freq="2M")
assert repr(cal) == (
- "MonthlyCalendar(month=12, freq=2M, n_targets=1, max_lag=None)"
+ "MonthlyCalendar(month=12, freq=2M, n_targets=1)"
)
def test_show(self, dummy_calendar):
@@ -111,7 +120,7 @@ class TestWeeklyCalendar:
def test_repr(self):
cal = WeeklyCalendar(anchor=48, freq="30W")
assert repr(cal) == (
- "WeeklyCalendar(week=48, freq=30W, n_targets=1, max_lag=None)"
+ "WeeklyCalendar(week=48, freq=30W, n_targets=1)"
)
def test_show(self, dummy_calendar):
@@ -299,111 +308,11 @@ class TestMap:
# and where the max_lag just causes the calendar to skip a year
@pytest.mark.parametrize("max_lag,expected_index,expected_size", max_lag_edge_cases)
def test_max_lag_skip_years(self, max_lag, expected_index, expected_size):
- calendar = AdventCalendar(anchor=(12, 31), freq="5d", max_lag=max_lag)
+ calendar = AdventCalendar(anchor=(12, 31), freq="5d")
+ calendar.set_max_lag(max_lag)
calendar = calendar.map_years(2018, 2019)
np.testing.assert_array_equal(
calendar.get_intervals().index.values, expected_index
)
assert calendar.get_intervals().iloc[0].size == expected_size
-
-
-class TestResample:
- """Test resample methods."""
-
- # Define all required inputs as fixtures:
- @pytest.fixture(autouse=True)
- def dummy_calendar(self):
- return AdventCalendar(anchor=(10, 15), freq="180d")
-
- @pytest.fixture(autouse=True, params=[1, 2, 3])
- def dummy_calendar_targets(self, request):
- return AdventCalendar(anchor=(5, 10), freq="100d", n_targets=request.param)
-
- @pytest.fixture(params=["20151020", "20191020"])
- def dummy_series(self, request):
- time_index = pd.date_range(request.param, "20211001", freq="60d")
- test_data = np.random.random(len(time_index))
- expected = np.array([test_data[4:7].mean(), test_data[1:4].mean()])
- series = pd.Series(test_data, index=time_index, name="data1")
- return series, expected
-
- @pytest.fixture
- def dummy_dataframe(self, dummy_series):
- series, expected = dummy_series
- return pd.DataFrame(series), expected
-
- @pytest.fixture
- def dummy_dataarray(self, dummy_series):
- series, expected = dummy_series
- dataarray = series.to_xarray()
- dataarray = dataarray.rename({"index": "time"})
- return dataarray, expected
-
- @pytest.fixture
- def dummy_dataset(self, dummy_dataframe):
- dataframe, expected = dummy_dataframe
- dataset = dataframe.to_xarray().rename({"index": "time"})
- return dataset, expected
-
- # Tests start here:
- def test_non_mapped_calendar(self, dummy_calendar):
- with pytest.raises(ValueError):
- resample(dummy_calendar, None)
-
- def test_nontime_index(self, dummy_calendar, dummy_series):
- series, _ = dummy_series
- cal = dummy_calendar.map_to_data(series)
- series = series.reset_index()
- with pytest.raises(ValueError):
- resample(cal, series)
-
- def test_series(self, dummy_calendar, dummy_series):
- series, expected = dummy_series
- cal = dummy_calendar.map_to_data(series)
- resampled_data = resample(cal, series)
- np.testing.assert_allclose(resampled_data["data1"].iloc[:2], expected)
-
- def test_unnamed_series(self, dummy_calendar, dummy_series):
- series, expected = dummy_series
- series.name = None
- cal = dummy_calendar.map_to_data(series)
- resampled_data = resample(cal, series)
- np.testing.assert_allclose(resampled_data["mean_data"].iloc[:2], expected)
-
- def test_dataframe(self, dummy_calendar, dummy_dataframe):
- dataframe, expected = dummy_dataframe
- cal = dummy_calendar.map_to_data(dataframe)
- resampled_data = resample(cal, dataframe)
- np.testing.assert_allclose(resampled_data["data1"].iloc[:2], expected)
-
- def test_dataarray(self, dummy_calendar, dummy_dataarray):
- dataarray, expected = dummy_dataarray
- cal = dummy_calendar.map_to_data(dataarray)
- resampled_data = resample(cal, dataarray)
- testing_vals = resampled_data["data1"].isel(anchor_year=0)
- np.testing.assert_allclose(testing_vals, expected)
-
- def test_dataset(self, dummy_calendar, dummy_dataset):
- dataset, expected = dummy_dataset
- cal = dummy_calendar.map_to_data(dataset)
- resampled_data = resample(cal, dataset)
- testing_vals = resampled_data["data1"].isel(anchor_year=0)
- np.testing.assert_allclose(testing_vals, expected)
-
- def test_target_period_dataframe(self, dummy_calendar_targets, dummy_dataframe):
- df, _ = dummy_dataframe
- calendar = dummy_calendar_targets.map_to_data(df)
- resampled_data = resample(calendar, df)
- expected = np.zeros(resampled_data.index.size, dtype=bool)
- for i in range(calendar.n_targets):
- expected[i::3] = True
- np.testing.assert_array_equal(resampled_data["target"].values, expected)
-
- def test_target_period_dataset(self, dummy_calendar_targets, dummy_dataset):
- ds, _ = dummy_dataset
- calendar = dummy_calendar_targets.map_to_data(ds)
- resampled_data = resample(calendar, ds)
- expected = np.zeros(3, dtype=bool)
- expected[: dummy_calendar_targets.n_targets] = True
- np.testing.assert_array_equal(resampled_data["target"].values, expected)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 5
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
astroid==3.3.9
babel==2.17.0
build==1.2.2.post1
bump2version==1.0.1
cachetools==5.5.2
certifi==2025.1.31
cftime==1.6.4.post1
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dill==0.3.9
distlib==0.3.9
docutils==0.21.2
dodgy==0.2.1
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
execnet==2.1.1
filelock==3.18.0
flake8==7.2.0
flake8-polyfill==1.0.2
fonttools==4.56.0
gitdb==4.0.12
GitPython==3.1.44
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==6.0.1
Jinja2==3.1.6
joblib==1.4.2
kiwisolver==1.4.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.9.4
mccabe==0.7.0
mdit-py-plugins==0.4.2
mdurl==0.1.2
mypy==1.15.0
mypy-extensions==1.0.0
myst-parser==3.0.1
netCDF4==1.7.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pep8-naming==0.10.0
pillow==11.1.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prospector==1.16.1
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.1
Pygments==2.19.1
pylint==3.3.6
pylint-celery==0.3
pylint-django==2.6.1
pylint-plugin-utils==0.8.2
pyparsing==3.2.3
pyproject-api==1.9.0
pyproject_hooks==1.2.0
pyroma==4.2
pytest @ file:///croot/pytest_1738938843180/work
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
requirements-detector==1.3.2
-e git+https://github.com/AI4S2S/s2spy.git@c254e11f1a64aaa52593e3848b71207421a16c61#egg=s2spy
scikit-learn==1.6.1
scipy==1.13.1
semver==3.0.4
setoptconf-tmp==0.3.1
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-autoapi==3.6.0
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stdlib-list==0.11.1
threadpoolctl==3.6.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
tox==4.25.0
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
virtualenv==20.29.3
xarray==2024.7.0
zipp==3.21.0
|
name: s2spy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- astroid==3.3.9
- babel==2.17.0
- build==1.2.2.post1
- bump2version==1.0.1
- cachetools==5.5.2
- certifi==2025.1.31
- cftime==1.6.4.post1
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dill==0.3.9
- distlib==0.3.9
- docutils==0.21.2
- dodgy==0.2.1
- execnet==2.1.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-polyfill==1.0.2
- fonttools==4.56.0
- gitdb==4.0.12
- gitpython==3.1.44
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- isort==6.0.1
- jinja2==3.1.6
- joblib==1.4.2
- kiwisolver==1.4.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- matplotlib==3.9.4
- mccabe==0.7.0
- mdit-py-plugins==0.4.2
- mdurl==0.1.2
- mypy==1.15.0
- mypy-extensions==1.0.0
- myst-parser==3.0.1
- netcdf4==1.7.2
- numpy==2.0.2
- pandas==2.2.3
- pep8-naming==0.10.0
- pillow==11.1.0
- platformdirs==4.3.7
- prospector==1.16.1
- pycodestyle==2.13.0
- pydocstyle==6.3.0
- pyflakes==3.3.1
- pygments==2.19.1
- pylint==3.3.6
- pylint-celery==0.3
- pylint-django==2.6.1
- pylint-plugin-utils==0.8.2
- pyparsing==3.2.3
- pyproject-api==1.9.0
- pyproject-hooks==1.2.0
- pyroma==4.2
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- requirements-detector==1.3.2
- s2spy==0.1.0
- scikit-learn==1.6.1
- scipy==1.13.1
- semver==3.0.4
- setoptconf-tmp==0.3.1
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-autoapi==3.6.0
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- stdlib-list==0.11.1
- threadpoolctl==3.6.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- tox==4.25.0
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- virtualenv==20.29.3
- xarray==2024.7.0
- zipp==3.21.0
prefix: /opt/conda/envs/s2spy
|
[
"tests/test_resample.py::TestResample::test_allow_overlap_dataframe[1]",
"tests/test_resample.py::TestResample::test_allow_overlap_dataframe[2]",
"tests/test_resample.py::TestResample::test_allow_overlap_dataframe[3]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[1-20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[1-20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[2-20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[2-20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[3-20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataframe[3-20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[1-20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[1-20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[2-20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[2-20191015]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[3-20151020]",
"tests/test_resample.py::TestResample::test_missing_intervals_dataset[3-20191015]",
"tests/test_resample.py::TestResample::test_low_freq_dataframe[1-20151020]",
"tests/test_resample.py::TestResample::test_low_freq_dataframe[1-20191015]",
"tests/test_resample.py::TestResample::test_low_freq_dataframe[2-20151020]",
"tests/test_resample.py::TestResample::test_low_freq_dataframe[2-20191015]",
"tests/test_resample.py::TestResample::test_low_freq_dataframe[3-20151020]",
"tests/test_resample.py::TestResample::test_low_freq_dataframe[3-20191015]",
"tests/test_resample.py::TestResample::test_low_freq_dataset[1-20151020]",
"tests/test_resample.py::TestResample::test_low_freq_dataset[1-20191015]",
"tests/test_resample.py::TestResample::test_low_freq_dataset[2-20151020]",
"tests/test_resample.py::TestResample::test_low_freq_dataset[2-20191015]",
"tests/test_resample.py::TestResample::test_low_freq_dataset[3-20151020]",
"tests/test_resample.py::TestResample::test_low_freq_dataset[3-20191015]",
"tests/test_time.py::TestAdventCalendar::test_repr",
"tests/test_time.py::TestAdventCalendar::test_set_max_lag",
"tests/test_time.py::TestAdventCalendar::test_set_max_lag_incorrect_val",
"tests/test_time.py::TestMonthlyCalendar::test_repr",
"tests/test_time.py::TestWeeklyCalendar::test_repr",
"tests/test_time.py::TestMap::test_max_lag_skip_years[73-expected_index0-74]",
"tests/test_time.py::TestMap::test_max_lag_skip_years[72-expected_index1-73]"
] |
[
"tests/test_time.py::TestAdventCalendar::test_show"
] |
[
"tests/test_resample.py::TestResample::test_non_mapped_calendar[1]",
"tests/test_resample.py::TestResample::test_non_mapped_calendar[2]",
"tests/test_resample.py::TestResample::test_non_mapped_calendar[3]",
"tests/test_resample.py::TestResample::test_nontime_index[1-20151020]",
"tests/test_resample.py::TestResample::test_nontime_index[1-20191015]",
"tests/test_resample.py::TestResample::test_nontime_index[2-20151020]",
"tests/test_resample.py::TestResample::test_nontime_index[2-20191015]",
"tests/test_resample.py::TestResample::test_nontime_index[3-20151020]",
"tests/test_resample.py::TestResample::test_nontime_index[3-20191015]",
"tests/test_resample.py::TestResample::test_series[1-20151020]",
"tests/test_resample.py::TestResample::test_series[1-20191015]",
"tests/test_resample.py::TestResample::test_series[2-20151020]",
"tests/test_resample.py::TestResample::test_series[2-20191015]",
"tests/test_resample.py::TestResample::test_series[3-20151020]",
"tests/test_resample.py::TestResample::test_series[3-20191015]",
"tests/test_resample.py::TestResample::test_unnamed_series[1-20151020]",
"tests/test_resample.py::TestResample::test_unnamed_series[1-20191015]",
"tests/test_resample.py::TestResample::test_unnamed_series[2-20151020]",
"tests/test_resample.py::TestResample::test_unnamed_series[2-20191015]",
"tests/test_resample.py::TestResample::test_unnamed_series[3-20151020]",
"tests/test_resample.py::TestResample::test_unnamed_series[3-20191015]",
"tests/test_resample.py::TestResample::test_dataframe[1-20151020]",
"tests/test_resample.py::TestResample::test_dataframe[1-20191015]",
"tests/test_resample.py::TestResample::test_dataframe[2-20151020]",
"tests/test_resample.py::TestResample::test_dataframe[2-20191015]",
"tests/test_resample.py::TestResample::test_dataframe[3-20151020]",
"tests/test_resample.py::TestResample::test_dataframe[3-20191015]",
"tests/test_resample.py::TestResample::test_dataarray[1-20151020]",
"tests/test_resample.py::TestResample::test_dataarray[1-20191015]",
"tests/test_resample.py::TestResample::test_dataarray[2-20151020]",
"tests/test_resample.py::TestResample::test_dataarray[2-20191015]",
"tests/test_resample.py::TestResample::test_dataarray[3-20151020]",
"tests/test_resample.py::TestResample::test_dataarray[3-20191015]",
"tests/test_resample.py::TestResample::test_dataset[1-20151020]",
"tests/test_resample.py::TestResample::test_dataset[1-20191015]",
"tests/test_resample.py::TestResample::test_dataset[2-20151020]",
"tests/test_resample.py::TestResample::test_dataset[2-20191015]",
"tests/test_resample.py::TestResample::test_dataset[3-20151020]",
"tests/test_resample.py::TestResample::test_dataset[3-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[1-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[1-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[2-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[2-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[3-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataframe[3-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[1-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[1-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[2-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[2-20191015]",
"tests/test_resample.py::TestResample::test_target_period_dataset[3-20151020]",
"tests/test_resample.py::TestResample::test_target_period_dataset[3-20191015]",
"tests/test_resample.py::TestResample::test_1day_freq_dataframe[1]",
"tests/test_resample.py::TestResample::test_1day_freq_dataframe[2]",
"tests/test_resample.py::TestResample::test_1day_freq_dataframe[3]",
"tests/test_time.py::TestAdventCalendar::test_init",
"tests/test_time.py::TestAdventCalendar::test_flat",
"tests/test_time.py::TestAdventCalendar::test_no_intervals",
"tests/test_time.py::TestAdventCalendar::test_incorrect_freq",
"tests/test_time.py::TestMonthlyCalendar::test_init",
"tests/test_time.py::TestMonthlyCalendar::test_show",
"tests/test_time.py::TestMonthlyCalendar::test_flat",
"tests/test_time.py::TestMonthlyCalendar::test_no_intervals",
"tests/test_time.py::TestMonthlyCalendar::test_incorrect_freq",
"tests/test_time.py::TestWeeklyCalendar::test_init",
"tests/test_time.py::TestWeeklyCalendar::test_show",
"tests/test_time.py::TestWeeklyCalendar::test_flat",
"tests/test_time.py::TestWeeklyCalendar::test_no_intervals",
"tests/test_time.py::TestWeeklyCalendar::test_incorrect_freq",
"tests/test_time.py::TestMap::test_map_years",
"tests/test_time.py::TestMap::test_map_years_single",
"tests/test_time.py::TestMap::test_map_to_data_edge_case_last_year",
"tests/test_time.py::TestMap::test_map_to_data_single_year_coverage",
"tests/test_time.py::TestMap::test_map_to_data_edge_case_first_year",
"tests/test_time.py::TestMap::test_map_to_data_input_time_backward",
"tests/test_time.py::TestMap::test_map_to_data_xarray_input",
"tests/test_time.py::TestMap::test_missing_time_dim",
"tests/test_time.py::TestMap::test_non_time_dim"
] |
[] |
Apache License 2.0
| null |
|
AI4S2S__s2spy-83
|
1bd615deba811a0b978e2c3abfad6c1de1be8851
|
2022-08-17 14:40:34
|
1bd615deba811a0b978e2c3abfad6c1de1be8851
|
diff --git a/notebooks/tutorial_RGDR.ipynb b/notebooks/tutorial_RGDR.ipynb
index 198ccea..29a7389 100644
--- a/notebooks/tutorial_RGDR.ipynb
+++ b/notebooks/tutorial_RGDR.ipynb
@@ -53,7 +53,7 @@
"target_timeseries = target_resampled.sel(cluster=3).ts.isel(i_interval=0)\n",
"precursor_field = field_resampled.sst.isel(i_interval=1)\n",
"\n",
- "rgdr = RGDR(target_timeseries, eps_km=600, alpha=0.05, min_area_km2=3000**2)"
+ "rgdr = RGDR(eps_km=600, alpha=0.05, min_area_km2=3000**2)"
]
},
{
@@ -83,7 +83,7 @@
],
"source": [
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
- "_ = rgdr.plot_correlation(precursor_field, ax1, ax2)"
+ "_ = rgdr.plot_correlation(precursor_field, target_timeseries, ax1, ax2)"
]
},
{
@@ -116,20 +116,17 @@
"source": [
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 2))\n",
"\n",
- "_ = rgdr.plot_clusters(precursor_field, ax=ax1)\n",
+ "_ = rgdr.plot_clusters(precursor_field, target_timeseries, ax=ax1)\n",
"\n",
- "_ = RGDR(target_timeseries,\n",
- " eps_km=600,\n",
- " alpha=0.05,\n",
- " min_area_km2=1000**2\n",
- " ).plot_clusters(precursor_field, ax=ax2)"
+ "_ = RGDR(min_area_km2=1000**2).plot_clusters(precursor_field, target_timeseries, ax=ax2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "With `.fit` the RGDR clustering can be fit to a precursor field. This will return the data reduced to clusters:"
+ "With `.fit` the RGDR clustering can be fit to a precursor field.\n",
+ "`.transform` can then be used to return the data reduced to clusters:"
]
},
{
@@ -171,6 +168,7 @@
"}\n",
"\n",
"html[theme=dark],\n",
+ "body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
@@ -494,12 +492,14 @@
"</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'sst' (cluster_labels: 3, anchor_year: 39)>\n",
"290.8 291.0 290.7 290.1 291.1 291.3 ... 299.0 299.5 298.9 298.9 299.2 298.2\n",
"Coordinates:\n",
+ " * anchor_year (anchor_year) int32 1980 1981 1982 1983 ... 2016 2017 2018\n",
+ " i_interval int64 1\n",
" index (anchor_year) int64 1 13 25 37 49 61 ... 409 421 433 445 457\n",
" interval (anchor_year) object (1980-07-02, 1980-08-01] ... (2018-0...\n",
- " * anchor_year (anchor_year) int64 1980 1981 1982 1983 ... 2016 2017 2018\n",
- " i_interval int64 1\n",
" target bool False\n",
- " * cluster_labels (cluster_labels) float64 -2.0 0.0 1.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>cluster_labels</span>: 3</li><li><span class='xr-has-index'>anchor_year</span>: 39</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-57548d43-1b48-4abf-a765-2fa308c2d9ce' class='xr-array-in' type='checkbox' ><label for='section-57548d43-1b48-4abf-a765-2fa308c2d9ce' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>290.8 291.0 290.7 290.1 291.1 291.3 ... 299.5 298.9 298.9 299.2 298.2</span></div><div class='xr-array-data'><pre>array([[290.79588914, 290.970545 , 290.71731703, 290.0762239 ,\n",
+ " * cluster_labels (cluster_labels) int32 -2 0 1\n",
+ " latitude (cluster_labels) float64 36.05 nan 29.44\n",
+ " longitude (cluster_labels) float64 223.9 nan 185.4</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'sst'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>cluster_labels</span>: 3</li><li><span class='xr-has-index'>anchor_year</span>: 39</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-f5bc8d25-bf34-4c88-9121-f7ab7fd5d804' class='xr-array-in' type='checkbox' ><label for='section-f5bc8d25-bf34-4c88-9121-f7ab7fd5d804' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>290.8 291.0 290.7 290.1 291.1 291.3 ... 299.5 298.9 298.9 299.2 298.2</span></div><div class='xr-array-data'><pre>array([[290.79588914, 290.970545 , 290.71731703, 290.0762239 ,\n",
" 291.08960917, 291.31511491, 291.11538436, 290.26277142,\n",
" 290.80443321, 290.99960169, 291.53446464, 291.36075119,\n",
" 291.85483292, 291.09343404, 291.31408735, 291.41374784,\n",
@@ -528,10 +528,13 @@
" 298.88763028, 299.2529288 , 299.0168395 , 298.84020348,\n",
" 298.48441327, 299.30649003, 299.69018872, 299.65241405,\n",
" 299.320106 , 299.04325189, 299.48610574, 298.91044985,\n",
- " 298.89195415, 299.19568083, 298.21053747]])</pre></div></div></li><li class='xr-section-item'><input id='section-7b3a0711-0bee-4e8a-bff6-653d382b6cee' class='xr-section-summary-in' type='checkbox' checked><label for='section-7b3a0711-0bee-4e8a-bff6-653d382b6cee' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>index</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1 13 25 37 49 ... 421 433 445 457</div><input id='attrs-67060b83-a064-4867-b21f-60b066184d18' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-67060b83-a064-4867-b21f-60b066184d18' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2793a313-1fa1-4469-b925-db2c25e8422e' class='xr-var-data-in' type='checkbox'><label for='data-2793a313-1fa1-4469-b925-db2c25e8422e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145,\n",
+ " 298.89195415, 299.19568083, 298.21053747]])</pre></div></div></li><li class='xr-section-item'><input id='section-95b251ac-392b-4d4b-bf6e-b9f7afec9cb5' class='xr-section-summary-in' type='checkbox' checked><label for='section-95b251ac-392b-4d4b-bf6e-b9f7afec9cb5' class='xr-section-summary' >Coordinates: <span>(8)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>1980 1981 1982 ... 2016 2017 2018</div><input id='attrs-8dba64f4-e3d0-4ae4-96fa-6a0144a3cfc1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-8dba64f4-e3d0-4ae4-96fa-6a0144a3cfc1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-71816fcd-d623-4450-bd28-c276610ad0e4' class='xr-var-data-in' type='checkbox'><label for='data-71816fcd-d623-4450-bd28-c276610ad0e4' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,\n",
+ " 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,\n",
+ " 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015,\n",
+ " 2016, 2017, 2018])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>i_interval</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1</div><input id='attrs-266c79b1-cd75-4fd9-a1a9-6e762b299ed2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-266c79b1-cd75-4fd9-a1a9-6e762b299ed2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-808c7c66-0d03-48c8-a094-5c5afae42b3c' class='xr-var-data-in' type='checkbox'><label for='data-808c7c66-0d03-48c8-a094-5c5afae42b3c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(1, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>index</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1 13 25 37 49 ... 421 433 445 457</div><input id='attrs-d96ed652-a251-48e3-a9c9-c78621ce231e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d96ed652-a251-48e3-a9c9-c78621ce231e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a70f5ba4-8506-474a-81fb-d3e40861c04c' class='xr-var-data-in' type='checkbox'><label for='data-a70f5ba4-8506-474a-81fb-d3e40861c04c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145,\n",
" 157, 169, 181, 193, 205, 217, 229, 241, 253, 265, 277, 289, 301,\n",
" 313, 325, 337, 349, 361, 373, 385, 397, 409, 421, 433, 445, 457],\n",
- " dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>interval</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>(1980-07-02, 1980-08-01] ... (20...</div><input id='attrs-51b9c5bf-59b2-45f7-93a9-99744db558c2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-51b9c5bf-59b2-45f7-93a9-99744db558c2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c881e817-cda4-415c-b815-5ad445a749bc' class='xr-var-data-in' type='checkbox'><label for='data-c881e817-cda4-415c-b815-5ad445a749bc' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([Interval('1980-07-02', '1980-08-01', closed='right'),\n",
+ " dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>interval</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>(1980-07-02, 1980-08-01] ... (20...</div><input id='attrs-78c7815f-5b0b-43b4-a8ee-8ba7cbdf6d57' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-78c7815f-5b0b-43b4-a8ee-8ba7cbdf6d57' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-47d98346-f0f3-4b4d-be33-8d9c6f61b92a' class='xr-var-data-in' type='checkbox'><label for='data-47d98346-f0f3-4b4d-be33-8d9c6f61b92a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([Interval('1980-07-02', '1980-08-01', closed='right'),\n",
" Interval('1981-07-02', '1981-08-01', closed='right'),\n",
" Interval('1982-07-02', '1982-08-01', closed='right'),\n",
" Interval('1983-07-02', '1983-08-01', closed='right'),\n",
@@ -569,21 +572,20 @@
" Interval('2015-07-02', '2015-08-01', closed='right'),\n",
" Interval('2016-07-02', '2016-08-01', closed='right'),\n",
" Interval('2017-07-02', '2017-08-01', closed='right'),\n",
- " Interval('2018-07-02', '2018-08-01', closed='right')], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>anchor_year</span></div><div class='xr-var-dims'>(anchor_year)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1980 1981 1982 ... 2016 2017 2018</div><input id='attrs-28bf1820-f31f-4cd8-8f28-1f70b627f934' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-28bf1820-f31f-4cd8-8f28-1f70b627f934' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-8b53caf6-01e7-48cb-9ba0-3c24fd03fadc' class='xr-var-data-in' type='checkbox'><label for='data-8b53caf6-01e7-48cb-9ba0-3c24fd03fadc' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,\n",
- " 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,\n",
- " 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015,\n",
- " 2016, 2017, 2018], dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>i_interval</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1</div><input id='attrs-927c990d-58a9-42e9-88d9-05a8b451a0e1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-927c990d-58a9-42e9-88d9-05a8b451a0e1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c9cbd978-62e5-4f6b-b471-e0b866de011f' class='xr-var-data-in' type='checkbox'><label for='data-c9cbd978-62e5-4f6b-b471-e0b866de011f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(1, dtype=int64)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>target</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>False</div><input id='attrs-13417705-633c-4a4d-bcca-7aef6bb48cb1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-13417705-633c-4a4d-bcca-7aef6bb48cb1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-57435aa5-d3cc-42a2-9fab-c3f1181d81f2' class='xr-var-data-in' type='checkbox'><label for='data-57435aa5-d3cc-42a2-9fab-c3f1181d81f2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(False)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-2.0 0.0 1.0</div><input id='attrs-c0794742-d215-4833-a607-f55b9d260507' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c0794742-d215-4833-a607-f55b9d260507' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-085d4cba-0134-429a-8b20-2f8ee0da0b19' class='xr-var-data-in' type='checkbox'><label for='data-085d4cba-0134-429a-8b20-2f8ee0da0b19' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-2., 0., 1.])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-edc51e75-c5d1-4d3d-acb8-d29e400324e0' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-edc51e75-c5d1-4d3d-acb8-d29e400324e0' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
+ " Interval('2018-07-02', '2018-08-01', closed='right')], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>target</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>False</div><input id='attrs-9c6a8913-5ff1-4399-9a14-1e92e0ecaf40' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-9c6a8913-5ff1-4399-9a14-1e92e0ecaf40' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f7a6b906-d6f1-4a23-8849-70bd9c64b8bf' class='xr-var-data-in' type='checkbox'><label for='data-f7a6b906-d6f1-4a23-8849-70bd9c64b8bf' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(False)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cluster_labels</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>-2 0 1</div><input id='attrs-3666865c-b0b6-4939-8d9f-46eeeef17953' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3666865c-b0b6-4939-8d9f-46eeeef17953' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a225f50b-a75d-48fd-972a-b3cdcbadc88a' class='xr-var-data-in' type='checkbox'><label for='data-a225f50b-a75d-48fd-972a-b3cdcbadc88a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([-2, 0, 1])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>latitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>36.05 nan 29.44</div><input id='attrs-83eedce7-6a6b-447b-acf3-da3c8599601d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-83eedce7-6a6b-447b-acf3-da3c8599601d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-28d9eff3-8d17-477b-a4c4-3eb11c127cb7' class='xr-var-data-in' type='checkbox'><label for='data-28d9eff3-8d17-477b-a4c4-3eb11c127cb7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([36.0508552, nan, 29.4398051])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>longitude</span></div><div class='xr-var-dims'>(cluster_labels)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>223.9 nan 185.4</div><input id='attrs-58fdb13b-0e3c-4e91-a117-8de91280dfb8' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-58fdb13b-0e3c-4e91-a117-8de91280dfb8' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9729360d-7b98-4363-a1b0-c41a3e1d5a28' class='xr-var-data-in' type='checkbox'><label for='data-9729360d-7b98-4363-a1b0-c41a3e1d5a28' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([223.86658208, nan, 185.40970765])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-b6f17ab0-1e40-4ee4-a636-991a140d2d05' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-b6f17ab0-1e40-4ee4-a636-991a140d2d05' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'sst' (cluster_labels: 3, anchor_year: 39)>\n",
"290.8 291.0 290.7 290.1 291.1 291.3 ... 299.0 299.5 298.9 298.9 299.2 298.2\n",
"Coordinates:\n",
+ " * anchor_year (anchor_year) int32 1980 1981 1982 1983 ... 2016 2017 2018\n",
+ " i_interval int64 1\n",
" index (anchor_year) int64 1 13 25 37 49 61 ... 409 421 433 445 457\n",
" interval (anchor_year) object (1980-07-02, 1980-08-01] ... (2018-0...\n",
- " * anchor_year (anchor_year) int64 1980 1981 1982 1983 ... 2016 2017 2018\n",
- " i_interval int64 1\n",
" target bool False\n",
- " * cluster_labels (cluster_labels) float64 -2.0 0.0 1.0"
+ " * cluster_labels (cluster_labels) int32 -2 0 1\n",
+ " latitude (cluster_labels) float64 36.05 nan 29.44\n",
+ " longitude (cluster_labels) float64 223.9 nan 185.4"
]
},
"execution_count": 5,
@@ -592,7 +594,8 @@
}
],
"source": [
- "clustered_data = rgdr.fit(precursor_field)\n",
+ "rgdr.fit(precursor_field, target_timeseries)\n",
+ "clustered_data = rgdr.transform(precursor_field)\n",
"xr.set_options(display_expand_data=False) # Hide the full data repr\n",
"clustered_data"
]
@@ -612,7 +615,7 @@
{
"data": {
"text/plain": [
- "<matplotlib.legend.Legend at 0x2df7dc7b0a0>"
+ "<matplotlib.legend.Legend at 0x1dc9fe35060>"
]
},
"execution_count": 6,
diff --git a/s2spy/rgdr/rgdr.py b/s2spy/rgdr/rgdr.py
index 35a415f..0e505ca 100644
--- a/s2spy/rgdr/rgdr.py
+++ b/s2spy/rgdr/rgdr.py
@@ -120,7 +120,7 @@ def masked_spherical_dbscan(
coords = np.radians(coords)
# Prepare labels, default value is 0 (not in cluster)
- labels = np.zeros(len(coords))
+ labels = np.zeros(len(coords), dtype=int)
for sign, sign_mask in zip([1, -1], [data["corr"] >= 0, data["corr"] < 0]):
mask = np.logical_and(data["p_val"] < dbscan_params["alpha"], sign_mask)
@@ -224,7 +224,7 @@ class RGDR:
"""Response Guided Dimensionality Reduction."""
def __init__(
- self, timeseries, eps_km=600, alpha=0.05, min_area_km2=3000**2
+ self, eps_km: float = 600, alpha: float = 0.05, min_area_km2: float = 3000**2
) -> None:
"""Response Guided Dimensionality Reduction (RGDR).
@@ -240,14 +240,52 @@ class RGDR:
min_area_km2 (float): The minimum area of a cluster. Clusters smaller than
this minimum area will be discarded.
"""
- self.timeseries = timeseries
self._clusters = None
self._area = None
self._dbscan_params = {"eps": eps_km, "alpha": alpha, "min_area": min_area_km2}
+ def get_correlation(
+ self,
+ precursor: xr.DataArray,
+ timeseries: xr.DataArray,
+ ) -> Tuple[xr.DataArray, xr.DataArray]:
+ """Calculates the correlation and p-value between input precursor and timeseries.
+
+ Args:
+ precursor: Precursor field data with the dimensions
+ 'latitude', 'longitude', and 'anchor_year'
+ timeseries: Timeseries data with only the dimension 'anchor_year'
+
+ Returns:
+ (correlation, p_value): DataArrays containing the correlation and p-value.
+ """
+ if not isinstance(precursor, xr.DataArray):
+ raise ValueError("Please provide an xr.DataArray, not a dataset")
+
+ return correlation(precursor, timeseries, corr_dim="anchor_year")
+
+ def get_clusters(
+ self,
+ precursor: xr.DataArray,
+ timeseries: xr.DataArray,
+ ) -> xr.DataArray:
+ """Generates clusters for the precursor data.
+
+ Args:
+ precursor: Precursor field data with the dimensions
+ 'latitude', 'longitude', and 'anchor_year'
+ timeseries: Timeseries data with only the dimension 'anchor_year'
+
+ Returns:
+ DataArray containing the clusters as masks.
+ """
+ corr, p_val = self.get_correlation(precursor, timeseries)
+ return masked_spherical_dbscan(precursor, corr, p_val, self._dbscan_params)
+
def plot_correlation(
self,
precursor: xr.DataArray,
+ timeseries: xr.DataArray,
ax1: Optional[plt.Axes] = None,
ax2: Optional[plt.Axes] = None,
) -> List[Type[mpl.collections.QuadMesh]]:
@@ -255,22 +293,19 @@ class RGDR:
initiated RGDR class and input precursor field.
Args:
- precursor (xr.DataArray): Precursor field data with the dimensions
+ precursor: Precursor field data with the dimensions
'latitude', 'longitude', and 'anchor_year'
- ax1 (plt.Axes, optional): a matplotlib axis handle to plot
+ timeseries: Timeseries data with only the dimension 'anchor_year'
+ ax1: a matplotlib axis handle to plot
the correlation values into. If None, an axis handle will be created
instead.
- ax2 (plt.Axes, optional): a matplotlib axis handle to plot
+ ax2: a matplotlib axis handle to plot
the p-values into. If None, an axis handle will be created instead.
Returns:
List[mpl.collections.QuadMesh]: List of matplotlib artists.
"""
-
- if not isinstance(precursor, xr.DataArray):
- raise ValueError("Please provide an xr.DataArray, not a dataset")
-
- corr, p_val = correlation(precursor, self.timeseries, corr_dim="anchor_year")
+ corr, p_val = self.get_correlation(precursor, timeseries)
if (ax1 is None) and (ax2 is None):
_, (ax1, ax2) = plt.subplots(ncols=2)
@@ -288,30 +323,32 @@ class RGDR:
return [plot1, plot2]
def plot_clusters(
- self, precursor: xr.DataArray, ax: Optional[plt.Axes] = None
+ self,
+ precursor: xr.DataArray,
+ timeseries: xr.DataArray,
+ ax: Optional[plt.Axes] = None,
) -> Type[mpl.collections.QuadMesh]:
"""Generates a figure showing the clusters resulting from the initiated RGDR
class and input precursor field.
Args:
- precursor: Precursor field data with the dimensions 'latitude', 'longitude',
- and 'anchor_year'
+ precursor: Precursor field data with the dimensions
+ 'latitude', 'longitude', and 'anchor_year'
+ timeseries: Timeseries data with only the dimension 'anchor_year'
ax (plt.Axes, optional): a matplotlib axis handle to plot the clusters
into. If None, an axis handle will be created instead.
Returns:
matplotlib.collections.QuadMesh: Matplotlib artist.
"""
- corr, p_val = correlation(precursor, self.timeseries, corr_dim="anchor_year")
-
- clusters = masked_spherical_dbscan(precursor, corr, p_val, self._dbscan_params)
+ clusters = self.get_clusters(precursor, timeseries)
if ax is None:
_, ax = plt.subplots()
return clusters.cluster_labels.plot(cmap="viridis", ax=ax)
- def fit(self, precursor: xr.DataArray) -> xr.DataArray:
+ def fit(self, precursor: xr.DataArray, timeseries: xr.DataArray):
"""Fits RGDR clusters to precursor data.
Performs DBSCAN clustering on a prepared DataArray, and then groups the data by
@@ -330,13 +367,15 @@ class RGDR:
Args:
precursor: Precursor field data with the dimensions 'latitude', 'longitude',
and 'anchor_year'
+ timeseries: Timeseries data with only the dimension 'anchor_year', which
+ will be correlated with the precursor field.
Returns:
xr.DataArray: The precursor data, with the latitute and longitude dimensions
reduced to clusters.
"""
- corr, p_val = correlation(precursor, self.timeseries, corr_dim="anchor_year")
+ corr, p_val = correlation(precursor, timeseries, corr_dim="anchor_year")
masked_data = masked_spherical_dbscan(
precursor, corr, p_val, self._dbscan_params
@@ -345,12 +384,7 @@ class RGDR:
self._clusters = masked_data.cluster_labels
self._area = masked_data.area
- reduced_precursor = utils.weighted_groupby(
- masked_data, groupby="cluster_labels", weight="area"
- )
-
- # Add the geographical centers for later alignment between, e.g., splits
- return utils.geographical_cluster_center(masked_data, reduced_precursor)
+ return self
def transform(self, data: xr.DataArray) -> xr.DataArray:
"""Apply RGDR on the input data, based on the previous fit.
@@ -366,8 +400,26 @@ class RGDR:
data["cluster_labels"] = self._clusters
data["area"] = self._area
+ # Add the geographical centers for later alignment between, e.g., splits
reduced_data = utils.weighted_groupby(
data, groupby="cluster_labels", weight="area"
)
return utils.geographical_cluster_center(data, reduced_data)
+
+ def fit_transform(self, precursor: xr.DataArray, timeseries: xr.DataArray):
+ """Fits RGDR clusters to precursor data, and applies RGDR on the input data.
+
+ Args:
+ precursor: Precursor field data with the dimensions 'latitude', 'longitude',
+ and 'anchor_year'
+ timeseries: Timeseries data with only the dimension 'anchor_year', which
+ will be correlated with the precursor field.
+
+ Returns:
+ xr.DataArray: The precursor data, with the latitute and longitude dimensions
+ reduced to clusters.
+ """
+
+ self.fit(precursor, timeseries)
+ return self.transform(precursor)
|
Return correlation / p_values from RGDR
Currently the correlation and p_values are not accessible by the user. The user can only visualize the those values via RGDR built-in plot functions. The users may need to investigate/store these values in case they want to check the correlation of the precursor fields and target timeseries for all the `i_intervals`. So RGDR should return correlation and p_values.
|
AI4S2S/s2spy
|
diff --git a/tests/test_rgdr/test_rgdr.py b/tests/test_rgdr/test_rgdr.py
index a6e9625..3cfb548 100644
--- a/tests/test_rgdr/test_rgdr.py
+++ b/tests/test_rgdr/test_rgdr.py
@@ -167,11 +167,11 @@ class TestRGDR:
"""Test RGDR and its methods."""
@pytest.fixture(autouse=True)
- def dummy_rgdr(self, example_target):
- return RGDR(example_target, min_area_km2=1000**2)
+ def dummy_rgdr(self):
+ return RGDR(min_area_km2=1000**2)
- def test_init(self, example_target):
- rgdr = RGDR(example_target, min_area_km2=1000**2)
+ def test_init(self):
+ rgdr = RGDR(min_area_km2=1000**2)
assert isinstance(rgdr, RGDR)
def test_transform_before_fit(self, dummy_rgdr, example_field):
@@ -179,27 +179,38 @@ class TestRGDR:
with pytest.raises(ValueError):
dummy_rgdr.transform(example_field)
- def test_fit(self, dummy_rgdr, example_field):
- clustered_data = dummy_rgdr.fit(example_field)
+ def test_fit(self, dummy_rgdr, example_field, example_target):
+ dummy_rgdr.fit(example_field, example_target)
+ assert dummy_rgdr._area is not None
+
+ def test_transform(self, dummy_rgdr, example_field, example_target):
+ dummy_rgdr.fit(example_field, example_target)
+ clustered_data = dummy_rgdr.transform(example_field)
cluster_labels = np.array([-2.0, -1.0, 0.0, 1.0])
np.testing.assert_array_equal(clustered_data["cluster_labels"], cluster_labels)
- def test_transform(self, dummy_rgdr, example_field):
- clustered_data = dummy_rgdr.fit(example_field)
- clustered_data = dummy_rgdr.transform(example_field)
+ def test_fit_transform_fits(self, example_field, example_target):
+ # Ensures that after fit_transform, the rgdr object is fit.
+ rgdr = RGDR()
+ _ = rgdr.fit_transform(example_field, example_target)
+ assert rgdr._area is not None
+
+ def test_fit_transform(self, example_field, example_target):
+ rgdr = RGDR(min_area_km2=1000**2)
+ clustered_data = rgdr.fit_transform(example_field, example_target)
cluster_labels = np.array([-2.0, -1.0, 0.0, 1.0])
np.testing.assert_array_equal(clustered_data["cluster_labels"], cluster_labels)
- def test_corr_plot(self, dummy_rgdr, example_field):
- dummy_rgdr.plot_correlation(example_field)
+ def test_corr_plot(self, dummy_rgdr, example_field, example_target):
+ dummy_rgdr.plot_correlation(example_field, example_target)
- def test_corr_plot_ax(self, dummy_rgdr, example_field):
+ def test_corr_plot_ax(self, dummy_rgdr, example_field, example_target):
_, (ax1, ax2) = plt.subplots(ncols=2)
- dummy_rgdr.plot_correlation(example_field, ax1=ax1, ax2=ax2)
+ dummy_rgdr.plot_correlation(example_field, example_target, ax1=ax1, ax2=ax2)
- def test_cluster_plot(self, dummy_rgdr, example_field):
- dummy_rgdr.plot_clusters(example_field)
+ def test_cluster_plot(self, dummy_rgdr, example_field, example_target):
+ dummy_rgdr.plot_clusters(example_field, example_target)
- def test_cluster_plot_ax(self, dummy_rgdr, example_field):
+ def test_cluster_plot_ax(self, dummy_rgdr, example_field, example_target):
_, ax = plt.subplots()
- dummy_rgdr.plot_clusters(example_field, ax=ax)
+ dummy_rgdr.plot_clusters(example_field, example_target, ax=ax)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
astroid==3.3.9
babel==2.17.0
build==1.2.2.post1
bump2version==1.0.1
cachetools==5.5.2
certifi==2025.1.31
cftime==1.6.4.post1
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
dill==0.3.9
distlib==0.3.9
docutils==0.21.2
dodgy==0.2.1
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
flake8==7.2.0
flake8-polyfill==1.0.2
fonttools==4.56.0
gitdb==4.0.12
GitPython==3.1.44
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==6.0.1
Jinja2==3.1.6
joblib==1.4.2
kiwisolver==1.4.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.9.4
mccabe==0.7.0
mdit-py-plugins==0.4.2
mdurl==0.1.2
mypy==1.15.0
mypy-extensions==1.0.0
myst-parser==3.0.1
netCDF4==1.7.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pep8-naming==0.10.0
pillow==11.1.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prospector==1.16.1
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.2
Pygments==2.19.1
pylint==3.3.6
pylint-celery==0.3
pylint-django==2.6.1
pylint-plugin-utils==0.8.2
pyparsing==3.2.3
pyproject-api==1.9.0
pyproject_hooks==1.2.0
pyroma==4.2
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
requirements-detector==1.3.2
-e git+https://github.com/AI4S2S/s2spy.git@1bd615deba811a0b978e2c3abfad6c1de1be8851#egg=s2spy
scikit-learn==1.6.1
scipy==1.13.1
semver==3.0.4
setoptconf-tmp==0.3.1
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-autoapi==3.6.0
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stdlib-list==0.11.1
threadpoolctl==3.6.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
tox==4.25.0
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
virtualenv==20.29.3
xarray==2024.7.0
zipp==3.21.0
|
name: s2spy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- astroid==3.3.9
- babel==2.17.0
- build==1.2.2.post1
- bump2version==1.0.1
- cachetools==5.5.2
- certifi==2025.1.31
- cftime==1.6.4.post1
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- dill==0.3.9
- distlib==0.3.9
- docutils==0.21.2
- dodgy==0.2.1
- filelock==3.18.0
- flake8==7.2.0
- flake8-polyfill==1.0.2
- fonttools==4.56.0
- gitdb==4.0.12
- gitpython==3.1.44
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- isort==6.0.1
- jinja2==3.1.6
- joblib==1.4.2
- kiwisolver==1.4.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- matplotlib==3.9.4
- mccabe==0.7.0
- mdit-py-plugins==0.4.2
- mdurl==0.1.2
- mypy==1.15.0
- mypy-extensions==1.0.0
- myst-parser==3.0.1
- netcdf4==1.7.2
- numpy==2.0.2
- pandas==2.2.3
- pep8-naming==0.10.0
- pillow==11.1.0
- platformdirs==4.3.7
- prospector==1.16.1
- pycodestyle==2.13.0
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygments==2.19.1
- pylint==3.3.6
- pylint-celery==0.3
- pylint-django==2.6.1
- pylint-plugin-utils==0.8.2
- pyparsing==3.2.3
- pyproject-api==1.9.0
- pyproject-hooks==1.2.0
- pyroma==4.2
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- requirements-detector==1.3.2
- s2spy==0.1.0
- scikit-learn==1.6.1
- scipy==1.13.1
- semver==3.0.4
- setoptconf-tmp==0.3.1
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-autoapi==3.6.0
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- stdlib-list==0.11.1
- threadpoolctl==3.6.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- tox==4.25.0
- trove-classifiers==2025.3.19.19
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- virtualenv==20.29.3
- xarray==2024.7.0
- zipp==3.21.0
prefix: /opt/conda/envs/s2spy
|
[
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_init",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform_before_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_transform",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform_fits",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_fit_transform",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_plot",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_corr_plot_ax",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_plot",
"tests/test_rgdr/test_rgdr.py::TestRGDR::test_cluster_plot_ax"
] |
[] |
[
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_pearsonr_nan",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_field_dim_name",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_correlation_wrong_target_dims",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_partial_correlation",
"tests/test_rgdr/test_rgdr.py::TestCorrelation::test_regression",
"tests/test_rgdr/test_rgdr.py::TestDBSCAN::test_dbscan",
"tests/test_rgdr/test_rgdr.py::TestDBSCAN::test_dbscan_min_area"
] |
[] |
Apache License 2.0
| null |
|
ARM-software__mango-42
|
f1b2aaef4b2d6ba5b5ed1667346c1d9cfb708d85
|
2021-08-23 06:03:32
|
a71bc007a0c4e39462fd1810cdbcf99c4e854679
|
diff --git a/mango/domain/domain_space.py b/mango/domain/domain_space.py
index 86cf9da..b02f833 100644
--- a/mango/domain/domain_space.py
+++ b/mango/domain/domain_space.py
@@ -70,7 +70,7 @@ class domain_space():
pass # we are not doing anything at present, and will directly use its value for GP.
elif isinstance(param_dict[par], range):
- mapping_int[par] = param_dict[par]
+ mapping_int[par] = list(param_dict[par])
elif isinstance(param_dict[par], Iterable):
@@ -83,11 +83,11 @@ class domain_space():
all_int = False
if all_int:
- mapping_int[par] = param_dict[par]
+ mapping_int[par] = list(param_dict[par])
# For lists with mixed type, floats or strings we consider them categorical or discrete
else:
- mapping_categorical[par] = param_dict[par]
+ mapping_categorical[par] = list(param_dict[par])
self.mapping_categorical = mapping_categorical
self.mapping_int = mapping_int
|
Variable type issue in domain_space.py file
System: Ubuntu 18.04, Python; 3.8.8 (via conda environment), Tensorflow: 2.4.0 (with GPU), numpy: 1.18.5
Error happens when using TF in conjunction with Mango for neural architecture search.
In https://github.com/ARM-software/mango/blob/master/mango/domain/domain_space.py, line 120:
```
...
# we need to see the index where: domain[x] appears in mapping[x]
index = mapping_categorical[x].index(domain[x])
...
```
The variable mapping_categorical[x] automatically changes to numpy array for some iterations and remains as a list for some iterations. This causes an error: "numpy.ndarray() has no attribute index". I am not sure why the variable would return list for some iterations and a numpy array for other iterations. I made a workaround replacing the lines as follows:
```
...
# we need to see the index where: domain[x] appears in mapping[x]
if(type(mapping_categorical[x]).__name__ == 'list'):
index = mapping_categorical[x].index(domain[x])
else:
index = mapping_categorical[x].tolist().index(domain[x])
...
```
|
ARM-software/mango
|
diff --git a/tests/test_domain_space.py b/tests/test_domain_space.py
index f0738de..1d5ae89 100644
--- a/tests/test_domain_space.py
+++ b/tests/test_domain_space.py
@@ -119,3 +119,17 @@ def test_gp_space():
X2 = ds.convert_GP_space(params)
assert np.isclose(X2, X).all()
+
+
+def test_np_space():
+ space = {
+ 'x': np.array(['a', 'b', 'c']),
+ 'y': np.arange(100),
+ }
+
+ ds = domain_space(space, domain_size=10)
+ params = ds.get_domain()
+ assert len(params) == 10
+
+ gp_params = ds.convert_GP_space(params)
+ assert gp_params.shape == (10, 4)
\ No newline at end of file
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 1
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/ARM-software/mango.git@f1b2aaef4b2d6ba5b5ed1667346c1d9cfb708d85#egg=arm_mango
attrdict==2.0.1
coverage==7.8.0
dataclasses==0.6
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
joblib==1.4.2
numpy==2.0.2
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
scikit-learn==1.6.1
scipy==1.13.1
six==1.17.0
threadpoolctl==3.6.0
tomli==2.2.1
tqdm==4.67.1
typing_extensions==4.13.0
|
name: mango
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrdict==2.0.1
- coverage==7.8.0
- dataclasses==0.6
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- joblib==1.4.2
- numpy==2.0.2
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- scikit-learn==1.6.1
- scipy==1.13.1
- six==1.17.0
- threadpoolctl==3.6.0
- tomli==2.2.1
- tqdm==4.67.1
- typing-extensions==4.13.0
prefix: /opt/conda/envs/mango
|
[
"tests/test_domain_space.py::test_np_space"
] |
[] |
[
"tests/test_domain_space.py::test_domain",
"tests/test_domain_space.py::test_mango_loguniform",
"tests/test_domain_space.py::test_gp_samples_to_params",
"tests/test_domain_space.py::test_gp_space"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__greentea-237
|
86f5ec3211a8f7f324bcdd3201012945ee0534ac
|
2017-09-25 13:51:40
|
86f5ec3211a8f7f324bcdd3201012945ee0534ac
|
diff --git a/mbed_greentea/mbed_report_api.py b/mbed_greentea/mbed_report_api.py
index da3f0d9..82acb5c 100644
--- a/mbed_greentea/mbed_report_api.py
+++ b/mbed_greentea/mbed_report_api.py
@@ -38,6 +38,13 @@ def exporter_json(test_result_ext, test_suite_properties=None):
@details This is a machine friendly format
"""
import json
+ for target in test_result_ext.values():
+ for suite in target.values():
+ try:
+ suite["single_test_output"] = suite["single_test_output"]\
+ .decode("unicode_escape")
+ except KeyError:
+ pass
return json.dumps(test_result_ext, indent=4)
@@ -211,7 +218,10 @@ def exporter_testcase_junit(test_result_ext, test_suite_properties=None):
test_cases.append(tc)
ts_name = target_name
- test_build_properties = test_suite_properties[target_name] if target_name in test_suite_properties else None
+ if test_suite_properties and target_name in test_suite_properties:
+ test_build_properties = test_suite_properties[target_name]
+ else:
+ test_build_properties = None
ts = TestSuite(ts_name, test_cases, properties=test_build_properties)
test_suites.append(ts)
@@ -584,7 +594,9 @@ def get_result_overlay_dropdowns(result_div_id, test_results):
result_output_div_id = "%s_output" % result_div_id
result_output_dropdown = get_dropdown_html(result_output_div_id,
"Test Output",
- test_results['single_test_output'].rstrip("\n"),
+ test_results['single_test_output']
+ .decode("unicode-escape")
+ .rstrip("\n"),
output_text=True)
# Add a dropdown for the testcases if they are present
@@ -740,10 +752,14 @@ def exporter_html(test_result_ext, test_suite_properties=None):
test_results['single_test_count'] += 1
result_class = get_result_colour_class(test_results['single_test_result'])
+ try:
+ percent_pass = int((test_results['single_test_passes']*100.0)/test_results['single_test_count'])
+ except ZeroDivisionError:
+ percent_pass = 100
this_row += result_cell_template % (result_class,
result_div_id,
test_results['single_test_result'],
- int((test_results['single_test_passes']*100.0)/test_results['single_test_count']),
+ percent_pass,
test_results['single_test_passes'],
test_results['single_test_count'],
result_overlay)
|
mbedgt crash with float division by zero
Hi
Here is my command:
mbedgt -V -v -t NUCLEO_F401RE-ARM,NUCLEO_F401RE-GCC_ARM,NUCLEO_F401RE-IAR,NUCLEO_F410RB-ARM,NUCLEO_F410RB-GCC_ARM,NUCLEO_F410RB-IAR,NUCLEO_F411RE-ARM,NUCLEO_F411RE-GCC_ARM,NUCLEO_F411RE-IAR --report-html=/c/xxx.html
It has crashed:
...
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.3680156551
mbedgt: exporting to HTML file
mbedgt: unexpected error:
float division by zero
Traceback (most recent call last):
File "C:\Python27\Scripts\mbedgt-script.py", line 11, in <module>
load_entry_point('mbed-greentea==1.2.6', 'console_scripts', 'mbedgt')()
File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 401, in main
cli_ret = main_cli(opts, args)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 1050, in main_cli
html_report = exporter_html(test_report)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_report_api.py", line 747, in exporter_html
int((test_results['single_test_passes']*100.0)/test_results['single_test_count']),
ZeroDivisionError: float division by zero
|
ARMmbed/greentea
|
diff --git a/test/report_api.py b/test/report_api.py
new file mode 100644
index 0000000..122e26e
--- /dev/null
+++ b/test/report_api.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+"""
+mbed SDK
+Copyright (c) 2017 ARM Limited
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import unittest
+from mock import patch
+
+from mbed_greentea.mbed_report_api import exporter_html, \
+ exporter_memory_metrics_csv, exporter_testcase_junit, \
+ exporter_testcase_text, exporter_text, exporter_json
+
+
+class ReportEmitting(unittest.TestCase):
+
+
+ report_fns = [exporter_html, exporter_memory_metrics_csv,
+ exporter_testcase_junit, exporter_testcase_text,
+ exporter_text, exporter_json]
+ def test_report_zero_tests(self):
+ test_data = {}
+ for report_fn in self.report_fns:
+ report_fn(test_data)
+
+ def test_report_zero_testcases(self):
+ test_data = {
+ 'k64f-gcc_arm': {
+ 'garbage_test_suite' :{
+ u'single_test_result': u'NOT_RAN',
+ u'elapsed_time': 0.0,
+ u'build_path': u'N/A',
+ u'build_path_abs': u'N/A',
+ u'copy_method': u'N/A',
+ u'image_path': u'N/A',
+ u'single_test_output': b'N/A',
+ u'platform_name': u'k64f',
+ u'test_bin_name': u'N/A',
+ u'testcase_result': {},
+ }
+ }
+ }
+ for report_fn in self.report_fns:
+ report_fn(test_data)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 1
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
beautifulsoup4==4.13.3
certifi==2025.1.31
charset-normalizer==3.4.1
colorama==0.3.9
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
fasteners==0.19
future==1.0.0
idna==3.10
iniconfig==2.1.0
intelhex==2.3.0
junit-xml==1.9
lockfile==0.12.2
-e git+https://github.com/ARMmbed/greentea.git@86f5ec3211a8f7f324bcdd3201012945ee0534ac#egg=mbed_greentea
mbed-host-tests==1.8.15
mbed-ls==1.8.15
mbed-os-tools==1.8.15
mock==5.2.0
packaging==24.2
pluggy==1.5.0
prettytable==2.5.0
pyserial==3.5
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
requests==2.32.3
six==1.17.0
soupsieve==2.6
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13
|
name: greentea
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- beautifulsoup4==4.13.3
- certifi==2025.1.31
- charset-normalizer==3.4.1
- colorama==0.3.9
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- fasteners==0.19
- future==1.0.0
- idna==3.10
- iniconfig==2.1.0
- intelhex==2.3.0
- junit-xml==1.9
- lockfile==0.12.2
- mbed-host-tests==1.8.15
- mbed-ls==1.8.15
- mbed-os-tools==1.8.15
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- prettytable==2.5.0
- pyserial==3.5
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- requests==2.32.3
- six==1.17.0
- soupsieve==2.6
- tomli==2.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
- wcwidth==0.2.13
prefix: /opt/conda/envs/greentea
|
[
"test/report_api.py::ReportEmitting::test_report_zero_testcases"
] |
[] |
[
"test/report_api.py::ReportEmitting::test_report_zero_tests"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__greentea-243
|
8f7b28f8ec739156d238304fa4f5f2e5156536f5
|
2017-09-29 17:09:53
|
68508c5f4d7cf0635c75399d0ff7cfa896fdf2cc
|
diff --git a/mbed_greentea/mbed_report_api.py b/mbed_greentea/mbed_report_api.py
index 166bc29..22a3778 100644
--- a/mbed_greentea/mbed_report_api.py
+++ b/mbed_greentea/mbed_report_api.py
@@ -42,7 +42,7 @@ def exporter_json(test_result_ext, test_suite_properties=None):
for suite in target.values():
try:
suite["single_test_output"] = suite["single_test_output"]\
- .decode("unicode_escape")
+ .decode("utf-8", "replace")
except KeyError:
pass
return json.dumps(test_result_ext, indent=4)
@@ -603,7 +603,7 @@ def get_result_overlay_dropdowns(result_div_id, test_results):
result_output_dropdown = get_dropdown_html(result_output_div_id,
"Test Output",
test_results['single_test_output']
- .decode("unicode-escape")
+ .decode("utf-8", "replace")
.rstrip("\n"),
output_text=True)
|
mbedgt crash with UnicodeDecodeError
Hi
I am sorry, but I still get some crash with the new green tea version ...
mbedgt: exporting to HTML file 'C:/mcu/reports/report__mbed_os5_release_non_regression_F756ZG_mbed-os-5.5.7__2017_09_28_00_06.html'...
mbedgt: unexpected error:
'unicodeescape' codec can't decode bytes in position 6308-6310: truncated \uXXXX escape
Traceback (most recent call last):
File "C:\Python27\Scripts\mbedgt-script.py", line 11, in <module>
load_entry_point('mbed-greentea==1.3.0', 'console_scripts', 'mbedgt')()
File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 416, in main
cli_ret = main_cli(opts, args)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 1067, in main_cli
html_report = exporter_html(test_report)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_report_api.py", line 747, in exporter_html
test_results)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_report_api.py", line 636, in get_result_overlay
overlay_dropdowns = get_result_overlay_dropdowns(result_div_id, test_results)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_report_api.py", line 598, in get_result_overlay_dropdowns
.decode("unicode-escape")
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 6308-6310: truncated \uXXXX escape
@theotherjimmy
|
ARMmbed/greentea
|
diff --git a/test/report_api.py b/test/report_api.py
index 122e26e..2a4275f 100644
--- a/test/report_api.py
+++ b/test/report_api.py
@@ -45,7 +45,7 @@ class ReportEmitting(unittest.TestCase):
u'build_path_abs': u'N/A',
u'copy_method': u'N/A',
u'image_path': u'N/A',
- u'single_test_output': b'N/A',
+ u'single_test_output': b'\x80abc\uXXXX' ,
u'platform_name': u'k64f',
u'test_bin_name': u'N/A',
u'testcase_result': {},
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 1
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
attrs==22.2.0
beautifulsoup4==4.12.3
certifi==2021.5.30
charset-normalizer==2.0.12
colorama==0.3.9
coverage==6.2
execnet==1.9.0
fasteners==0.19
future==1.0.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
intelhex==2.3.0
junit-xml==1.9
lockfile==0.12.2
-e git+https://github.com/ARMmbed/greentea.git@8f7b28f8ec739156d238304fa4f5f2e5156536f5#egg=mbed_greentea
mbed-host-tests==1.8.15
mbed-ls==1.8.15
mbed-os-tools==1.8.15
mock==5.2.0
packaging==21.3
pluggy==1.0.0
prettytable==2.5.0
py==1.11.0
pyparsing==3.1.4
pyserial==3.5
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
requests==2.27.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
zipp==3.6.0
|
name: greentea
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- attrs==22.2.0
- beautifulsoup4==4.12.3
- charset-normalizer==2.0.12
- colorama==0.3.9
- coverage==6.2
- execnet==1.9.0
- fasteners==0.19
- future==1.0.0
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- intelhex==2.3.0
- junit-xml==1.9
- lockfile==0.12.2
- mbed-host-tests==1.8.15
- mbed-ls==1.8.15
- mbed-os-tools==1.8.15
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- prettytable==2.5.0
- py==1.11.0
- pyparsing==3.1.4
- pyserial==3.5
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- requests==2.27.1
- six==1.17.0
- soupsieve==2.3.2.post1
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- wcwidth==0.2.13
- zipp==3.6.0
prefix: /opt/conda/envs/greentea
|
[
"test/report_api.py::ReportEmitting::test_report_zero_testcases"
] |
[] |
[
"test/report_api.py::ReportEmitting::test_report_zero_tests"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__greentea-250
|
b8bcffbb7aaced094f252a4ddfe930e8237fb484
|
2017-10-20 19:13:58
|
68508c5f4d7cf0635c75399d0ff7cfa896fdf2cc
|
diff --git a/mbed_greentea/mbed_target_info.py b/mbed_greentea/mbed_target_info.py
index 356676b..c825bcf 100644
--- a/mbed_greentea/mbed_target_info.py
+++ b/mbed_greentea/mbed_target_info.py
@@ -20,6 +20,17 @@ Author: Przemyslaw Wirkus <[email protected]>
import os
import re
import json
+from os import walk
+try:
+ from contextlib import suppress
+except ImportError:
+ from contextlib import contextmanager
+ @contextmanager
+ def suppress(*excs):
+ try:
+ yield
+ except excs:
+ pass
from mbed_greentea.mbed_common_api import run_cli_process
from mbed_greentea.mbed_greentea_log import gt_logger
@@ -381,82 +392,65 @@ def get_platform_property(platform, property):
:return: property value, None if property not found
"""
- # First load from targets.json if available
- value_from_targets_json = get_platform_property_from_targets(platform, property)
- if value_from_targets_json:
- return value_from_targets_json
-
- # Check if info is available for a specific platform
- if platform in TARGET_INFO_MAPPING:
- if property in TARGET_INFO_MAPPING[platform]['properties']:
- return TARGET_INFO_MAPPING[platform]['properties'][property]
+ default = _get_platform_property_from_default(property)
+ from_targets_json = _get_platform_property_from_targets(
+ platform, property, default)
+ if from_targets_json:
+ return from_targets_json
+ from_info_mapping = _get_platform_property_from_info_mapping(platform, property)
+ if from_info_mapping:
+ return from_info_mapping
+ return default
+
+def _get_platform_property_from_default(property):
+ with suppress(KeyError):
+ return TARGET_INFO_MAPPING['default'][property]
+
+def _get_platform_property_from_info_mapping(platform, property):
+ with suppress(KeyError):
+ return TARGET_INFO_MAPPING[platform]['properties'][property]
+
+def _platform_property_from_targets_json(targets, platform, property, default):
+ """! Get a platforms's property from the target data structure in
+ targets.json. Takes into account target inheritance.
+ @param targets Data structure parsed from targets.json
+ @param platform Name of the platform
+ @param property Name of the property
+ @param default the fallback value if none is found, but the target exists
+ @return property value, None if property not found
- # Check if default data is available
- if 'default' in TARGET_INFO_MAPPING:
- if property in TARGET_INFO_MAPPING['default']:
- return TARGET_INFO_MAPPING['default'][property]
-
- return None
+ """
+ with suppress(KeyError):
+ return targets[platform][property]
+ with suppress(KeyError):
+ for inherited_target in targets[platform]['inherits']:
+ result = _platform_property_from_targets_json(targets, inherited_target, property, None)
+ if result:
+ return result
+ if platform in targets:
+ return default
+
+IGNORED_DIRS = ['.build', 'BUILD', 'tools']
+
+def _find_targets_json(path):
+ for root, dirs, files in walk(path, followlinks=True):
+ for ignored_dir in IGNORED_DIRS:
+ if ignored_dir in dirs:
+ dirs.remove(ignored_dir)
+ if 'targets.json' in files:
+ yield os.path.join(root, 'targets.json')
-def get_platform_property_from_targets(platform, property):
+def _get_platform_property_from_targets(platform, property, default):
"""
Load properties from targets.json file somewhere in the project structure
:param platform:
:return: property value, None if property not found
"""
-
- def get_platform_property_from_targets(targets, platform, property):
- """! Get a platforms's property from the target data structure in
- targets.json. Takes into account target inheritance.
- @param targets Data structure parsed from targets.json
- @param platform Name of the platform
- @param property Name of the property
- @return property value, None if property not found
-
- """
-
- result = None
- if platform in targets:
- if property in targets[platform]:
- result = targets[platform][property]
- elif 'inherits' in targets[platform]:
- result = None
- for inherited_target in targets[platform]['inherits']:
- result = get_platform_property_from_targets(targets, inherited_target, property)
-
- # Stop searching after finding the first value for the property
- if result:
- break
-
- return result
-
- result = None
- targets_json_path = []
- for root, dirs, files in os.walk(os.getcwd(), followlinks=True):
- ignored_dirs = ['.build', 'BUILD', 'tools']
-
- for ignored_dir in ignored_dirs:
- if ignored_dir in dirs:
- dirs.remove(ignored_dir)
-
- if 'targets.json' in files:
- targets_json_path.append(os.path.join(root, 'targets.json'))
-
- if not targets_json_path:
- gt_logger.gt_log_warn("No targets.json files found, using default target properties")
-
- for targets_path in targets_json_path:
- try:
+ for targets_path in _find_targets_json(os.getcwd()):
+ with suppress(IOError, ValueError):
with open(targets_path, 'r') as f:
targets = json.load(f)
-
- # Load property from targets.json
- result = get_platform_property_from_targets(targets, platform, property)
-
- # If a valid property was found, stop looking
+ result = _platform_property_from_targets_json(targets, platform, property, default)
if result:
- break
- except Exception:
- continue
- return result
+ return result
diff --git a/setup.py b/setup.py
index e98e109..0734dfe 100644
--- a/setup.py
+++ b/setup.py
@@ -50,13 +50,15 @@ setup(name='mbed-greentea',
license=LICENSE,
test_suite = 'test',
entry_points={
- "console_scripts": ["mbedgt=mbed_greentea.mbed_greentea_cli:main",],
+ "console_scripts": ["mbedgt=mbed_greentea.mbed_greentea_cli:main",],
},
install_requires=["PrettyTable>=0.7.2",
- "PySerial>=3.0",
- "mbed-host-tests>=1.2.0",
- "mbed-ls>=1.2.15",
- "junit-xml",
- "lockfile",
- "mock",
- "colorama>=0.3,<0.4"])
+ "PySerial>=3.0",
+ "mbed-host-tests>=1.2.0",
+ "mbed-ls>=1.2.15",
+ "junit-xml",
+ "lockfile",
+ "mock",
+ "six",
+ "colorama>=0.3,<0.4"])
+
|
Target property priority incorrect
Currently we have priority as follows:
```
internal yotta blob > targets.json > tool default
```
This is a bug.
Instead the priority should be:
```
targets.json /w default > internal yotta blob > tool delaut
```
This implies a few test cases:
In targets.json | In yotta blob | property used | Currently Works
---------------------- | ------------- | ---------------- | ---------------
Yes, with property | No | `targets.json` | Yes
Yes, without property| No | default | Yes
Yes, with property | Yes | `targets.json` | No
Yes, without property | Yes | default | No
No | No | default | Yes
No | Yes | yotta blob | Yes
@bridadan Is this the issue masked by #248?
|
ARMmbed/greentea
|
diff --git a/test/mbed_gt_target_info.py b/test/mbed_gt_target_info.py
index e3f0a6a..96cd1db 100644
--- a/test/mbed_gt_target_info.py
+++ b/test/mbed_gt_target_info.py
@@ -21,6 +21,8 @@ import shutil
import tempfile
import unittest
+from six import StringIO
+
from mock import patch
from mbed_greentea import mbed_target_info
@@ -338,8 +340,168 @@ mbed-gcc 1.1.0
result = mbed_target_info.add_target_info_mapping("null")
- def test_get_platform_property_from_targets(self):
- result = mbed_target_info.get_platform_property_from_targets({}, {})
+ def test_get_platform_property_from_targets_no_json(self):
+ with patch("mbed_greentea.mbed_target_info._find_targets_json") as _find:
+ _find.return_value = iter([])
+ result = mbed_target_info._get_platform_property_from_targets("not_a_platform", "not_a_property", "default")
+ self.assertIsNone(result)
+
+ def test_get_platform_property_from_targets_no_file(self):
+ with patch("mbed_greentea.mbed_target_info._find_targets_json") as _find,\
+ patch("mbed_greentea.mbed_target_info.open") as _open:
+ _find.return_value = iter(["foo"])
+ _open.side_effect = IOError
+ result = mbed_target_info._get_platform_property_from_targets("not_a_platform", "not_a_property", "default")
+ self.assertIsNone(result)
+
+ def test_get_platform_property_from_targets_invalid_json(self):
+ with patch("mbed_greentea.mbed_target_info._find_targets_json") as _find,\
+ patch("mbed_greentea.mbed_target_info.open") as _open:
+ _find.return_value = iter(["foo"])
+ _open.return_value.__enter__.return_value = StringIO("{")
+ result = mbed_target_info._get_platform_property_from_targets("not_a_platform", "not_a_property", "default")
+ self.assertIsNone(result)
+
+ def test_get_platform_property_from_targets_empty_json(self):
+ with patch("mbed_greentea.mbed_target_info._find_targets_json") as _find,\
+ patch("mbed_greentea.mbed_target_info.open") as _open:
+ _find.return_value = iter(["foo"])
+ _open.return_value.__enter__.return_value = StringIO("{}")
+ result = mbed_target_info._get_platform_property_from_targets("not_a_platform", "not_a_property", "default")
+ self.assertIsNone(result)
+
+ def test_get_platform_property_from_targets_no_value(self):
+ with patch("mbed_greentea.mbed_target_info._find_targets_json") as _find,\
+ patch("mbed_greentea.mbed_target_info.open") as _open:
+ _find.return_value = iter(["foo"])
+ _open.return_value.__enter__.return_value = StringIO("{\"K64F\": {}}")
+ result = mbed_target_info._get_platform_property_from_targets("K64F", "not_a_property", "default")
+ self.assertEqual(result, "default")
+
+ def test_get_platform_property_from_targets_in_json(self):
+ with patch("mbed_greentea.mbed_target_info._find_targets_json") as _find,\
+ patch("mbed_greentea.mbed_target_info.open") as _open:
+ _find.return_value = iter(["foo"])
+ _open.return_value.__enter__.return_value = StringIO("{\"K64F\": {\"copy_method\": \"cp\"}}")
+ result = mbed_target_info._get_platform_property_from_targets("K64F", "copy_method", "default")
+ self.assertEqual("cp", result)
+
+ def test_find_targets_json(self):
+ with patch("mbed_greentea.mbed_target_info.walk") as _walk:
+ _walk.return_value = iter([("", ["foo"], []), ("foo", [], ["targets.json"])])
+ result = list(mbed_target_info._find_targets_json("bogus_path"))
+ self.assertEqual(result, ["foo/targets.json"])
+
+ def test_find_targets_json_ignored(self):
+ with patch("mbed_greentea.mbed_target_info.walk") as _walk:
+ walk_result =[("", [".build"], [])]
+ _walk.return_value = iter(walk_result)
+ result = list(mbed_target_info._find_targets_json("bogus_path"))
+ self.assertEqual(result, [])
+ self.assertEqual(walk_result, [("", [], [])])
+
+ def test_platform_property_from_targets_json_empty(self):
+ result = mbed_target_info._platform_property_from_targets_json(
+ {}, "not_a_target", "not_a_property", "default"
+ )
+ self.assertIsNone(result)
+
+ def test_platform_property_from_targets_json_base_target(self):
+ result = mbed_target_info._platform_property_from_targets_json(
+ {"K64F": {"copy_method": "cp"}}, "K64F", "copy_method", "default"
+ )
+ self.assertEqual(result, "cp")
+
+ def test_platform_property_from_targets_json_inherits(self):
+ result = mbed_target_info._platform_property_from_targets_json(
+ {"K64F": {"inherits": ["Target"]}, "Target": {"copy_method": "cp"}},
+ "K64F", "copy_method", "default"
+ )
+ self.assertEqual(result, "cp")
+
+ def test_platform_property_from_default_missing(self):
+ result = mbed_target_info._get_platform_property_from_default("not_a_property")
+ self.assertIsNone(result)
+
+ def test_platform_property_from_default(self):
+ result = mbed_target_info._get_platform_property_from_default("copy_method")
+ self.assertEqual(result, "default")
+
+ def test_platform_property_from_info_mapping_bad_platform(self):
+ result = mbed_target_info._get_platform_property_from_info_mapping("not_a_platform", "not_a_property")
+ self.assertIsNone(result)
+
+ def test_platform_property_from_info_mapping_missing(self):
+ result = mbed_target_info._get_platform_property_from_info_mapping("K64F", "not_a_property")
+ self.assertIsNone(result)
+
+ def test_platform_property_from_info_mapping(self):
+ result = mbed_target_info._get_platform_property_from_info_mapping("K64F", "copy_method")
+ self.assertEqual(result, "default")
+
+
+ # The following test cases are taken from this table:
+ #
+ # Num | In targets.json | In yotta blob | In Default | property used
+ # --- | --------------- | ------------- | ---------- | --------------
+ # 1 | Yes | No | Yes |`targets.json`
+ # 2 | Yes | Yes | Yes |`targets.json`
+ # 3 | No | Yes | Yes | yotta blob
+ # 4 | No | No | Yes | default
+ # 5 | No | No | No | None
+ # 6 | Yes | No | No |`targets.json`
+ # 7 | Yes | Yes | No |`targets.json`
+ # 8 | No | Yes | No | yotta blob
+ def test_platform_property(self):
+ """Test that platform_property picks the property value preserving
+ the following priority relationship:
+ targets.json > yotta blob > default
+ """
+ with patch("mbed_greentea.mbed_target_info._get_platform_property_from_targets") as _targets,\
+ patch("mbed_greentea.mbed_target_info._get_platform_property_from_info_mapping") as _info_mapping,\
+ patch("mbed_greentea.mbed_target_info._get_platform_property_from_default") as _default:
+ # 1
+ _targets.return_value = "targets"
+ _info_mapping.return_value = None
+ _default.return_value = "default"
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "targets")
+ # 2
+ _info_mapping.return_value = "yotta"
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "targets")
+ # 3
+ _targets.return_value = None
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "yotta")
+ # 4
+ _info_mapping.return_value = None
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "default")
+ # 5
+ _default.return_value = None
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ None)
+ # 6
+ _targets.return_value = "targets"
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "targets")
+ # 7
+ _info_mapping.return_value = "yotta"
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "targets")
+ # 8
+ _targets.return_value = None
+ self.assertEqual(
+ mbed_target_info.get_platform_property("K64F", "copy_method"),
+ "yotta")
def test_parse_yotta_json_for_build_name(self):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 2
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
beautifulsoup4==4.13.3
certifi==2025.1.31
charset-normalizer==3.4.1
colorama==0.3.9
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
fasteners==0.19
future==1.0.0
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
intelhex==2.3.0
junit-xml==1.9
lockfile==0.12.2
-e git+https://github.com/ARMmbed/greentea.git@b8bcffbb7aaced094f252a4ddfe930e8237fb484#egg=mbed_greentea
mbed-host-tests==1.8.15
mbed-ls==1.8.15
mbed-os-tools==1.8.15
mock==5.2.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
prettytable==2.5.0
pyserial==3.5
pytest @ file:///croot/pytest_1738938843180/work
requests==2.32.3
six==1.17.0
soupsieve==2.6
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13
|
name: greentea
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- beautifulsoup4==4.13.3
- certifi==2025.1.31
- charset-normalizer==3.4.1
- colorama==0.3.9
- fasteners==0.19
- future==1.0.0
- idna==3.10
- intelhex==2.3.0
- junit-xml==1.9
- lockfile==0.12.2
- mbed-host-tests==1.8.15
- mbed-ls==1.8.15
- mbed-os-tools==1.8.15
- mock==5.2.0
- prettytable==2.5.0
- pyserial==3.5
- requests==2.32.3
- six==1.17.0
- soupsieve==2.6
- typing-extensions==4.13.0
- urllib3==2.3.0
- wcwidth==0.2.13
prefix: /opt/conda/envs/greentea
|
[
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_find_targets_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_find_targets_json_ignored",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_empty_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_in_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_invalid_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_no_file",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_no_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_no_value",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_default",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_default_missing",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_info_mapping",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_info_mapping_bad_platform",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_info_mapping_missing",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_targets_json_base_target",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_targets_json_empty",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_targets_json_inherits"
] |
[] |
[
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_target_from_current_dir_ok",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_targets_from_yotta_local_module_invalid_path",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_targets_from_yotta_local_module_invalid_target",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_targets_from_yotta_local_module_valid",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_yotta_target_from_local_config_failed_open",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_yotta_target_from_local_config_invalid_path",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_yotta_target_from_local_config_valid_path",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_add_target_info_mapping",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_json_data",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_keywords",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_name",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_target",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_multiple",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_json_for_build_name",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_new_style",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_new_style_text",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_new_style_text_2",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_text",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_with_ssl_errors",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_fail",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_chars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_nl",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_nl_whitechars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_rcnl",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_rcnl_whitechars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_version",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_whitechars"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__greentea-263
|
68508c5f4d7cf0635c75399d0ff7cfa896fdf2cc
|
2018-02-15 17:29:56
|
68508c5f4d7cf0635c75399d0ff7cfa896fdf2cc
|
diff --git a/mbed_greentea/mbed_greentea_cli.py b/mbed_greentea/mbed_greentea_cli.py
index f6a13c4..446b965 100644
--- a/mbed_greentea/mbed_greentea_cli.py
+++ b/mbed_greentea/mbed_greentea_cli.py
@@ -23,6 +23,7 @@ import os
import sys
import random
import optparse
+import fnmatch
from time import time
try:
from Queue import Queue
@@ -119,18 +120,6 @@ def create_filtered_test_list(ctest_test_list, test_by_names, skip_test, test_sp
@return
"""
- def filter_names_by_prefix(test_case_name_list, prefix_name):
- """!
- @param test_case_name_list List of all test cases
- @param prefix_name Prefix of test name we are looking for
- @result Set with names of test names starting with 'prefix_name'
- """
- result = list()
- for test_name in test_case_name_list:
- if test_name.startswith(prefix_name):
- result.append(test_name)
- return sorted(result)
-
filtered_ctest_test_list = ctest_test_list
test_list = None
invalid_test_names = []
@@ -143,17 +132,15 @@ def create_filtered_test_list(ctest_test_list, test_by_names, skip_test, test_sp
gt_logger.gt_log("test case filter (specified with -n option)")
for test_name in set(test_list):
- if test_name.endswith('*'):
- # This 'star-sufix' filter allows users to filter tests with fixed prefixes
- # Example: -n 'TESTS-mbed_drivers* will filter all test cases with name starting with 'TESTS-mbed_drivers'
- for test_name_filtered in filter_names_by_prefix(ctest_test_list.keys(), test_name[:-1]):
- gt_logger.gt_log_tab("test filtered in '%s'"% gt_logger.gt_bright(test_name_filtered))
- filtered_ctest_test_list[test_name_filtered] = ctest_test_list[test_name_filtered]
- elif test_name not in ctest_test_list:
- invalid_test_names.append(test_name)
+ gt_logger.gt_log_tab(test_name)
+ matches = [test for test in ctest_test_list.keys() if fnmatch.fnmatch(test, test_name)]
+ gt_logger.gt_log_tab(str(ctest_test_list))
+ if matches:
+ for match in matches:
+ gt_logger.gt_log_tab("test filtered in '%s'"% gt_logger.gt_bright(match))
+ filtered_ctest_test_list[match] = ctest_test_list[match]
else:
- gt_logger.gt_log_tab("test filtered in '%s'"% gt_logger.gt_bright(test_name))
- filtered_ctest_test_list[test_name] = ctest_test_list[test_name]
+ invalid_test_names.append(test_name)
if skip_test:
test_list = skip_test.split(',')
|
Test names are not correctly globbed
Test names only respect a wildcard that is placed at the end of the string. Ex. "mbed-os-*".
However, it does not respect the wildcard anywhere else. Ex. "*-timer"
The build tools accept these wildcards, so greentea should as well. This is the line responsible: https://github.com/ARMmbed/greentea/blob/32b95b44be653c3db527c02e1c5e1ffdc7d37f6f/mbed_greentea/mbed_greentea_cli.py#L146
Should be switched to `fnmatch`.
(This is mostly a note to myself to fix it)
|
ARMmbed/greentea
|
diff --git a/test/mbed_gt_cli.py b/test/mbed_gt_cli.py
index 0646c20..8f4a1eb 100644
--- a/test/mbed_gt_cli.py
+++ b/test/mbed_gt_cli.py
@@ -21,6 +21,36 @@ import sys
import unittest
from mbed_greentea import mbed_greentea_cli
+from mbed_greentea.tests_spec import TestSpec
+
+test_spec_def = {
+ "builds": {
+ "K64F-ARM": {
+ "platform": "K64F",
+ "toolchain": "ARM",
+ "base_path": "./.build/K64F/ARM",
+ "baud_rate": 115200,
+ "tests": {
+ "mbed-drivers-test-generic_tests":{
+ "binaries":[
+ {
+ "binary_type": "bootable",
+ "path": "./.build/K64F/ARM/mbed-drivers-test-generic_tests.bin"
+ }
+ ]
+ },
+ "mbed-drivers-test-c_strings":{
+ "binaries":[
+ {
+ "binary_type": "bootable",
+ "path": "./.build/K64F/ARM/mbed-drivers-test-c_strings.bin"
+ }
+ ]
+ }
+ }
+ }
+ }
+}
class GreenteaCliFunctionality(unittest.TestCase):
@@ -86,5 +116,36 @@ class GreenteaCliFunctionality(unittest.TestCase):
os.chdir(curr_dir)
shutil.rmtree(test1_dir)
+ def test_create_filtered_test_list(self):
+ test_spec = TestSpec()
+ test_spec.parse(test_spec_def)
+ test_build = test_spec.get_test_builds()[0]
+
+ test_list = mbed_greentea_cli.create_filtered_test_list(test_build.get_tests(),
+ 'mbed-drivers-test-generic_*',
+ None,
+ test_spec=test_spec)
+ self.assertEqual(set(test_list.keys()), set(['mbed-drivers-test-generic_tests']))
+
+ test_list = mbed_greentea_cli.create_filtered_test_list(test_build.get_tests(),
+ '*_strings',
+ None,
+ test_spec=test_spec)
+ self.assertEqual(set(test_list.keys()), set(['mbed-drivers-test-c_strings']))
+
+ test_list = mbed_greentea_cli.create_filtered_test_list(test_build.get_tests(),
+ 'mbed*s',
+ None,
+ test_spec=test_spec)
+ expected = set(['mbed-drivers-test-c_strings', 'mbed-drivers-test-generic_tests'])
+ self.assertEqual(set(test_list.keys()), expected)
+
+ test_list = mbed_greentea_cli.create_filtered_test_list(test_build.get_tests(),
+ '*-drivers-*',
+ None,
+ test_spec=test_spec)
+ expected = set(['mbed-drivers-test-c_strings', 'mbed-drivers-test-generic_tests'])
+ self.assertEqual(set(test_list.keys()), expected)
+
if __name__ == '__main__':
unittest.main()
diff --git a/test/mbed_gt_target_info.py b/test/mbed_gt_target_info.py
index e630e7b..a12ba09 100644
--- a/test/mbed_gt_target_info.py
+++ b/test/mbed_gt_target_info.py
@@ -416,7 +416,7 @@ mbed-gcc 1.1.0
with patch("mbed_greentea.mbed_target_info.walk") as _walk:
_walk.return_value = iter([("", ["foo"], []), ("foo", [], ["targets.json"])])
result = list(mbed_target_info._find_targets_json("bogus_path"))
- self.assertEqual(result, ["foo/targets.json"])
+ self.assertEqual(result, [os.path.join("foo", "targets.json")])
def test_find_targets_json_ignored(self):
with patch("mbed_greentea.mbed_target_info.walk") as _walk:
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
appdirs==1.4.4
beautifulsoup4==4.13.3
certifi==2025.1.31
charset-normalizer==3.4.1
colorama==0.3.9
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
fasteners==0.19
future==1.0.0
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
intelhex==2.3.0
junit-xml==1.9
lockfile==0.12.2
-e git+https://github.com/ARMmbed/greentea.git@68508c5f4d7cf0635c75399d0ff7cfa896fdf2cc#egg=mbed_greentea
mbed-host-tests==1.8.15
mbed-ls==1.8.15
mbed-os-tools==1.8.15
mock==5.2.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
prettytable==2.5.0
pyserial==3.5
pytest @ file:///croot/pytest_1738938843180/work
requests==2.32.3
six==1.17.0
soupsieve==2.6
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13
|
name: greentea
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- appdirs==1.4.4
- beautifulsoup4==4.13.3
- certifi==2025.1.31
- charset-normalizer==3.4.1
- colorama==0.3.9
- fasteners==0.19
- future==1.0.0
- idna==3.10
- intelhex==2.3.0
- junit-xml==1.9
- lockfile==0.12.2
- mbed-host-tests==1.8.15
- mbed-ls==1.8.15
- mbed-os-tools==1.8.15
- mock==5.2.0
- prettytable==2.5.0
- pyserial==3.5
- requests==2.32.3
- six==1.17.0
- soupsieve==2.6
- typing-extensions==4.13.0
- urllib3==2.3.0
- wcwidth==0.2.13
prefix: /opt/conda/envs/greentea
|
[
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_create_filtered_test_list"
] |
[] |
[
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_get_greentea_version",
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_get_hello_string",
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_get_local_host_tests_dir_default_path",
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_get_local_host_tests_dir_invalid_path",
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_get_local_host_tests_dir_valid_path",
"test/mbed_gt_cli.py::GreenteaCliFunctionality::test_print_version",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_find_targets_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_find_targets_json_ignored",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_target_from_current_dir_ok",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_targets_from_yotta_local_module_invalid_path",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_targets_from_yotta_local_module_invalid_target",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_mbed_targets_from_yotta_local_module_valid",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_empty_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_in_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_invalid_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_no_file",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_no_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_platform_property_from_targets_no_value",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_yotta_target_from_local_config_failed_open",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_yotta_target_from_local_config_invalid_path",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_get_yotta_target_from_local_config_valid_path",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_add_target_info_mapping",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_json_data",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_keywords",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_name",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_missing_target",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_multiple",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_no_keywords",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_mbed_target_from_target_json_no_name",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_json_for_build_name",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_new_style",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_new_style_text",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_new_style_text_2",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_text",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_search_cmd_output_with_ssl_errors",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_fail",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_chars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_nl",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_nl_whitechars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_rcnl",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_rcnl_whitechars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_version",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_parse_yotta_target_cmd_output_mixed_whitechars",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_default",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_default_missing",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_info_mapping",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_info_mapping_bad_platform",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_info_mapping_missing",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_targets_json_base_target",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_targets_json_empty",
"test/mbed_gt_target_info.py::GreenteaTargetInfo::test_platform_property_from_targets_json_inherits"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_greentea-263
|
|
ARMmbed__mbed-tools-138
|
94a3bd761d6ab3305c81da93517767aafff58d7e
|
2020-12-01 14:33:04
|
9ad9be8ebe4c5cb07a88a7bd151ca845340a2cfe
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/138?src=pr&el=h1) Report
> Merging [#138](https://codecov.io/gh/ARMmbed/mbed-tools/pull/138?src=pr&el=desc) (1999bcd) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/1fbc64249a3650dd633fdf2631cc256aec6971b5?el=desc) (1fbc642) will **decrease** coverage by `0.07%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/138?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #138 +/- ##
==========================================
- Coverage 96.52% 96.44% -0.08%
==========================================
Files 95 95
Lines 2644 2644
==========================================
- Hits 2552 2550 -2
- Misses 92 94 +2
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/138?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ools/devices/\_internal/detect\_candidate\_devices.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/138/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvZGV2aWNlcy9faW50ZXJuYWwvZGV0ZWN0X2NhbmRpZGF0ZV9kZXZpY2VzLnB5) | `88.23% <0.00%> (-11.77%)` | :arrow_down: |
|
diff --git a/news/20201201142709.bugfix b/news/20201201142709.bugfix
new file mode 100644
index 0000000..0468f3e
--- /dev/null
+++ b/news/20201201142709.bugfix
@@ -0,0 +1,1 @@
+Fix bug where we failed to handle config options that contain quotes (#125)
diff --git a/src/mbed_tools/build/_internal/templates/mbed_config.tmpl b/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
index e4820af..08ccced 100644
--- a/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
+++ b/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
@@ -65,7 +65,7 @@ set(MBED_CONFIG_DEFINITIONS
# options
{% for option in options -%}
{% if option.value is not none -%}
- {%if '{' in option.value|string or '(' in option.value|string %}"{% endif %}-D{{option.macro_name}}={{option.value}}{% if '}' in option.value|string or ')' in option.value|string %}"{% endif %}
+ "-D{{option.macro_name}}={{option.value|replace("\"", "\\\"")}}"
{% endif %}
{%- endfor %}
# macros
|
mbed-tools fails to handle config options that contain quotes
### Description
From @rajkan01:
For the below mbed_lib.json config
```
"iotc-mqtt-host": {
"help": "IOTC MQTT host configuration. Defaults to mqtt.2030.ltsapis.goog host and port number 8883 if undefined",
"value": "{\"mqtt.2030.ltsapis.goog\", IOTC_MQTT_PORT}",
"macro_name": "IOTC_MQTT_HOST"
}
```
Mbedtools is generating `"-DIOTC_MQTT_HOST={"mqtt.2030.ltsapis.goog", IOTC_MQTT_PORT}"` config starts double-quotes from -D itself, and CMake prepossessing time this macro gets divided into multiple #define like below because of this define begin with double-quotes and also the value ("mqtt.2030.ltsapis.goog") with double-quote consider to be a string
```
#define IOTC_MQTT_HOST {
#define mqtt .2030.ltsapis.goog, IOTC_MQTT_PORT} 1
```
Could someone check this, why is the mbedtools generating macros starts with double-quotes which include `-D` and fix.
I've attached `main.ii` and `mbed_config.cmake`
[mbed_config.zip](https://github.com/ARMmbed/mbed-tools/files/5602300/mbed_config.zip)
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [X] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/build/_internal/test_cmake_file.py b/tests/build/_internal/test_cmake_file.py
index 1f59cb3..b0247a8 100644
--- a/tests/build/_internal/test_cmake_file.py
+++ b/tests/build/_internal/test_cmake_file.py
@@ -2,67 +2,69 @@
# Copyright (C) 2020 Arm Mbed. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
-from unittest import TestCase
+import pytest
-from tests.build._internal.config.factories import ConfigFactory
+from tests.build._internal.config.factories import ConfigFactory, SourceFactory
from mbed_tools.build._internal.cmake_file import generate_mbed_config_cmake_file, _render_mbed_config_cmake_template
+from mbed_tools.build._internal.config.config import _create_config_option
-class TestGenerateCMakeListsFile(TestCase):
- def test_correct_arguments_passed(self):
- target = dict()
- target["labels"] = ["foo"]
- target["extra_labels"] = ["morefoo"]
- target["features"] = ["bar"]
- target["components"] = ["baz"]
- target["macros"] = ["macbaz"]
- target["device_has"] = ["stuff"]
- target["c_lib"] = ["c_lib"]
- target["core"] = ["core"]
- target["printf_lib"] = ["printf_lib"]
- target["supported_form_factors"] = ["arduino"]
+TOOLCHAIN_NAME = "gcc"
+
+
[email protected]()
+def fake_target():
+ return {
+ "labels": ["foo"],
+ "extra_labels": ["morefoo"],
+ "features": ["bar"],
+ "components": ["baz"],
+ "macros": ["macbaz"],
+ "device_has": ["stuff"],
+ "c_lib": ["c_lib"],
+ "core": ["core"],
+ "printf_lib": ["printf_lib"],
+ "supported_form_factors": ["arduino"],
+ "supported_c_libs": {TOOLCHAIN_NAME: ["ginormous"]},
+ "supported_application_profiles": ["full", "bare-metal"],
+ }
+
+
+class TestGenerateCMakeListsFile:
+ def test_correct_arguments_passed(self, fake_target):
config = ConfigFactory()
mbed_target = "K64F"
- toolchain_name = "GCC"
- target["supported_c_libs"] = {toolchain_name.lower(): ["small", "std"]}
- target["supported_application_profiles"] = ["full", "bare-metal"]
-
- result = generate_mbed_config_cmake_file(mbed_target, target, config, toolchain_name)
-
- self.assertEqual(
- result, _render_mbed_config_cmake_template(target, config, toolchain_name, mbed_target,),
- )
-
-
-class TestRendersCMakeListsFile(TestCase):
- def test_returns_rendered_content(self):
- target = dict()
- target["labels"] = ["foo"]
- target["extra_labels"] = ["morefoo"]
- target["features"] = ["bar"]
- target["components"] = ["baz"]
- target["macros"] = ["macbaz"]
- target["device_has"] = ["stuff"]
- target["core"] = ["core"]
- target["c_lib"] = ["c_lib"]
- target["printf_lib"] = ["printf_lib"]
- target["supported_form_factors"] = ["arduino"]
+
+ result = generate_mbed_config_cmake_file(mbed_target, fake_target, config, TOOLCHAIN_NAME)
+
+ assert result == _render_mbed_config_cmake_template(fake_target, config, TOOLCHAIN_NAME, mbed_target,)
+
+
+class TestRendersCMakeListsFile:
+ def test_returns_rendered_content(self, fake_target):
config = ConfigFactory()
- toolchain_name = "baz"
- target["supported_c_libs"] = {toolchain_name.lower(): ["small", "std"]}
- target["supported_application_profiles"] = ["full", "bare-metal"]
- result = _render_mbed_config_cmake_template(target, config, toolchain_name, "target_name")
+ result = _render_mbed_config_cmake_template(fake_target, config, TOOLCHAIN_NAME, "target_name")
- for label in target["labels"] + target["extra_labels"]:
- self.assertIn(label, result)
+ for label in fake_target["labels"] + fake_target["extra_labels"]:
+ assert label in result
- for macro in target["features"] + target["components"] + [toolchain_name]:
- self.assertIn(macro, result)
+ for macro in fake_target["features"] + fake_target["components"] + [TOOLCHAIN_NAME]:
+ assert macro in result
- for toolchain in target["supported_c_libs"]:
- self.assertIn(toolchain, result)
+ for toolchain in fake_target["supported_c_libs"]:
+ assert toolchain in result
for supported_c_libs in toolchain:
- self.assertIn(supported_c_libs, result)
+ assert supported_c_libs in result
+
+ for supported_application_profiles in fake_target["supported_application_profiles"]:
+ assert supported_application_profiles in result
+
+ def test_returns_quoted_content(self, fake_target):
+ config = ConfigFactory()
+ source = SourceFactory()
+
+ # Add an option whose value contains quotes to the config.
+ _create_config_option(config, "iotc-mqtt-host", '{"mqtt.2030.ltsapis.goog", IOTC_MQTT_PORT}', source)
- for supported_application_profiles in target["supported_application_profiles"]:
- self.assertIn(supported_application_profiles, result)
+ result = _render_mbed_config_cmake_template(fake_target, config, TOOLCHAIN_NAME, "target_name")
+ assert '"-DMBED_CONF_IOTC_MQTT_HOST={\\"mqtt.2030.ltsapis.goog\\", IOTC_MQTT_PORT}"' in result
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
4.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock"
],
"pre_install": null,
"python": "3.8",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.19.0
black==24.8.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.6.1
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.20.1
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==35.2.2
filelock==3.16.1
flake8==7.1.2
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.1
idna==3.10
importlib_metadata==8.5.0
importlib_resources==6.4.5
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.5.0
license-expression==30.3.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==2.1.5
-e git+https://github.com/ARMmbed/mbed-tools.git@94a3bd761d6ab3305c81da93517767aafff58d7e#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.5.0
mypy==1.14.1
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.0
platformdirs==4.3.6
pluggy==1.5.0
ply==3.11
pre-commit==3.5.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.12.1
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.2.0
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.9.0
PyNaCl==1.5.0
pyparsing==3.1.4
pyserial==3.5
pytest==8.3.5
pytest-cov==5.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==43.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.20.2
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=24.2=py38h06a4308_0
- python=3.8.20=he870216_0
- readline=8.2=h5eee18b_0
- setuptools=75.1.0=py38h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.44.0=py38h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.19.0
- black==24.8.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.6.1
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.20.1
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==35.2.2
- filelock==3.16.1
- flake8==7.1.2
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.1
- idna==3.10
- importlib-metadata==8.5.0
- importlib-resources==6.4.5
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.5.0
- license-expression==30.3.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==2.1.5
- mbed-tools==4.0.1.dev3
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.5.0
- mypy==1.14.1
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.0
- platformdirs==4.3.6
- pluggy==1.5.0
- ply==3.11
- pre-commit==3.5.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.12.1
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.2.0
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.9.0
- pynacl==1.5.0
- pyparsing==3.1.4
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==5.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.0.1
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==43.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.20.2
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/build/_internal/test_cmake_file.py::TestRendersCMakeListsFile::test_returns_quoted_content"
] |
[] |
[
"tests/build/_internal/test_cmake_file.py::TestGenerateCMakeListsFile::test_correct_arguments_passed",
"tests/build/_internal/test_cmake_file.py::TestRendersCMakeListsFile::test_returns_rendered_content"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-138
|
ARMmbed__mbed-tools-154
|
9d6b2c71a7ddc93bd71279482a7572cac30ed745
|
2020-12-10 13:15:11
|
9d6b2c71a7ddc93bd71279482a7572cac30ed745
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/154?src=pr&el=h1) Report
> Merging [#154](https://codecov.io/gh/ARMmbed/mbed-tools/pull/154?src=pr&el=desc) (78ae5c4) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/9ad9be8ebe4c5cb07a88a7bd151ca845340a2cfe?el=desc) (9ad9be8) will **increase** coverage by `0.08%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/154?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #154 +/- ##
==========================================
+ Coverage 96.50% 96.58% +0.08%
==========================================
Files 95 95
Lines 2659 2668 +9
==========================================
+ Hits 2566 2577 +11
+ Misses 93 91 -2
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/154?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/build/build.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/154/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvYnVpbGQucHk=) | `100.00% <100.00%> (ø)` | |
| [...ools/devices/\_internal/detect\_candidate\_devices.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/154/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvZGV2aWNlcy9faW50ZXJuYWwvZGV0ZWN0X2NhbmRpZGF0ZV9kZXZpY2VzLnB5) | `100.00% <0.00%> (+11.76%)` | :arrow_up: |
jeromecoutant: No update/information in README?
rwalton-arm: > No update/information in README?
We already have [instructions for installing CMake and Ninja](https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/tools/mbed_cli_2/install.md) in our user facing documentation. However, we should probably also add them to our README.md, so I've updated it in commit 582c455
jeromecoutant: > We already have [instructions for installing CMake and Ninja](https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/tools/mbed_cli_2/install.md) in our user facing documentation.
So to avoid duplication, you could just add this link in the Installation paragraph ?
|
diff --git a/README.md b/README.md
index fdd2e05..eff3449 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,10 @@ follows:
## Installation
+`mbed-tools` relies on the Ninja build system and CMake.
+- CMake. [Install version 3.19.0 or newer for all operating systems](https://cmake.org/install/).
+- Ninja. [Install version 1.0 or newer for all operating systems](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages).
+
We recommend installing `mbed-tools` in a Python virtual environment to avoid dependency conflicts.
To install the most recent production quality release use:
diff --git a/news/20201210131204.bugfix b/news/20201210131204.bugfix
new file mode 100644
index 0000000..65ae014
--- /dev/null
+++ b/news/20201210131204.bugfix
@@ -0,0 +1,1 @@
+Emit more useful error messages if CMake or Ninja aren't found in PATH.
diff --git a/src/mbed_tools/build/build.py b/src/mbed_tools/build/build.py
index 66822bc..2334bc4 100644
--- a/src/mbed_tools/build/build.py
+++ b/src/mbed_tools/build/build.py
@@ -22,6 +22,7 @@ def build_project(build_dir: pathlib.Path, target: Optional[str] = None) -> None
build_dir: Path to the CMake build tree.
target: The CMake target to build (e.g 'install')
"""
+ _check_ninja_found()
target_flag = ["--target", target] if target is not None else []
_cmake_wrapper("--build", str(build_dir), *target_flag)
@@ -34,6 +35,7 @@ def generate_build_system(source_dir: pathlib.Path, build_dir: pathlib.Path, pro
build_dir: Path to the CMake build tree.
profile: The Mbed build profile (develop, debug or release).
"""
+ _check_ninja_found()
_cmake_wrapper("-S", str(source_dir), "-B", str(build_dir), "-GNinja", f"-DCMAKE_BUILD_TYPE={profile}")
@@ -41,5 +43,16 @@ def _cmake_wrapper(*cmake_args: str) -> None:
try:
logger.debug("Running CMake with args: %s", cmake_args)
subprocess.run(["cmake", *cmake_args], check=True)
+ except FileNotFoundError:
+ raise MbedBuildError("Could not find CMake. Please ensure CMake is installed and added to PATH.")
except subprocess.CalledProcessError:
raise MbedBuildError("CMake invocation failed!")
+
+
+def _check_ninja_found() -> None:
+ try:
+ subprocess.run(["ninja", "--version"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ except FileNotFoundError:
+ raise MbedBuildError(
+ "Could not find the 'Ninja' build program. Please ensure 'Ninja' is installed and added to PATH."
+ )
|
README.md : miss cmake and ninja information
### Description
Hi
This morning, I spent some time on a new PC to install this new mbed tool,
This was not working, and I got several not friendly messages...
... till I remembered that I didn't install cmake yet...
So my request would be:
- to update tools when cmake is not installed with some friendly message "please install cmake"
- same for ninja
- to update README.md to add information how to install cmake and ninja
Thx
@0xc0170
@MarceloSalazar
@JeanMarcR
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [x] Enhancement
- [ ] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/build/test_build.py b/tests/build/test_build.py
index b9d32af..5293966 100644
--- a/tests/build/test_build.py
+++ b/tests/build/test_build.py
@@ -2,45 +2,60 @@
# Copyright (C) 2020 Arm Mbed. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
-import pathlib
+import subprocess
-from tempfile import TemporaryDirectory
-from unittest import TestCase, mock
+from unittest import mock
+
+import pytest
from mbed_tools.build.build import build_project, generate_build_system
from mbed_tools.build.exceptions import MbedBuildError
-class TestBuildProject(TestCase):
- @mock.patch("mbed_tools.build.build._cmake_wrapper")
- def test_invokes_cmake_with_correct_args(self, cmake_wrapper):
[email protected]
+def subprocess_run():
+ with mock.patch("mbed_tools.build.build.subprocess.run", autospec=True) as subproc:
+ yield subproc
+
+
+class TestBuildProject:
+ def test_invokes_cmake_with_correct_args(self, subprocess_run):
build_project(build_dir="cmake_build", target="install")
- cmake_wrapper.assert_called_once_with("--build", "cmake_build", "--target", "install")
+ subprocess_run.assert_called_with(["cmake", "--build", "cmake_build", "--target", "install"], check=True)
- @mock.patch("mbed_tools.build.build._cmake_wrapper")
- def test_invokes_cmake_with_correct_args_if_no_target_passed(self, cmake_wrapper):
+ def test_invokes_cmake_with_correct_args_if_no_target_passed(self, subprocess_run):
build_project(build_dir="cmake_build")
- cmake_wrapper.assert_called_once_with("--build", "cmake_build")
+ subprocess_run.assert_called_with(["cmake", "--build", "cmake_build"], check=True)
- def test_raises_build_error_if_build_dir_doesnt_exist(self):
- with TemporaryDirectory() as tmp_dir:
- nonexistent_build_dir = pathlib.Path(tmp_dir, "cmake_build")
+ def test_raises_build_error_if_cmake_invocation_fails(self, subprocess_run):
+ subprocess_run.side_effect = (None, subprocess.CalledProcessError(1, ""))
- with self.assertRaises(MbedBuildError):
- build_project(nonexistent_build_dir)
+ with pytest.raises(MbedBuildError, match="CMake invocation failed"):
+ build_project(build_dir="cmake_build")
[email protected]("mbed_tools.build.build._cmake_wrapper")
-class TestConfigureProject(TestCase):
- def test_invokes_cmake_with_correct_args(self, cmake_wrapper):
+class TestConfigureProject:
+ def test_invokes_cmake_with_correct_args(self, subprocess_run):
source_dir = "source_dir"
build_dir = "cmake_build"
profile = "debug"
generate_build_system(source_dir, build_dir, profile)
- cmake_wrapper.assert_called_once_with(
- "-S", source_dir, "-B", build_dir, "-GNinja", f"-DCMAKE_BUILD_TYPE={profile}"
+ subprocess_run.assert_called_with(
+ ["cmake", "-S", source_dir, "-B", build_dir, "-GNinja", f"-DCMAKE_BUILD_TYPE={profile}"], check=True
)
+
+ def test_raises_when_ninja_cannot_be_found(self, subprocess_run):
+ subprocess_run.side_effect = FileNotFoundError
+
+ with pytest.raises(MbedBuildError, match="Ninja"):
+ generate_build_system("", "", "")
+
+ def test_raises_when_cmake_cannot_be_found(self, subprocess_run):
+ subprocess_run.side_effect = (None, FileNotFoundError)
+
+ with pytest.raises(MbedBuildError, match="Could not find CMake"):
+ generate_build_system("", "", "")
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
4.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": null,
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@9d6b2c71a7ddc93bd71279482a7572cac30ed745#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==4.1.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/build/test_build.py::TestBuildProject::test_raises_build_error_if_cmake_invocation_fails",
"tests/build/test_build.py::TestConfigureProject::test_raises_when_ninja_cannot_be_found",
"tests/build/test_build.py::TestConfigureProject::test_raises_when_cmake_cannot_be_found"
] |
[] |
[
"tests/build/test_build.py::TestBuildProject::test_invokes_cmake_with_correct_args",
"tests/build/test_build.py::TestBuildProject::test_invokes_cmake_with_correct_args_if_no_target_passed",
"tests/build/test_build.py::TestConfigureProject::test_invokes_cmake_with_correct_args"
] |
[] |
Apache License 2.0
| null |
ARMmbed__mbed-tools-190
|
d4dd48ce58952851f9cb2a9e98b0f788a61a23a3
|
2021-02-15 13:43:30
|
e9710eabb27a4f65e7c0e799224c3f8bcd2b4881
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=h1) Report
> Merging [#190](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=desc) (68c47da) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/73d90030d995a3da7a518d69ec70c9a54fd59579?el=desc) (73d9003) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #190 +/- ##
=======================================
Coverage 96.56% 96.56%
=======================================
Files 94 94
Lines 2619 2621 +2
=======================================
+ Hits 2529 2531 +2
Misses 90 90
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/project/mbed\_program.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9tYmVkX3Byb2dyYW0ucHk=) | `100.00% <100.00%> (ø)` | |
|
diff --git a/news/169.bugfix b/news/169.bugfix
new file mode 100644
index 0000000..78b6135
--- /dev/null
+++ b/news/169.bugfix
@@ -0,0 +1,1 @@
+Support use of user@host:directory syntax with the import subcommand.
diff --git a/src/mbed_tools/project/mbed_program.py b/src/mbed_tools/project/mbed_program.py
index d095e5b..c3a9536 100644
--- a/src/mbed_tools/project/mbed_program.py
+++ b/src/mbed_tools/project/mbed_program.py
@@ -113,6 +113,9 @@ def parse_url(name_or_url: str) -> Dict[str, str]:
url_obj = urlparse(name_or_url)
if url_obj.hostname:
url = url_obj.geturl()
+ elif ":" in name_or_url.split("/", maxsplit=1)[0]:
+ # If non-standard and no slashes before first colon, git will recognize as scp ssh syntax
+ url = name_or_url
else:
url = f"https://github.com/armmbed/{url_obj.path}"
# We need to create a valid directory name from the url path section.
|
mbed-tools import fails to import an example with ssh url
### Description
<!--
A detailed description of what is being reported. Please include steps to reproduce the problem.
Things to consider sharing:
- What version of the package is being used (pip show mbed-tools)?
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
-->
mbed-tools version: **5.0.0**
Command:
`mbed-tools -vv import [email protected]:ARMmbed/mbed-os-example-blinky.git`
Expected:
mbed-os-example-blinky example cloned onto a local machine.
Output:
```
Cloning Mbed program '[email protected]:ARMmbed/mbed-os-example-blinky.git'
Resolving program library dependencies.
ERROR: Cloning git repository from url 'https://github.com/armmbed/[email protected]:ARMmbed/mbed-os-example-blinky.git' failed. Error from VCS: Cmd('git') failed due to: exit code(128)
cmdline: git clone --progress -v https://github.com/armmbed/[email protected]:ARMmbed/mbed-os-example-blinky.git mbed-os-example-blinky.git
More information may be available by using the command line option '-vvv'.
```
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [x] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/project/test_mbed_program.py b/tests/project/test_mbed_program.py
index 7f700f0..be83aa9 100644
--- a/tests/project/test_mbed_program.py
+++ b/tests/project/test_mbed_program.py
@@ -127,6 +127,12 @@ class TestParseURL(TestCase):
self.assertEqual(data["url"], url)
self.assertEqual(data["dst_path"], "mbed-os-example-numskull")
+ def test_creates_valid_dst_dir_from_ssh_url(self):
+ url = "git@superversioncontrol:superorg/mbed-os-example-numskull"
+ data = parse_url(url)
+ self.assertEqual(data["url"], url)
+ self.assertEqual(data["dst_path"], "mbed-os-example-numskull")
+
class TestFindProgramRoot(TestCase):
@patchfs
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
7.1
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"requests-mock",
"factory_boy",
"boto3",
"jinja2",
"PyGithub"
],
"pre_install": [],
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
intelhex==2.3.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@d4dd48ce58952851f9cb2a9e98b0f788a61a23a3#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
prettytable==3.16.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.1
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wcwidth==0.2.13
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- intelhex==2.3.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.1.1.dev6
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- prettytable==3.16.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.1
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wcwidth==0.2.13
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/project/test_mbed_program.py::TestParseURL::test_creates_valid_dst_dir_from_ssh_url"
] |
[] |
[
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_existing_raises_if_no_mbed_os_dir_found_and_check_mbed_os_is_true",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_existing_raises_if_path_is_not_a_program",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_existing_returns_valid_program",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_existing_with_mbed_os_path_returns_valid_program",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_generates_valid_program_creating_directory",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_generates_valid_program_creating_directory_in_cwd",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_generates_valid_program_existing_directory",
"tests/project/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_raises_if_path_is_existing_program",
"tests/project/test_mbed_program.py::TestParseURL::test_creates_url_and_dst_dir_from_name",
"tests/project/test_mbed_program.py::TestParseURL::test_creates_valid_dst_dir_from_url",
"tests/project/test_mbed_program.py::TestFindProgramRoot::test_finds_program_at_current_path",
"tests/project/test_mbed_program.py::TestFindProgramRoot::test_finds_program_higher_in_dir_tree",
"tests/project/test_mbed_program.py::TestFindProgramRoot::test_raises_if_no_program_found"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-190
|
ARMmbed__mbed-tools-203
|
b4ec310be404e690c1947f8050597a87691bf381
|
2021-02-24 16:32:59
|
584a995d93b9562e9c95385268891dfdae9c55f1
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203?src=pr&el=h1) Report
> Merging [#203](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203?src=pr&el=desc) (de0dcbc) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/c4ccaf1baeacf2640b0103dff46db6cb6186ea43?el=desc) (c4ccaf1) will **decrease** coverage by `0.07%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #203 +/- ##
==========================================
- Coverage 96.57% 96.50% -0.08%
==========================================
Files 94 94
Lines 2629 2632 +3
==========================================
+ Hits 2539 2540 +1
- Misses 90 92 +2
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/project/\_internal/git\_utils.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9faW50ZXJuYWwvZ2l0X3V0aWxzLnB5) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/project/\_internal/libraries.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9faW50ZXJuYWwvbGlicmFyaWVzLnB5) | `98.21% <100.00%> (ø)` | |
| [...ools/devices/\_internal/detect\_candidate\_devices.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/203/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvZGV2aWNlcy9faW50ZXJuYWwvZGV0ZWN0X2NhbmRpZGF0ZV9kZXZpY2VzLnB5) | `90.00% <0.00%> (-10.00%)` | :arrow_down: |
Patater: Looks like `--branch` isn't able to work with git hashes, possibly. `git clone --branch=26606218ad9d1ee1c8781aa73774fd7ea3a7658e --depth=1 --progress -v https://github.com/ARMmbed/mbed-os mbed-os-example-ble/BLE_GattClient_CharacteristicUpdates/mbed-os` fails with:
```
Cloning into 'mbed-os-example-ble/BLE_GattClient_CharacteristicUpdates/mbed-os'...
warning: Could not find remote branch 26606218ad9d1ee1c8781aa73774fd7ea3a7658e to clone.
fatal: Remote branch 26606218ad9d1ee1c8781aa73774fd7ea3a7658e not found in upstream origin
```
So, a bit of work to do still
Patater: Unfortunately, many of our lib files use explicit git hashes, instead of tags. We can speed up cloning for everybody by shipping our examples and other software with explicit tags, but the tools will try their best to keep things shallow where possible until use of tags is more widespread.
ladislas: Maybe libs and example are not as heavy as mbed os itself. So it's not really an issue for those.
Patater: > Maybe libs and example are not as heavy as mbed os itself. So it's not really an issue for those.
Correct. The main issue is `mbed-os.lib` contained in many of our exampes. However, with `mbed-os`, even a shallow clone takes up around 650 MB or more. This is less than 2.5 GB, but still substantial.
|
diff --git a/.travis.yml b/.travis.yml
index 1995da5..77b83b0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -197,7 +197,8 @@ matrix:
- mbedtools import mbed-os-example-ble
- cd mbed-os-example-ble
# Checkout the development branch on BLE example
- - git checkout development
+ - git fetch origin development
+ - git checkout FETCH_HEAD
- cd BLE_Advertising
- mbedtools deploy
- mbedtools compile -t GCC_ARM -m K64F
diff --git a/news/20210224162840.feature b/news/20210224162840.feature
new file mode 100644
index 0000000..e877386
--- /dev/null
+++ b/news/20210224162840.feature
@@ -0,0 +1,2 @@
+Speed up obtaining library dependencies by obtaining only the requested library
+revision and no other revision.
diff --git a/src/mbed_tools/project/_internal/git_utils.py b/src/mbed_tools/project/_internal/git_utils.py
index 89e2898..a84d582 100644
--- a/src/mbed_tools/project/_internal/git_utils.py
+++ b/src/mbed_tools/project/_internal/git_utils.py
@@ -7,9 +7,13 @@ from dataclasses import dataclass
from pathlib import Path
import git
+import logging
from mbed_tools.project.exceptions import VersionControlError
from mbed_tools.project._internal.progress import ProgressReporter
+from typing import Optional
+
+logger = logging.getLogger(__name__)
@dataclass
@@ -25,21 +29,31 @@ class GitReference:
ref: str
-def clone(url: str, dst_dir: Path) -> git.Repo:
+def clone(url: str, dst_dir: Path, ref: Optional[str] = None, depth: int = 1) -> git.Repo:
"""Clone a library repository.
Args:
url: URL of the remote to clone.
dst_dir: Destination directory for the cloned repo.
+ ref: An optional git commit hash, branch or tag reference to checkout
+ depth: Truncate history to the specified number of commits. Defaults to
+ 1, to make a shallow clone.
Raises:
VersionControlError: Cloning the repository failed.
"""
+ # Gitpython doesn't propagate the git error message when a repo is already
+ # cloned, so we cannot depend on git to handle the "already cloned" error.
+ # We must handle this ourselves instead.
if dst_dir.exists() and list(dst_dir.glob("*")):
raise VersionControlError(f"{dst_dir} exists and is not an empty directory.")
+ clone_from_kwargs = {"url": url, "to_path": str(dst_dir), "progress": ProgressReporter(name=url), "depth": depth}
+ if ref:
+ clone_from_kwargs["branch"] = ref
+
try:
- return git.Repo.clone_from(url, str(dst_dir), progress=ProgressReporter(name=url))
+ return git.Repo.clone_from(**clone_from_kwargs)
except git.exc.GitCommandError as err:
raise VersionControlError(f"Cloning git repository from url '{url}' failed. Error from VCS: {err}")
@@ -61,6 +75,22 @@ def checkout(repo: git.Repo, ref: str, force: bool = False) -> None:
raise VersionControlError(f"Failed to check out revision '{ref}'. Error from VCS: {err}")
+def fetch(repo: git.Repo, ref: str) -> None:
+ """Fetch from the repo's origin.
+
+ Args:
+ repo: git.Repo object where the checkout will be performed.
+ ref: Git commit hash, branch or tag reference, must be a valid ref defined in the repo.
+
+ Raises:
+ VersionControlError: Fetch failed.
+ """
+ try:
+ repo.git.fetch("origin", ref)
+ except git.exc.GitCommandError as err:
+ raise VersionControlError(f"Failed to fetch. Error from VCS: {err}")
+
+
def init(path: Path) -> git.Repo:
"""Initialise a git repository at the given path.
diff --git a/src/mbed_tools/project/_internal/libraries.py b/src/mbed_tools/project/_internal/libraries.py
index 2fa89ef..8c3f1a9 100644
--- a/src/mbed_tools/project/_internal/libraries.py
+++ b/src/mbed_tools/project/_internal/libraries.py
@@ -10,6 +10,7 @@ from pathlib import Path
from typing import Generator, List
from mbed_tools.project._internal import git_utils
+from mbed_tools.project.exceptions import VersionControlError
logger = logging.getLogger(__name__)
@@ -61,10 +62,7 @@ class LibraryReferences:
for lib in self.iter_unresolved():
git_ref = lib.get_git_reference()
logger.info(f"Resolving library reference {git_ref.repo_url}.")
- repo = git_utils.clone(git_ref.repo_url, lib.source_code_path)
- if git_ref.ref:
- logger.info(f"Checking out revision {git_ref.ref} for library {git_ref.repo_url}.")
- git_utils.checkout(repo, git_ref.ref)
+ _clone_at_ref(git_ref.repo_url, lib.source_code_path, git_ref.ref)
# Check if we find any new references after cloning dependencies.
if list(self.iter_unresolved()):
@@ -77,13 +75,10 @@ class LibraryReferences:
git_ref = lib.get_git_reference()
if not git_ref.ref:
- repo.git.fetch()
git_ref.ref = git_utils.get_default_branch(repo)
- else:
- # Fetch only the requested ref
- repo.git.fetch("origin", git_ref.ref)
- git_utils.checkout(repo, git_ref.ref, force=force)
+ git_utils.fetch(repo, git_ref.ref)
+ git_utils.checkout(repo, "FETCH_HEAD", force=force)
def iter_all(self) -> Generator[MbedLibReference, None, None]:
"""Iterate all library references in the tree.
@@ -118,3 +113,21 @@ class LibraryReferences:
def _in_ignore_path(self, lib_reference_path: Path) -> bool:
"""Check if a library reference is in a path we want to ignore."""
return any(p in lib_reference_path.parts for p in self.ignore_paths)
+
+
+def _clone_at_ref(url: str, path: Path, ref: str) -> None:
+ if ref:
+ logger.info(f"Checking out revision {ref} for library {url}.")
+ try:
+ git_utils.clone(url, path, ref)
+ except VersionControlError:
+ # We weren't able to clone. Try again without the ref.
+ repo = git_utils.clone(url, path)
+ # We couldn't clone the ref and had to fall back to cloning
+ # just the default branch. Fetch the ref before checkout, so
+ # that we have it available locally.
+ logger.warning(f"No tag or branch with name {ref}. Fetching full repository.")
+ git_utils.fetch(repo, ref)
+ git_utils.checkout(repo, "FETCH_HEAD")
+ else:
+ git_utils.clone(url, path)
|
Missing --depth option for deploy/new commands
### Description
Old tools `mbed-cli` has amazing option --depth for more fast and efficient downloading mbed-os sources, but new tools `mbed-tools` don't have this option.
But this option very useful on limited and slow internet connections. And takes up less space on hdd.
### Issue request type
- [x] Enhancement
- [ ] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/project/_internal/test_git_utils.py b/tests/project/_internal/test_git_utils.py
index b280359..c188d47 100644
--- a/tests/project/_internal/test_git_utils.py
+++ b/tests/project/_internal/test_git_utils.py
@@ -30,12 +30,33 @@ class TestClone:
repo = git_utils.clone(url, path)
assert repo is not None
- mock_repo.clone_from.assert_called_once_with(url, str(path), progress=mock_progress())
+ mock_repo.clone_from.assert_called_once_with(url=url, to_path=str(path), progress=mock_progress(), depth=1)
+
+ def test_returns_repo_for_ref(self, mock_progress, mock_repo, tmp_path):
+ url = "https://example.com/org/repo.git"
+ ref = "development"
+ path = Path(tmp_path, "repo")
+ repo = git_utils.clone(url, path, ref)
+
+ assert repo is not None
+ mock_repo.clone_from.assert_called_once_with(
+ url=url, to_path=str(path), progress=mock_progress(), depth=1, branch=ref
+ )
def test_raises_when_fails_due_to_bad_url(self, tmp_path):
with pytest.raises(VersionControlError, match="from url 'bad' failed"):
git_utils.clone("bad", Path(tmp_path, "dst"))
+ def test_raises_when_fails_due_to_bad_url_with_ref(self, mock_progress, mock_repo, tmp_path):
+ url = "https://example.com/org/repo.git"
+ ref = "development"
+ path = Path(tmp_path, "repo")
+
+ mock_repo.clone_from.side_effect = git_utils.git.exc.GitCommandError("git clone", 255)
+
+ with pytest.raises(VersionControlError, match=f"Cloning git repository from url '{url}' failed."):
+ git_utils.clone(url, path, ref)
+
def test_raises_when_fails_due_to_existing_nonempty_dst_dir(self, mock_repo, tmp_path):
dst_dir = Path(tmp_path, "dst")
dst_dir.mkdir()
@@ -52,7 +73,7 @@ class TestClone:
repo = git_utils.clone(url, dst_dir)
assert repo is not None
- mock_repo.clone_from.assert_called_once_with(url, str(dst_dir), progress=mock_progress())
+ mock_repo.clone_from.assert_called_once_with(url=url, to_path=str(dst_dir), progress=mock_progress(), depth=1)
class TestInit:
@@ -100,6 +121,21 @@ class TestCheckout:
git_utils.checkout(mock_repo, "bad")
+class TestFetch:
+ def test_does_a_fetch(self, mock_repo):
+ ref = "b23a8eb1c3f80292c8eb40689106759fae83a4c6"
+ git_utils.fetch(mock_repo, ref)
+
+ mock_repo.git.fetch.assert_called_once_with("origin", ref)
+
+ def test_raises_when_fetch_fails(self, mock_repo):
+ ref = "v2.7.9"
+ mock_repo.git.fetch.side_effect = git_utils.git.exc.GitCommandError("git fetch", 255)
+
+ with pytest.raises(VersionControlError):
+ git_utils.fetch(mock_repo, ref)
+
+
class TestGetDefaultBranch:
def test_returns_default_branch_name(self, mock_repo):
mock_repo().git.symbolic_ref.return_value = "refs/remotes/origin/main"
diff --git a/tests/project/_internal/test_libraries.py b/tests/project/_internal/test_libraries.py
index e6b154d..fbff350 100644
--- a/tests/project/_internal/test_libraries.py
+++ b/tests/project/_internal/test_libraries.py
@@ -9,6 +9,7 @@ import pytest
from unittest import mock
from mbed_tools.project._internal.libraries import MbedLibReference, LibraryReferences
+from mbed_tools.project.exceptions import VersionControlError
from tests.project.factories import make_mbed_lib_reference
@@ -24,6 +25,12 @@ def mock_checkout():
yield checkout
[email protected]
+def mock_fetch():
+ with mock.patch("mbed_tools.project._internal.git_utils.fetch") as fetch:
+ yield fetch
+
+
@pytest.fixture
def mock_get_repo():
with mock.patch("mbed_tools.project._internal.git_utils.get_repo") as get_repo:
@@ -46,7 +53,7 @@ class TestLibraryReferences:
def test_hydrates_top_level_library_references(self, mock_clone, tmp_path):
fs_root = pathlib.Path(tmp_path, "foo")
lib = make_mbed_lib_reference(fs_root, ref_url="https://git")
- mock_clone.side_effect = lambda url, dst_dir: dst_dir.mkdir()
+ mock_clone.side_effect = lambda url, dst_dir, *args: dst_dir.mkdir()
lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.fetch()
@@ -64,7 +71,7 @@ class TestLibraryReferences:
)
# Here we mock the effects of a recursive reference lookup. We create a new lib reference as a side effect of
# the first call to the mock. Then we create the src dir, thus resolving the lib, on the second call.
- mock_clone.side_effect = lambda url, dst_dir: (
+ mock_clone.side_effect = lambda url, dst_dir, *args: (
make_mbed_lib_reference(pathlib.Path(dst_dir), name=lib2.reference_file.name, ref_url="https://valid2"),
lib2.source_code_path.mkdir(),
)
@@ -76,7 +83,7 @@ class TestLibraryReferences:
assert lib2.is_resolved()
def test_does_perform_checkout_of_default_repo_branch_if_no_git_ref_exists(
- self, mock_get_repo, mock_checkout, mock_get_default_branch, mock_clone, tmp_path
+ self, mock_get_repo, mock_checkout, mock_fetch, mock_get_default_branch, mock_clone, tmp_path
):
fs_root = pathlib.Path(tmp_path, "foo")
make_mbed_lib_reference(fs_root, ref_url="https://git", resolved=True)
@@ -84,38 +91,95 @@ class TestLibraryReferences:
lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.checkout(force=False)
- mock_checkout.assert_called_once_with(mock_get_repo(), mock_get_default_branch(), force=False)
+ mock_fetch.assert_called_once_with(mock_get_repo(), mock_get_default_branch())
+ mock_checkout.assert_called_once_with(mock_get_repo(), "FETCH_HEAD", force=False)
- def test_performs_checkout_if_git_ref_exists(self, mock_get_repo, mock_checkout, mock_clone, tmp_path):
+ def test_performs_checkout_if_git_ref_exists(self, mock_get_repo, mock_checkout, mock_fetch, mock_clone, tmp_path):
fs_root = pathlib.Path(tmp_path, "foo")
lib = make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234", resolved=True)
lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.checkout(force=False)
- mock_checkout.assert_called_once_with(mock_get_repo.return_value, lib.get_git_reference().ref, force=False)
+ mock_fetch.assert_called_once_with(mock_get_repo(), lib.get_git_reference().ref)
+ mock_checkout.assert_called_once_with(mock_get_repo.return_value, "FETCH_HEAD", force=False)
def test_fetch_does_not_perform_checkout_if_no_git_ref_exists(
- self, mock_get_repo, mock_checkout, mock_clone, tmp_path
+ self, mock_get_repo, mock_checkout, mock_fetch, mock_clone, tmp_path
):
fs_root = pathlib.Path(tmp_path, "foo")
make_mbed_lib_reference(fs_root, ref_url="https://git")
- mock_clone.side_effect = lambda url, dst_dir: dst_dir.mkdir()
+ mock_clone.side_effect = lambda url, dst_dir, *args: dst_dir.mkdir()
lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.fetch()
+ mock_fetch.assert_not_called()
mock_checkout.assert_not_called()
- def test_fetch_performs_checkout_if_git_ref_exists(self, mock_get_repo, mock_checkout, mock_clone, tmp_path):
+ def test_fetch_performs_checkout_if_ref_is_hash(
+ self, mock_get_repo, mock_clone, mock_fetch, mock_checkout, tmp_path
+ ):
+ num_times_called = 0
+
+ def clone_side_effect(url, dst_dir, *args):
+ nonlocal num_times_called
+ if num_times_called == 0:
+ num_times_called += 1
+ raise VersionControlError("Failed to clone")
+ elif num_times_called == 1:
+ num_times_called += 1
+ dst_dir.mkdir()
+ else:
+ assert False
+
fs_root = pathlib.Path(tmp_path, "foo")
- lib = make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234")
- mock_clone.side_effect = lambda url, dst_dir: dst_dir.mkdir()
+ lib = make_mbed_lib_reference(fs_root, ref_url="https://git#398bc1a63370")
+ mock_clone.side_effect = clone_side_effect
lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.fetch()
- mock_checkout.assert_called_once_with(None, lib.get_git_reference().ref)
+ mock_clone.assert_called_with(lib.get_git_reference().repo_url, lib.source_code_path)
+ mock_fetch.assert_called_once_with(None, lib.get_git_reference().ref)
+ mock_checkout.assert_called_once_with(None, "FETCH_HEAD")
+
+ def test_raises_when_no_such_ref(self, mock_repo, mock_clone, mock_fetch, mock_checkout, tmp_path):
+ num_times_called = 0
+
+ def clone_side_effect(url, dst_dir, *args):
+ nonlocal num_times_called
+ if num_times_called == 0:
+ num_times_called += 1
+ raise VersionControlError("Failed to clone")
+ elif num_times_called == 1:
+ num_times_called += 1
+ dst_dir.mkdir()
+ else:
+ assert False
+
+ fs_root = pathlib.Path(tmp_path, "foo")
+ make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234")
+
+ mock_clone.side_effect = clone_side_effect
+ mock_fetch.side_effect = None
+ mock_checkout.side_effect = VersionControlError("Failed to checkout")
+
+ with pytest.raises(VersionControlError, match="Failed to checkout"):
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
+ lib_refs.fetch()
+
+ def test_doesnt_fetch_for_branch_or_tag(self, mock_clone, mock_fetch, mock_checkout, tmp_path):
+ fs_root = pathlib.Path(tmp_path, "foo")
+ make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234")
+
+ mock_clone.side_effect = lambda url, dst_dir, *args: dst_dir.mkdir()
+
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
+ lib_refs.fetch()
+
+ mock_fetch.assert_not_called()
+ mock_checkout.assert_not_called()
def test_does_not_resolve_references_in_ignore_paths(self, mock_get_repo, mock_checkout, mock_clone, tmp_path):
fs_root = pathlib.Path(tmp_path, "mbed-os")
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 3
}
|
7.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc cmake ninja-build"
],
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
intelhex==2.3.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.2.0
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@b4ec310be404e690c1947f8050597a87691bf381#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
prettytable==3.16.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wcwidth==0.2.13
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- intelhex==2.3.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.2.0
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.2.1
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- prettytable==3.16.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wcwidth==0.2.13
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/project/_internal/test_git_utils.py::TestClone::test_returns_repo",
"tests/project/_internal/test_git_utils.py::TestClone::test_returns_repo_for_ref",
"tests/project/_internal/test_git_utils.py::TestClone::test_raises_when_fails_due_to_bad_url_with_ref",
"tests/project/_internal/test_git_utils.py::TestClone::test_can_clone_to_empty_existing_dst_dir",
"tests/project/_internal/test_git_utils.py::TestFetch::test_does_a_fetch",
"tests/project/_internal/test_git_utils.py::TestFetch::test_raises_when_fetch_fails",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_does_perform_checkout_of_default_repo_branch_if_no_git_ref_exists",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_performs_checkout_if_git_ref_exists",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_fetch_does_not_perform_checkout_if_no_git_ref_exists",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_fetch_performs_checkout_if_ref_is_hash",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_raises_when_no_such_ref",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_doesnt_fetch_for_branch_or_tag"
] |
[] |
[
"tests/project/_internal/test_git_utils.py::TestClone::test_raises_when_fails_due_to_bad_url",
"tests/project/_internal/test_git_utils.py::TestClone::test_raises_when_fails_due_to_existing_nonempty_dst_dir",
"tests/project/_internal/test_git_utils.py::TestInit::test_returns_initialised_repo",
"tests/project/_internal/test_git_utils.py::TestInit::test_raises_when_init_fails",
"tests/project/_internal/test_git_utils.py::TestGetRepo::test_returns_repo_object",
"tests/project/_internal/test_git_utils.py::TestGetRepo::test_raises_version_control_error_when_no_git_repo_found",
"tests/project/_internal/test_git_utils.py::TestCheckout::test_git_lib_called_with_correct_command",
"tests/project/_internal/test_git_utils.py::TestCheckout::test_git_lib_called_with_correct_command_with_force",
"tests/project/_internal/test_git_utils.py::TestCheckout::test_raises_version_control_error_when_git_checkout_fails",
"tests/project/_internal/test_git_utils.py::TestGetDefaultBranch::test_returns_default_branch_name",
"tests/project/_internal/test_git_utils.py::TestGetDefaultBranch::test_raises_version_control_error_when_git_command_fails",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_hydrates_top_level_library_references",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_hydrates_recursive_dependencies",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_does_not_resolve_references_in_ignore_paths",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_fetches_only_requested_ref"
] |
[] |
Apache License 2.0
| null |
ARMmbed__mbed-tools-207
|
e9710eabb27a4f65e7c0e799224c3f8bcd2b4881
|
2021-03-02 10:56:32
|
e9710eabb27a4f65e7c0e799224c3f8bcd2b4881
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207?src=pr&el=h1) Report
> Merging [#207](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207?src=pr&el=desc) (ce44d6c) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/e9710eabb27a4f65e7c0e799224c3f8bcd2b4881?el=desc) (e9710ea) will **increase** coverage by `0.07%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #207 +/- ##
==========================================
+ Coverage 96.63% 96.71% +0.07%
==========================================
Files 94 94
Lines 2674 2675 +1
==========================================
+ Hits 2584 2587 +3
+ Misses 90 88 -2
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ls/build/\_internal/config/assemble\_build\_config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9hc3NlbWJsZV9idWlsZF9jb25maWcucHk=) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/build/config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvY29uZmlnLnB5) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/project/\_internal/project\_data.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/207/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9faW50ZXJuYWwvcHJvamVjdF9kYXRhLnB5) | `100.00% <0.00%> (+2.81%)` | :arrow_up: |
|
diff --git a/news/20210302104001.bugfix b/news/20210302104001.bugfix
new file mode 100644
index 0000000..398a80b
--- /dev/null
+++ b/news/20210302104001.bugfix
@@ -0,0 +1,1 @@
+Search mbed-os for config files when mbed-os-path is used and mbed-os is not a subdirectory of the project.
diff --git a/src/mbed_tools/build/_internal/config/assemble_build_config.py b/src/mbed_tools/build/_internal/config/assemble_build_config.py
index 805a6d0..676bc4a 100644
--- a/src/mbed_tools/build/_internal/config/assemble_build_config.py
+++ b/src/mbed_tools/build/_internal/config/assemble_build_config.py
@@ -3,6 +3,8 @@
# SPDX-License-Identifier: Apache-2.0
#
"""Configuration assembly algorithm."""
+import itertools
+
from dataclasses import dataclass
from pathlib import Path
from typing import Iterable, List, Optional, Set
@@ -12,7 +14,7 @@ from mbed_tools.build._internal.config import source
from mbed_tools.build._internal.find_files import LabelFilter, RequiresFilter, filter_files, find_files
-def assemble_config(target_attributes: dict, mbed_program_directory: Path, mbed_app_file: Optional[Path]) -> Config:
+def assemble_config(target_attributes: dict, search_paths: Iterable[Path], mbed_app_file: Optional[Path]) -> Config:
"""Assemble config for given target and program directory.
Mbed library and application specific config parameters are parsed from mbed_lib.json and mbed_app.json files
@@ -24,8 +26,15 @@ def assemble_config(target_attributes: dict, mbed_program_directory: Path, mbed_
Unfortunately, mbed_app.json may also contain filter labels to tell us which mbed libs we're depending on.
This means we have to collect the filter labels from mbed_app.json before parsing any other config files.
Then we parse all the required mbed_lib config and finally apply the app overrides.
+
+ Args:
+ target_attributes: Mapping of target specific config parameters.
+ search_paths: Iterable of paths to search for mbed_lib.json files.
+ mbed_app_file: The path to mbed_app.json. This can be None.
"""
- mbed_lib_files = find_files("mbed_lib.json", mbed_program_directory)
+ mbed_lib_files = list(
+ set(itertools.chain.from_iterable(find_files("mbed_lib.json", path) for path in search_paths))
+ )
return _assemble_config_from_sources(target_attributes, mbed_lib_files, mbed_app_file)
diff --git a/src/mbed_tools/build/config.py b/src/mbed_tools/build/config.py
index 90a1a77..620e1fe 100644
--- a/src/mbed_tools/build/config.py
+++ b/src/mbed_tools/build/config.py
@@ -31,7 +31,9 @@ def generate_config(target_name: str, toolchain: str, program: MbedProgram) -> p
"""
targets_data = _load_raw_targets_data(program)
target_build_attributes = get_target_by_name(target_name, targets_data)
- config = assemble_config(target_build_attributes, program.root, program.files.app_config_file)
+ config = assemble_config(
+ target_build_attributes, [program.root, program.mbed_os.root], program.files.app_config_file
+ )
cmake_file_contents = render_mbed_config_cmake_template(
target_name=target_name, config=config, toolchain_name=toolchain,
)
|
Mbed OS path not searched when processing config
### Description
When we added the `--mbed-os-path` option to `configure` and `compile` we didn't add it to the list of search paths for the config processing tool. Currently, the tool always searches for config files from the project root down, and `mbed-os-path` could be outside of the project root.
This causes issues with Greentea tests, as the Greentea test "project root" is a subdirectory of `mbed-os`, so the tool fails to find any `mbed_lib.json` files as it's only searching from the "project root" down.
We should pass this `mbed-os-path` argument to the config processing tool so it can search mbed-os for config files even when mbed-os is outside of the "project root".
<!--
A detailed description of what is being reported. Please include steps to reproduce the problem.
Things to consider sharing:
- What version of the package is being used (pip show mbed-tools)?
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
-->
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [x] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/build/test_generate_config.py b/tests/build/test_generate_config.py
index 362b020..b2e7008 100644
--- a/tests/build/test_generate_config.py
+++ b/tests/build/test_generate_config.py
@@ -71,6 +71,19 @@ def program(tmp_path):
return prog
[email protected]
+def program_in_mbed_os_subdir(tmp_path):
+ mbed_os_path = tmp_path / "mbed-os"
+ targets_json = mbed_os_path / "targets" / "targets.json"
+ program_root = mbed_os_path / "test-prog"
+ build_subdir = program_root / "__build" / "k64f"
+ program_root.mkdir(parents=True, exist_ok=True)
+ # Create program mbed-os directory and fake targets.json
+ targets_json.parent.mkdir(exist_ok=True, parents=True)
+ targets_json.write_text(json.dumps({target: TARGET_DATA for target in TARGETS}))
+ return MbedProgram.from_existing(program_root, build_subdir, mbed_os_path=mbed_os_path)
+
+
@pytest.fixture(
params=[(TARGETS[0], TARGETS[0]), (TARGETS[1], TARGETS[1]), (TARGETS[0], "*")],
ids=lambda fixture_val: f"target: {fixture_val[0]}, filter: {fixture_val[1]}",
@@ -456,3 +469,23 @@ def test_target_requires_config_option(program):
assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=9600" in config_text
assert "MBED_LFS_READ_SIZE=64" not in config_text
+
+
+def test_config_parsed_when_mbed_os_outside_project_root(program_in_mbed_os_subdir, matching_target_and_filter):
+ program = program_in_mbed_os_subdir
+ target, target_filter = matching_target_and_filter
+ create_mbed_lib_json(
+ program.mbed_os.root / "mbed_lib.json", "platform", config={"stdio-baud-rate": {"value": 9600}},
+ )
+ create_mbed_lib_json(
+ program.mbed_os.root / "storage" / "mbed_lib.json",
+ "filesystem",
+ config={"read_size": {"macro_name": "MBED_LFS_READ_SIZE", "value": 64}},
+ )
+
+ generate_config("K64F", "GCC_ARM", program)
+
+ config_text = (program.files.cmake_build_dir / CMAKE_CONFIG_FILE).read_text()
+
+ assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=9600" in config_text
+ assert "MBED_LFS_READ_SIZE=64" in config_text
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
7.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y cmake ninja-build"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
intelhex==2.3.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@e9710eabb27a4f65e7c0e799224c3f8bcd2b4881#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
prettytable==3.16.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wcwidth==0.2.13
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- intelhex==2.3.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.1.3.dev6
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- prettytable==3.16.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wcwidth==0.2.13
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/build/test_generate_config.py::test_config_parsed_when_mbed_os_outside_project_root[target:"
] |
[] |
[
"tests/build/test_generate_config.py::test_target_and_toolchain_collected",
"tests/build/test_generate_config.py::test_custom_targets_data_found",
"tests/build/test_generate_config.py::test_raises_error_when_attempting_to_customize_existing_target",
"tests/build/test_generate_config.py::test_config_param_from_lib_processed_with_default_name_mangling",
"tests/build/test_generate_config.py::test_config_param_from_lib_processed_with_user_set_name",
"tests/build/test_generate_config.py::test_config_param_from_app_processed_with_default_name_mangling",
"tests/build/test_generate_config.py::test_config_param_from_target_processed_with_default_name_mangling",
"tests/build/test_generate_config.py::test_macros_from_lib_collected[single]",
"tests/build/test_generate_config.py::test_macros_from_lib_collected[multiple]",
"tests/build/test_generate_config.py::test_macros_from_app_collected[single]",
"tests/build/test_generate_config.py::test_macros_from_app_collected[multiple]",
"tests/build/test_generate_config.py::test_macros_from_target_collected",
"tests/build/test_generate_config.py::test_target_labels_collected_as_defines",
"tests/build/test_generate_config.py::test_overrides_lib_config_param_from_app[target:",
"tests/build/test_generate_config.py::test_overrides_target_config_param_from_app[target:",
"tests/build/test_generate_config.py::test_overrides_target_non_config_params_from_app[target:",
"tests/build/test_generate_config.py::test_overrides_target_config_param_from_lib[target:",
"tests/build/test_generate_config.py::test_overrides_lib_config_param_from_same_lib[target:",
"tests/build/test_generate_config.py::test_raises_when_attempting_to_override_lib_config_param_from_other_lib[target:",
"tests/build/test_generate_config.py::test_target_list_params_can_be_added_to[target:",
"tests/build/test_generate_config.py::test_target_list_params_can_be_removed[target:",
"tests/build/test_generate_config.py::test_warns_when_attempting_to_override_nonexistent_param[target:",
"tests/build/test_generate_config.py::test_settings_from_multiple_libs_included[target:",
"tests/build/test_generate_config.py::test_requires_config_option",
"tests/build/test_generate_config.py::test_target_requires_config_option"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-207
|
ARMmbed__mbed-tools-208
|
584a995d93b9562e9c95385268891dfdae9c55f1
|
2021-03-02 16:43:27
|
584a995d93b9562e9c95385268891dfdae9c55f1
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208?src=pr&el=h1) Report
> Merging [#208](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208?src=pr&el=desc) (2dec7c0) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/e9710eabb27a4f65e7c0e799224c3f8bcd2b4881?el=desc) (e9710ea) will **increase** coverage by `0.11%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #208 +/- ##
==========================================
+ Coverage 96.63% 96.75% +0.11%
==========================================
Files 94 94
Lines 2674 2711 +37
==========================================
+ Hits 2584 2623 +39
+ Misses 90 88 -2
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/targets/\_internal/board\_database.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvdGFyZ2V0cy9faW50ZXJuYWwvYm9hcmRfZGF0YWJhc2UucHk=) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/targets/get\_board.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvdGFyZ2V0cy9nZXRfYm9hcmQucHk=) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/build/config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvY29uZmlnLnB5) | `100.00% <0.00%> (ø)` | |
| [...ls/build/\_internal/config/assemble\_build\_config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9hc3NlbWJsZV9idWlsZF9jb25maWcucHk=) | `100.00% <0.00%> (ø)` | |
| [src/mbed\_tools/project/\_internal/project\_data.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/208/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9faW50ZXJuYWwvcHJvamVjdF9kYXRhLnB5) | `100.00% <0.00%> (+2.81%)` | :arrow_up: |
|
diff --git a/news/201.bugfix b/news/201.bugfix
new file mode 100644
index 0000000..0ef9e8e
--- /dev/null
+++ b/news/201.bugfix
@@ -0,0 +1,1 @@
+Define a board as unknown if it cannot be identified locally when unable to access the online database.
diff --git a/src/mbed_tools/targets/_internal/board_database.py b/src/mbed_tools/targets/_internal/board_database.py
index 6745f65..3619cba 100644
--- a/src/mbed_tools/targets/_internal/board_database.py
+++ b/src/mbed_tools/targets/_internal/board_database.py
@@ -106,5 +106,5 @@ def _get_request() -> requests.Response:
try:
return requests.get(_BOARD_API, headers=header)
except requests.exceptions.ConnectionError as connection_error:
- logger.warning("There was an error connecting to the online database. Please check your internet connection.")
+ logger.warning("Unable to connect to the online database. Please check your internet connection.")
raise BoardAPIError("Failed to connect to the online database.") from connection_error
diff --git a/src/mbed_tools/targets/get_board.py b/src/mbed_tools/targets/get_board.py
index 5bd99b5..1760fe9 100644
--- a/src/mbed_tools/targets/get_board.py
+++ b/src/mbed_tools/targets/get_board.py
@@ -11,7 +11,7 @@ from enum import Enum
from typing import Callable
from mbed_tools.targets.env import env
-from mbed_tools.targets.exceptions import UnknownBoard, UnsupportedMode
+from mbed_tools.targets.exceptions import UnknownBoard, UnsupportedMode, BoardDatabaseError
from mbed_tools.targets.board import Board
from mbed_tools.targets.boards import Boards
@@ -70,7 +70,11 @@ def get_board(matching: Callable) -> Board:
return Boards.from_offline_database().get_board(matching)
except UnknownBoard:
logger.info("Unable to identify a board using the offline database, trying the online database.")
- return Boards.from_online_database().get_board(matching)
+ try:
+ return Boards.from_online_database().get_board(matching)
+ except BoardDatabaseError:
+ logger.error("Unable to access the online database to identify a board.")
+ raise UnknownBoard()
class _DatabaseMode(Enum):
|
Obtuse error message when board is not found locally or remotely
### Description
When a board is being looked for, and it isn't found in the offline database, and no network connectivity is available (say, perhaps [when a proxy is required to access the net](https://github.com/ARMmbed/mbed-tools/issues/200), the error message we receive is as follows:
```
$ mbedtools detect -a
ERROR: A problem occurred when looking up board data for connected devices.
More information may be available by using the command line option '-v'.
```
Using verbose output isn't too much better.
```
$ mbedtools -vvv detect -a
DEBUG: Failed getting an attribute value: <unknown>.AdditionalAvailability
DEBUG: Failed getting an attribute value: <unknown>.IdentifyingDescriptions
DEBUG: Failed getting an attribute value: <unknown>.MaxQuiesceTime
DEBUG: Failed getting an attribute value: <unknown>.OtherIdentifyingInfo
DEBUG: Failed getting an attribute value: <unknown>.PowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.TotalPowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.AdditionalAvailability
DEBUG: Failed getting an attribute value: <unknown>.IdentifyingDescriptions
DEBUG: Failed getting an attribute value: <unknown>.MaxQuiesceTime
DEBUG: Failed getting an attribute value: <unknown>.OtherIdentifyingInfo
DEBUG: Failed getting an attribute value: <unknown>.PowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.TotalPowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.AdditionalAvailability
DEBUG: Failed getting an attribute value: <unknown>.IdentifyingDescriptions
DEBUG: Failed getting an attribute value: <unknown>.MaxQuiesceTime
DEBUG: Failed getting an attribute value: <unknown>.OtherIdentifyingInfo
DEBUG: Failed getting an attribute value: <unknown>.PowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.TotalPowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.AdditionalAvailability
DEBUG: Failed getting an attribute value: <unknown>.IdentifyingDescriptions
DEBUG: Failed getting an attribute value: <unknown>.MaxQuiesceTime
DEBUG: Failed getting an attribute value: <unknown>.OtherIdentifyingInfo
DEBUG: Failed getting an attribute value: <unknown>.PowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.TotalPowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.AdditionalAvailability
DEBUG: Failed getting an attribute value: <unknown>.IdentifyingDescriptions
DEBUG: Failed getting an attribute value: <unknown>.MaxQuiesceTime
DEBUG: Failed getting an attribute value: <unknown>.OtherIdentifyingInfo
DEBUG: Failed getting an attribute value: <unknown>.PowerOnHours
DEBUG: Failed getting an attribute value: <unknown>.TotalPowerOnHours
DEBUG: Cannot retrieve the real name of volume Y:\. Reason: (87, 'GetVolumeNameForVolumeMountPoint', 'The parameter is incorrect.')
DEBUG: Attribute [DiskIndex] is undefined on this instance DiskPartition({}): 'DiskPartition' object has no attribute 'DiskIndex'
DEBUG: Attribute [PNPDeviceID] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'PNPDeviceID'
DEBUG: Attribute [SerialNumber] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'SerialNumber'
DEBUG: Attribute [DeviceID] is undefined on this instance DiskPartition({}): 'DiskPartition' object has no attribute 'DeviceID'
DEBUG: Attribute [Type] is undefined on this instance DiskPartition({}): 'DiskPartition' object has no attribute 'Type'
DEBUG: Attribute [Caption] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Caption'
DEBUG: Attribute [DeviceID] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'DeviceID'
DEBUG: Attribute [Model] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Model'
DEBUG: Attribute [InterfaceType] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'InterfaceType'
DEBUG: Attribute [MediaType] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'MediaType'
DEBUG: Attribute [Manufacturer] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Manufacturer'
DEBUG: Attribute [SerialNumber] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'SerialNumber'
DEBUG: Attribute [Status] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Status'
DEBUG: Attribute [PNPDeviceID] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'PNPDeviceID'
DEBUG: Cannot retrieve the real name of volume Y:\. Reason: (87, 'GetVolumeNameForVolumeMountPoint', 'The parameter is incorrect.')
DEBUG: Attribute [DiskIndex] is undefined on this instance DiskPartition({}): 'DiskPartition' object has no attribute 'DiskIndex'
DEBUG: Attribute [PNPDeviceID] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'PNPDeviceID'
DEBUG: Attribute [SerialNumber] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'SerialNumber'
DEBUG: Attribute [DeviceID] is undefined on this instance DiskPartition({}): 'DiskPartition' object has no attribute 'DeviceID'
DEBUG: Attribute [Type] is undefined on this instance DiskPartition({}): 'DiskPartition' object has no attribute 'Type'
DEBUG: Attribute [Caption] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Caption'
DEBUG: Attribute [DeviceID] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'DeviceID'
DEBUG: Attribute [Model] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Model'
DEBUG: Attribute [InterfaceType] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'InterfaceType'
DEBUG: Attribute [MediaType] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'MediaType'
DEBUG: Attribute [Manufacturer] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Manufacturer'
DEBUG: Attribute [SerialNumber] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'SerialNumber'
DEBUG: Attribute [Status] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'Status'
DEBUG: Attribute [PNPDeviceID] is undefined on this instance DiskDrive({}): 'DiskDrive' object has no attribute 'PNPDeviceID'
INFO: Using the offline database to identify boards.
INFO: Unable to identify a board using the offline database, trying the online database.
DEBUG: Starting new HTTPS connection (1): os.mbed.com:443
WARNING: There was an error connecting to the online database. Please check your internet connection.
ERROR: A problem occurred when looking up board data for connected devices.
More information may be available by using the command line option '--traceback'.
```
Instead of failing with an error when we can't access the online board database, we should accept the board is unknown and display a user-friendly message, explaining that the board is unknown in the local database and that we couldn't access the online database, so we have to consider the board as unknown.
This issue is a subset of the issues reported in https://github.com/ARMmbed/mbed-tools/issues/186
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [X] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/targets/test_get_board.py b/tests/targets/test_get_board.py
index d2e5b69..0398f4a 100644
--- a/tests/targets/test_get_board.py
+++ b/tests/targets/test_get_board.py
@@ -5,6 +5,8 @@
"""Tests for `mbed_tools.targets.get_board`."""
from unittest import mock, TestCase
+from mbed_tools.targets._internal.exceptions import BoardAPIError
+
# Import from top level as this is the expected interface for users
from mbed_tools.targets import get_board_by_online_id, get_board_by_product_code
from mbed_tools.targets.get_board import (
@@ -59,6 +61,17 @@ class TestGetBoard(TestCase):
mocked_boards.from_offline_database().get_board.assert_called_once_with(fn)
mocked_boards.from_online_database().get_board.assert_called_once_with(fn)
+ def test_auto_mode_raises_when_board_not_found_offline_with_no_network(self, env, mocked_boards):
+ env.MBED_DATABASE_MODE = "AUTO"
+ mocked_boards.from_offline_database().get_board.side_effect = UnknownBoard
+ mocked_boards.from_online_database().get_board.side_effect = BoardAPIError
+ fn = mock.Mock()
+
+ with self.assertRaises(UnknownBoard):
+ get_board(fn)
+ mocked_boards.from_offline_database().get_board.assert_called_once_with(fn)
+ mocked_boards.from_online_database().get_board.assert_called_once_with(fn)
+
class TestGetBoardByProductCode(TestCase):
@mock.patch("mbed_tools.targets.get_board.get_board")
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
7.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y cmake ninja-build"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
intelhex==2.3.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@584a995d93b9562e9c95385268891dfdae9c55f1#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
prettytable==3.16.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wcwidth==0.2.13
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- intelhex==2.3.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.2.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- prettytable==3.16.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wcwidth==0.2.13
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/targets/test_get_board.py::TestGetBoard::test_auto_mode_raises_when_board_not_found_offline_with_no_network"
] |
[] |
[
"tests/targets/test_get_board.py::TestGetBoard::test_auto_mode_calls_offline_boards_first",
"tests/targets/test_get_board.py::TestGetBoard::test_auto_mode_falls_back_to_online_database_when_board_not_found",
"tests/targets/test_get_board.py::TestGetBoard::test_offline_mode",
"tests/targets/test_get_board.py::TestGetBoard::test_online_mode",
"tests/targets/test_get_board.py::TestGetBoardByProductCode::test_matches_boards_by_product_code",
"tests/targets/test_get_board.py::TestGetBoardByOnlineId::test_matches_boards_by_online_id",
"tests/targets/test_get_board.py::TestGetDatabaseMode::test_raises_when_configuration_is_not_supported",
"tests/targets/test_get_board.py::TestGetDatabaseMode::test_returns_configured_database_mode"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-208
|
ARMmbed__mbed-tools-259
|
a9b0e1fa3e1d58f80eff5fcc4f82f5952acf8f96
|
2021-04-01 16:06:11
|
a9b0e1fa3e1d58f80eff5fcc4f82f5952acf8f96
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/259?src=pr&el=h1) Report
> Merging [#259](https://codecov.io/gh/ARMmbed/mbed-tools/pull/259?src=pr&el=desc) (a663bbd) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/a9b0e1fa3e1d58f80eff5fcc4f82f5952acf8f96?el=desc) (a9b0e1f) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/259?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #259 +/- ##
=======================================
Coverage 97.07% 97.07%
=======================================
Files 92 92
Lines 2768 2769 +1
=======================================
+ Hits 2687 2688 +1
Misses 81 81
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/259?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/devices/\_internal/file\_parser.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/259/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvZGV2aWNlcy9faW50ZXJuYWwvZmlsZV9wYXJzZXIucHk=) | `100.00% <100.00%> (ø)` | |
|
diff --git a/news/258.bugfix b/news/258.bugfix
new file mode 100644
index 0000000..cd7d099
--- /dev/null
+++ b/news/258.bugfix
@@ -0,0 +1,1 @@
+Make details.txt parsing more lenient to avoid issues with various formats.
diff --git a/src/mbed_tools/devices/_internal/file_parser.py b/src/mbed_tools/devices/_internal/file_parser.py
index baea039..b39622d 100644
--- a/src/mbed_tools/devices/_internal/file_parser.py
+++ b/src/mbed_tools/devices/_internal/file_parser.py
@@ -214,8 +214,9 @@ def _read_details_txt(file_contents: str) -> dict:
if line.startswith("#"):
continue
- key, value = line.split(":", maxsplit=1)
- output[key.strip()] = value.strip()
+ key, sep, value = line.partition(":")
+ if key and value:
+ output[key.strip()] = value.strip()
# Some forms of details.txt use Interface Version instead of Version as the key for the version number field
if "Interface Version" in output and "Version" not in output:
|
This introduces a big issue:
The PR to list the interface version https://github.com/ARMmbed/mbed-tools/pull/235, shipped with v7.6.0, has a big issue.
````
$ pip list | grep mbed-tools
mbed-tools 7.6.0
$ mbedtools detect
Traceback (most recent call last):
File "xxx\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "xxx\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "xxx\AppData\Local\Programs\Python\Python37\Scripts\mbedtools.exe\__main__.py", line 7, in <module>
File "xxx\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\cli\main.py", line 38, in invoke
super().invoke(context)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "xxx\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\cli\list_connected_devices.py", line 29, in list_connected_devices
connected_devices = get_connected_devices()
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\devices\devices.py", line 25, in get_connected_devices
device = Device.from_candidate(candidate_device)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\devices\device.py", line 48, in from_candidate
device_file_info = read_device_files(candidate.mount_points)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\devices\_internal\file_parser.py", line 121, in read_device_files
details_txt_contents = _read_first_details_txt_contents(device_file_paths)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\devices\_internal\file_parser.py", line 162, in _read_first_details_txt_contents
return _read_details_txt(contents)
File "xxx\appdata\local\programs\python\python37\lib\site-packages\mbed_tools\devices\_internal\file_parser.py", line 180, in _read_details_txt
key, value = line.split(":", maxsplit=1)
ValueError: not enough values to unpack (expected 2, got 1)
$ mbedls
| platform_name | platform_name_unique | mount_point | serial_port | target_id | interface_version |
|---------------|----------------------|-------------|-------------|--------------------------|-------------------|
| NUCLEO_F103RB | NUCLEO_F103RB[0] | D: | COM15 | 07000221283E5EF4177AC8C9 | V2J37M26 |
````
_Originally posted by @jeromecoutant in https://github.com/ARMmbed/mbed-tools/issues/235#issuecomment-811982174_
|
ARMmbed/mbed-tools
|
diff --git a/tests/devices/_internal/test_file_parser.py b/tests/devices/_internal/test_file_parser.py
index 7211c81..4872623 100644
--- a/tests/devices/_internal/test_file_parser.py
+++ b/tests/devices/_internal/test_file_parser.py
@@ -233,8 +233,11 @@ class TestReadDetailsTxt:
build_short_details_txt(version="0777", commit_sha="99789s", local_mods="No"),
build_long_details_txt(),
("", {}),
+ ("\n", {}),
+ ("blablablablaandbla", {}),
+ ("blablabla\nblaandbla\nversion : 2\n\n", {"version": "2"}),
),
- ids=("short", "short2", "long", "empty"),
+ ids=("short", "short2", "long", "empty", "newline", "nosep", "multiline"),
)
def test_parses_details_txt(self, content, expected, tmp_path):
details_file_path = pathlib.Path(tmp_path, "DETAILS.txt")
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
7.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y cmake ninja-build"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.2.0
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@a9b0e1fa3e1d58f80eff5fcc4f82f5952acf8f96#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.2.0
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.6.1.dev4
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[newline]",
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[nosep]",
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[multiline]"
] |
[] |
[
"tests/devices/_internal/test_file_parser.py::TestReadDeviceFiles::test_finds_daplink_compatible_device_files",
"tests/devices/_internal/test_file_parser.py::TestReadDeviceFiles::test_finds_jlink_device_files",
"tests/devices/_internal/test_file_parser.py::TestReadDeviceFiles::test_warns_if_no_device_files_found",
"tests/devices/_internal/test_file_parser.py::TestReadDeviceFiles::test_skips_hidden_files",
"tests/devices/_internal/test_file_parser.py::TestReadDeviceFiles::test_handles_os_error_with_warning",
"tests/devices/_internal/test_file_parser.py::TestExtractProductCodeFromHtm::test_reads_product_code_from_code_attribute",
"tests/devices/_internal/test_file_parser.py::TestExtractProductCodeFromHtm::test_reads_product_code_from_auth_attribute",
"tests/devices/_internal/test_file_parser.py::TestExtractProductCodeFromHtm::test_none_if_no_product_code",
"tests/devices/_internal/test_file_parser.py::TestExtractProductCodeFromHtm::test_extracts_first_product_code_found",
"tests/devices/_internal/test_file_parser.py::TestExtractOnlineIDFromHTM::test_reads_online_id_from_url",
"tests/devices/_internal/test_file_parser.py::TestExtractOnlineIDFromHTM::test_none_if_not_found",
"tests/devices/_internal/test_file_parser.py::TestExtractsJlinkData::test_reads_board_slug",
"tests/devices/_internal/test_file_parser.py::TestExtractsJlinkData::test_reads_board_slug_ignore_extension",
"tests/devices/_internal/test_file_parser.py::TestExtractsJlinkData::test_id_none_if_no_board_slug",
"tests/devices/_internal/test_file_parser.py::TestExtractsJlinkData::test_reads_segger_slug",
"tests/devices/_internal/test_file_parser.py::TestExtractsJlinkData::test_interface_empty_if_not_found",
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[short]",
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[short2]",
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[long]",
"tests/devices/_internal/test_file_parser.py::TestReadDetailsTxt::test_parses_details_txt[empty]"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-259
|
ARMmbed__mbed-tools-270
|
73fc6ed6fd728beea588e100c2de83c439c29228
|
2021-04-13 11:28:54
|
73fc6ed6fd728beea588e100c2de83c439c29228
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/270?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) Report
> Merging [#270](https://codecov.io/gh/ARMmbed/mbed-tools/pull/270?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (dd7c062) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/3dbc738b4f46c9b170922f9299b1650dc3ad5b9d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (3dbc738) will **increase** coverage by `0.04%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/270?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed)
```diff
@@ Coverage Diff @@
## master #270 +/- ##
==========================================
+ Coverage 97.07% 97.12% +0.04%
==========================================
Files 92 92
Lines 2769 2814 +45
==========================================
+ Hits 2688 2733 +45
Misses 81 81
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/270?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/build/\_internal/config/config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/270/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9jb25maWcucHk=) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/build/\_internal/config/source.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/270/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9zb3VyY2UucHk=) | `100.00% <100.00%> (ø)` | |
jeromecoutant: Hi
> These attributes are now extracted from the config files
Config files are targets/custom and mbed_app json files ?
Not tools/arm_pack_manager/index.json, right ?
LDong-Arm: Another issue with `tools/arm_pack_manager/index.json` is, despite having memory regions specified, the memory addresses and sizes are also hardcoded in each target's linker script (`.sct` or `.ld`) in most cases. Confusions arise if they disagree. Not to mention some targets (e.g. ARM_MUSCA_S1) only have memory regions in linker scripts, not in `tools/arm_pack_manager/index.json` or `targets.json`.
rwalton-arm: > Another issue with `tools/arm_pack_manager/index.json` is, despite having memory regions specified, the memory addresses and sizes are also hardcoded in each target's linker script (`.sct` or `.ld`) in most cases. Confusions arise if they disagree. Not to mention some targets (e.g. ARM_MUSCA_S1) only have memory regions in linker scripts, not in `tools/arm_pack_manager/index.json` or `targets.json`.
I would suggest the best course of action is to migrate the necessary information to targets.json, and ignore pack_manager/index.json, as it seems to be out of date or incorrect in a number of cases. If the memory regions aren't configurable for certain targets, because they're hardcoded in the linkerscripts, then we should probably not define the properties in targets.json for those targets. That would mean the tool would at least emit a warning if a user attempts to override the memory region for a target where that isn't possible, which may reduce the potential other "confusions" later on.
LDong-Arm: > I would suggest the best course of action is to migrate the necessary information to targets.json, and ignore pack_manager/index.json, as it seems to be out of date or incorrect in a number of cases.
Agreed.
> If the memory regions aren't configurable for certain targets, because they're hardcoded in the linkerscripts, then we should probably not define the properties in targets.json for those targets. That would mean the tool would at least emit a warning if a user attempts to override the memory region for a target where that isn't possible, which may reduce the potential other "confusions" later on.
Most targets' linker scripts have hardcoded values, but they can be overridden with macros ([example](https://github.com/ARMmbed/mbed-os/blob/9738b27c7df897c29e9769911d6794ba3e5b3f19/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/device/TOOLCHAIN_ARMC6/musca_ns.sct#L24-L38)). The old mbed-cli sets memory region macros from either `targets.json` or `tools/arm_pack_manager/index.json` anyway. Any clean-up/alignment would be a large amount of work on its own.
At minimum we need to migrate memory regions from `tools/arm_pack_manager/index.json` to `targets.json` as suggested above, I guess.
Patater: I've raised https://github.com/ARMmbed/mbed-tools/issues/271 for deciding what to do about `tools/arm_pack_manager/index.json`. Please continue discussion there.
What do we need to move this PR forward, given we are limiting its scope to only memory map information defined in `targets.json`?
LDong-Arm: > I've raised #271 for deciding what to do about `tools/arm_pack_manager/index.json`. Please continue discussion there.
>
> What do we need to move this PR forward, given we are limiting its scope to only memory map information defined in `targets.json`?
Thanks. I will approve this PR as it's sufficient for the current scope. Maybe we can't close #222, because the target mentioned there is one that depends on #271?
|
diff --git a/news/222.bugfix b/news/222.bugfix
new file mode 100644
index 0000000..4bb5df6
--- /dev/null
+++ b/news/222.bugfix
@@ -0,0 +1,1 @@
+Add support for MBED_ROM_START, MBED_ROM_SIZE, MBED_RAM_START and MBED_RAM_SIZE in config system.
diff --git a/src/mbed_tools/build/_internal/config/config.py b/src/mbed_tools/build/_internal/config/config.py
index d93cfe4..bb493f2 100644
--- a/src/mbed_tools/build/_internal/config/config.py
+++ b/src/mbed_tools/build/_internal/config/config.py
@@ -8,7 +8,7 @@ import logging
from collections import UserDict
from typing import Any, Iterable, Hashable, Callable, List
-from mbed_tools.build._internal.config.source import Override, ConfigSetting
+from mbed_tools.build._internal.config.source import Memory, Override, ConfigSetting
logger = logging.getLogger(__name__)
@@ -18,13 +18,15 @@ class Config(UserDict):
This object understands how to populate the different 'config sections' which all have different rules for how the
settings are collected.
- Applies overrides, appends macros and updates config settings.
+ Applies overrides, appends macros, updates memories, and updates config settings.
"""
def __setitem__(self, key: Hashable, item: Any) -> None:
"""Set an item based on its key."""
if key == CONFIG_SECTION:
self._update_config_section(item)
+ elif key == MEMORIES_SECTION:
+ self._update_memories_section(item)
elif key == OVERRIDES_SECTION:
self._handle_overrides(item)
elif key == MACROS_SECTION:
@@ -67,6 +69,20 @@ class Config(UserDict):
self.data[CONFIG_SECTION] = self.data.get(CONFIG_SECTION, []) + config_settings
+ def _update_memories_section(self, memories: List[Memory]) -> None:
+ defined_memories = self.data.get(MEMORIES_SECTION, [])
+ for memory in memories:
+ logger.debug(f"Adding memory settings `{memory.name}: start={memory.start} size={memory.size}`")
+ prev_defined = next((mem for mem in defined_memories if mem.name == memory.name), None)
+ if prev_defined is None:
+ defined_memories.append(memory)
+ else:
+ logger.warning(
+ f"You are attempting to redefine `{memory.name}` from {prev_defined.namespace}.\n"
+ f"The values from `{memory.namespace}` will be ignored"
+ )
+ self.data[MEMORIES_SECTION] = defined_memories
+
def _find_first_config_setting(self, predicate: Callable) -> Any:
"""Find first config setting based on `predicate`.
@@ -89,6 +105,7 @@ class Config(UserDict):
CONFIG_SECTION = "config"
MACROS_SECTION = "macros"
+MEMORIES_SECTION = "memories"
OVERRIDES_SECTION = "overrides"
diff --git a/src/mbed_tools/build/_internal/config/source.py b/src/mbed_tools/build/_internal/config/source.py
index 4ad7e37..59d01df 100644
--- a/src/mbed_tools/build/_internal/config/source.py
+++ b/src/mbed_tools/build/_internal/config/source.py
@@ -28,8 +28,8 @@ def prepare(
) -> dict:
"""Prepare a config source for entry into the Config object.
- Extracts config and override settings from the source. Flattens these nested dictionaries out into lists of
- objects which are namespaced in the way the Mbed config system expects.
+ Extracts memory, config and override settings from the source. Flattens these nested dictionaries out into
+ lists of objects which are namespaced in the way the Mbed config system expects.
Args:
input_data: The raw config JSON object parsed from the config file.
@@ -46,6 +46,11 @@ def prepare(
for key in data:
data[key] = _sanitise_value(data[key])
+ memories = _extract_memories(namespace, data)
+
+ if memories:
+ data["memories"] = memories
+
if "config" in data:
data["config"] = _extract_config_settings(namespace, data["config"])
@@ -78,6 +83,31 @@ class ConfigSetting:
self.value = _sanitise_value(self.value)
+@dataclass
+class Memory:
+ """Representation of a defined RAM/ROM region."""
+
+ name: str
+ namespace: str
+ start: str
+ size: str
+
+ def __post_init__(self) -> None:
+ """Convert start and size to hex format strings."""
+ try:
+ self.start = hex(int(self.start, 0))
+ except ValueError:
+ raise ValueError(
+ f"Value of MBED_{self.name}_START in {self.namespace}, {self.start} is invalid: must be an integer"
+ )
+ try:
+ self.size = hex(int(self.size, 0))
+ except ValueError:
+ raise ValueError(
+ f"Value of MBED_{self.name}_SIZE in {self.namespace}, {self.size} is invalid: must be an integer"
+ )
+
+
@dataclass
class Override:
"""Representation of a config override.
@@ -128,6 +158,27 @@ def _extract_config_settings(namespace: str, config_data: dict) -> List[ConfigSe
return settings
+def _extract_memories(namespace: str, data: dict) -> List[Memory]:
+ memories = []
+ for mem in ["rom", "ram"]:
+ start_attr = f"mbed_{mem}_start"
+ size_attr = f"mbed_{mem}_size"
+ start = data.get(start_attr)
+ size = data.get(size_attr)
+
+ if size is not None and start is not None:
+ logger.debug(f"Extracting MBED_{mem.upper()} definitions in {namespace}: _START={start}, _SIZE={size}.")
+
+ memory = Memory(mem.upper(), namespace, start, size)
+ memories.append(memory)
+ elif start is not None or size is not None:
+ raise ValueError(
+ f"{size_attr.upper()} and {start_attr.upper()} must be defined together. Only "
+ f"{'START' if start is not None else 'SIZE'} is defined in the lib {namespace}."
+ )
+ return memories
+
+
def _extract_target_overrides(
namespace: str, override_data: dict, allowed_target_labels: Iterable[str]
) -> List[Override]:
diff --git a/src/mbed_tools/build/_internal/templates/mbed_config.tmpl b/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
index 8fb2119..7fadeb1 100644
--- a/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
+++ b/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
@@ -75,6 +75,10 @@ set(MBED_CONFIG_DEFINITIONS
"-D{{setting_name}}={{value}}"
{% endif -%}
{%- endfor -%}
+{% for memory in memories %}
+ "-DMBED_{{memory.name}}_START={{memory.start}}"
+ "-DMBED_{{memory.name}}_SIZE={{memory.size}}"
+{%- endfor -%}
{% for macro in macros %}
"{{macro|replace("\"", "\\\"")}}"
{%- endfor %}
|
MBED_ROM_START and friends unavailable on Mbed CLI2
### Description
<!--
A detailed description of what is being reported. Please include steps to reproduce the problem.
Things to consider sharing:
- What version of the package is being used (pip show mbed-tools)?
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
-->
On Mbed CLI, the following symbols are generated and passed to compiler, linker, or both:
```sh
mbed compile -m NUMAKER_IOT_M487 -t ARM
```
**BUILD/NUMAKER_IOT_M487/ARM/.profile.c**:
```
{
"flags": [
......
"-DMBED_RAM_SIZE=0x28000",
"-DMBED_RAM_START=0x20000000",
"-DMBED_ROM_SIZE=0x80000",
"-DMBED_ROM_START=0x0",
......
```
**BUILD/NUMAKER_IOT_M487/ARM/.profile.ld**:
```
{
"flags": [
......
"--predefine=\"-DMBED_BOOT_STACK_SIZE=1024\"",
"--predefine=\"-DMBED_RAM_SIZE=0x28000\"",
"--predefine=\"-DMBED_RAM_START=0x20000000\"",
"--predefine=\"-DMBED_ROM_SIZE=0x80000\"",
"--predefine=\"-DMBED_ROM_START=0x0\"",
......
```
But on Mbed CLI2, they are unavailable in `cmake_build/NUMAKER_IOT_M487/develop/ARM/mbed_config.cmake` or elsewhere.
```sh
mbed-tools compile -m NUMAKER_IOT_M487 -t ARM
```
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [x] Bug
### Mbed/Tool version
**mbed-os**: 6.8.0
**mbed-cli**: 1.10.5
**mbed-tools**:: 7.2.1
|
ARMmbed/mbed-tools
|
diff --git a/tests/build/_internal/config/test_config.py b/tests/build/_internal/config/test_config.py
index 980ed4d..c7e2e35 100644
--- a/tests/build/_internal/config/test_config.py
+++ b/tests/build/_internal/config/test_config.py
@@ -2,10 +2,11 @@
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
+import logging
import pytest
from mbed_tools.build._internal.config.config import Config
-from mbed_tools.build._internal.config.source import prepare, ConfigSetting, Override
+from mbed_tools.build._internal.config.source import prepare, ConfigSetting, Memory, Override
class TestConfig:
@@ -24,6 +25,17 @@ class TestConfig:
with pytest.raises(ValueError, match="lib.param already defined"):
conf.update(prepare({"config": {"param": {"value": 0}}}, source_name="lib"))
+ def test_logs_ignore_mbed_ram_repeated(self, caplog):
+ caplog.set_level(logging.DEBUG)
+ input_dict = {"mbed_ram_size": "0x80000", "mbed_ram_start": "0x24000000"}
+ input_dict2 = {"mbed_ram_size": "0x78000", "mbed_ram_start": "0x24200000"}
+
+ conf = Config(prepare(input_dict, source_name="lib1"))
+ conf.update(prepare(input_dict2, source_name="lib2"))
+
+ assert "values from `lib2` will be ignored" in caplog.text
+ assert conf["memories"] == [Memory("RAM", "lib1", "0x24000000", "0x80000")]
+
def test_target_overrides_handled(self):
conf = Config(
{
diff --git a/tests/build/_internal/config/test_source.py b/tests/build/_internal/config/test_source.py
index 962315a..b7f4a2a 100644
--- a/tests/build/_internal/config/test_source.py
+++ b/tests/build/_internal/config/test_source.py
@@ -2,8 +2,10 @@
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
+import pytest
+
from mbed_tools.build._internal.config import source
-from mbed_tools.build._internal.config.source import Override
+from mbed_tools.build._internal.config.source import Memory, Override
class TestPrepareSource:
@@ -118,3 +120,48 @@ class TestPrepareSource:
assert conf["config"][0].value == {"ETHERNET", "WIFI"}
assert conf["sectors"] == {0, 2048}
assert conf["header_info"] == {0, 2048, "bobbins", "magic"}
+
+ def test_memory_attr_extracted(self):
+ lib = {
+ "mbed_ram_size": "0x80000",
+ "mbed_ram_start": "0x24000000",
+ "mbed_rom_size": "0x200000",
+ "mbed_rom_start": "0x08000000",
+ }
+
+ conf = source.prepare(lib, "lib")
+
+ assert Memory("RAM", "lib", "0x24000000", "0x80000") in conf["memories"]
+ assert Memory("ROM", "lib", "0x8000000", "0x200000") in conf["memories"]
+
+ def test_memory_attr_converted_as_hex(self):
+ input_dict = {"mbed_ram_size": "1024", "mbed_ram_start": "0x24000000"}
+
+ conf = source.prepare(input_dict, source_name="lib")
+
+ memory, *_ = conf["memories"]
+ assert memory.size == "0x400"
+
+ def test_raises_memory_size_not_integer(self):
+ input_dict = {"mbed_ram_size": "NOT INT", "mbed_ram_start": "0x24000000"}
+
+ with pytest.raises(ValueError, match="_SIZE in lib, NOT INT is invalid: must be an integer"):
+ source.prepare(input_dict, "lib")
+
+ def test_raises_memory_start_not_integer(self):
+ input_dict = {"mbed_ram_size": "0x80000", "mbed_ram_start": "NOT INT"}
+
+ with pytest.raises(ValueError, match="_START in lib, NOT INT is invalid: must be an integer"):
+ source.prepare(input_dict, "lib")
+
+ def test_raises_memory_size_defined_not_start(self):
+ input_dict = {"mbed_ram_size": "0x80000"}
+
+ with pytest.raises(ValueError, match="Only SIZE is defined"):
+ source.prepare(input_dict)
+
+ def test_raises_memory_start_defined_not_size(self):
+ input_dict = {"mbed_ram_start": "0x24000000"}
+
+ with pytest.raises(ValueError, match="Only START is defined"):
+ source.prepare(input_dict)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 3
}
|
7.10
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@73fc6ed6fd728beea588e100c2de83c439c29228#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.10.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/build/_internal/config/test_config.py::TestConfig::test_config_updated",
"tests/build/_internal/config/test_config.py::TestConfig::test_raises_when_trying_to_add_duplicate_config_setting",
"tests/build/_internal/config/test_config.py::TestConfig::test_logs_ignore_mbed_ram_repeated",
"tests/build/_internal/config/test_config.py::TestConfig::test_target_overrides_handled",
"tests/build/_internal/config/test_config.py::TestConfig::test_target_overrides_separate_namespace",
"tests/build/_internal/config/test_config.py::TestConfig::test_lib_overrides_handled",
"tests/build/_internal/config/test_config.py::TestConfig::test_cumulative_fields_can_be_modified",
"tests/build/_internal/config/test_config.py::TestConfig::test_macros_are_appended_to",
"tests/build/_internal/config/test_config.py::TestConfig::test_warns_and_skips_override_for_undefined_config_parameter",
"tests/build/_internal/config/test_config.py::TestConfig::test_ignores_present_option",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_config_fields_from_target_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_override_fields_from_target_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_config_fields_from_lib_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_override_fields_from_lib_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_target_overrides_only_collected_for_valid_targets",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_cumulative_fields_parsed",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_converts_config_setting_value_lists_to_sets",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_memory_attr_extracted",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_memory_attr_converted_as_hex",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_raises_memory_size_not_integer",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_raises_memory_start_not_integer",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_raises_memory_size_defined_not_start",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_raises_memory_start_defined_not_size"
] |
[] |
[] |
[] |
Apache License 2.0
| null |
ARMmbed__mbed-tools-284
|
71e9707b908c393691a4e509ced90ce608e68b81
|
2021-05-24 11:45:52
|
71e9707b908c393691a4e509ced90ce608e68b81
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) Report
> Merging [#284](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (8f1df1b) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/71e9707b908c393691a4e509ced90ce608e68b81?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (71e9707) will **decrease** coverage by `0.04%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed)
```diff
@@ Coverage Diff @@
## master #284 +/- ##
==========================================
- Coverage 97.12% 97.07% -0.05%
==========================================
Files 92 92
Lines 2813 2773 -40
==========================================
- Hits 2732 2692 -40
Misses 81 81
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/build/\_internal/config/source.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9zb3VyY2UucHk=) | `100.00% <ø> (ø)` | |
| [src/mbed\_tools/build/\_internal/cmake\_file.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NtYWtlX2ZpbGUucHk=) | `100.00% <100.00%> (ø)` | |
| [src/mbed\_tools/build/\_internal/config/config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/284/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9jb25maWcucHk=) | `100.00% <100.00%> (ø)` | |
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e61e039..29a1296 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,15 @@ beta releases are not included in this history. For a full list of all releases,
[//]: # (begin_release_notes)
+7.16.0 (2021-05-26)
+===================
+
+Features
+--------
+
+- Targets modified: MultiTech mDot. (#20210526050235)
+
+
7.15.0 (2021-05-15)
===================
diff --git a/news/20210524113403.bugfix b/news/20210524113403.bugfix
new file mode 100644
index 0000000..2f178f5
--- /dev/null
+++ b/news/20210524113403.bugfix
@@ -0,0 +1,1 @@
+Fix issue with memory region overrides being ignored.
diff --git a/src/mbed_tools/build/_internal/cmake_file.py b/src/mbed_tools/build/_internal/cmake_file.py
index 09d507c..d6b550b 100644
--- a/src/mbed_tools/build/_internal/cmake_file.py
+++ b/src/mbed_tools/build/_internal/cmake_file.py
@@ -5,6 +5,8 @@
"""Module in charge of CMake file generation."""
import pathlib
+from typing import Any
+
import jinja2
from mbed_tools.build._internal.config.config import Config
@@ -25,7 +27,13 @@ def render_mbed_config_cmake_template(config: Config, toolchain_name: str, targe
The rendered mbed_config template.
"""
env = jinja2.Environment(loader=jinja2.PackageLoader("mbed_tools.build", str(TEMPLATES_DIRECTORY)),)
+ env.filters["to_hex"] = to_hex
template = env.get_template(TEMPLATE_NAME)
config["supported_c_libs"] = [x for x in config["supported_c_libs"][toolchain_name.lower()]]
context = {"target_name": target_name, "toolchain_name": toolchain_name, **config}
return template.render(context)
+
+
+def to_hex(s: Any) -> str:
+ """Filter to convert integers to hex."""
+ return hex(int(s, 0))
diff --git a/src/mbed_tools/build/_internal/config/config.py b/src/mbed_tools/build/_internal/config/config.py
index bb493f2..7f96862 100644
--- a/src/mbed_tools/build/_internal/config/config.py
+++ b/src/mbed_tools/build/_internal/config/config.py
@@ -8,7 +8,7 @@ import logging
from collections import UserDict
from typing import Any, Iterable, Hashable, Callable, List
-from mbed_tools.build._internal.config.source import Memory, Override, ConfigSetting
+from mbed_tools.build._internal.config.source import Override, ConfigSetting
logger = logging.getLogger(__name__)
@@ -18,15 +18,13 @@ class Config(UserDict):
This object understands how to populate the different 'config sections' which all have different rules for how the
settings are collected.
- Applies overrides, appends macros, updates memories, and updates config settings.
+ Applies overrides, appends macros, and updates config settings.
"""
def __setitem__(self, key: Hashable, item: Any) -> None:
"""Set an item based on its key."""
if key == CONFIG_SECTION:
self._update_config_section(item)
- elif key == MEMORIES_SECTION:
- self._update_memories_section(item)
elif key == OVERRIDES_SECTION:
self._handle_overrides(item)
elif key == MACROS_SECTION:
@@ -69,20 +67,6 @@ class Config(UserDict):
self.data[CONFIG_SECTION] = self.data.get(CONFIG_SECTION, []) + config_settings
- def _update_memories_section(self, memories: List[Memory]) -> None:
- defined_memories = self.data.get(MEMORIES_SECTION, [])
- for memory in memories:
- logger.debug(f"Adding memory settings `{memory.name}: start={memory.start} size={memory.size}`")
- prev_defined = next((mem for mem in defined_memories if mem.name == memory.name), None)
- if prev_defined is None:
- defined_memories.append(memory)
- else:
- logger.warning(
- f"You are attempting to redefine `{memory.name}` from {prev_defined.namespace}.\n"
- f"The values from `{memory.namespace}` will be ignored"
- )
- self.data[MEMORIES_SECTION] = defined_memories
-
def _find_first_config_setting(self, predicate: Callable) -> Any:
"""Find first config setting based on `predicate`.
@@ -105,7 +89,6 @@ class Config(UserDict):
CONFIG_SECTION = "config"
MACROS_SECTION = "macros"
-MEMORIES_SECTION = "memories"
OVERRIDES_SECTION = "overrides"
diff --git a/src/mbed_tools/build/_internal/config/source.py b/src/mbed_tools/build/_internal/config/source.py
index 59d01df..54008bc 100644
--- a/src/mbed_tools/build/_internal/config/source.py
+++ b/src/mbed_tools/build/_internal/config/source.py
@@ -28,7 +28,7 @@ def prepare(
) -> dict:
"""Prepare a config source for entry into the Config object.
- Extracts memory, config and override settings from the source. Flattens these nested dictionaries out into
+ Extracts config and override settings from the source. Flattens these nested dictionaries out into
lists of objects which are namespaced in the way the Mbed config system expects.
Args:
@@ -46,11 +46,6 @@ def prepare(
for key in data:
data[key] = _sanitise_value(data[key])
- memories = _extract_memories(namespace, data)
-
- if memories:
- data["memories"] = memories
-
if "config" in data:
data["config"] = _extract_config_settings(namespace, data["config"])
@@ -83,31 +78,6 @@ class ConfigSetting:
self.value = _sanitise_value(self.value)
-@dataclass
-class Memory:
- """Representation of a defined RAM/ROM region."""
-
- name: str
- namespace: str
- start: str
- size: str
-
- def __post_init__(self) -> None:
- """Convert start and size to hex format strings."""
- try:
- self.start = hex(int(self.start, 0))
- except ValueError:
- raise ValueError(
- f"Value of MBED_{self.name}_START in {self.namespace}, {self.start} is invalid: must be an integer"
- )
- try:
- self.size = hex(int(self.size, 0))
- except ValueError:
- raise ValueError(
- f"Value of MBED_{self.name}_SIZE in {self.namespace}, {self.size} is invalid: must be an integer"
- )
-
-
@dataclass
class Override:
"""Representation of a config override.
@@ -158,27 +128,6 @@ def _extract_config_settings(namespace: str, config_data: dict) -> List[ConfigSe
return settings
-def _extract_memories(namespace: str, data: dict) -> List[Memory]:
- memories = []
- for mem in ["rom", "ram"]:
- start_attr = f"mbed_{mem}_start"
- size_attr = f"mbed_{mem}_size"
- start = data.get(start_attr)
- size = data.get(size_attr)
-
- if size is not None and start is not None:
- logger.debug(f"Extracting MBED_{mem.upper()} definitions in {namespace}: _START={start}, _SIZE={size}.")
-
- memory = Memory(mem.upper(), namespace, start, size)
- memories.append(memory)
- elif start is not None or size is not None:
- raise ValueError(
- f"{size_attr.upper()} and {start_attr.upper()} must be defined together. Only "
- f"{'START' if start is not None else 'SIZE'} is defined in the lib {namespace}."
- )
- return memories
-
-
def _extract_target_overrides(
namespace: str, override_data: dict, allowed_target_labels: Iterable[str]
) -> List[Override]:
diff --git a/src/mbed_tools/build/_internal/templates/mbed_config.tmpl b/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
index 7fadeb1..89308ac 100644
--- a/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
+++ b/src/mbed_tools/build/_internal/templates/mbed_config.tmpl
@@ -54,6 +54,18 @@ set(MBED_TARGET_DEFINITIONS{% for component in components %}
{% for form_factor in supported_form_factors %}
TARGET_FF_{{form_factor}}
{%- endfor %}
+{% if mbed_rom_start is defined %}
+ MBED_ROM_START={{ mbed_rom_start | to_hex }}
+{%- endif %}
+{% if mbed_rom_size is defined %}
+ MBED_ROM_SIZE={{ mbed_rom_size | to_hex }}
+{%- endif %}
+{% if mbed_ram_start is defined %}
+ MBED_RAM_START={{ mbed_ram_start | to_hex }}
+{%- endif %}
+{% if mbed_ram_size is defined %}
+ MBED_RAM_SIZE={{ mbed_ram_size | to_hex }}
+{%- endif %}
TARGET_LIKE_MBED
__MBED__=1
)
@@ -75,10 +87,6 @@ set(MBED_CONFIG_DEFINITIONS
"-D{{setting_name}}={{value}}"
{% endif -%}
{%- endfor -%}
-{% for memory in memories %}
- "-DMBED_{{memory.name}}_START={{memory.start}}"
- "-DMBED_{{memory.name}}_SIZE={{memory.size}}"
-{%- endfor -%}
{% for macro in macros %}
"{{macro|replace("\"", "\\\"")}}"
{%- endfor %}
diff --git a/src/mbed_tools/targets/_internal/data/board_database_snapshot.json b/src/mbed_tools/targets/_internal/data/board_database_snapshot.json
index 6b81247..6ef01a2 100644
--- a/src/mbed_tools/targets/_internal/data/board_database_snapshot.json
+++ b/src/mbed_tools/targets/_internal/data/board_database_snapshot.json
@@ -4921,7 +4921,6 @@
"slug": "MTS-mDot-F411",
"build_variant": [],
"mbed_os_support": [
- "Mbed OS 2",
"Mbed OS 5.10",
"Mbed OS 5.11",
"Mbed OS 5.12",
@@ -4935,7 +4934,14 @@
"Mbed OS 5.8",
"Mbed OS 5.9",
"Mbed OS 6.0",
- "Mbed OS 6.1"
+ "Mbed OS 6.1",
+ "Mbed OS 6.2",
+ "Mbed OS 6.3",
+ "Mbed OS 6.4",
+ "Mbed OS 6.5",
+ "Mbed OS 6.6",
+ "Mbed OS 6.7",
+ "Mbed OS 6.8"
],
"mbed_enabled": [
"Baseline"
|
mbed_rom_size values from mbed_app.json are ignored
**Describe the bug**
#270 has implemented mbed_rom_size support in targets.json file,
But it seems that if values is overwritten in the local mbed_app.json file, value is ignored
@wernerlewis
**To Reproduce**
Steps to reproduce the behavior:
- choose a target with "mbed_rom_size" defined
- change the value in mbed_app.json: "target.mbed_rom_size"
- see in mbed_config.cmake
|
ARMmbed/mbed-tools
|
diff --git a/tests/build/_internal/config/test_config.py b/tests/build/_internal/config/test_config.py
index c7e2e35..980ed4d 100644
--- a/tests/build/_internal/config/test_config.py
+++ b/tests/build/_internal/config/test_config.py
@@ -2,11 +2,10 @@
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
-import logging
import pytest
from mbed_tools.build._internal.config.config import Config
-from mbed_tools.build._internal.config.source import prepare, ConfigSetting, Memory, Override
+from mbed_tools.build._internal.config.source import prepare, ConfigSetting, Override
class TestConfig:
@@ -25,17 +24,6 @@ class TestConfig:
with pytest.raises(ValueError, match="lib.param already defined"):
conf.update(prepare({"config": {"param": {"value": 0}}}, source_name="lib"))
- def test_logs_ignore_mbed_ram_repeated(self, caplog):
- caplog.set_level(logging.DEBUG)
- input_dict = {"mbed_ram_size": "0x80000", "mbed_ram_start": "0x24000000"}
- input_dict2 = {"mbed_ram_size": "0x78000", "mbed_ram_start": "0x24200000"}
-
- conf = Config(prepare(input_dict, source_name="lib1"))
- conf.update(prepare(input_dict2, source_name="lib2"))
-
- assert "values from `lib2` will be ignored" in caplog.text
- assert conf["memories"] == [Memory("RAM", "lib1", "0x24000000", "0x80000")]
-
def test_target_overrides_handled(self):
conf = Config(
{
diff --git a/tests/build/_internal/config/test_source.py b/tests/build/_internal/config/test_source.py
index b7f4a2a..962315a 100644
--- a/tests/build/_internal/config/test_source.py
+++ b/tests/build/_internal/config/test_source.py
@@ -2,10 +2,8 @@
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
-import pytest
-
from mbed_tools.build._internal.config import source
-from mbed_tools.build._internal.config.source import Memory, Override
+from mbed_tools.build._internal.config.source import Override
class TestPrepareSource:
@@ -120,48 +118,3 @@ class TestPrepareSource:
assert conf["config"][0].value == {"ETHERNET", "WIFI"}
assert conf["sectors"] == {0, 2048}
assert conf["header_info"] == {0, 2048, "bobbins", "magic"}
-
- def test_memory_attr_extracted(self):
- lib = {
- "mbed_ram_size": "0x80000",
- "mbed_ram_start": "0x24000000",
- "mbed_rom_size": "0x200000",
- "mbed_rom_start": "0x08000000",
- }
-
- conf = source.prepare(lib, "lib")
-
- assert Memory("RAM", "lib", "0x24000000", "0x80000") in conf["memories"]
- assert Memory("ROM", "lib", "0x8000000", "0x200000") in conf["memories"]
-
- def test_memory_attr_converted_as_hex(self):
- input_dict = {"mbed_ram_size": "1024", "mbed_ram_start": "0x24000000"}
-
- conf = source.prepare(input_dict, source_name="lib")
-
- memory, *_ = conf["memories"]
- assert memory.size == "0x400"
-
- def test_raises_memory_size_not_integer(self):
- input_dict = {"mbed_ram_size": "NOT INT", "mbed_ram_start": "0x24000000"}
-
- with pytest.raises(ValueError, match="_SIZE in lib, NOT INT is invalid: must be an integer"):
- source.prepare(input_dict, "lib")
-
- def test_raises_memory_start_not_integer(self):
- input_dict = {"mbed_ram_size": "0x80000", "mbed_ram_start": "NOT INT"}
-
- with pytest.raises(ValueError, match="_START in lib, NOT INT is invalid: must be an integer"):
- source.prepare(input_dict, "lib")
-
- def test_raises_memory_size_defined_not_start(self):
- input_dict = {"mbed_ram_size": "0x80000"}
-
- with pytest.raises(ValueError, match="Only SIZE is defined"):
- source.prepare(input_dict)
-
- def test_raises_memory_start_defined_not_size(self):
- input_dict = {"mbed_ram_start": "0x24000000"}
-
- with pytest.raises(ValueError, match="Only START is defined"):
- source.prepare(input_dict)
diff --git a/tests/build/test_generate_config.py b/tests/build/test_generate_config.py
index b18bb2b..6605f5b 100644
--- a/tests/build/test_generate_config.py
+++ b/tests/build/test_generate_config.py
@@ -48,6 +48,10 @@ TARGET_DATA = {
"supported_toolchains": ["ARM", "GCC_ARM", "IAR"],
"trustzone": False,
"OUTPUT_EXT": "hex",
+ "mbed_ram_start": "0",
+ "mbed_ram_size": "0",
+ "mbed_rom_start": "0",
+ "mbed_rom_size": "0",
}
@@ -289,6 +293,10 @@ def test_overrides_target_config_param_from_app(matching_target_and_filter, prog
("target.macros", ["DEFINE"], "DEFINE"),
("target.device_has", ["NOTHING"], "DEVICE_NOTHING"),
("target.features", ["ELECTRICITY"], "FEATURE_ELECTRICITY"),
+ ("target.mbed_rom_start", "99", "MBED_ROM_START=0x63"),
+ ("target.mbed_rom_size", "1010", "MBED_ROM_SIZE=0x3f2"),
+ ("target.mbed_ram_start", "99", "MBED_RAM_START=0x63"),
+ ("target.mbed_ram_size", "1010", "MBED_RAM_SIZE=0x3f2"),
("OUTPUT_EXT", "hex", 'MBED_OUTPUT_EXT "hex"'),
],
)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 6
}
|
7.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@71e9707b908c393691a4e509ced90ce608e68b81#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.15.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/build/test_generate_config.py::test_overrides_target_non_config_params_from_app[target:"
] |
[] |
[
"tests/build/_internal/config/test_config.py::TestConfig::test_config_updated",
"tests/build/_internal/config/test_config.py::TestConfig::test_raises_when_trying_to_add_duplicate_config_setting",
"tests/build/_internal/config/test_config.py::TestConfig::test_target_overrides_handled",
"tests/build/_internal/config/test_config.py::TestConfig::test_target_overrides_separate_namespace",
"tests/build/_internal/config/test_config.py::TestConfig::test_lib_overrides_handled",
"tests/build/_internal/config/test_config.py::TestConfig::test_cumulative_fields_can_be_modified",
"tests/build/_internal/config/test_config.py::TestConfig::test_macros_are_appended_to",
"tests/build/_internal/config/test_config.py::TestConfig::test_warns_and_skips_override_for_undefined_config_parameter",
"tests/build/_internal/config/test_config.py::TestConfig::test_ignores_present_option",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_config_fields_from_target_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_override_fields_from_target_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_config_fields_from_lib_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_override_fields_from_lib_are_namespaced",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_target_overrides_only_collected_for_valid_targets",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_cumulative_fields_parsed",
"tests/build/_internal/config/test_source.py::TestPrepareSource::test_converts_config_setting_value_lists_to_sets",
"tests/build/test_generate_config.py::test_target_and_toolchain_collected",
"tests/build/test_generate_config.py::test_custom_targets_data_found",
"tests/build/test_generate_config.py::test_raises_error_when_attempting_to_customize_existing_target",
"tests/build/test_generate_config.py::test_config_param_from_lib_processed_with_default_name_mangling",
"tests/build/test_generate_config.py::test_config_param_from_lib_processed_with_user_set_name",
"tests/build/test_generate_config.py::test_config_param_from_app_processed_with_default_name_mangling",
"tests/build/test_generate_config.py::test_config_param_from_target_processed_with_default_name_mangling",
"tests/build/test_generate_config.py::test_macros_from_lib_collected[single]",
"tests/build/test_generate_config.py::test_macros_from_lib_collected[multiple]",
"tests/build/test_generate_config.py::test_macros_from_app_collected[single]",
"tests/build/test_generate_config.py::test_macros_from_app_collected[multiple]",
"tests/build/test_generate_config.py::test_macros_from_target_collected",
"tests/build/test_generate_config.py::test_target_labels_collected_as_defines",
"tests/build/test_generate_config.py::test_overrides_lib_config_param_from_app[target:",
"tests/build/test_generate_config.py::test_overrides_target_config_param_from_app[target:",
"tests/build/test_generate_config.py::test_overrides_target_config_param_from_lib[target:",
"tests/build/test_generate_config.py::test_overrides_lib_config_param_from_same_lib[target:",
"tests/build/test_generate_config.py::test_raises_when_attempting_to_override_lib_config_param_from_other_lib[target:",
"tests/build/test_generate_config.py::test_target_list_params_can_be_added_to[target:",
"tests/build/test_generate_config.py::test_target_list_params_can_be_removed[target:",
"tests/build/test_generate_config.py::test_warns_when_attempting_to_override_nonexistent_param[target:",
"tests/build/test_generate_config.py::test_settings_from_multiple_libs_included[target:",
"tests/build/test_generate_config.py::test_requires_config_option",
"tests/build/test_generate_config.py::test_target_requires_config_option",
"tests/build/test_generate_config.py::test_config_parsed_when_mbed_os_outside_project_root[target:"
] |
[] |
Apache License 2.0
| null |
ARMmbed__mbed-tools-285
|
ff2da40abec773902b6fda86d36de154d83a7d9f
|
2021-05-24 18:08:57
|
ff2da40abec773902b6fda86d36de154d83a7d9f
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/285?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) Report
> Merging [#285](https://codecov.io/gh/ARMmbed/mbed-tools/pull/285?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (0fa678f) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/71e9707b908c393691a4e509ced90ce608e68b81?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (71e9707) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/285?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed)
```diff
@@ Coverage Diff @@
## master #285 +/- ##
=======================================
Coverage 97.12% 97.12%
=======================================
Files 92 92
Lines 2813 2815 +2
=======================================
+ Hits 2732 2734 +2
Misses 81 81
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/285?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) | Coverage Δ | |
|---|---|---|
| [...ls/build/\_internal/config/assemble\_build\_config.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/285/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2NvbmZpZy9hc3NlbWJsZV9idWlsZF9jb25maWcucHk=) | `100.00% <ø> (ø)` | |
| [src/mbed\_tools/build/\_internal/find\_files.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/285/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvYnVpbGQvX2ludGVybmFsL2ZpbmRfZmlsZXMucHk=) | `100.00% <100.00%> (ø)` | |
|
diff --git a/news/20210524175020.bugfix b/news/20210524175020.bugfix
new file mode 100644
index 0000000..e9b7b63
--- /dev/null
+++ b/news/20210524175020.bugfix
@@ -0,0 +1,1 @@
+Avoid searching config file paths twice when mbed-os-path is used and it is a subdirectory of the project path.
diff --git a/src/mbed_tools/build/_internal/config/assemble_build_config.py b/src/mbed_tools/build/_internal/config/assemble_build_config.py
index 676bc4a..e61cd9c 100644
--- a/src/mbed_tools/build/_internal/config/assemble_build_config.py
+++ b/src/mbed_tools/build/_internal/config/assemble_build_config.py
@@ -33,7 +33,11 @@ def assemble_config(target_attributes: dict, search_paths: Iterable[Path], mbed_
mbed_app_file: The path to mbed_app.json. This can be None.
"""
mbed_lib_files = list(
- set(itertools.chain.from_iterable(find_files("mbed_lib.json", path) for path in search_paths))
+ set(
+ itertools.chain.from_iterable(
+ find_files("mbed_lib.json", path.absolute().resolve()) for path in search_paths
+ )
+ )
)
return _assemble_config_from_sources(target_attributes, mbed_lib_files, mbed_app_file)
diff --git a/src/mbed_tools/build/_internal/find_files.py b/src/mbed_tools/build/_internal/find_files.py
index 9f663bb..1dba384 100644
--- a/src/mbed_tools/build/_internal/find_files.py
+++ b/src/mbed_tools/build/_internal/find_files.py
@@ -52,6 +52,9 @@ def _find_files(filename: str, directory: Path, filters: Optional[List[Callable]
filtered_children = filter_files(children, filters)
for child in filtered_children:
+ if child.is_symlink():
+ child = child.absolute().resolve()
+
if child.is_dir():
# If processed child is a directory, recurse with current set of filters
result += _find_files(filename, child, filters)
|
Does not compile with --mbed-os-path option
**Describe the bug**
As in title.
**To Reproduce**
Steps to reproduce the behavior:
1. Import an example project.
1. mbed-tools compile -m K64F -t GCC_ARM --mbed-os-path mbed-os
Error:
`ValueError: Setting storage_filesystem.rbp_internal_size already defined. You cannot duplicate config settings!`
The setting name changes every time the command is executed.
**Expected behavior**
Should work.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: Windows
- Version: 10
**Mbed (please complete the following information):**
- Device: any
- Mbed OS Version: 6.9.0
- Mbed CLI 2 Version: 7.8.0
**Additional context**
I assume this has something to do with the dependencies. Here is my pipdeptree output:
```
mbed-tools==7.8.0
- Click [required: >=7.1,<8, installed: 7.1]
- GitPython [required: Any, installed: 3.1.14]
- gitdb [required: >=4.0.1,<5, installed: 4.0.5]
- smmap [required: >=3.0.1,<4, installed: 3.0.5]
- Jinja2 [required: Any, installed: 2.11.3]
- MarkupSafe [required: >=0.23, installed: 1.1.1]
- pdoc3 [required: Any, installed: 0.9.2]
- mako [required: Any, installed: 1.1.4]
- MarkupSafe [required: >=0.9.2, installed: 1.1.1]
- markdown [required: >=3.0, installed: 3.3.4]
- pyserial [required: Any, installed: 3.5]
- python-dotenv [required: Any, installed: 0.15.0]
- pywin32 [required: Any, installed: 300]
- requests [required: >=2.20, installed: 2.25.1]
- certifi [required: >=2017.4.17, installed: 2020.12.5]
- chardet [required: >=3.0.2,<5, installed: 4.0.0]
- idna [required: >=2.5,<3, installed: 2.10]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.4]
- tabulate [required: Any, installed: 0.8.9]
- tqdm [required: Any, installed: 4.59.0]
- typing-extensions [required: Any, installed: 3.7.4.3]
```
|
ARMmbed/mbed-tools
|
diff --git a/tests/build/_internal/config/test_assemble_build_config.py b/tests/build/_internal/config/test_assemble_build_config.py
index 79acb8d..47fcc5f 100644
--- a/tests/build/_internal/config/test_assemble_build_config.py
+++ b/tests/build/_internal/config/test_assemble_build_config.py
@@ -6,7 +6,7 @@ import json
from pathlib import Path
from tempfile import TemporaryDirectory
-from mbed_tools.build._internal.config.assemble_build_config import _assemble_config_from_sources
+from mbed_tools.build._internal.config.assemble_build_config import _assemble_config_from_sources, assemble_config
from mbed_tools.build._internal.config.config import Config
from mbed_tools.build._internal.find_files import find_files
from mbed_tools.build._internal.config.source import prepare
@@ -157,3 +157,47 @@ class TestAssembleConfigFromSourcesAndLibFiles:
assert config["extra_labels"] == {"EXTRA_HOT"}
assert config["labels"] == {"A", "PICKLE"}
assert config["macros"] == {"TICKER", "RED_MACRO"}
+
+ def test_ignores_duplicate_paths_to_lib_files(self, tmp_path, monkeypatch):
+ target = {
+ "labels": {"A"},
+ }
+ mbed_lib_files = [
+ {
+ "path": Path("mbed-os", "TARGET_A", "mbed_lib.json"),
+ "json_contents": {"name": "a", "config": {"a": {"value": 4}}},
+ },
+ ]
+ _ = create_files(tmp_path, mbed_lib_files)
+ monkeypatch.chdir(tmp_path)
+
+ config = assemble_config(target, [tmp_path, Path("mbed-os")], None)
+
+ assert config["config"][0].name == "a"
+ assert config["config"][0].value == 4
+
+ def test_does_not_search_symlinks_in_proj_dir_twice(self, tmp_path, monkeypatch):
+ target = {
+ "labels": {"A"},
+ }
+ mbed_lib_files = [
+ {
+ "path": Path("mbed-os", "TARGET_A", "mbed_lib.json"),
+ "json_contents": {"name": "a", "config": {"a": {"value": 4}}},
+ },
+ ]
+ project_dir = tmp_path / "project"
+ project_dir.mkdir()
+
+ mbed_os_dir = tmp_path / "other" / "mbed-os"
+ mbed_os_dir.mkdir(parents=True)
+ _ = create_files(mbed_os_dir, mbed_lib_files)
+
+ monkeypatch.chdir(project_dir)
+ mbed_symlink = Path("mbed-os")
+ mbed_symlink.symlink_to(mbed_os_dir, target_is_directory=True)
+
+ config = assemble_config(target, [project_dir, mbed_symlink], None)
+
+ assert config["config"][0].name == "a"
+ assert config["config"][0].value == 4
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 1
},
"num_modified_files": 2
}
|
7.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-xdist"
],
"pre_install": [],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
execnet==2.1.1
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.2.0
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@ff2da40abec773902b6fda86d36de154d83a7d9f#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- execnet==2.1.1
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.2.0
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.16.1.dev2
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/build/_internal/config/test_assemble_build_config.py::TestAssembleConfigFromSourcesAndLibFiles::test_ignores_duplicate_paths_to_lib_files",
"tests/build/_internal/config/test_assemble_build_config.py::TestAssembleConfigFromSourcesAndLibFiles::test_does_not_search_symlinks_in_proj_dir_twice"
] |
[] |
[
"tests/build/_internal/config/test_assemble_build_config.py::TestAssembleConfigFromSourcesAndLibFiles::test_assembles_config_using_all_relevant_files",
"tests/build/_internal/config/test_assemble_build_config.py::TestAssembleConfigFromSourcesAndLibFiles::test_updates_target_labels_from_config"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-285
|
ARMmbed__mbed-tools-288
|
673552826ac7e1e60477e8a212a522412e45ef7e
|
2021-05-25 13:50:10
|
673552826ac7e1e60477e8a212a522412e45ef7e
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/288?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) Report
> Merging [#288](https://codecov.io/gh/ARMmbed/mbed-tools/pull/288?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (0b72511) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/71e9707b908c393691a4e509ced90ce608e68b81?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (71e9707) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/288?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed)
```diff
@@ Coverage Diff @@
## master #288 +/- ##
=======================================
Coverage 97.12% 97.12%
=======================================
Files 92 92
Lines 2813 2819 +6
=======================================
+ Hits 2732 2738 +6
Misses 81 81
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/288?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/cli/configure.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/288/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvY2xpL2NvbmZpZ3VyZS5weQ==) | `100.00% <100.00%> (ø)` | |
rwalton-arm: Thanks for the PR. Could you squash the commit "Fix flake8 linter offenses" so the history is clean? We merge the patchset as is, and we'd prefer not to have "fixup" commits in the history. You'll also need to rebase as the branch is out of date with the base branch.
g-arjones: No problem. Updated...
g-arjones: Done.
g-arjones: Did I miss anything?
g-arjones: Rebased.
rwalton-arm: We had an automated release this morning and the branch is out of date again. Sorry! If you could rebase one more time we will get this in today.
g-arjones: Rebased, again.
|
diff --git a/news/286.bugfix b/news/286.bugfix
new file mode 100644
index 0000000..745bfb1
--- /dev/null
+++ b/news/286.bugfix
@@ -0,0 +1,1 @@
+Properly handle --custom-targets-json in configure sub command
diff --git a/news/287.bugfix b/news/287.bugfix
new file mode 100644
index 0000000..586d532
--- /dev/null
+++ b/news/287.bugfix
@@ -0,0 +1,1 @@
+Allow choosing output directory in configure sub command
diff --git a/src/mbed_tools/cli/configure.py b/src/mbed_tools/cli/configure.py
index 71e2c79..553266e 100644
--- a/src/mbed_tools/cli/configure.py
+++ b/src/mbed_tools/cli/configure.py
@@ -14,6 +14,9 @@ from mbed_tools.build import generate_config
@click.command(
help="Generate an Mbed OS config CMake file and write it to a .mbedbuild folder in the program directory."
)
[email protected](
+ "--custom-targets-json", type=click.Path(), default=None, help="Path to custom_targets.json.",
+)
@click.option(
"-t",
"--toolchain",
@@ -22,6 +25,7 @@ from mbed_tools.build import generate_config
help="The toolchain you are using to build your app.",
)
@click.option("-m", "--mbed-target", required=True, help="A build target for an Mbed-enabled device, eg. K64F")
[email protected]("-o", "--output-dir", type=click.Path(), default=None, help="Path to output directory.")
@click.option(
"-p",
"--program-path",
@@ -32,7 +36,9 @@ from mbed_tools.build import generate_config
@click.option(
"--mbed-os-path", type=click.Path(), default=None, help="Path to local Mbed OS directory.",
)
-def configure(toolchain: str, mbed_target: str, program_path: str, mbed_os_path: str) -> None:
+def configure(
+ toolchain: str, mbed_target: str, program_path: str, mbed_os_path: str, output_dir: str, custom_targets_json: str
+) -> None:
"""Exports a mbed_config.cmake file to build directory in the program root.
The parameters set in the CMake file will be dependent on the combination of
@@ -43,16 +49,23 @@ def configure(toolchain: str, mbed_target: str, program_path: str, mbed_os_path:
exist.
Args:
+ custom_targets_json: the path to custom_targets.json
toolchain: the toolchain you are using (eg. GCC_ARM, ARM)
mbed_target: the target you are building for (eg. K64F)
program_path: the path to the local Mbed program
mbed_os_path: the path to the local Mbed OS directory
+ output_dir: the path to the output directory
"""
cmake_build_subdir = pathlib.Path(mbed_target.upper(), "develop", toolchain.upper())
if mbed_os_path is None:
program = MbedProgram.from_existing(pathlib.Path(program_path), cmake_build_subdir)
else:
program = MbedProgram.from_existing(pathlib.Path(program_path), cmake_build_subdir, pathlib.Path(mbed_os_path))
+ if custom_targets_json is not None:
+ program.files.custom_targets_json = pathlib.Path(custom_targets_json)
+ if output_dir is not None:
+ program.files.cmake_build_dir = pathlib.Path(output_dir)
+
mbed_target = mbed_target.upper()
output_path = generate_config(mbed_target, toolchain, program)
click.echo(f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'")
|
Allow setting custom output directory in "configure" sub command
**Is your feature request related to a problem? Please describe.**
I use a custom build tool (that calls cmake under the hood) to build packages in my project. The fact mbed-tools use such an unusual build directory makes things awkward to integrate.
**Describe the solution you'd like**
It would be great if mbed-tools could allow passing an "-o/--output-dir" option to configure that would allow us to customize where mbed_config.cmake will be written to.
**Describe alternatives you've considered**
Heuristically trying to find out where mbed_config.cmake was generated and moving to an appropriate location. This solution is suboptimal, at best.
|
ARMmbed/mbed-tools
|
diff --git a/tests/cli/test_configure.py b/tests/cli/test_configure.py
index edb2341..a0c61fd 100644
--- a/tests/cli/test_configure.py
+++ b/tests/cli/test_configure.py
@@ -2,6 +2,8 @@
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
+import pathlib
+
from unittest import TestCase, mock
from click.testing import CliRunner
@@ -23,3 +25,25 @@ class TestConfigureCommand(TestCase):
CliRunner().invoke(configure, ["-m", "k64f", "-t", "gcc_arm", "--mbed-os-path", "./extern/mbed-os"])
generate_config.assert_called_once_with("K64F", "GCC_ARM", program.from_existing())
+
+ @mock.patch("mbed_tools.cli.configure.generate_config")
+ @mock.patch("mbed_tools.cli.configure.MbedProgram")
+ def test_custom_targets_location_used_when_passed(self, program, generate_config):
+ program = program.from_existing()
+ custom_targets_json_path = pathlib.Path("custom", "custom_targets.json")
+ CliRunner().invoke(
+ configure, ["-t", "gcc_arm", "-m", "k64f", "--custom-targets-json", custom_targets_json_path]
+ )
+
+ generate_config.assert_called_once_with("K64F", "GCC_ARM", program)
+ self.assertEqual(program.files.custom_targets_json, custom_targets_json_path)
+
+ @mock.patch("mbed_tools.cli.configure.generate_config")
+ @mock.patch("mbed_tools.cli.configure.MbedProgram")
+ def test_custom_output_directory_used_when_passed(self, program, generate_config):
+ program = program.from_existing()
+ output_dir = pathlib.Path("build")
+ CliRunner().invoke(configure, ["-t", "gcc_arm", "-m", "k64f", "-o", output_dir])
+
+ generate_config.assert_called_once_with("K64F", "GCC_ARM", program)
+ self.assertEqual(program.files.cmake_build_dir, output_dir)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 1
}
|
7.19
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock"
],
"pre_install": [],
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@673552826ac7e1e60477e8a212a522412e45ef7e#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.19.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/cli/test_configure.py::TestConfigureCommand::test_custom_output_directory_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_custom_targets_location_used_when_passed"
] |
[] |
[
"tests/cli/test_configure.py::TestConfigureCommand::test_generate_config_called_with_correct_arguments",
"tests/cli/test_configure.py::TestConfigureCommand::test_generate_config_called_with_mbed_os_path"
] |
[] |
Apache License 2.0
| null |
ARMmbed__mbed-tools-292
|
f55d2eb5f6aec73e33a85331c82d0d3d71cc09b4
|
2021-06-22 11:53:33
|
f55d2eb5f6aec73e33a85331c82d0d3d71cc09b4
|
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/292?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) Report
> Merging [#292](https://codecov.io/gh/ARMmbed/mbed-tools/pull/292?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (4e5e512) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/01091ed475998210b592852a4f00cde71a24b0e9?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (01091ed) will **decrease** coverage by `0.02%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/292?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed)
```diff
@@ Coverage Diff @@
## master #292 +/- ##
==========================================
- Coverage 97.08% 97.05% -0.03%
==========================================
Files 92 92
Lines 2779 2785 +6
==========================================
+ Hits 2698 2703 +5
- Misses 81 82 +1
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/292?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/cli/build.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvY2xpL2J1aWxkLnB5) | `98.46% <100.00%> (-1.54%)` | :arrow_down: |
| [src/mbed\_tools/cli/configure.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvY2xpL2NvbmZpZ3VyZS5weQ==) | `100.00% <100.00%> (ø)` | |
LDong-Arm: The Travis failure has nothing to do with this PR or mbed-tools. I've created a fix for it: https://github.com/ARMmbed/mbed-os/pull/14829
LDong-Arm: Rebased and updated commit message
|
diff --git a/news/291.bugfix b/news/291.bugfix
new file mode 100644
index 0000000..c7487e4
--- /dev/null
+++ b/news/291.bugfix
@@ -0,0 +1,1 @@
+Add an option `--app-config` to `configure` and `build` commands to allow users to specify an application configuration file.
diff --git a/src/mbed_tools/cli/build.py b/src/mbed_tools/cli/build.py
index f548d60..60d2e06 100644
--- a/src/mbed_tools/cli/build.py
+++ b/src/mbed_tools/cli/build.py
@@ -22,9 +22,10 @@ from mbed_tools.sterm import terminal
"-t",
"--toolchain",
type=click.Choice(["ARM", "GCC_ARM"], case_sensitive=False),
+ required=True,
help="The toolchain you are using to build your app.",
)
[email protected]("-m", "--mbed-target", help="A build target for an Mbed-enabled device, e.g. K64F.")
[email protected]("-m", "--mbed-target", required=True, help="A build target for an Mbed-enabled device, e.g. K64F.")
@click.option("-b", "--profile", default="develop", help="The build type (release, develop or debug).")
@click.option("-c", "--clean", is_flag=True, default=False, help="Perform a clean build.")
@click.option(
@@ -39,6 +40,9 @@ from mbed_tools.sterm import terminal
@click.option(
"--custom-targets-json", type=click.Path(), default=None, help="Path to custom_targets.json.",
)
[email protected](
+ "--app-config", type=click.Path(), default=None, help="Path to application configuration file.",
+)
@click.option(
"-f", "--flash", is_flag=True, default=False, help="Flash the binary onto a device",
)
@@ -54,14 +58,15 @@ from mbed_tools.sterm import terminal
def build(
program_path: str,
profile: str,
- toolchain: str = "",
- mbed_target: str = "",
- clean: bool = False,
- flash: bool = False,
- sterm: bool = False,
- baudrate: int = 9600,
- mbed_os_path: str = None,
- custom_targets_json: str = None,
+ toolchain: str,
+ mbed_target: str,
+ clean: bool,
+ flash: bool,
+ sterm: bool,
+ baudrate: int,
+ mbed_os_path: str,
+ custom_targets_json: str,
+ app_config: str,
) -> None:
"""Configure and build an Mbed project using CMake and Ninja.
@@ -75,12 +80,12 @@ def build(
custom_targets_json: Path to custom_targets.json.
toolchain: The toolchain to use for the build.
mbed_target: The name of the Mbed target to build for.
+ app_config: the path to the application configuration file
clean: Perform a clean build.
flash: Flash the binary onto a device.
sterm: Open a serial terminal to the connected target.
baudrate: Change the serial baud rate (ignored unless --sterm is also given).
"""
- _validate_target_and_toolchain_args(mbed_target, toolchain)
mbed_target, target_id = _get_target_id(mbed_target)
cmake_build_subdir = pathlib.Path(mbed_target.upper(), profile.lower(), toolchain.upper())
@@ -95,6 +100,8 @@ def build(
click.echo("Configuring project and generating build system...")
if custom_targets_json is not None:
program.files.custom_targets_json = pathlib.Path(custom_targets_json)
+ if app_config is not None:
+ program.files.app_config_file = pathlib.Path(app_config)
config, _ = generate_config(mbed_target.upper(), toolchain, program)
generate_build_system(program.root, build_tree, profile)
@@ -124,13 +131,6 @@ def build(
terminal.run(dev.serial_port, baudrate)
-def _validate_target_and_toolchain_args(target: str, toolchain: str) -> None:
- if not all([toolchain, target]):
- raise click.UsageError(
- "Both --toolchain and --mbed-target arguments are required when using the compile subcommand."
- )
-
-
def _get_target_id(target: str) -> Tuple[str, Optional[int]]:
if "[" in target:
target_name, target_id = target.replace("]", "").split("[", maxsplit=1)
diff --git a/src/mbed_tools/cli/configure.py b/src/mbed_tools/cli/configure.py
index e7279d6..360c389 100644
--- a/src/mbed_tools/cli/configure.py
+++ b/src/mbed_tools/cli/configure.py
@@ -36,8 +36,17 @@ from mbed_tools.build import generate_config
@click.option(
"--mbed-os-path", type=click.Path(), default=None, help="Path to local Mbed OS directory.",
)
[email protected](
+ "--app-config", type=click.Path(), default=None, help="Path to application configuration file.",
+)
def configure(
- toolchain: str, mbed_target: str, program_path: str, mbed_os_path: str, output_dir: str, custom_targets_json: str
+ toolchain: str,
+ mbed_target: str,
+ program_path: str,
+ mbed_os_path: str,
+ output_dir: str,
+ custom_targets_json: str,
+ app_config: str
) -> None:
"""Exports a mbed_config.cmake file to build directory in the program root.
@@ -55,6 +64,7 @@ def configure(
program_path: the path to the local Mbed program
mbed_os_path: the path to the local Mbed OS directory
output_dir: the path to the output directory
+ app_config: the path to the application configuration file
"""
cmake_build_subdir = pathlib.Path(mbed_target.upper(), "develop", toolchain.upper())
if mbed_os_path is None:
@@ -65,6 +75,8 @@ def configure(
program.files.custom_targets_json = pathlib.Path(custom_targets_json)
if output_dir is not None:
program.files.cmake_build_dir = pathlib.Path(output_dir)
+ if app_config is not None:
+ program.files.app_config_file = pathlib.Path(app_config)
mbed_target = mbed_target.upper()
_, output_path = generate_config(mbed_target, toolchain, program)
|
Missing `--app-config` option
**Describe the bug**
Mbed CLI 1 offers an `--app-config` option to let users specify the application configuration JSON instead of assuming `mbed_app.json`. This is not currently provided by mbed-tools, but useful when
* one application provides multiple configurations for different use cases
* different applications or tests share one common configuration (e.g. [experimental.json](https://github.com/ARMmbed/mbed-os/blob/master/TESTS/configs/experimental.json))
**To Reproduce**
Try to build an application (e.g. blinky) with `--app-config`, for example
```
mbed-tools compile -t GCC_ARM -m K64F --app-config mbed-os/TESTS/configs/experimental.json
```
and the error is
```
Error: no such option: --app-config
```
**Expected behavior**
An option `--app-config` is available to both `mbed-tools configure` and `mbed-tools compile`. The specified JSON is used for generating `mbed_config.cmake`.
**Screenshots**
N/A
**Desktop (please complete the following information):**
- OS: Any
- Version: Any
**Mbed (please complete the following information):**
- Device: Any
- Mbed OS Version: 6.11.0
- Mbed CLI 2 Version: 7.23.0
**Additional context**
N/A
|
ARMmbed/mbed-tools
|
diff --git a/tests/cli/test_build.py b/tests/cli/test_build.py
index 860d275..d680ee9 100644
--- a/tests/cli/test_build.py
+++ b/tests/cli/test_build.py
@@ -116,18 +116,6 @@ class TestBuildCommand(TestCase):
self.assertIsNotNone(result.exception)
self.assertRegex(result.output, "--mbed-target")
- def test_raises_if_gen_config_target_toolchain_not_passed(
- self, generate_config, mbed_program, build_project, generate_build_system
- ):
- program = mbed_program.from_existing()
- with mock_project_directory(program):
- runner = CliRunner()
- result = runner.invoke(build)
-
- self.assertIsNotNone(result.exception)
- self.assertRegex(result.output, "--mbed-target")
- self.assertRegex(result.output, "--toolchain")
-
def test_raises_if_target_identifier_not_int(
self, generate_config, mbed_program, build_project, generate_build_system
):
@@ -183,6 +171,21 @@ class TestBuildCommand(TestCase):
generate_config.assert_called_once_with(target.upper(), toolchain.upper(), program)
self.assertEqual(program.files.custom_targets_json, custom_targets_json_path)
+ def test_app_config_used_when_passed(
+ self, generate_config, mbed_program, build_project, generate_build_system
+ ):
+ program = mbed_program.from_existing()
+ with mock_project_directory(program, mbed_config_exists=True, build_tree_exists=True):
+ toolchain = "gcc_arm"
+ target = "k64f"
+ app_config_path = pathlib.Path("alternative_config.json")
+
+ runner = CliRunner()
+ runner.invoke(build, ["-t", toolchain, "-m", target, "--app-config", app_config_path])
+
+ generate_config.assert_called_once_with(target.upper(), toolchain.upper(), program)
+ self.assertEqual(program.files.app_config_file, app_config_path)
+
def test_build_folder_removed_when_clean_flag_passed(
self, generate_config, mbed_program, build_project, generate_build_system
):
diff --git a/tests/cli/test_configure.py b/tests/cli/test_configure.py
index a0c61fd..2ae90b1 100644
--- a/tests/cli/test_configure.py
+++ b/tests/cli/test_configure.py
@@ -47,3 +47,15 @@ class TestConfigureCommand(TestCase):
generate_config.assert_called_once_with("K64F", "GCC_ARM", program)
self.assertEqual(program.files.cmake_build_dir, output_dir)
+
+ @mock.patch("mbed_tools.cli.configure.generate_config")
+ @mock.patch("mbed_tools.cli.configure.MbedProgram")
+ def test_app_config_used_when_passed(self, program, generate_config):
+ program = program.from_existing()
+ app_config_path = pathlib.Path("alternative_config.json")
+ CliRunner().invoke(
+ configure, ["-t", "gcc_arm", "-m", "k64f", "--app-config", app_config_path]
+ )
+
+ generate_config.assert_called_once_with("K64F", "GCC_ARM", program)
+ self.assertEqual(program.files.app_config_file, app_config_path)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
7.26
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-test.txt",
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.2.0
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@f55d2eb5f6aec73e33a85331c82d0d3d71cc09b4#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.2.0
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.26.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/cli/test_build.py::TestBuildCommand::test_app_config_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_app_config_used_when_passed"
] |
[] |
[
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_both_two_devices",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_only_identifier_device",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_options_bin_target",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_options_hex_target",
"tests/cli/test_build.py::TestBuildCommand::test_build_folder_removed_when_clean_flag_passed",
"tests/cli/test_build.py::TestBuildCommand::test_build_system_regenerated_when_mbed_os_path_passed",
"tests/cli/test_build.py::TestBuildCommand::test_calls_generate_build_system_if_build_tree_nonexistent",
"tests/cli/test_build.py::TestBuildCommand::test_custom_targets_location_used_when_passed",
"tests/cli/test_build.py::TestBuildCommand::test_generate_config_called_if_config_script_nonexistent",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_device_does_not_have_serial_port_and_sterm_flag_given",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_gen_config_target_not_passed_when_required",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_gen_config_toolchain_not_passed_when_required",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_target_identifier_negative",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_target_identifier_not_int",
"tests/cli/test_build.py::TestBuildCommand::test_searches_for_mbed_program_at_default_project_path",
"tests/cli/test_build.py::TestBuildCommand::test_searches_for_mbed_program_at_user_defined_project_root",
"tests/cli/test_build.py::TestBuildCommand::test_sterm_is_started_when_flag_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_custom_output_directory_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_custom_targets_location_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_generate_config_called_with_correct_arguments",
"tests/cli/test_configure.py::TestConfigureCommand::test_generate_config_called_with_mbed_os_path"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-292
|
ARMmbed__mbed-tools-293
|
a97be74fef509c90c820c9a96961377e14412c92
|
2021-06-30 14:52:52
|
a97be74fef509c90c820c9a96961377e14412c92
|
LDong-Arm: I first made the fix locally while working on #292 (`--app-config`) as they are quite similar, but decided to not include this there as more time was needed to add a test. Now it's done here.
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/293?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) Report
> Merging [#293](https://codecov.io/gh/ARMmbed/mbed-tools/pull/293?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (71eea10) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/4047136e0052c97bc5e19a04de65425a29edca5a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) (4047136) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/293?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed)
```diff
@@ Coverage Diff @@
## master #293 +/- ##
=======================================
Coverage 97.08% 97.08%
=======================================
Files 92 92
Lines 2781 2782 +1
=======================================
+ Hits 2700 2701 +1
Misses 81 81
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/293?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/cli/configure.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/293/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ARMmbed#diff-c3JjL21iZWRfdG9vbHMvY2xpL2NvbmZpZ3VyZS5weQ==) | `100.00% <100.00%> (ø)` | |
LDong-Arm: @ARMmbed/mbed-os-core
rwalton-arm: Travis timed out. Could you force push to trigger it again?
LDong-Arm: > Travis timed out. Could you force push to trigger it again?
Done. Waiting for CI to finish.
|
diff --git a/news/262.bugfix b/news/262.bugfix
new file mode 100644
index 0000000..a438a13
--- /dev/null
+++ b/news/262.bugfix
@@ -0,0 +1,1 @@
+Add `-b`, `--profile` to the `configure` subcommand for specifying build profile.
diff --git a/src/mbed_tools/cli/configure.py b/src/mbed_tools/cli/configure.py
index 360c389..24b49d8 100644
--- a/src/mbed_tools/cli/configure.py
+++ b/src/mbed_tools/cli/configure.py
@@ -25,6 +25,7 @@ from mbed_tools.build import generate_config
help="The toolchain you are using to build your app.",
)
@click.option("-m", "--mbed-target", required=True, help="A build target for an Mbed-enabled device, eg. K64F")
[email protected]("-b", "--profile", default="develop", help="The build type (release, develop or debug).")
@click.option("-o", "--output-dir", type=click.Path(), default=None, help="Path to output directory.")
@click.option(
"-p",
@@ -42,6 +43,7 @@ from mbed_tools.build import generate_config
def configure(
toolchain: str,
mbed_target: str,
+ profile: str,
program_path: str,
mbed_os_path: str,
output_dir: str,
@@ -61,12 +63,13 @@ def configure(
custom_targets_json: the path to custom_targets.json
toolchain: the toolchain you are using (eg. GCC_ARM, ARM)
mbed_target: the target you are building for (eg. K64F)
+ profile: The Mbed build profile (debug, develop or release).
program_path: the path to the local Mbed program
mbed_os_path: the path to the local Mbed OS directory
output_dir: the path to the output directory
app_config: the path to the application configuration file
"""
- cmake_build_subdir = pathlib.Path(mbed_target.upper(), "develop", toolchain.upper())
+ cmake_build_subdir = pathlib.Path(mbed_target.upper(), profile.lower(), toolchain.upper())
if mbed_os_path is None:
program = MbedProgram.from_existing(pathlib.Path(program_path), cmake_build_subdir)
else:
|
`mbed-tools configure` generates `mbed_config.cmake` under `develop`, and doesn't have a `-b` option
From the PR description and commit msg, it says that configs and builds should now live under `cmake_build/TARGET/PROFILE/TOOLCHAIN`, but this line makes `mbed-tools configure` always generate the `mbed_config.cmake` under `cmake_build/TARGET/develop/TOOLCHAIN`. Why is this?
_Originally posted by @wmmc88 in https://github.com/ARMmbed/mbed-tools/pull/175#discussion_r606712097_
|
ARMmbed/mbed-tools
|
diff --git a/tests/cli/test_build.py b/tests/cli/test_build.py
index d680ee9..42e5852 100644
--- a/tests/cli/test_build.py
+++ b/tests/cli/test_build.py
@@ -186,6 +186,29 @@ class TestBuildCommand(TestCase):
generate_config.assert_called_once_with(target.upper(), toolchain.upper(), program)
self.assertEqual(program.files.app_config_file, app_config_path)
+ def test_profile_used_when_passed(
+ self, generate_config, mbed_program, build_project, generate_build_system
+ ):
+ program = mbed_program.from_existing()
+ mbed_program.reset_mock() # clear call count from previous line
+
+ with mock_project_directory(program, mbed_config_exists=True, build_tree_exists=True):
+ generate_config.return_value = [mock.MagicMock(), mock.MagicMock()]
+
+ toolchain = "gcc_arm"
+ target = "k64f"
+ profile = "release"
+
+ runner = CliRunner()
+ runner.invoke(build, ["-t", toolchain, "-m", target, "--profile", profile])
+
+ mbed_program.from_existing.assert_called_once_with(
+ pathlib.Path(os.getcwd()),
+ pathlib.Path(target.upper(), profile, toolchain.upper())
+ )
+ generate_config.assert_called_once_with(target.upper(), toolchain.upper(), program)
+ generate_build_system.assert_called_once_with(program.root, program.files.cmake_build_dir, profile)
+
def test_build_folder_removed_when_clean_flag_passed(
self, generate_config, mbed_program, build_project, generate_build_system
):
diff --git a/tests/cli/test_configure.py b/tests/cli/test_configure.py
index 2ae90b1..0483e99 100644
--- a/tests/cli/test_configure.py
+++ b/tests/cli/test_configure.py
@@ -59,3 +59,23 @@ class TestConfigureCommand(TestCase):
generate_config.assert_called_once_with("K64F", "GCC_ARM", program)
self.assertEqual(program.files.app_config_file, app_config_path)
+
+ @mock.patch("mbed_tools.cli.configure.generate_config")
+ @mock.patch("mbed_tools.cli.configure.MbedProgram")
+ def test_profile_used_when_passed(self, program, generate_config):
+ test_program = program.from_existing()
+ program.reset_mock() # clear call count from previous line
+
+ toolchain = "gcc_arm"
+ target = "k64f"
+ profile = "release"
+
+ CliRunner().invoke(
+ configure, ["-t", toolchain, "-m", target, "--profile", profile]
+ )
+
+ program.from_existing.assert_called_once_with(
+ pathlib.Path("."),
+ pathlib.Path(target.upper(), profile, toolchain.upper())
+ )
+ generate_config.assert_called_once_with("K64F", "GCC_ARM", test_program)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
7.28
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"apt-get install -y cmake",
"apt-get install -y ninja-build"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1.2
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.2.0
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@a97be74fef509c90c820c9a96961377e14412c92#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1.2
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.2.0
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==7.28.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pyserial==3.5
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/cli/test_configure.py::TestConfigureCommand::test_profile_used_when_passed"
] |
[] |
[
"tests/cli/test_build.py::TestBuildCommand::test_app_config_used_when_passed",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_both_two_devices",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_only_identifier_device",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_options_bin_target",
"tests/cli/test_build.py::TestBuildCommand::test_build_flash_options_hex_target",
"tests/cli/test_build.py::TestBuildCommand::test_build_folder_removed_when_clean_flag_passed",
"tests/cli/test_build.py::TestBuildCommand::test_build_system_regenerated_when_mbed_os_path_passed",
"tests/cli/test_build.py::TestBuildCommand::test_calls_generate_build_system_if_build_tree_nonexistent",
"tests/cli/test_build.py::TestBuildCommand::test_custom_targets_location_used_when_passed",
"tests/cli/test_build.py::TestBuildCommand::test_generate_config_called_if_config_script_nonexistent",
"tests/cli/test_build.py::TestBuildCommand::test_profile_used_when_passed",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_device_does_not_have_serial_port_and_sterm_flag_given",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_gen_config_target_not_passed_when_required",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_gen_config_toolchain_not_passed_when_required",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_target_identifier_negative",
"tests/cli/test_build.py::TestBuildCommand::test_raises_if_target_identifier_not_int",
"tests/cli/test_build.py::TestBuildCommand::test_searches_for_mbed_program_at_default_project_path",
"tests/cli/test_build.py::TestBuildCommand::test_searches_for_mbed_program_at_user_defined_project_root",
"tests/cli/test_build.py::TestBuildCommand::test_sterm_is_started_when_flag_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_app_config_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_custom_output_directory_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_custom_targets_location_used_when_passed",
"tests/cli/test_configure.py::TestConfigureCommand::test_generate_config_called_with_correct_arguments",
"tests/cli/test_configure.py::TestConfigureCommand::test_generate_config_called_with_mbed_os_path"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-293
|
ARMmbed__mbed-tools-91
|
a188be5d23cdc1f5c7434b439e9afed50a75e8ad
|
2020-10-22 15:02:19
|
18434c76f9a68f87e418d65d57f33bae6b9fb7c9
|
jainvikas8: Rebased on latest mater
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91?src=pr&el=h1) Report
> Merging [#91](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91?src=pr&el=desc) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/a188be5d23cdc1f5c7434b439e9afed50a75e8ad?el=desc) will **increase** coverage by `0.99%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #91 +/- ##
==========================================
+ Coverage 95.44% 96.43% +0.99%
==========================================
Files 92 92
Lines 2522 2524 +2
==========================================
+ Hits 2407 2434 +27
+ Misses 115 90 -25
```
| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/project/\_internal/libraries.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9faW50ZXJuYWwvbGlicmFyaWVzLnB5) | `98.11% <100.00%> (+0.07%)` | :arrow_up: |
| [...ools/devices/\_internal/detect\_candidate\_devices.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvZGV2aWNlcy9faW50ZXJuYWwvZGV0ZWN0X2NhbmRpZGF0ZV9kZXZpY2VzLnB5) | `100.00% <0.00%> (+11.76%)` | :arrow_up: |
| [...d\_tools/devices/\_internal/linux/device\_detector.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/91/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvZGV2aWNlcy9faW50ZXJuYWwvbGludXgvZGV2aWNlX2RldGVjdG9yLnB5) | `100.00% <0.00%> (+82.14%)` | :arrow_up: |
|
diff --git a/news/66.bugfix b/news/66.bugfix
new file mode 100644
index 0000000..f920f1e
--- /dev/null
+++ b/news/66.bugfix
@@ -0,0 +1,1 @@
+Fix https to ssh redirection
diff --git a/src/mbed_tools/project/_internal/libraries.py b/src/mbed_tools/project/_internal/libraries.py
index cc417bf..abc4ccb 100644
--- a/src/mbed_tools/project/_internal/libraries.py
+++ b/src/mbed_tools/project/_internal/libraries.py
@@ -42,6 +42,10 @@ class MbedLibReference:
"""
raw_ref = self.reference_file.read_text().strip()
url, sep, ref = raw_ref.partition("#")
+
+ if url.endswith("/"):
+ url = url[:-1]
+
return git_utils.GitReference(repo_url=url, ref=ref)
|
mbedtools clone <example> fails
### Description
<!--
A detailed description of what is being reported. Please include steps to reproduce the problem.
Things to consider sharing:
- What version of the package is being used (pip show mbed-tools)?
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
-->
The clone command `mbedtools clone https://github.com/ARMmbed/mbed-os-example-blinky` fails with following error:
```
Cloning Mbed program 'https://github.com/ARMmbed/mbed-os-example-blinky'
Resolving program library dependencies.
ERROR: Cloning git repository from url 'https://github.com/ARMmbed/mbed-os/' failed. Error from VCS:
More information may be available by using the command line option '-v'.
```
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [x] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/project/_internal/test_project_data.py b/tests/project/_internal/test_project_data.py
index 51c0fad..6be1510 100644
--- a/tests/project/_internal/test_project_data.py
+++ b/tests/project/_internal/test_project_data.py
@@ -108,13 +108,15 @@ class TestMbedLibReference(TestCase):
root = pathlib.Path(fs, "foo")
url = "https://github.com/mylibrepo"
ref = "latest"
- full_ref = f"{url}#{ref}"
- lib = make_mbed_lib_reference(root, ref_url=full_ref)
+ references = [f"{url}#{ref}", f"{url}/#{ref}"]
- reference = lib.get_git_reference()
+ for full_ref in references:
+ lib = make_mbed_lib_reference(root, ref_url=full_ref)
- self.assertEqual(reference.repo_url, url)
- self.assertEqual(reference.ref, ref)
+ reference = lib.get_git_reference()
+
+ self.assertEqual(reference.repo_url, url)
+ self.assertEqual(reference.ref, ref)
class TestMbedOS(TestCase):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
3.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt",
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.2.0
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@a188be5d23cdc1f5c7434b439e9afed50a75e8ad#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.2.0
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==3.4.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/project/_internal/test_project_data.py::TestMbedLibReference::test_get_git_reference_returns_lib_file_contents"
] |
[] |
[
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_existing_calls_render_cmakelists_template_with_program_name_if_file_nonexistent",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_existing_finds_existing_program_data",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_existing_skips_rendering_cmake_template_if_file_exists",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_new_calls_render_template_for_gitignore_cmake_and_main",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_new_raises_if_program_files_already_exist",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_new_returns_valid_program_file_set",
"tests/project/_internal/test_project_data.py::TestMbedLibReference::test_is_resolved_returns_false_if_source_code_dir_doesnt_exist",
"tests/project/_internal/test_project_data.py::TestMbedLibReference::test_is_resolved_returns_true_if_source_code_dir_exists",
"tests/project/_internal/test_project_data.py::TestMbedOS::test_from_existing_finds_existing_mbed_os_data",
"tests/project/_internal/test_project_data.py::TestMbedOS::test_raises_if_files_missing"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_mbed-tools-91
|
ARMmbed__mbed-tools-92
|
49683ab6ab548f932bb790bf5a0b32e3f3d20fe2
|
2020-10-23 11:53:22
|
18434c76f9a68f87e418d65d57f33bae6b9fb7c9
|
diff --git a/.travis.yml b/.travis.yml
index 761e422..2e1058c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -99,7 +99,7 @@ matrix:
- <<: *mbed-tools-test
name: "Test ble example (NRF52840_DK)"
- env: EXAMPLE_NAME=mbed-os-example-ble TARGET_NAME=NRF52840_DK SUBEXAMPLE_NAME=BLE_Button CACHE_NAME=ble-ble-button-NRF52840_DK
+ env: EXAMPLE_NAME=mbed-os-example-ble TARGET_NAME=NRF52840_DK SUBEXAMPLE_NAME=BLE_LED CACHE_NAME=ble-ble-led-NRF52840_DK
- <<: *mbed-tools-test
name: "Test cellular example (WIO_3G)"
diff --git a/docs/howto/mbed-tools-howto.md b/docs/howto/mbed-tools-howto.md
index ca880bc..d1ea748 100644
--- a/docs/howto/mbed-tools-howto.md
+++ b/docs/howto/mbed-tools-howto.md
@@ -207,7 +207,7 @@ Use CMake to build your application:
We can use a single command which will configure (set up your target and toolchain) and build the project.
- 1. To build and configure:
+1. To build and configure:
```
mbed-tools build -m <target> -t <toolchain>
@@ -221,7 +221,7 @@ We can use a single command which will configure (set up your target and toolcha
mbed-tools build -m K64F -t GCC_ARM
```
- 1. To perform an iterative build on previously configured target:
+1. To perform an iterative build on previously configured target:
```
mbed-tools build
diff --git a/news/202010261000.doc b/news/202010261000.doc
new file mode 100644
index 0000000..367a400
--- /dev/null
+++ b/news/202010261000.doc
@@ -0,0 +1,1 @@
+Fix formatting issue in docs
diff --git a/news/202010261100.misc b/news/202010261100.misc
new file mode 100644
index 0000000..cc6bfdb
--- /dev/null
+++ b/news/202010261100.misc
@@ -0,0 +1,1 @@
+Update CI to use BLE LED example
diff --git a/news/62.bugfix b/news/62.bugfix
new file mode 100644
index 0000000..56b12d0
--- /dev/null
+++ b/news/62.bugfix
@@ -0,0 +1,1 @@
+Do not check for mbed-os.lib in MbedProgram::from_url as it was making clone fail on examples containing multiple programs.
diff --git a/news/66.bugfix b/news/66.bugfix
new file mode 100644
index 0000000..f920f1e
--- /dev/null
+++ b/news/66.bugfix
@@ -0,0 +1,1 @@
+Fix https to ssh redirection
diff --git a/src/mbed_tools/project/_internal/libraries.py b/src/mbed_tools/project/_internal/libraries.py
index cc417bf..4e95694 100644
--- a/src/mbed_tools/project/_internal/libraries.py
+++ b/src/mbed_tools/project/_internal/libraries.py
@@ -42,6 +42,10 @@ class MbedLibReference:
"""
raw_ref = self.reference_file.read_text().strip()
url, sep, ref = raw_ref.partition("#")
+
+ if url.endswith("/"):
+ url = url[:-1]
+
return git_utils.GitReference(repo_url=url, ref=ref)
@@ -50,7 +54,7 @@ class LibraryReferences:
"""Manages library references in an MbedProgram."""
root: Path
- ignore_paths: List[Path]
+ ignore_paths: List[str]
def resolve(self) -> None:
"""Recursively clone all dependencies defined in .lib files."""
@@ -106,4 +110,4 @@ class LibraryReferences:
def _in_ignore_path(self, lib_reference_path: Path) -> bool:
"""Check if a library reference is in a path we want to ignore."""
- return any(p in lib_reference_path.parents for p in self.ignore_paths)
+ return any(p in lib_reference_path.parts for p in self.ignore_paths)
diff --git a/src/mbed_tools/project/_internal/project_data.py b/src/mbed_tools/project/_internal/project_data.py
index 2ea7022..b956e8b 100644
--- a/src/mbed_tools/project/_internal/project_data.py
+++ b/src/mbed_tools/project/_internal/project_data.py
@@ -113,8 +113,7 @@ class MbedProgramFiles:
cmakelists_file = root_path / CMAKELISTS_FILE_NAME
if not cmakelists_file.exists():
- logger.warning("No CMakeLists.txt found in the program root. Creating it...")
- render_cmakelists_template(cmakelists_file, root_path.stem)
+ logger.warning("No CMakeLists.txt found in the program root.")
return cls(
app_config_file=app_config,
diff --git a/src/mbed_tools/project/mbed_program.py b/src/mbed_tools/project/mbed_program.py
index 4c7fda7..65e94fb 100644
--- a/src/mbed_tools/project/mbed_program.py
+++ b/src/mbed_tools/project/mbed_program.py
@@ -26,7 +26,6 @@ class MbedProgram:
"""Represents an Mbed program.
An `MbedProgram` consists of:
- * A git repository
* A copy of, or reference to, `MbedOS`
* A set of `MbedProgramFiles`
* A collection of references to external libraries, defined in .lib files located in the program source tree
@@ -42,38 +41,21 @@ class MbedProgram:
self.files = program_files
self.root = self.files.mbed_os_ref.parent
self.mbed_os = mbed_os
- self.lib_references = LibraryReferences(root=self.root, ignore_paths=[self.mbed_os.root])
+ self.lib_references = LibraryReferences(root=self.root, ignore_paths=[self.mbed_os.root.name])
@classmethod
- def from_url(cls, url: str, dst_path: Path, check_mbed_os: bool = True) -> "MbedProgram":
+ def from_url(cls, url: str, dst_path: Path) -> "MbedProgram":
"""Fetch an Mbed program from a remote URL.
Args:
url: URL of the remote program repository.
dst_path: Destination path for the cloned program.
-
- Raises:
- ExistingProgram: `dst_path` already contains an Mbed program.
"""
- if _tree_contains_program(dst_path):
- raise ExistingProgram(
- f"The destination path '{dst_path}' already contains an Mbed program. Please set the destination path "
- "to an empty directory."
- )
logger.info(f"Cloning Mbed program from URL '{url}'.")
git_utils.clone(url, dst_path)
-
program_files = MbedProgramFiles.from_existing(dst_path)
- if not program_files.mbed_os_ref.exists():
- raise ProgramNotFound(
- "This repository does not contain a valid Mbed program at the top level. "
- "Cloned programs must contain an mbed-os.lib file containing the URL to the Mbed OS repository. It is "
- "possible you have cloned a repository containing multiple mbed-programs. If this is the case, you "
- "should cd to a directory containing a program before performing any other operations."
- )
-
try:
- mbed_os = MbedOS.from_existing(dst_path / MBED_OS_DIR_NAME, check_mbed_os)
+ mbed_os = MbedOS.from_existing(dst_path / MBED_OS_DIR_NAME, False)
except ValueError as mbed_err:
raise MbedOSNotFound(f"{mbed_err}")
diff --git a/src/mbed_tools/project/project.py b/src/mbed_tools/project/project.py
index f8301cc..26e69b5 100644
--- a/src/mbed_tools/project/project.py
+++ b/src/mbed_tools/project/project.py
@@ -26,7 +26,7 @@ def clone_project(url: str, dst_path: Any = None, recursive: bool = False) -> No
if not dst_path:
dst_path = pathlib.Path(git_data["dst_path"])
- program = MbedProgram.from_url(url, dst_path, check_mbed_os=False)
+ program = MbedProgram.from_url(url, dst_path)
if recursive:
program.resolve_libraries()
|
Fix `mbed-os.lib` for the following examples
### Description
<!--
A detailed description of what is being reported. Please include steps to reproduce the problem.
Things to consider sharing:
- What version of the package is being used (pip show mbed-tools)?
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
-->
```
$mbed-tools -vvv clone mbed-os-example-ble
Cloning Mbed program 'mbed-os-example-ble'
Resolving program library dependencies.
DEBUG: Searching for mbed-os.lib file at path C:\Work\Workspace\trial\mbed-os-example-ble
DEBUG: Searching for mbed-os.lib file at path C:\Work\Workspace\trial
DEBUG: Searching for mbed-os.lib file at path C:\Work\Workspace
DEBUG: Searching for mbed-os.lib file at path C:\Work
DEBUG: No mbed-os.lib file found.
INFO: Cloning Mbed program from URL 'https://github.com/armmbed/mbed-os-example-ble'.
DEBUG: Failed checking if running in CYGWIN due to: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
DEBUG: Popen(['git', 'version'], cwd=c:\Work\Workspace\trial, universal_newlines=False, shell=None, istream=None)
DEBUG: Popen(['git', 'clone', '--progress', '-v', 'https://github.com/armmbed/mbed-os-example-ble', 'mbed-os-example-ble'], cwd=c:\Work\Workspace\trial, universal_newlines=True, shell=None, istream=None)
INFO: This program does not contain an mbed_app.json config file.
WARNING: No CMakeLists.txt found in the program root. Creating it...
ERROR: This repository does not contain a valid Mbed program at the top level. Cloned programs must contain an mbed-os.lib file containing the URL to the Mbed OS repository. It is possible you have cloned a repository containing multiple mbed-programs. If this is the case, you should cd to a directory containing a program before performing any other operations.
```
Following examples are effected
```
mbed-tools -vvv clone mbed-os-example-mbed-crypto
mbed-tools -vvv clone mbed-os-example-ble
mbed-tools -vvv clone mbed-os-example-nfc
```
mbed-os-example-ble example is the BLE_button one.
On
```
$mbed-tools --version
3.2.2
```
### Issue request type
<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).
For questions please use https://forums.mbed.com/
-->
- [ ] Enhancement
- [x ] Bug
|
ARMmbed/mbed-tools
|
diff --git a/tests/project/_internal/test_libraries.py b/tests/project/_internal/test_libraries.py
index 9bed897..76ee133 100644
--- a/tests/project/_internal/test_libraries.py
+++ b/tests/project/_internal/test_libraries.py
@@ -18,7 +18,7 @@ class TestLibraryReferences(TestCase):
lib = make_mbed_lib_reference(fs_root, ref_url="https://git")
mock_clone.side_effect = lambda url, dst_dir: dst_dir.mkdir()
- lib_refs = LibraryReferences(fs_root, ignore_paths=[fs_root / "mbed-os"])
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.resolve()
mock_clone.assert_called_once_with(lib.get_git_reference().repo_url, lib.source_code_path)
@@ -40,7 +40,7 @@ class TestLibraryReferences(TestCase):
lib2.source_code_path.mkdir(),
)
- lib_refs = LibraryReferences(fs_root, ignore_paths=[fs_root / "mbed-os"])
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.resolve()
self.assertTrue(lib.is_resolved())
@@ -53,7 +53,7 @@ class TestLibraryReferences(TestCase):
fs_root = pathlib.Path(fs, "foo")
make_mbed_lib_reference(fs_root, ref_url="https://git", resolved=True)
- lib_refs = LibraryReferences(fs_root, ignore_paths=[fs_root / "mbed-os"])
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.checkout(force=False)
mock_checkout.assert_not_called()
@@ -65,7 +65,7 @@ class TestLibraryReferences(TestCase):
fs_root = pathlib.Path(fs, "foo")
lib = make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234", resolved=True)
- lib_refs = LibraryReferences(fs_root, ignore_paths=[fs_root / "mbed-os"])
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.checkout(force=False)
mock_checkout.assert_called_once_with(mock_init.return_value, lib.get_git_reference().ref, force=False)
@@ -78,7 +78,7 @@ class TestLibraryReferences(TestCase):
make_mbed_lib_reference(fs_root, ref_url="https://git")
mock_clone.side_effect = lambda url, dst_dir: dst_dir.mkdir()
- lib_refs = LibraryReferences(fs_root, ignore_paths=[fs_root / "mbed-os"])
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.resolve()
mock_checkout.assert_not_called()
@@ -91,7 +91,19 @@ class TestLibraryReferences(TestCase):
lib = make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234")
mock_clone.side_effect = lambda url, dst_dir: dst_dir.mkdir()
- lib_refs = LibraryReferences(fs_root, ignore_paths=[fs_root / "mbed-os"])
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
lib_refs.resolve()
mock_checkout.assert_called_once_with(None, lib.get_git_reference().ref)
+
+ @patchfs
+ @mock.patch("mbed_tools.project._internal.git_utils.checkout", autospec=True)
+ @mock.patch("mbed_tools.project._internal.git_utils.init", autospec=True)
+ def test_does_not_resolve_references_in_ignore_paths(self, mock_init, mock_checkout, mock_clone, fs):
+ fs_root = pathlib.Path(fs, "mbed-os")
+ make_mbed_lib_reference(fs_root, ref_url="https://git#lajdhalk234")
+
+ lib_refs = LibraryReferences(fs_root, ignore_paths=["mbed-os"])
+ lib_refs.resolve()
+
+ mock_clone.assert_not_called()
diff --git a/tests/project/_internal/test_mbed_program.py b/tests/project/_internal/test_mbed_program.py
index fee3f18..39f8edc 100644
--- a/tests/project/_internal/test_mbed_program.py
+++ b/tests/project/_internal/test_mbed_program.py
@@ -61,44 +61,25 @@ class TestInitialiseProgram(TestCase):
self.assertEqual(program.files, MbedProgramFiles.from_existing(program_root))
@patchfs
- def test_from_url_raises_if_dest_dir_contains_program(self, fs):
+ @mock.patch("mbed_tools.project.mbed_program.git_utils.clone", autospec=True)
+ def test_from_url_returns_valid_program(self, mock_clone, fs):
fs_root = pathlib.Path(fs, "foo")
- make_mbed_program_files(fs_root)
url = "https://valid"
-
- with self.assertRaises(ExistingProgram):
- MbedProgram.from_url(url, fs_root)
-
- @patchfs
- @mock.patch("mbed_tools.project._internal.git_utils.clone", autospec=True)
- def test_from_url_raises_if_cloned_repo_is_not_program(self, mock_repo, fs):
- fs_root = pathlib.Path(fs, "foo")
- fs_root.mkdir()
- url = "https://validrepo.com"
- mock_repo.side_effect = lambda url, dst_dir: dst_dir.mkdir()
-
- with self.assertRaises(ProgramNotFound):
- MbedProgram.from_url(url, fs_root / "corrupt-prog")
-
- @patchfs
- @mock.patch("mbed_tools.project._internal.git_utils.clone", autospec=True)
- def test_from_url_raises_if_check_mbed_os_is_true_and_mbed_os_dir_nonexistent(self, mock_clone, fs):
- fs_root = pathlib.Path(fs, "foo")
- url = "https://validrepo.com"
mock_clone.side_effect = lambda *args: make_mbed_program_files(fs_root)
+ program = MbedProgram.from_url(url, fs_root)
- with self.assertRaises(MbedOSNotFound):
- MbedProgram.from_url(url, fs_root, check_mbed_os=True)
+ self.assertEqual(program.files, MbedProgramFiles.from_existing(fs_root))
+ mock_clone.assert_called_once_with(url, fs_root)
@patchfs
@mock.patch("mbed_tools.project.mbed_program.git_utils.clone", autospec=True)
- def test_from_url_returns_valid_program(self, mock_clone, fs):
+ def test_from_url_does_not_raise_with_odd_program_layout(self, mock_clone, fs):
fs_root = pathlib.Path(fs, "foo")
- url = "https://valid"
- mock_clone.side_effect = lambda *args: make_mbed_program_files(fs_root)
- program = MbedProgram.from_url(url, fs_root, False)
+ fs_root.mkdir()
+ url = "https://nested"
+ mock_clone.side_effect = lambda *args: make_mbed_program_files(fs_root / "nested")
+ MbedProgram.from_url(url, fs_root)
- self.assertEqual(program.files, MbedProgramFiles.from_existing(fs_root))
mock_clone.assert_called_once_with(url, fs_root)
@patchfs
diff --git a/tests/project/_internal/test_project_data.py b/tests/project/_internal/test_project_data.py
index 51c0fad..aaa59d1 100644
--- a/tests/project/_internal/test_project_data.py
+++ b/tests/project/_internal/test_project_data.py
@@ -10,7 +10,6 @@ from unittest import TestCase, mock
from mbed_tools.project._internal.project_data import (
MbedProgramFiles,
MbedOS,
- CMAKELISTS_FILE_NAME,
MAIN_CPP_FILE_NAME,
)
from tests.project.factories import make_mbed_lib_reference, make_mbed_program_files, make_mbed_os_files, patchfs
@@ -65,28 +64,6 @@ class TestMbedProgramFiles(TestCase):
self.assertTrue(program.mbed_os_ref.exists())
self.assertTrue(program.cmakelists_file.exists())
- @patchfs
- def test_from_existing_calls_render_cmakelists_template_with_program_name_if_file_nonexistent(self, fs):
- with mock.patch("mbed_tools.project._internal.project_data.render_cmakelists_template") as render_cmake:
- root = pathlib.Path(fs, "foo")
- make_mbed_program_files(root)
- render_cmake.return_value = "foo"
-
- program_files = MbedProgramFiles.from_existing(root)
-
- render_cmake.assert_called_with(program_files.cmakelists_file, root.stem)
-
- @patchfs
- def test_from_existing_skips_rendering_cmake_template_if_file_exists(self, fs):
- with mock.patch("mbed_tools.project._internal.project_data.render_cmakelists_template") as render_cmake:
- root = pathlib.Path(fs, "foo")
- make_mbed_program_files(root)
- (root / CMAKELISTS_FILE_NAME).touch()
-
- MbedProgramFiles.from_existing(root)
-
- render_cmake.assert_not_called()
-
class TestMbedLibReference(TestCase):
@patchfs
@@ -108,13 +85,15 @@ class TestMbedLibReference(TestCase):
root = pathlib.Path(fs, "foo")
url = "https://github.com/mylibrepo"
ref = "latest"
- full_ref = f"{url}#{ref}"
- lib = make_mbed_lib_reference(root, ref_url=full_ref)
+ references = [f"{url}#{ref}", f"{url}/#{ref}"]
+
+ for full_ref in references:
+ lib = make_mbed_lib_reference(root, ref_url=full_ref)
- reference = lib.get_git_reference()
+ reference = lib.get_git_reference()
- self.assertEqual(reference.repo_url, url)
- self.assertEqual(reference.ref, ref)
+ self.assertEqual(reference.repo_url, url)
+ self.assertEqual(reference.ref, ref)
class TestMbedOS(TestCase):
diff --git a/tests/project/factories.py b/tests/project/factories.py
index 49084bb..f1040d7 100644
--- a/tests/project/factories.py
+++ b/tests/project/factories.py
@@ -5,6 +5,11 @@
from functools import wraps
from tempfile import TemporaryDirectory
from mbed_tools.project._internal.libraries import MbedLibReference
+from mbed_tools.project._internal.project_data import (
+ CMAKELISTS_FILE_NAME,
+ APP_CONFIG_FILE_NAME,
+ MBED_OS_REFERENCE_FILE_NAME,
+)
def patchfs(func):
@@ -16,12 +21,13 @@ def patchfs(func):
return wrapper
-def make_mbed_program_files(root, config_file_name="mbed_app.json"):
+def make_mbed_program_files(root, config_file_name=APP_CONFIG_FILE_NAME):
if not root.exists():
root.mkdir()
- (root / "mbed-os.lib").touch()
+ (root / MBED_OS_REFERENCE_FILE_NAME).touch()
(root / config_file_name).touch()
+ (root / CMAKELISTS_FILE_NAME).touch()
def make_mbed_lib_reference(root, name="mylib.lib", resolved=False, ref_url=None):
diff --git a/tests/project/test_mbed_project.py b/tests/project/test_mbed_project.py
index 24efd3a..12f8247 100644
--- a/tests/project/test_mbed_project.py
+++ b/tests/project/test_mbed_project.py
@@ -32,13 +32,13 @@ class TestCloneProject(TestCase):
url = "https://git.com/gitorg/repo"
clone_project(url, recursive=False)
- mock_program.from_url.assert_called_once_with(url, pathlib.Path(url.rsplit("/", maxsplit=1)[-1]), False)
+ mock_program.from_url.assert_called_once_with(url, pathlib.Path(url.rsplit("/", maxsplit=1)[-1]))
def test_resolves_libs_when_recursive_is_true(self, mock_program):
url = "https://git.com/gitorg/repo"
clone_project(url, recursive=True)
- mock_program.from_url.assert_called_once_with(url, pathlib.Path(url.rsplit("/", maxsplit=1)[-1]), False)
+ mock_program.from_url.assert_called_once_with(url, pathlib.Path(url.rsplit("/", maxsplit=1)[-1]))
mock_program.from_url.return_value.resolve_libraries.assert_called_once()
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 6
}
|
3.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.tarfile==1.2.0
beartype==0.20.2
black==25.1.0
boolean.py==4.0
boto3==1.37.23
botocore==1.37.23
bracex==2.5.post1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==7.1
coverage==7.8.0
cryptography==44.0.2
Deprecated==1.2.18
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
factory_boy==3.3.3
Faker==37.1.0
filelock==3.18.0
flake8==7.2.0
flake8-docstrings==1.7.0
gitdb==4.0.12
GitPython==3.1.44
id==1.5.0
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
incremental==24.7.2
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jellyfish==1.1.3
Jinja2==3.1.6
jmespath==1.0.1
keyring==25.6.0
license-expression==30.4.1
licenseheaders==0.8.5
Mako==1.3.9
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
-e git+https://github.com/ARMmbed/mbed-tools.git@49683ab6ab548f932bb790bf5a0b32e3f3d20fe2#egg=mbed_tools
mbed-tools-ci-scripts==1.7.5
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
nodeenv==1.9.1
packaging==24.2
pathspec==0.12.1
pdoc3==0.11.6
platformdirs==4.3.7
pluggy==1.5.0
ply==3.11
pre_commit==4.2.0
psutil==7.0.0
pyautoversion==1.2.0
pycodestyle==2.13.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.3.2
PyGithub==2.6.1
Pygments==2.19.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyudev==0.24.3
PyYAML==6.0.2
rdflib==7.1.4
readme_renderer==44.0
regex==2024.11.6
requests==2.32.3
requests-mock==1.12.1
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
s3transfer==0.11.4
SecretStorage==3.3.3
semantic-version==2.10.0
semver==3.0.4
six==1.17.0
smmap==5.0.2
snowballstemmer==2.2.0
spdx-tools==0.8.3
tabulate==0.9.0
toml==0.10.2
tomli==2.2.1
towncrier==19.2.0
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
uritools==4.0.3
urllib3==1.26.20
virtualenv==20.29.3
wcmatch==10.0
wrapt==1.17.2
xmltodict==0.14.2
zipp==3.21.0
|
name: mbed-tools
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-tarfile==1.2.0
- beartype==0.20.2
- black==25.1.0
- boolean-py==4.0
- boto3==1.37.23
- botocore==1.37.23
- bracex==2.5.post1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- click==7.1
- coverage==7.8.0
- cryptography==44.0.2
- deprecated==1.2.18
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- factory-boy==3.3.3
- faker==37.1.0
- filelock==3.18.0
- flake8==7.2.0
- flake8-docstrings==1.7.0
- gitdb==4.0.12
- gitpython==3.1.44
- id==1.5.0
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- incremental==24.7.2
- iniconfig==2.1.0
- isodate==0.7.2
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jeepney==0.9.0
- jellyfish==1.1.3
- jinja2==3.1.6
- jmespath==1.0.1
- keyring==25.6.0
- license-expression==30.4.1
- licenseheaders==0.8.5
- mako==1.3.9
- markdown==3.7
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mbed-tools==3.4.0
- mbed-tools-ci-scripts==1.7.5
- mccabe==0.7.0
- mdurl==0.1.2
- more-itertools==10.6.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- nh3==0.2.21
- nodeenv==1.9.1
- packaging==24.2
- pathspec==0.12.1
- pdoc3==0.11.6
- platformdirs==4.3.7
- pluggy==1.5.0
- ply==3.11
- pre-commit==4.2.0
- psutil==7.0.0
- pyautoversion==1.2.0
- pycodestyle==2.13.0
- pycparser==2.22
- pydocstyle==6.3.0
- pyflakes==3.3.2
- pygithub==2.6.1
- pygments==2.19.1
- pyjwt==2.10.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- python-dotenv==1.1.0
- pyudev==0.24.3
- pyyaml==6.0.2
- rdflib==7.1.4
- readme-renderer==44.0
- regex==2024.11.6
- requests==2.32.3
- requests-mock==1.12.1
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- s3transfer==0.11.4
- secretstorage==3.3.3
- semantic-version==2.10.0
- semver==3.0.4
- six==1.17.0
- smmap==5.0.2
- snowballstemmer==2.2.0
- spdx-tools==0.8.3
- tabulate==0.9.0
- toml==0.10.2
- tomli==2.2.1
- towncrier==19.2.0
- tqdm==4.67.1
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- uritools==4.0.3
- urllib3==1.26.20
- virtualenv==20.29.3
- wcmatch==10.0
- wrapt==1.17.2
- xmltodict==0.14.2
- zipp==3.21.0
prefix: /opt/conda/envs/mbed-tools
|
[
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_does_not_resolve_references_in_ignore_paths",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_url_does_not_raise_with_odd_program_layout",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_url_returns_valid_program",
"tests/project/_internal/test_project_data.py::TestMbedLibReference::test_get_git_reference_returns_lib_file_contents",
"tests/project/test_mbed_project.py::TestCloneProject::test_clones_from_remote",
"tests/project/test_mbed_project.py::TestCloneProject::test_resolves_libs_when_recursive_is_true"
] |
[] |
[
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_does_not_perform_checkout_if_no_git_ref_exists",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_hydrates_recursive_dependencies",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_hydrates_top_level_library_references",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_performs_checkout_if_git_ref_exists",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_resolve_does_not_perform_checkout_if_no_git_ref_exists",
"tests/project/_internal/test_libraries.py::TestLibraryReferences::test_resolve_performs_checkout_if_git_ref_exists",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_existing_raises_if_no_mbed_os_dir_found_and_check_mbed_os_is_true",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_existing_raises_if_path_is_not_a_program",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_existing_returns_valid_program",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_generates_valid_program_creating_directory",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_generates_valid_program_creating_directory_in_cwd",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_generates_valid_program_existing_directory",
"tests/project/_internal/test_mbed_program.py::TestInitialiseProgram::test_from_new_local_dir_raises_if_path_is_existing_program",
"tests/project/_internal/test_mbed_program.py::TestLibReferenceHandling::test_checkout_libraries_delegation",
"tests/project/_internal/test_mbed_program.py::TestLibReferenceHandling::test_checks_for_unresolved_libraries",
"tests/project/_internal/test_mbed_program.py::TestLibReferenceHandling::test_lists_all_known_libraries",
"tests/project/_internal/test_mbed_program.py::TestLibReferenceHandling::test_resolve_libraries_delegation",
"tests/project/_internal/test_mbed_program.py::TestParseURL::test_creates_url_and_dst_dir_from_name",
"tests/project/_internal/test_mbed_program.py::TestParseURL::test_creates_valid_dst_dir_from_url",
"tests/project/_internal/test_mbed_program.py::TestFindProgramRoot::test_finds_program_at_current_path",
"tests/project/_internal/test_mbed_program.py::TestFindProgramRoot::test_finds_program_higher_in_dir_tree",
"tests/project/_internal/test_mbed_program.py::TestFindProgramRoot::test_raises_if_no_program_found",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_existing_finds_existing_program_data",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_new_calls_render_template_for_gitignore_cmake_and_main",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_new_raises_if_program_files_already_exist",
"tests/project/_internal/test_project_data.py::TestMbedProgramFiles::test_from_new_returns_valid_program_file_set",
"tests/project/_internal/test_project_data.py::TestMbedLibReference::test_is_resolved_returns_false_if_source_code_dir_doesnt_exist",
"tests/project/_internal/test_project_data.py::TestMbedLibReference::test_is_resolved_returns_true_if_source_code_dir_exists",
"tests/project/_internal/test_project_data.py::TestMbedOS::test_from_existing_finds_existing_mbed_os_data",
"tests/project/_internal/test_project_data.py::TestMbedOS::test_raises_if_files_missing",
"tests/project/test_mbed_project.py::TestInitialiseProject::test_fetches_mbed_os_when_create_only_is_false",
"tests/project/test_mbed_project.py::TestInitialiseProject::test_skips_mbed_os_when_create_only_is_true",
"tests/project/test_mbed_project.py::TestCheckoutProject::test_checks_out_libraries",
"tests/project/test_mbed_project.py::TestCheckoutProject::test_resolves_libs_if_unresolved_detected",
"tests/project/test_mbed_project.py::TestPrintLibs::test_list_libraries_called"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__yotta-586
|
852c1e498fbb12938fa28aa388cf2b2b650508fe
|
2015-11-19 17:32:49
|
852c1e498fbb12938fa28aa388cf2b2b650508fe
|
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..0150ea4
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,5 @@
+[run]
+parallel=True
+concurrency=multiprocessing
+include=./yotta/*
+
diff --git a/tox.ini b/tox.ini
index 20af1fb..06075d3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,14 +6,16 @@ deps=
cython
pylint
coverage
-setenv=
- COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
+passenv=
+ SSH_AUTH_SOCK
commands=
pip install .
- coverage erase
- coverage run --parallel-mode setup.py test
- coverage combine
- coverage report --include="yotta/*"
+ python setup.py test
+ # disable coverage for now: subprocesses aren't being combined correctly
+ # coverage erase
+ # coverage run --parallel-mode setup.py test
+ # coverage combine
+ # coverage report --include="yotta/*"
py27: pylint ./yotta
py33: pylint ./yotta
py34: pylint ./yotta
diff --git a/yotta/lib/validate.py b/yotta/lib/validate.py
index 1ff5b8e..ed38de8 100644
--- a/yotta/lib/validate.py
+++ b/yotta/lib/validate.py
@@ -18,10 +18,12 @@ import pack
Source_Dir_Regex = re.compile('^[a-z0-9_-]*$')
Source_Dir_Invalid_Regex = re.compile('[^a-z0-9_-]*')
-Component_Name_Regex = re.compile('^[a-z0-9-]*$')
Component_Name_Replace_With_Dash = re.compile('[^a-z0-9]+')
Looks_Like_An_Email = re.compile('^[^@]+@[^@]+\.[^@]+$')
+Component_Name_Regex = r'^[a-z]+[a-z0-9-]*$'
+Target_Name_Regex = r'^[a-z]+[a-z0-9+-]*$'
+
# return an error string describing the validation failure, or None if there is
# no error
def sourceDirValidationError(dirname, component_name):
@@ -41,10 +43,15 @@ def sourceDirValidationError(dirname, component_name):
return None
def componentNameValidationError(component_name):
- if not Component_Name_Regex.match(component_name):
+ if not re.match(Component_Name_Regex, component_name):
return 'Module name "%s" is invalid - must contain only lowercase a-z, 0-9 and hyphen, with no spaces.' % component_name
return None
+def targetNameValidationError(target_name):
+ if not re.match(Target_Name_Regex, target_name):
+ return 'Module name "%s" is invalid - must contain only lowercase a-z, 0-9 and hyphen, with no spaces.' % target_name
+ return None
+
def componentNameCoerced(component_name):
return Component_Name_Replace_With_Dash.sub('-', component_name.lower())
@@ -67,6 +74,18 @@ def currentDirectoryModule():
return None
return c
+def currentDirectoryTarget():
+ try:
+ t = target.Target(os.getcwd())
+ except pack.InvalidDescription as e:
+ logging.error(e)
+ return None
+ if not t:
+ logging.error(str(t.error))
+ logging.error('The current directory does not contain a valid target.')
+ return None
+ return t
+
def currentDirectoryModuleOrTarget():
wd = os.getcwd()
errors = []
diff --git a/yotta/main.py b/yotta/main.py
index f1d6055..7147d01 100644
--- a/yotta/main.py
+++ b/yotta/main.py
@@ -25,7 +25,7 @@ from .lib import detect
import yotta.lib.globalconf as globalconf
# hook to support coverage information when yotta runs itself during tests:
-if 'COVERAGE_PROCESS_START' is os.environ:
+if 'COVERAGE_PROCESS_START' in os.environ:
import coverage
coverage.process_startup()
@@ -92,7 +92,7 @@ def main():
description='Build software using re-usable components.\n'+
'For more detailed help on each subcommand, run: yotta <subcommand> --help'
)
- subparser = parser.add_subparsers(metavar='<subcommand>')
+ subparser = parser.add_subparsers(dest='subcommand_name', metavar='<subcommand>')
parser.add_argument('--version', nargs=0, action=FastVersionAction,
help='display the version'
@@ -145,7 +145,8 @@ def main():
'Search for open-source modules and targets that have been published '+
'to the yotta registry (with yotta publish). See help for `yotta '+
'install` for installing modules, and for `yotta target` for '+
- 'switching targets.'
+ 'switching targets.',
+ 'Search for published modules and targets'
)
addParser('init', 'init', 'Create a new module.')
addParser('install', 'install',
@@ -164,8 +165,20 @@ def main():
'Build the current module.'
)
addParser('version', 'version', 'Bump the module version, or (with no arguments) display the current version.')
- addParser('link', 'link', 'Symlink a module.')
- addParser('link-target', 'link_target', 'Symlink a target.')
+ addParser('link', 'link',
+ 'Symlink a module to be used in another module. Use "yotta link" '+
+ '(with no arguments) to link the current module globally. Or use '+
+ '"yotta link module-name" To use a module that was previously linked '+
+ 'globally in the current module.',
+ 'Symlink a module'
+ )
+ addParser('link-target', 'link_target',
+ 'Symlink a target to be used in another module. Use "yotta link-target" '+
+ '(with no arguments) to link the current target globally. Or use '+
+ '"yotta link-target target-name" To use a target that was previously linked '+
+ 'globally in the current module.',
+ 'Symlink a target'
+ )
addParser('update', 'update', 'Update dependencies for the current module, or a specific module.')
addParser('target', 'target', 'Set or display the target device.')
addParser('debug', 'debug', 'Attach a debugger to the current target. Requires target support.')
@@ -186,7 +199,12 @@ def main():
addParser('list', 'list', 'List the dependencies of the current module, or the inherited targets of the current target.')
addParser('outdated', 'outdated', 'Display information about dependencies which have newer versions available.')
addParser('uninstall', 'uninstall', 'Remove a specific dependency of the current module, both from module.json and from disk.')
- addParser('remove', 'remove', 'Remove the downloaded version of a dependency, or un-link a linked module.')
+ addParser('remove', 'remove',
+ 'Remove the downloaded version of a dependency module or target, or '+
+ 'un-link a linked module or target (see yotta link --help for details '+
+ 'of linking). This command does not modify your module.json file.',
+ 'Remove or unlink a dependency without removing it from module.json.'
+ )
addParser('owners', 'owners', 'Add/remove/display the owners of a module or target.')
addParser('licenses', 'licenses', 'List the licenses of the current module and its dependencies.')
addParser('clean', 'clean', 'Remove files created by yotta and the build.')
@@ -195,16 +213,17 @@ def main():
# short synonyms, subparser.choices is a dictionary, so use update() to
# merge in the keys from another dictionary
short_commands = {
- 'up':subparser.choices['update'],
- 'in':subparser.choices['install'],
- 'ln':subparser.choices['link'],
- 'v':subparser.choices['version'],
- 'ls':subparser.choices['list'],
- 'rm':subparser.choices['remove'],
- 'unlink':subparser.choices['remove'],
- 'owner':subparser.choices['owners'],
- 'lics':subparser.choices['licenses'],
- 'who':subparser.choices['whoami']
+ 'up':subparser.choices['update'],
+ 'in':subparser.choices['install'],
+ 'ln':subparser.choices['link'],
+ 'v':subparser.choices['version'],
+ 'ls':subparser.choices['list'],
+ 'rm':subparser.choices['remove'],
+ 'unlink':subparser.choices['remove'],
+ 'unlink-target':subparser.choices['remove'],
+ 'owner':subparser.choices['owners'],
+ 'lics':subparser.choices['licenses'],
+ 'who':subparser.choices['whoami']
}
subparser.choices.update(short_commands)
diff --git a/yotta/remove.py b/yotta/remove.py
index e734003..c961616 100644
--- a/yotta/remove.py
+++ b/yotta/remove.py
@@ -14,22 +14,58 @@ from .lib import validate
def addOptions(parser):
- parser.add_argument('component',
- help='Name of the dependency to remove'
+ parser.add_argument('module', default=None, nargs='?', metavar='<module>',
+ help='Name of the module to remove. If omitted the current module '+
+ 'or target will be removed from the global linking directory.'
)
def execCommand(args, following_args):
- err = validate.componentNameValidationError(args.component)
- if err:
- logging.error(err)
- return 1
- c = validate.currentDirectoryModule()
- if not c:
+ module_or_target = 'module'
+ if 'target' in args.subcommand_name:
+ module_or_target = 'target'
+ if args.module is not None:
+ return removeDependency(args, module_or_target)
+ else:
+ return removeGlobally(module_or_target)
+
+def rmLinkOrDirectory(path, nonexistent_warning):
+ if not os.path.exists(path):
+ logging.warning(nonexistent_warning)
return 1
- path = os.path.join(c.modulesPath(), args.component)
if fsutils.isLink(path):
fsutils.rmF(path)
else:
fsutils.rmRf(path)
+ return 0
+
+def removeGlobally(module_or_target):
+ # folders, , get places to install things, internal
+ from .lib import folders
+ if module_or_target == 'module':
+ global_dir = folders.globalInstallDirectory()
+ p = validate.currentDirectoryModule()
+ else:
+ global_dir = folders.globalTargetInstallDirectory()
+ p = validate.currentDirectoryTarget()
+ if p is None:
+ return 1
+ path = os.path.join(global_dir, p.getName())
+ return rmLinkOrDirectory(path, ('%s is not linked globally' % p.getName()))
+
+def removeDependency(args, module_or_target):
+ c = validate.currentDirectoryModule()
+ if not c:
+ return 1
+ if module_or_target == 'module':
+ subdir = c.modulesPath()
+ err = validate.componentNameValidationError(args.module)
+ else:
+ subdir = c.targetsPath()
+ err = validate.targetNameValidationError(args.module)
+ if err:
+ logging.error(err)
+ return 1
+ path = os.path.join(subdir, args.module)
+ return rmLinkOrDirectory(path, '%s %s not found' % (('dependency', 'target')[module_or_target=='target'], args.module))
|
c:\ytexe yt link does not install module
## Problem
To add a local library module to a executable module it requires 3 steps
`c:\ytlib yt link`
`c:\ytexe yt link ytlib`
If you run `yt ls` at this point there is no indication that `ytlib` is linked into the project, you must either `yt install` or `yt build` to get `ytlib` added to your module.json file
`c:\ytexe yt install ytlib`
At this point you can now see `ytlib` in a `yt ls` command output.
### example
I'm a developer developing locally. I want to add simplelog to my project to help me debug and maybe tweak a few pretty print settings in simplelog for fun. So I make the yotta executable `ytexe`. I clone the simplelog repo to my local machine so they are both at my root directory. Now to add simplelog to my project I must
`C:\simplelog yt link`
`C:\ytexe yt link simplelog`
at this point I have added simplelog calls into my code and run `yt build`, which fails, because the simplelog module has not been added to my module.json, nor does it show up in a `yt ls` command.
I must run `yt install simplelog`.
This may be expected behaviour, and maybe we dont want to change it, but at the very least it makes for a bad user experience.
## Solution
1) have a `yt link <absolute file path>` command that takes care of all these steps
or
2) have `c:\ytexe yt link ytlib` add the module to the module.json or otherwise make it obvious that it is added to the project, currently there is no feedback.
or
3) when a user runs `c:\ytexe yt link ytlib` give them a feedback message telling them they need to `yt install ytlib` to finish adding the module. I think this solution is the least optimum because it requires 3 steps instead of 1, but it is the miminum required for user interaction.
|
ARMmbed/yotta
|
diff --git a/yotta/test/cli/build.py b/yotta/test/cli/build.py
index bbd0dbb..3ff37bf 100644
--- a/yotta/test/cli/build.py
+++ b/yotta/test/cli/build.py
@@ -6,17 +6,14 @@
# standard library modules, , ,
import unittest
-import os
-import tempfile
import subprocess
import copy
import re
import datetime
# internal modules:
-from yotta.lib.fsutils import mkDirP, rmRf
-from yotta.lib.detect import systemDefaultTarget
from . import cli
+from . import util
Test_Complex = {
'module.json': '''{
@@ -87,59 +84,7 @@ int main(){
'''
}
-
-Test_Trivial_Lib = {
-'module.json':'''{
- "name": "test-trivial-lib",
- "version": "0.0.2",
- "description": "Module to test trivial lib compilation",
- "licenses": [
- {
- "url": "https://spdx.org/licenses/Apache-2.0",
- "type": "Apache-2.0"
- }
- ],
- "dependencies": {
- }
-}''',
-
-'test-trivial-lib/lib.h': '''
-int foo();
-''',
-
-'source/lib.c':'''
-#include "test-trivial-lib/lib.h"
-
-int foo(){
- return 7;
-}
-'''
-}
-
-Test_Trivial_Exe = {
-'module.json':'''{
- "name": "test-trivial-exe",
- "version": "0.0.2",
- "description": "Module to test trivial exe compilation",
- "licenses": [
- {
- "url": "https://spdx.org/licenses/Apache-2.0",
- "type": "Apache-2.0"
- }
- ],
- "dependencies": {
- },
- "bin":"./source"
-}''',
-
-'source/lib.c':'''
-int main(){
- return 0;
-}
-'''
-}
-
-Test_Build_Info = copy.copy(Test_Trivial_Exe)
+Test_Build_Info = copy.copy(util.Test_Trivial_Exe)
Test_Build_Info['source/lib.c'] = '''
#include "stdio.h"
#include YOTTA_BUILD_INFO_HEADER
@@ -202,84 +147,66 @@ int foo(){
'test/g/a/a/b/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }'
}
-def isWindows():
- # can't run tests that hit github without an authn token
- return os.name == 'nt'
-
class TestCLIBuild(unittest.TestCase):
- def writeTestFiles(self, files, add_space_in_path=False):
- test_dir = tempfile.mkdtemp()
- if add_space_in_path:
- test_dir = test_dir + ' spaces in path'
-
- for path, contents in files.items():
- path_dir, file_name = os.path.split(path)
- path_dir = os.path.join(test_dir, path_dir)
- mkDirP(path_dir)
- with open(os.path.join(path_dir, file_name), 'w') as f:
- f.write(contents)
- return test_dir
-
-
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_buildTrivialLib(self):
- test_dir = self.writeTestFiles(Test_Trivial_Lib)
+ test_dir = util.writeTestFiles(util.Test_Trivial_Lib)
- stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
+ stdout = self.runCheckCommand(['--target', util.nativeTarget(), 'build'], test_dir)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_buildTrivialExe(self):
- test_dir = self.writeTestFiles(Test_Trivial_Exe)
+ test_dir = util.writeTestFiles(util.Test_Trivial_Exe)
- stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
+ stdout = self.runCheckCommand(['--target', util.nativeTarget(), 'build'], test_dir)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_buildComplex(self):
- test_dir = self.writeTestFiles(Test_Complex)
+ test_dir = util.writeTestFiles(Test_Complex)
- stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
+ stdout = self.runCheckCommand(['--target', util.nativeTarget(), 'build'], test_dir)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_buildComplexSpaceInPath(self):
- test_dir = self.writeTestFiles(Test_Complex, True)
+ test_dir = util.writeTestFiles(Test_Complex, True)
- stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
+ stdout = self.runCheckCommand(['--target', util.nativeTarget(), 'build'], test_dir)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_buildTests(self):
- test_dir = self.writeTestFiles(Test_Tests, True)
- stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
- stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'test'], test_dir)
+ test_dir = util.writeTestFiles(Test_Tests, True)
+ stdout = self.runCheckCommand(['--target', util.nativeTarget(), 'build'], test_dir)
+ stdout = self.runCheckCommand(['--target', util.nativeTarget(), 'test'], test_dir)
self.assertIn('test-a', stdout)
self.assertIn('test-c', stdout)
self.assertIn('test-d', stdout)
self.assertIn('test-e', stdout)
self.assertIn('test-f', stdout)
self.assertIn('test-g', stdout)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_buildInfo(self):
- test_dir = self.writeTestFiles(Test_Build_Info, True)
+ test_dir = util.writeTestFiles(Test_Build_Info, True)
# commit all the test files to git so that the VCS build info gets
# defined:
subprocess.check_call(['git', 'init', '-q'], cwd=test_dir)
subprocess.check_call(['git', 'add', '.'], cwd=test_dir)
subprocess.check_call(['git', 'commit', '-m', 'test build info automated commit', '-q'], cwd=test_dir)
- self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
+ self.runCheckCommand(['--target', util.nativeTarget(), 'build'], test_dir)
build_time = datetime.datetime.utcnow()
- output = subprocess.check_output(['./build/' + systemDefaultTarget().split(',')[0] + '/source/test-trivial-exe'], cwd=test_dir).decode()
+ output = subprocess.check_output(['./build/' + util.nativeTarget().split(',')[0] + '/source/test-trivial-exe'], cwd=test_dir).decode()
self.assertIn('vcs clean: 1', output)
# check build timestamp
diff --git a/yotta/test/cli/cli.py b/yotta/test/cli/cli.py
index 3017aa2..541cedb 100644
--- a/yotta/test/cli/cli.py
+++ b/yotta/test/cli/cli.py
@@ -24,6 +24,10 @@ def run(arguments, cwd='.'):
stdin = subprocess.PIPE
)
out, err = child.communicate()
+ # no command should ever produce a traceback:
+ if 'traceback' in (out.decode('utf-8')+err.decode('utf-8')).lower():
+ print(out+err)
+ assert(False)
return out.decode('utf-8'), err.decode('utf-8'), child.returncode
diff --git a/yotta/test/cli/link.py b/yotta/test/cli/link.py
new file mode 100644
index 0000000..eddb5c5
--- /dev/null
+++ b/yotta/test/cli/link.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# Copyright 2014-2015 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0
+# See LICENSE file for details.
+
+
+# standard library modules, , ,
+import unittest
+import os
+import tempfile
+
+# internal modules:
+from yotta.lib.folders import globalInstallDirectory
+
+from . import cli
+from . import util
+
+Test_Target = 'x86-linux-native'
+
+class TestCLILink(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.prefix_dir = tempfile.mkdtemp()
+ os.environ['YOTTA_PREFIX'] = cls.prefix_dir
+
+ @classmethod
+ def tearDownClass(cls):
+ util.rmRf(cls.prefix_dir)
+ cls.prefix_dir = None
+
+ def testLink(self):
+ linked_in_module = util.writeTestFiles(util.Test_Trivial_Lib, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'link'], cwd=linked_in_module)
+ self.assertEqual(statuscode, 0)
+ self.assertTrue(os.path.exists(os.path.join(globalInstallDirectory(), 'test-trivial-lib')))
+
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'list'], cwd=test_module)
+ self.assertIn('missing', stdout+stderr)
+
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'link', 'test-trivial-lib'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ self.assertNotIn('broken', stdout+stderr)
+
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'list'], cwd=test_module)
+ self.assertNotIn('missing', stdout+stderr)
+
+ util.rmRf(test_module)
+ util.rmRf(linked_in_module)
+
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on this platform yet")
+ def testLinkedBuild(self):
+ linked_in_module = util.writeTestFiles(util.Test_Trivial_Lib, True)
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link'], cwd=linked_in_module)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link', 'test-trivial-lib'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'build'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+
+ util.rmRf(test_module)
+ util.rmRf(linked_in_module)
+
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on this platform yet")
+ def testLinkedReBuild(self):
+ # test that changing which module is linked triggers a re-build
+ linked_in_module_1 = util.writeTestFiles(util.Test_Trivial_Lib, True)
+ linked_in_module_2 = util.writeTestFiles(util.Test_Trivial_Lib, True)
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link'], cwd=linked_in_module_1)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link', 'test-trivial-lib'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'build'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+
+ # check that rebuild is no-op
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'build'], cwd=test_module)
+ self.assertIn('no work to do', stdout+stderr)
+ self.assertEqual(statuscode, 0)
+
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link'], cwd=linked_in_module_2)
+ self.assertEqual(statuscode, 0)
+
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'build'], cwd=test_module)
+ self.assertNotIn('no work to do', stdout+stderr)
+ self.assertEqual(statuscode, 0)
+
+ util.rmRf(test_module)
+ util.rmRf(linked_in_module_1)
+ util.rmRf(linked_in_module_2)
+
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on this platform yet")
+ def testTargetLinkedBuild(self):
+ linked_in_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep_Preinstalled, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target'], cwd=linked_in_target)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target', 'test-native-target'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'build'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+
+ util.rmRf(test_module)
+ util.rmRf(linked_in_target)
+
diff --git a/yotta/test/cli/outdated.py b/yotta/test/cli/outdated.py
index 15fbed4..be8eb4d 100644
--- a/yotta/test/cli/outdated.py
+++ b/yotta/test/cli/outdated.py
@@ -6,11 +6,9 @@
# standard library modules, , ,
import unittest
-import os
-import tempfile
# internal modules:
-from yotta.lib.fsutils import mkDirP, rmRf
+from . import util
from . import cli
Test_Outdated = {
@@ -42,30 +40,17 @@ int foo(){
}
class TestCLIOutdated(unittest.TestCase):
- def writeTestFiles(self, files, add_space_in_path=False):
- test_dir = tempfile.mkdtemp()
- if add_space_in_path:
- test_dir = test_dir + ' spaces in path'
-
- for path, contents in files.items():
- path_dir, file_name = os.path.split(path)
- path_dir = os.path.join(test_dir, path_dir)
- mkDirP(path_dir)
- with open(os.path.join(path_dir, file_name), 'w') as f:
- f.write(contents)
- return test_dir
-
def test_outdated(self):
- path = self.writeTestFiles(Test_Outdated, True)
+ path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'outdated'], cwd=path)
self.assertNotEqual(statuscode, 0)
self.assertIn('test-testing-dummy', stdout + stderr)
- rmRf(path)
+ util.rmRf(path)
def test_notOutdated(self):
- path = self.writeTestFiles(Test_Outdated, True)
+ path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'up'], cwd=path)
self.assertEqual(statuscode, 0)
@@ -74,4 +59,4 @@ class TestCLIOutdated(unittest.TestCase):
self.assertEqual(statuscode, 0)
self.assertNotIn('test-testing-dummy', stdout + stderr)
- rmRf(path)
+ util.rmRf(path)
diff --git a/yotta/test/cli/test.py b/yotta/test/cli/test.py
index 6a243d6..ccec431 100644
--- a/yotta/test/cli/test.py
+++ b/yotta/test/cli/test.py
@@ -6,15 +6,12 @@
# standard library modules, , ,
import unittest
-import os
-import tempfile
import copy
# internal modules:
-from yotta.lib.fsutils import mkDirP, rmRf
from yotta.lib.detect import systemDefaultTarget
from . import cli
-
+from . import util
Test_Tests = {
'module.json':'''{
@@ -103,26 +100,10 @@ Test_Fitler_NotFound['module.json'] = '''{
}
}'''
-def isWindows():
- return os.name == 'nt'
-
class TestCLITest(unittest.TestCase):
- def writeTestFiles(self, files, add_space_in_path=False):
- test_dir = tempfile.mkdtemp()
- if add_space_in_path:
- test_dir = test_dir + ' spaces in path'
-
- for path, contents in files.items():
- path_dir, file_name = os.path.split(path)
- path_dir = os.path.join(test_dir, path_dir)
- mkDirP(path_dir)
- with open(os.path.join(path_dir, file_name), 'w') as f:
- f.write(contents)
- return test_dir
-
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_tests(self):
- test_dir = self.writeTestFiles(Test_Tests, True)
+ test_dir = util.writeTestFiles(Test_Tests, True)
output = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
output = self.runCheckCommand(['--target', systemDefaultTarget(), 'test'], test_dir)
self.assertIn('test-a passed', output)
@@ -131,17 +112,17 @@ class TestCLITest(unittest.TestCase):
self.assertIn('test-e passed', output)
self.assertIn('test-f passed', output)
self.assertIn('test-g passed', output)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_testOutputFilterPassing(self):
- test_dir = self.writeTestFiles(Test_Fitler_Pass, True)
+ test_dir = util.writeTestFiles(Test_Fitler_Pass, True)
stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'test'], test_dir)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_testOutputFilterFailing(self):
- test_dir = self.writeTestFiles(Test_Fitler_Fail, True)
+ test_dir = util.writeTestFiles(Test_Fitler_Fail, True)
stdout, stderr, statuscode = cli.run(['--target', systemDefaultTarget(), 'test'], cwd=test_dir)
if statuscode == 0:
print(stdout)
@@ -153,17 +134,17 @@ class TestCLITest(unittest.TestCase):
self.assertIn('test-f failed', '%s %s' % (stdout, stderr))
self.assertIn('test-g failed', '%s %s' % (stdout, stderr))
self.assertNotEqual(statuscode, 0)
- rmRf(test_dir)
+ util.rmRf(test_dir)
- @unittest.skipIf(isWindows(), "can't build natively on windows yet")
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on windows yet")
def test_testOutputFilterNotFound(self):
- test_dir = self.writeTestFiles(Test_Fitler_NotFound, True)
+ test_dir = util.writeTestFiles(Test_Fitler_NotFound, True)
stdout, stderr, statuscode = cli.run(['--target', systemDefaultTarget(), 'test'], cwd=test_dir)
if statuscode == 0:
print(stdout)
print(stderr)
self.assertNotEqual(statuscode, 0)
- rmRf(test_dir)
+ util.rmRf(test_dir)
def runCheckCommand(self, args, test_dir):
stdout, stderr, statuscode = cli.run(args, cwd=test_dir)
diff --git a/yotta/test/cli/unlink.py b/yotta/test/cli/unlink.py
new file mode 100644
index 0000000..ff6eda6
--- /dev/null
+++ b/yotta/test/cli/unlink.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# Copyright 2014-2015 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0
+# See LICENSE file for details.
+
+
+# standard library modules, , ,
+import unittest
+import tempfile
+import os
+
+# internal modules:
+from . import cli
+from . import util
+
+Test_Target = 'x86-linux-native'
+
+class TestCLIUnLink(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.prefix_dir = tempfile.mkdtemp()
+ os.environ['YOTTA_PREFIX'] = cls.prefix_dir
+
+ @classmethod
+ def tearDownClass(cls):
+ util.rmRf(cls.prefix_dir)
+ cls.prefix_dir = None
+
+ def testUnlinkNonexistentModule(self):
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink', 'doesnotexist'], cwd=test_module)
+ self.assertNotEqual(statuscode, 0)
+ util.rmRf(test_module)
+
+ def testUnlinkNonexistentTarget(self):
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink-target', 'doesnotexist'], cwd=test_module)
+ self.assertNotEqual(statuscode, 0)
+ util.rmRf(test_module)
+
+ def testUnlinkNotLinkedModuleGlobally(self):
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink'], cwd=test_module)
+ self.assertNotEqual(statuscode, 0)
+ util.rmRf(test_module)
+
+ def testUnlinkNotLinkedTargetGlobally(self):
+ test_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink'], cwd=test_target)
+ self.assertNotEqual(statuscode, 0)
+ util.rmRf(test_target)
+
+ def testUnlinkModuleGlobally(self):
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'link'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ util.rmRf(test_module)
+
+ def testUnlinkTargetGlobally(self):
+ test_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'link-target'], cwd=test_target)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink-target'], cwd=test_target)
+ self.assertEqual(statuscode, 0)
+ util.rmRf(test_target)
+
+ def testUnlinkModule(self):
+ linked_in_module = util.writeTestFiles(util.Test_Trivial_Lib, True)
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link'], cwd=linked_in_module)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link', 'test-trivial-lib'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ self.assertTrue(os.path.exists(os.path.join(test_module, 'yotta_modules', 'test-trivial-lib')))
+ stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'unlink', 'test-trivial-lib'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ self.assertTrue(not os.path.exists(os.path.join(test_module, 'yotta_modules', 'test-trivial-lib')))
+
+ util.rmRf(test_module)
+ util.rmRf(linked_in_module)
+
+ @unittest.skipIf(not util.canBuildNatively(), "can't build natively on this platform yet")
+ def testUnlinkTarget(self):
+ linked_in_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
+ test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep_Preinstalled, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target'], cwd=linked_in_target)
+ self.assertEqual(statuscode, 0)
+ stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target', 'test-native-target'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ self.assertTrue(os.path.exists(os.path.join(test_module, 'yotta_targets', 'test-native-target')))
+ stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'unlink-target', 'test-native-target'], cwd=test_module)
+ self.assertEqual(statuscode, 0)
+ self.assertTrue(not os.path.exists(os.path.join(test_module, 'yotta_targets', 'test-native-target')))
+
+ util.rmRf(test_module)
+ util.rmRf(linked_in_target)
+
+
diff --git a/yotta/test/cli/update.py b/yotta/test/cli/update.py
index 4906fab..8581689 100644
--- a/yotta/test/cli/update.py
+++ b/yotta/test/cli/update.py
@@ -6,12 +6,10 @@
# standard library modules, , ,
import unittest
-import os
-import tempfile
# internal modules:
-from yotta.lib.fsutils import mkDirP, rmRf
from . import cli
+from . import util
Test_Outdated = {
'module.json':'''{
@@ -42,39 +40,26 @@ int foo(){
}
class TestCLIUpdate(unittest.TestCase):
- def writeTestFiles(self, files, add_space_in_path=False):
- test_dir = tempfile.mkdtemp()
- if add_space_in_path:
- test_dir = test_dir + ' spaces in path'
-
- for path, contents in files.items():
- path_dir, file_name = os.path.split(path)
- path_dir = os.path.join(test_dir, path_dir)
- mkDirP(path_dir)
- with open(os.path.join(path_dir, file_name), 'w') as f:
- f.write(contents)
- return test_dir
-
def test_update(self):
- path = self.writeTestFiles(Test_Outdated, True)
+ path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'update'], cwd=path)
self.assertEqual(statuscode, 0)
self.assertIn('download test-testing-dummy', stdout + stderr)
- rmRf(path)
+ util.rmRf(path)
def test_updateExplicit(self):
- path = self.writeTestFiles(Test_Outdated, True)
+ path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'update', 'test-testing-dummy'], cwd=path)
self.assertEqual(statuscode, 0)
self.assertIn('download test-testing-dummy', stdout + stderr)
- rmRf(path)
+ util.rmRf(path)
def test_updateNothing(self):
- path = self.writeTestFiles(Test_Outdated, True)
+ path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'up'], cwd=path)
self.assertEqual(statuscode, 0)
@@ -84,4 +69,4 @@ class TestCLIUpdate(unittest.TestCase):
self.assertEqual(statuscode, 0)
self.assertNotIn('download test-testing-dummy', stdout + stderr)
- rmRf(path)
+ util.rmRf(path)
diff --git a/yotta/test/cli/util.py b/yotta/test/cli/util.py
new file mode 100644
index 0000000..553619b
--- /dev/null
+++ b/yotta/test/cli/util.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+# Copyright 2015 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0
+# See LICENSE file for details.
+
+# standard library modules, , ,
+import tempfile
+import os
+import copy
+
+# internal modules:
+import yotta.lib.fsutils as fsutils
+from yotta.lib.detect import systemDefaultTarget
+
+# some simple example module definitions that can be re-used by multiple tests:
+Test_Trivial_Lib = {
+'module.json':'''{
+ "name": "test-trivial-lib",
+ "version": "1.0.0",
+ "description": "Module to test trivial lib compilation",
+ "license": "Apache-2.0",
+ "dependencies": {
+ }
+}''',
+
+'test-trivial-lib/lib.h': '''
+int foo();
+''',
+
+'source/lib.c':'''
+#include "test-trivial-lib/lib.h"
+int foo(){ return 7; }
+'''
+}
+
+Test_Trivial_Exe = {
+'module.json':'''{
+ "name": "test-trivial-exe",
+ "version": "1.0.0",
+ "description": "Module to test trivial exe compilation",
+ "license": "Apache-2.0",
+ "dependencies": {
+ },
+ "bin":"./source"
+}''',
+
+'source/lib.c':'''
+int main(){ return 0; }
+'''
+}
+
+Test_Testing_Trivial_Lib_Dep = {
+'module.json':'''{
+ "name": "test-simple-module",
+ "version": "1.0.0",
+ "description": "a simple test module",
+ "author": "Someone Somewhere <[email protected]>",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "test-trivial-lib": "^1.0.0"
+ }
+}
+''',
+
+'test-simple-module/simple.h': '''
+int simple();
+''',
+
+'source/lib.c':'''
+#include "test-simple-module/simple.h"
+int simple(){ return 123; }
+'''
+}
+
+Test_Testing_Trivial_Lib_Dep_Preinstalled = copy.copy(Test_Testing_Trivial_Lib_Dep)
+for k, v in Test_Trivial_Lib.items():
+ Test_Testing_Trivial_Lib_Dep_Preinstalled['yotta_modules/test-trivial-lib/' + k] = v
+
+
+def getNativeTargetDescription():
+ # actually returns a trivial target which inherits from the native target
+ native_target = nativeTarget()
+ if ',' in native_target:
+ native_target = native_target[:native_target.find(',')]
+ return {
+ 'target.json':'''{
+ "name": "test-native-target",
+ "version": "1.0.0",
+ "license": "Apache-2.0",
+ "inherits": {
+ "%s": "*"
+ }
+ }
+ ''' % native_target
+ }
+
+
+def writeTestFiles(files, add_space_in_path=False):
+ ''' write a dictionary of filename:contents into a new temporary directory
+ '''
+ test_dir = tempfile.mkdtemp()
+ if add_space_in_path:
+ test_dir = test_dir + ' spaces in path'
+
+ for path, contents in files.items():
+ path_dir, file_name = os.path.split(path)
+ path_dir = os.path.join(test_dir, path_dir)
+ fsutils.mkDirP(path_dir)
+ with open(os.path.join(path_dir, file_name), 'w') as f:
+ f.write(contents)
+ return test_dir
+
+def isWindows():
+ # can't run tests that hit github without an authn token
+ return os.name == 'nt'
+
+def canBuildNatively():
+ return not isWindows()
+
+def nativeTarget():
+ assert(canBuildNatively())
+ return systemDefaultTarget()
+
+#expose rmRf for convenience
+rmRf = fsutils.rmRf
diff --git a/yotta/test/config.py b/yotta/test/config.py
index 8c7b417..8c67192 100644
--- a/yotta/test/config.py
+++ b/yotta/test/config.py
@@ -7,12 +7,11 @@
import unittest
import copy
import os
-import tempfile
import logging
# internal modules:
-from yotta.lib.fsutils import mkDirP, rmRf
from yotta.lib import validate
+from .cli import util
logging.basicConfig(
level=logging.ERROR
@@ -78,19 +77,6 @@ Test_Module_Config_Ignored['module.json'] = '''{
}'''
class ConfigTest(unittest.TestCase):
- def writeTestFiles(self, files, add_space_in_path=False):
- test_dir = tempfile.mkdtemp()
- if add_space_in_path:
- test_dir = test_dir + ' spaces in path'
-
- for path, contents in files.items():
- path_dir, file_name = os.path.split(path)
- path_dir = os.path.join(test_dir, path_dir)
- mkDirP(path_dir)
- with open(os.path.join(path_dir, file_name), 'w') as f:
- f.write(contents)
- return test_dir
-
def setUp(self):
self.restore_cwd = os.getcwd()
@@ -98,7 +84,7 @@ class ConfigTest(unittest.TestCase):
os.chdir(self.restore_cwd)
def test_targetConfigMerge(self):
- test_dir = self.writeTestFiles(Test_Target_Config_Merge, True)
+ test_dir = util.writeTestFiles(Test_Target_Config_Merge, True)
os.chdir(test_dir)
c = validate.currentDirectoryModule()
@@ -118,10 +104,10 @@ class ConfigTest(unittest.TestCase):
self.assertEqual(merged_config['bar']['d'], "def")
os.chdir(self.restore_cwd)
- rmRf(test_dir)
+ util.rmRf(test_dir)
def test_targetAppConfigMerge(self):
- test_dir = self.writeTestFiles(Test_Target_Config_Merge_App, True)
+ test_dir = util.writeTestFiles(Test_Target_Config_Merge_App, True)
os.chdir(test_dir)
c = validate.currentDirectoryModule()
@@ -144,10 +130,10 @@ class ConfigTest(unittest.TestCase):
self.assertEqual(merged_config['new'], 123)
os.chdir(self.restore_cwd)
- rmRf(test_dir)
+ util.rmRf(test_dir)
def test_moduleConfigIgnored(self):
- test_dir = self.writeTestFiles(Test_Module_Config_Ignored, True)
+ test_dir = util.writeTestFiles(Test_Module_Config_Ignored, True)
os.chdir(test_dir)
c = validate.currentDirectoryModule()
@@ -157,5 +143,5 @@ class ConfigTest(unittest.TestCase):
self.assertNotIn("new", merged_config)
os.chdir(self.restore_cwd)
- rmRf(test_dir)
+ util.rmRf(test_dir)
diff --git a/yotta/test/ignores.py b/yotta/test/ignores.py
index 3a5f8e9..16832a8 100644
--- a/yotta/test/ignores.py
+++ b/yotta/test/ignores.py
@@ -8,13 +8,12 @@
# standard library modules, , ,
import unittest
import os
-import tempfile
# internal modules:
-from yotta.lib.fsutils import mkDirP, rmRf
from yotta.lib.detect import systemDefaultTarget
from yotta.lib import component
from .cli import cli
+from .cli import util
Test_Files = {
'.yotta_ignore': '''
@@ -115,24 +114,14 @@ def isWindows():
# can't run tests that hit github without an authn token
return os.name == 'nt'
-def writeTestFiles(files):
- test_dir = tempfile.mkdtemp()
- for path, contents in files.items():
- path_dir, file_name = os.path.split(path)
- path_dir = os.path.join(test_dir, path_dir)
- mkDirP(path_dir)
- with open(os.path.join(path_dir, file_name), 'w') as f:
- f.write(contents)
- return test_dir
-
class TestPackIgnores(unittest.TestCase):
@classmethod
def setUpClass(cls):
- cls.test_dir = writeTestFiles(Test_Files)
+ cls.test_dir = util.writeTestFiles(Test_Files)
@classmethod
def tearDownClass(cls):
- rmRf(cls.test_dir)
+ util.rmRf(cls.test_dir)
def test_absolute_ignores(self):
c = component.Component(self.test_dir)
@@ -158,7 +147,7 @@ class TestPackIgnores(unittest.TestCase):
self.assertTrue(c.ignores('test/someothertest/alsoignored.c'))
def test_default_ignores(self):
- default_test_dir = writeTestFiles(Default_Test_Files)
+ default_test_dir = util.writeTestFiles(Default_Test_Files)
c = component.Component(default_test_dir)
self.assertTrue(c.ignores('.something.c.swp'))
self.assertTrue(c.ignores('.something.c~'))
@@ -173,7 +162,7 @@ class TestPackIgnores(unittest.TestCase):
self.assertTrue(c.ignores('build'))
self.assertTrue(c.ignores('.yotta.json'))
- rmRf(default_test_dir)
+ util.rmRf(default_test_dir)
def test_comments(self):
c = component.Component(self.test_dir)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 4
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc cmake ninja-build"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==0.9.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
colorama==0.3.9
cryptography==44.0.2
Deprecated==1.2.18
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
hgapi==1.7.4
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
intelhex==2.3.0
intervaltree==3.1.0
Jinja2==2.11.3
jsonpointer==2.0
jsonschema==2.6.0
MarkupSafe==3.0.2
mbed_test_wrapper==0.0.3
packaging @ file:///croot/packaging_1734472117206/work
pathlib==1.0.1
pluggy @ file:///croot/pluggy_1733169602837/work
project-generator-definitions==0.2.46
project_generator==0.8.17
pycparser==2.22
pyelftools==0.23
PyGithub==1.54.1
PyJWT==1.7.1
pyocd==0.15.0
pytest @ file:///croot/pytest_1738938843180/work
pyusb==1.3.1
PyYAML==3.13
requests==2.32.3
semantic-version==2.10.0
six==1.17.0
sortedcontainers==2.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
urllib3==2.3.0
valinor==0.0.15
websocket-client==1.8.0
wrapt==1.17.2
xmltodict==0.14.2
-e git+https://github.com/ARMmbed/yotta.git@852c1e498fbb12938fa28aa388cf2b2b650508fe#egg=yotta
|
name: yotta
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==0.9.0
- argparse==1.4.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- colorama==0.3.9
- cryptography==44.0.2
- deprecated==1.2.18
- future==1.0.0
- hgapi==1.7.4
- idna==3.10
- intelhex==2.3.0
- intervaltree==3.1.0
- jinja2==2.11.3
- jsonpointer==2.0
- jsonschema==2.6.0
- markupsafe==3.0.2
- mbed-test-wrapper==0.0.3
- pathlib==1.0.1
- project-generator==0.8.17
- project-generator-definitions==0.2.46
- pycparser==2.22
- pyelftools==0.23
- pygithub==1.54.1
- pyjwt==1.7.1
- pyocd==0.15.0
- pyusb==1.3.1
- pyyaml==3.13
- requests==2.32.3
- semantic-version==2.10.0
- six==1.17.0
- sortedcontainers==2.4.0
- urllib3==2.3.0
- valinor==0.0.15
- websocket-client==1.8.0
- wrapt==1.17.2
- xmltodict==0.14.2
prefix: /opt/conda/envs/yotta
|
[
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkModuleGlobally",
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkNonexistentModule",
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkTarget",
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkTargetGlobally"
] |
[
"yotta/test/cli/build.py::TestCLIBuild::test_buildComplex",
"yotta/test/cli/build.py::TestCLIBuild::test_buildComplexSpaceInPath",
"yotta/test/cli/build.py::TestCLIBuild::test_buildInfo",
"yotta/test/cli/build.py::TestCLIBuild::test_buildTests",
"yotta/test/cli/build.py::TestCLIBuild::test_buildTrivialExe",
"yotta/test/cli/build.py::TestCLIBuild::test_buildTrivialLib",
"yotta/test/cli/link.py::TestCLILink::testLink",
"yotta/test/cli/link.py::TestCLILink::testLinkedBuild",
"yotta/test/cli/link.py::TestCLILink::testLinkedReBuild",
"yotta/test/cli/link.py::TestCLILink::testTargetLinkedBuild",
"yotta/test/cli/outdated.py::TestCLIOutdated::test_notOutdated",
"yotta/test/cli/outdated.py::TestCLIOutdated::test_outdated",
"yotta/test/cli/test.py::TestCLITest::test_testOutputFilterFailing",
"yotta/test/cli/test.py::TestCLITest::test_testOutputFilterNotFound",
"yotta/test/cli/test.py::TestCLITest::test_testOutputFilterPassing",
"yotta/test/cli/test.py::TestCLITest::test_tests",
"yotta/test/cli/update.py::TestCLIUpdate::test_update",
"yotta/test/cli/update.py::TestCLIUpdate::test_updateExplicit",
"yotta/test/cli/update.py::TestCLIUpdate::test_updateNothing",
"yotta/test/config.py::ConfigTest::test_moduleConfigIgnored",
"yotta/test/config.py::ConfigTest::test_targetAppConfigMerge",
"yotta/test/config.py::ConfigTest::test_targetConfigMerge",
"yotta/test/ignores.py::TestPackIgnores::test_build",
"yotta/test/ignores.py::TestPackIgnores::test_test"
] |
[
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkModule",
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkNonexistentTarget",
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkNotLinkedModuleGlobally",
"yotta/test/cli/unlink.py::TestCLIUnLink::testUnlinkNotLinkedTargetGlobally",
"yotta/test/ignores.py::TestPackIgnores::test_absolute_ignores",
"yotta/test/ignores.py::TestPackIgnores::test_comments",
"yotta/test/ignores.py::TestPackIgnores::test_default_ignores",
"yotta/test/ignores.py::TestPackIgnores::test_glob_ignores",
"yotta/test/ignores.py::TestPackIgnores::test_relative_ignores"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__yotta-656
|
16cc2baeba653dc77e3ce32c20018b32ab108bf4
|
2016-01-12 15:29:25
|
16cc2baeba653dc77e3ce32c20018b32ab108bf4
|
diff --git a/yotta/lib/pack.py b/yotta/lib/pack.py
index ade5aae..f7ef9d0 100644
--- a/yotta/lib/pack.py
+++ b/yotta/lib/pack.py
@@ -257,6 +257,12 @@ class Pack(object):
else:
return None
+ def getKeywords(self):
+ if self.description:
+ return self.description.get('keywords', [])
+ else:
+ return []
+
def _parseIgnoreFile(self, f):
r = []
for l in f:
diff --git a/yotta/options/__init__.py b/yotta/options/__init__.py
index 1482b43..aa66e80 100644
--- a/yotta/options/__init__.py
+++ b/yotta/options/__init__.py
@@ -11,6 +11,7 @@ from . import noninteractive
from . import registry
from . import target
from . import config
+from . import force
# this modifies argparse when it's imported:
from . import parser
diff --git a/yotta/options/force.py b/yotta/options/force.py
new file mode 100644
index 0000000..33c8e6e
--- /dev/null
+++ b/yotta/options/force.py
@@ -0,0 +1,12 @@
+# Copyright 2014-2015 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0
+# See LICENSE file for details.
+
+def addTo(parser):
+ parser.add_argument('-f', '--force', action='store_true', dest="force",
+ help='Force the operation to (try to) continue even in situations which '+
+ 'would be an error.'
+ )
+
+
diff --git a/yotta/publish.py b/yotta/publish.py
index 28d999b..721d932 100644
--- a/yotta/publish.py
+++ b/yotta/publish.py
@@ -8,11 +8,50 @@ import logging
# validate, , validate things, internal
from .lib import validate
+# options, , shared options, internal
+import yotta.options as options
def addOptions(parser):
- # no options
+ options.force.addTo(parser)
+
+# python 2 + 3 compatibility
+try:
+ global input
+ input = raw_input
+except NameError:
pass
+def prePublishCheck(p, force=False, interactive=True):
+ need_ok = False
+ if p.description.get('bin', None) is not None:
+ logging.warning(
+ 'This is an executable application, not a re-usable library module. Other modules will not be able to depend on it!'
+ )
+ need_ok = True
+
+ official_keywords = [x for x in p.getKeywords() if x.endswith('-official')]
+ if len(official_keywords):
+ need_ok = True
+ for k in official_keywords:
+ prefix = k[:-len('-official')]
+ logging.warning(
+ ('You\'re publishing with the %s tag. Is this really an '+
+ 'officially supported %s module? If not, please remove the %s '+
+ 'tag from your %s file. If you are unsure, please ask on the '+
+ 'issue tracker.') % (
+ k, prefix, k, p.description_filename
+ )
+ )
+
+ if need_ok and not interactive:
+ logging.error('--noninteractive prevents user confirmation. Please re-run with --force')
+ return 1
+
+ if need_ok and not force:
+ input("If you still want to publish, press [enter] to continue.")
+
+ return 0
+
def execCommand(args, following_args):
p = validate.currentDirectoryModuleOrTarget()
if not p:
@@ -22,17 +61,9 @@ def execCommand(args, following_args):
logging.error('The working directory is not clean. Commit before publishing!')
return 1
- if p.description.get('bin', None) is not None:
- logging.warning(
- 'This is an executable application, not a re-usable library module. Other modules will not be able to depend on it!'
- )
- # python 2 + 3 compatibility
- try:
- global input
- input = raw_input
- except NameError:
- pass
- raw_input("If you still want to publish it, press [enter] to continue.")
+ errcode = prePublishCheck(p, args.force, args.interactive)
+ if errcode and not args.force:
+ return errcode
error = p.publish(args.registry)
if error:
|
Discourage accidental use of mbed-official keyword
There have been several cases where target descriptions have been published with descriptions and keywords indicating that they are officially supported, when in fact they aren't.
yotta should warn when these keywords are used, to make sure that their use is intentional.
|
ARMmbed/yotta
|
diff --git a/yotta/test/cli/test_publish.py b/yotta/test/cli/test_publish.py
index de93d77..11b713e 100644
--- a/yotta/test/cli/test_publish.py
+++ b/yotta/test/cli/test_publish.py
@@ -13,7 +13,7 @@ import tempfile
# internal modules:
from yotta.lib.fsutils import rmRf
from . import cli
-
+from . import util
Test_Target = "x86-osx-native,*"
@@ -54,6 +54,26 @@ Public_Module_JSON = '''{
}'''
+Test_Publish = {
+'module.json':'''{
+ "name": "test-publish",
+ "version": "0.0.0",
+ "description": "Test yotta publish",
+ "author": "James Crosby <[email protected]>",
+ "license": "Apache-2.0",
+ "keywords": ["mbed-official"],
+ "dependencies":{
+ }
+}''',
+'readme.md':'''##This is a test module used in yotta's test suite.''',
+'source/foo.c':'''#include "stdio.h"
+int foo(){
+ printf("foo!\\n");
+ return 7;
+}'''
+}
+
+
class TestCLIPublish(unittest.TestCase):
@classmethod
def setUpClass(cls):
@@ -89,6 +109,15 @@ class TestCLIPublish(unittest.TestCase):
else:
del os.environ['YOTTA_USER_SETTINGS_DIR']
+ def test_warnOfficialKeywords(self):
+ path = util.writeTestFiles(Test_Publish, True)
+
+ stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', '--noninteractive', 'publish'], cwd=path)
+ self.assertNotEqual(statuscode, 0)
+ self.assertIn('Is this really an officially supported mbed module', stdout + stderr)
+
+ util.rmRf(path)
+
if __name__ == '__main__':
unittest.main()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 3
}
|
0.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc cmake ninja-build"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==1.0.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
colorama==0.3.9
cryptography==44.0.2
Deprecated==1.2.18
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
hgapi==1.7.4
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
intelhex==2.3.0
intervaltree==3.1.0
Jinja2==2.11.3
jsonpointer==2.0
jsonschema==2.6.0
MarkupSafe==3.0.2
mbed_test_wrapper==0.0.3
packaging @ file:///croot/packaging_1734472117206/work
pathlib==1.0.1
pluggy @ file:///croot/pluggy_1733169602837/work
project-generator-definitions==0.2.46
project_generator==0.8.17
pycparser==2.22
pyelftools==0.23
PyGithub==1.54.1
PyJWT==1.7.1
pyocd==0.15.0
pytest @ file:///croot/pytest_1738938843180/work
pyusb==1.3.1
PyYAML==3.13
requests==2.32.3
semantic-version==2.10.0
six==1.17.0
sortedcontainers==2.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
urllib3==2.3.0
valinor==0.0.15
websocket-client==1.8.0
wrapt==1.17.2
xmltodict==0.14.2
-e git+https://github.com/ARMmbed/yotta.git@16cc2baeba653dc77e3ce32c20018b32ab108bf4#egg=yotta
|
name: yotta
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==1.0.0
- argparse==1.4.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- colorama==0.3.9
- cryptography==44.0.2
- deprecated==1.2.18
- future==1.0.0
- hgapi==1.7.4
- idna==3.10
- intelhex==2.3.0
- intervaltree==3.1.0
- jinja2==2.11.3
- jsonpointer==2.0
- jsonschema==2.6.0
- markupsafe==3.0.2
- mbed-test-wrapper==0.0.3
- pathlib==1.0.1
- project-generator==0.8.17
- project-generator-definitions==0.2.46
- pycparser==2.22
- pyelftools==0.23
- pygithub==1.54.1
- pyjwt==1.7.1
- pyocd==0.15.0
- pyusb==1.3.1
- pyyaml==3.13
- requests==2.32.3
- semantic-version==2.10.0
- six==1.17.0
- sortedcontainers==2.4.0
- urllib3==2.3.0
- valinor==0.0.15
- websocket-client==1.8.0
- wrapt==1.17.2
- xmltodict==0.14.2
prefix: /opt/conda/envs/yotta
|
[
"yotta/test/cli/test_publish.py::TestCLIPublish::test_warnOfficialKeywords"
] |
[
"yotta/test/cli/test_publish.py::TestCLIPublish::test_publishNotAuthed"
] |
[
"yotta/test/cli/test_publish.py::TestCLIPublish::test_publishPrivate"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__yotta-802
|
ae1cda2082f6f82c1c9f80f6194fcae62d228bc1
|
2017-03-28 19:14:56
|
ae1cda2082f6f82c1c9f80f6194fcae62d228bc1
|
diff --git a/docs/reference/buildsystem.md b/docs/reference/buildsystem.md
index e728c9f..6cc8bd9 100644
--- a/docs/reference/buildsystem.md
+++ b/docs/reference/buildsystem.md
@@ -30,7 +30,7 @@ The name of the library being built by the current module is available as
No header needs to be included for this definition to be available.
Use the [preprocessor stringification
-trick](https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html) to get the
+trick](https://gcc.gnu.org/onlinedocs/cpp/Stringification.html) to get the
module name as a string, if desired. Note that this definition is **not**
currently available when compiling tests, and there are other circumstances
where using custom CMake can make it unavailable.
diff --git a/docs/reference/commands.md b/docs/reference/commands.md
index 7269eca..30ee1bf 100755
--- a/docs/reference/commands.md
+++ b/docs/reference/commands.md
@@ -534,7 +534,7 @@ example:
## <a href="#yotta-uninstall" name="yotta-uninstall">#</a> yotta uninstall
-Synonyms: `yotta unlink`, `yotta rm`
+Synonyms: `yotta unlink`, `yotta rm`, `yotta un`
#### Synopsis
```
diff --git a/docs/reference/config.md b/docs/reference/config.md
index d56a2f5..43be6bb 100644
--- a/docs/reference/config.md
+++ b/docs/reference/config.md
@@ -267,7 +267,7 @@ definitions will be produced:
Note that string values are not quoted. If you want a quoted string,
either embed escaped quotes (`\"`) in the string value, or use the preprocessor
[stringification
-trick](https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html).
+trick](https://gcc.gnu.org/onlinedocs/cpp/Stringification.html).
JSON boolean values are converted to 1 or 0, and `null` values are converted to `NULL`.
diff --git a/docs/reference/module.md b/docs/reference/module.md
index 4bc38c5..57498c1 100755
--- a/docs/reference/module.md
+++ b/docs/reference/module.md
@@ -198,6 +198,10 @@ To specify a dependency on a github module, use one of the following forms:
Uses the latest committed version on the specified branch.
+ * `"usefulmodule": "username/repositoryname#commit-id"`
+
+ Uses the specified commit ID.
+
#### Depending on git Modules
To specify a module available from a non-Github git server as a dependency, use
a git URL:
@@ -206,8 +210,9 @@ a git URL:
* `"usefulmodule": "git+ssh://somwhere.com/anything/anywhere#<version specification>"`
* `"usefulmodule": "git+ssh://somwhere.com/anything/anywhere#<branch name>"`
* `"usefulmodule": "git+ssh://somwhere.com/anything/anywhere#<tag name>"`
+ * `"usefulmodule": "git+ssh://somwhere.com/anything/anywhere#<commit id>"`
* `"usefulmodule": "<anything>://somwhere.git"`
- * `"usefulmodule": "<anything>://somwhere.git#<version spec, tag, or branch name>"`
+ * `"usefulmodule": "<anything>://somwhere.git#<version spec, tag, branch name or commit id>"`
#### Depending on hg Modules
To specify a module available from a mercurial server as a dependency, use
diff --git a/docs/tutorial/privaterepos.md b/docs/tutorial/privaterepos.md
index 471d2de..630ad9a 100644
--- a/docs/tutorial/privaterepos.md
+++ b/docs/tutorial/privaterepos.md
@@ -24,18 +24,33 @@ Sometimes it may not be appropriate publish a module to the public package regis
The shorthand GitHub URL is formed of two parts: `<username>/<reponame>` where `<username>` is the GitHub user or organisation name of the repository owner and `<reponame>` is the name of the repositiry. e.g. the `yotta` repositry can be found at `ARMmbed/yotta`.
-You can specify a particular branch or tag to use by providing it in the URL. The supported GitHub URL formats are:
+You can specify a particular branch, tag or commit to use by providing it in the URL. The supported GitHub URL formats are:
```
username/reponame
username/reponame#<versionspec>
username/reponame#<branchname>
username/reponame#<tagname>
+username/reponame#<commit>
+https://github.com/username/reponame
+https://github.com/username/reponame#<branchname>
+https://github.com/username/reponame#<tagname>
+https://github.com/username/reponame#<commit>
```
+If the GitHub repository is public, the dependency will simply be downloaded. If the GitHub repository is private and this is the first time you are downloading from a private GitHub repository, you will be prompted to log in to GitHub using a URL.
+
+If you have a private GitHub repository and you would prefer to download it using SSH keys, you can use the following dependency form:
+
+```
[email protected]:username/reponame.git
[email protected]:username/reponame.git#<branchname>
[email protected]:username/reponame.git#<tagname>
[email protected]:username/reponame.git#<commit>
+```
###Other ways to depend on private repositories
-Using shorthand GitHub URLs is the easiest and reccomneded method of working with private repositories, however as not all projects are hosted on GitHub, `yotta` supports using git and hg URLs directly as well.
+Using shorthand GitHub URLs is the easiest and recommended method of working with private repositories, however as not all projects are hosted on GitHub, `yotta` supports using git and hg URLs directly as well.
For example, to include a privately hosted git repository from example.com:
@@ -47,13 +62,13 @@ For example, to include a privately hosted git repository from example.com:
...
```
-Git URLs support branch, version and tags specifications:
+Git URLs support branch, version, tag and commit specifications:
```
git+ssh://example.com/path/to/repo
-git+ssh://example.com/path/to/repo#<versionspec, branch or tag>
+git+ssh://example.com/path/to/repo#<versionspec, branch, tag or commit>
anything://example.com/path/to/repo.git
-anything://example.com/path/to/repo.git#<versionspec, branch or tag>
+anything://example.com/path/to/repo.git#<versionspec, branch, tag or commit>
```
Currently, mercurial URLs only support a version specification:
diff --git a/yotta/install.py b/yotta/install.py
index 28e2816..1ed7d8a 100644
--- a/yotta/install.py
+++ b/yotta/install.py
@@ -167,7 +167,12 @@ def installComponentAsDependency(args, current_component):
# (if it is not already present), and write that back to disk. Without
# writing to disk the dependency wouldn't be usable.
if installed and not current_component.hasDependency(component_name):
- saved_spec = current_component.saveDependency(installed)
+ vs = sourceparse.parseSourceURL(component_spec)
+ if vs.source_type == 'registry':
+ saved_spec = current_component.saveDependency(installed)
+ else:
+ saved_spec = current_component.saveDependency(installed, component_spec)
+
current_component.writeDescription()
logging.info('dependency %s: %s written to module.json', component_name, saved_spec)
else:
diff --git a/yotta/lib/access.py b/yotta/lib/access.py
index ae8fcac..51dec3b 100644
--- a/yotta/lib/access.py
+++ b/yotta/lib/access.py
@@ -147,8 +147,14 @@ def latestSuitableVersion(name, version_required, registry='modules', quiet=Fals
)
if v:
return v
+
+ # we have passed a specific commit ID:
+ v = remote_component.commitVersion()
+ if v:
+ return v
+
raise access_common.Unavailable(
- 'Github repository "%s" does not have any tags or branches matching "%s"' % (
+ 'Github repository "%s" does not have any tags, branches or commits matching "%s"' % (
version_required, remote_component.tagOrBranchSpec()
)
)
@@ -189,8 +195,14 @@ def latestSuitableVersion(name, version_required, registry='modules', quiet=Fals
)
if v:
return v
+
+ # we have passed a specific commit ID:
+ v = local_clone.commitVersion(remote_component.tagOrBranchSpec())
+ if v:
+ return v
+
raise access_common.Unavailable(
- '%s repository "%s" does not have any tags or branches matching "%s"' % (
+ '%s repository "%s" does not have any tags, branches or commits matching "%s"' % (
clone_type, version_required, spec
)
)
diff --git a/yotta/lib/git_access.py b/yotta/lib/git_access.py
index f53e19f..4b2bbb1 100644
--- a/yotta/lib/git_access.py
+++ b/yotta/lib/git_access.py
@@ -73,8 +73,18 @@ class GitWorkingCopy(object):
def tipVersion(self):
- return GitCloneVersion('', '', self)
+ raise NotImplementedError
+ def commitVersion(self, spec):
+ ''' return a GithubComponentVersion object for a specific commit if valid
+ '''
+ import re
+
+ commit_match = re.match('^[a-f0-9]{7,40}$', spec, re.I)
+ if commit_match:
+ return GitCloneVersion('', spec, self)
+
+ return None
class GitComponent(access_common.RemoteComponent):
def __init__(self, url, tag_or_branch=None, semantic_spec=None):
diff --git a/yotta/lib/github_access.py b/yotta/lib/github_access.py
index e2d47a1..b1f293f 100644
--- a/yotta/lib/github_access.py
+++ b/yotta/lib/github_access.py
@@ -141,6 +141,12 @@ def _getTipArchiveURL(repo):
repo = g.get_repo(repo)
return repo.get_archive_link('tarball')
+@_handleAuth
+def _getCommitArchiveURL(repo, commit):
+ ''' return a string containing a tarball url '''
+ g = Github(settings.getProperty('github', 'authtoken'))
+ repo = g.get_repo(repo)
+ return repo.get_archive_link('tarball', commit)
@_handleAuth
def _getTarball(url, into_directory, cache_key, origin_info=None):
@@ -283,6 +289,19 @@ class GithubComponent(access_common.RemoteComponent):
'', '', _getTipArchiveURL(self.repo), self.name, cache_key=None
)
+ def commitVersion(self):
+ ''' return a GithubComponentVersion object for a specific commit if valid
+ '''
+ import re
+
+ commit_match = re.match('^[a-f0-9]{7,40}$', self.tagOrBranchSpec(), re.I)
+ if commit_match:
+ return GithubComponentVersion(
+ '', '', _getCommitArchiveURL(self.repo, self.tagOrBranchSpec()), self.name, cache_key=None
+ )
+
+ return None
+
@classmethod
def remoteType(cls):
return 'github'
diff --git a/yotta/lib/sourceparse.py b/yotta/lib/sourceparse.py
index 1b1176e..0f451ad 100644
--- a/yotta/lib/sourceparse.py
+++ b/yotta/lib/sourceparse.py
@@ -51,39 +51,55 @@ class VersionSource(object):
return self.semantic_spec.match(v)
-def _splitFragment(url):
- parsed = urlsplit(url)
- if '#' in url:
- return url[:url.index('#')], parsed.fragment
- else:
- return url, None
-
-def _getGithubRef(source_url):
+def _getNonRegistryRef(source_url):
import re
+
# something/something#spec = github
- defragmented, fragment = _splitFragment(source_url)
- github_match = re.match('^[a-z0-9_-]+/([a-z0-9_-]+)$', defragmented, re.I)
+ # something/something@spec = github
+ # something/something spec = github
+ github_match = re.match('^([.a-z0-9_-]+/([.a-z0-9_-]+)) *[@#]?([.a-z0-9_\-\*\^\~\>\<\=]*)$', source_url, re.I)
if github_match:
- return github_match.group(1), VersionSource('github', defragmented, fragment)
+ return github_match.group(2), VersionSource('github', github_match.group(1), github_match.group(3))
- # something/something@spec = github
- alternate_github_match = re.match('([a-z0-9_-]+/([a-z0-9_-]+)) *@?([~^><=.0-9a-z\*-]*)$', source_url, re.I)
- if alternate_github_match:
- return alternate_github_match.group(2), VersionSource('github', alternate_github_match.group(1), alternate_github_match.group(3))
+ parsed = urlsplit(source_url)
+
+ # github
+ if parsed.netloc.endswith('github.com'):
+ # any URL onto github should be fetched over the github API, even if it
+ # would parse as a valid git URL
+ name_match = re.match('^/([.a-z0-9_-]+/([.a-z0-9_-]+?))(.git)?$', parsed.path, re.I)
+ if name_match:
+ return name_match.group(2), VersionSource('github', name_match.group(1), parsed.fragment)
+
+ if '#' in source_url:
+ without_fragment = source_url[:source_url.index('#')]
+ else:
+ without_fragment = source_url
+
+ # git
+ if parsed.scheme.startswith('git+') or parsed.path.endswith('.git'):
+ # git+anything://anything or anything.git is a git repo:
+ name_match = re.match('^.*?([.a-z0-9_-]+?)(.git)?$', parsed.path, re.I)
+ if name_match:
+ return name_match.group(1), VersionSource('git', without_fragment, parsed.fragment)
+
+ # mercurial
+ if parsed.scheme.startswith('hg+') or parsed.path.endswith('.hg'):
+ # hg+anything://anything or anything.hg is a hg repo:
+ name_match = re.match('^.*?([.a-z0-9_-]+?)(.hg)?$', parsed.path, re.I)
+ if name_match:
+ return name_match.group(1), VersionSource('hg', without_fragment, parsed.fragment)
return None, None
+
def parseSourceURL(source_url):
''' Parse the specified version source URL (or version spec), and return an
instance of VersionSource
'''
- import re
- parsed = urlsplit(source_url)
-
- if '#' in source_url:
- without_fragment = source_url[:source_url.index('#')]
- else:
- without_fragment = source_url
+ name, spec = _getNonRegistryRef(source_url)
+ if spec:
+ return spec
try:
url_is_spec = version.Spec(source_url)
@@ -94,22 +110,6 @@ def parseSourceURL(source_url):
# if the url is an unadorned version specification (including an empty
# string) then the source is the module registry:
return VersionSource('registry', '', source_url)
- elif parsed.netloc.endswith('github.com'):
- # any URL onto github should be fetched over the github API, even if it
- # would parse as a valid git URL
- return VersionSource('github', parsed.path, parsed.fragment)
- elif parsed.scheme.startswith('git+') or parsed.path.endswith('.git'):
- # git+anything://anything or anything.git is a git repo:
- return VersionSource('git', without_fragment, parsed.fragment)
- elif parsed.scheme.startswith('hg+') or parsed.path.endswith('.hg'):
- # hg+anything://anything or anything.hg is a hg repo:
- return VersionSource('hg', without_fragment, parsed.fragment)
-
- # something/something@spec = github
- # something/something#spec = github
- module_name, github_match = _getGithubRef(source_url)
- if github_match:
- return github_match
raise InvalidVersionSpec("Invalid version specification: \"%s\"" % (source_url))
@@ -143,8 +143,8 @@ def parseTargetNameAndSpec(target_name_and_spec):
import re
# fist check if this is a raw github specification that we can get the
# target name from:
- name, spec = _getGithubRef(target_name_and_spec)
- if name and spec:
+ name, spec = _getNonRegistryRef(target_name_and_spec)
+ if name:
return name, target_name_and_spec
# next split at the first @ or , if any
@@ -178,8 +178,8 @@ def parseModuleNameAndSpec(module_name_and_spec):
import re
# fist check if this is a raw github specification that we can get the
# module name from:
- name, spec = _getGithubRef(module_name_and_spec)
- if name and spec:
+ name, spec = _getNonRegistryRef(module_name_and_spec)
+ if name:
return name, module_name_and_spec
# next split at the first @, if any
diff --git a/yotta/link.py b/yotta/link.py
index d13263d..8275e4f 100644
--- a/yotta/link.py
+++ b/yotta/link.py
@@ -11,9 +11,6 @@ def addOptions(parser):
)
def tryLink(src, dst):
- # standard library modules, , ,
- import logging
-
# fsutils, , misc filesystem utils, internal
from yotta.lib import fsutils
try:
diff --git a/yotta/link_target.py b/yotta/link_target.py
index e67de6a..0ad10dd 100644
--- a/yotta/link_target.py
+++ b/yotta/link_target.py
@@ -11,9 +11,6 @@ def addOptions(parser):
)
def tryLink(src, dst):
- # standard library modules, , ,
- import logging
-
# fsutils, , misc filesystem utils, internal
from yotta.lib import fsutils
try:
diff --git a/yotta/main.py b/yotta/main.py
index c18cd72..12f6839 100644
--- a/yotta/main.py
+++ b/yotta/main.py
@@ -201,6 +201,7 @@ def main():
short_commands = {
'up':subparser.choices['update'],
'in':subparser.choices['install'],
+ 'un':subparser.choices['uninstall'],
'ln':subparser.choices['link'],
'v':subparser.choices['version'],
'ls':subparser.choices['list'],
|
Install yotta modules from github with git credentials
I'd like to do following but it fails:
```
$ yotta install [email protected]:ARMmbed/module-x.git
info: get versions for git
Fatal Exception, yotta=0.17.2
Traceback (most recent call last):
File "/home/jaakor01/workspace/yotta_issue/venv/bin/yotta", line 4, in <module>
yotta.main()
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/main.py", line 61, in wrapped
return fn(*args, **kwargs)
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/main.py", line 46, in wrapped
return fn(*args, **kwargs)
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/main.py", line 243, in main
status = args.command(args, following_args)
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/install.py", line 62, in execCommand
return installComponent(args)
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/install.py", line 202, in installComponent
working_directory = path
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/access.py", line 385, in satisfyVersion
name, version_required, working_directory, type=type, inherit_shrinkwrap = inherit_shrinkwrap
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/access.py", line 314, in satisfyVersionByInstalling
v = latestSuitableVersion(name, version_required, _registryNamespaceForType(type))
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/access.py", line 159, in latestSuitableVersion
local_clone = remote_component.clone()
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/git_access.py", line 114, in clone
clone = vcs.Git.cloneToTemporaryDir(self.url)
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/vcs.py", line 62, in cloneToTemporaryDir
return cls.cloneToDirectory(remote, tempfile.mkdtemp())
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/vcs.py", line 69, in cloneToDirectory
cls._execCommands(commands)
File "/home/jaakor01/workspace/yotta_issue/venv/local/lib/python2.7/site-packages/yotta/lib/vcs.py", line 146, in _execCommands
raise VCSError("command failed: %s" % (err or out), returncode=returncode, command=cmd)
yotta.lib.vcs.VCSError: command failed: Cloning into '/tmp/tmpi_bJ_8'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
```
However, if I add the same address manually to `module.json` it works with `yotta update`.
```
"dependencies": {
"module-x":"[email protected]:ARMmbed/module-x.git#master"
},
```
|
ARMmbed/yotta
|
diff --git a/yotta/test/test_sourceparse.py b/yotta/test/test_sourceparse.py
index 412f4ad..0b7af6f 100644
--- a/yotta/test/test_sourceparse.py
+++ b/yotta/test/test_sourceparse.py
@@ -11,50 +11,60 @@ import unittest
# sourceparse, , parse version source urls, internal
from yotta.lib import sourceparse
-
-Registry_URLs = [
- '',
- '*',
- '1.2.3',
- '>=1.2.3',
- '^0.1.2',
- '~0.1.2',
+# Shorthand URLs for GitHub
+ShortHand_URLs = [
+ 'username/reponame',
]
+# Longhand URLs for GitHub
Github_URLs = [
- 'username/reponame',
- 'username/reponame#1.2.3',
- 'username/reponame#^1.2.3',
- 'username/reponame#-1.2.3',
- 'username/reponame#branch-or-tag-name',
- 'username/[email protected]',
- 'username/reponame@^1.2.3',
- 'username/[email protected]',
- 'username/reponame@branch-or-tag-name',
+ 'https://github.com/username/reponame.git',
+ 'git://github.com/username/reponame.git',
+ 'git+http://[email protected]/username/reponame.git',
+ 'git+https://[email protected]/username/reponame.git',
]
Git_URLs = [
- 'git+ssh://somewhere.com/something/etc/etc',
- 'git+ssh://somewhere.com/something/etc/etc#1.2.3',
- 'git+ssh://somewhere.com/something/etc/etc#^1.2.3',
- 'git+ssh://somewhere.com/something/etc/etc#~1.2.3',
- 'git+ssh://somewhere.com/something/etc/etc#branch-name',
- 'ssh://somewhere.com/something/etc/etc.git',
- 'ssh://somewhere.com/something/etc/etc.git#^1.2.3',
- 'ssh://somewhere.com/something/etc/etc.git#~1.2.3',
- 'ssh://somewhere.com/something/etc/etc.git#branch-name',
- 'http://somewhere.something/something.git',
+ 'http://somewhere.something/reponame.git',
+ 'https://somewhere.something/reponame.git',
+ 'ssh://somewhere.com/something/etc/reponame.git',
+ 'git+ssh://somewhere.com/something/etc/reponame',
+ '[email protected]:username/reponame.git',
]
HG_URLs = [
- 'hg+ssh://somewhere.com/something/etc/etc',
- 'hg+ssh://somewhere.com/something/etc/etc#1.2.3',
- 'hg+ssh://somewhere.com/something/etc/etc#^1.2.3',
- 'hg+ssh://somewhere.com/something/etc/etc#~1.2.3',
- 'ssh://somewhere.com/something/etc/etc.hg',
- 'ssh://somewhere.com/something/etc/etc.hg#^1.2.3',
- 'ssh://somewhere.com/something/etc/etc.hg#~1.2.3',
- 'http://somewhere.something/something.hg',
+ 'http://somewhere.something/reponame.hg',
+ 'https://somewhere.something/reponame.hg',
+ 'ssh://somewhere.com/something/etc/reponame.hg',
+ 'hg+ssh://somewhere.com/something/etc/reponame',
+]
+
+# We support version spec, branch name, tag name and commit id for GitHub and Git
+Git_Specs = [
+ '',
+ '1.2.3',
+ '^1.2.3',
+ '~1.2.3',
+ '-1.2.3',
+ 'branch-or-tag-name',
+ 'd5f5049',
+]
+
+# We support only version spec for HG
+HG_Specs = [
+ '',
+ '1.2.3',
+ '^1.2.3',
+ '~1.2.3',
+]
+
+Registry_Specs = [
+ '',
+ '*',
+ '1.2.3',
+ '>=1.2.3',
+ '^0.1.2',
+ '~0.1.2',
]
test_invalid_urls = [
@@ -65,24 +75,56 @@ test_invalid_urls = [
class TestParseSourceURL(unittest.TestCase):
def test_registryURLs(self):
- for url in Registry_URLs:
+ for url in Registry_Specs:
sv = sourceparse.parseSourceURL(url)
self.assertEqual(sv.source_type, 'registry')
+ def test_shorthandURLs(self):
+ for url in ShortHand_URLs:
+ for s in Git_Specs:
+ if len(s):
+ # Shorthand URLs support '@' and ' ' as well as '#'
+ for m in ['#', '@', ' ']:
+ sv = sourceparse.parseSourceURL(url + m + s)
+ self.assertEqual(sv.source_type, 'github')
+ self.assertEqual(sv.spec, s)
+ else:
+ sv = sourceparse.parseSourceURL(url)
+ self.assertEqual(sv.source_type, 'github')
+ self.assertEqual(sv.spec, s)
+
def test_githubURLs(self):
for url in Github_URLs:
- sv = sourceparse.parseSourceURL(url)
- self.assertEqual(sv.source_type, 'github')
+ for s in Git_Specs:
+ if len(s):
+ source = url + '#' + s
+ else:
+ source = url
+ sv = sourceparse.parseSourceURL(source)
+ self.assertEqual(sv.source_type, 'github')
+ self.assertEqual(sv.spec, s)
def test_gitURLs(self):
for url in Git_URLs:
- sv = sourceparse.parseSourceURL(url)
- self.assertEqual(sv.source_type, 'git')
+ for s in Git_Specs:
+ if len(s):
+ source = url + '#' + s
+ else:
+ source = url
+ sv = sourceparse.parseSourceURL(source)
+ self.assertEqual(sv.source_type, 'git')
+ self.assertEqual(sv.spec, s)
def test_hgURLs(self):
for url in HG_URLs:
- sv = sourceparse.parseSourceURL(url)
- self.assertEqual(sv.source_type, 'hg')
+ for s in HG_Specs:
+ if len(s):
+ source = url + '#' + s
+ else:
+ source = url
+ sv = sourceparse.parseSourceURL(source)
+ self.assertEqual(sv.source_type, 'hg')
+ self.assertEqual(sv.spec, s)
def test_invalid(self):
for url in test_invalid_urls:
@@ -101,38 +143,63 @@ class TestParseModuleNameAndSpec(unittest.TestCase):
self.assertEqual(n, name)
self.assertEqual(s, '*')
+ def test_ShorthandRefs(self):
+ for url in ShortHand_URLs:
+ for spec in Git_Specs:
+ if len(spec):
+ # Shorthand URLs support '@' and ' ' as well as '#'
+ for m in ['#', '@', ' ']:
+ ns = url + m + spec
+ n, s = sourceparse.parseModuleNameAndSpec(ns)
+ self.assertEqual(n, 'reponame')
+ self.assertEqual(s, ns)
+ else:
+ n, s = sourceparse.parseModuleNameAndSpec(url)
+ self.assertEqual(n, 'reponame')
+ self.assertEqual(s, url)
+
def test_GithubRefs(self):
for url in Github_URLs:
- n, s = sourceparse.parseModuleNameAndSpec(url)
- self.assertEqual(n, 'reponame')
+ for spec in Git_Specs:
+ if len(spec):
+ ns = url + '#' + spec
+ else:
+ ns = url
+ n, s = sourceparse.parseModuleNameAndSpec(ns)
+ self.assertEqual(n, 'reponame')
+ self.assertEqual(s, ns)
+
+ def test_GitRefs(self):
+ for url in Git_URLs:
+ for spec in Git_Specs:
+ if len(spec):
+ ns = url + '#' + spec
+ else:
+ ns = url
+ n, s = sourceparse.parseModuleNameAndSpec(ns)
+ self.assertEqual(n, 'reponame')
+ self.assertEqual(s, ns)
+
+ def test_HGRefs(self):
+ for url in HG_URLs:
+ for spec in HG_Specs:
+ if len(spec):
+ ns = url + '#' + spec
+ else:
+ ns = url
+ n, s = sourceparse.parseModuleNameAndSpec(ns)
+ self.assertEqual(n, 'reponame')
+ self.assertEqual(s, ns)
def test_atVersion(self):
for name in Valid_Names:
- for v in Registry_URLs:
+ for v in Registry_Specs:
if len(v):
nv = name + '@' + v
n, s = sourceparse.parseModuleNameAndSpec(nv)
self.assertEqual(n, name)
self.assertEqual(s, v)
- def test_atGitURL(self):
- for name in Valid_Names:
- for v in Git_URLs:
- nv = name + '@' + v
- n, s = sourceparse.parseModuleNameAndSpec(nv)
- self.assertEqual(n, name)
- self.assertEqual(s, v)
-
- def test_atHGURL(self):
- for name in Valid_Names:
- for v in HG_URLs:
- nv = name + '@' + v
- n, s = sourceparse.parseModuleNameAndSpec(nv)
- self.assertEqual(n, name)
- self.assertEqual(s, v)
-
if __name__ == '__main__':
unittest.main()
-
-
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 13
}
|
0.17
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.4",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==1.12.3
attrs==22.2.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
colorama==0.3.9
coverage==6.2
cryptography==40.0.2
Deprecated==1.2.18
execnet==1.9.0
future==1.0.0
hgapi==1.7.4
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
intelhex==2.3.0
intervaltree==3.1.0
Jinja2==2.11.3
jsonpointer==1.14
jsonschema==2.6.0
MarkupSafe==2.0.1
mbed-test-wrapper==1.0.0
packaging==21.3
pathlib==1.0.1
pluggy==1.0.0
project-generator==0.8.17
project-generator-definitions==0.2.46
py==1.11.0
pycparser==2.21
pyelftools==0.23
PyGithub==1.54.1
PyJWT==1.7.1
pyocd==0.15.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
pyusb==1.2.1
PyYAML==3.13
requests==2.27.1
semantic-version==2.10.0
six==1.17.0
sortedcontainers==2.4.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
valinor==0.0.15
websocket-client==1.3.1
wrapt==1.16.0
xmltodict==0.14.2
-e git+https://github.com/ARMmbed/yotta.git@ae1cda2082f6f82c1c9f80f6194fcae62d228bc1#egg=yotta
zipp==3.6.0
|
name: yotta
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==1.12.3
- argparse==1.4.0
- attrs==22.2.0
- cffi==1.15.1
- charset-normalizer==2.0.12
- colorama==0.3.9
- coverage==6.2
- cryptography==40.0.2
- deprecated==1.2.18
- execnet==1.9.0
- future==1.0.0
- hgapi==1.7.4
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- intelhex==2.3.0
- intervaltree==3.1.0
- jinja2==2.11.3
- jsonpointer==1.14
- jsonschema==2.6.0
- markupsafe==2.0.1
- mbed-test-wrapper==1.0.0
- packaging==21.3
- pathlib==1.0.1
- pluggy==1.0.0
- project-generator==0.8.17
- project-generator-definitions==0.2.46
- py==1.11.0
- pycparser==2.21
- pyelftools==0.23
- pygithub==1.54.1
- pyjwt==1.7.1
- pyocd==0.15.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- pyusb==1.2.1
- pyyaml==3.13
- requests==2.27.1
- semantic-version==2.10.0
- six==1.17.0
- sortedcontainers==2.4.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- valinor==0.0.15
- websocket-client==1.3.1
- wrapt==1.16.0
- xmltodict==0.14.2
- zipp==3.6.0
prefix: /opt/conda/envs/yotta
|
[
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_shorthandURLs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_GitRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_GithubRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_HGRefs"
] |
[] |
[
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_gitURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_githubURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_hgURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_invalid",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_registryURLs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_ShorthandRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_atVersion",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_validNames"
] |
[] |
Apache License 2.0
| null |
|
ARMmbed__yotta-804
|
4094b7a26c66dd64ff724d4f72da282d41ea9fca
|
2017-04-06 15:06:03
|
2575c2f7cd0977b5df2347223738629d28e5310b
|
diff --git a/yotta/lib/sourceparse.py b/yotta/lib/sourceparse.py
index 0f451ad..eb1f0b4 100644
--- a/yotta/lib/sourceparse.py
+++ b/yotta/lib/sourceparse.py
@@ -57,7 +57,7 @@ def _getNonRegistryRef(source_url):
# something/something#spec = github
# something/something@spec = github
# something/something spec = github
- github_match = re.match('^([.a-z0-9_-]+/([.a-z0-9_-]+)) *[@#]?([.a-z0-9_\-\*\^\~\>\<\=]*)$', source_url, re.I)
+ github_match = re.match(r'^([.a-z0-9_-]+/([.a-z0-9_-]+)) *[@#]?([^/:\?\[\\]*)$', source_url, re.I)
if github_match:
return github_match.group(2), VersionSource('github', github_match.group(1), github_match.group(3))
|
Semver incompatibility
Hi,
It seems the recent version has broken semantic version for any previous version, which we heavily use in our project, [microbit-dal](https://github.com/lancaster-university/microbit-dal).
We have had two new users on v18 who have reported this breakage: https://github.com/lancaster-university/microbit-dal/issues/282
Any help would be greatly appreciated :smile:
|
ARMmbed/yotta
|
diff --git a/yotta/test/test_sourceparse.py b/yotta/test/test_sourceparse.py
index 0b7af6f..2c421ba 100644
--- a/yotta/test/test_sourceparse.py
+++ b/yotta/test/test_sourceparse.py
@@ -47,6 +47,7 @@ Git_Specs = [
'~1.2.3',
'-1.2.3',
'branch-or-tag-name',
+ 'branch+or+tag+name',
'd5f5049',
]
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 1
}
|
0.18
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==1.12.3
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
colorama==0.3.9
cryptography==44.0.2
Deprecated==1.2.18
exceptiongroup==1.2.2
future==1.0.0
hgapi==1.7.4
idna==3.10
iniconfig==2.1.0
intelhex==2.3.0
intervaltree==3.1.0
Jinja2==2.11.3
jsonpointer==1.14
jsonschema==2.6.0
MarkupSafe==3.0.2
mbed_test_wrapper==1.0.0
packaging==24.2
pathlib==1.0.1
pluggy==1.5.0
project-generator-definitions==0.2.46
project_generator==0.8.17
pycparser==2.22
pyelftools==0.23
PyGithub==1.54.1
PyJWT==1.7.1
pyocd==0.15.0
pytest==8.3.5
pyusb==1.3.1
PyYAML==3.13
requests==2.32.3
semantic-version==2.10.0
six==1.17.0
sortedcontainers==2.4.0
tomli==2.2.1
urllib3==2.3.0
valinor==0.0.15
websocket-client==1.8.0
wrapt==1.17.2
xmltodict==0.14.2
-e git+https://github.com/ARMmbed/yotta.git@4094b7a26c66dd64ff724d4f72da282d41ea9fca#egg=yotta
|
name: yotta
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==1.12.3
- argparse==1.4.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- colorama==0.3.9
- cryptography==44.0.2
- deprecated==1.2.18
- exceptiongroup==1.2.2
- future==1.0.0
- hgapi==1.7.4
- idna==3.10
- iniconfig==2.1.0
- intelhex==2.3.0
- intervaltree==3.1.0
- jinja2==2.11.3
- jsonpointer==1.14
- jsonschema==2.6.0
- markupsafe==3.0.2
- mbed-test-wrapper==1.0.0
- packaging==24.2
- pathlib==1.0.1
- pluggy==1.5.0
- project-generator==0.8.17
- project-generator-definitions==0.2.46
- pycparser==2.22
- pyelftools==0.23
- pygithub==1.54.1
- pyjwt==1.7.1
- pyocd==0.15.0
- pytest==8.3.5
- pyusb==1.3.1
- pyyaml==3.13
- requests==2.32.3
- semantic-version==2.10.0
- six==1.17.0
- sortedcontainers==2.4.0
- tomli==2.2.1
- urllib3==2.3.0
- valinor==0.0.15
- websocket-client==1.8.0
- wrapt==1.17.2
- xmltodict==0.14.2
prefix: /opt/conda/envs/yotta
|
[
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_shorthandURLs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_ShorthandRefs"
] |
[] |
[
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_gitURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_githubURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_hgURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_invalid",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_registryURLs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_GitRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_GithubRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_HGRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_atVersion",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_validNames"
] |
[] |
Apache License 2.0
|
swerebench/sweb.eval.x86_64.armmbed_1776_yotta-804
|
|
ASFHyP3__hyp3-autorift-202
|
ca9bda5f0a8a5db47d0d83c825a9d447a6c4180e
|
2023-01-06 06:48:03
|
ca9bda5f0a8a5db47d0d83c825a9d447a6c4180e
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e092e35..a9108fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.10.4]
+
+### Fixed
+* Landsat 7+8 pairs will be filtered appropriately; see [#201](https://github.com/ASFHyP3/hyp3-autorift/issues/201)
+
## [0.10.3]
### Added
diff --git a/hyp3_autorift/io.py b/hyp3_autorift/io.py
index d7a1b22..9876b6d 100644
--- a/hyp3_autorift/io.py
+++ b/hyp3_autorift/io.py
@@ -168,7 +168,7 @@ def load_geospatial(infile: str, band: int = 1):
def write_geospatial(outfile: str, data, transform, projection, nodata,
- driver: str = 'GTiff', dtype: int = gdal.GDT_Float64):
+ driver: str = 'GTiff', dtype: int = gdal.GDT_Float64) -> str:
driver = gdal.GetDriverByName(driver)
rows, cols = data.shape
diff --git a/hyp3_autorift/process.py b/hyp3_autorift/process.py
index a56b7f6..b887d5e 100644
--- a/hyp3_autorift/process.py
+++ b/hyp3_autorift/process.py
@@ -11,7 +11,7 @@ import xml.etree.ElementTree as ET
from datetime import datetime
from pathlib import Path
from secrets import token_hex
-from typing import Optional, Tuple
+from typing import Callable, Optional, Tuple
import boto3
import botocore.exceptions
@@ -227,12 +227,11 @@ def get_s1_primary_polarization(granule_name):
raise ValueError(f'Cannot determine co-polarization of granule {granule_name}')
-def create_filtered_filepath(path: str):
+def create_filtered_filepath(path: str) -> Path:
parent = (Path.cwd() / 'filtered').resolve()
parent.mkdir(exist_ok=True)
- out_path = parent / Path(path).name
- return str(out_path)
+ return parent / Path(path).name
def prepare_array_for_filtering(array: np.ndarray, nodata: int) -> Tuple[np.ndarray, np.ndarray]:
@@ -266,32 +265,52 @@ def apply_wallis_nodata_fill_filter(array: np.ndarray, nodata: int) -> Tuple[np.
return filtered, zero_mask
-def apply_landsat_filtering(image_path: str, image_platform: str) -> Tuple[Path, Optional[Path]]:
+def _apply_filter_function(image_path: str, filter_function: Callable) -> Tuple[Path, Optional[Path]]:
image_array, image_transform, image_projection, image_nodata = io.load_geospatial(image_path)
image_array = image_array.astype(np.float32)
+ image_filtered, zero_mask = filter_function(image_array, image_nodata)
+
+ image_new_path = create_filtered_filepath(image_path)
+ _ = io.write_geospatial(str(image_new_path), image_filtered, image_transform, image_projection,
+ nodata=0, dtype=gdal.GDT_Float32)
+
+ zero_path = None
+ if zero_mask is not None:
+ zero_path = create_filtered_filepath(f'{image_new_path.stem}_zeroMask{image_new_path.suffix}')
+ _ = io.write_geospatial(str(zero_path), zero_mask, image_transform, image_projection,
+ nodata=np.iinfo(np.uint8).max, dtype=gdal.GDT_Byte)
+
+ return image_new_path, zero_path
+
+
+def apply_landsat_filtering(reference: str, secondary: str) -> Tuple[Path, Optional[Path], Path, Optional[Path]]:
+ reference_platform = get_platform(reference)
+ secondary_platform = get_platform(secondary)
+ if reference_platform > 'L7' and secondary_platform > 'L7':
+ raise NotImplementedError(
+ f'{reference_platform}+{secondary_platform} pairs should be highpass filtered in autoRIFT instead'
+ )
+
platform_filter_dispatch = {
'L4': apply_fft_filter,
'L5': apply_fft_filter,
'L7': apply_wallis_nodata_fill_filter,
+ 'L8': apply_wallis_nodata_fill_filter, # sometimes paired w/ L7 scenes, so use same filter
}
-
try:
- image_filtered, zero_mask = platform_filter_dispatch[image_platform](image_array, image_nodata)
+ reference_filter = platform_filter_dispatch[reference_platform]
+ secondary_filter = platform_filter_dispatch[secondary_platform]
except KeyError:
- raise NotImplementedError(f'Unknown pre-processing filter for satellite platform: {image_platform}')
+ raise NotImplementedError('Unknown pre-processing filter for satellite platform')
- image_new_path = create_filtered_filepath(image_path)
- image_path = io.write_geospatial(image_new_path, image_filtered, image_transform, image_projection,
- nodata=0, dtype=gdal.GDT_Float32)
+ if reference_filter != secondary_filter:
+ raise NotImplementedError('AutoRIFT not available for image pairs with different preprocessing methods')
- zero_path = None
- if zero_mask is not None:
- zero_path = create_filtered_filepath(f'{Path(image_path).stem}_zeroMask{Path(image_path).suffix}')
- _ = io.write_geospatial(str(zero_path), zero_mask, image_transform, image_projection,
- nodata=np.iinfo(np.uint8).max, dtype=gdal.GDT_Byte)
+ reference_path, reference_zero_path = _apply_filter_function(reference, reference_filter)
+ secondary_path, secondary_zero_path = _apply_filter_function(secondary, secondary_filter)
- return image_path, zero_path
+ return reference_path, reference_zero_path, secondary_path, secondary_zero_path
def process(reference: str, secondary: str, parameter_file: str = DEFAULT_PARAMETER_FILE,
@@ -365,9 +384,10 @@ def process(reference: str, secondary: str, parameter_file: str = DEFAULT_PARAME
secondary_metadata = get_lc2_metadata(secondary)
secondary_path = get_lc2_path(secondary_metadata)
- if platform in ('L4', 'L5', 'L7'):
- reference_path, reference_zero_path = apply_landsat_filtering(reference_path, platform)
- secondary_path, secondary_zero_path = apply_landsat_filtering(secondary_path, platform)
+ filter_platform = min([platform, get_platform(secondary)])
+ if filter_platform in ('L4', 'L5', 'L7'):
+ reference_path, reference_zero_path, secondary_path, secondary_zero_path = \
+ apply_landsat_filtering(reference_path, secondary_path)
if reference_metadata['properties']['proj:epsg'] != secondary_metadata['properties']['proj:epsg']:
log.info('Reference and secondary projections are different! Reprojecting.')
@@ -376,9 +396,6 @@ def process(reference: str, secondary: str, parameter_file: str = DEFAULT_PARAME
if reference_zero_path and secondary_zero_path:
_, _ = io.ensure_same_projection(reference_zero_path, secondary_zero_path)
- elif not isinstance(reference_zero_path, type(secondary_zero_path)):
- raise NotImplementedError('AutoRIFT not available for image pairs with different preprocessing methods')
-
reference_path, secondary_path = io.ensure_same_projection(reference_path, secondary_path)
bbox = reference_metadata['bbox']
|
Landsat 7 + 8 pairs may not be handled well
Since we only look at the reference scene to [determine the platform](https://github.com/ASFHyP3/hyp3-autorift/blob/develop/hyp3_autorift/process.py#L319), we may have some issues with the secondary scene:
- [x] L7 reference scene w/ a L8 secondary will attempt to apply the Wallis filter and bonk:
https://github.com/ASFHyP3/hyp3-autorift/blob/develop/hyp3_autorift/process.py#L269-L282
- [x] L8 reference scene w/ a L7 secondary will not have the Wallis filter applied to it:
https://github.com/ASFHyP3/hyp3-autorift/blob/develop/hyp3_autorift/process.py#L368-L370
Fortunately, in our current campaign pair list, 4/5 pairs are only crossed with 4/5 pairs, and 9 pairs are only crossed with 8, so we should only see issues around 7+8 pairs.
```python
>>> import geopandas as gpd
>>> df = gpd.read_parquet('l45789.parquet')
>>> df.groupby(['ref_mission', 'sec_mission']).reference.count()
ref_mission sec_mission
L4 L4 1058
L5 3203
L5 L4 2988
L5 767024
L7 L7 2003704
L8 474339
L8 L7 416539
L8 4103107
L9 367178
L9 L8 112403
L9 109936
```
**Fix:** AutoRIFT pre-processing defaults to the strictest filtering, so we should allow L8 scenes to be wallis filled if either pair is L7. And we should check both ref, sec platform when deciding to run the pre-processing filters or not in `process.py`
|
ASFHyP3/hyp3-autorift
|
diff --git a/tests/test_process.py b/tests/test_process.py
index eae954f..42d58d1 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -1,5 +1,6 @@
import io
from datetime import datetime
+from pathlib import Path
from re import match
from unittest import mock
from unittest.mock import MagicMock, patch
@@ -358,3 +359,67 @@ def test_get_s1_primary_polarization():
process.get_s1_primary_polarization('S1A_IW_SLC__1SVH_20150706T015744_20150706T015814_006684_008EF7_9B69')
with pytest.raises(ValueError):
process.get_s1_primary_polarization('S1A_IW_GRDH_1SVV_20150706T015720_20150706T015749_006684_008EF7_54BA')
+
+
+def test_apply_landsat_filtering(monkeypatch):
+ def mock_apply_filter_function(scene, _):
+ if process.get_platform(scene) < 'L7':
+ return Path(scene), None
+ return Path(scene), Path('zero_mask')
+
+ monkeypatch.setattr(process, '_apply_filter_function', mock_apply_filter_function)
+
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC09', 'LC09')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC09', 'LC08')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC09', 'LE07')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC09', 'LT05')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC09', 'LT04')
+
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC08', 'LC09')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC08', 'LC08')
+ assert process.apply_landsat_filtering('LC08', 'LE07') == \
+ (Path('LC08'), Path('zero_mask'), Path('LE07'), Path('zero_mask'))
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC08', 'LT05')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LC08', 'LT04')
+
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LE07', 'LC09')
+ assert process.apply_landsat_filtering('LE07', 'LC08') == \
+ (Path('LE07'), Path('zero_mask'), Path('LC08'), Path('zero_mask'))
+ assert process.apply_landsat_filtering('LE07', 'LE07') == \
+ (Path('LE07'), Path('zero_mask'), Path('LE07'), Path('zero_mask'))
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LE07', 'LT05')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LE07', 'LT04')
+
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LT05', 'LC09')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LT05', 'LC08')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LT05', 'LE07')
+ assert process.apply_landsat_filtering('LT05', 'LT05') == \
+ (Path('LT05'), None, Path('LT05'), None)
+ assert process.apply_landsat_filtering('LT05', 'LT04') == \
+ (Path('LT05'), None, Path('LT04'), None)
+
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LT04', 'LC09')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LT04', 'LC08')
+ with pytest.raises(NotImplementedError):
+ process.apply_landsat_filtering('LT04', 'LE07')
+ assert process.apply_landsat_filtering('LT04', 'LT05') == \
+ (Path('LT04'), None, Path('LT05'), None)
+ assert process.apply_landsat_filtering('LT04', 'LT04') == \
+ (Path('LT04'), None, Path('LT04'), None)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 3
}
|
0.10
|
{
"env_vars": null,
"env_yml_path": [
"environment.yml"
],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "environment.yml",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y --no-install-recommends libgl1-mesa-glx unzip vim"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
boto3 @ file:///home/conda/feedstock_root/build_artifacts/boto3_1743235439640/work
botocore @ file:///home/conda/feedstock_root/build_artifacts/botocore_1743212919739/work
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1725267488082/work
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cftime @ file:///home/conda/feedstock_root/build_artifacts/cftime_1725400455427/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1735929714516/work
click @ file:///home/conda/feedstock_root/build_artifacts/click_1734858813237/work
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1736947526808/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1733218098505/work
contourpy @ file:///home/conda/feedstock_root/build_artifacts/contourpy_1727293517607/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1743381224823/work
cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1733332471406/work
cytoolz @ file:///home/conda/feedstock_root/build_artifacts/cytoolz_1734107207199/work
dask @ file:///home/conda/feedstock_root/build_artifacts/dask-core_1722976580461/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1733208806608/work
flake8 @ file:///home/conda/feedstock_root/build_artifacts/flake8_1739898391164/work
flake8-blind-except @ file:///home/conda/feedstock_root/build_artifacts/flake8-blind-except_1736103523415/work
flake8-builtins @ file:///home/conda/feedstock_root/build_artifacts/flake8-builtins_1736204556749/work
flake8-import-order @ file:///home/conda/feedstock_root/build_artifacts/flake8-import-order_1735327522577/work
fonttools @ file:///home/conda/feedstock_root/build_artifacts/fonttools_1738940303262/work
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1743361113926/work
GDAL==3.5.3
geo-autoRIFT==1.5.0
h5py @ file:///home/conda/feedstock_root/build_artifacts/h5py_1666830834012/work
-e git+https://github.com/ASFHyP3/hyp3-autorift.git@ca9bda5f0a8a5db47d0d83c825a9d447a6c4180e#egg=hyp3_autorift
hyp3lib @ file:///home/conda/feedstock_root/build_artifacts/hyp3lib_1645727695347/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1733211830134/work
imagecodecs-lite @ file:///home/conda/feedstock_root/build_artifacts/imagecodecs-lite_1716011159782/work
imageio @ file:///home/conda/feedstock_root/build_artifacts/imageio_1738273805233/work
importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1737420181517/work
importlib_resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1736252299705/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1733223141826/work
jmespath @ file:///home/conda/feedstock_root/build_artifacts/jmespath_1733229141657/work
kiwisolver @ file:///home/conda/feedstock_root/build_artifacts/kiwisolver_1725459266648/work
locket @ file:///home/conda/feedstock_root/build_artifacts/locket_1650660393415/work
lxml @ file:///home/conda/feedstock_root/build_artifacts/lxml_1671013460024/work
matplotlib==3.9.4
mccabe @ file:///home/conda/feedstock_root/build_artifacts/mccabe_1733216466933/work
munkres==1.1.4
netCDF4 @ file:///home/conda/feedstock_root/build_artifacts/netcdf4_1678139184044/work
networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1698504735452/work
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1668919081525/work
opencv-python==4.6.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
pandas @ file:///home/conda/feedstock_root/build_artifacts/pandas_1736810577256/work
partd @ file:///home/conda/feedstock_root/build_artifacts/partd_1715026491486/work
patsy @ file:///home/conda/feedstock_root/build_artifacts/patsy_1733792384640/work
pep8==1.7.1
Pillow @ file:///home/conda/feedstock_root/build_artifacts/pillow_1675487166627/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1733222765875/work
pycodestyle @ file:///home/conda/feedstock_root/build_artifacts/pycodestyle_1733216196861/work
pyflakes @ file:///home/conda/feedstock_root/build_artifacts/pyflakes_1733216066937/work
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1743089729650/work
pyproj @ file:///home/conda/feedstock_root/build_artifacts/pyproj_1680037536458/work
pyshp @ file:///home/conda/feedstock_root/build_artifacts/pyshp_1733821528126/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1733217236728/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1740946542080/work
pytest-console-scripts @ file:///home/conda/feedstock_root/build_artifacts/pytest-console-scripts_1733279592225/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1733223023082/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1706886791323/work
PyWavelets==1.6.0
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1733217035951/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1741755837680/work
s3transfer @ file:///home/conda/feedstock_root/build_artifacts/s3transfer_1741171990164/work
scikit-image @ file:///home/conda/feedstock_root/build_artifacts/scikit-image_1667117163409/work
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy-split_1716470218293/work/dist/scipy-1.13.1-cp39-cp39-linux_x86_64.whl#sha256=e6696cb8683d94467891b7648e068a3970f6bc0a1b3c1aa7f9bc89458eafd2f0
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1742403392659/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
statsmodels @ file:///home/conda/feedstock_root/build_artifacts/statsmodels_1727986706423/work
tifffile @ file:///home/conda/feedstock_root/build_artifacts/tifffile_1591280222285/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1734091811753/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1733256695513/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1733736030883/work
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1735564787326/work
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1743201626/work
tzdata @ file:///home/conda/feedstock_root/build_artifacts/python-tzdata_1742745135198/work
unicodedata2 @ file:///home/conda/feedstock_root/build_artifacts/unicodedata2_1736692503055/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1718728347128/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1732827521216/work
|
name: hyp3-autorift
channels:
- hyp3
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- alsa-lib=1.2.8=h166bdaf_0
- aom=3.5.0=h27087fc_0
- attr=2.5.1=h166bdaf_1
- autorift=1.5.0=py39h06cf3d3_1
- blosc=1.21.6=hef167b5_0
- boost-cpp=1.78.0=h5adbc97_2
- boto3=1.37.23=pyhd8ed1ab_0
- botocore=1.37.23=pyge38_1234567_0
- brotli=1.1.0=hb9d3cd8_2
- brotli-bin=1.1.0=hb9d3cd8_2
- brotli-python=1.1.0=py39hf88036b_2
- bzip2=1.0.8=h4bc722e_7
- c-ares=1.34.4=hb9d3cd8_0
- ca-certificates=2025.1.31=hbcca054_0
- cached-property=1.5.2=hd8ed1ab_1
- cached_property=1.5.2=pyha770c72_1
- cairo=1.16.0=ha61ee94_1012
- certifi=2025.1.31=pyhd8ed1ab_0
- cfitsio=4.2.0=hd9d235c_0
- cftime=1.6.4=py39hf3d9206_1
- charset-normalizer=3.4.1=pyhd8ed1ab_0
- click=8.1.8=pyh707e725_0
- cloudpickle=3.1.1=pyhd8ed1ab_0
- colorama=0.4.6=pyhd8ed1ab_1
- contourpy=1.3.0=py39h74842e3_2
- coverage=7.8.0=py39h9399b63_0
- curl=8.1.2=h409715c_0
- cycler=0.12.1=pyhd8ed1ab_1
- cytoolz=1.0.1=py39h8cd3c5a_0
- dask-core=2024.8.0=pyhd8ed1ab_0
- dbus=1.13.6=h5008d03_3
- exceptiongroup=1.2.2=pyhd8ed1ab_1
- expat=2.6.4=h5888daf_0
- ffmpeg=5.1.2=gpl_h8dda1f0_106
- fftw=3.3.10=nompi_hf1063bd_110
- flake8=7.1.2=pyhd8ed1ab_0
- flake8-blind-except=0.2.1=pyhd8ed1ab_1
- flake8-builtins=2.5.0=pyhd8ed1ab_1
- flake8-import-order=0.18.2=pyhd8ed1ab_1
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=h77eed37_3
- fontconfig=2.15.0=h7e30c49_1
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- fonttools=4.56.0=py39h9399b63_0
- freeglut=3.2.2=h9c3ff4c_1
- freetype=2.13.3=h48d6fc4_0
- freexl=1.0.6=h166bdaf_1
- fsspec=2025.3.1=pyhd8ed1ab_0
- gdal=3.5.3=py39hc6cd174_18
- geos=3.11.1=h27087fc_0
- geotiff=1.7.1=h7a142b4_6
- gettext=0.23.1=h5888daf_0
- gettext-tools=0.23.1=h5888daf_0
- giflib=5.2.2=hd590300_0
- glib=2.78.1=hfc55251_0
- glib-tools=2.78.1=hfc55251_0
- gmp=6.3.0=hac33072_2
- gnutls=3.7.9=hb077bed_0
- graphite2=1.3.13=h59595ed_1003
- gst-plugins-base=1.22.0=h4243ec0_2
- gstreamer=1.22.0=h25f0c4b_2
- gstreamer-orc=0.4.41=h17648ed_0
- h5py=3.7.0=nompi_py39h817c9c5_102
- harfbuzz=6.0.0=h8e241bc_0
- hdf4=4.2.15=h9772cbc_5
- hdf5=1.12.2=nompi_h4df4325_101
- hyp3lib=1.7.0=pyhd8ed1ab_0
- icu=70.1=h27087fc_0
- idna=3.10=pyhd8ed1ab_1
- imagecodecs-lite=2019.12.3=py39hd92a3bb_8
- imageio=2.37.0=pyhfb79c49_0
- importlib-metadata=8.6.1=pyha770c72_0
- importlib-resources=6.5.2=pyhd8ed1ab_0
- importlib_metadata=8.6.1=hd8ed1ab_0
- importlib_resources=6.5.2=pyhd8ed1ab_0
- iniconfig=2.0.0=pyhd8ed1ab_1
- isce2=2.6.1.dev7=py39h53f6d99_0
- jack=1.9.22=h11f4161_0
- jasper=2.0.33=h0ff4b12_1
- jmespath=1.0.1=pyhd8ed1ab_1
- jpeg=9e=h0b41bf4_3
- json-c=0.16=hc379101_0
- kealib=1.5.0=ha7026e8_0
- keyutils=1.6.1=h166bdaf_0
- kiwisolver=1.4.7=py39h74842e3_0
- krb5=1.20.1=h81ceb04_0
- lame=3.100=h166bdaf_1003
- lcms2=2.15=hfd0df8a_0
- ld_impl_linux-64=2.43=h712a8e2_4
- lerc=4.0.0=h27087fc_0
- libacl=2.3.2=h0f662aa_0
- libaec=1.1.3=h59595ed_0
- libasprintf=0.23.1=h8e693c7_0
- libasprintf-devel=0.23.1=h8e693c7_0
- libblas=3.9.0=31_h59b9bed_openblas
- libbrotlicommon=1.1.0=hb9d3cd8_2
- libbrotlidec=1.1.0=hb9d3cd8_2
- libbrotlienc=1.1.0=hb9d3cd8_2
- libcap=2.67=he9d0100_0
- libcblas=3.9.0=31_he106b2a_openblas
- libclang=15.0.7=default_h127d8a8_5
- libclang13=15.0.7=default_h5d6823c_5
- libcups=2.3.3=h36d4200_3
- libcurl=8.1.2=h409715c_0
- libdap4=3.20.6=hd7c4107_2
- libdb=6.2.32=h9c3ff4c_0
- libdeflate=1.17=h0b41bf4_0
- libdrm=2.4.124=hb9d3cd8_0
- libedit=3.1.20250104=pl5321h7949ede_0
- libev=4.33=hd590300_2
- libevent=2.1.10=h28343ad_4
- libexpat=2.6.4=h5888daf_0
- libffi=3.4.6=h2dba641_0
- libflac=1.4.3=h59595ed_0
- libgcc=14.2.0=h767d61c_2
- libgcc-ng=14.2.0=h69a702a_2
- libgcrypt=1.11.0=ha770c72_2
- libgcrypt-devel=1.11.0=hb9d3cd8_2
- libgcrypt-lib=1.11.0=hb9d3cd8_2
- libgcrypt-tools=1.11.0=hb9d3cd8_2
- libgdal=3.5.3=h634f703_18
- libgettextpo=0.23.1=h5888daf_0
- libgettextpo-devel=0.23.1=h5888daf_0
- libgfortran=14.2.0=h69a702a_2
- libgfortran-ng=14.2.0=h69a702a_2
- libgfortran5=14.2.0=hf1ad2bd_2
- libglib=2.78.1=hebfc3b9_0
- libglu=9.0.0=he1b5a44_1001
- libgomp=14.2.0=h767d61c_2
- libgpg-error=1.51=hbd13f7d_1
- libiconv=1.18=h4ce23a2_1
- libidn2=2.3.8=ha4ef2c3_0
- libkml=1.3.0=hf539b9f_1021
- liblapack=3.9.0=31_h7ac8fdf_openblas
- liblapacke=3.9.0=31_he2f377e_openblas
- libllvm15=15.0.7=hadd5161_1
- libltdl=2.4.3a=h5888daf_0
- liblzma=5.6.4=hb9d3cd8_0
- liblzma-devel=5.6.4=hb9d3cd8_0
- libnetcdf=4.9.1=nompi_h34a3ff0_101
- libnghttp2=1.58.0=h47da74e_0
- libnsl=2.0.1=hd590300_0
- libogg=1.3.5=h4ab18f5_0
- libopenblas=0.3.29=pthreads_h94d23a6_0
- libopencv=4.6.0=py39hb375605_9
- libopus=1.3.1=h7f98852_1
- libpciaccess=0.18=hd590300_0
- libpng=1.6.47=h943b412_0
- libpq=15.2=hb675445_0
- libprotobuf=3.21.12=hfc55251_2
- librttopo=1.1.0=ha49c73b_12
- libsndfile=1.2.2=hc60ed4a_1
- libspatialite=5.0.1=h221c8f1_23
- libsqlite=3.49.1=hee588c1_2
- libssh2=1.11.0=h0841786_0
- libstdcxx=14.2.0=h8f9b012_2
- libstdcxx-ng=14.2.0=h4852527_2
- libsystemd0=253=h8c4010b_1
- libtasn1=4.20.0=hb9d3cd8_0
- libtiff=4.5.0=h6adf6a1_2
- libtool=2.5.4=h5888daf_0
- libudev1=253=h0b41bf4_1
- libunistring=0.9.10=h7f98852_0
- libuuid=2.38.1=h0b41bf4_0
- libva=2.17.0=h0b41bf4_0
- libvorbis=1.3.7=h9c3ff4c_0
- libvpx=1.11.0=h9c3ff4c_3
- libwebp-base=1.5.0=h851e524_0
- libxcb=1.13=h7f98852_1004
- libxkbcommon=1.5.0=h79f4944_1
- libxml2=2.10.3=hca2bb57_4
- libxslt=1.1.37=h873f0b0_0
- libzip=1.10.1=h2629f0a_3
- libzlib=1.3.1=hb9d3cd8_2
- locket=1.0.0=pyhd8ed1ab_0
- lxml=4.9.2=py39h14694de_0
- lz4-c=1.9.4=hcb278e6_0
- matplotlib-base=3.9.4=py39h16632d1_0
- mccabe=0.7.0=pyhd8ed1ab_1
- mpg123=1.32.9=hc50e24c_0
- munkres=1.1.4=pyh9f0ad1d_0
- mysql-common=8.0.33=hf1915f5_6
- mysql-libs=8.0.33=hca2cd23_6
- ncurses=6.5=h2d0b736_3
- netcdf4=1.6.3=nompi_py39h8b3a7bc_100
- nettle=3.9.1=h7ab15ed_0
- networkx=3.2.1=pyhd8ed1ab_0
- nspr=4.36=h5888daf_0
- nss=3.110=h159eef7_0
- numpy=1.23.5=py39h3d75532_0
- opencv=4.6.0=py39hf3d152e_9
- openh264=2.3.1=hcb278e6_2
- openjpeg=2.5.0=hfec8fc6_2
- openmotif=2.3.8=h5d10074_3
- openssl=3.1.8=h7b32b05_0
- p11-kit=0.24.1=hc5aa10d_0
- packaging=24.2=pyhd8ed1ab_2
- pandas=2.2.3=py39h3b40f6f_2
- partd=1.4.2=pyhd8ed1ab_0
- patsy=1.0.1=pyhd8ed1ab_1
- pcre2=10.40=hc3806b6_0
- pep8=1.7.1=py_0
- pillow=9.4.0=py39h2320bf1_1
- pip=25.0.1=pyh8b19718_0
- pixman=0.44.2=h29eaf8c_0
- pluggy=1.5.0=pyhd8ed1ab_1
- poppler=23.03.0=h091648b_0
- poppler-data=0.4.12=hd8ed1ab_0
- postgresql=15.2=h3248436_0
- proj=9.1.1=h8ffa02c_2
- pthread-stubs=0.4=hb9d3cd8_1002
- pulseaudio=16.1=hcb278e6_3
- pulseaudio-client=16.1=h5195f5e_3
- pulseaudio-daemon=16.1=ha8d29e2_3
- py-opencv=4.6.0=py39hcca971b_9
- pycodestyle=2.12.1=pyhd8ed1ab_1
- pyflakes=3.2.0=pyhd8ed1ab_1
- pyparsing=3.2.3=pyhd8ed1ab_1
- pyproj=3.5.0=py39hf8a5840_0
- pyshp=2.3.1=pyhd8ed1ab_1
- pysocks=1.7.1=pyha55dd90_7
- pytest=8.3.5=pyhd8ed1ab_0
- pytest-console-scripts=1.4.1=pyhd8ed1ab_1
- pytest-cov=6.0.0=pyhd8ed1ab_1
- python=3.9.18=h0755675_0_cpython
- python-dateutil=2.9.0.post0=pyhff2d567_1
- python-tzdata=2025.2=pyhd8ed1ab_0
- python_abi=3.9=5_cp39
- pytz=2024.1=pyhd8ed1ab_0
- pywavelets=1.6.0=py39hd92a3bb_0
- pyyaml=6.0.2=py39h9399b63_2
- qhull=2020.2=h434a139_5
- qt-main=5.15.8=h5d23da1_6
- readline=8.2=h8c095d6_2
- requests=2.32.3=pyhd8ed1ab_1
- responses=0.25.7=pyhd8ed1ab_0
- s3transfer=0.11.4=pyhd8ed1ab_0
- scikit-image=0.19.3=py39h4661b88_2
- scipy=1.13.1=py39haf93ffa_0
- setuptools=75.8.2=pyhff2d567_0
- setuptools-scm=8.2.1=pyhd8ed1ab_0
- setuptools_scm=8.2.1=hd8ed1ab_0
- six=1.17.0=pyhd8ed1ab_0
- snappy=1.2.1=h8bd8927_1
- sqlite=3.49.1=h9eae976_2
- statsmodels=0.14.4=py39hf3d9206_0
- svt-av1=1.4.1=hcb278e6_0
- tifffile=2020.6.3=py_0
- tiledb=2.13.2=hd532e3d_0
- tk=8.6.13=noxft_h4845f30_101
- toml=0.10.2=pyhd8ed1ab_1
- tomli=2.2.1=pyhd8ed1ab_1
- toolz=1.0.0=pyhd8ed1ab_1
- types-pyyaml=6.0.12.20241230=pyhd8ed1ab_0
- typing-extensions=4.13.0=h9fa5a19_1
- typing_extensions=4.13.0=pyh29332c3_1
- tzcode=2025b=hb9d3cd8_0
- tzdata=2025b=h78e105d_0
- unicodedata2=16.0.0=py39h8cd3c5a_0
- uriparser=0.9.8=hac33072_0
- urllib3=1.26.19=pyhd8ed1ab_0
- wheel=0.45.1=pyhd8ed1ab_1
- x264=1!164.3095=h166bdaf_2
- x265=3.5=h924138e_3
- xcb-util=0.4.0=h516909a_0
- xcb-util-image=0.4.0=h166bdaf_0
- xcb-util-keysyms=0.4.0=h516909a_0
- xcb-util-renderutil=0.3.9=h166bdaf_0
- xcb-util-wm=0.4.1=h516909a_0
- xerces-c=3.2.4=h55805fa_1
- xkeyboard-config=2.38=h0b41bf4_0
- xorg-fixesproto=5.0=hb9d3cd8_1003
- xorg-inputproto=2.3.2=hb9d3cd8_1003
- xorg-kbproto=1.0.7=hb9d3cd8_1003
- xorg-libice=1.0.10=h7f98852_0
- xorg-libsm=1.2.3=hd9c2040_1000
- xorg-libx11=1.6.12=h36c2ea0_0
- xorg-libxau=1.0.12=hb9d3cd8_0
- xorg-libxdmcp=1.1.5=hb9d3cd8_0
- xorg-libxext=1.3.4=h516909a_0
- xorg-libxfixes=5.0.3=h516909a_1004
- xorg-libxft=2.3.4=hc534e41_1
- xorg-libxi=1.7.10=h516909a_0
- xorg-libxmu=1.1.3=h516909a_0
- xorg-libxp=1.0.3=hd590300_1003
- xorg-libxrender=0.9.10=h516909a_1002
- xorg-libxt=1.1.5=h516909a_1003
- xorg-renderproto=0.11.1=hb9d3cd8_1003
- xorg-xextproto=7.3.0=hb9d3cd8_1004
- xorg-xproto=7.0.31=hb9d3cd8_1008
- xz=5.6.4=hbcc6ac9_0
- xz-gpl-tools=5.6.4=hbcc6ac9_0
- xz-tools=5.6.4=hb9d3cd8_0
- yaml=0.2.5=h7f98852_2
- zipp=3.21.0=pyhd8ed1ab_1
- zlib=1.3.1=hb9d3cd8_2
- zstd=1.5.7=hb8e6e7a_2
- pip:
- hyp3-autorift==0.10.3
prefix: /opt/conda/envs/hyp3-autorift
|
[
"tests/test_process.py::test_apply_landsat_filtering"
] |
[] |
[
"tests/test_process.py::test_get_platform",
"tests/test_process.py::test_get_lc2_stac_json_key",
"tests/test_process.py::test_get_lc2_metadata",
"tests/test_process.py::test_get_lc2_metadata_fallback",
"tests/test_process.py::test_get_lc2_path",
"tests/test_process.py::test_get_s2_metadata_not_found",
"tests/test_process.py::test_get_s2_metadata",
"tests/test_process.py::test_get_s2_safe_url",
"tests/test_process.py::test_get_s2_manifest",
"tests/test_process.py::test_get_s2_path",
"tests/test_process.py::test_get_raster_bbox",
"tests/test_process.py::test_s3_object_is_accessible",
"tests/test_process.py::test_parse_s3_url",
"tests/test_process.py::test_get_datetime",
"tests/test_process.py::test_get_product_name",
"tests/test_process.py::test_get_s1_primary_polarization"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| null |
|
ASFHyP3__hyp3-autorift-49
|
cf8c6dadd1d4af9cb310a2eb470ac0c2e820c2ab
|
2021-01-19 18:15:27
|
cf8c6dadd1d4af9cb310a2eb470ac0c2e820c2ab
|
diff --git a/hyp3_autorift/geometry.py b/hyp3_autorift/geometry.py
index 5b66d76..a2c6a13 100644
--- a/hyp3_autorift/geometry.py
+++ b/hyp3_autorift/geometry.py
@@ -2,19 +2,18 @@
import logging
import os
+from typing import Tuple
import isce # noqa: F401
import isceobj
import numpy as np
from contrib.demUtils import createDemStitcher
from contrib.geo_autoRIFT.geogrid import Geogrid
-from hyp3lib import DemError
from isceobj.Orbit.Orbit import Orbit
from isceobj.Sensor.TOPS.Sentinel1 import Sentinel1
from osgeo import gdal
from osgeo import ogr
-
-from hyp3_autorift.io import AUTORIFT_PREFIX, ITS_LIVE_BUCKET
+from osgeo import osr
log = logging.getLogger(__name__)
@@ -89,7 +88,7 @@ def bounding_box(safe, priority='reference', polarization='hh', orbits='Orbits',
return lat_limits, lon_limits
-def polygon_from_bbox(lat_limits, lon_limits):
+def polygon_from_bbox(lat_limits: Tuple[float, float], lon_limits: Tuple[float, float]) -> ogr.Geometry:
ring = ogr.Geometry(ogr.wkbLinearRing)
ring.AddPoint(lon_limits[0], lat_limits[0])
ring.AddPoint(lon_limits[1], lat_limits[0])
@@ -101,20 +100,24 @@ def polygon_from_bbox(lat_limits, lon_limits):
return polygon
-def find_jpl_dem(lat_limits, lon_limits):
- shape_file = f'/vsicurl/http://{ITS_LIVE_BUCKET}.s3.amazonaws.com/{AUTORIFT_PREFIX}/autorift_parameters.shp'
- driver = ogr.GetDriverByName('ESRI Shapefile')
- shapes = driver.Open(shape_file, gdal.GA_ReadOnly)
+def poly_bounds_in_proj(polygon: ogr.Geometry, in_epsg: int, out_epsg: int):
+ in_srs = osr.SpatialReference()
+ in_srs.ImportFromEPSG(in_epsg)
- centroid = polygon_from_bbox(lat_limits, lon_limits).Centroid()
- for feature in shapes.GetLayer(0):
- if feature.geometry().Contains(centroid):
- return f'{feature["name"]}_0240m'
+ out_srs = osr.SpatialReference()
+ out_srs.ImportFromEPSG(out_epsg)
- raise DemError('Could not determine appropriate DEM for:\n'
- f' lat (min, max): {lat_limits}'
- f' lon (min, max): {lon_limits}'
- f' using: {shape_file}')
+ transformation = osr.CoordinateTransformation(in_srs, out_srs)
+ ring = ogr.Geometry(ogr.wkbLinearRing)
+ for point in polygon.GetBoundary().GetPoints():
+ try:
+ lon, lat = point
+ except ValueError:
+ # buffered polygons only have (X, Y) while unbuffered have (X, Y, Z)
+ lon, lat, _ = point
+ ring.AddPoint(*transformation.TransformPoint(lat, lon))
+
+ return ring.GetEnvelope()
def prep_isce_dem(input_dem, lat_limits, lon_limits, isce_dem=None):
diff --git a/hyp3_autorift/io.py b/hyp3_autorift/io.py
index 226f3d6..b38fa23 100644
--- a/hyp3_autorift/io.py
+++ b/hyp3_autorift/io.py
@@ -3,24 +3,24 @@
import argparse
import logging
import os
-import shutil
import textwrap
from pathlib import Path
from typing import Union
import boto3
-from boto3.s3.transfer import TransferConfig
-from botocore import UNSIGNED
-from botocore.config import Config
+from hyp3lib import DemError
from isce.applications.topsApp import TopsInSAR
+from osgeo import gdal
+from osgeo import ogr
from scipy.io import savemat
+from hyp3_autorift.geometry import poly_bounds_in_proj
+
log = logging.getLogger(__name__)
ITS_LIVE_BUCKET = 'its-live-data.jpl.nasa.gov'
AUTORIFT_PREFIX = 'autorift_parameters/v001'
-_s3_client_unsigned = boto3.client('s3', config=Config(signature_version=UNSIGNED))
_s3_client = boto3.client('s3')
@@ -31,53 +31,65 @@ def download_s3_file_requester_pays(target_path: Union[str, Path], bucket: str,
return filename
-def _download_s3_files(target_dir, bucket, keys, chunk_size=50*1024*1024):
- transfer_config = TransferConfig(multipart_threshold=chunk_size, multipart_chunksize=chunk_size)
- file_list = []
- for key in keys:
- filename = os.path.join(target_dir, os.path.basename(key))
- if os.path.exists(filename):
- continue
- file_list.append(filename)
- log.info(f'Downloading s3://{bucket}/{key} to {filename}')
- _s3_client_unsigned.download_file(Bucket=bucket, Key=key, Filename=filename, Config=transfer_config)
- return file_list
-
-
-def _get_s3_keys_for_dem(prefix=AUTORIFT_PREFIX, dem='GRE240m'):
- tags = [
- 'h',
- 'StableSurface',
- 'dhdx',
- 'dhdy',
- 'dhdxs',
- 'dhdys',
- 'vx0',
- 'vy0',
- 'vxSearchRange',
- 'vySearchRange',
- 'xMinChipSize',
- 'yMinChipSize',
- 'xMaxChipSize',
- 'yMaxChipSize',
- # FIXME: Was renamed from masks to sp by JPL; change hasn't been propagated to autoRIFT
- # keep last so we can easily rename the file after downloading
- 'sp',
- ]
- keys = [f'{prefix}/{dem}_{tag}.tif' for tag in tags]
- return keys
-
-
-def fetch_jpl_tifs(dem='GRE240m', target_dir='DEM', bucket=ITS_LIVE_BUCKET, prefix=AUTORIFT_PREFIX):
- # FIXME: gdalwarp needed subset instead?
- log.info(f"Downloading {dem} tifs from JPL's AWS bucket")
-
- for logger in ('botocore', 's3transfer'):
- logging.getLogger(logger).setLevel(logging.WARNING)
-
- keys = _get_s3_keys_for_dem(prefix, dem)
- tifs = _download_s3_files(target_dir, bucket, keys)
- shutil.move(tifs[-1], tifs[-1].replace('_sp.tif', '_masks.tif'))
+def find_jpl_dem(polygon: ogr.Geometry) -> dict:
+ shape_file = f'/vsicurl/http://{ITS_LIVE_BUCKET}.s3.amazonaws.com/{AUTORIFT_PREFIX}/autorift_parameters.shp'
+ driver = ogr.GetDriverByName('ESRI Shapefile')
+ shapes = driver.Open(shape_file, gdal.GA_ReadOnly)
+
+ centroid = polygon.Centroid()
+ for feature in shapes.GetLayer(0):
+ if feature.geometry().Contains(centroid):
+ dem_info = {
+ 'name': f'{feature["name"]}_0240m',
+ 'epsg': feature['epsg'],
+ 'tifs': {
+ 'h': f"/vsicurl/{feature['h']}",
+ 'StableSurface': f"/vsicurl/{feature['StableSurfa']}",
+ 'dhdx': f"/vsicurl/{feature['dhdx']}",
+ 'dhdy': f"/vsicurl/{feature['dhdy']}",
+ 'dhdxs': f"/vsicurl/{feature['dhdxs']}",
+ 'dhdys': f"/vsicurl/{feature['dhdys']}",
+ 'vx0': f"/vsicurl/{feature['vx0']}",
+ 'vy0': f"/vsicurl/{feature['vy0']}",
+ 'vxSearchRange': f"/vsicurl/{feature['vxSearchRan']}",
+ 'vySearchRange': f"/vsicurl/{feature['vySearchRan']}",
+ 'xMinChipSize': f"/vsicurl/{feature['xMinChipSiz']}",
+ 'yMinChipSize': f"/vsicurl/{feature['yMinChipSiz']}",
+ 'xMaxChipSize': f"/vsicurl/{feature['xMaxChipSiz']}",
+ 'yMaxChipSize': f"/vsicurl/{feature['yMaxChipSiz']}",
+ 'sp': f"/vsicurl/{feature['sp']}",
+ },
+ }
+ return dem_info
+
+ raise DemError('Could not determine appropriate DEM for:\n'
+ f' centroid: {centroid}'
+ f' using: {shape_file}')
+
+
+def subset_jpl_tifs(polygon: ogr.Geometry, buffer: float = 0.15, target_dir: Union[str, Path] = '.'):
+ dem_info = find_jpl_dem(polygon)
+ log.info(f'Subsetting {dem_info["name"]} tifs from s3://{ITS_LIVE_BUCKET}/{AUTORIFT_PREFIX}/')
+
+ min_x, max_x, min_y, max_y = poly_bounds_in_proj(polygon.Buffer(buffer), in_epsg=4326, out_epsg=dem_info['epsg'])
+ output_bounds = (min_x, min_y, max_x, max_y)
+ log.debug(f'Subset bounds: {output_bounds}')
+
+ subset_tifs = {}
+ for key, tif in dem_info['tifs'].items():
+ out_path = os.path.join(target_dir, os.path.basename(tif))
+
+ # FIXME: shouldn't need to do after next autoRIFT upgrade
+ if out_path.endswith('_sp.tif'):
+ out_path = out_path.replace('_sp.tif', '_masks.tif')
+
+ subset_tifs[key] = out_path
+
+ gdal.Warp(
+ out_path, tif, outputBounds=output_bounds, xRes=240, yRes=240, targetAlignedPixels=True, multithread=True,
+ )
+
+ return subset_tifs
def format_tops_xml(reference, secondary, polarization, dem, orbits, xml_file='topsApp.xml'):
diff --git a/hyp3_autorift/process.py b/hyp3_autorift/process.py
index 401bd34..d3d3936 100644
--- a/hyp3_autorift/process.py
+++ b/hyp3_autorift/process.py
@@ -196,25 +196,22 @@ def process(reference: str, secondary: str, polarization: str = 'hh', band: str
lat_limits = (bbox[1], bbox[3])
lon_limits = (bbox[0], bbox[2])
- dem = geometry.find_jpl_dem(lat_limits, lon_limits)
- dem_dir = os.path.join(os.getcwd(), 'DEM')
- mkdir_p(dem_dir)
- io.fetch_jpl_tifs(dem=dem, target_dir=dem_dir)
- dem_prefix = os.path.join(dem_dir, dem)
-
- geogrid_parameters = f'-d {dem_prefix}_h.tif -ssm {dem_prefix}_StableSurface.tif ' \
- f'-sx {dem_prefix}_dhdx.tif -sy {dem_prefix}_dhdy.tif ' \
- f'-vx {dem_prefix}_vx0.tif -vy {dem_prefix}_vy0.tif ' \
- f'-srx {dem_prefix}_vxSearchRange.tif -sry {dem_prefix}_vySearchRange.tif ' \
- f'-csminx {dem_prefix}_xMinChipSize.tif -csminy {dem_prefix}_yMinChipSize.tif ' \
- f'-csmaxx {dem_prefix}_xMaxChipSize.tif -csmaxy {dem_prefix}_yMaxChipSize.tif'
+ scene_poly = geometry.polygon_from_bbox(lat_limits, lon_limits)
+ tifs = io.subset_jpl_tifs(scene_poly, target_dir=Path.cwd())
+
+ geogrid_parameters = f'-d {tifs["h"]} -ssm {tifs["StableSurface"]} ' \
+ f'-sx {tifs["dhdx"]} -sy {tifs["dhdy"]} ' \
+ f'-vx {tifs["vx0"]} -vy {tifs["vy0"]} ' \
+ f'-srx {tifs["vxSearchRange"]} -sry {tifs["vySearchRange"]} ' \
+ f'-csminx {tifs["xMinChipSize"]} -csminy {tifs["yMinChipSize"]} ' \
+ f'-csmaxx {tifs["xMaxChipSize"]} -csmaxy {tifs["yMaxChipSize"]}'
autorift_parameters = '-g window_location.tif -o window_offset.tif -sr window_search_range.tif ' \
'-csmin window_chip_size_min.tif -csmax window_chip_size_max.tif ' \
'-vx window_rdr_off2vel_x_vec.tif -vy window_rdr_off2vel_y_vec.tif ' \
'-ssm window_stable_surface_mask.tif'
if platform == 'S1':
- isce_dem = geometry.prep_isce_dem(f'{dem_prefix}_h.tif', lat_limits, lon_limits)
+ isce_dem = geometry.prep_isce_dem(tifs["h"], lat_limits, lon_limits)
io.format_tops_xml(reference, secondary, polarization, isce_dem, orbits)
diff --git a/setup.py b/setup.py
index 54a17a4..96de391 100644
--- a/setup.py
+++ b/setup.py
@@ -62,7 +62,6 @@ setup(
'testGeogrid_ISCE.py = hyp3_autorift.vend.testGeogrid_ISCE:main',
'testautoRIFT.py = hyp3_autorift.vend.testautoRIFT:main',
'testGeogridOptical.py = hyp3_autorift.vend.testGeogridOptical:main',
- # FIXME: Only needed for testautoRIFT.py and testautoRIFT_ISCE.py
'topsinsar_filename.py = hyp3_autorift.io:topsinsar_mat',
]
},
|
Get associated autoRIFT files from parameter shapefile
Currently, we hardcode the set of needed files for processing:
https://github.com/ASFHyP3/hyp3-autorift/blob/develop/hyp3_autorift/io.py#L47-L68
These however, at detailed in the new parameter shapefile and could be pulled from there instead to be more flexible to future change (see #47 )
|
ASFHyP3/hyp3-autorift
|
diff --git a/tests/conftest.py b/tests/conftest.py
index b4399a0..6b44082 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,7 +1,7 @@
import pytest
from botocore.stub import Stubber
-from hyp3_autorift.io import _s3_client, _s3_client_unsigned
+from hyp3_autorift.io import _s3_client
@pytest.fixture
@@ -9,10 +9,3 @@ def s3_stub():
with Stubber(_s3_client) as stubber:
yield stubber
stubber.assert_no_pending_responses()
-
-
[email protected]
-def s3_unsigned_stub():
- with Stubber(_s3_client_unsigned) as stubber:
- yield stubber
- stubber.assert_no_pending_responses()
diff --git a/tests/test_geometry.py b/tests/test_geometry.py
index 264f07c..54d444e 100644
--- a/tests/test_geometry.py
+++ b/tests/test_geometry.py
@@ -1,5 +1,4 @@
-import pytest
-from hyp3lib import DemError
+import numpy as np
from hyp3_autorift import geometry
@@ -11,47 +10,27 @@ def test_polygon_from_bbox():
== 'POLYGON ((3 1 0,4 1 0,4 2 0,3 2 0,3 1 0))'
-def test_find_jpl_dem():
- lat_limits = (55, 56)
- lon_limits = (40, 41)
- assert geometry.find_jpl_dem(lat_limits, lon_limits) == 'NPS_0240m'
-
- lat_limits = (54, 55)
- lon_limits = (40, 41)
- assert geometry.find_jpl_dem(lat_limits, lon_limits) == 'N37_0240m'
-
- lat_limits = (54, 55)
- lon_limits = (-40, -41)
- assert geometry.find_jpl_dem(lat_limits, lon_limits) == 'N24_0240m'
-
- lat_limits = (-54, -55)
- lon_limits = (-40, -41)
- assert geometry.find_jpl_dem(lat_limits, lon_limits) == 'S24_0240m'
-
- lat_limits = (-55, -56)
- lon_limits = (40, 41)
- assert geometry.find_jpl_dem(lat_limits, lon_limits) == 'S37_0240m'
-
- lat_limits = (-56, -57)
- lon_limits = (40, 41)
- assert geometry.find_jpl_dem(lat_limits, lon_limits) == 'SPS_0240m'
-
- lat_limits = (-90, -91)
- lon_limits = (40, 41)
- with pytest.raises(DemError):
- geometry.find_jpl_dem(lat_limits, lon_limits)
-
- lat_limits = (90, 91)
- lon_limits = (40, 41)
- with pytest.raises(DemError):
- geometry.find_jpl_dem(lat_limits, lon_limits)
-
- lat_limits = (55, 56)
- lon_limits = (180, 181)
- with pytest.raises(DemError):
- geometry.find_jpl_dem(lat_limits, lon_limits)
-
- lat_limits = (55, 56)
- lon_limits = (-180, -181)
- with pytest.raises(DemError):
- geometry.find_jpl_dem(lat_limits, lon_limits)
+def test_pol_bounds_in_proj():
+ polygon = geometry.polygon_from_bbox(lat_limits=(55, 56), lon_limits=(40, 41))
+ assert np.allclose(
+ geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=3413), # NPS
+ (3776365.5697414433, 3899644.3388010086, -340706.3423259673, -264432.19003121805)
+ )
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(-58, -57), lon_limits=(40, 41))
+ assert np.allclose(
+ geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=3031), # SPS
+ (2292512.6214329866, 2416952.768825992, 2691684.1770189586, 2822144.2827928355)
+ )
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(22, 23), lon_limits=(40, 41))
+ assert np.allclose(
+ geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=32637),
+ (602485.1663686256, 706472.0593133729, 2433164.428653589, 2544918.1043369616)
+ )
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(-23, -22), lon_limits=(40, 41))
+ assert np.allclose(
+ geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=32737),
+ (602485.1663686256, 706472.0593133729, 7455081.895663038, 7566835.5713464115)
+ )
diff --git a/tests/test_io.py b/tests/test_io.py
index 5d75942..cb4d334 100644
--- a/tests/test_io.py
+++ b/tests/test_io.py
@@ -1,6 +1,9 @@
from io import BytesIO
-from hyp3_autorift import io
+import pytest
+from hyp3lib import DemError
+
+from hyp3_autorift import geometry, io
def test_download_s3_file_requester_pays(tmp_path, s3_stub):
@@ -21,52 +24,43 @@ def test_download_s3_file_requester_pays(tmp_path, s3_stub):
assert tmp_path / 'foobar.txt' == file
-def test_get_s3_keys_for_dem():
- expected = [
- 'Prefix/GRE240m_h.tif',
- 'Prefix/GRE240m_StableSurface.tif',
- 'Prefix/GRE240m_dhdx.tif',
- 'Prefix/GRE240m_dhdy.tif',
- 'Prefix/GRE240m_dhdxs.tif',
- 'Prefix/GRE240m_dhdys.tif',
- 'Prefix/GRE240m_vx0.tif',
- 'Prefix/GRE240m_vy0.tif',
- 'Prefix/GRE240m_vxSearchRange.tif',
- 'Prefix/GRE240m_vySearchRange.tif',
- 'Prefix/GRE240m_xMinChipSize.tif',
- 'Prefix/GRE240m_yMinChipSize.tif',
- 'Prefix/GRE240m_xMaxChipSize.tif',
- 'Prefix/GRE240m_yMaxChipSize.tif',
- 'Prefix/GRE240m_sp.tif',
- ]
- assert sorted(io._get_s3_keys_for_dem('Prefix', 'GRE240m')) == sorted(expected)
+def test_find_jpl_dem():
+ polygon = geometry.polygon_from_bbox(lat_limits=(55, 56), lon_limits=(40, 41))
+ dem_info = io.find_jpl_dem(polygon)
+ assert dem_info['name'] == 'NPS_0240m'
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(54, 55), lon_limits=(40, 41))
+ dem_info = io.find_jpl_dem(polygon)
+ assert dem_info['name'] == 'N37_0240m'
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(54, 55), lon_limits=(-40, -41))
+ dem_info = io.find_jpl_dem(polygon)
+ assert dem_info['name'] == 'N24_0240m'
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(-54, -55), lon_limits=(-40, -41))
+ dem_info = io.find_jpl_dem(polygon)
+ assert dem_info['name'] == 'S24_0240m'
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(-55, -56), lon_limits=(40, 41))
+ dem_info = io.find_jpl_dem(polygon)
+ assert dem_info['name'] == 'S37_0240m'
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(-56, -57), lon_limits=(40, 41))
+ dem_info = io.find_jpl_dem(polygon)
+ assert dem_info['name'] == 'SPS_0240m'
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(-90, -91), lon_limits=(40, 41))
+ with pytest.raises(DemError):
+ io.find_jpl_dem(polygon)
+
+ polygon = geometry.polygon_from_bbox(lat_limits=(90, 91), lon_limits=(40, 41))
+ with pytest.raises(DemError):
+ io.find_jpl_dem(polygon)
+ polygon = geometry.polygon_from_bbox(lat_limits=(55, 56), lon_limits=(180, 181))
+ with pytest.raises(DemError):
+ io.find_jpl_dem(polygon)
-def test_download_s3_files(tmp_path, s3_unsigned_stub):
- keys = ['foo', 'bar']
- for key in keys:
- s3_unsigned_stub.add_response(
- 'head_object',
- expected_params={
- 'Bucket': 'myBucket',
- 'Key': key,
- },
- service_response={
- 'ContentLength': 3,
- },
- )
- s3_unsigned_stub.add_response(
- 'get_object',
- expected_params={
- 'Bucket': 'myBucket',
- 'Key': key,
- },
- service_response={
- 'Body': BytesIO(b'123'),
- },
- )
- downloaded_files = io._download_s3_files(tmp_path, 'myBucket', keys)
- for key, downloaded_file in zip(keys, downloaded_files):
- assert (tmp_path / key).exists()
- assert (tmp_path / key).read_text() == '123'
- assert str(tmp_path / key) == downloaded_file
+ polygon = geometry.polygon_from_bbox(lat_limits=(55, 56), lon_limits=(-180, -181))
+ with pytest.raises(DemError):
+ io.find_jpl_dem(polygon)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 4
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": [
"conda-env.yml"
],
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": true,
"packages": "environment.yml",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y libgl1-mesa-glx unzip vim"
],
"python": "3.8",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
annotated-types==0.7.0
Authlib==1.3.2
autoRIFT==1.0.0
boto3 @ file:///home/conda/feedstock_root/build_artifacts/boto3_1733165740123/work
boto3-stubs==1.37.23
botocore @ file:///home/conda/feedstock_root/build_artifacts/botocore_1736951971072/work
botocore-stubs==1.37.23
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1648883617327/work
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1725278078093/work/certifi
cffi==1.17.1
cftime @ file:///home/conda/feedstock_root/build_artifacts/cftime_1649636864359/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1728479282467/work
click @ file:///home/conda/feedstock_root/build_artifacts/click_1692311806742/work
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1729059237860/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1652409050186/work
cryptography==44.0.2
cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1696677705766/work
cytoolz==0.11.2
dask @ file:///home/conda/feedstock_root/build_artifacts/dask-core_1683908660643/work
dparse==0.6.4
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1720869315914/work
filelock==3.16.1
flake8 @ file:///home/conda/feedstock_root/build_artifacts/flake8_1722878870427/work
flake8-blind-except @ file:///home/conda/feedstock_root/build_artifacts/flake8-blind-except_1649251193897/work
flake8-builtins @ file:///home/conda/feedstock_root/build_artifacts/flake8-builtins_1712681067342/work
flake8-import-order @ file:///home/conda/feedstock_root/build_artifacts/flake8-import-order_1669670271290/work
fonttools @ file:///home/conda/feedstock_root/build_artifacts/fonttools_1651017731964/work
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1729608855534/work
GDAL==3.1.4
h5py @ file:///home/conda/feedstock_root/build_artifacts/h5py_1624405622079/work
-e git+https://github.com/ASFHyP3/hyp3-autorift.git@cf8c6dadd1d4af9cb310a2eb470ac0c2e820c2ab#egg=hyp3_autorift
hyp3lib @ file:///home/conda/feedstock_root/build_artifacts/hyp3lib_1603217808371/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1726459485162/work
imagecodecs @ file:///home/conda/feedstock_root/build_artifacts/imagecodecs_1632914153721/work
imageio @ file:///home/conda/feedstock_root/build_artifacts/imageio_1729190692267/work
importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1726082825846/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1673103042956/work
Jinja2==3.1.6
jmespath @ file:///home/conda/feedstock_root/build_artifacts/jmespath_1655568249366/work
joblib==1.4.2
kiwisolver @ file:///home/conda/feedstock_root/build_artifacts/kiwisolver_1648854389294/work
locket @ file:///home/conda/feedstock_root/build_artifacts/locket_1650660393415/work
lxml @ file:///home/conda/feedstock_root/build_artifacts/lxml_1649637471763/work
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.22.0
matplotlib @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-suite_1651609455247/work
mccabe @ file:///home/conda/feedstock_root/build_artifacts/mccabe_1643049622439/work
mdurl==0.1.2
munkres==1.1.4
mypy-boto3-dynamodb==1.37.12
mypy-boto3-s3==1.37.0
netCDF4 @ file:///home/conda/feedstock_root/build_artifacts/netcdf4_1630447999241/work
networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1680692919326/work
nltk==3.9.1
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1651020413938/work
olefile @ file:///home/conda/feedstock_root/build_artifacts/olefile_1701735466804/work
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
pandas==1.4.2
partd @ file:///home/conda/feedstock_root/build_artifacts/partd_1695667515973/work
patsy @ file:///home/conda/feedstock_root/build_artifacts/patsy_1704469236901/work
pep8==1.7.1
Pillow @ file:///home/conda/feedstock_root/build_artifacts/pillow_1630696607296/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1713667077545/work
psutil==6.1.1
pycodestyle @ file:///home/conda/feedstock_root/build_artifacts/pycodestyle_1722846760694/work
pycparser==2.22
pydantic==2.9.2
pydantic_core==2.23.4
pyflakes @ file:///home/conda/feedstock_root/build_artifacts/pyflakes_1704424584912/work
Pygments==2.19.1
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1724616129934/work
pyproj==2.6.1.post1
pyshp @ file:///home/conda/feedstock_root/build_artifacts/pyshp_1659002966020/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1733087655016/work
pytest-console-scripts @ file:///home/conda/feedstock_root/build_artifacts/pytest-console-scripts_1685535707317/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1711411024363/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1709299778482/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1726055524169/work
PyWavelets @ file:///home/conda/feedstock_root/build_artifacts/pywavelets_1649616412805/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1648757091578/work
regex==2024.11.6
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1717057054362/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1718399541342/work
rich==14.0.0
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.8
s3pypi==2.0.1
s3transfer @ file:///home/conda/feedstock_root/build_artifacts/s3transfer_1732154317807/work
safety==3.3.1
safety-schemas==0.0.11
scikit-image @ file:///home/conda/feedstock_root/build_artifacts/scikit-image_1645196656555/work
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy_1604304772019/work
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1715083232181/work
shellingham==1.5.4
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
statsmodels @ file:///home/conda/feedstock_root/build_artifacts/statsmodels_1644535586434/work
tifffile @ file:///home/conda/feedstock_root/build_artifacts/tifffile_1635944860688/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1604308577558/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1727974628237/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1728059506884/work
tqdm==4.67.1
typer==0.15.2
types-awscrt==0.24.2
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1726556272458/work
types-s3transfer==0.11.4
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1717802530399/work
unicodedata2 @ file:///home/conda/feedstock_root/build_artifacts/unicodedata2_1649111919534/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1718728347128/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1731262100163/work
|
name: hyp3-autorift
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- alsa-lib=1.2.3.2=h166bdaf_0
- autorift=1.0.8=py38h82cb98a_2
- blosc=1.21.1=hd32f23e_0
- boost-cpp=1.74.0=h312852a_4
- boto3=1.35.72=pyhd8ed1ab_0
- botocore=1.35.99=pyge38_1234567_0
- brotli=1.0.9=h166bdaf_7
- brotli-bin=1.0.9=h166bdaf_7
- brotli-python=1.0.9=py38hfa26641_7
- brunsli=0.1=h9c3ff4c_0
- bzip2=1.0.8=h7f98852_4
- c-ares=1.18.1=h7f98852_0
- ca-certificates=2025.2.25=h06a4308_0
- cached-property=1.5.2=hd8ed1ab_1
- cached_property=1.5.2=pyha770c72_1
- cairo=1.16.0=h6cf1ce9_1008
- certifi=2024.8.30=pyhd8ed1ab_0
- cfitsio=3.470=h2e3daa1_7
- cftime=1.6.0=py38h71d37f0_1
- charls=2.2.0=h9c3ff4c_0
- charset-normalizer=3.4.0=pyhd8ed1ab_0
- click=8.1.7=unix_pyh707e725_0
- cloudpickle=3.1.0=pyhd8ed1ab_1
- colorama=0.4.6=pyhd8ed1ab_0
- coverage=6.3.3=py38h0a891b7_0
- curl=7.79.1=h2574ce0_1
- cycler=0.12.1=pyhd8ed1ab_0
- cytoolz=0.11.2=py38h0a891b7_2
- dask-core=2023.5.0=pyhd8ed1ab_0
- dbus=1.13.6=h48d8840_2
- exceptiongroup=1.2.2=pyhd8ed1ab_0
- expat=2.4.8=h27087fc_0
- ffmpeg=4.3.2=hca11adc_0
- fftw=3.3.8=nompi_hfc0cae8_1114
- flake8=7.1.1=pyhd8ed1ab_0
- flake8-blind-except=0.2.1=pyhd8ed1ab_0
- flake8-builtins=2.5.0=pyhd8ed1ab_0
- flake8-import-order=0.18.2=pyhd8ed1ab_0
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=h77eed37_3
- fontconfig=2.14.0=h8e229c2_0
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- fonttools=4.33.3=py38h0a891b7_0
- freetype=2.10.4=h0708190_1
- freexl=1.0.6=h7f98852_0
- fsspec=2024.10.0=pyhff2d567_0
- gdal=3.1.4=py38hcba47de_18
- geos=3.9.1=h9c3ff4c_2
- geotiff=1.6.0=h4f31c25_6
- gettext=0.19.8.1=h73d1719_1008
- giflib=5.2.1=h36c2ea0_2
- glib=2.68.4=h9c3ff4c_1
- glib-tools=2.68.4=h9c3ff4c_1
- gmp=6.2.1=h58526e2_0
- gnutls=3.6.13=h85f3911_1
- graphite2=1.3.13=h58526e2_1001
- gst-plugins-base=1.18.5=hf529b03_0
- gstreamer=1.18.5=h76c114f_0
- h5py=3.3.0=nompi_py38h9915d05_100
- harfbuzz=2.9.1=h83ec7ef_1
- hdf4=4.2.15=h10796ff_3
- hdf5=1.10.6=nompi_h7c3c948_1111
- hyp3lib=1.6.2=py_0
- icu=68.2=h9c3ff4c_0
- idna=3.10=pyhd8ed1ab_0
- imagecodecs=2021.7.30=py38hb5ce8f7_1
- imageio=2.36.0=pyh12aca89_1
- importlib-metadata=8.5.0=pyha770c72_0
- importlib_metadata=8.5.0=hd8ed1ab_1
- iniconfig=2.0.0=pyhd8ed1ab_0
- isce2=2.4.2=py38h4e29f2e_1
- jasper=1.900.1=h07fcdf6_1006
- jbig=2.1=h7f98852_2003
- jmespath=1.0.1=pyhd8ed1ab_0
- jpeg=9e=h166bdaf_1
- json-c=0.15=h98cffda_0
- jxrlib=1.1=h7f98852_2
- kealib=1.4.14=hcc255d8_2
- keyutils=1.6.1=h166bdaf_0
- kiwisolver=1.4.2=py38h43d8883_1
- krb5=1.19.3=h3790be6_0
- lame=3.100=h7f98852_1001
- lcms2=2.12=hddcbb42_0
- ld_impl_linux-64=2.40=h12ee557_0
- lerc=2.2.1=h9c3ff4c_0
- libaec=1.0.6=h9c3ff4c_0
- libblas=3.9.0=8_openblas
- libbrotlicommon=1.0.9=h166bdaf_7
- libbrotlidec=1.0.9=h166bdaf_7
- libbrotlienc=1.0.9=h166bdaf_7
- libcblas=3.9.0=8_openblas
- libclang=11.1.0=default_ha53f305_1
- libcurl=7.79.1=h2574ce0_1
- libdap4=3.20.6=hd7c4107_2
- libdeflate=1.7=h7f98852_5
- libedit=3.1.20191231=he28a2e2_2
- libev=4.33=h516909a_1
- libevent=2.1.10=h9b69904_4
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgdal=3.1.4=h07ae0cd_18
- libgfortran-ng=7.5.0=h14aa051_20
- libgfortran4=7.5.0=h14aa051_20
- libglib=2.68.4=h174f98d_1
- libgomp=11.2.0=h1234567_1
- libiconv=1.17=h166bdaf_0
- libkml=1.3.0=h238a007_1014
- liblapack=3.9.0=8_openblas
- liblapacke=3.9.0=8_openblas
- libllvm11=11.1.0=hf817b99_2
- libnetcdf=4.8.1=nompi_hcd642e3_100
- libnghttp2=1.43.0=h812cca2_1
- libnsl=2.0.0=h7f98852_0
- libogg=1.3.4=h7f98852_1
- libopenblas=0.3.12=pthreads_hb3c22a3_1
- libopencv=4.5.3=py38h5627943_1
- libopus=1.3.1=h7f98852_1
- libpng=1.6.37=h21135ba_2
- libpq=13.3=hd57d9b9_0
- libprotobuf=3.16.0=h780b84a_0
- librttopo=1.1.0=h1185371_6
- libspatialite=5.0.1=h8694cbe_6
- libssh2=1.10.0=ha56f1ee_2
- libstdcxx-ng=11.2.0=h1234567_1
- libtiff=4.3.0=hf544144_1
- libuuid=2.32.1=h7f98852_1000
- libvorbis=1.3.7=h9c3ff4c_0
- libwebp-base=1.2.2=h7f98852_1
- libxcb=1.13=h7f98852_1004
- libxkbcommon=1.0.3=he3ba5ed_0
- libxml2=2.9.12=h72842e0_0
- libxslt=1.1.33=h15afd5d_2
- libzip=1.8.0=h4de3113_1
- libzopfli=1.0.3=h9c3ff4c_0
- locket=1.0.0=pyhd8ed1ab_0
- lxml=4.8.0=py38h0a891b7_2
- lz4-c=1.9.3=h9c3ff4c_1
- matplotlib-base=3.5.2=py38h826bfd8_0
- mccabe=0.7.0=pyhd8ed1ab_0
- munkres=1.1.4=pyh9f0ad1d_0
- mysql-common=8.0.25=ha770c72_2
- mysql-libs=8.0.25=hfa10184_2
- ncurses=6.4=h6a678d5_0
- netcdf4=1.5.7=nompi_py38hcc16cfe_101
- nettle=3.6=he412f7d_0
- networkx=3.1=pyhd8ed1ab_0
- nspr=4.32=h9c3ff4c_1
- nss=3.69=hb5efdd6_1
- numpy=1.22.3=py38h99721a1_2
- olefile=0.47=pyhd8ed1ab_0
- opencv=4.5.3=py38h578d9bd_1
- openh264=2.1.1=h780b84a_0
- openjpeg=2.4.0=hb52868f_1
- openmotif=2.3.8=h5d10074_3
- openssl=1.1.1o=h166bdaf_0
- packaging=24.2=pyhd8ed1ab_2
- pandas=1.4.2=py38h47df419_1
- partd=1.4.1=pyhd8ed1ab_0
- patsy=0.5.6=pyhd8ed1ab_0
- pcre=8.45=h9c3ff4c_0
- pep8=1.7.1=py_0
- pillow=8.3.2=py38h8e6f84c_0
- pip=24.3.1=pyh8b19718_0
- pixman=0.40.0=h36c2ea0_0
- pluggy=1.5.0=pyhd8ed1ab_0
- poppler=21.03.0=h93df280_0
- poppler-data=0.4.12=hd8ed1ab_0
- postgresql=13.3=h2510834_0
- proj=8.0.1=h277dcde_0
- pthread-stubs=0.4=h36c2ea0_1001
- py-opencv=4.5.3=py38he5a9106_1
- pycodestyle=2.12.1=pyhd8ed1ab_0
- pyflakes=3.2.0=pyhd8ed1ab_0
- pyparsing=3.1.4=pyhd8ed1ab_0
- pyshp=2.3.1=pyhd8ed1ab_0
- pysocks=1.7.1=pyha2e5f31_6
- pytest=8.3.4=pyhd8ed1ab_0
- pytest-console-scripts=1.4.1=pyhd8ed1ab_0
- pytest-cov=5.0.0=pyhd8ed1ab_0
- python=3.8.12=hb7a2778_1_cpython
- python-dateutil=2.9.0=pyhd8ed1ab_0
- python_abi=3.8=5_cp38
- pytz=2024.2=pyhd8ed1ab_0
- pywavelets=1.3.0=py38h71d37f0_1
- pyyaml=6.0=py38h0a891b7_4
- qt=5.12.9=hda022c4_4
- readline=8.2=h5eee18b_0
- requests=2.32.3=pyhd8ed1ab_0
- responses=0.25.3=pyhd8ed1ab_0
- s3transfer=0.10.4=pyhd8ed1ab_0
- scikit-image=0.19.2=py38h43a58ef_0
- scipy=1.5.3=py38h828c644_0
- setuptools=75.3.0=pyhd8ed1ab_0
- setuptools-scm=8.1.0=pyhd8ed1ab_0
- setuptools_scm=8.1.0=hd8ed1ab_1
- six=1.16.0=pyh6c4a22f_0
- snappy=1.1.9=hbd366e4_1
- sqlite=3.45.3=h5eee18b_0
- statsmodels=0.13.2=py38h6c62de6_0
- tifffile=2021.11.2=pyhd8ed1ab_0
- tiledb=2.3.4=he87e0bf_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd8ed1ab_0
- tomli=2.0.2=pyhd8ed1ab_0
- toolz=1.0.0=pyhd8ed1ab_0
- types-pyyaml=6.0.12.20240917=pyhd8ed1ab_0
- typing-extensions=4.12.2=hd8ed1ab_0
- typing_extensions=4.12.2=pyha770c72_0
- tzcode=2022a=h166bdaf_0
- tzdata=2025b=h78e105d_0
- unicodedata2=14.0.0=py38h0a891b7_1
- urllib3=1.26.19=pyhd8ed1ab_0
- wheel=0.45.1=pyhd8ed1ab_0
- x264=1!161.3030=h7f98852_1
- xerces-c=3.2.3=h9d8b166_3
- xorg-kbproto=1.0.7=h7f98852_1002
- xorg-libice=1.0.10=h7f98852_0
- xorg-libsm=1.2.3=hd9c2040_1000
- xorg-libx11=1.6.12=h36c2ea0_0
- xorg-libxau=1.0.9=h7f98852_0
- xorg-libxdmcp=1.1.3=h7f98852_0
- xorg-libxext=1.3.4=h516909a_0
- xorg-libxft=2.3.4=hc534e41_1
- xorg-libxmu=1.1.3=h516909a_0
- xorg-libxp=1.0.3=0
- xorg-libxrender=0.9.10=h516909a_1002
- xorg-libxt=1.1.5=h516909a_1003
- xorg-renderproto=0.11.1=h7f98852_1002
- xorg-xextproto=7.3.0=h7f98852_1002
- xorg-xproto=7.0.31=h7f98852_1007
- xz=5.6.4=h5eee18b_1
- yaml=0.2.5=h7f98852_2
- zfp=0.5.5=h9c3ff4c_8
- zipp=3.21.0=pyhd8ed1ab_0
- zlib=1.2.13=h5eee18b_1
- zstd=1.5.0=ha95c52a_0
- pip:
- annotated-types==0.7.0
- authlib==1.3.2
- boto3-stubs==1.37.23
- botocore-stubs==1.37.23
- cffi==1.17.1
- cryptography==44.0.2
- dparse==0.6.4
- filelock==3.16.1
- hyp3-autorift==0.3.2.dev46+gcf8c6da
- jinja2==3.1.6
- joblib==1.4.2
- markdown-it-py==3.0.0
- markupsafe==2.1.5
- marshmallow==3.22.0
- mdurl==0.1.2
- mypy-boto3-dynamodb==1.37.12
- mypy-boto3-s3==1.37.0
- nltk==3.9.1
- psutil==6.1.1
- pycparser==2.22
- pydantic==2.9.2
- pydantic-core==2.23.4
- pygments==2.19.1
- pyproj==2.6.1.post1
- regex==2024.11.6
- rich==14.0.0
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.8
- s3pypi==2.0.1
- safety==3.3.1
- safety-schemas==0.0.11
- shellingham==1.5.4
- tqdm==4.67.1
- typer==0.15.2
- types-awscrt==0.24.2
- types-s3transfer==0.11.4
prefix: /opt/conda/envs/hyp3-autorift
|
[
"tests/test_geometry.py::test_pol_bounds_in_proj",
"tests/test_io.py::test_find_jpl_dem"
] |
[] |
[
"tests/test_geometry.py::test_polygon_from_bbox",
"tests/test_io.py::test_download_s3_file_requester_pays"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| null |
|
ASFHyP3__hyp3-sdk-152
|
b3e64fdef9d76d7abb6bd762ae1b8429ebd1e3f5
|
2021-11-19 18:14:31
|
938a41f4251c8246258a29a2904b445d0e28678a
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2c340f0..55972fc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,14 @@ and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.4.1](https://github.com/ASFHyP3/hyp3-sdk/compare/v1.4.1...v1.4.1)
+
+### Fixed
+- Slicing a `Batch` object will now return a new `Batch` instead of `list` of jobs
+- `Batch` equality now compares the contained jobs and not object identity
+
## [1.4.0](https://github.com/ASFHyP3/hyp3-sdk/compare/v1.3.2...v1.4.0)
+
### Added
- Exposed new `include_displacement_maps` parameter for `HyP3.prepare_insar_job` and `HyP3.submit_insar_job`, which will
cause both a line-of-sight displacement and a vertical displacement GeoTIFF to be included in the product.
diff --git a/hyp3_sdk/jobs.py b/hyp3_sdk/jobs.py
index fbe31e8..dbcfb4d 100644
--- a/hyp3_sdk/jobs.py
+++ b/hyp3_sdk/jobs.py
@@ -170,21 +170,22 @@ class Batch:
def __contains__(self, job: Job):
return job in self.jobs
- def __delitem__(self, job: Job):
+ def __eq__(self, other: 'Batch'):
+ return self.jobs == other.jobs
+
+ def __delitem__(self, job: int):
self.jobs.pop(job)
return self
def __getitem__(self, index: int):
+ if isinstance(index, slice):
+ return Batch(self.jobs[index])
return self.jobs[index]
def __setitem__(self, index: int, job: Job):
self.jobs[index] = job
return self
- def __reverse__(self):
- for job in self.jobs[::-1]:
- yield job
-
def __repr__(self):
reprs = ", ".join([job.__repr__() for job in self.jobs])
return f'Batch([{reprs}])'
diff --git a/hyp3_sdk/util.py b/hyp3_sdk/util.py
index 94ab7a7..cae1eac 100644
--- a/hyp3_sdk/util.py
+++ b/hyp3_sdk/util.py
@@ -109,8 +109,8 @@ def download_file(url: str, filepath: Union[Path, str], chunk_size=None, retries
session.mount('https://', HTTPAdapter(max_retries=retry_strategy))
session.mount('http://', HTTPAdapter(max_retries=retry_strategy))
-
- with session.get(url, stream=True) as s:
+ stream = False if chunk_size is None else True
+ with session.get(url, stream=stream) as s:
s.raise_for_status()
tqdm = get_tqdm_progress_bar()
with tqdm.wrapattr(open(filepath, "wb"), 'write', miniters=1, desc=filepath.name,
|
slicing a Batch returns a list
Should return a Batch instead.
```
>>> import hyp3_sdk
>>> hyp3 = hyp3_sdk.HyP3()
>>> jobs = hyp3.find_jobs()
>>> type(jobs)
<class 'hyp3_sdk.jobs.Batch'>
>>> len(jobs)
955
>>> type(jobs[3:10])
<class 'list'>
```
|
ASFHyP3/hyp3-sdk
|
diff --git a/tests/test_jobs.py b/tests/test_jobs.py
index 35c409d..cdef7e5 100644
--- a/tests/test_jobs.py
+++ b/tests/test_jobs.py
@@ -228,60 +228,66 @@ def test_contains(get_mock_job):
def test_delitem():
- j1 = Job.from_dict(SUCCEEDED_JOB)
- j2 = Job.from_dict(FAILED_JOB)
- batch = Batch([j1, j2])
+ j0 = Job.from_dict(SUCCEEDED_JOB)
+ j1 = Job.from_dict(FAILED_JOB)
+ batch = Batch([j0, j1])
+ assert j0 in batch
assert j1 in batch
- assert j2 in batch
del batch[1]
- assert j1 in batch
- assert j2 not in batch
+ assert j0 in batch
+ assert j1 not in batch
- batch += j2
+ batch += j1
del batch[0]
- assert j1 not in batch
- assert j2 in batch
+ assert j0 not in batch
+ assert j1 in batch
-def test_getitem():
- j1 = Job.from_dict(SUCCEEDED_JOB)
- j2 = Job.from_dict(FAILED_JOB)
- batch = Batch([j1, j2])
+def test_getitem(get_mock_job):
+ unexpired_time = (datetime.now(tz=tz.UTC) + timedelta(days=7)).isoformat(timespec='seconds')
+ j0 = Job.from_dict(SUCCEEDED_JOB)
+ j1 = Job.from_dict(FAILED_JOB)
+ j2 = get_mock_job(status_code='SUCCEEDED', expiration_time=unexpired_time,
+ files=[{'url': 'https://foo.com/file', 'size': 0, 'filename': 'file'}])
+ batch = Batch([j0, j1, j2])
+
+ assert j0 == batch[0]
+ assert j1 == batch[1]
+ assert j2 == batch[2]
- assert j1 == batch[0]
- assert j2 == batch[1]
+ assert Batch([j1, j2]) == batch[1:]
def test_setitem(get_mock_job):
unexpired_time = (datetime.now(tz=tz.UTC) + timedelta(days=7)).isoformat(timespec='seconds')
- j1 = Job.from_dict(SUCCEEDED_JOB)
- j2 = Job.from_dict(FAILED_JOB)
- j3 = get_mock_job(status_code='SUCCEEDED', expiration_time=unexpired_time,
+ j0 = Job.from_dict(SUCCEEDED_JOB)
+ j1 = Job.from_dict(FAILED_JOB)
+ j2 = get_mock_job(status_code='SUCCEEDED', expiration_time=unexpired_time,
files=[{'url': 'https://foo.com/file', 'size': 0, 'filename': 'file'}])
- batch = Batch([j1, j2])
+ batch = Batch([j0, j1])
- batch[1] = j3
- assert batch[1] == j3
+ assert batch[1] == j1
+ batch[1] = j2
+ assert batch[1] == j2
def test_reverse(get_mock_job):
unexpired_time = (datetime.now(tz=tz.UTC) + timedelta(days=7)).isoformat(timespec='seconds')
- j1 = Job.from_dict(SUCCEEDED_JOB)
- j2 = Job.from_dict(FAILED_JOB)
- j3 = get_mock_job(status_code='SUCCEEDED', expiration_time=unexpired_time,
+ j0 = Job.from_dict(SUCCEEDED_JOB)
+ j1 = Job.from_dict(FAILED_JOB)
+ j2 = get_mock_job(status_code='SUCCEEDED', expiration_time=unexpired_time,
files=[{'url': 'https://foo.com/file', 'size': 0, 'filename': 'file'}])
- batch = Batch([j1, j2, j3])
-
- batch_reversed = list(reversed(batch))
+ batch = Batch([j0, j1, j2])
- assert batch_reversed[0] == j3
- assert batch_reversed[1] == j2
- assert batch_reversed[2] == j1
+ batch_reversed = reversed(batch)
+ assert next(batch_reversed) == j2
+ assert next(batch_reversed) == j1
+ assert next(batch_reversed) == j0
def test_batch_complete_succeeded():
diff --git a/tests/test_util.py b/tests/test_util.py
index 7330f42..ec2b768 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -14,13 +14,24 @@ def test_download_file(tmp_path):
assert result_path == (tmp_path / 'file')
assert result_path.read_text() == 'foobar'
+
[email protected]
+def test_download_file_string_format(tmp_path):
responses.add(responses.GET, 'https://foo.com/file2', body='foobar2')
- result_path = util.download_file('https://foo.com/file', str(tmp_path / 'file'))
- assert result_path == (tmp_path / 'file')
- assert result_path.read_text() == 'foobar'
+ result_path = util.download_file('https://foo.com/file2', str(tmp_path / 'file2'))
+ assert result_path == (tmp_path / 'file2')
+ assert result_path.read_text() == 'foobar2'
assert isinstance(result_path, Path)
[email protected]
+def test_download_file_chunked_response(tmp_path):
+ responses.add(responses.GET, 'https://foo.com/file3', body='foobar3')
+ result_path = util.download_file('https://foo.com/file3', tmp_path / 'file3', chunk_size=3)
+ assert result_path == (tmp_path / 'file3')
+ assert result_path.read_text() == 'foobar3'
+
+
def test_chunk():
items = list(range(1234))
chunks = list(util.chunk(items))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 3
}
|
1.4
|
{
"env_vars": null,
"env_yml_path": [
"environment.yml"
],
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "environment.yml",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
anyio @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_anyio_1742243108/work
argon2-cffi @ file:///home/conda/feedstock_root/build_artifacts/argon2-cffi_1733311059102/work
argon2-cffi-bindings @ file:///home/conda/feedstock_root/build_artifacts/argon2-cffi-bindings_1725356560642/work
arrow @ file:///home/conda/feedstock_root/build_artifacts/arrow_1733584251875/work
asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1733250440834/work
async-lru @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_async-lru_1742153708/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1741918516150/work
babel @ file:///home/conda/feedstock_root/build_artifacts/babel_1738490167835/work
beautifulsoup4 @ file:///home/conda/feedstock_root/build_artifacts/beautifulsoup4_1738740337718/work
bleach @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_bleach_1737382993/work
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1725267488082/work
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1725571112467/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1735929714516/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1733218098505/work
comm @ file:///home/conda/feedstock_root/build_artifacts/comm_1733502965406/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1743381224823/work
debugpy @ file:///home/conda/feedstock_root/build_artifacts/debugpy_1741148409996/work
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1740384970518/work
defusedxml @ file:///home/conda/feedstock_root/build_artifacts/defusedxml_1615232257335/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1733208806608/work
executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1733569351617/work
fastjsonschema @ file:///home/conda/feedstock_root/build_artifacts/python-fastjsonschema_1733235979760/work/dist
flake8 @ file:///home/conda/feedstock_root/build_artifacts/flake8_1739898391164/work
flake8-blind-except @ file:///home/conda/feedstock_root/build_artifacts/flake8-blind-except_1736103523415/work
flake8-builtins @ file:///home/conda/feedstock_root/build_artifacts/flake8-builtins_1736204556749/work
flake8-import-order @ file:///home/conda/feedstock_root/build_artifacts/flake8-import-order_1735327522577/work
fqdn @ file:///home/conda/feedstock_root/build_artifacts/fqdn_1733327382592/work/dist
h11 @ file:///home/conda/feedstock_root/build_artifacts/h11_1733327467879/work
h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1738578511449/work
hpack @ file:///home/conda/feedstock_root/build_artifacts/hpack_1737618293087/work
httpcore @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_httpcore_1731707562/work
httpx @ file:///home/conda/feedstock_root/build_artifacts/httpx_1733663348460/work
-e git+https://github.com/ASFHyP3/hyp3-sdk.git@b3e64fdef9d76d7abb6bd762ae1b8429ebd1e3f5#egg=hyp3_sdk
hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1737618333194/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1733211830134/work
importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1737420181517/work
importlib_resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1736252299705/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1733223141826/work
ipykernel @ file:///home/conda/feedstock_root/build_artifacts/ipykernel_1719845459717/work
ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1701831663892/work
ipywidgets @ file:///home/conda/feedstock_root/build_artifacts/ipywidgets_1733493556527/work
isoduration @ file:///home/conda/feedstock_root/build_artifacts/isoduration_1733493628631/work/dist
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1733300866624/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1741263328855/work
json5 @ file:///home/conda/feedstock_root/build_artifacts/json5_1733272076743/work
jsonpointer @ file:///home/conda/feedstock_root/build_artifacts/jsonpointer_1725302957584/work
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema_1733472696581/work
jsonschema-specifications @ file:///tmp/tmpk0f344m9/src
jupyter @ file:///home/conda/feedstock_root/build_artifacts/jupyter_1733818543322/work
jupyter-console @ file:///home/conda/feedstock_root/build_artifacts/jupyter_console_1733817997778/work
jupyter-events @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_jupyter_events_1738765986/work
jupyter-lsp @ file:///home/conda/feedstock_root/build_artifacts/jupyter-lsp-meta_1733492907176/work/jupyter-lsp
jupyter_client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1733440914442/work
jupyter_core @ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1727163409502/work
jupyter_server @ file:///home/conda/feedstock_root/build_artifacts/jupyter_server_1734702637701/work
jupyter_server_terminals @ file:///home/conda/feedstock_root/build_artifacts/jupyter_server_terminals_1733427956852/work
jupyterlab @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_1741964057182/work
jupyterlab_pygments @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_pygments_1733328101776/work
jupyterlab_server @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_server_1733599573484/work
jupyterlab_widgets @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_widgets_1733428046021/work
MarkupSafe @ file:///home/conda/feedstock_root/build_artifacts/markupsafe_1733219680183/work
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1733416936468/work
mccabe @ file:///home/conda/feedstock_root/build_artifacts/mccabe_1733216466933/work
mistune @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_mistune_1742402716/work
nbclient @ file:///home/conda/feedstock_root/build_artifacts/nbclient_1734628800805/work
nbconvert @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_nbconvert-core_1738067871/work
nbformat @ file:///home/conda/feedstock_root/build_artifacts/nbformat_1733402752141/work
nest_asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1733325553580/work
notebook @ file:///home/conda/feedstock_root/build_artifacts/notebook_1741968175534/work
notebook_shim @ file:///home/conda/feedstock_root/build_artifacts/notebook-shim_1733408315203/work
overrides @ file:///home/conda/feedstock_root/build_artifacts/overrides_1734587627321/work
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
pandocfilters @ file:///home/conda/feedstock_root/build_artifacts/pandocfilters_1631603243851/work
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1733271261340/work
pep8==1.7.1
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1733301927746/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1733327343728/work
pkgutil_resolve_name @ file:///home/conda/feedstock_root/build_artifacts/pkgutil-resolve-name_1733344503739/work
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_platformdirs_1742485085/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1733222765875/work
prometheus_client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1733327310477/work
prompt_toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1737453357274/work
psutil @ file:///home/conda/feedstock_root/build_artifacts/psutil_1740663125313/work
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1733302279685/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl#sha256=92c32ff62b5fd8cf325bec5ab90d7be3d2a8ca8c8a3813ff487a8d2002630d1f
pure_eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1733569405015/work
pycodestyle @ file:///home/conda/feedstock_root/build_artifacts/pycodestyle_1733216196861/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_pycparser_1733195786/work
pyflakes @ file:///home/conda/feedstock_root/build_artifacts/pyflakes_1733216066937/work
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1736243443484/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1733217236728/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1740946542080/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1733223023082/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
python-json-logger @ file:///home/conda/feedstock_root/build_artifacts/python-json-logger_1677079630776/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1742920838005/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
pyzmq @ file:///home/conda/feedstock_root/build_artifacts/pyzmq_1741805177758/work
referencing @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_referencing_1737836872/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1733217035951/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1741755837680/work
rfc3339_validator @ file:///home/conda/feedstock_root/build_artifacts/rfc3339-validator_1733599910982/work
rfc3986-validator @ file:///home/conda/feedstock_root/build_artifacts/rfc3986-validator_1598024191506/work
rpds-py @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_rpds-py_1743037693/work
Send2Trash @ file:///home/conda/feedstock_root/build_artifacts/send2trash_1733322040660/work
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1742403392659/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
sniffio @ file:///home/conda/feedstock_root/build_artifacts/sniffio_1733244044561/work
soupsieve @ file:///home/conda/feedstock_root/build_artifacts/soupsieve_1693929250441/work
stack_data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1733569443808/work
terminado @ file:///home/conda/feedstock_root/build_artifacts/terminado_1710262609923/work
tinycss2 @ file:///home/conda/feedstock_root/build_artifacts/tinycss2_1729802851396/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1734091811753/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1733256695513/work
tornado @ file:///home/conda/feedstock_root/build_artifacts/tornado_1732615921868/work
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1735661334605/work
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1733367359838/work
types-python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/types-python-dateutil_1733612335562/work
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1735564787326/work
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1743201626/work
typing_utils @ file:///home/conda/feedstock_root/build_artifacts/typing_utils_1733331286120/work
uri-template @ file:///home/conda/feedstock_root/build_artifacts/uri-template_1733323593477/work/dist
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1734859416348/work
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1733231326287/work
webcolors @ file:///home/conda/feedstock_root/build_artifacts/webcolors_1733359735138/work
webencodings @ file:///home/conda/feedstock_root/build_artifacts/webencodings_1733236011802/work
websocket-client @ file:///home/conda/feedstock_root/build_artifacts/websocket-client_1733157342724/work
widgetsnbextension @ file:///home/conda/feedstock_root/build_artifacts/widgetsnbextension_1733128559935/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1732827521216/work
zstandard==0.23.0
|
name: hyp3-sdk
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- anyio=4.9.0=pyh29332c3_0
- argon2-cffi=23.1.0=pyhd8ed1ab_1
- argon2-cffi-bindings=21.2.0=py39h8cd3c5a_5
- arrow=1.3.0=pyhd8ed1ab_1
- asttokens=3.0.0=pyhd8ed1ab_1
- async-lru=2.0.5=pyh29332c3_0
- attrs=25.3.0=pyh71513ae_0
- babel=2.17.0=pyhd8ed1ab_0
- beautifulsoup4=4.13.3=pyha770c72_0
- bleach=6.2.0=pyh29332c3_4
- bleach-with-css=6.2.0=h82add2a_4
- brotli-python=1.1.0=py39hf88036b_2
- bzip2=1.0.8=h4bc722e_7
- ca-certificates=2025.1.31=hbcca054_0
- cached-property=1.5.2=hd8ed1ab_1
- cached_property=1.5.2=pyha770c72_1
- certifi=2025.1.31=pyhd8ed1ab_0
- cffi=1.17.1=py39h15c3d72_0
- charset-normalizer=3.4.1=pyhd8ed1ab_0
- colorama=0.4.6=pyhd8ed1ab_1
- comm=0.2.2=pyhd8ed1ab_1
- coverage=7.8.0=py39h9399b63_0
- debugpy=1.8.13=py39hf88036b_0
- decorator=5.2.1=pyhd8ed1ab_0
- defusedxml=0.7.1=pyhd8ed1ab_0
- exceptiongroup=1.2.2=pyhd8ed1ab_1
- executing=2.1.0=pyhd8ed1ab_1
- flake8=7.1.2=pyhd8ed1ab_0
- flake8-blind-except=0.2.1=pyhd8ed1ab_1
- flake8-builtins=2.5.0=pyhd8ed1ab_1
- flake8-import-order=0.18.2=pyhd8ed1ab_1
- fqdn=1.5.1=pyhd8ed1ab_1
- h11=0.14.0=pyhd8ed1ab_1
- h2=4.2.0=pyhd8ed1ab_0
- hpack=4.1.0=pyhd8ed1ab_0
- httpcore=1.0.7=pyh29332c3_1
- httpx=0.28.1=pyhd8ed1ab_0
- hyperframe=6.1.0=pyhd8ed1ab_0
- idna=3.10=pyhd8ed1ab_1
- importlib-metadata=8.6.1=pyha770c72_0
- importlib_resources=6.5.2=pyhd8ed1ab_0
- iniconfig=2.0.0=pyhd8ed1ab_1
- ipykernel=6.29.5=pyh3099207_0
- ipython=8.18.1=pyh707e725_3
- ipywidgets=8.1.5=pyhd8ed1ab_1
- isoduration=20.11.0=pyhd8ed1ab_1
- jedi=0.19.2=pyhd8ed1ab_1
- jinja2=3.1.6=pyhd8ed1ab_0
- json5=0.10.0=pyhd8ed1ab_1
- jsonpointer=3.0.0=py39hf3d152e_1
- jsonschema=4.23.0=pyhd8ed1ab_1
- jsonschema-specifications=2024.10.1=pyhd8ed1ab_1
- jsonschema-with-format-nongpl=4.23.0=hd8ed1ab_1
- jupyter=1.1.1=pyhd8ed1ab_1
- jupyter-lsp=2.2.5=pyhd8ed1ab_1
- jupyter_client=8.6.3=pyhd8ed1ab_1
- jupyter_console=6.6.3=pyhd8ed1ab_1
- jupyter_core=5.7.2=pyh31011fe_1
- jupyter_events=0.12.0=pyh29332c3_0
- jupyter_server=2.15.0=pyhd8ed1ab_0
- jupyter_server_terminals=0.5.3=pyhd8ed1ab_1
- jupyterlab=4.3.6=pyhd8ed1ab_0
- jupyterlab_pygments=0.3.0=pyhd8ed1ab_2
- jupyterlab_server=2.27.3=pyhd8ed1ab_1
- jupyterlab_widgets=3.0.13=pyhd8ed1ab_1
- keyutils=1.6.1=h166bdaf_0
- krb5=1.21.3=h659f571_0
- ld_impl_linux-64=2.43=h712a8e2_4
- libedit=3.1.20250104=pl5321h7949ede_0
- libffi=3.4.6=h2dba641_1
- libgcc=14.2.0=h767d61c_2
- libgcc-ng=14.2.0=h69a702a_2
- libgomp=14.2.0=h767d61c_2
- liblzma=5.6.4=hb9d3cd8_0
- libnsl=2.0.1=hd590300_0
- libsodium=1.0.20=h4ab18f5_0
- libsqlite=3.49.1=hee588c1_2
- libstdcxx=14.2.0=h8f9b012_2
- libstdcxx-ng=14.2.0=h4852527_2
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=hb9d3cd8_2
- markupsafe=3.0.2=py39h9399b63_1
- matplotlib-inline=0.1.7=pyhd8ed1ab_1
- mccabe=0.7.0=pyhd8ed1ab_1
- mistune=3.1.3=pyh29332c3_0
- nbclient=0.10.2=pyhd8ed1ab_0
- nbconvert-core=7.16.6=pyh29332c3_0
- nbformat=5.10.4=pyhd8ed1ab_1
- ncurses=6.5=h2d0b736_3
- nest-asyncio=1.6.0=pyhd8ed1ab_1
- notebook=7.3.3=pyhd8ed1ab_0
- notebook-shim=0.2.4=pyhd8ed1ab_1
- openssl=3.4.1=h7b32b05_0
- overrides=7.7.0=pyhd8ed1ab_1
- packaging=24.2=pyhd8ed1ab_2
- pandocfilters=1.5.0=pyhd8ed1ab_0
- parso=0.8.4=pyhd8ed1ab_1
- pep8=1.7.1=py_0
- pexpect=4.9.0=pyhd8ed1ab_1
- pickleshare=0.7.5=pyhd8ed1ab_1004
- pip=25.0.1=pyh8b19718_0
- pkgutil-resolve-name=1.3.10=pyhd8ed1ab_2
- platformdirs=4.3.7=pyh29332c3_0
- pluggy=1.5.0=pyhd8ed1ab_1
- prometheus_client=0.21.1=pyhd8ed1ab_0
- prompt-toolkit=3.0.50=pyha770c72_0
- prompt_toolkit=3.0.50=hd8ed1ab_0
- psutil=7.0.0=py39h8cd3c5a_0
- ptyprocess=0.7.0=pyhd8ed1ab_1
- pure_eval=0.2.3=pyhd8ed1ab_1
- pycodestyle=2.12.1=pyhd8ed1ab_1
- pycparser=2.22=pyh29332c3_1
- pyflakes=3.2.0=pyhd8ed1ab_1
- pygments=2.19.1=pyhd8ed1ab_0
- pysocks=1.7.1=pyha55dd90_7
- pytest=8.3.5=pyhd8ed1ab_0
- pytest-cov=6.0.0=pyhd8ed1ab_1
- python=3.9.21=h9c0c6dc_1_cpython
- python-dateutil=2.9.0.post0=pyhff2d567_1
- python-fastjsonschema=2.21.1=pyhd8ed1ab_0
- python-json-logger=2.0.7=pyhd8ed1ab_0
- python_abi=3.9=5_cp39
- pytz=2025.2=pyhd8ed1ab_0
- pyyaml=6.0.2=py39h9399b63_2
- pyzmq=26.3.0=py39h4e4fb57_0
- readline=8.2=h8c095d6_2
- referencing=0.36.2=pyh29332c3_0
- requests=2.32.3=pyhd8ed1ab_1
- responses=0.25.7=pyhd8ed1ab_0
- rfc3339-validator=0.1.4=pyhd8ed1ab_1
- rfc3986-validator=0.1.1=pyh9f0ad1d_0
- rpds-py=0.24.0=py39h3506688_0
- send2trash=1.8.3=pyh0d859eb_1
- setuptools=75.8.2=pyhff2d567_0
- setuptools-scm=8.2.1=pyhd8ed1ab_0
- setuptools_scm=8.2.1=hd8ed1ab_0
- six=1.17.0=pyhd8ed1ab_0
- sniffio=1.3.1=pyhd8ed1ab_1
- soupsieve=2.5=pyhd8ed1ab_1
- stack_data=0.6.3=pyhd8ed1ab_1
- terminado=0.18.1=pyh0d859eb_0
- tinycss2=1.4.0=pyhd8ed1ab_0
- tk=8.6.13=noxft_h4845f30_101
- toml=0.10.2=pyhd8ed1ab_1
- tomli=2.2.1=pyhd8ed1ab_1
- tornado=6.4.2=py39h8cd3c5a_0
- tqdm=4.67.1=pyhd8ed1ab_1
- traitlets=5.14.3=pyhd8ed1ab_1
- types-python-dateutil=2.9.0.20241206=pyhd8ed1ab_0
- types-pyyaml=6.0.12.20241230=pyhd8ed1ab_0
- typing-extensions=4.13.0=h9fa5a19_1
- typing_extensions=4.13.0=pyh29332c3_1
- typing_utils=0.1.0=pyhd8ed1ab_1
- tzdata=2025b=h78e105d_0
- uri-template=1.3.0=pyhd8ed1ab_1
- urllib3=2.3.0=pyhd8ed1ab_0
- wcwidth=0.2.13=pyhd8ed1ab_1
- webcolors=24.11.1=pyhd8ed1ab_0
- webencodings=0.5.1=pyhd8ed1ab_3
- websocket-client=1.8.0=pyhd8ed1ab_1
- wheel=0.45.1=pyhd8ed1ab_1
- widgetsnbextension=4.0.13=pyhd8ed1ab_1
- yaml=0.2.5=h7f98852_2
- zeromq=4.3.5=h3b0a872_7
- zipp=3.21.0=pyhd8ed1ab_1
- zstandard=0.23.0=py39h8cd3c5a_1
- pip:
- hyp3-sdk==1.4.0
prefix: /opt/conda/envs/hyp3-sdk
|
[
"tests/test_jobs.py::test_getitem"
] |
[] |
[
"tests/test_jobs.py::test_job_attributes",
"tests/test_jobs.py::test_job_dict_transforms",
"tests/test_jobs.py::test_job_complete_succeeded_failed_running",
"tests/test_jobs.py::test_job_expired",
"tests/test_jobs.py::test_job_download_files",
"tests/test_jobs.py::test_job_download_files_create_dirs",
"tests/test_jobs.py::test_job_download_files_expired",
"tests/test_jobs.py::test_batch_add",
"tests/test_jobs.py::test_batch_iadd",
"tests/test_jobs.py::test_batch_iter",
"tests/test_jobs.py::test_batch_len",
"tests/test_jobs.py::test_contains",
"tests/test_jobs.py::test_delitem",
"tests/test_jobs.py::test_setitem",
"tests/test_jobs.py::test_reverse",
"tests/test_jobs.py::test_batch_complete_succeeded",
"tests/test_jobs.py::test_batch_download",
"tests/test_jobs.py::test_batch_download_expired",
"tests/test_jobs.py::test_batch_any_expired",
"tests/test_jobs.py::test_batch_filter_jobs",
"tests/test_util.py::test_download_file",
"tests/test_util.py::test_download_file_string_format",
"tests/test_util.py::test_download_file_chunked_response",
"tests/test_util.py::test_chunk",
"tests/test_util.py::test_extract_zipped_product"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| null |
|
ASFHyP3__hyp3-sdk-51
|
67e33235f7dc3b98241fe34d97a4fae58873590c
|
2020-12-07 19:19:41
|
56cfb700341a0de44ee0f2f3548d5ed6c534d659
|
diff --git a/hyp3_sdk/hyp3.py b/hyp3_sdk/hyp3.py
index 7d90095..baf69f4 100644
--- a/hyp3_sdk/hyp3.py
+++ b/hyp3_sdk/hyp3.py
@@ -6,6 +6,7 @@ from urllib.parse import urljoin
from requests.exceptions import HTTPError, RequestException
+import hyp3_sdk
from hyp3_sdk.exceptions import HyP3Error, ValidationError
from hyp3_sdk.jobs import Batch, Job
from hyp3_sdk.util import get_authenticated_session
@@ -28,6 +29,7 @@ class HyP3:
"""
self.url = api_url
self.session = get_authenticated_session(username, password)
+ self.session.headers.update({'User-Agent': f'{hyp3_sdk.__name__}/{hyp3_sdk.__version__}'})
def find_jobs(self, start: Optional[datetime] = None, end: Optional[datetime] = None,
status: Optional[str] = None, name: Optional[str] = None) -> Batch:
|
Add custom User Agent header to hyp3 api session
e.g. `User-Agent: hyp3-sdk v0.1.2` so we can identify SDK-generated requests in the API access logs, separate from other requests made via `requests`.
|
ASFHyP3/hyp3-sdk
|
diff --git a/tests/test_hyp3.py b/tests/test_hyp3.py
index 626ee05..9aa05e9 100644
--- a/tests/test_hyp3.py
+++ b/tests/test_hyp3.py
@@ -1,4 +1,3 @@
-import json
from datetime import datetime, timedelta
from urllib.parse import urljoin
@@ -10,6 +9,18 @@ from hyp3_sdk import HyP3, Job
hyp3_sdk.TESTING = True
[email protected]
+def test_session_headers():
+ api = HyP3()
+ responses.add(responses.GET, urljoin(api.url, '/user'), json={'foo': 'bar'})
+
+ api.session.get(urljoin(api.url, '/user'))
+ assert responses.calls[0].request.headers['User-Agent'] == f'hyp3_sdk/{hyp3_sdk.__version__}'
+
+ api.my_info()
+ assert responses.calls[1].request.headers['User-Agent'] == f'hyp3_sdk/{hyp3_sdk.__version__}'
+
+
@responses.activate
def test_find_jobs(get_mock_job):
api_response_mock = {
@@ -23,7 +34,7 @@ def test_find_jobs(get_mock_job):
]
}
api = HyP3()
- responses.add(responses.GET, urljoin(api.url, '/jobs'), body=json.dumps(api_response_mock))
+ responses.add(responses.GET, urljoin(api.url, '/jobs'), json=api_response_mock)
response = api.find_jobs()
assert len(response) == 3
@@ -32,7 +43,7 @@ def test_find_jobs(get_mock_job):
def test_get_job_by_id(get_mock_job):
job = get_mock_job()
api = HyP3()
- responses.add(responses.GET, urljoin(api.url, f'/jobs/{job.job_id}'), body=json.dumps(job.to_dict()))
+ responses.add(responses.GET, urljoin(api.url, f'/jobs/{job.job_id}'), json=job.to_dict())
response = api._get_job_by_id(job.job_id)
assert response == job
@@ -45,9 +56,9 @@ def test_watch(get_mock_job):
api = HyP3()
for ii in range(3):
responses.add(responses.GET, urljoin(api.url, f'/jobs/{incomplete_job.job_id}'),
- body=json.dumps(incomplete_job.to_dict()))
+ json=incomplete_job.to_dict())
responses.add(responses.GET, urljoin(api.url, f'/jobs/{incomplete_job.job_id}'),
- body=json.dumps(complete_job.to_dict()))
+ json=complete_job.to_dict())
response = api.watch(incomplete_job, interval=0.05)
assert response == complete_job
responses.assert_call_count(urljoin(api.url, f'/jobs/{incomplete_job.job_id}'), 4)
@@ -60,7 +71,7 @@ def test_refresh(get_mock_job):
new_job.status_code = 'SUCCEEDED'
api = HyP3()
- responses.add(responses.GET, urljoin(api.url, f'/jobs/{job.job_id}'), body=json.dumps(new_job.to_dict()))
+ responses.add(responses.GET, urljoin(api.url, f'/jobs/{job.job_id}'), json=new_job.to_dict())
response = api.refresh(job)
assert response == new_job
@@ -74,7 +85,7 @@ def test_submit_job_dict(get_mock_job):
]
}
api = HyP3()
- responses.add(responses.POST, urljoin(api.url, '/jobs'), body=json.dumps(api_response))
+ responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
response = api.submit_job_dict(job.to_dict(for_resubmit=True))
assert response == job
@@ -88,7 +99,7 @@ def test_submit_autorift_job(get_mock_job):
]
}
api = HyP3()
- responses.add(responses.POST, urljoin(api.url, '/jobs'), body=json.dumps(api_response))
+ responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
response = api.submit_autorift_job('g1', 'g2')
assert response == job
@@ -102,7 +113,7 @@ def test_submit_rtc_job(get_mock_job):
]
}
api = HyP3()
- responses.add(responses.POST, urljoin(api.url, '/jobs'), body=json.dumps(api_response))
+ responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
response = api.submit_rtc_job('g1')
assert response == job
@@ -116,7 +127,7 @@ def test_submit_insar_job(get_mock_job):
]
}
api = HyP3()
- responses.add(responses.POST, urljoin(api.url, '/jobs'), body=json.dumps(api_response))
+ responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
response = api.submit_insar_job('g1', 'g2')
assert response == job
@@ -135,7 +146,7 @@ def test_my_info():
'user_id': 'someUser'
}
api = HyP3()
- responses.add(responses.GET, urljoin(api.url, '/user'), body=json.dumps(api_response))
+ responses.add(responses.GET, urljoin(api.url, '/user'), json=api_response)
response = api.my_info()
assert response == api_response
@@ -154,6 +165,6 @@ def test_check_quota():
'user_id': 'someUser'
}
api = HyP3()
- responses.add(responses.GET, urljoin(api.url, '/user'), body=json.dumps(api_response))
+ responses.add(responses.GET, urljoin(api.url, '/user'), json=api_response)
response = api.check_quota()
assert response == api_response['quota']['remaining']
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": [
"conda-env.yml"
],
"install": "python -m pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "environment.yml",
"pip_packages": null,
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
annotated-types==0.7.0
Authlib==1.5.1
babel @ file:///home/conda/feedstock_root/build_artifacts/babel_1738490167835/work
backrefs @ file:///home/conda/feedstock_root/build_artifacts/backrefs_1740887580136/work
boto3==1.37.23
boto3-stubs==1.37.23
botocore==1.37.23
botocore-stubs==1.37.23
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1725267488082/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1725571112467/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1735929714516/work
click @ file:///home/conda/feedstock_root/build_artifacts/click_1734858813237/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1733218098505/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1743381224823/work
cryptography==44.0.2
dparse==0.6.4
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1733208806608/work
filelock==3.16.1
ghp-import @ file:///home/conda/feedstock_root/build_artifacts/ghp-import_1734344360713/work
h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1738578511449/work
hpack @ file:///home/conda/feedstock_root/build_artifacts/hpack_1737618293087/work
-e git+https://github.com/ASFHyP3/hyp3-sdk.git@67e33235f7dc3b98241fe34d97a4fae58873590c#egg=hyp3_sdk
hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1737618333194/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1733211830134/work
importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1737420181517/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1733223141826/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1741263328855/work
jmespath==1.0.1
joblib==1.4.2
Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1710435156458/work
markdown-it-py==3.0.0
MarkupSafe @ file:///home/conda/feedstock_root/build_artifacts/markupsafe_1733219680183/work
marshmallow==3.26.1
mdurl==0.1.2
mergedeep @ file:///home/conda/feedstock_root/build_artifacts/mergedeep_1734156985434/work
mkdocs @ file:///home/conda/feedstock_root/build_artifacts/mkdocs_1734344575329/work
mkdocs-autorefs==1.4.1
mkdocs-get-deps @ file:///home/conda/feedstock_root/build_artifacts/mkdocs-get-deps_1734352941277/work
mkdocs-material @ file:///home/conda/feedstock_root/build_artifacts/mkdocs-material_1743393634987/work
mkdocs-material-extensions @ file:///home/conda/feedstock_root/build_artifacts/mkdocs-material-extensions_1734640982920/work
mkdocstrings==0.29.1
mypy-boto3-dynamodb==1.37.12
mypy-boto3-s3==1.37.0
nltk==3.9.1
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
paginate @ file:///home/conda/feedstock_root/build_artifacts/paginate_1734618550153/work
pathspec @ file:///home/conda/feedstock_root/build_artifacts/pathspec_1733233363808/work
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_platformdirs_1742485085/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1733222765875/work
psutil==6.1.1
pycparser @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_pycparser_1733195786/work
pydantic==2.9.2
pydantic_core==2.23.4
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1736243443484/work
pymdown-extensions @ file:///home/conda/feedstock_root/build_artifacts/pymdown-extensions_1738439084124/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1733217236728/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1740946542080/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1733223023082/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1742920838005/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
pyyaml_env_tag @ file:///home/conda/feedstock_root/build_artifacts/pyyaml-env-tag_1734344268003/work
regex==2024.11.6
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1733217035951/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1741755837680/work
rich==14.0.0
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
s3pypi==2.0.1
s3transfer==0.11.4
safety==3.3.1
safety-schemas==0.0.11
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1742403392659/work
shellingham==1.5.4
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1734091811753/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1733256695513/work
tqdm==4.67.1
typer==0.15.2
types-awscrt==0.24.2
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1735564787326/work
types-s3transfer==0.11.4
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1743201626/work
urllib3==1.26.20
watchdog @ file:///home/conda/feedstock_root/build_artifacts/watchdog_1730492870473/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1732827521216/work
zstandard==0.23.0
|
name: hyp3-sdk
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- babel=2.17.0=pyhd8ed1ab_0
- backrefs=5.8=pyhd8ed1ab_0
- brotli-python=1.1.0=py39hf88036b_2
- bzip2=1.0.8=h4bc722e_7
- ca-certificates=2025.1.31=hbcca054_0
- certifi=2025.1.31=pyhd8ed1ab_0
- cffi=1.17.1=py39h15c3d72_0
- charset-normalizer=3.4.1=pyhd8ed1ab_0
- click=8.1.8=pyh707e725_0
- colorama=0.4.6=pyhd8ed1ab_1
- coverage=7.8.0=py39h9399b63_0
- exceptiongroup=1.2.2=pyhd8ed1ab_1
- ghp-import=2.1.0=pyhd8ed1ab_2
- h2=4.2.0=pyhd8ed1ab_0
- hpack=4.1.0=pyhd8ed1ab_0
- hyperframe=6.1.0=pyhd8ed1ab_0
- idna=3.10=pyhd8ed1ab_1
- importlib-metadata=8.6.1=pyha770c72_0
- iniconfig=2.0.0=pyhd8ed1ab_1
- jinja2=3.1.6=pyhd8ed1ab_0
- ld_impl_linux-64=2.43=h712a8e2_4
- libffi=3.4.6=h2dba641_0
- libgcc=14.2.0=h767d61c_2
- libgcc-ng=14.2.0=h69a702a_2
- libgomp=14.2.0=h767d61c_2
- liblzma=5.6.4=hb9d3cd8_0
- libnsl=2.0.1=hd590300_0
- libsqlite=3.49.1=hee588c1_2
- libstdcxx=14.2.0=h8f9b012_2
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=hb9d3cd8_2
- markdown=3.6=pyhd8ed1ab_0
- markupsafe=3.0.2=py39h9399b63_1
- mergedeep=1.3.4=pyhd8ed1ab_1
- mkdocs=1.6.1=pyhd8ed1ab_1
- mkdocs-get-deps=0.2.0=pyhd8ed1ab_1
- mkdocs-material=9.6.10=pyhd8ed1ab_0
- mkdocs-material-extensions=1.3.1=pyhd8ed1ab_1
- ncurses=6.5=h2d0b736_3
- openssl=3.4.1=h7b32b05_0
- packaging=24.2=pyhd8ed1ab_2
- paginate=0.5.7=pyhd8ed1ab_1
- pathspec=0.12.1=pyhd8ed1ab_1
- pip=25.0.1=pyh8b19718_0
- platformdirs=4.3.7=pyh29332c3_0
- pluggy=1.5.0=pyhd8ed1ab_1
- pycparser=2.22=pyh29332c3_1
- pygments=2.19.1=pyhd8ed1ab_0
- pymdown-extensions=10.14.3=pyhd8ed1ab_0
- pysocks=1.7.1=pyha55dd90_7
- pytest=8.3.5=pyhd8ed1ab_0
- pytest-cov=6.0.0=pyhd8ed1ab_1
- python=3.9.21=h9c0c6dc_1_cpython
- python-dateutil=2.9.0.post0=pyhff2d567_1
- python_abi=3.9=5_cp39
- pytz=2025.2=pyhd8ed1ab_0
- pyyaml=6.0.2=py39h9399b63_2
- pyyaml-env-tag=0.1=pyhd8ed1ab_1
- readline=8.2=h8c095d6_2
- requests=2.32.3=pyhd8ed1ab_1
- responses=0.25.7=pyhd8ed1ab_0
- setuptools=75.8.2=pyhff2d567_0
- setuptools-scm=8.2.1=pyhd8ed1ab_0
- setuptools_scm=8.2.1=hd8ed1ab_0
- six=1.17.0=pyhd8ed1ab_0
- tk=8.6.13=noxft_h4845f30_101
- toml=0.10.2=pyhd8ed1ab_1
- tomli=2.2.1=pyhd8ed1ab_1
- types-pyyaml=6.0.12.20241230=pyhd8ed1ab_0
- typing-extensions=4.13.0=h9fa5a19_1
- typing_extensions=4.13.0=pyh29332c3_1
- tzdata=2025b=h78e105d_0
- watchdog=6.0.0=py39hf3d152e_0
- wheel=0.45.1=pyhd8ed1ab_1
- yaml=0.2.5=h7f98852_2
- zipp=3.21.0=pyhd8ed1ab_1
- zstandard=0.23.0=py39h8cd3c5a_1
- pip:
- annotated-types==0.7.0
- authlib==1.5.1
- boto3==1.37.23
- boto3-stubs==1.37.23
- botocore==1.37.23
- botocore-stubs==1.37.23
- cryptography==44.0.2
- dparse==0.6.4
- filelock==3.16.1
- hyp3-sdk==0.3.3.dev6+g67e3323
- jmespath==1.0.1
- joblib==1.4.2
- markdown-it-py==3.0.0
- marshmallow==3.26.1
- mdurl==0.1.2
- mkdocs-autorefs==1.4.1
- mkdocstrings==0.29.1
- mypy-boto3-dynamodb==1.37.12
- mypy-boto3-s3==1.37.0
- nltk==3.9.1
- psutil==6.1.1
- pydantic==2.9.2
- pydantic-core==2.23.4
- regex==2024.11.6
- rich==14.0.0
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- s3pypi==2.0.1
- s3transfer==0.11.4
- safety==3.3.1
- safety-schemas==0.0.11
- shellingham==1.5.4
- tqdm==4.67.1
- typer==0.15.2
- types-awscrt==0.24.2
- types-s3transfer==0.11.4
- urllib3==1.26.20
prefix: /opt/conda/envs/hyp3-sdk
|
[
"tests/test_hyp3.py::test_session_headers"
] |
[] |
[
"tests/test_hyp3.py::test_find_jobs",
"tests/test_hyp3.py::test_get_job_by_id",
"tests/test_hyp3.py::test_watch",
"tests/test_hyp3.py::test_refresh",
"tests/test_hyp3.py::test_submit_job_dict",
"tests/test_hyp3.py::test_submit_autorift_job",
"tests/test_hyp3.py::test_submit_rtc_job",
"tests/test_hyp3.py::test_submit_insar_job",
"tests/test_hyp3.py::test_my_info",
"tests/test_hyp3.py::test_check_quota"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| null |
|
ASFHyP3__hyp3-sdk-53
|
56cfb700341a0de44ee0f2f3548d5ed6c534d659
|
2020-12-08 01:14:31
|
56cfb700341a0de44ee0f2f3548d5ed6c534d659
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8905268..ddcacaa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.3.3](https://github.com/ASFHyP3/hyp3-sdk/compare/v0.3.2...v0.3.3)
+### Added
+- SDK will attach a `User-Agent` statement like `hyp3_sdk/VERSION` to all API interactions
+
+### Changed
+- Providing a job list to `Batch.__init__()` is now optional; an empty batch will
+ be created if the job list is not provided
+- `Batch.__init__()` no longer issues a warning when creating an empty batch
## [0.3.2](https://github.com/ASFHyP3/hyp3-sdk/compare/v0.3.1...v0.3.2)
### Changed
diff --git a/hyp3_sdk/jobs.py b/hyp3_sdk/jobs.py
index fbe8837..7866439 100644
--- a/hyp3_sdk/jobs.py
+++ b/hyp3_sdk/jobs.py
@@ -1,4 +1,3 @@
-import warnings
from datetime import datetime
from pathlib import Path
from typing import List, Optional, Union
@@ -124,10 +123,9 @@ class Job:
class Batch:
- def __init__(self, jobs: List[Job]):
- if len(jobs) == 0:
- warnings.warn('Jobs list is empty; creating an empty Batch', UserWarning)
-
+ def __init__(self, jobs: Optional[List[Job]] = None):
+ if jobs is None:
+ jobs = []
self.jobs = jobs
def __len__(self):
|
Batch constructor should create an empty batch by default
Currently, calling `jobs = Batch()` raises `TypeError: __init__() missing 1 required positional argument: 'jobs'`.
To construct an empty batch, the user has to write `jobs = Batch([])`. It would be more intuitive if this were the default behavior without having to explicitly provide an empty list.
|
ASFHyP3/hyp3-sdk
|
diff --git a/tests/test_jobs.py b/tests/test_jobs.py
index 6d25cec..400f2d8 100644
--- a/tests/test_jobs.py
+++ b/tests/test_jobs.py
@@ -119,8 +119,10 @@ def test_job_download_files(tmp_path, get_mock_job):
def test_batch_len():
- with pytest.warns(UserWarning):
- batch = Batch([])
+ batch = Batch()
+ assert len(batch) == 0
+
+ batch = Batch([])
assert len(batch) == 0
batch = Batch([Job.from_dict(SUCCEEDED_JOB), Job.from_dict(FAILED_JOB)])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"responses"
],
"pre_install": [],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
exceptiongroup==1.2.2
-e git+https://github.com/ASFHyP3/hyp3-sdk.git@56cfb700341a0de44ee0f2f3548d5ed6c534d659#egg=hyp3_sdk
idna==3.10
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
responses==0.25.7
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: hyp3-sdk
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- exceptiongroup==1.2.2
- hyp3-sdk==0.3.3.dev11+g56cfb70
- idna==3.10
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- responses==0.25.7
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/hyp3-sdk
|
[
"tests/test_jobs.py::test_batch_len"
] |
[] |
[
"tests/test_jobs.py::test_job_dict_transforms",
"tests/test_jobs.py::test_job_complete_succeeded_failed_running",
"tests/test_jobs.py::test_job_expired",
"tests/test_jobs.py::test_job_download_files",
"tests/test_jobs.py::test_batch_add",
"tests/test_jobs.py::test_batch_complete_succeeded",
"tests/test_jobs.py::test_batch_download",
"tests/test_jobs.py::test_batch_any_expired",
"tests/test_jobs.py::test_batch_filter_jobs"
] |
[] |
BSD 3-Clause "New" or "Revised" License
|
swerebench/sweb.eval.x86_64.asfhyp3_1776_hyp3-sdk-53
|
|
ASFHyP3__hyp3-sdk-70
|
6e4004e372771dc444bf5f334f1f8e25a39313bf
|
2021-02-15 23:10:57
|
1fec8b5ae4c2cf80392cc6e27a52123e72e320e0
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ef243f..620eb3f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [unreleased]
+
+### Added
+- Methods to prepare jobs for submission to HyP3
+ - `HyP3.prepare_autorift_job`
+ - `HyP3.prepare_rtc_job`
+ - `HyP3.prepare_insar_job`
+
+### Changed
+- HyP3 submit methods will always return a `Batch` containing the submitted job(s)
+- `HyP3.submit_job_dict` has been renamed to `HyP3.submit_prepared_jobs` and can
+ submit one or more prepared job dictionaries.
+
## [0.4.0](https://github.com/ASFHyP3/hyp3-sdk/compare/v0.3.3...v0.4.0)
### Added
diff --git a/conda-env.yml b/conda-env.yml
index 19264fd..60e7b10 100644
--- a/conda-env.yml
+++ b/conda-env.yml
@@ -5,6 +5,10 @@ channels:
dependencies:
- pip
# For packaging, and testing
+ - flake8
+ - flake8-import-order
+ - flake8-blind-except
+ - flake8-builtins
- setuptools
- setuptools_scm
- wheel
@@ -18,4 +22,3 @@ dependencies:
- pip:
# For packaging and testing
- s3pypi
- - safety
diff --git a/hyp3_sdk/exceptions.py b/hyp3_sdk/exceptions.py
index eeb5f3f..3c1fac5 100644
--- a/hyp3_sdk/exceptions.py
+++ b/hyp3_sdk/exceptions.py
@@ -5,9 +5,5 @@ class HyP3Error(Exception):
"""Base Exception for Hyp3_sdk"""
-class ValidationError(HyP3Error):
- """Raise when jobs do not pass validation"""
-
-
class AuthenticationError(HyP3Error):
"""Raise when authentication does not succeed"""
diff --git a/hyp3_sdk/hyp3.py b/hyp3_sdk/hyp3.py
index 8f85510..3acd82e 100644
--- a/hyp3_sdk/hyp3.py
+++ b/hyp3_sdk/hyp3.py
@@ -2,13 +2,13 @@ import time
import warnings
from datetime import datetime, timedelta
from functools import singledispatchmethod
-from typing import Optional, Union
+from typing import List, Optional, Union
from urllib.parse import urljoin
from requests.exceptions import HTTPError, RequestException
import hyp3_sdk
-from hyp3_sdk.exceptions import HyP3Error, ValidationError
+from hyp3_sdk.exceptions import HyP3Error
from hyp3_sdk.jobs import Batch, Job
from hyp3_sdk.util import get_authenticated_session
@@ -105,7 +105,7 @@ class HyP3:
job_or_batch: A Batch of Job object to refresh
Returns:
- obj: A Batch or Job object with refreshed information
+ A Batch or Job object with refreshed information
"""
raise NotImplementedError(f'Cannot refresh {type(job_or_batch)} type object')
@@ -120,71 +120,134 @@ class HyP3:
def _refresh_job(self, job: Job):
return self._get_job_by_id(job.job_id)
- def submit_job_dict(self, job_dict: dict, name: Optional[str] = None, validate_only: bool = False) -> Job:
- if name is not None:
- if len(name) > 20:
- raise ValidationError('Job name too long; must be less than 20 characters')
- job_dict['name'] = name
+ def submit_prepared_jobs(self, prepared_jobs: Union[dict, List[dict]]) -> Batch:
+ """Submit a prepared job dictionary, or list of prepared job dictionaries
+
+ Args:
+ prepared_jobs: A prepared job dictionary, or list of prepared job dictionaries
+
+ Returns:
+ A Batch object containing the submitted job(s)
+ """
+ if isinstance(prepared_jobs, dict):
+ payload = {'jobs': [prepared_jobs]}
+ else:
+ payload = {'jobs': prepared_jobs}
- payload = {'jobs': [job_dict], 'validate_only': validate_only}
response = self.session.post(urljoin(self.url, '/jobs'), json=payload)
try:
response.raise_for_status()
except HTTPError:
raise HyP3Error('Error while submitting job to HyP3')
- return Job.from_dict(response.json()['jobs'][0])
- def submit_autorift_job(self, granule1: str, granule2: str, name: Optional[str] = None) -> Job:
+ batch = Batch()
+ for job in response.json()['jobs']:
+ batch += Job.from_dict(job)
+ return batch
+
+ def submit_autorift_job(self, granule1: str, granule2: str, name: Optional[str] = None) -> Batch:
"""Submit an autoRIFT job
Args:
granule1: The first granule (scene) to use
granule2: The second granule (scene) to use
- name: A name for the job (must be <= 20 characters)
+ name: A name for the job
Returns:
A Batch object containing the autoRIFT job
"""
+ job_dict = self.prepare_autorift_job(granule1, granule2, name=name)
+ return self.submit_prepared_jobs(prepared_jobs=job_dict)
+
+ @classmethod
+ def prepare_autorift_job(cls, granule1: str, granule2: str, name: Optional[str] = None) -> dict:
+ """Submit an autoRIFT job
+
+ Args:
+ granule1: The first granule (scene) to use
+ granule2: The second granule (scene) to use
+ name: A name for the job
+
+ Returns:
+ A dictionary containing the prepared autoRIFT job
+ """
job_dict = {
'job_parameters': {'granules': [granule1, granule2]},
'job_type': 'AUTORIFT',
}
- return self.submit_job_dict(job_dict=job_dict, name=name)
+ if name is not None:
+ job_dict['name'] = name
+ return job_dict
- def submit_rtc_job(self, granule: str, name: Optional[str] = None, **kwargs) -> Job:
+ def submit_rtc_job(self, granule: str, name: Optional[str] = None, **kwargs) -> Batch:
"""Submit an RTC job
Args:
granule: The granule (scene) to use
- name: A name for the job (must be <= 20 characters)
+ name: A name for the job
**kwargs: Extra job parameters specifying custom processing options
Returns:
A Batch object containing the RTC job
"""
+ job_dict = self.prepare_rtc_job(granule, name=name, **kwargs)
+ return self.submit_prepared_jobs(prepared_jobs=job_dict)
+
+ @classmethod
+ def prepare_rtc_job(cls, granule: str, name: Optional[str] = None, **kwargs) -> dict:
+ """Submit an RTC job
+
+ Args:
+ granule: The granule (scene) to use
+ name: A name for the job
+ **kwargs: Extra job parameters specifying custom processing options
+
+ Returns:
+ A dictionary containing the prepared RTC job
+ """
job_dict = {
'job_parameters': {'granules': [granule], **kwargs},
'job_type': 'RTC_GAMMA',
}
- return self.submit_job_dict(job_dict=job_dict, name=name)
+ if name is not None:
+ job_dict['name'] = name
+ return job_dict
- def submit_insar_job(self, granule1: str, granule2: str, name: Optional[str] = None, **kwargs) -> Job:
+ def submit_insar_job(self, granule1: str, granule2: str, name: Optional[str] = None, **kwargs) -> Batch:
"""Submit an InSAR job
Args:
granule1: The first granule (scene) to use
granule2: The second granule (scene) to use
- name: A name for the job (must be <= 20 characters)
+ name: A name for the job
**kwargs: Extra job parameters specifying custom processing options
Returns:
A Batch object containing the InSAR job
"""
+ job_dict = self.prepare_insar_job(granule1, granule2, name=name, **kwargs)
+ return self.submit_prepared_jobs(prepared_jobs=job_dict)
+
+ @classmethod
+ def prepare_insar_job(cls, granule1: str, granule2: str, name: Optional[str] = None, **kwargs) -> dict:
+ """Submit an InSAR job
+
+ Args:
+ granule1: The first granule (scene) to use
+ granule2: The second granule (scene) to use
+ name: A name for the job
+ **kwargs: Extra job parameters specifying custom processing options
+
+ Returns:
+ A dictionary containing the prepared InSAR job
+ """
job_dict = {
'job_parameters': {'granules': [granule1, granule2], **kwargs},
'job_type': 'INSAR_GAMMA',
}
- return self.submit_job_dict(job_dict=job_dict, name=name)
+ if name is not None:
+ job_dict['name'] = name
+ return job_dict
def my_info(self) -> dict:
"""
|
use fewer requests when submitting multiple jobs
When submitting large jobs, multiple api request are created, would be nice for a way to aggrigate jobs into one request
|
ASFHyP3/hyp3-sdk
|
diff --git a/tests/test_hyp3.py b/tests/test_hyp3.py
index 383ac87..743fbac 100644
--- a/tests/test_hyp3.py
+++ b/tests/test_hyp3.py
@@ -85,17 +85,88 @@ def test_refresh(get_mock_job):
@responses.activate
-def test_submit_job_dict(get_mock_job):
- job = get_mock_job()
+def test_submit_prepared_jobs(get_mock_job):
+ rtc_job = get_mock_job('RTC_GAMMA', job_parameters={'granules': ['g1']})
+ insar_job = get_mock_job('INSAR_GAMMA', job_parameters={'granules': ['g1', 'g2']})
api_response = {
'jobs': [
- job.to_dict()
+ rtc_job.to_dict(),
+ insar_job.to_dict(),
]
}
+
api = HyP3()
responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
- response = api.submit_job_dict(job.to_dict(for_resubmit=True))
- assert response == job
+
+ batch = api.submit_prepared_jobs(
+ [rtc_job.to_dict(for_resubmit=True), insar_job.to_dict(for_resubmit=True)])
+ assert batch.jobs == [rtc_job, insar_job]
+
+
+def test_prepare_autorift_job():
+ assert HyP3.prepare_autorift_job(granule1='my_granule1', granule2='my_granule2') == {
+ 'job_type': 'AUTORIFT',
+ 'job_parameters': {
+ 'granules': ['my_granule1', 'my_granule2'],
+ }
+ }
+ assert HyP3.prepare_autorift_job(granule1='my_granule1', granule2='my_granule2', name='my_name') == {
+ 'job_type': 'AUTORIFT',
+ 'name': 'my_name',
+ 'job_parameters': {
+ 'granules': ['my_granule1', 'my_granule2'],
+ },
+ }
+
+
+def test_prepare_rtc_job():
+ assert HyP3.prepare_rtc_job(granule='my_granule') == {
+ 'job_type': 'RTC_GAMMA',
+ 'job_parameters': {
+ 'granules': ['my_granule'],
+ }
+ }
+ assert HyP3.prepare_rtc_job(granule='my_granule', name='my_name') == {
+ 'job_type': 'RTC_GAMMA',
+ 'name': 'my_name',
+ 'job_parameters': {
+ 'granules': ['my_granule'],
+ },
+ }
+ assert HyP3.prepare_rtc_job(granule='my_granule', x='foo', y=1.0, z=True) == {
+ 'job_type': 'RTC_GAMMA',
+ 'job_parameters': {
+ 'granules': ['my_granule'],
+ 'x': 'foo',
+ 'y': 1.0,
+ 'z': True,
+ }
+ }
+
+
+def test_prepare_insar_job():
+ assert HyP3.prepare_insar_job(granule1='my_granule1', granule2='my_granule2') == {
+ 'job_type': 'INSAR_GAMMA',
+ 'job_parameters': {
+ 'granules': ['my_granule1', 'my_granule2'],
+ }
+ }
+ assert HyP3.prepare_insar_job(granule1='my_granule1', granule2='my_granule2', name='my_name') == {
+ 'job_type': 'INSAR_GAMMA',
+ 'name': 'my_name',
+ 'job_parameters': {
+ 'granules': ['my_granule1', 'my_granule2'],
+ },
+ }
+ assert HyP3.prepare_insar_job(granule1='my_granule1', granule2='my_granule2', x='foo', y=1.0, z=True) == {
+ 'job_type': 'INSAR_GAMMA',
+ 'job_parameters': {
+ 'granules': ['my_granule1', 'my_granule2'],
+ 'x': 'foo',
+ 'y': 1.0,
+ 'z': True,
+ }
+ }
@responses.activate
@@ -108,8 +179,8 @@ def test_submit_autorift_job(get_mock_job):
}
api = HyP3()
responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
- response = api.submit_autorift_job('g1', 'g2')
- assert response == job
+ batch = api.submit_autorift_job('g1', 'g2')
+ assert batch.jobs[0] == job
@responses.activate
@@ -122,8 +193,8 @@ def test_submit_rtc_job(get_mock_job):
}
api = HyP3()
responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
- response = api.submit_rtc_job('g1')
- assert response == job
+ batch = api.submit_rtc_job('g1')
+ assert batch.jobs[0] == job
@responses.activate
@@ -136,8 +207,22 @@ def test_submit_insar_job(get_mock_job):
}
api = HyP3()
responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
- response = api.submit_insar_job('g1', 'g2')
- assert response == job
+ batch = api.submit_insar_job('g1', 'g2')
+ assert batch.jobs[0] == job
+
+
[email protected]
+def test_resubmit_previous_job(get_mock_job):
+ job = get_mock_job()
+ api_response = {
+ 'jobs': [
+ job.to_dict()
+ ]
+ }
+ api = HyP3()
+ responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response)
+ batch = api.submit_prepared_jobs(job.to_dict(for_resubmit=True))
+ assert batch.jobs[0] == job
@responses.activate
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 4
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": [
"conda-env.yml"
],
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "environment.yml",
"pip_packages": null,
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
annotated-types==0.7.0
Authlib==1.5.1
boto3==1.37.23
boto3-stubs==1.37.23
botocore==1.37.23
botocore-stubs==1.37.23
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1725267488082/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1725571112467/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1735929714516/work
click==8.1.8
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1733218098505/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1743381224823/work
cryptography==44.0.2
dparse==0.6.4
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1733208806608/work
filelock==3.16.1
h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1738578511449/work
hpack @ file:///home/conda/feedstock_root/build_artifacts/hpack_1737618293087/work
-e git+https://github.com/ASFHyP3/hyp3-sdk.git@6e4004e372771dc444bf5f334f1f8e25a39313bf#egg=hyp3_sdk
hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1737618333194/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1733211830134/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1733223141826/work
Jinja2==3.1.6
jmespath==1.0.1
joblib==1.4.2
markdown-it-py==3.0.0
MarkupSafe==3.0.2
marshmallow==3.26.1
mdurl==0.1.2
mypy-boto3-dynamodb==1.37.12
mypy-boto3-s3==1.37.0
nltk==3.9.1
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1733222765875/work
psutil==6.1.1
pycparser @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_pycparser_1733195786/work
pydantic==2.9.2
pydantic_core==2.23.4
Pygments==2.19.1
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1733217236728/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1740946542080/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1733223023082/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
regex==2024.11.6
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1733217035951/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1741755837680/work
rich==14.0.0
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
s3pypi==2.0.1
s3transfer==0.11.4
safety==3.3.1
safety-schemas==0.0.11
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1742403392659/work
shellingham==1.5.4
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1734091811753/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1733256695513/work
tqdm==4.67.1
typer==0.15.2
types-awscrt==0.24.2
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1735564787326/work
types-s3transfer==0.11.4
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1743201626/work
urllib3==1.26.20
zstandard==0.23.0
|
name: hyp3-sdk
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- brotli-python=1.1.0=py39hf88036b_2
- bzip2=1.0.8=h4bc722e_7
- ca-certificates=2025.1.31=hbcca054_0
- certifi=2025.1.31=pyhd8ed1ab_0
- cffi=1.17.1=py39h15c3d72_0
- charset-normalizer=3.4.1=pyhd8ed1ab_0
- colorama=0.4.6=pyhd8ed1ab_1
- coverage=7.8.0=py39h9399b63_0
- exceptiongroup=1.2.2=pyhd8ed1ab_1
- h2=4.2.0=pyhd8ed1ab_0
- hpack=4.1.0=pyhd8ed1ab_0
- hyperframe=6.1.0=pyhd8ed1ab_0
- idna=3.10=pyhd8ed1ab_1
- iniconfig=2.0.0=pyhd8ed1ab_1
- ld_impl_linux-64=2.43=h712a8e2_4
- libffi=3.4.6=h2dba641_0
- libgcc=14.2.0=h767d61c_2
- libgcc-ng=14.2.0=h69a702a_2
- libgomp=14.2.0=h767d61c_2
- liblzma=5.6.4=hb9d3cd8_0
- libnsl=2.0.1=hd590300_0
- libsqlite=3.49.1=hee588c1_2
- libstdcxx=14.2.0=h8f9b012_2
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=hb9d3cd8_2
- ncurses=6.5=h2d0b736_3
- openssl=3.4.1=h7b32b05_0
- packaging=24.2=pyhd8ed1ab_2
- pip=25.0.1=pyh8b19718_0
- pluggy=1.5.0=pyhd8ed1ab_1
- pycparser=2.22=pyh29332c3_1
- pysocks=1.7.1=pyha55dd90_7
- pytest=8.3.5=pyhd8ed1ab_0
- pytest-cov=6.0.0=pyhd8ed1ab_1
- python=3.9.21=h9c0c6dc_1_cpython
- python-dateutil=2.9.0.post0=pyhff2d567_1
- python_abi=3.9=5_cp39
- pyyaml=6.0.2=py39h9399b63_2
- readline=8.2=h8c095d6_2
- requests=2.32.3=pyhd8ed1ab_1
- responses=0.25.7=pyhd8ed1ab_0
- setuptools=75.8.2=pyhff2d567_0
- setuptools-scm=8.2.1=pyhd8ed1ab_0
- setuptools_scm=8.2.1=hd8ed1ab_0
- six=1.17.0=pyhd8ed1ab_0
- tk=8.6.13=noxft_h4845f30_101
- toml=0.10.2=pyhd8ed1ab_1
- tomli=2.2.1=pyhd8ed1ab_1
- types-pyyaml=6.0.12.20241230=pyhd8ed1ab_0
- typing-extensions=4.13.0=h9fa5a19_1
- typing_extensions=4.13.0=pyh29332c3_1
- tzdata=2025b=h78e105d_0
- wheel=0.45.1=pyhd8ed1ab_1
- yaml=0.2.5=h7f98852_2
- zstandard=0.23.0=py39h8cd3c5a_1
- pip:
- annotated-types==0.7.0
- authlib==1.5.1
- boto3==1.37.23
- boto3-stubs==1.37.23
- botocore==1.37.23
- botocore-stubs==1.37.23
- click==8.1.8
- cryptography==44.0.2
- dparse==0.6.4
- filelock==3.16.1
- hyp3-sdk==0.4.1.dev3+g6e4004e
- jinja2==3.1.6
- jmespath==1.0.1
- joblib==1.4.2
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- marshmallow==3.26.1
- mdurl==0.1.2
- mypy-boto3-dynamodb==1.37.12
- mypy-boto3-s3==1.37.0
- nltk==3.9.1
- psutil==6.1.1
- pydantic==2.9.2
- pydantic-core==2.23.4
- pygments==2.19.1
- regex==2024.11.6
- rich==14.0.0
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- s3pypi==2.0.1
- s3transfer==0.11.4
- safety==3.3.1
- safety-schemas==0.0.11
- shellingham==1.5.4
- tqdm==4.67.1
- typer==0.15.2
- types-awscrt==0.24.2
- types-s3transfer==0.11.4
- urllib3==1.26.20
prefix: /opt/conda/envs/hyp3-sdk
|
[
"tests/test_hyp3.py::test_submit_prepared_jobs",
"tests/test_hyp3.py::test_prepare_autorift_job",
"tests/test_hyp3.py::test_prepare_rtc_job",
"tests/test_hyp3.py::test_prepare_insar_job",
"tests/test_hyp3.py::test_submit_autorift_job",
"tests/test_hyp3.py::test_submit_rtc_job",
"tests/test_hyp3.py::test_submit_insar_job",
"tests/test_hyp3.py::test_resubmit_previous_job"
] |
[] |
[
"tests/test_hyp3.py::test_session_headers",
"tests/test_hyp3.py::test_find_jobs",
"tests/test_hyp3.py::test_get_job_by_id",
"tests/test_hyp3.py::test_watch",
"tests/test_hyp3.py::test_refresh",
"tests/test_hyp3.py::test_my_info",
"tests/test_hyp3.py::test_check_quota"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| null |
|
ASFHyP3__hyp3-sdk-71
|
b8011c957ce5759bd64007c2116d202fdb5a6dae
|
2021-02-16 00:37:00
|
1fec8b5ae4c2cf80392cc6e27a52123e72e320e0
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 620eb3f..38529ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- `HyP3.prepare_insar_job`
### Changed
+- HyP3 `Batch` objects are now iterable
- HyP3 submit methods will always return a `Batch` containing the submitted job(s)
- `HyP3.submit_job_dict` has been renamed to `HyP3.submit_prepared_jobs` and can
submit one or more prepared job dictionaries.
diff --git a/hyp3_sdk/jobs.py b/hyp3_sdk/jobs.py
index 9167d02..38054fa 100644
--- a/hyp3_sdk/jobs.py
+++ b/hyp3_sdk/jobs.py
@@ -129,9 +129,6 @@ class Batch:
jobs = []
self.jobs = jobs
- def __len__(self):
- return len(self.jobs)
-
def __add__(self, other: Union[Job, 'Batch']):
if isinstance(other, Batch):
return Batch(self.jobs + other.jobs)
@@ -140,6 +137,12 @@ class Batch:
else:
raise TypeError(f"unsupported operand type(s) for +: '{type(self)}' and '{type(other)}'")
+ def __iter__(self):
+ return iter(self.jobs)
+
+ def __len__(self):
+ return len(self.jobs)
+
def __repr__(self):
return str([job.to_dict() for job in self.jobs])
|
Batch should be iterable
Attempting to iterate over a Batch object currently fails with `TypeError: 'Batch' object is not iterable`.
```
> import hyp3_sdk
> api = hyp3_sdk.HyP3()
> jobs = api.find_jobs(name='refactor')
> sizes = [job['files'][0]['size'] for job in jobs]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'Batch' object is not iterable
```
|
ASFHyP3/hyp3-sdk
|
diff --git a/tests/test_jobs.py b/tests/test_jobs.py
index 400f2d8..dab034b 100644
--- a/tests/test_jobs.py
+++ b/tests/test_jobs.py
@@ -118,17 +118,6 @@ def test_job_download_files(tmp_path, get_mock_job):
assert contents == 'foobar2'
-def test_batch_len():
- batch = Batch()
- assert len(batch) == 0
-
- batch = Batch([])
- assert len(batch) == 0
-
- batch = Batch([Job.from_dict(SUCCEEDED_JOB), Job.from_dict(FAILED_JOB)])
- assert len(batch) == 2
-
-
def test_batch_add():
a = Batch([Job.from_dict(SUCCEEDED_JOB)])
b = Batch([Job.from_dict(FAILED_JOB)])
@@ -147,6 +136,24 @@ def test_batch_add():
assert d.jobs[2].running()
+def test_batch_iter():
+ defined_jobs = [Job.from_dict(SUCCEEDED_JOB), Job.from_dict(FAILED_JOB)]
+ batch = Batch(defined_jobs)
+ for batch_job, defined_job in zip(batch, defined_jobs):
+ assert batch_job == defined_job
+
+
+def test_batch_len():
+ batch = Batch()
+ assert len(batch) == 0
+
+ batch = Batch([])
+ assert len(batch) == 0
+
+ batch = Batch([Job.from_dict(SUCCEEDED_JOB), Job.from_dict(FAILED_JOB)])
+ assert len(batch) == 2
+
+
def test_batch_complete_succeeded():
batch = Batch([Job.from_dict(SUCCEEDED_JOB), Job.from_dict(SUCCEEDED_JOB)])
assert batch.complete()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": [
"conda-env.yml"
],
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "environment.yml",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
boto3==1.37.23
boto3-stubs==1.37.23
botocore==1.37.23
botocore-stubs==1.37.23
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1725267488082/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1725571112467/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1735929714516/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1733218098505/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1743381224823/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1733208806608/work
flake8 @ file:///home/conda/feedstock_root/build_artifacts/flake8_1739898391164/work
flake8-blind-except @ file:///home/conda/feedstock_root/build_artifacts/flake8-blind-except_1736103523415/work
flake8-builtins @ file:///home/conda/feedstock_root/build_artifacts/flake8-builtins_1736204556749/work
flake8-import-order @ file:///home/conda/feedstock_root/build_artifacts/flake8-import-order_1735327522577/work
h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1738578511449/work
hpack @ file:///home/conda/feedstock_root/build_artifacts/hpack_1737618293087/work
-e git+https://github.com/ASFHyP3/hyp3-sdk.git@b8011c957ce5759bd64007c2116d202fdb5a6dae#egg=hyp3_sdk
hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1737618333194/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1733211830134/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1733223141826/work
jmespath==1.0.1
mccabe @ file:///home/conda/feedstock_root/build_artifacts/mccabe_1733216466933/work
mypy-boto3-dynamodb==1.37.12
mypy-boto3-s3==1.37.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
pep8==1.7.1
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1733222765875/work
pycodestyle @ file:///home/conda/feedstock_root/build_artifacts/pycodestyle_1733216196861/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_pycparser_1733195786/work
pyflakes @ file:///home/conda/feedstock_root/build_artifacts/pyflakes_1733216066937/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1733217236728/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1740946542080/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1733223023082/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1733217035951/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1741755837680/work
s3pypi==2.0.1
s3transfer==0.11.4
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1742403392659/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1734091811753/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1733256695513/work
types-awscrt==0.24.2
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1735564787326/work
types-s3transfer==0.11.4
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1743201626/work
urllib3==1.26.20
zstandard==0.23.0
|
name: hyp3-sdk
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- brotli-python=1.1.0=py39hf88036b_2
- bzip2=1.0.8=h4bc722e_7
- ca-certificates=2025.1.31=hbcca054_0
- certifi=2025.1.31=pyhd8ed1ab_0
- cffi=1.17.1=py39h15c3d72_0
- charset-normalizer=3.4.1=pyhd8ed1ab_0
- colorama=0.4.6=pyhd8ed1ab_1
- coverage=7.8.0=py39h9399b63_0
- exceptiongroup=1.2.2=pyhd8ed1ab_1
- flake8=7.1.2=pyhd8ed1ab_0
- flake8-blind-except=0.2.1=pyhd8ed1ab_1
- flake8-builtins=2.5.0=pyhd8ed1ab_1
- flake8-import-order=0.18.2=pyhd8ed1ab_1
- h2=4.2.0=pyhd8ed1ab_0
- hpack=4.1.0=pyhd8ed1ab_0
- hyperframe=6.1.0=pyhd8ed1ab_0
- idna=3.10=pyhd8ed1ab_1
- iniconfig=2.0.0=pyhd8ed1ab_1
- ld_impl_linux-64=2.43=h712a8e2_4
- libffi=3.4.6=h2dba641_0
- libgcc=14.2.0=h767d61c_2
- libgcc-ng=14.2.0=h69a702a_2
- libgomp=14.2.0=h767d61c_2
- liblzma=5.6.4=hb9d3cd8_0
- libnsl=2.0.1=hd590300_0
- libsqlite=3.49.1=hee588c1_2
- libstdcxx=14.2.0=h8f9b012_2
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=hb9d3cd8_2
- mccabe=0.7.0=pyhd8ed1ab_1
- ncurses=6.5=h2d0b736_3
- openssl=3.4.1=h7b32b05_0
- packaging=24.2=pyhd8ed1ab_2
- pep8=1.7.1=py_0
- pip=25.0.1=pyh8b19718_0
- pluggy=1.5.0=pyhd8ed1ab_1
- pycodestyle=2.12.1=pyhd8ed1ab_1
- pycparser=2.22=pyh29332c3_1
- pyflakes=3.2.0=pyhd8ed1ab_1
- pysocks=1.7.1=pyha55dd90_7
- pytest=8.3.5=pyhd8ed1ab_0
- pytest-cov=6.0.0=pyhd8ed1ab_1
- python=3.9.21=h9c0c6dc_1_cpython
- python-dateutil=2.9.0.post0=pyhff2d567_1
- python_abi=3.9=5_cp39
- pyyaml=6.0.2=py39h9399b63_2
- readline=8.2=h8c095d6_2
- requests=2.32.3=pyhd8ed1ab_1
- responses=0.25.7=pyhd8ed1ab_0
- setuptools=75.8.2=pyhff2d567_0
- setuptools-scm=8.2.1=pyhd8ed1ab_0
- setuptools_scm=8.2.1=hd8ed1ab_0
- six=1.17.0=pyhd8ed1ab_0
- tk=8.6.13=noxft_h4845f30_101
- toml=0.10.2=pyhd8ed1ab_1
- tomli=2.2.1=pyhd8ed1ab_1
- types-pyyaml=6.0.12.20241230=pyhd8ed1ab_0
- typing-extensions=4.13.0=h9fa5a19_1
- typing_extensions=4.13.0=pyh29332c3_1
- tzdata=2025b=h78e105d_0
- wheel=0.45.1=pyhd8ed1ab_1
- yaml=0.2.5=h7f98852_2
- zstandard=0.23.0=py39h8cd3c5a_1
- pip:
- boto3==1.37.23
- boto3-stubs==1.37.23
- botocore==1.37.23
- botocore-stubs==1.37.23
- hyp3-sdk==0.4.1.dev12+gb8011c9
- jmespath==1.0.1
- mypy-boto3-dynamodb==1.37.12
- mypy-boto3-s3==1.37.0
- s3pypi==2.0.1
- s3transfer==0.11.4
- types-awscrt==0.24.2
- types-s3transfer==0.11.4
- urllib3==1.26.20
prefix: /opt/conda/envs/hyp3-sdk
|
[
"tests/test_jobs.py::test_batch_iter"
] |
[] |
[
"tests/test_jobs.py::test_job_dict_transforms",
"tests/test_jobs.py::test_job_complete_succeeded_failed_running",
"tests/test_jobs.py::test_job_expired",
"tests/test_jobs.py::test_job_download_files",
"tests/test_jobs.py::test_batch_add",
"tests/test_jobs.py::test_batch_len",
"tests/test_jobs.py::test_batch_complete_succeeded",
"tests/test_jobs.py::test_batch_download",
"tests/test_jobs.py::test_batch_any_expired",
"tests/test_jobs.py::test_batch_filter_jobs"
] |
[] |
BSD 3-Clause "New" or "Revised" License
|
swerebench/sweb.eval.x86_64.asfhyp3_1776_hyp3-sdk-71
|
|
ASFHyP3__hyp3-sdk-73
|
1fec8b5ae4c2cf80392cc6e27a52123e72e320e0
|
2021-02-17 01:04:42
|
1fec8b5ae4c2cf80392cc6e27a52123e72e320e0
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71619ef..d83763d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
submit one or more prepared job dictionaries.
- `Job.download_files` and `Batch.download_files` will (optionally) create the
download location if it doesn't exist
+- `Hyp3._get_job_by_id` has been made public and renamed to `Hyp3.get_job_by_id`
## [0.4.0](https://github.com/ASFHyP3/hyp3-sdk/compare/v0.3.3...v0.4.0)
diff --git a/hyp3_sdk/hyp3.py b/hyp3_sdk/hyp3.py
index 060aca6..6c0c8ef 100644
--- a/hyp3_sdk/hyp3.py
+++ b/hyp3_sdk/hyp3.py
@@ -71,12 +71,20 @@ class HyP3:
warnings.warn('Found zero jobs', UserWarning)
return Batch(jobs)
- def _get_job_by_id(self, job_id):
+ def get_job_by_id(self, job_id: str) -> Job:
+ """Get job by job ID
+
+ Args:
+ job_id: A job ID
+
+ Returns:
+ A Job object
+ """
try:
response = self.session.get(urljoin(self.url, f'/jobs/{job_id}'))
response.raise_for_status()
except RequestException:
- raise HyP3Error('Unable to get job by ID')
+ raise HyP3Error(f'Unable to get job by ID {job_id}')
return Job.from_dict(response.json())
@singledispatchmethod
@@ -150,7 +158,7 @@ class HyP3:
@refresh.register
def _refresh_job(self, job: Job):
- return self._get_job_by_id(job.job_id)
+ return self.get_job_by_id(job.job_id)
def submit_prepared_jobs(self, prepared_jobs: Union[dict, List[dict]]) -> Batch:
"""Submit a prepared job dictionary, or list of prepared job dictionaries
|
_get_job_by_id shouldn't be private
https://github.com/ASFHyP3/hyp3-sdk/blob/develop/hyp3_sdk/hyp3.py#L72
Turns out it's pretty useful generally.
|
ASFHyP3/hyp3-sdk
|
diff --git a/tests/test_hyp3.py b/tests/test_hyp3.py
index 743fbac..ced9e4c 100644
--- a/tests/test_hyp3.py
+++ b/tests/test_hyp3.py
@@ -52,7 +52,7 @@ def test_get_job_by_id(get_mock_job):
job = get_mock_job()
api = HyP3()
responses.add(responses.GET, urljoin(api.url, f'/jobs/{job.job_id}'), json=job.to_dict())
- response = api._get_job_by_id(job.job_id)
+ response = api.get_job_by_id(job.job_id)
assert response == job
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": [
"conda-env.yml"
],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "environment.yml",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
boto3==1.37.23
boto3-stubs==1.37.23
botocore==1.37.23
botocore-stubs==1.37.23
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1725267488082/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1725571112467/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1735929714516/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1733218098505/work
coverage @ file:///home/conda/feedstock_root/build_artifacts/coverage_1743381224823/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1733208806608/work
flake8 @ file:///home/conda/feedstock_root/build_artifacts/flake8_1739898391164/work
flake8-blind-except @ file:///home/conda/feedstock_root/build_artifacts/flake8-blind-except_1736103523415/work
flake8-builtins @ file:///home/conda/feedstock_root/build_artifacts/flake8-builtins_1736204556749/work
flake8-import-order @ file:///home/conda/feedstock_root/build_artifacts/flake8-import-order_1735327522577/work
h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1738578511449/work
hpack @ file:///home/conda/feedstock_root/build_artifacts/hpack_1737618293087/work
-e git+https://github.com/ASFHyP3/hyp3-sdk.git@1fec8b5ae4c2cf80392cc6e27a52123e72e320e0#egg=hyp3_sdk
hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1737618333194/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1733211830134/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1733223141826/work
jmespath==1.0.1
mccabe @ file:///home/conda/feedstock_root/build_artifacts/mccabe_1733216466933/work
mypy-boto3-dynamodb==1.37.12
mypy-boto3-s3==1.37.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
pep8==1.7.1
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1733222765875/work
pycodestyle @ file:///home/conda/feedstock_root/build_artifacts/pycodestyle_1733216196861/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_pycparser_1733195786/work
pyflakes @ file:///home/conda/feedstock_root/build_artifacts/pyflakes_1733216066937/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1733217236728/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1740946542080/work
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1733223023082/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1733217035951/work
responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1741755837680/work
s3pypi==2.0.1
s3transfer==0.11.4
setuptools-scm @ file:///home/conda/feedstock_root/build_artifacts/setuptools_scm_1742403392659/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1734091811753/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1733256695513/work
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1735661334605/work
types-awscrt==0.24.2
types-PyYAML @ file:///home/conda/feedstock_root/build_artifacts/types-pyyaml_1735564787326/work
types-s3transfer==0.11.4
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1743201626/work
urllib3==1.26.20
zstandard==0.23.0
|
name: hyp3-sdk
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- brotli-python=1.1.0=py39hf88036b_2
- bzip2=1.0.8=h4bc722e_7
- ca-certificates=2025.1.31=hbcca054_0
- certifi=2025.1.31=pyhd8ed1ab_0
- cffi=1.17.1=py39h15c3d72_0
- charset-normalizer=3.4.1=pyhd8ed1ab_0
- colorama=0.4.6=pyhd8ed1ab_1
- coverage=7.8.0=py39h9399b63_0
- exceptiongroup=1.2.2=pyhd8ed1ab_1
- flake8=7.1.2=pyhd8ed1ab_0
- flake8-blind-except=0.2.1=pyhd8ed1ab_1
- flake8-builtins=2.5.0=pyhd8ed1ab_1
- flake8-import-order=0.18.2=pyhd8ed1ab_1
- h2=4.2.0=pyhd8ed1ab_0
- hpack=4.1.0=pyhd8ed1ab_0
- hyperframe=6.1.0=pyhd8ed1ab_0
- idna=3.10=pyhd8ed1ab_1
- iniconfig=2.0.0=pyhd8ed1ab_1
- ld_impl_linux-64=2.43=h712a8e2_4
- libffi=3.4.6=h2dba641_0
- libgcc=14.2.0=h767d61c_2
- libgcc-ng=14.2.0=h69a702a_2
- libgomp=14.2.0=h767d61c_2
- liblzma=5.6.4=hb9d3cd8_0
- libnsl=2.0.1=hd590300_0
- libsqlite=3.49.1=hee588c1_2
- libstdcxx=14.2.0=h8f9b012_2
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=hb9d3cd8_2
- mccabe=0.7.0=pyhd8ed1ab_1
- ncurses=6.5=h2d0b736_3
- openssl=3.4.1=h7b32b05_0
- packaging=24.2=pyhd8ed1ab_2
- pep8=1.7.1=py_0
- pip=25.0.1=pyh8b19718_0
- pluggy=1.5.0=pyhd8ed1ab_1
- pycodestyle=2.12.1=pyhd8ed1ab_1
- pycparser=2.22=pyh29332c3_1
- pyflakes=3.2.0=pyhd8ed1ab_1
- pysocks=1.7.1=pyha55dd90_7
- pytest=8.3.5=pyhd8ed1ab_0
- pytest-cov=6.0.0=pyhd8ed1ab_1
- python=3.9.21=h9c0c6dc_1_cpython
- python-dateutil=2.9.0.post0=pyhff2d567_1
- python_abi=3.9=5_cp39
- pyyaml=6.0.2=py39h9399b63_2
- readline=8.2=h8c095d6_2
- requests=2.32.3=pyhd8ed1ab_1
- responses=0.25.7=pyhd8ed1ab_0
- setuptools=75.8.2=pyhff2d567_0
- setuptools-scm=8.2.1=pyhd8ed1ab_0
- setuptools_scm=8.2.1=hd8ed1ab_0
- six=1.17.0=pyhd8ed1ab_0
- tk=8.6.13=noxft_h4845f30_101
- toml=0.10.2=pyhd8ed1ab_1
- tomli=2.2.1=pyhd8ed1ab_1
- tqdm=4.67.1=pyhd8ed1ab_1
- types-pyyaml=6.0.12.20241230=pyhd8ed1ab_0
- typing-extensions=4.13.0=h9fa5a19_1
- typing_extensions=4.13.0=pyh29332c3_1
- tzdata=2025b=h78e105d_0
- wheel=0.45.1=pyhd8ed1ab_1
- yaml=0.2.5=h7f98852_2
- zstandard=0.23.0=py39h8cd3c5a_1
- pip:
- boto3==1.37.23
- boto3-stubs==1.37.23
- botocore==1.37.23
- botocore-stubs==1.37.23
- hyp3-sdk==0.4.1.dev35+g1fec8b5
- jmespath==1.0.1
- mypy-boto3-dynamodb==1.37.12
- mypy-boto3-s3==1.37.0
- s3pypi==2.0.1
- s3transfer==0.11.4
- types-awscrt==0.24.2
- types-s3transfer==0.11.4
- urllib3==1.26.20
prefix: /opt/conda/envs/hyp3-sdk
|
[
"tests/test_hyp3.py::test_get_job_by_id"
] |
[] |
[
"tests/test_hyp3.py::test_session_headers",
"tests/test_hyp3.py::test_find_jobs",
"tests/test_hyp3.py::test_watch",
"tests/test_hyp3.py::test_refresh",
"tests/test_hyp3.py::test_submit_prepared_jobs",
"tests/test_hyp3.py::test_prepare_autorift_job",
"tests/test_hyp3.py::test_prepare_rtc_job",
"tests/test_hyp3.py::test_prepare_insar_job",
"tests/test_hyp3.py::test_submit_autorift_job",
"tests/test_hyp3.py::test_submit_rtc_job",
"tests/test_hyp3.py::test_submit_insar_job",
"tests/test_hyp3.py::test_resubmit_previous_job",
"tests/test_hyp3.py::test_my_info",
"tests/test_hyp3.py::test_check_quota"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| null |
|
ASPP__pelita-412
|
002ae9e325b1608a324d02749205cd70b4f6da2b
|
2017-08-29 08:38:58
|
e3fc4b8a42f874925aa619a06d2a16d5b189ba24
|
diff --git a/pelita/player/__init__.py b/pelita/player/__init__.py
index cf429bca..bedaae24 100644
--- a/pelita/player/__init__.py
+++ b/pelita/player/__init__.py
@@ -1,7 +1,7 @@
from .base import AbstractTeam, SimpleTeam, AbstractPlayer
-from .base import (StoppingPlayer, TestPlayer, SpeakingPlayer,
+from .base import (StoppingPlayer, SteppingPlayer, SpeakingPlayer,
RoundBasedPlayer, MoveExceptionPlayer, InitialExceptionPlayer,
DebuggablePlayer)
diff --git a/pelita/player/base.py b/pelita/player/base.py
index f07bba65..0e578f2f 100644
--- a/pelita/player/base.py
+++ b/pelita/player/base.py
@@ -516,7 +516,7 @@ class SpeakingPlayer(AbstractPlayer):
self.say("Going %r." % (move,))
return move
-class TestPlayer(AbstractPlayer):
+class SteppingPlayer(AbstractPlayer):
""" A Player with predetermined set of moves.
Parameters
|
pytest warns about our TestPlayer
WC1 /tmp/group1/test/test_drunk_player.py cannot collect test class 'TestPlayer' because it has a __init__ constructor
Maybe rename it?
|
ASPP/pelita
|
diff --git a/test/test_game_master.py b/test/test_game_master.py
index 2b164441..e943d70b 100644
--- a/test/test_game_master.py
+++ b/test/test_game_master.py
@@ -5,7 +5,7 @@ import collections
from pelita.datamodel import CTFUniverse
from pelita.game_master import GameMaster, ManhattanNoiser, PlayerTimeout
-from pelita.player import AbstractPlayer, SimpleTeam, StoppingPlayer, TestPlayer
+from pelita.player import AbstractPlayer, SimpleTeam, StoppingPlayer, SteppingPlayer
from pelita.viewer import AbstractViewer
@@ -18,8 +18,8 @@ class TestGameMaster:
# . # . .#3#
################## """)
- team_1 = SimpleTeam("team1", TestPlayer([]), TestPlayer([]))
- team_2 = SimpleTeam("team2", TestPlayer([]), TestPlayer([]))
+ team_1 = SimpleTeam("team1", SteppingPlayer([]), SteppingPlayer([]))
+ team_2 = SimpleTeam("team2", SteppingPlayer([]), SteppingPlayer([]))
game_master = GameMaster(test_layout, [team_1, team_2], 4, 200)
assert game_master.game_state["team_name"][0] == ""
@@ -48,8 +48,8 @@ class TestGameMaster:
# . # . .#3#
################## """)
- team_1 = SimpleTeam('team1', TestPlayer([]), TestPlayer([]))
- team_2 = SimpleTeam('team2', TestPlayer([]), TestPlayer([]))
+ team_1 = SimpleTeam('team1', SteppingPlayer([]), SteppingPlayer([]))
+ team_2 = SimpleTeam('team2', SteppingPlayer([]), SteppingPlayer([]))
game_master = GameMaster(test_layout, [team_1, team_2], 4, 200)
game_master.set_initial()
@@ -64,7 +64,7 @@ class TestGameMaster:
#2##### #####1#
# . # . .#3#
################## """)
- team_1 = SimpleTeam(TestPlayer([]), TestPlayer([]))
+ team_1 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
with pytest.raises(ValueError):
GameMaster(test_layout_4, [team_1], 4, 200)
@@ -76,9 +76,9 @@ class TestGameMaster:
# . # . .#3#
################## """)
- team_1 = SimpleTeam(TestPlayer([]), TestPlayer([]))
- team_2 = SimpleTeam(TestPlayer([]), TestPlayer([]))
- team_3 = SimpleTeam(TestPlayer([]), TestPlayer([]))
+ team_1 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
+ team_2 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
+ team_3 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
with pytest.raises(ValueError):
GameMaster(test_layout_4, [team_1, team_2, team_3], 4, 200)
@@ -259,7 +259,7 @@ class TestGame:
return universe
- teams = [SimpleTeam(TestPlayer('>-v>>>')), SimpleTeam(TestPlayer('<<-<<<'))]
+ teams = [SimpleTeam(SteppingPlayer('>-v>>>')), SimpleTeam(SteppingPlayer('<<-<<<'))]
gm = GameMaster(test_start, teams, number_bots, 200)
gm.set_initial()
@@ -317,7 +317,7 @@ class TestGame:
assert create_TestUniverse(test_sixth_round,
black_score=gm.universe.KILLPOINTS, white_score=gm.universe.KILLPOINTS) == gm.universe
- teams = [SimpleTeam(TestPlayer('>-v>>>')), SimpleTeam(TestPlayer('<<-<<<'))]
+ teams = [SimpleTeam(SteppingPlayer('>-v>>>')), SimpleTeam(SteppingPlayer('<<-<<<'))]
# now play the full game
gm = GameMaster(test_start, teams, number_bots, 200)
gm.play()
@@ -380,7 +380,7 @@ class TestGame:
#0 . #
#.. 1#
###### """)
- teams = [SimpleTeam(FailingPlayer()), SimpleTeam(TestPlayer("^"))]
+ teams = [SimpleTeam(FailingPlayer()), SimpleTeam(SteppingPlayer("^"))]
gm = GameMaster(test_layout, teams, 2, 1)
@@ -409,8 +409,8 @@ class TestGame:
number_bots = 2
teams = [
- SimpleTeam(TestPlayer([(0,0)])),
- SimpleTeam(TestPlayer([(0,0)]))
+ SimpleTeam(SteppingPlayer([(0,0)])),
+ SimpleTeam(SteppingPlayer([(0,0)]))
]
gm = GameMaster(test_start, teams, number_bots, 200)
@@ -439,7 +439,7 @@ class TestGame:
NUM_ROUNDS = 2
# bot 1 moves east twice to eat the single food
teams = [
- SimpleTeam(TestPlayer('>>')),
+ SimpleTeam(SteppingPlayer('>>')),
SimpleTeam(StoppingPlayer())
]
gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)
@@ -473,7 +473,7 @@ class TestGame:
teams = [
SimpleTeam(StoppingPlayer()),
- SimpleTeam(TestPlayer('<<')) # bot 1 moves west twice to eat the single food
+ SimpleTeam(SteppingPlayer('<<')) # bot 1 moves west twice to eat the single food
]
gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)
@@ -533,7 +533,7 @@ class TestGame:
)
teams = [
SimpleTeam(StoppingPlayer()),
- SimpleTeam(TestPlayer('<<<'))
+ SimpleTeam(SteppingPlayer('<<<'))
]
# bot 1 eats all the food and the game stops
gm = GameMaster(test_start, teams, 2, 100)
@@ -566,7 +566,7 @@ class TestGame:
)
teams = [
SimpleTeam(StoppingPlayer()),
- SimpleTeam(TestPlayer('<<<'))
+ SimpleTeam(SteppingPlayer('<<<'))
]
# bot 1 eats all the food and the game stops
gm = GameMaster(test_start, teams, 2, 100)
@@ -710,8 +710,8 @@ class TestGame:
teams = [
- SimpleTeam(TestPlayer('>>>>')),
- SimpleTeam(TestPlayer('<<<<'))
+ SimpleTeam(SteppingPlayer('>>>>')),
+ SimpleTeam(SteppingPlayer('<<<<'))
]
gm = GameMaster(test_start, teams, number_bots, 4)
@@ -806,8 +806,8 @@ class TestGame:
# the game lasts two rounds, enough time for bot 1 to eat food
NUM_ROUNDS = 5
teams = [
- SimpleTeam(TestPlayer('>--->')),
- SimpleTeam(TestPlayer('<<<<<')) # bot 1 moves west twice to eat the single food
+ SimpleTeam(SteppingPlayer('>--->')),
+ SimpleTeam(SteppingPlayer('<<<<<')) # bot 1 moves west twice to eat the single food
]
gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)
diff --git a/test/test_player_base.py b/test/test_player_base.py
index 96998f8d..75fdadae 100644
--- a/test/test_player_base.py
+++ b/test/test_player_base.py
@@ -8,7 +8,7 @@ from pelita import datamodel
from pelita.datamodel import CTFUniverse, east, stop, west
from pelita.game_master import GameMaster
from pelita.player import (AbstractPlayer, SimpleTeam,
- RandomPlayer, StoppingPlayer, TestPlayer,
+ RandomPlayer, StoppingPlayer, SteppingPlayer,
RoundBasedPlayer, SpeakingPlayer)
@@ -29,7 +29,7 @@ class TestAbstractPlayer:
################## """)
player_0 = StoppingPlayer()
- player_1 = TestPlayer('^<')
+ player_1 = SteppingPlayer('^<')
player_2 = StoppingPlayer()
player_3 = StoppingPlayer()
teams = [
@@ -277,8 +277,8 @@ class TestAbstractPlayer:
assert set(sim_uni.enemy_food(p1._index)) == {(4, 3), (4, 2)}
-class TestTestPlayer:
- def test_test_players(self):
+class TestSteppingPlayer:
+ def test_stepping_players(self):
test_layout = (
""" ############
#0 . . 1#
@@ -287,8 +287,8 @@ class TestTestPlayer:
movements_0 = [east, east]
movements_1 = [west, west]
teams = [
- SimpleTeam(TestPlayer(movements_0), TestPlayer(movements_0)),
- SimpleTeam(TestPlayer(movements_1), TestPlayer(movements_1))
+ SimpleTeam(SteppingPlayer(movements_0), SteppingPlayer(movements_0)),
+ SimpleTeam(SteppingPlayer(movements_1), SteppingPlayer(movements_1))
]
gm = GameMaster(test_layout, teams, 4, 2)
@@ -311,8 +311,8 @@ class TestTestPlayer:
############ """)
num_rounds = 5
teams = [
- SimpleTeam(TestPlayer('>v<^-)')),
- SimpleTeam(TestPlayer('<^>v-)'))
+ SimpleTeam(SteppingPlayer('>v<^-)')),
+ SimpleTeam(SteppingPlayer('<^>v-)'))
]
gm = GameMaster(test_layout, teams, 2, num_rounds)
player0_expected_positions = [(1,1), (2,1), (2,2), (1,2), (1,1)]
@@ -334,8 +334,8 @@ class TestTestPlayer:
movements_0 = [east, east]
movements_1 = [west, west]
teams = [
- SimpleTeam(TestPlayer(movements_0), TestPlayer(movements_0)),
- SimpleTeam(TestPlayer(movements_1), TestPlayer(movements_1))
+ SimpleTeam(SteppingPlayer(movements_0), SteppingPlayer(movements_0)),
+ SimpleTeam(SteppingPlayer(movements_1), SteppingPlayer(movements_1))
]
gm = GameMaster(test_layout, teams, 4, 3)
@@ -512,19 +512,19 @@ class TestSimpleTeam:
assert team0.team_name == "my team"
assert len(team0._players) == 0
- team1 = SimpleTeam("my team", TestPlayer([]))
+ team1 = SimpleTeam("my team", SteppingPlayer([]))
assert team1.team_name == "my team"
assert len(team1._players) == 1
- team2 = SimpleTeam("my other team", TestPlayer([]), TestPlayer([]))
+ team2 = SimpleTeam("my other team", SteppingPlayer([]), SteppingPlayer([]))
assert team2.team_name == "my other team"
assert len(team2._players) == 2
- team3 = SimpleTeam(TestPlayer([]))
+ team3 = SimpleTeam(SteppingPlayer([]))
assert team3.team_name == ""
assert len(team3._players) == 1
- team4 = SimpleTeam(TestPlayer([]), TestPlayer([]))
+ team4 = SimpleTeam(SteppingPlayer([]), SteppingPlayer([]))
assert team4.team_name == ""
assert len(team4._players) == 2
@@ -535,7 +535,7 @@ class TestSimpleTeam:
###### """
)
dummy_universe = CTFUniverse.create(layout, 4)
- team1 = SimpleTeam(TestPlayer('^'))
+ team1 = SimpleTeam(SteppingPlayer('^'))
with pytest.raises(ValueError):
team1.set_initial(0, dummy_universe, {})
diff --git a/test/test_simplesetup.py b/test/test_simplesetup.py
index 1a1cb830..fafe8c43 100644
--- a/test/test_simplesetup.py
+++ b/test/test_simplesetup.py
@@ -5,7 +5,7 @@ import uuid
import zmq
import pelita
-from pelita.player import AbstractPlayer, SimpleTeam, TestPlayer
+from pelita.player import AbstractPlayer, SimpleTeam, SteppingPlayer
from pelita.simplesetup import SimpleClient, SimpleServer, bind_socket, extract_port_range
from pelita.player import RandomPlayer
@@ -61,8 +61,8 @@ class TestSimpleSetup:
client1_address = server.bind_addresses[0].replace("*", "localhost")
client2_address = server.bind_addresses[1].replace("*", "localhost")
- client1 = SimpleClient(SimpleTeam("team1", TestPlayer("^>>v<")), address=client1_address)
- client2 = SimpleClient(SimpleTeam("team2", TestPlayer("^<<v>")), address=client2_address)
+ client1 = SimpleClient(SimpleTeam("team1", SteppingPlayer("^>>v<")), address=client1_address)
+ client2 = SimpleClient(SimpleTeam("team2", SteppingPlayer("^<<v>")), address=client2_address)
client1.autoplay_process()
client2.autoplay_process()
@@ -92,7 +92,7 @@ class TestSimpleSetup:
def _get_move(self, universe, game_state):
pass
- client1 = SimpleClient(SimpleTeam("team1", TestPlayer("^>>v<")), address=client1_address)
+ client1 = SimpleClient(SimpleTeam("team1", SteppingPlayer("^>>v<")), address=client1_address)
client2 = SimpleClient(SimpleTeam("team2", FailingPlayer()), address=client2_address)
client1.autoplay_process()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
importlib-metadata==4.8.3
iniconfig==1.1.1
numpy==1.19.5
packaging==21.3
-e git+https://github.com/ASPP/pelita.git@002ae9e325b1608a324d02749205cd70b4f6da2b#egg=pelita
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
PyYAML==6.0.1
pyzmq==25.1.2
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- numpy==1.19.5
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pyyaml==6.0.1
- pyzmq==25.1.2
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/pelita
|
[
"test/test_game_master.py::TestGameMaster::test_team_names",
"test/test_game_master.py::TestGameMaster::test_team_names_in_simpleteam",
"test/test_game_master.py::TestGameMaster::test_too_few_registered_teams",
"test/test_game_master.py::TestGameMaster::test_too_many_registered_teams",
"test/test_game_master.py::TestUniverseNoiser::test_uniform_noise_manhattan",
"test/test_game_master.py::TestUniverseNoiser::test_uniform_noise_4_bots_manhattan",
"test/test_game_master.py::TestUniverseNoiser::test_uniform_noise_4_bots_no_noise_manhattan",
"test/test_game_master.py::TestUniverseNoiser::test_noise_manhattan_failure",
"test/test_game_master.py::TestAbstracts::test_AbstractViewer",
"test/test_game_master.py::TestAbstracts::test_BrokenViewer",
"test/test_game_master.py::TestGame::test_game",
"test/test_game_master.py::TestGame::test_malicous_player",
"test/test_game_master.py::TestGame::test_failing_player",
"test/test_game_master.py::TestGame::test_viewer_may_change_gm",
"test/test_game_master.py::TestGame::test_win_on_timeout_team_0",
"test/test_game_master.py::TestGame::test_win_on_timeout_team_1",
"test/test_game_master.py::TestGame::test_draw_on_timeout",
"test/test_game_master.py::TestGame::test_win_on_eating_all",
"test/test_game_master.py::TestGame::test_lose_on_eating_all",
"test/test_game_master.py::TestGame::test_lose_5_timeouts",
"test/test_game_master.py::TestGame::test_must_not_move_after_last_timeout",
"test/test_game_master.py::TestGame::test_play_step",
"test/test_game_master.py::TestGame::test_kill_count",
"test/test_player_base.py::TestAbstractPlayer::test_convenience",
"test/test_player_base.py::TestAbstractPlayer::test_time_spent",
"test/test_player_base.py::TestAbstractPlayer::test_rnd",
"test/test_player_base.py::TestAbstractPlayer::test_simulate_move",
"test/test_player_base.py::TestSteppingPlayer::test_stepping_players",
"test/test_player_base.py::TestSteppingPlayer::test_shorthand",
"test/test_player_base.py::TestSteppingPlayer::test_too_many_moves",
"test/test_player_base.py::TestRoundBasedPlayer::test_round_based_players",
"test/test_player_base.py::TestRandomPlayerSeeds::test_demo_players",
"test/test_player_base.py::TestRandomPlayerSeeds::test_random_seeds",
"test/test_player_base.py::TestSpeakingPlayer::test_demo_players",
"test/test_player_base.py::TestSimpleTeam::test_player_api_methods",
"test/test_player_base.py::TestSimpleTeam::test_init",
"test/test_player_base.py::TestSimpleTeam::test_too_few_players",
"test/test_player_base.py::TestAbstracts::test_AbstractPlayer",
"test/test_player_base.py::TestAbstracts::test_BrokenPlayer",
"test/test_simplesetup.py::TestSimpleSetup::test_bind_socket",
"test/test_simplesetup.py::TestSimpleSetup::test_simple_game",
"test/test_simplesetup.py::TestSimpleSetup::test_simple_remote_game",
"test/test_simplesetup.py::TestSimpleSetup::test_simple_failing_bots",
"test/test_simplesetup.py::TestSimpleSetup::test_failing_bots_do_not_crash_server_in_set_initial",
"test/test_simplesetup.py::TestSimpleSetup::test_failing_bots_do_not_crash_server",
"test/test_simplesetup.py::TestSimpleSetup::test_extract_port_range"
] |
[] |
[] |
[] |
BSD License
| null |
|
ASPP__pelita-619
|
8c4b83c5fcfd1b748af5cfe8b0b09e93ab5a6406
|
2019-07-22 15:14:21
|
c94d1b0f26600f5982c95b095666fbddea993787
|
diff --git a/pelita/layout.py b/pelita/layout.py
index 1ad10138..6fde0227 100644
--- a/pelita/layout.py
+++ b/pelita/layout.py
@@ -9,12 +9,6 @@ except SyntaxError as err:
print("Invalid syntax in __layouts module. Pelita will not be able to use built-in layouts.")
print(err)
-class Layout:
- pass
-
-class LayoutEncodingException(Exception):
- """ Signifies a problem with the encoding of a layout. """
- pass
def get_random_layout(filter=''):
""" Return a random layout string from the available ones.
@@ -98,7 +92,7 @@ def get_layout_by_name(layout_name):
# thus reraise as ValueError with appropriate error message.
raise ValueError("Layout: '%s' is not known." % ke.args)
-def parse_layout(layout_str):
+def parse_layout(layout_str, allow_enemy_chars=False):
"""Parse a layout string
Return a dict
@@ -130,8 +124,19 @@ def parse_layout(layout_str):
# . 3#
########
- In this case, bot '0' and bot '2' are on top of each other at position (1,1)
- """
+ In this case, bot '0' and bot '2' are on top of each other at position (1,1)
+
+ If `allow_enemy_chars` is True, we additionally allow for the definition of
+ at most 2 enemy characters with the letter "E". The returned dict will then
+ additionally contain an entry "enemy" which contains these coordinates.
+ If only one enemy character is given, both will be assumed sitting on the
+ same spot. """
+
+ if allow_enemy_chars:
+ num_bots = 2
+ else:
+ num_bots = 4
+
layout_list = []
start = False
for i, line in enumerate(layout_str.splitlines()):
@@ -160,24 +165,68 @@ def parse_layout(layout_str):
# the last layout has not been closed, complain here!
raise ValueError(f"Layout does not end with a row of walls (line: {i})!")
- # initialize walls, food and bots from the first layout
- out = parse_single_layout(layout_list.pop(0))
+ # set empty default values
+ walls = []
+ food = []
+ bots = [None] * num_bots
+ if allow_enemy_chars:
+ enemy = []
+
+ # iterate through all layouts
for layout in layout_list:
- items = parse_layout(layout)
+ items = parse_single_layout(layout, num_bots=num_bots, allow_enemy_chars=allow_enemy_chars)
+ # initialize walls from the first layout
+ if not walls:
+ walls = items['walls']
+
# walls should always be the same
- if items['walls'] != out['walls']:
+ if items['walls'] != walls:
raise ValueError('Walls are not equal in all layouts!')
+
# add the food, removing duplicates
- out['food'] = list(set(out['food'] + items['food']))
+ food = list(set(food + items['food']))
+
+ # add the enemy, removing duplicates
+ if allow_enemy_chars:
+ enemy = list(set(enemy + items['enemy']))
+
# add the bots
for bot_idx, bot_pos in enumerate(items['bots']):
if bot_pos:
- # this bot position is not None, overwrite whatever we had before
- out['bots'][bot_idx] = bot_pos
+ # this bot position is not None, overwrite whatever we had before, unless
+ # it already holds a different coordinate
+ if bots[bot_idx] and bots[bot_idx] != bot_pos:
+ raise ValueError(f"Cannot set bot {bot_idx} to position {bot_pos} (already at {bots[bot_idx]}).")
+ bots[bot_idx] = bot_pos
+
+ if allow_enemy_chars:
+ # validate that we have at most two enemies
+ if len(enemy) > 2:
+ raise ValueError(f"More than two enemies defined: {enemy}!")
+ elif len(enemy) == 2:
+ # do nothing
+ pass
+ elif len(enemy) == 1:
+ # we use the position for both enemies
+ enemy = [enemy[0], enemy[0]]
+ else:
+ enemy = [None, None]
+
+ # build parsed layout, ensuring walls and food are sorted
+ out = {
+ 'walls': sorted(walls),
+ 'food': sorted(food),
+ 'bots': bots
+ }
+
+ if allow_enemy_chars:
+ # sort the enemy characters
+ # be careful, since it may contain None
+ out['enemy'] = sorted(enemy, key=lambda x: () if x is None else x)
return out
-def parse_single_layout(layout_str):
+def parse_single_layout(layout_str, num_bots=4, allow_enemy_chars=False):
"""Parse a single layout from a string
See parse_layout for details about valid layout strings.
@@ -228,8 +277,10 @@ def parse_single_layout(layout_str):
height = len(rows)
walls = []
food = []
- # bot positions (we assume 4 bots)
- bots = [None]*4
+ # bot positions
+ bots = [None] * num_bots
+ # enemy positions (only used for team-style layouts)
+ enemy = []
# iterate through the grid of characters
for y, row in enumerate(rows):
@@ -245,22 +296,37 @@ def parse_single_layout(layout_str):
elif char == ' ':
# empty
continue
+ elif char == 'E':
+ # enemy
+ if allow_enemy_chars:
+ enemy.append(coord)
+ else:
+ raise ValueError(f"Enemy character not allowed.")
else:
# bot
try:
- # we expect an 0<=index<=3
+ # we expect an 0<=index<=num_bots
bot_idx = int(char)
if bot_idx >= len(bots):
# reuse the except below
raise ValueError
except ValueError:
raise ValueError(f"Unknown character {char} in maze!")
+
+ # bot_idx is a valid character.
+ if bots[bot_idx]:
+ # bot_idx has already been set before
+ raise ValueError(f"Cannot set bot {bot_idx} to position {coord} (already at {bots[bot_idx]}).")
bots[bot_idx] = coord
walls.sort()
food.sort()
- return {'walls':walls, 'food':food, 'bots':bots}
+ out = {'walls':walls, 'food':food, 'bots':bots}
+ if allow_enemy_chars:
+ enemy.sort()
+ out['enemy'] = enemy
+ return out
-def layout_as_str(*, walls, food=None, bots=None):
+def layout_as_str(*, walls, food=None, bots=None, enemy=None):
"""Given walls, food and bots return a string layout representation
Returns a combined layout string.
@@ -279,21 +345,27 @@ def layout_as_str(*, walls, food=None, bots=None):
width = max(walls)[0] + 1
height = max(walls)[1] + 1
+ # enemy is optional
+ if enemy is None:
+ enemy = []
# flag to check if we have overlapping objects
# when need_combined is True, we force the printing of a combined layout
# string:
# - the first layout will have walls and food
- # - subsequent layouts will have walls and bots
+ # - subsequent layouts will have walls and bots (and enemies, if given)
# You'll get as many layouts as you have overlapping bots
need_combined = False
+ # combine bots an enemy lists
+ bots_and_enemy = bots + enemy if enemy else bots
+
# first, check if we have overlapping bots
- if len(set(bots)) != len(bots):
+ if len(set(bots_and_enemy)) != len(bots_and_enemy):
need_combined = True
else:
- need_combined = any(coord in food for coord in bots)
+ need_combined = any(coord in food for coord in bots_and_enemy)
# then, check that bots are not overlapping with food
out = io.StringIO()
@@ -311,6 +383,8 @@ def layout_as_str(*, walls, food=None, bots=None):
# we won't need a combined layout later
if (x, y) in bots:
out.write(str(bots.index((x, y))))
+ elif (x, y) in enemy:
+ out.write("E")
else:
out.write(' ')
else:
@@ -333,6 +407,14 @@ def layout_as_str(*, walls, food=None, bots=None):
# if still no bot was seen here we have to start with an empty list
coord_bots[pos] = coord_bots.get(pos, []) + [str(idx)]
+ # add enemies to mapping
+ for pos in enemy:
+ if pos is None:
+ # if an enemy coordinate is None
+ # don't put the enemy in the layout
+ continue
+ coord_bots[pos] = coord_bots.get(pos, []) + ["E"]
+
# loop through the bot coordinates
while coord_bots:
for y in range(height):
@@ -358,6 +440,28 @@ def layout_as_str(*, walls, food=None, bots=None):
return out.getvalue()
+def layout_for_team(layout, is_blue=True):
+ """ Converts a layout dict with 4 bots to a layout
+ from the view of the specified team.
+ """
+ if "enemy" in layout:
+ raise ValueError("Layout is already in team-style.")
+
+ if is_blue:
+ bots = layout['bots'][0::2]
+ enemy = layout['bots'][1::2]
+ else:
+ bots = layout['bots'][1::2]
+ enemy = layout['bots'][0::2]
+
+ return {
+ 'walls': layout['walls'][:],
+ 'food': layout['food'][:],
+ 'bots': bots,
+ 'enemy': enemy,
+ }
+
+
def wall_dimensions(walls):
""" Given a list of walls, returns a tuple of (width, height)."""
width = max(walls)[0] + 1
diff --git a/pelita/player/team.py b/pelita/player/team.py
index 58b3efe6..a6a41f58 100644
--- a/pelita/player/team.py
+++ b/pelita/player/team.py
@@ -1,20 +1,20 @@
import collections
-from functools import reduce
-from io import StringIO
import logging
import os
-from pathlib import Path
import random
import subprocess
import traceback
+from functools import reduce
+from io import StringIO
+from pathlib import Path
import zmq
-from .. import libpelita, layout
+from .. import layout, libpelita
from ..exceptions import PlayerDisconnected, PlayerTimeout
-from ..network import ZMQConnection, ZMQClientError, ZMQReplyTimeout, ZMQUnreachablePeer
-
+from ..layout import layout_as_str, parse_layout, wall_dimensions
+from ..network import ZMQClientError, ZMQConnection, ZMQReplyTimeout, ZMQUnreachablePeer
_logger = logging.getLogger(__name__)
@@ -599,10 +599,10 @@ class Bot:
with StringIO() as out:
out.write(header)
- layout = Layout(walls=bot.walls[:],
- food=bot.food + bot.enemy[0].food,
- bots=[b.position for b in bot._team],
- enemy=[e.position for e in bot.enemy])
+ layout = layout_as_str(walls=bot.walls[:],
+ food=bot.food + bot.enemy[0].food,
+ bots=[b.position for b in bot._team],
+ enemy=[e.position for e in bot.enemy])
out.write(str(layout))
return out.getvalue()
@@ -669,214 +669,6 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
return team_bots[bot_turn]
-# @dataclass
-class Layout:
- def __init__(self, walls, food, bots, enemy):
- if not food:
- food = []
-
- if not bots:
- bots = [None, None]
-
- if not enemy:
- enemy = [None, None]
-
- # input validation
- for pos in [*food, *bots, *enemy]:
- if pos:
- if len(pos) != 2:
- raise ValueError("Items must be tuples of length 2.")
- if pos in walls:
- raise ValueError("Item at %r placed on walls." % (pos,))
- else:
- walls_width = max(walls)[0] + 1
- walls_height = max(walls)[1] + 1
- if not (0 <= pos[0] < walls_width) or not (0 <= pos[1] < walls_height):
- raise ValueError("Item at %r not in bounds." % (pos,))
-
-
- if len(bots) > 2:
- raise ValueError("Too many bots given.")
-
- self.walls = sorted(walls)
- self.food = sorted(food)
- self.bots = bots
- self.enemy = enemy
- self.initial_positions = self.guess_initial_positions(self.walls)
-
- def guess_initial_positions(self, walls):
- """ Returns the free positions that are closest to the bottom left and
- top right corner. The algorithm starts searching from (1, -2) and (-2, 1)
- respectively and uses the manhattan distance for judging what is closest.
- On equal distances, a smaller distance in the x value is preferred.
- """
- walls_width = max(walls)[0] + 1
- walls_height = max(walls)[1] + 1
-
- left_start = (1, walls_height - 2)
- left_initials = []
- right_start = (walls_width - 2, 1)
- right_initials = []
-
- dist = 0
- while len(left_initials) < 2:
- # iterate through all possible x distances (inclusive)
- for x_dist in range(dist + 1):
- y_dist = dist - x_dist
- pos = (left_start[0] + x_dist, left_start[1] - y_dist)
- # if both coordinates are out of bounds, we stop
- if not (0 <= pos[0] < walls_width) and not (0 <= pos[1] < walls_height):
- raise ValueError("Not enough free initial positions.")
- # if one coordinate is out of bounds, we just continue
- if not (0 <= pos[0] < walls_width) or not (0 <= pos[1] < walls_height):
- continue
- # check if the new value is free
- if not pos in walls:
- left_initials.append(pos)
-
- if len(left_initials) == 2:
- break
-
- dist += 1
-
- dist = 0
- while len(right_initials) < 2:
- # iterate through all possible x distances (inclusive)
- for x_dist in range(dist + 1):
- y_dist = dist - x_dist
- pos = (right_start[0] - x_dist, right_start[1] + y_dist)
- # if both coordinates are out of bounds, we stop
- if not (0 <= pos[0] < walls_width) and not (0 <= pos[1] < walls_height):
- raise ValueError("Not enough free initial positions.")
- # if one coordinate is out of bounds, we just continue
- if not (0 <= pos[0] < walls_width) or not (0 <= pos[1] < walls_height):
- continue
- # check if the new value is free
- if not pos in walls:
- right_initials.append(pos)
-
- if len(right_initials) == 2:
- break
-
- dist += 1
-
- # lower indices start further away
- left_initials.reverse()
- right_initials.reverse()
- return left_initials, right_initials
-
- def merge(self, other):
- """ Merges `self` with the `other` layout.
- """
-
- if not self.walls:
- self.walls = other.walls
- if self.walls != other.walls:
- raise ValueError("Walls are not equal.")
-
- self.food += other.food
- # remove duplicates
- self.food = list(set(self.food))
-
- # update all newer bot positions
- for idx, b in enumerate(other.bots):
- if b:
- self.bots[idx] = b
-
- # merge all enemies and then take the last 2
- enemies = [e for e in [*self.enemy, *other.enemy] if e is not None]
- self.enemy = enemies[-2:]
- # if self.enemy smaller than 2, we pad with None again
- for _ in range(2 - len(self.enemy)):
- self.enemy.append(None)
-
- # return our merged self
- return self
-
- def _repr_html_(self):
- walls = self.walls
- walls_width = max(walls)[0] + 1
- walls_height = max(walls)[1] + 1
- with StringIO() as out:
- out.write("<table>")
- for y in range(walls_height):
- out.write("<tr>")
- for x in range(walls_width):
- if (x, y) in walls:
- bg = 'style="background-color: {}"'.format(
- "rgb(94, 158, 217)" if x < walls_width // 2 else
- "rgb(235, 90, 90)")
- elif (x, y) in self.initial_positions[0]:
- bg = 'style="background-color: #ffffcc"'
- elif (x, y) in self.initial_positions[1]:
- bg = 'style="background-color: #ffffcc"'
- else:
- bg = ""
- out.write("<td %s>" % bg)
- if (x, y) in walls: out.write("#")
- if (x, y) in self.food: out.write('<span style="color: rgb(247, 150, 213)">●</span>')
- for idx, pos in enumerate(self.bots):
- if pos == (x, y):
- out.write(str(idx))
- for pos in self.enemy:
- if pos == (x, y):
- out.write('E')
- out.write("</td>")
- out.write("</tr>")
- out.write("</table>")
- return out.getvalue()
-
- def __str__(self):
- walls = self.walls
- walls_width = max(walls)[0] + 1
- walls_height = max(walls)[1] + 1
- with StringIO() as out:
- out.write('\n')
- # first, print walls and food
- for y in range(walls_height):
- for x in range(walls_width):
- if (x, y) in walls: out.write('#')
- elif (x, y) in self.food: out.write('.')
- else: out.write(' ')
- out.write('\n')
- out.write('\n')
- # print walls and bots
-
- # Do we have bots/enemies sitting on each other?
-
- # assign bots to their positions
- bots = {}
- for pos in self.enemy:
- bots[pos] = bots.get(pos, []) + ['E']
- for idx, pos in enumerate(self.bots):
- bots[pos] = bots.get(pos, []) + [str(idx)]
- # strip all None positions from bots
- try:
- bots.pop(None)
- except KeyError:
- pass
-
- while bots:
- for y in range(walls_height):
- for x in range(walls_width):
- if (x, y) in walls: out.write('#')
- elif (x, y) in bots:
- elem = bots[(x, y)].pop(0)
- out.write(elem)
- # cleanup
- if len(bots[(x, y)]) == 0:
- bots.pop((x, y))
-
- else: out.write(' ')
- out.write('\n')
- out.write('\n')
- return out.getvalue()
-
- def __eq__(self, other):
- return ((self.walls, self.food, self.bots, self.enemy, self.initial_positions) ==
- (other.walls, other.food, other.bots, self.enemy, other.initial_positions))
-
-
def create_layout(*layout_strings, food=None, bots=None, enemy=None):
""" Create a layout from layout strings with additional food, bots and enemy positions.
@@ -887,106 +679,42 @@ def create_layout(*layout_strings, food=None, bots=None, enemy=None):
======
ValueError
If walls are not equal in all layouts
+ If enemy argument is not a list of two
"""
- # layout_strings can be a list of strings or one huge string
- # with many layouts after another
- layouts = [
- load_layout(layout)
- for layout_str in layout_strings
- for layout in split_layout_str(layout_str)
- ]
- merged = reduce(lambda x, y: x.merge(y), layouts)
- additional_layout = Layout(walls=merged.walls, food=food, bots=bots, enemy=enemy)
- merged.merge(additional_layout)
- return merged
-
-def split_layout_str(layout_str):
- """ Turns a layout string containing many layouts into a list
- of simple layouts.
- """
- out = []
- current_layout = []
- for row in layout_str.splitlines():
- stripped = row.strip()
- if not stripped:
- # found an empty line
- # if we have a current_layout, append it to out
- # and reset it
- if current_layout:
- out.append(current_layout)
- current_layout = []
- continue
- # non-empty line: append to current_layout
- current_layout.append(row)
-
- # We still have a current layout at the end: append
- if current_layout:
- out.append(current_layout)
-
- return ['\n'.join(l) for l in out]
-
-def load_layout(layout_str):
- """ Loads a *single* (partial) layout from a string. """
- build = []
- width = None
- height = None
-
- food = []
- bots = [None, None]
- enemy = []
-
- for row in layout_str.splitlines():
- stripped = row.strip()
- if not stripped:
- continue
- if width is not None:
- if len(stripped) != width:
- raise ValueError("Layout has differing widths.")
- width = len(stripped)
- build.append(stripped)
-
- height = len(build)
- data=list("".join(build))
- def idx_to_coord(idx):
- """ Maps a 1-D index to a 2-D coord given a width and height. """
- return (idx % width, idx // width)
-
- # Check that the layout is surrounded with walls
- for idx, char in enumerate(data):
- x, y = idx_to_coord(idx)
- if x == 0 or x == width - 1:
- if not char == '#':
- raise ValueError(f"Layout not surrounded with # at ({x}, {y}).")
- if y == 0 or y == height - 1:
- if not char == '#':
- raise ValueError(f"Layout not surrounded with # at ({x}, {y}).")
-
- walls = []
- # extract the non-wall values from mesh
- for idx, char in enumerate(data):
- coord = idx_to_coord(idx)
- # We know that each char is only one character, so it is
- # either wall or something else
- if '#' in char:
- walls.append(coord)
- # free: skip
- elif ' ' in char:
- continue
- # food
- elif '.' in char:
- food.append(coord)
- # other
- else:
- if 'E' in char:
- # We can have several undefined enemies
- enemy.append(coord)
- elif '0' in char:
- bots[0] = coord
- elif '1' in char:
- bots[1] = coord
- else:
- raise ValueError("Unknown character %s in maze." % char)
+ layout_str = "\n\n".join(layout_strings)
+ parsed_layout = parse_layout(layout_str, allow_enemy_chars=True)
+
+ width, height = wall_dimensions(parsed_layout['walls'])
- walls = sorted(walls)
- return Layout(walls, food, bots, enemy)
+ def _check_valid_pos(pos, item):
+ if pos in parsed_layout['walls']:
+ raise ValueError(f"{item} must not be on wall (given: {pos})!")
+ if not ((0 <= pos[0] < width) and (0 <= pos[1] < height)):
+ raise ValueError(f"{item} is outside of maze (given: {pos} but dimensions are {width}x{height})!")
+
+ # if additional food was supplied, we add it
+ if food:
+ for f in food:
+ _check_valid_pos(f, "food")
+ parsed_layout['food'] = sorted(list(set(food + parsed_layout['food'])))
+
+ # override bots if given and not None
+ if bots is not None:
+ if len(bots) > 2:
+ raise ValueError(f"bots must not be more than 2 ({bots})!")
+ for idx, pos in enumerate(bots):
+ if pos is not None:
+ _check_valid_pos(pos, "bot")
+ parsed_layout['bots'][idx] = pos
+
+ # override enemies if given
+ if enemy is not None:
+ if not len(enemy) == 2:
+ raise ValueError(f"enemy must be a list of 2 ({enemy})!")
+ for idx, e in enumerate(enemy):
+ if e is not None:
+ _check_valid_pos(e, "enemy")
+ parsed_layout['enemy'][idx] = e
+
+ return parsed_layout
diff --git a/pelita/utils/__init__.py b/pelita/utils/__init__.py
index 4d63bbe4..c2172229 100644
--- a/pelita/utils/__init__.py
+++ b/pelita/utils/__init__.py
@@ -3,11 +3,10 @@ import random
from ..player.team import create_layout, make_bots
from ..graph import Graph
-def split_food(layout):
- width = max(layout.walls)[0] + 1
+def split_food(width, food):
team_food = [set(), set()]
- for pos in layout.food:
+ for pos in food:
idx = pos[0] // (width // 2)
team_food[idx].add(pos)
return team_food
@@ -26,7 +25,9 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
score = [0, 0]
layout = create_layout(layout, food=food, bots=bots, enemy=enemy)
- food = split_food(layout)
+ width = max(layout['walls'])[0] + 1
+
+ food = split_food(width, layout['food'])
if is_blue:
team_index = 0
@@ -38,7 +39,7 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
rng = random.Random(seed)
team = {
- 'bot_positions': layout.bots[:],
+ 'bot_positions': layout['bots'][:],
'team_index': team_index,
'score': score[team_index],
'kills': [0]*2,
@@ -49,7 +50,7 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
'name': "blue" if is_blue else "red"
}
enemy = {
- 'bot_positions': layout.enemy[:],
+ 'bot_positions': layout['enemy'][:],
'team_index': enemy_index,
'score': score[enemy_index],
'kills': [0]*2,
@@ -57,11 +58,11 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
'bot_eaten': [False]*2,
'error_count': 0,
'food': food[enemy_index],
- 'is_noisy': [False] * len(layout.enemy),
+ 'is_noisy': [False] * len(layout['enemy']),
'name': "red" if is_blue else "blue"
}
- bot = make_bots(walls=layout.walls[:],
+ bot = make_bots(walls=layout['walls'][:],
team=team,
enemy=enemy,
round=round,
|
parse_layout should fail when a bot is defined on different coordinates
from pelita.layout import parse_layout
layout = """
######
#000.#
#.111#
###### """
print(parse_layout(layout)['bots'])
[(3, 1), (4, 2), None, None]
should raise `ValueError`
|
ASPP/pelita
|
diff --git a/test/test_layout.py b/test/test_layout.py
index dfca69dd..e8c7d4b7 100644
--- a/test/test_layout.py
+++ b/test/test_layout.py
@@ -138,6 +138,41 @@ def test_combined_layouts_empty_lines():
from_single = parse_single_layout(layouts)
assert from_combined == from_single
+def test_duplicate_bots_forbidden():
+ layouts = """
+ ####
+ #11#
+ ####
+ """
+ with pytest.raises(ValueError):
+ parse_layout(layouts)
+
+def test_duplicate_bots_forbidden_multiple():
+ layouts = """
+ ####
+ # 1#
+ ####
+
+ ####
+ #1 #
+ ####
+ """
+ with pytest.raises(ValueError):
+ parse_layout(layouts)
+
+def test_duplicate_bots_allowed():
+ layouts = """
+ ####
+ # 1#
+ ####
+
+ ####
+ # 1#
+ ####
+ """
+ parsed_layout = parse_layout(layouts)
+ assert parsed_layout['bots'][1] == (2, 1)
+
def test_combined_layouts_broken_lines():
layouts = """
####
@@ -291,3 +326,113 @@ def test_legal_positions_fail(pos):
parsed = parse_layout(test_layout)
with pytest.raises(ValueError):
get_legal_positions(parsed['walls'], pos)
+
+def test_enemy_raises():
+ layouts = """
+ ####
+ #E1#
+ ####
+
+ ####
+ #1 #
+ ####
+ """
+ with pytest.raises(ValueError):
+ parse_layout(layouts)
+
[email protected]('layout,enemy_pos', [
+ ("""
+ ####
+ #E #
+ ####
+ """, [(1, 1), (1, 1)]), # one enemy sets both coordinates
+ ("""
+ ####
+ #EE#
+ ####
+ """, [(1, 1), (2, 1)]), # two enemies
+ ("""
+ ####
+ #E #
+ ####
+ ####
+ #E #
+ ####
+ """, [(1, 1), (1, 1)]), # two enemies two layouts on the same spot
+ ("""
+ ####
+ #E #
+ ####
+ ####
+ # E#
+ ####
+ """, [(1, 1), (2, 1)]), # two enemies in two layouts
+ ("""
+ ####
+ # E#
+ ####
+ ####
+ #E #
+ ####
+ """, [(1, 1), (2, 1)]), # two enemies in two layouts (list is sorted)
+ ("""
+ ####
+ # E#
+ ####
+ ####
+ #EE#
+ ####
+ """, [(1, 1), (2, 1)]), # two enemies in two layouts with duplication
+ ("""
+ #######
+ #E E E#
+ #######
+ """, None), # this will raise ValueError
+ ("""
+ ####
+ # #
+ ####
+ """, [None, None]), # this will set both to None
+])
+def test_enemy_positions(layout, enemy_pos):
+ if enemy_pos is None:
+ with pytest.raises(ValueError):
+ parse_layout(layout, allow_enemy_chars=True)
+ else:
+ assert parse_layout(layout, allow_enemy_chars=True)['enemy'] == enemy_pos
+
+def test_layout_for_team():
+ # test that we can convert a layout to team-style
+ l1 = """
+ ####
+ #01#
+ #32#
+ #..#
+ ####
+ """
+ blue1 = layout_as_str(**layout_for_team(parse_layout(l1), is_blue=True))
+ red1 = layout_as_str(**layout_for_team(parse_layout(l1), is_blue=False))
+
+ assert blue1 == """\
+####
+#0E#
+#E1#
+#..#
+####
+"""
+
+ assert red1 == """\
+####
+#E0#
+#1E#
+#..#
+####
+"""
+
+
+ # cannot convert layout that is already in team-style
+ with pytest.raises(ValueError):
+ layout_for_team(parse_layout(blue1))
+
+ with pytest.raises(ValueError):
+ layout_for_team(parse_layout(red1))
diff --git a/test/test_team.py b/test/test_team.py
index ada43a44..6b9cd97f 100644
--- a/test/test_team.py
+++ b/test/test_team.py
@@ -1,8 +1,8 @@
import pytest
-from pelita.layout import parse_layout, get_random_layout, initial_positions
+from pelita.layout import parse_layout, get_random_layout, initial_positions, layout_as_str
from pelita.game import run_game, setup_game, play_turn
-from pelita.player.team import Team, split_layout_str, create_layout
+from pelita.player.team import Team, create_layout
from pelita.utils import setup_test_game
def stopping(bot, state):
@@ -12,166 +12,154 @@ def randomBot(bot, state):
legal = bot.legal_positions[:]
return bot.random.choice(legal), state
-class TestLayout:
- layout="""
- ########
- # ###E0#
- #1E #
- ########
- """
- layout2="""
- ########
- # ### #
- # . ...#
- ########
- """
-
- def test_split_layout(self):
- layout = split_layout_str(self.layout)
- assert len(layout) == 1
- assert layout[0].strip() != ""
-
- mini = """####
- # #
- ####"""
- layout = split_layout_str(mini)
- assert len(layout) == 1
- assert layout[0].strip() != ""
-
- def test_load(self):
- layout = create_layout(self.layout, self.layout2)
- assert layout.bots == [(6, 1), (1, 2)]
- assert layout.enemy == [(5, 1), (2, 2)]
-
- def test_concat(self):
- layout = create_layout(self.layout + self.layout2)
- assert layout.bots == [(6, 1), (1, 2)]
- assert layout.enemy == [(5, 1), (2, 2)]
-
- def test_load1(self):
- layout = create_layout(self.layout)
- assert layout.bots == [(6, 1), (1, 2)]
- assert layout.enemy == [(5, 1), (2, 2)]
-
- def test_equal_positions(self):
- layout_str = """
- ########
- #0### #
- # . ...#
- ########
-
- ########
- #1### #
- # . ...#
- ########
-
- ########
- #E### #
- # . ...#
- ########
-
- ########
- #E### #
- # . ...#
- ########
- """
- layout = create_layout(layout_str)
- assert layout.bots == [(1, 1), (1, 1)]
- assert layout.enemy == [(1, 1), (1, 1)]
- setup_test_game(layout=layout_str)
-
- def test_define_after(self):
- layout = create_layout(self.layout, food=[(1, 1)], bots=[None, None], enemy=None)
- assert layout.bots == [(6, 1), (1, 2)]
- assert layout.enemy == [(5, 1), (2, 2)]
- layout = create_layout(self.layout, food=[(1, 1)], bots=[None, (1, 2)], enemy=None)
- assert layout.bots == [(6, 1), (1, 2)]
- assert layout.enemy == [(5, 1), (2, 2)]
-
- layout = create_layout(self.layout, food=[(1, 1)], bots=[None, (1, 2)], enemy=[(5, 1)])
- assert layout.enemy == [(2, 2), (5, 1)]
-
- layout = create_layout(self.layout2, food=[(1, 1)], bots=[None, (1, 2)], enemy=[(5, 1), (2, 2)])
- assert layout.bots == [None, (1, 2)]
- assert layout.enemy == [(5, 1), (2, 2)]
-
- with pytest.raises(ValueError):
- # placed bot on walls
- layout = create_layout(self.layout2, food=[(1, 1)], bots=[(0, 1), (1, 2)], enemy=[(5, 1), (2, 2)])
-
- with pytest.raises(ValueError):
- # placed bot outside maze
- layout = create_layout(self.layout2, food=[(1, 1)], bots=[(1, 40), (1, 2)], enemy=[(5, 1), (2, 2)])
-
- with pytest.raises(ValueError):
- # too many bots
- layout = create_layout(self.layout2, food=[(1, 1)], bots=[(1, 1), (1, 2), (2, 2)], enemy=[(5, 1), (2, 2)])
-
- def test_repr(self):
- layout = create_layout(self.layout, food=[(1, 1)], bots=[None, None], enemy=None)
- assert layout._repr_html_()
- str1 = str(create_layout(self.layout, food=[(1, 1)], bots=[None, None], enemy=None))
- assert str1 == """
+layout1="""
########
-#.### #
-# #
+# ###E0#
+#1E #
+########
+"""
+layout2="""
########
+# ### #
+# . ...#
+########
+"""
+
+
+def test_load():
+ layout = create_layout(layout1, layout2)
+ assert layout['bots'] == [(6, 1), (1, 2)]
+ assert layout['enemy'] == [(2, 2), (5, 1)]
+
+def test_concat():
+ layout = create_layout(layout1 + layout2)
+ assert layout['bots'] == [(6, 1), (1, 2)]
+ assert layout['enemy'] == [(2, 2), (5, 1)]
+
+def test_load1():
+ layout = create_layout(layout1)
+ assert layout['bots'] == [(6, 1), (1, 2)]
+ assert layout['enemy'] == [(2, 2), (5, 1)]
+
+def test_equal_positions():
+ layout_str = """
+ ########
+ #0### #
+ # . ...#
+ ########
+
+ ########
+ #1### #
+ # . ...#
+ ########
+ ########
+ #E### #
+ # . ...#
+ ########
+
+ ########
+ #E### #
+ # . ...#
+ ########
+ """
+ layout = create_layout(layout_str)
+ assert layout['bots'] == [(1, 1), (1, 1)]
+ assert layout['enemy'] == [(1, 1), (1, 1)]
+ setup_test_game(layout=layout_str)
+
+def test_define_after():
+ layout = create_layout(layout1, food=[(1, 1)], bots=[None, None], enemy=None)
+ assert layout['bots'] == [(6, 1), (1, 2)]
+ assert layout['enemy'] == [(2, 2), (5, 1)]
+ layout = create_layout(layout1, food=[(1, 1)], bots=[None, (1, 1)], enemy=None)
+ assert layout['bots'] == [(6, 1), (1, 1)]
+ assert layout['enemy'] == [(2, 2), (5, 1)]
+
+ with pytest.raises(ValueError):
+ # must define all enemies
+ layout = create_layout(layout1, food=[(1, 1)], bots=[None, (1, 2)], enemy=[(5, 1)])
+
+ layout = create_layout(layout2, food=[(1, 1)], bots=[None, (1, 2)], enemy=[(5, 1), (2, 2)])
+ assert layout['bots'] == [None, (1, 2)]
+ assert layout['enemy'] == [(5, 1), (2, 2)]
+
+ with pytest.raises(ValueError):
+ # placed bot on walls
+ layout = create_layout(layout2, food=[(1, 1)], bots=[(0, 1), (1, 2)], enemy=[(5, 1), (2, 2)])
+
+ with pytest.raises(ValueError):
+ # placed bot outside maze
+ layout = create_layout(layout2, food=[(1, 1)], bots=[(1, 40), (1, 2)], enemy=[(5, 1), (2, 2)])
+
+ with pytest.raises(ValueError):
+ # placed bot outside maze
+ layout = create_layout(layout2, food=[(1, 1)], bots=[(40, 40), (1, 2)], enemy=[(5, 1), (2, 2)])
+
+ with pytest.raises(ValueError):
+ # placed bot outside maze
+ layout = create_layout(layout2, food=[(1, 1)], bots=[(-40, 4), (1, 2)], enemy=[(5, 1), (2, 2)])
+
+ with pytest.raises(ValueError):
+ # too many bots
+ layout = create_layout(layout2, food=[(1, 1)], bots=[(1, 1), (1, 2), (2, 2)], enemy=[(5, 1), (2, 2)])
+
+def test_repr():
+ layout = create_layout(layout1, food=[(1, 1)], bots=[None, None], enemy=None)
+ str1 = layout_as_str(**layout)
+ assert str1 == """\
########
-# ###E0#
+#.###E0#
#1E #
########
-
"""
- layout_merge = create_layout(self.layout, food=[(1, 1)], bots=[(1, 2), (1, 2)], enemy=[(1, 1), (1, 1)])
- str2 = str(layout_merge)
- assert str2 == """
+ layout_merge = create_layout(layout1, food=[(1, 1)], bots=[(1, 2), (1, 2)], enemy=[(1, 1), (1, 1)])
+ str2 = layout_as_str(**layout_merge)
+ assert str2 == """\
########
#.### #
# #
########
-
########
#E### #
#0 #
########
-
########
#E### #
#1 #
########
-
"""
- # load again
- assert create_layout(str2) == layout_merge
+ # load again
+ assert create_layout(str2) == layout_merge
- def test_solo_bot(self):
- l = """
- ########
- #.### #
- # #
- ########
+def test_two_enemies():
+ # single E evaluates to two enemies
+ l = """
+ ########
+ #.### #
+ # #
+ ########
- ########
- # ### #
- #0E #
- ########
- """
- layout = create_layout(l, food=[(1, 1)], bots=[None, None], enemy=None)
- assert layout._repr_html_()
- str1 = str(create_layout(l, food=[(1, 1)], bots=[None, None], enemy=None))
- assert str1 == """
+ ########
+ # ### #
+ #0E #
+ ########
+ """
+ str1 = layout_as_str(**create_layout(l, food=[(1, 1)], bots=[None, None], enemy=None))
+ assert str1 == """\
########
#.### #
# #
########
-
########
# ### #
#0E #
########
-
+########
+# ### #
+# E #
+########
"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 3
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest-cov",
"codecov",
"coveralls",
"pytest"
],
"pre_install": [],
"python": "3.7",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
codecov==2.1.13
coverage==6.5.0
coveralls==3.3.1
docopt==0.6.2
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
numpy==1.21.6
packaging==24.0
-e git+https://github.com/ASPP/pelita.git@8c4b83c5fcfd1b748af5cfe8b0b09e93ab5a6406#egg=pelita
pluggy==1.2.0
pytest==7.4.4
pytest-cov==4.1.0
PyYAML==6.0.1
pyzmq==26.2.1
requests==2.31.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==3.4.1
- codecov==2.1.13
- coverage==6.5.0
- coveralls==3.3.1
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- numpy==1.21.6
- packaging==24.0
- pluggy==1.2.0
- pytest==7.4.4
- pytest-cov==4.1.0
- pyyaml==6.0.1
- pyzmq==26.2.1
- requests==2.31.0
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- zipp==3.15.0
prefix: /opt/conda/envs/pelita
|
[
"test/test_layout.py::test_duplicate_bots_forbidden",
"test/test_layout.py::test_duplicate_bots_forbidden_multiple",
"test/test_layout.py::test_enemy_positions[\\n",
"test/test_layout.py::test_layout_for_team",
"test/test_team.py::test_load",
"test/test_team.py::test_concat",
"test/test_team.py::test_load1",
"test/test_team.py::test_equal_positions",
"test/test_team.py::test_define_after",
"test/test_team.py::test_repr",
"test/test_team.py::test_two_enemies"
] |
[] |
[
"test/test_layout.py::test_get_available_layouts",
"test/test_layout.py::test_get_layout_by_name",
"test/test_layout.py::test_get_random_layout",
"test/test_layout.py::test_get_random_layout_returns_correct_layout",
"test/test_layout.py::test_not_enclosed_by_walls",
"test/test_layout.py::test_illegal_character",
"test/test_layout.py::test_illegal_index",
"test/test_layout.py::test_illegal_walls",
"test/test_layout.py::test_illegal_width",
"test/test_layout.py::test_different_width",
"test/test_layout.py::test_combined_layouts",
"test/test_layout.py::test_combined_layouts_empty_lines",
"test/test_layout.py::test_duplicate_bots_allowed",
"test/test_layout.py::test_combined_layouts_broken_lines",
"test/test_layout.py::test_roundtrip",
"test/test_layout.py::test_roundtrip_overlapping",
"test/test_layout.py::test_empty_lines",
"test/test_layout.py::test_equal_positions",
"test/test_layout.py::test_legal_positions[pos0-legal_positions0]",
"test/test_layout.py::test_legal_positions[pos1-legal_positions1]",
"test/test_layout.py::test_legal_positions[pos2-legal_positions2]",
"test/test_layout.py::test_legal_positions[pos3-legal_positions3]",
"test/test_layout.py::test_legal_positions_fail[pos0]",
"test/test_layout.py::test_legal_positions_fail[pos1]",
"test/test_layout.py::test_legal_positions_fail[pos2]",
"test/test_layout.py::test_legal_positions_fail[pos3]",
"test/test_layout.py::test_legal_positions_fail[pos4]",
"test/test_layout.py::test_enemy_raises",
"test/test_team.py::TestStoppingTeam::test_stopping",
"test/test_team.py::test_track_and_kill_count",
"test/test_team.py::test_eaten_flag_kill[0]",
"test/test_team.py::test_eaten_flag_kill[1]",
"test/test_team.py::test_eaten_flag_kill[2]",
"test/test_team.py::test_eaten_flag_kill[3]",
"test/test_team.py::test_eaten_flag_suicide[0]",
"test/test_team.py::test_eaten_flag_suicide[1]",
"test/test_team.py::test_eaten_flag_suicide[2]",
"test/test_team.py::test_eaten_flag_suicide[3]",
"test/test_team.py::test_initial_position[0]",
"test/test_team.py::test_initial_position[1]",
"test/test_team.py::test_initial_position[2]",
"test/test_team.py::test_initial_position[3]",
"test/test_team.py::test_initial_position[4]",
"test/test_team.py::test_initial_position[5]",
"test/test_team.py::test_initial_position[6]",
"test/test_team.py::test_initial_position[7]",
"test/test_team.py::test_initial_position[8]",
"test/test_team.py::test_initial_position[9]",
"test/test_team.py::test_bot_attributes"
] |
[] |
BSD License
| null |
|
ASPP__pelita-635
|
ffe76f4adeca90e7c9e4542ab61a1deb5081408f
|
2019-08-01 19:40:51
|
c94d1b0f26600f5982c95b095666fbddea993787
|
diff --git a/pelita/game.py b/pelita/game.py
index 5789a9b3..2dd68761 100644
--- a/pelita/game.py
+++ b/pelita/game.py
@@ -275,7 +275,7 @@ def setup_game(team_specs, *, layout_dict, max_rounds=300, layout_name="", seed=
kills = [0]*4,
# List of boolean flags weather bot has been eaten since its last move
- bot_eaten = [False]*4,
+ bot_was_killed = [False]*4,
#: Messages the bots say. Keeps only the recent one at the respective bot’s index.
say=[""] * 4,
@@ -418,7 +418,7 @@ def prepare_bot_state(game_state, idx=None):
'score': game_state['score'][own_team],
'kills': game_state['kills'][own_team::2],
'deaths': game_state['deaths'][own_team::2],
- 'bot_eaten': game_state['bot_eaten'][own_team::2],
+ 'bot_was_killed': game_state['bot_was_killed'][own_team::2],
'error_count': len(game_state['errors'][own_team]),
'food': list(game_state['food'][own_team]),
'name': game_state['team_names'][own_team]
@@ -431,7 +431,7 @@ def prepare_bot_state(game_state, idx=None):
'score': game_state['score'][enemy_team],
'kills': game_state['kills'][enemy_team::2],
'deaths': game_state['deaths'][enemy_team::2],
- 'bot_eaten': game_state['bot_eaten'][enemy_team::2],
+ 'bot_was_killed': game_state['bot_was_killed'][enemy_team::2],
'error_count': 0, # TODO. Could be left out for the enemy
'food': list(game_state['food'][enemy_team]),
'name': game_state['team_names'][enemy_team]
@@ -627,14 +627,14 @@ def apply_move(gamestate, bot_position):
n_round = gamestate["round"]
kills = gamestate["kills"]
deaths = gamestate["deaths"]
- bot_eaten = gamestate["bot_eaten"]
+ bot_was_killed = gamestate["bot_was_killed"]
fatal_error = True if gamestate["fatal_errors"][team] else False
#TODO how are fatal errors passed to us? dict with same structure as regular errors?
#TODO do we need to communicate that fatal error was the reason for game over in any other way?
- # reset our own bot_eaten flag
- bot_eaten[turn] = False
+ # reset our own bot_was_killed flag
+ bot_was_killed[turn] = False
# previous errors
team_errors = gamestate["errors"][team]
@@ -694,7 +694,7 @@ def apply_move(gamestate, bot_position):
bots[enemy_idx] = init_positions[enemy_idx]
kills[turn] += 1
deaths[enemy_idx] += 1
- bot_eaten[enemy_idx] = True
+ bot_was_killed[enemy_idx] = True
_logger.info(f"Bot {enemy_idx} reappears at {bots[enemy_idx]}.")
else:
# check if we have been eaten
@@ -706,7 +706,7 @@ def apply_move(gamestate, bot_position):
bots[turn] = init_positions[turn]
deaths[turn] += 1
kills[enemies_on_target[0]] += 1
- bot_eaten[turn] = True
+ bot_was_killed[turn] = True
_logger.info(f"Bot {turn} reappears at {bots[turn]}.")
errors = gamestate["errors"]
@@ -717,7 +717,7 @@ def apply_move(gamestate, bot_position):
"score": score,
"deaths": deaths,
"kills": kills,
- "bot_eaten": bot_eaten,
+ "bot_was_killed": bot_was_killed,
"errors": errors,
}
diff --git a/pelita/player/team.py b/pelita/player/team.py
index 5e80eaa5..a98d6140 100644
--- a/pelita/player/team.py
+++ b/pelita/player/team.py
@@ -104,8 +104,8 @@ class Team:
team = me._team
for idx, mybot in enumerate(team):
- # If a bot has been eaten, we reset it’s bot track
- if mybot.eaten:
+ # If a bot has been killed, we reset it’s bot track
+ if mybot.was_killed:
self._bot_track[idx] = []
# Add our track
@@ -414,7 +414,7 @@ class Bot:
score,
kills,
deaths,
- eaten,
+ was_killed,
random,
round,
is_blue,
@@ -441,7 +441,7 @@ class Bot:
self.score = score
self.kills = kills
self.deaths = deaths
- self.eaten = eaten
+ self.was_killed = was_killed
self._bot_index = bot_index
self.round = round
self.is_blue = is_blue
@@ -636,7 +636,7 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
score=team['score'],
deaths=team['deaths'][idx],
kills=team['kills'][idx],
- eaten=team['bot_eaten'][idx],
+ was_killed=team['bot_was_killed'][idx],
error_count=team['error_count'],
food=team['food'],
walls=walls,
@@ -658,7 +658,7 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
score=enemy['score'],
kills=enemy['kills'][idx],
deaths=enemy['deaths'][idx],
- eaten=enemy['bot_eaten'][idx],
+ was_killed=enemy['bot_was_killed'][idx],
is_noisy=enemy['is_noisy'][idx],
error_count=enemy['error_count'],
food=enemy['food'],
diff --git a/pelita/utils.py b/pelita/utils.py
index 2ba81335..4da42bb9 100644
--- a/pelita/utils.py
+++ b/pelita/utils.py
@@ -58,7 +58,7 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
'score': score[team_index],
'kills': [0]*2,
'deaths': [0]*2,
- 'bot_eaten' : [False]*2,
+ 'bot_was_killed' : [False]*2,
'error_count': 0,
'food': food[team_index],
'name': "blue" if is_blue else "red"
@@ -69,7 +69,7 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
'score': score[enemy_index],
'kills': [0]*2,
'deaths': [0]*2,
- 'bot_eaten': [False]*2,
+ 'bot_was_killed': [False]*2,
'error_count': 0,
'food': food[enemy_index],
'is_noisy': [False] * len(layout['enemy']),
|
rename Bot.has_respawned
What about renaming `Bot.has_respawned` to `Bot.was_killed`? The word _respawned_ is totally meaningless for most non-hardcore programmers.
|
ASPP/pelita
|
diff --git a/test/test_game.py b/test/test_game.py
index 52f998e8..5f41ce0f 100644
--- a/test/test_game.py
+++ b/test/test_game.py
@@ -884,7 +884,7 @@ def test_play_turn_move():
"score": 0,
"kills":[0]*4,
"deaths": [0]*4,
- "bot_eaten": [False]*4,
+ "bot_was_killed": [False]*4,
"errors": [[], []],
"fatal_errors": [{}, {}],
"rnd": random.Random()
@@ -1266,9 +1266,9 @@ def test_setup_game_run_game_have_same_args():
@pytest.mark.parametrize('bot_to_move', range(4))
# all combinations of True False in a list of 4
[email protected]('bot_eaten_flags', itertools.product(*[(True, False)] * 4))
-def test_apply_move_resets_bot_eaten(bot_to_move, bot_eaten_flags):
- """ Check that `prepare_bot_state` sees the proper bot_eaten flag
[email protected]('bot_was_killed_flags', itertools.product(*[(True, False)] * 4))
+def test_apply_move_resets_bot_was_killed(bot_to_move, bot_was_killed_flags):
+ """ Check that `prepare_bot_state` sees the proper bot_was_killed flag
and that `apply_move` will reset the flag to False. """
team_id = bot_to_move % 2
other_bot = (bot_to_move + 2) % 4
@@ -1277,27 +1277,27 @@ def test_apply_move_resets_bot_eaten(bot_to_move, bot_eaten_flags):
# specify which bot should move
test_state = setup_random_basic_gamestate(turn=bot_to_move)
- bot_eaten_flags = list(bot_eaten_flags) # needs to be a list
- test_state['bot_eaten'] = bot_eaten_flags[:] # copy to avoid reference issues
+ bot_was_killed_flags = list(bot_was_killed_flags) # needs to be a list
+ test_state['bot_was_killed'] = bot_was_killed_flags[:] # copy to avoid reference issues
# create bot state for current turn
current_bot_position = test_state['bots'][bot_to_move]
bot_state = game.prepare_bot_state(test_state)
- # bot state should have proper bot_eaten flag
- assert bot_state['team']['bot_eaten'] == bot_eaten_flags[team_id::2]
+ # bot state should have proper bot_was_killed flag
+ assert bot_state['team']['bot_was_killed'] == bot_was_killed_flags[team_id::2]
- # apply a dummy move that should reset bot_eaten for the current bot
+ # apply a dummy move that should reset bot_was_killed for the current bot
new_test_state = game.apply_move(test_state, current_bot_position)
- # the bot_eaten flag should be False again
- assert test_state['bot_eaten'][bot_to_move] == False
+ # the bot_was_killed flag should be False again
+ assert test_state['bot_was_killed'][bot_to_move] == False
- # the bot_eaten flags for other bot should still be as before
- assert test_state['bot_eaten'][other_bot] == bot_eaten_flags[other_bot]
+ # the bot_was_killed flags for other bot should still be as before
+ assert test_state['bot_was_killed'][other_bot] == bot_was_killed_flags[other_bot]
- # all bot_eaten flags for other team should still be as before
- assert test_state['bot_eaten'][other_team_id::2] == bot_eaten_flags[other_team_id::2]
+ # all bot_was_killed flags for other team should still be as before
+ assert test_state['bot_was_killed'][other_team_id::2] == bot_was_killed_flags[other_team_id::2]
def test_bot_does_not_eat_own_food():
diff --git a/test/test_network.py b/test/test_network.py
index f01d6d0a..c967753a 100644
--- a/test/test_network.py
+++ b/test/test_network.py
@@ -96,7 +96,7 @@ def test_simpleclient(zmq_context):
'score': 0,
'kills': [0]*2,
'deaths': [0]*2,
- 'bot_eaten': [False]*2,
+ 'bot_was_killed': [False]*2,
'error_count': 0,
'food': [(1, 1)],
'name': 'dummy',
@@ -107,7 +107,7 @@ def test_simpleclient(zmq_context):
'score': 0,
'kills': [0]*2,
'deaths': [0]*2,
- 'bot_eaten': [False]*2,
+ 'bot_was_killed': [False]*2,
'food': [(2, 2)],
'name': 'other dummy',
'is_noisy': [False, False],
diff --git a/test/test_team.py b/test/test_team.py
index 6b9cd97f..d78a22f9 100644
--- a/test/test_team.py
+++ b/test/test_team.py
@@ -225,7 +225,7 @@ def test_track_and_kill_count():
if bot.round == 1 and turn == 0:
assert bot.track[0] == bot.position
- if bot.eaten:
+ if bot.was_killed:
state[turn]['eaten'] = True
# if bot.deaths has increased from our last known value,
# we add a kill
@@ -234,15 +234,15 @@ def test_track_and_kill_count():
if state[turn]['deaths'] != bot.deaths:
state[turn]['times_killed'] += 1
state[turn]['deaths'] = bot.deaths
- if other.eaten:
+ if other.was_killed:
state[1 - turn]['eaten'] = True
if state[1 - turn]['deaths'] != bot.other.deaths:
state[1 - turn]['times_killed'] += 1
state[1 - turn]['deaths'] = bot.other.deaths
- if bot.eaten or not state[turn]['track']:
+ if bot.was_killed or not state[turn]['track']:
state[turn]['track'] = [bot.position]
- if other.eaten or not state[1 - turn]['track']:
+ if other.was_killed or not state[1 - turn]['track']:
state[1 - turn]['track'] = [other.position]
else:
state[1 - turn]['track'].append(other.position)
@@ -286,9 +286,9 @@ def test_track_and_kill_count():
team = state['turn'] % 2
# The current bot knows about its deaths, *unless* it made suicide,
- # so we have to substract 1 if bot_eaten is True
+ # so we have to substract 1 if bot_was_killed is True
suicide_correction = [0] * 4
- suicide_correction[state['turn']] = 1 if state['bot_eaten'][state['turn']] else 0
+ suicide_correction[state['turn']] = 1 if state['bot_was_killed'][state['turn']] else 0
# The other team knows about its deaths, *unless* one of the bots got eaten
# just now, or the previous bot made suicide
@@ -299,7 +299,7 @@ def test_track_and_kill_count():
# suicide
prev_idx = state['turn'] - 1
- if old_deaths[prev_idx] == deaths[prev_idx] and state['bot_eaten'][prev_idx]:
+ if old_deaths[prev_idx] == deaths[prev_idx] and state['bot_was_killed'][prev_idx]:
other_team_correction[prev_idx] = 1
assert bot_states[0][0]['times_killed'] == deaths[0] - suicide_correction[0] - other_team_correction[0]
@@ -338,54 +338,54 @@ def test_eaten_flag_kill(bot_to_move):
new_pos = (x - 1, y)
# The red team should notice immediately
if bot.round == 1 and not bot.is_blue and bot.turn == 0:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
# as bot 1 has been moved, the eaten flag will be reset in all other cases
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
if bot_to_move == 1:
# we move in the first round as red team
if bot.round == 1 and not bot.is_blue and bot.turn == 0:
new_pos = (x + 1, y)
# The other team should notice immediately that its other bot (#0) has been eaten
if bot.round == 1 and bot.is_blue and bot.turn == 1:
- assert bot.eaten is False
- assert bot.other.eaten
+ assert bot.was_killed is False
+ assert bot.other.was_killed
# When bot 0 moves, the flag is still set
elif bot.round == 2 and bot.is_blue and bot.turn == 0:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
if bot_to_move == 2:
# we move in the first round as blue team in turn == 1
if bot.round == 1 and bot.is_blue and bot.turn == 1:
new_pos = (x - 1, y)
# The red team should notice immediately
if bot.round == 1 and not bot.is_blue and bot.turn == 1:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
# as bot 2 has been moved, the eaten flag will be reset in all other cases
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
if bot_to_move == 3:
# we move in the first round as red team in turn == 1
if bot.round == 1 and not bot.is_blue and bot.turn == 1:
new_pos = (x + 1, y)
# The blue team should notice immediately (in round == 2!) that bot 1 has been eaten
if bot.round == 2 and bot.is_blue and bot.turn == 0:
- assert bot.eaten is False
- assert bot.other.eaten
+ assert bot.was_killed is False
+ assert bot.other.was_killed
# When bot 1 moves, the flag is still set
elif bot.round == 2 and bot.is_blue and bot.turn == 1:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
# otherwise return current position
return new_pos, state
@@ -414,60 +414,60 @@ def test_eaten_flag_suicide(bot_to_move):
new_pos = (x + 1, y)
# our other bot should notice it in our next turn
if bot.round == 1 and bot.is_blue and bot.turn == 1:
- assert bot.eaten is False
- assert bot.other.eaten
+ assert bot.was_killed is False
+ assert bot.other.was_killed
# bot 0 will notice it in the next round
elif bot.round == 2 and bot.is_blue and bot.turn == 0:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
if bot_to_move == 1:
# we move in the first round as red team
if bot.round == 1 and not bot.is_blue and bot.turn == 0:
new_pos = (x - 1, y)
# we should notice in our next turn
if bot.round == 1 and not bot.is_blue and bot.turn == 1:
- assert bot.eaten is False
- assert bot.other.eaten
+ assert bot.was_killed is False
+ assert bot.other.was_killed
# bot 1 will notice it in the next round
elif bot.round == 2 and not bot.is_blue and bot.turn == 0:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
if bot_to_move == 2:
# we move in the first round as blue team in turn == 1
if bot.round == 1 and bot.is_blue and bot.turn == 1:
new_pos = (x + 1, y)
# we should notice in our next turn (next round!)
if bot.round == 2 and bot.is_blue and bot.turn == 0:
- assert bot.eaten is False
- assert bot.other.eaten
+ assert bot.was_killed is False
+ assert bot.other.was_killed
# bot 2 will notice it in the next round as well
elif bot.round == 2 and bot.is_blue and bot.turn == 1:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
if bot_to_move == 3:
# we move in the first round as red team in turn == 1
if bot.round == 1 and not bot.is_blue and bot.turn == 1:
new_pos = (x - 1, y)
# we should notice in our next turn (next round!)
if bot.round == 2 and not bot.is_blue and bot.turn == 0:
- assert bot.eaten is False
- assert bot.other.eaten
+ assert bot.was_killed is False
+ assert bot.other.was_killed
# bot 3 will notice it in the next round as well
elif bot.round == 2 and not bot.is_blue and bot.turn == 1:
- assert bot.eaten
- assert bot.other.eaten is False
+ assert bot.was_killed
+ assert bot.other.was_killed is False
else:
- assert bot.eaten is False
- assert bot.other.eaten is False
+ assert bot.was_killed is False
+ assert bot.other.was_killed is False
# otherwise return current position
return new_pos, state
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 3
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": null,
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
numpy==1.21.6
packaging @ file:///croot/packaging_1671697413597/work
-e git+https://github.com/ASPP/pelita.git@ffe76f4adeca90e7c9e4542ab61a1deb5081408f#egg=pelita
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
pytest-cov==4.1.0
PyYAML==6.0.1
pyzmq==26.2.1
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib-metadata=4.11.3=py37h06a4308_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.2.7
- numpy==1.21.6
- pytest-cov==4.1.0
- pyyaml==6.0.1
- pyzmq==26.2.1
prefix: /opt/conda/envs/pelita
|
[
"test/test_game.py::test_play_turn_move",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-3]",
"test/test_network.py::test_simpleclient",
"test/test_team.py::test_track_and_kill_count",
"test/test_team.py::test_eaten_flag_kill[0]",
"test/test_team.py::test_eaten_flag_kill[1]",
"test/test_team.py::test_eaten_flag_kill[2]",
"test/test_team.py::test_eaten_flag_kill[3]",
"test/test_team.py::test_eaten_flag_suicide[0]",
"test/test_team.py::test_eaten_flag_suicide[1]",
"test/test_team.py::test_eaten_flag_suicide[2]",
"test/test_team.py::test_eaten_flag_suicide[3]"
] |
[] |
[
"test/test_game.py::test_initial_positions_basic",
"test/test_game.py::test_initial_positions[\\n",
"test/test_game.py::test_no_initial_positions_possible[\\n",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t0]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t1]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t2]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t3]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t4]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t5]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t6]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t7]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t8]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t9]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t10]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t11]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t12]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t13]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t14]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t15]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t16]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t17]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t18]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t19]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t20]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t21]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t22]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t23]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t24]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t25]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t26]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t27]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t28]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t29]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_001]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_002]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_003]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_004]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_005]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_006]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_007]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_008]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_009]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_010]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_011]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_012]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_013]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_014]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_015]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_016]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_017]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_018]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_019]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_020]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_021]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_022]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_023]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_024]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_025]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_026]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_027]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_028]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_029]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_030]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_031]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_032]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_033]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_034]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_035]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_036]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_037]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_038]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_039]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_040]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_041]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_042]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_043]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_044]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_045]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_046]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_047]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_048]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_049]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_050]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_051]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_052]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_053]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_054]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_055]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_056]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_057]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_058]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_059]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_060]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_061]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_062]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_063]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_064]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_065]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_066]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_067]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_068]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_069]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_070]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_071]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_072]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_073]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_074]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_075]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_076]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_077]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_078]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_079]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_080]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_081]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_082]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_083]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_084]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_085]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_086]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_087]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_088]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_089]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_090]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_091]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_092]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_093]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_094]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_095]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_096]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_097]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_098]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_099]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_with_dead_ends_100]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_001]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_002]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_003]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_004]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_005]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_006]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_007]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_008]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_009]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_010]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_011]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_012]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_013]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_014]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_015]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_016]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_017]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_018]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_019]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_020]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_021]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_022]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_023]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_024]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_025]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_026]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_027]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_028]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_029]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_030]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_031]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_032]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_033]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_034]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_035]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_036]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_037]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_038]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_039]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_040]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_041]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_042]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_043]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_044]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_045]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_046]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_047]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_048]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_049]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_050]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_051]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_052]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_053]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_054]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_055]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_056]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_057]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_058]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_059]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_060]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_061]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_062]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_063]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_064]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_065]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_066]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_067]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_068]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_069]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_070]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_071]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_072]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_073]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_074]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_075]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_076]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_077]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_078]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_079]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_080]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_081]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_082]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_083]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_084]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_085]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_086]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_087]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_088]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_089]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_090]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_091]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_092]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_093]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_094]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_095]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_096]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_097]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_098]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_099]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_big_without_dead_ends_100]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_001]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_002]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_003]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_004]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_005]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_006]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_007]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_008]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_009]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_010]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_011]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_012]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_013]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_014]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_015]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_016]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_017]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_018]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_019]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_020]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_021]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_022]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_023]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_024]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_025]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_026]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_027]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_028]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_029]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_030]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_031]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_032]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_033]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_034]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_035]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_036]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_037]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_038]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_039]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_040]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_041]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_042]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_043]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_044]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_045]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_046]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_047]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_048]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_049]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_050]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_051]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_052]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_053]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_054]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_055]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_056]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_057]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_058]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_059]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_060]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_061]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_062]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_063]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_064]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_065]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_066]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_067]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_068]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_069]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_070]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_071]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_072]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_073]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_074]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_075]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_076]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_077]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_078]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_079]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_080]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_081]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_082]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_083]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_084]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_085]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_086]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_087]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_088]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_089]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_090]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_091]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_092]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_093]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_094]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_095]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_096]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_097]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_098]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_099]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_with_dead_ends_100]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_001]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_002]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_003]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_004]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_005]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_006]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_007]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_008]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_009]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_010]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_011]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_012]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_013]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_014]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_015]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_016]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_017]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_018]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_019]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_020]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_021]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_022]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_023]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_024]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_025]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_026]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_027]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_028]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_029]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_030]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_031]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_032]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_033]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_034]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_035]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_036]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_037]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_038]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_039]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_040]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_041]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_042]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_043]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_044]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_045]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_046]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_047]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_048]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_049]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_050]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_051]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_052]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_053]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_054]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_055]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_056]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_057]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_058]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_059]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_060]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_061]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_062]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_063]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_064]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_065]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_066]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_067]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_068]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_069]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_070]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_071]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_072]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_073]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_074]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_075]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_076]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_077]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_078]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_079]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_080]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_081]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_082]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_083]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_084]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_085]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_086]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_087]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_088]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_089]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_090]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_091]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_092]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_093]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_094]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_095]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_096]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_097]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_098]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_099]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_normal_without_dead_ends_100]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_001]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_002]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_003]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_004]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_005]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_006]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_007]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_008]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_009]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_010]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_011]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_012]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_013]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_014]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_015]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_016]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_017]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_018]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_019]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_020]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_021]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_022]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_023]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_024]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_025]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_026]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_027]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_028]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_029]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_030]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_031]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_032]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_033]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_034]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_035]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_036]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_037]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_038]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_039]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_040]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_041]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_042]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_043]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_044]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_045]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_046]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_047]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_048]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_049]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_050]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_051]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_052]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_053]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_054]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_055]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_056]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_057]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_058]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_059]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_060]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_061]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_062]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_063]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_064]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_065]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_066]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_067]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_068]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_069]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_070]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_071]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_072]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_073]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_074]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_075]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_076]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_077]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_078]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_079]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_080]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_081]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_082]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_083]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_084]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_085]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_086]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_087]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_088]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_089]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_090]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_091]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_092]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_093]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_094]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_095]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_096]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_097]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_098]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_099]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_with_dead_ends_100]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_001]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_002]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_003]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_004]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_005]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_006]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_007]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_008]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_009]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_010]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_011]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_012]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_013]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_014]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_015]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_016]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_017]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_018]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_019]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_020]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_021]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_022]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_023]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_024]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_025]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_026]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_027]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_028]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_029]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_030]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_031]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_032]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_033]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_034]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_035]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_036]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_037]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_038]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_039]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_040]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_041]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_042]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_043]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_044]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_045]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_046]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_047]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_048]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_049]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_050]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_051]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_052]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_053]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_054]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_055]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_056]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_057]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_058]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_059]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_060]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_061]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_062]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_063]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_064]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_065]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_066]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_067]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_068]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_069]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_070]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_071]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_072]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_073]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_074]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_075]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_076]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_077]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_078]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_079]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_080]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_081]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_082]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_083]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_084]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_085]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_086]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_087]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_088]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_089]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_090]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_091]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_092]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_093]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_094]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_095]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_096]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_097]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_098]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_099]",
"test/test_game.py::test_initial_positions_same_in_layout[layout_small_without_dead_ends_100]",
"test/test_game.py::test_get_legal_positions_basic",
"test/test_game.py::test_get_legal_positions_random[0-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t49]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t49]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t49]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t49]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden0]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden1]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden2]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden3]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden4]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden5]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden6]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden7]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden8]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden9]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden10]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden11]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden12]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden13]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden14]",
"test/test_game.py::test_setup_game_bad_number_of_bots[bots_hidden15]",
"test/test_game.py::test_play_turn_apply_error[0]",
"test/test_game.py::test_play_turn_apply_error[1]",
"test/test_game.py::test_play_turn_apply_error[2]",
"test/test_game.py::test_play_turn_apply_error[3]",
"test/test_game.py::test_play_turn_fatal[0]",
"test/test_game.py::test_play_turn_fatal[1]",
"test/test_game.py::test_play_turn_fatal[2]",
"test/test_game.py::test_play_turn_fatal[3]",
"test/test_game.py::test_play_turn_illegal_position[0]",
"test/test_game.py::test_play_turn_illegal_position[1]",
"test/test_game.py::test_play_turn_illegal_position[2]",
"test/test_game.py::test_play_turn_illegal_position[3]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-0]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-1]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-2]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-3]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-0]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-1]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-2]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-3]",
"test/test_game.py::test_play_turn_killing[0]",
"test/test_game.py::test_play_turn_killing[1]",
"test/test_game.py::test_play_turn_killing[2]",
"test/test_game.py::test_play_turn_killing[3]",
"test/test_game.py::test_play_turn_friendly_fire[setups0]",
"test/test_game.py::test_play_turn_friendly_fire[setups1]",
"test/test_game.py::test_play_turn_friendly_fire[setups2]",
"test/test_game.py::test_play_turn_friendly_fire[setups3]",
"test/test_game.py::test_multiple_enemies_killing",
"test/test_game.py::test_suicide",
"test/test_game.py::test_cascade_kill",
"test/test_game.py::test_cascade_kill_2",
"test/test_game.py::test_cascade_kill_rescue_1",
"test/test_game.py::test_cascade_kill_rescue_2",
"test/test_game.py::test_cascade_suicide",
"test/test_game.py::test_moving_through_maze",
"test/test_game.py::test_play_turn_maxrounds[score0]",
"test/test_game.py::test_play_turn_maxrounds[score1]",
"test/test_game.py::test_play_turn_maxrounds[score2]",
"test/test_game.py::test_max_rounds",
"test/test_game.py::test_update_round_counter",
"test/test_game.py::test_last_round_check",
"test/test_game.py::test_error_finishes_game[team_errors0-False]",
"test/test_game.py::test_error_finishes_game[team_errors1-False]",
"test/test_game.py::test_error_finishes_game[team_errors2-False]",
"test/test_game.py::test_error_finishes_game[team_errors3-False]",
"test/test_game.py::test_error_finishes_game[team_errors4-False]",
"test/test_game.py::test_error_finishes_game[team_errors5-False]",
"test/test_game.py::test_error_finishes_game[team_errors6-False]",
"test/test_game.py::test_error_finishes_game[team_errors7-1]",
"test/test_game.py::test_error_finishes_game[team_errors8-0]",
"test/test_game.py::test_error_finishes_game[team_errors9-2]",
"test/test_game.py::test_error_finishes_game[team_errors10-1]",
"test/test_game.py::test_error_finishes_game[team_errors11-0]",
"test/test_game.py::test_error_finishes_game[team_errors12-2]",
"test/test_game.py::test_error_finishes_game[team_errors13-2]",
"test/test_game.py::test_error_finishes_game[team_errors14-1]",
"test/test_game.py::test_error_finishes_game[team_errors15-0]",
"test/test_game.py::test_finished_when_no_food[0]",
"test/test_game.py::test_finished_when_no_food[1]",
"test/test_game.py::test_finished_when_no_food[2]",
"test/test_game.py::test_finished_when_no_food[3]",
"test/test_game.py::test_minimal_game",
"test/test_game.py::test_minimal_losing_game_has_one_error",
"test/test_game.py::test_minimal_remote_game",
"test/test_game.py::test_non_existing_file",
"test/test_game.py::test_remote_errors",
"test/test_game.py::test_bad_move_function[0]",
"test/test_game.py::test_bad_move_function[1]",
"test/test_game.py::test_setup_game_run_game_have_same_args",
"test/test_game.py::test_bot_does_not_eat_own_food",
"test/test_game.py::test_suicide_win",
"test/test_game.py::test_double_suicide",
"test/test_game.py::test_remote_game_closes_players_on_exit",
"test/test_game.py::test_manual_remote_game_closes_players",
"test/test_game.py::test_invalid_setup_game_closes_players",
"test/test_network.py::test_bind_socket_success",
"test/test_network.py::test_bind_socket_fail",
"test/test_network.py::test_extract_port_range",
"test/test_team.py::test_load",
"test/test_team.py::test_concat",
"test/test_team.py::test_load1",
"test/test_team.py::test_equal_positions",
"test/test_team.py::test_define_after",
"test/test_team.py::test_repr",
"test/test_team.py::test_two_enemies",
"test/test_team.py::TestStoppingTeam::test_stopping",
"test/test_team.py::test_initial_position[0]",
"test/test_team.py::test_initial_position[1]",
"test/test_team.py::test_initial_position[2]",
"test/test_team.py::test_initial_position[3]",
"test/test_team.py::test_initial_position[4]",
"test/test_team.py::test_initial_position[5]",
"test/test_team.py::test_initial_position[6]",
"test/test_team.py::test_initial_position[7]",
"test/test_team.py::test_initial_position[8]",
"test/test_team.py::test_initial_position[9]",
"test/test_team.py::test_bot_attributes"
] |
[] |
BSD License
| null |
|
ASPP__pelita-655
|
1108fc71cdc9a7eeb4563149e9821255d6f56bf3
|
2019-08-08 14:56:42
|
c94d1b0f26600f5982c95b095666fbddea993787
|
otizonaizit: and you would show `E` when the position is not noisy? This seems a good idea! Have you adapted also the layout_from_str function to understand the new character?
Debilski:
> On 8. Aug 2019, at 17:42, Tiziano Zito <[email protected]> wrote:
>
> and you would show E when the position is not noisy? This seems a good idea! Have you adapted also the layout_from_str function to understand the new character?
>
Not yet. (Should have made it a draft PR.)
Debilski: `parse_layout` can parse the ? now but it will be the same as E. I don’t know if we want `setup_test_game` to automatically set the `is_noisy` flag, when there is a question mark?
otizonaizit: Sure, set is_noisy.
On 8 August 2019 21:42:44 CEST, Rike-Benjamin Schuppner <[email protected]> wrote:
>`parse_layout` can parse the ? now but it will be the same as E. I
>don’t know if we want `setup_test_game` to automatically set the
>`is_noisy` flag, when there is a question mark?>
>>
>-- >
>You are receiving this because you commented.>
>Reply to this email directly or view it on GitHub:>
>https://github.com/ASPP/pelita/pull/655#issuecomment-519660353
|
diff --git a/pelita/layout.py b/pelita/layout.py
index 369da014..df604a43 100644
--- a/pelita/layout.py
+++ b/pelita/layout.py
@@ -117,8 +117,9 @@ def parse_layout(layout_str, allow_enemy_chars=False):
In this case, bot '0' and bot '2' are on top of each other at position (1,1)
If `allow_enemy_chars` is True, we additionally allow for the definition of
- at most 2 enemy characters with the letter "E". The returned dict will then
- additionally contain an entry "enemy" which contains these coordinates.
+ at most 2 enemy characters with the letters "E" and "?". The returned dict will
+ then additionally contain an entry "enemy" which contains these coordinates and
+ an entry "is_noisy" that specifies which of the given enemies is noisy.
If only one enemy character is given, both will be assumed sitting on the
same spot. """
@@ -161,6 +162,7 @@ def parse_layout(layout_str, allow_enemy_chars=False):
bots = [None] * num_bots
if allow_enemy_chars:
enemy = []
+ noisy_enemy = set()
# iterate through all layouts
for layout in layout_list:
@@ -178,7 +180,10 @@ def parse_layout(layout_str, allow_enemy_chars=False):
# add the enemy, removing duplicates
if allow_enemy_chars:
- enemy = list(set(enemy + items['enemy']))
+ # enemy contains _all_ enemies
+ enemy = list(set(enemy + items['enemy'] + items['noisy_enemy']))
+ # noisy_enemy contains only the noisy enemies
+ noisy_enemy.update(items['noisy_enemy'])
# add the bots
for bot_idx, bot_pos in enumerate(items['bots']):
@@ -213,6 +218,7 @@ def parse_layout(layout_str, allow_enemy_chars=False):
# sort the enemy characters
# be careful, since it may contain None
out['enemy'] = sorted(enemy, key=lambda x: () if x is None else x)
+ out['is_noisy'] = [e in noisy_enemy for e in out['enemy']]
return out
@@ -271,6 +277,7 @@ def parse_single_layout(layout_str, num_bots=4, allow_enemy_chars=False):
bots = [None] * num_bots
# enemy positions (only used for team-style layouts)
enemy = []
+ noisy_enemy = []
# iterate through the grid of characters
for y, row in enumerate(rows):
@@ -292,6 +299,12 @@ def parse_single_layout(layout_str, num_bots=4, allow_enemy_chars=False):
enemy.append(coord)
else:
raise ValueError(f"Enemy character not allowed.")
+ elif char == '?':
+ # noisy_enemy
+ if allow_enemy_chars:
+ noisy_enemy.append(coord)
+ else:
+ raise ValueError(f"Enemy character not allowed.")
else:
# bot
try:
@@ -312,11 +325,11 @@ def parse_single_layout(layout_str, num_bots=4, allow_enemy_chars=False):
food.sort()
out = {'walls':walls, 'food':food, 'bots':bots}
if allow_enemy_chars:
- enemy.sort()
- out['enemy'] = enemy
+ out['enemy'] = sorted(enemy)
+ out['noisy_enemy'] = sorted(noisy_enemy)
return out
-def layout_as_str(*, walls, food=None, bots=None, enemy=None):
+def layout_as_str(*, walls, food=None, bots=None, enemy=None, is_noisy=None):
"""Given walls, food and bots return a string layout representation
Returns a combined layout string.
@@ -339,6 +352,15 @@ def layout_as_str(*, walls, food=None, bots=None, enemy=None):
if enemy is None:
enemy = []
+ # if noisy is given, it must be of the same length as enemy
+ if is_noisy is None:
+ noisy_enemies = set()
+ elif len(is_noisy) != len(enemy):
+ raise ValueError("Parameter `noisy` must have same length as `enemy`.")
+ else:
+ # if an enemy is flagged as noisy, we put it into the set of noisy_enemies
+ noisy_enemies = {e for e, e_is_noisy in zip(enemy, is_noisy) if e_is_noisy}
+
# flag to check if we have overlapping objects
# when need_combined is True, we force the printing of a combined layout
@@ -374,7 +396,10 @@ def layout_as_str(*, walls, food=None, bots=None, enemy=None):
if (x, y) in bots:
out.write(str(bots.index((x, y))))
elif (x, y) in enemy:
- out.write("E")
+ if (x, y) in noisy_enemies:
+ out.write("?")
+ else:
+ out.write("E")
else:
out.write(' ')
else:
@@ -403,7 +428,8 @@ def layout_as_str(*, walls, food=None, bots=None, enemy=None):
# if an enemy coordinate is None
# don't put the enemy in the layout
continue
- coord_bots[pos] = coord_bots.get(pos, []) + ["E"]
+ enemy_char = '?' if pos in noisy_enemies else 'E'
+ coord_bots[pos] = coord_bots.get(pos, []) + [enemy_char]
# loop through the bot coordinates
while coord_bots:
diff --git a/pelita/player/team.py b/pelita/player/team.py
index b936994f..5f8f638e 100644
--- a/pelita/player/team.py
+++ b/pelita/player/team.py
@@ -594,7 +594,7 @@ class Bot:
header = ("{blue}{you_blue} vs {red}{you_red}.\n" +
"Playing on {col} side. Current turn: {turn}. Round: {round}, score: {blue_score}:{red_score}. " +
- "timeouts: {blue_timeouts}:{red_timeouts}").format(
+ "timeouts: {blue_timeouts}:{red_timeouts}\n").format(
blue=blue.team_name,
red=red.team_name,
turn=bot.turn,
@@ -614,7 +614,8 @@ class Bot:
layout = layout_as_str(walls=bot.walls[:],
food=bot.food + bot.enemy[0].food,
bots=[b.position for b in bot._team],
- enemy=[e.position for e in bot.enemy])
+ enemy=[e.position for e in bot.enemy],
+ is_noisy=[e.is_noisy for e in bot.enemy])
out.write(str(layout))
return out.getvalue()
@@ -681,7 +682,7 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
return team_bots[bot_turn]
-def create_layout(*layout_strings, food=None, bots=None, enemy=None):
+def create_layout(*layout_strings, food=None, bots=None, enemy=None, is_noisy=None):
""" Create a layout from layout strings with additional food, bots and enemy positions.
Walls must be equal in all layout strings. Food positions will be collected.
@@ -729,4 +730,12 @@ def create_layout(*layout_strings, food=None, bots=None, enemy=None):
_check_valid_pos(e, "enemy")
parsed_layout['enemy'][idx] = e
+ # override is_noisy if given
+ if is_noisy is not None:
+ if not len(is_noisy) == 2:
+ raise ValueError(f"is_noisy must be a list of 2 ({is_noisy})!")
+ for idx, e_is_noisy in enumerate(is_noisy):
+ if e_is_noisy is not None:
+ parsed_layout['is_noisy'][idx] = e_is_noisy
+
return parsed_layout
diff --git a/pelita/utils.py b/pelita/utils.py
index 813e74c1..b238f1ec 100644
--- a/pelita/utils.py
+++ b/pelita/utils.py
@@ -34,7 +34,7 @@ def load_builtin_layout(layout_name, *, is_blue=True):
def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None, seed=None,
- food=None, bots=None, enemy=None):
+ food=None, bots=None, enemy=None, is_noisy=None):
"""Returns the first bot object given a layout.
The returned Bot instance can be passed to a move function to test its return value.
@@ -45,7 +45,7 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
if score is None:
score = [0, 0]
- layout = create_layout(layout, food=food, bots=bots, enemy=enemy)
+ layout = create_layout(layout, food=food, bots=bots, enemy=enemy, is_noisy=is_noisy)
width = max(layout['walls'])[0] + 1
food = split_food(width, layout['food'])
@@ -79,7 +79,7 @@ def setup_test_game(*, layout, game=None, is_blue=True, round=None, score=None,
'bot_was_killed': [False]*2,
'error_count': 0,
'food': food[enemy_index],
- 'is_noisy': [False] * len(layout['enemy']),
+ 'is_noisy': layout['is_noisy'],
'name': "red" if is_blue else "blue"
}
|
print(bot) should show which enemies are noisy
This will hopefully avoid confusion.
One remark: since we got rid of set_initial in the new-style API, the teams never see their enemies sitting unnoised on their initial positions, which has been a nice (and easy) starting point for filtering. Question: Do we want to be explicit about how the initial positions are fixed (ie. add an example) or do we want them to figure it out themselves?
|
ASPP/pelita
|
diff --git a/test/test_layout.py b/test/test_layout.py
index 0039b6e2..6b15bf7d 100644
--- a/test/test_layout.py
+++ b/test/test_layout.py
@@ -402,6 +402,14 @@ def test_enemy_raises():
# #
####
""", [None, None]), # this will set both to None
+ ("""
+ ####
+ # E#
+ ####
+ ####
+ #??#
+ ####
+ """, [(1, 1), (2, 1)]), # two enemies in two layouts with duplication and question marks
])
def test_enemy_positions(layout, enemy_pos):
if enemy_pos is None:
diff --git a/test/test_utils.py b/test/test_utils.py
new file mode 100644
index 00000000..0262fb16
--- /dev/null
+++ b/test/test_utils.py
@@ -0,0 +1,50 @@
+
+from pelita import utils
+
+import pytest
+
[email protected]('is_blue', [True, False])
+def test_setup_test_game(is_blue):
+ layout = utils.load_builtin_layout('small_without_dead_ends_001', is_blue=is_blue)
+ test_game = utils.setup_test_game(layout=layout, is_blue=is_blue)
+
+ if is_blue:
+ assert test_game.position == (1, 5)
+ assert test_game.other.position == (1, 6)
+ assert test_game.enemy[0].position == (16, 1)
+ assert test_game.enemy[1].position == (16, 2)
+ else:
+ assert test_game.position == (16, 2)
+ assert test_game.other.position == (16, 1)
+ assert test_game.enemy[0].position == (1, 5)
+ assert test_game.enemy[1].position == (1, 6)
+
+ # load_builtin_layout loads unnoised enemies
+ assert test_game.enemy[0].is_noisy is False
+ assert test_game.enemy[1].is_noisy is False
+
+
[email protected]('is_blue', [True, False])
+def test_setup_test_game(is_blue):
+ # Test that is_noisy is set properly
+ layout = """
+ ##################
+ #. ... .##. ?#
+ # # # . .### # #
+ # # ##. E . #
+ # . .## # #
+ #0# ###. . # # #
+ #1 .##. ... .#
+ ##################
+ """
+ test_game = utils.setup_test_game(layout=layout, is_blue=is_blue)
+
+ assert test_game.position == (1, 5)
+ assert test_game.other.position == (1, 6)
+ assert test_game.enemy[0].position == (8, 3)
+ assert test_game.enemy[1].position == (16, 1)
+
+ # load_builtin_layout loads unnoised enemies
+ assert test_game.enemy[0].is_noisy is False
+ assert test_game.enemy[1].is_noisy is True
+
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 3
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"codecov",
"coveralls"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
codecov==2.1.13
coverage==6.5.0
coveralls==3.3.1
docopt==0.6.2
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
networkx==2.6.3
numpy==1.21.6
packaging==24.0
-e git+https://github.com/ASPP/pelita.git@1108fc71cdc9a7eeb4563149e9821255d6f56bf3#egg=pelita
pluggy==1.2.0
pytest==7.4.4
pytest-cov==4.1.0
PyYAML==6.0.1
pyzmq==26.2.1
requests==2.31.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==3.4.1
- codecov==2.1.13
- coverage==6.5.0
- coveralls==3.3.1
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- networkx==2.6.3
- numpy==1.21.6
- packaging==24.0
- pluggy==1.2.0
- pytest==7.4.4
- pytest-cov==4.1.0
- pyyaml==6.0.1
- pyzmq==26.2.1
- requests==2.31.0
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- zipp==3.15.0
prefix: /opt/conda/envs/pelita
|
[
"test/test_layout.py::test_enemy_positions[\\n",
"test/test_utils.py::test_setup_test_game[True]",
"test/test_utils.py::test_setup_test_game[False]"
] |
[] |
[
"test/test_layout.py::test_get_available_layouts",
"test/test_layout.py::test_get_layout_by_name",
"test/test_layout.py::test_get_random_layout",
"test/test_layout.py::test_get_random_layout_returns_correct_layout",
"test/test_layout.py::test_not_enclosed_by_walls",
"test/test_layout.py::test_illegal_character",
"test/test_layout.py::test_illegal_index",
"test/test_layout.py::test_illegal_walls",
"test/test_layout.py::test_illegal_width",
"test/test_layout.py::test_different_width",
"test/test_layout.py::test_combined_layouts",
"test/test_layout.py::test_combined_layouts_empty_lines",
"test/test_layout.py::test_duplicate_bots_forbidden",
"test/test_layout.py::test_duplicate_bots_forbidden_multiple",
"test/test_layout.py::test_duplicate_bots_allowed",
"test/test_layout.py::test_combined_layouts_broken_lines",
"test/test_layout.py::test_roundtrip",
"test/test_layout.py::test_roundtrip_overlapping",
"test/test_layout.py::test_empty_lines",
"test/test_layout.py::test_equal_positions",
"test/test_layout.py::test_legal_positions[pos0-legal_positions0]",
"test/test_layout.py::test_legal_positions[pos1-legal_positions1]",
"test/test_layout.py::test_legal_positions[pos2-legal_positions2]",
"test/test_layout.py::test_legal_positions[pos3-legal_positions3]",
"test/test_layout.py::test_legal_positions_fail[pos0]",
"test/test_layout.py::test_legal_positions_fail[pos1]",
"test/test_layout.py::test_legal_positions_fail[pos2]",
"test/test_layout.py::test_legal_positions_fail[pos3]",
"test/test_layout.py::test_legal_positions_fail[pos4]",
"test/test_layout.py::test_enemy_raises",
"test/test_layout.py::test_layout_for_team"
] |
[] |
BSD License
| null |
ASPP__pelita-696
|
557c3a757a24e0f1abe25f7edf5c4ffee83a077e
|
2019-10-09 20:08:47
|
98d481043218149304c663fbc521bad30a8b97d1
|
diff --git a/pelita/layout.py b/pelita/layout.py
index e5797adc..66fa2ebd 100644
--- a/pelita/layout.py
+++ b/pelita/layout.py
@@ -545,9 +545,9 @@ def layout_for_team(layout, is_blue=True, is_noisy=(False, False)):
'is_noisy' : is_noisy,
}
-def layout_agnostic(layout_for_team, is_blue=True):
- """ Converts a layout dict with 2 bots and enemies to a layout
- with 4 bots.
+def layout_agnostic(layout, is_blue=True):
+ """ Converts a layout dict with 2 bots and enemies (team-style)
+ to a layout with 4 bots (server-style).
"""
if "enemy" not in layout:
raise ValueError("Layout is already in server-style.")
|
layout_agnostic needs tests and fixes
Currently broken. https://github.com/ASPP/pelita/blob/2f17db5355b4dffae8a130ede549ab869b2f1ce2/pelita/layout.py#L548-L566
|
ASPP/pelita
|
diff --git a/test/test_layout.py b/test/test_layout.py
index ff30905a..4d3d8638 100644
--- a/test/test_layout.py
+++ b/test/test_layout.py
@@ -454,3 +454,38 @@ def test_layout_for_team():
with pytest.raises(ValueError):
layout_for_team(parse_layout(red1))
+
+def test_layout_agnostic():
+ """
+ Test if team-style layout can be converted to server-style layout.
+
+ Uses this layout:
+
+ ####
+ #01#
+ #EE#
+ #..#
+ ####
+ """
+
+ l = {
+ 'walls': [(0,0),(0,1),(0,2),(0,3),(1,0),(1,3),(2,0),(2,3),(3,0),(3,3),(4,0),(4,1),(4,2),(4,3)],
+ 'food': [(3,1),(3,2)],
+ 'bots': [(1,1),(1,2)],
+ 'enemy': [(2,1),(2,2)]
+ }
+
+
+ l_expected_blue = {
+ 'walls': [(0,0),(0,1),(0,2),(0,3),(1,0),(1,3),(2,0),(2,3),(3,0),(3,3),(4,0),(4,1),(4,2),(4,3)],
+ 'food': [(3,1),(3,2)],
+ 'bots': [(1,1),(2,1),(1,2),(2,2)]
+ }
+ l_expected_red = {
+ 'walls': [(0,0),(0,1),(0,2),(0,3),(1,0),(1,3),(2,0),(2,3),(3,0),(3,3),(4,0),(4,1),(4,2),(4,3)],
+ 'food': [(3,1),(3,2)],
+ 'bots': [(2,1),(1,1),(2,2),(1,2)]
+ }
+
+ assert layout_agnostic(l, is_blue=True) == l_expected_blue
+ assert layout_agnostic(l, is_blue=False) == l_expected_red
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "",
"pip_packages": [
"pytest-cov",
"codecov",
"coveralls",
"pytest"
],
"pre_install": [],
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
codecov==2.1.13
coverage==6.5.0
coveralls==3.3.1
docopt==0.6.2
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
networkx==2.6.3
numpy==1.21.6
packaging==24.0
-e git+https://github.com/ASPP/pelita.git@557c3a757a24e0f1abe25f7edf5c4ffee83a077e#egg=pelita
pluggy==1.2.0
pytest==7.4.4
pytest-cov==4.1.0
PyYAML==6.0.1
pyzmq==26.2.1
requests==2.31.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==3.4.1
- codecov==2.1.13
- coverage==6.5.0
- coveralls==3.3.1
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- networkx==2.6.3
- numpy==1.21.6
- packaging==24.0
- pluggy==1.2.0
- pytest==7.4.4
- pytest-cov==4.1.0
- pyyaml==6.0.1
- pyzmq==26.2.1
- requests==2.31.0
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- zipp==3.15.0
prefix: /opt/conda/envs/pelita
|
[
"test/test_layout.py::test_layout_agnostic"
] |
[] |
[
"test/test_layout.py::test_get_available_layouts",
"test/test_layout.py::test_get_layout_by_name",
"test/test_layout.py::test_get_random_layout",
"test/test_layout.py::test_get_random_layout_returns_correct_layout",
"test/test_layout.py::test_not_enclosed_by_walls",
"test/test_layout.py::test_illegal_character",
"test/test_layout.py::test_illegal_index",
"test/test_layout.py::test_illegal_walls",
"test/test_layout.py::test_illegal_width",
"test/test_layout.py::test_different_width",
"test/test_layout.py::test_combined_layouts",
"test/test_layout.py::test_combined_layouts_empty_lines",
"test/test_layout.py::test_duplicate_bots_forbidden",
"test/test_layout.py::test_duplicate_bots_allowed",
"test/test_layout.py::test_combined_layouts_broken_lines",
"test/test_layout.py::test_roundtrip",
"test/test_layout.py::test_roundtrip_overlapping",
"test/test_layout.py::test_empty_lines",
"test/test_layout.py::test_equal_positions",
"test/test_layout.py::test_legal_positions[pos0-legal_positions0]",
"test/test_layout.py::test_legal_positions[pos1-legal_positions1]",
"test/test_layout.py::test_legal_positions[pos2-legal_positions2]",
"test/test_layout.py::test_legal_positions[pos3-legal_positions3]",
"test/test_layout.py::test_legal_positions_fail[pos0]",
"test/test_layout.py::test_legal_positions_fail[pos1]",
"test/test_layout.py::test_legal_positions_fail[pos2]",
"test/test_layout.py::test_legal_positions_fail[pos3]",
"test/test_layout.py::test_legal_positions_fail[pos4]",
"test/test_layout.py::test_enemy_raises",
"test/test_layout.py::test_enemy_positions[\\n",
"test/test_layout.py::test_layout_for_team"
] |
[] |
BSD License
|
swerebench/sweb.eval.x86_64.aspp_1776_pelita-696
|
|
ASPP__pelita-708
|
8c47e30cdf8b6dabf173ebfe71170e36b2aaa35e
|
2020-06-25 11:23:34
|
98d481043218149304c663fbc521bad30a8b97d1
|
codecov-commenter: # [Codecov](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP) Report
> Merging [#708](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP) (a4e248c) into [master](https://codecov.io/gh/ASPP/pelita/commit/254a9f4dfd142f05999462c645fd81bc3f5a27a2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP) (254a9f4) will **decrease** coverage by `0.35%`.
> The diff coverage is `75.86%`.
[](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP)
```diff
@@ Coverage Diff @@
## master #708 +/- ##
==========================================
- Coverage 59.36% 59.00% -0.36%
==========================================
Files 32 32
Lines 3733 3710 -23
==========================================
- Hits 2216 2189 -27
- Misses 1517 1521 +4
```
| [Impacted Files](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP) | Coverage Δ | |
|---|---|---|
| [pelita/ui/tk\_canvas.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL3VpL3RrX2NhbnZhcy5weQ==) | `0.00% <0.00%> (ø)` | |
| [pelita/utils.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL3V0aWxzLnB5) | `62.36% <ø> (ø)` | |
| [pelita/layout.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL2xheW91dC5weQ==) | `94.11% <80.00%> (-0.48%)` | :arrow_down: |
| [pelita/player/team.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL3BsYXllci90ZWFtLnB5) | `84.24% <87.50%> (-0.09%)` | :arrow_down: |
| [pelita/game.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL2dhbWUucHk=) | `86.59% <100.00%> (ø)` | |
| [pelita/gamestate\_filters.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL2dhbWVzdGF0ZV9maWx0ZXJzLnB5) | `94.87% <100.00%> (-0.26%)` | :arrow_down: |
| [pelita/scripts/pelita\_player.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL3NjcmlwdHMvcGVsaXRhX3BsYXllci5weQ==) | `84.97% <0.00%> (-4.75%)` | :arrow_down: |
| [pelita/tournament/\_\_init\_\_.py](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP#diff-cGVsaXRhL3RvdXJuYW1lbnQvX19pbml0X18ucHk=) | `70.63% <0.00%> (-1.08%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/ASPP/pelita/pull/708/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP). Last update [254a9f4...a4e248c](https://codecov.io/gh/ASPP/pelita/pull/708?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ASPP).
Debilski: Here’s an in-progress update on the speed:
First with the background_games demo.
```
./pelita_template (master)
❯ time python demo08_background_games.py
Games played: 100
Attacker wins: 17
Defender wins: 79
Draws: 4
Average score difference: -14.71
________________________________________________________
Executed in 92.99 secs fish external
usr time 90.31 secs 203.00 micros 90.31 secs
sys time 0.64 secs 898.00 micros 0.63 secs
```
```
./pelita_template (this PR)
❯ time python demo08_background_games.py
Games played: 100
Attacker wins: 18
Defender wins: 77
Draws: 5
Average score difference: -18.29
________________________________________________________
Executed in 20.08 secs fish external
usr time 19.55 secs 276.00 micros 19.55 secs
sys time 0.32 secs 959.00 micros 0.32 secs
```
Now with the benchmark that I created for this PR:
```
❯ python demo/benchmark_game.py --number 5 --max-rounds 300
Running 5 times with max 300 rounds. Fastest out of 5:
Stopping : 0.6716697419999997
NQ_Random : 0.9012290820000004
Stopping (remote) : 4.812962928999998
NQ_Random (remote) : 5.1260686190000015
```
```
❯ python demo/benchmark_game.py --number 5 --max-rounds 300
Running 5 times with max 300 rounds. Fastest out of 5:
Stopping : 4.707969789
NQ_Random : 6.251112241999998
Stopping (remote) : 10.743467068000001
NQ_Random (remote) : 11.85318602800001
```
As we can see, the new PR can make the code between 2 times and up to 8 times faster in the best case in a local game. Of course, the optimisations are only relevant for code that accesses the shape (this won’t happen too often to be a relevant factor) and checks `bot.walls`. As many good bots will at some point switch over to using some sort of a graph, they also shouldn’t need to access `bot.walls` more than once (and `bot.legal_positions` wouldn’t be needed either), but our own code already profits a lot from the changes.
My suggestion would be to merge this in the coming days (I still want to have another look at the code and docs) with the current changes:
* added a `shape` to `game_state` and `bot` to avoid having to use the costly and error-prone `max(walls)[0]+1`
* made `walls` a `Set[Tuple[int]]`
* made `homezone` a `Set[Tuple[int]]` (we can still make this a special object with `__contains__` syntax later)
Notably, `walls` and `homezone` are no `frozenset`s yet. Also, given the problems with `random.choice`, `food` is still a `List[Tuple[int]]`. I haven’t checked it, but the access pattern for food might not profit from it being a set *that* much. (Arguably, the *usual* access pattern for food also doesn’t include `random.choice`, but I think it’s still useful for experimenting.)
I have rewritten Pietro’s bots to use networkx while using this branch and haven’t really run into problems (one usual change was the need to do `homezone[:]` → `homezone.copy()` but that’s a minor thing). I’d say it is safe to use.
|
diff --git a/check_layout_consistency.py b/check_layout_consistency.py
index f3e873c6..cb6b9689 100644
--- a/check_layout_consistency.py
+++ b/check_layout_consistency.py
@@ -1,36 +1,11 @@
"""Detect if a layout contains "chambers" with food"""
import sys
-import networkx
+import networkx as nx
from pelita.layout import parse_layout
+from pelita.utils import walls_to_graph
-def get_hw(layout):
- walls = layout['walls']
- width = max([coord[0] for coord in walls]) + 1
- height = max([coord[1] for coord in walls]) + 1
- return height, width
-
-def layout_to_graph(layout):
- """Return a networkx.Graph object given the layout
- """
- graph = networkx.Graph()
- height, width = get_hw(layout)
- walls = layout['walls']
- for x in range(width):
- for y in range(height):
- if (x, y) not in walls:
- # this is a free position, get its neighbors
- for delta_x, delta_y in ((1,0), (-1,0), (0,1), (0,-1)):
- neighbor = (x + delta_x, y + delta_y)
- # we don't need to check for getting neighbors out of the maze
- # because our mazes are all surrounded by walls, i.e. our
- # deltas will not put us out of the maze
- if neighbor not in walls:
- # this is a genuine neighbor, add an edge in the graph
- graph.add_edge((x, y), neighbor)
- return graph
-
if __name__ == '__main__':
# either read a file or read from stdin
@@ -44,8 +19,8 @@ if __name__ == '__main__':
# first of all, check for symmetry
# if something is found on the left, it should be found center-mirrored on the right
- height, width = get_hw(layout)
- known = layout['walls']+layout['food']
+ width, height = layout['shape']
+ known = layout['walls'] | set(layout['food'])
layout['empty'] = [(x,y) for x in range(width) for y in range(height) if (x,y) not in known]
for x in range(width // 2):
for y in range(height):
@@ -56,14 +31,14 @@ if __name__ == '__main__':
print(f'{flname}: Layout is not symmetric {coord} != {cmirror}')
- graph = layout_to_graph(layout)
+ graph = walls_to_graph(layout['walls'])
# check for dead_ends
for node, degree in graph.degree():
if degree < 2:
print(f'{flname}: found dead end in {node}')
- if networkx.node_connectivity(graph) < 2:
- entrance = networkx.minimum_node_cut(graph).pop()
+ if nx.node_connectivity(graph) < 2:
+ entrance = nx.minimum_node_cut(graph).pop()
print(f'{flname}: Detected chamber, entrance: {entrance}')
diff --git a/demo/benchmark_game.py b/demo/benchmark_game.py
index 1f5df3c6..cdc6dedc 100644
--- a/demo/benchmark_game.py
+++ b/demo/benchmark_game.py
@@ -1,8 +1,14 @@
#!/usr/bin/env python3
+import argparse
+import cProfile
+import functools
+import subprocess
+import timeit
+
from pelita.layout import parse_layout
from pelita.game import run_game
-from pelita.player import stopping_player
+from pelita.player import stopping_player, nq_random_player
LAYOUT="""
##################################
@@ -27,15 +33,41 @@ LAYOUT="""
layout = parse_layout(LAYOUT)
-def run():
- return run_game([stopping_player, stopping_player], max_rounds=10, layout_dict=layout)
+def run(teams, max_rounds):
+ return run_game(teams, max_rounds=max_rounds, layout_dict=layout, print_result=False, allow_exceptions=True, store_output=subprocess.DEVNULL)
+
+def parse_args():
+ parser = argparse.ArgumentParser(description='Benchmark pelita run_game')
+ parser.add_argument('--repeat', help="Number of repeats of timeit.", default=5, type=int)
+ parser.add_argument('--number', help="Number of iterations inside timeit.", default=10, type=int)
+ parser.add_argument('--max-rounds', help="Max rounds.", default=300, type=int)
+
+ parser.add_argument('--cprofile', help="Show cProfile output with test teams (int).", default=None, type=int)
+
+ return parser.parse_args()
if __name__ == '__main__':
- import timeit
- REPEAT = 5
- NUMBER = 10
- result = min(timeit.repeat(run, repeat=REPEAT, number=NUMBER))
- print("Fastest out of {}: {}".format(REPEAT, result))
-
- import cProfile
- cProfile.runctx("""run()""", globals(), locals())
+ args = parse_args()
+ REPEAT = args.repeat
+ NUMBER = args.number
+ MAX_ROUNDS = args.max_rounds
+
+ tests = [
+ ("Stopping", [stopping_player, stopping_player]),
+ ("NQ_Random", [nq_random_player, nq_random_player]),
+ ("Stopping (remote)", ["pelita/player/StoppingPlayer.py", "pelita/player/StoppingPlayer.py"]),
+ ("NQ_Random (remote)", ["pelita/player/RandomPlayers.py", "pelita/player/RandomPlayers.py"]),
+ ]
+
+ if args.cprofile is None:
+ print(f"Running {NUMBER} times with max {MAX_ROUNDS} rounds. Fastest out of {REPEAT}:")
+
+ for name, teams in tests:
+ result = min(timeit.repeat(functools.partial(run, teams=teams, max_rounds=MAX_ROUNDS), repeat=REPEAT, number=NUMBER))
+ print(f"{name:<20}: {result}")
+
+ else:
+ name, teams = tests[args.cprofile]
+ print(f"Running cProfile for teams {name} with max {MAX_ROUNDS} rounds:")
+ max_rounds = MAX_ROUNDS
+ cProfile.runctx("""run(teams, max_rounds)""", globals(), locals())
diff --git a/pelita/game.py b/pelita/game.py
index 04cc7e58..3c1c816b 100644
--- a/pelita/game.py
+++ b/pelita/game.py
@@ -268,6 +268,8 @@ def setup_game(team_specs, *, layout_dict, max_rounds=300, layout_name="", seed=
raise ValueError("Number of bots in layout must be 4.")
width, height = layout.wall_dimensions(layout_dict['walls'])
+ if not (width, height) == layout_dict['shape']:
+ raise ValueError(f"layout_dict['walls'] does not match layout_dict['shape'].")
for idx, pos in enumerate(layout_dict['bots']):
if pos in layout_dict['walls']:
@@ -300,8 +302,11 @@ def setup_game(team_specs, *, layout_dict, max_rounds=300, layout_name="", seed=
game_state = dict(
### The layout attributes
- #: Walls. List of (int, int)
- walls=layout_dict['walls'][:],
+ #: Walls. Set of (int, int)
+ walls=set(layout_dict['walls']),
+
+ #: Shape of the maze. (int, int)
+ shape=layout_dict['shape'],
#: Food per team. List of sets of (int, int)
food=food,
@@ -507,6 +512,7 @@ def prepare_bot_state(game_state, idx=None):
enemy_team = 1 - own_team
enemy_positions = game_state['bots'][enemy_team::2]
noised_positions = noiser(walls=game_state['walls'],
+ shape=game_state['shape'],
bot_position=bot_position,
enemy_positions=enemy_positions,
noise_radius=game_state['noise_radius'],
@@ -560,6 +566,7 @@ def prepare_bot_state(game_state, idx=None):
if bot_initialization:
bot_state.update({
'walls': game_state['walls'], # only in initial round
+ 'shape': game_state['shape'], # only in initial round
'seed': seed # only used in set_initial phase
})
@@ -739,6 +746,7 @@ def apply_move(gamestate, bot_position):
score = gamestate["score"]
food = gamestate["food"]
walls = gamestate["walls"]
+ shape = gamestate["shape"]
food = gamestate["food"]
n_round = gamestate["round"]
kills = gamestate["kills"]
@@ -756,7 +764,7 @@ def apply_move(gamestate, bot_position):
team_errors = gamestate["errors"][team]
# the allowed moves for the current bot
- legal_positions = get_legal_positions(walls, gamestate["bots"][gamestate["turn"]])
+ legal_positions = get_legal_positions(walls, shape, gamestate["bots"][gamestate["turn"]])
# unless we have already made an error, check if we made a legal move
if not (n_round, turn) in team_errors:
@@ -787,12 +795,11 @@ def apply_move(gamestate, bot_position):
_logger.info(f"Bot {turn} moves to {bot_position}.")
# then apply rules
# is bot in home or enemy territory
- x_walls = [i[0] for i in walls]
- boundary = max(x_walls) / 2 # float
+ boundary = gamestate['shape'][0] / 2
if team == 0:
bot_in_homezone = bot_position[0] < boundary
elif team == 1:
- bot_in_homezone = bot_position[0] > boundary
+ bot_in_homezone = bot_position[0] >= boundary
# update food list
if not bot_in_homezone:
if bot_position in food[1 - team]:
@@ -806,7 +813,7 @@ def apply_move(gamestate, bot_position):
for enemy_idx in killed_enemies:
_logger.info(f"Bot {turn} eats enemy bot {enemy_idx} at {bot_position}.")
score[team] = score[team] + KILL_POINTS
- init_positions = initial_positions(walls)
+ init_positions = initial_positions(walls, shape)
bots[enemy_idx] = init_positions[enemy_idx]
kills[turn] += 1
deaths[enemy_idx] += 1
@@ -818,7 +825,7 @@ def apply_move(gamestate, bot_position):
if len(enemies_on_target) > 0:
_logger.info(f"Bot {turn} was eaten by bots {enemies_on_target} at {bot_position}.")
score[1 - team] = score[1 - team] + KILL_POINTS
- init_positions = initial_positions(walls)
+ init_positions = initial_positions(walls, shape)
bots[turn] = init_positions[turn]
deaths[turn] += 1
kills[enemies_on_target[0]] += 1
diff --git a/pelita/gamestate_filters.py b/pelita/gamestate_filters.py
index 84c7eb7c..e43de6ce 100644
--- a/pelita/gamestate_filters.py
+++ b/pelita/gamestate_filters.py
@@ -5,7 +5,7 @@ import copy
### The main function
-def noiser(walls, bot_position, enemy_positions, noise_radius=5, sight_distance=5, rnd=None):
+def noiser(walls, shape, bot_position, enemy_positions, noise_radius=5, sight_distance=5, rnd=None):
"""Function to make bot positions noisy in a game state.
Applies uniform noise in maze space. Noise will only be applied if the
@@ -36,7 +36,7 @@ def noiser(walls, bot_position, enemy_positions, noise_radius=5, sight_distance=
Parameters
----------
- walls : list of (int, int)
+ walls : set of (int, int)
noise_radius : int, optional, default: 5
the radius for the uniform noise
sight_distance : int, optional, default: 5
@@ -67,7 +67,7 @@ def noiser(walls, bot_position, enemy_positions, noise_radius=5, sight_distance=
if cur_distance is None or cur_distance > sight_distance:
# If so then alter the position of the enemy
- new_pos, noisy_flag = alter_pos(b, noise_radius, rnd, walls)
+ new_pos, noisy_flag = alter_pos(b, noise_radius, rnd, walls, shape)
noised_positions[count] = new_pos
is_noisy[count] = noisy_flag
else:
@@ -80,26 +80,22 @@ def noiser(walls, bot_position, enemy_positions, noise_radius=5, sight_distance=
### The subfunctions
-def alter_pos(bot_pos, noise_radius, rnd, walls):
+def alter_pos(bot_pos, noise_radius, rnd, walls, shape):
""" alter the position """
- # extracting from walls the maximum width and height
- max_walls = max(walls)
- min_walls = min(walls)
-
# get a list of possible positions
x_min, x_max = bot_pos[0] - noise_radius, bot_pos[0] + noise_radius
y_min, y_max = bot_pos[1] - noise_radius, bot_pos[1] + noise_radius
- # filter them so the we return no positions outsided the maze
+ # filter them so that we return no positions outside the maze
if x_min < 0:
x_min = 1
- if x_max > max_walls[0]:
- x_max = max_walls[0]
+ if x_max >= shape[0]:
+ x_max = shape[0] - 1
if y_min < 0:
y_min = 1
- if y_max > max_walls[1]:
- y_max = max_walls[1]
+ if y_max >= shape[1]:
+ y_max = shape[1] - 1
possible_positions = [
(i, j)
diff --git a/pelita/layout.py b/pelita/layout.py
index a45a6f3e..3039bbc2 100644
--- a/pelita/layout.py
+++ b/pelita/layout.py
@@ -111,16 +111,18 @@ def parse_layout(layout_str, food=None, bots=None):
Return a dict
- {'walls': list_of_wall_coordinates,
+ {'walls': set_of_wall_coordinates,
'food' : list_of_food_coordinates,
- 'bots' : list_of_bot_coordinates in the order (a,x,b,y) }
+ 'bots' : list_of_bot_coordinates in the order (a,x,b,y),
+ 'shape': tuple of (height, width) of the layout}
In the example above:
- {'walls': [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 4), (2, 0),
+ {'walls': {(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 4), (2, 0),
(2, 4), (3, 0), (3, 2), (3, 4), (4, 0), (4, 2), (4, 4), (5, 0),
- (5, 4), (6, 0), (6, 4), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4)],
+ (5, 4), (6, 0), (6, 4), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4)},
'food': [(3, 3), (4, 1)],
- 'bots': [(1, 1), (6, 2), (1, 2), (6, 3)]}
+ 'bots': [(1, 1), (6, 2), (1, 2), (6, 3)],
+ 'shape': (8, 4)}
Additional food and bots can be passed:
@@ -135,7 +137,7 @@ def parse_layout(layout_str, food=None, bots=None):
food = []
# set empty default values
- lwalls = []
+ lwalls = set()
lfood = []
lbots = [None] * 4
@@ -190,7 +192,7 @@ def parse_layout(layout_str, food=None, bots=None):
# assign the char to the corresponding list
if char == '#':
# wall
- lwalls.append(coord)
+ lwalls.add(coord)
elif char == '.':
# food
lfood.append(coord)
@@ -212,7 +214,6 @@ def parse_layout(layout_str, food=None, bots=None):
missing_bots.append(BOT_I2N[i])
if missing_bots:
raise ValueError(f"Missing bot(s): {missing_bots}")
- lwalls.sort()
lfood.sort()
# if additional food was supplied, we add it
@@ -239,25 +240,27 @@ def parse_layout(layout_str, food=None, bots=None):
# build parsed layout, ensuring walls and food are sorted
parsed_layout = {
- 'walls': sorted(lwalls),
+ 'walls': lwalls,
'food': sorted(lfood),
- 'bots': lbots
+ 'bots': lbots,
+ 'shape': (width, height)
}
return parsed_layout
-def layout_as_str(*, walls, food=None, bots=None):
+def layout_as_str(*, walls, food=None, bots=None, shape=None):
"""Given a dictionary with walls, food and bots coordinates return a string layout representation
Example:
Given:
- {'walls': [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 4), (2, 0),
+ {'walls': {(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 4), (2, 0),
(2, 4), (3, 0), (3, 2), (3, 4), (4, 0), (4, 2), (4, 4), (5, 0),
- (5, 4), (6, 0), (6, 4), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4)],
+ (5, 4), (6, 0), (6, 4), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4)},
'food': [(3, 3), (4, 1)],
- 'bots': [(1, 1), (6, 2), (1, 2), (6, 3)]}
+ 'bots': [(1, 1), (6, 2), (1, 2), (6, 3)],
+ 'shape': (8, 4)}
Return:
########
@@ -268,10 +271,14 @@ def layout_as_str(*, walls, food=None, bots=None):
Overlapping items are discarded. When overlapping, walls take precedence over
bots, which take precedence over food.
+
+ The shape is optional. When it does not match the borders of the maze, a ValueError
+ is raised.
"""
- walls = sorted(walls)
- width = max(walls)[0] + 1
- height = max(walls)[1] + 1
+ width, height = wall_dimensions(walls)
+
+ if shape is not None and not (width, height) == shape:
+ raise ValueError(f"Given shape {shape} does not match width and height of layout {(width, height)}.")
# initialized empty containers
if food is None:
@@ -299,13 +306,14 @@ def layout_as_str(*, walls, food=None, bots=None):
def wall_dimensions(walls):
- """ Given a list of walls, returns a tuple of (width, height)."""
- width = max(walls)[0] + 1
- height = max(walls)[1] + 1
+ """ Given a list of walls, returns the shape of the maze as a tuple of (width, height)"""
+ max_elem = max(walls)
+ width = max_elem[0] + 1
+ height = max_elem[1] + 1
return (width, height)
-def initial_positions(walls):
+def initial_positions(walls, shape):
"""Calculate initial positions.
Given the list of walls, returns the free positions that are closest to the
@@ -314,8 +322,7 @@ def initial_positions(walls):
for judging what is closest. On equal distances, a smaller distance in the
x value is preferred.
"""
- width = max(walls)[0] + 1
- height = max(walls)[1] + 1
+ width, height = shape
left_start = (1, height - 2)
left = []
@@ -370,13 +377,13 @@ def initial_positions(walls):
return [left[0], right[0], left[1], right[1]]
-def get_legal_positions(walls, bot_position):
+def get_legal_positions(walls, shape, bot_position):
""" Returns all legal positions that a bot at `bot_position`
can go to.
Parameters
----------
- walls : list
+ walls : set of (int, int)
position of the walls of current layout.
bot_position: tuple
position of current bot.
@@ -391,7 +398,7 @@ def get_legal_positions(walls, bot_position):
ValueError
if bot_position invalid or on wall
"""
- width, height = wall_dimensions(walls)
+ width, height = shape
if not (0, 0) <= bot_position < (width, height):
raise ValueError(f"Position {bot_position} not inside maze ({width}x{height}).")
if bot_position in walls:
diff --git a/pelita/network.py b/pelita/network.py
index 7cd5f29c..0a444ef4 100644
--- a/pelita/network.py
+++ b/pelita/network.py
@@ -96,6 +96,14 @@ def bind_socket(socket, address, option_hint=None):
(option_hint,), file=sys.stderr)
raise
+
+class SetEncoder(json.JSONEncoder):
+ def default(self, obj):
+ if isinstance(obj, set):
+ return list(obj)
+ return json.JSONEncoder.default(self, obj)
+
+
def json_default_handler(o):
""" Pythons built-in json handler has problems converting numpy.in64
to json. By adding this method as a default= to json.dumps, we can
@@ -164,7 +172,7 @@ class ZMQConnection:
# race condition if a connection was closed between poll and send.
# NOBLOCK should raise, so we can catch that
message_obj = {"__uuid__": msg_id, "__action__": action, "__data__": data}
- json_message = json.dumps(message_obj)
+ json_message = json.dumps(message_obj, cls=SetEncoder)
try:
self.socket.send_unicode(json_message, flags=zmq.NOBLOCK)
except zmq.ZMQError as e:
@@ -275,7 +283,6 @@ class ZMQConnection:
def __repr__(self):
return "ZMQConnection(%r)" % self.socket
-
class ZMQPublisher:
""" Sets up a simple Publisher which sends all viewed events
over a zmq connection.
@@ -298,7 +305,7 @@ class ZMQPublisher:
info['gameover'] = True
_logger.debug(f"--#> [{action}] %r", info)
message = {"__action__": action, "__data__": data}
- as_json = json.dumps(message)
+ as_json = json.dumps(message, cls=SetEncoder)
self.socket.send_unicode(as_json)
def show_state(self, game_state):
diff --git a/pelita/player/team.py b/pelita/player/team.py
index dc693bf7..e2ded2fc 100644
--- a/pelita/player/team.py
+++ b/pelita/player/team.py
@@ -6,7 +6,6 @@ import random
import subprocess
import sys
import traceback
-from functools import reduce
from io import StringIO
from pathlib import Path
@@ -14,12 +13,31 @@ import zmq
from .. import layout
from ..exceptions import PlayerDisconnected, PlayerTimeout
-from ..layout import layout_as_str, parse_layout, wall_dimensions, BOT_I2N
+from ..layout import layout_as_str, BOT_I2N
from ..network import ZMQClientError, ZMQConnection, ZMQReplyTimeout, ZMQUnreachablePeer
_logger = logging.getLogger(__name__)
+def _ensure_list_tuples(list):
+ """ Ensures that an iterable is a list of position tuples. """
+ return [tuple(item) for item in list]
+
+def _ensure_set_tuples(set):
+ """ Ensures that an iterable is a set of position tuples. """
+ return {tuple(item) for item in set}
+
+
+def create_homezones(shape):
+ width, height = shape
+ return [
+ {(x, y) for x in range(0, width // 2)
+ for y in range(0, height)},
+ {(x, y) for x in range(width // 2, width)
+ for y in range(0, height)}
+ ]
+
+
class Team:
"""
Wraps a move function and forwards it the `set_initial`
@@ -78,7 +96,16 @@ class Team:
self._bot_track = [[], []]
# Store the walls, which are only transmitted once
- self._walls = game_state['walls']
+ self._walls = _ensure_set_tuples(game_state['walls'])
+
+ # Store the shape, which is only transmitted once
+ self._shape = tuple(game_state['shape'])
+
+ # Cache the initial positions so that we don’t have to calculate them at each step
+ self._initial_positions = layout.initial_positions(self._walls, self._shape)
+
+ # Cache the homezone so that we don’t have to create it at each step
+ self._homezone = create_homezones(self._shape)
return self.team_name
@@ -98,6 +125,9 @@ class Team:
move : dict
"""
me = make_bots(walls=self._walls,
+ shape=self._shape,
+ initial_positions=self._initial_positions,
+ homezone=self._homezone,
team=game_state['team'],
enemy=game_state['enemy'],
round=game_state['round'],
@@ -107,7 +137,7 @@ class Team:
team = me._team
for idx, mybot in enumerate(team):
- # If a bot has been killed, we reset it’s bot track
+ # If a bot has been killed, we reset its bot track
if mybot.was_killed:
self._bot_track[idx] = []
@@ -117,7 +147,7 @@ class Team:
for idx, mybot in enumerate(team):
# If the track of any bot is empty,
- # Add its current position
+ # add its current position
if me._bot_turn != idx:
self._bot_track[idx].append(mybot.position)
@@ -397,26 +427,13 @@ def make_team(team_spec, team_name=None, zmq_context=None, idx=None, store_outpu
return team_player, zmq_context
-def create_homezones(walls):
- width = max(walls)[0]+1
- height = max(walls)[1]+1
- return [
- [(x, y) for x in range(0, width // 2)
- for y in range(0, height)],
- [(x, y) for x in range(width // 2, width)
- for y in range(0, height)]
- ]
-
-def _ensure_tuples(list):
- """ Ensures that an iterable is a list of position tuples. """
- return [tuple(item) for item in list]
-
class Bot:
def __init__(self, *, bot_index,
is_on_team,
position,
initial_position,
walls,
+ shape,
homezone,
food,
score,
@@ -443,10 +460,11 @@ class Bot:
self.random = random
self.position = tuple(position)
self._initial_position = tuple(initial_position)
- self.walls = _ensure_tuples(walls)
+ self.walls = walls
- self.homezone = _ensure_tuples(homezone)
- self.food = _ensure_tuples(food)
+ self.homezone = homezone
+ self.food = food
+ self.shape = shape
self.score = score
self.kills = kills
self.deaths = deaths
@@ -554,8 +572,7 @@ class Bot:
def _repr_html_(self):
""" Jupyter-friendly representation. """
bot = self
- width = max(bot.walls)[0] + 1
- height = max(bot.walls)[1] + 1
+ width, height = bot.shape
with StringIO() as out:
out.write("<table>")
@@ -589,8 +606,6 @@ class Bot:
def __str__(self):
bot = self
- width = max(bot.walls)[0] + 1
- height = max(bot.walls)[1] + 1
if bot.is_blue:
blue = bot if not bot.turn else bot.other
@@ -628,9 +643,10 @@ class Bot:
with StringIO() as out:
out.write(header)
- layout = layout_as_str(walls=bot.walls[:],
+ layout = layout_as_str(walls=bot.walls.copy(),
food=bot.food + bot.enemy[0].food,
- bots=bot_positions)
+ bots=bot_positions,
+ shape=bot.shape)
out.write(str(layout))
out.write(footer)
@@ -638,14 +654,12 @@ class Bot:
# def __init__(self, *, bot_index, position, initial_position, walls, homezone, food, is_noisy, score, random, round, is_blue):
-def make_bots(*, walls, team, enemy, round, bot_turn, rng):
+def make_bots(*, walls, shape, initial_positions, homezone, team, enemy, round, bot_turn, rng):
bots = {}
team_index = team['team_index']
enemy_index = enemy['team_index']
- homezone = create_homezones(walls)
- initial_positions = layout.initial_positions(walls)
team_initial_positions = initial_positions[team_index::2]
enemy_initial_positions = initial_positions[enemy_index::2]
@@ -659,8 +673,9 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
was_killed=team['bot_was_killed'][idx],
is_noisy=False,
error_count=team['error_count'],
- food=team['food'],
+ food=_ensure_list_tuples(team['food']),
walls=walls,
+ shape=shape,
round=round,
bot_turn=bot_turn,
bot_char=BOT_I2N[team_index + idx*2],
@@ -683,8 +698,9 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
was_killed=enemy['bot_was_killed'][idx],
is_noisy=enemy['is_noisy'][idx],
error_count=enemy['error_count'],
- food=enemy['food'],
+ food=_ensure_list_tuples(enemy['food']),
walls=walls,
+ shape=shape,
round=round,
bot_char = BOT_I2N[team_index + idx*2],
random=rng,
@@ -700,5 +716,3 @@ def make_bots(*, walls, team, enemy, round, bot_turn, rng):
bots['enemy'] = enemy_bots
return team_bots[bot_turn]
-
-
diff --git a/pelita/ui/tk_canvas.py b/pelita/ui/tk_canvas.py
index 671ac456..025f7e5d 100644
--- a/pelita/ui/tk_canvas.py
+++ b/pelita/ui/tk_canvas.py
@@ -8,6 +8,7 @@ import tkinter
import tkinter.font
from ..game import next_round_turn
+from ..player.team import _ensure_list_tuples
from .tk_sprites import BotSprite, Food, Wall, col
from .tk_utils import wm_delete_window_handler
from .tk_sprites import BotSprite, Food, Wall, RED, BLUE, YELLOW, GREY, BROWN
@@ -15,10 +16,6 @@ from .. import layout
_logger = logging.getLogger(__name__)
-def _ensure_tuples(list):
- """ Ensures that an iterable is a list of position tuples. """
- return [tuple(item) for item in list]
-
def guess_size(display_string, bounding_width, bounding_height, rel_size=0):
no_lines = display_string.count("\n") + 1
@@ -341,8 +338,7 @@ class TkApplication:
def init_mesh(self, game_state):
- width = max(game_state['walls'])[0] + 1
- height = max(game_state['walls'])[1] + 1
+ width, height = game_state['shape']
if self.geometry is None:
screensize = (
@@ -425,8 +421,8 @@ class TkApplication:
self.size_changed = False
def draw_universe(self, game_state):
- self.mesh_graph.num_x = max(game_state['walls'])[0] + 1
- self.mesh_graph.num_y = max(game_state['walls'])[1] + 1
+ self.mesh_graph.num_x = game_state['shape'][0]
+ self.mesh_graph.num_y = game_state['shape'][1]
self.draw_grid()
self.draw_selected(game_state)
@@ -578,7 +574,7 @@ class TkApplication:
has_food = pos in game_state['food']
is_wall = pos in game_state['walls']
bots = [idx for idx, bot in enumerate(game_state['bots']) if bot==pos]
- if pos[0] < (max(game_state['walls'])[0] + 1) // 2:
+ if pos[0] <= (game_state['shape'][0] // 2):
zone = "blue"
else:
zone = "red"
@@ -796,9 +792,10 @@ class TkApplication:
skip_request = False
self._observed_steps.add(step)
# ensure walls, foods and bots positions are list of tuples
- game_state['walls'] = _ensure_tuples(game_state['walls'])
- game_state['food'] = _ensure_tuples(game_state['food'])
- game_state['bots'] = _ensure_tuples(game_state['bots'])
+ game_state['walls'] = _ensure_list_tuples(game_state['walls'])
+ game_state['food'] = _ensure_list_tuples(game_state['food'])
+ game_state['bots'] = _ensure_list_tuples(game_state['bots'])
+ game_state['shape'] = tuple(game_state['shape'])
self.update(game_state)
if self._stop_after is not None:
if self._stop_after == 0:
diff --git a/pelita/utils.py b/pelita/utils.py
index d92dfad5..b56f3c72 100644
--- a/pelita/utils.py
+++ b/pelita/utils.py
@@ -1,11 +1,11 @@
import random
-import networkx
+import networkx as nx
-from .player.team import make_bots
+from .player.team import make_bots, create_homezones
from .layout import (get_random_layout, get_layout_by_name, get_available_layouts,
- parse_layout, BOT_N2I)
+ parse_layout, BOT_N2I, initial_positions, wall_dimensions)
RNG = random.Random()
@@ -14,8 +14,8 @@ def walls_to_graph(walls):
Parameters
----------
- walls : list[(x0,y0), (x1,y1), ...]
- a list of wall coordinates
+ walls : set[(x0,y0), (x1,y1), ...]
+ a set of wall coordinates
Returns
-------
@@ -32,10 +32,9 @@ def walls_to_graph(walls):
adjacent squares. Adjacent means that you can go from one square to one of
its adjacent squares by making ore single step (up, down, left, or right).
"""
- graph = networkx.Graph()
- extreme = max(walls)
- width = extreme[0] + 1
- height = extreme[1] + 1
+ graph = nx.Graph()
+ width, height = wall_dimensions(walls)
+
for x in range(width):
for y in range(height):
if (x, y) not in walls:
@@ -110,7 +109,7 @@ def run_background_game(*, blue_move, red_move, layout=None, max_rounds=300, see
game_state : dict
the final game state as a dictionary. Dictionary keys are:
- 'seed' : the seed used to initialize the random number generator
- - 'walls' : list of walls coordinates for the layout
+ - 'walls' : set of wall coordinates for the layout
- 'layout' : the name of the used layout
- 'round' : the round at which the game was over
- 'draw' : True if the game ended in a draw
@@ -246,7 +245,7 @@ def setup_test_game(*, layout, is_blue=True, round=None, score=None, seed=None,
layout, layout_name = _parse_layout_arg(layout=layout, food=food, bots=bots)
- width = max(layout['walls'])[0] + 1
+ width, height = layout['shape']
def split_food(width, food):
team_food = [set(), set()]
@@ -296,7 +295,10 @@ def setup_test_game(*, layout, is_blue=True, round=None, score=None, seed=None,
'name': "red" if is_blue else "blue"
}
- bot = make_bots(walls=layout['walls'][:],
+ bot = make_bots(walls=layout['walls'].copy(),
+ shape=layout['shape'],
+ initial_positions=initial_positions(layout['walls'], layout['shape']),
+ homezone=create_homezones(layout['shape']),
team=team,
enemy=enemy,
round=round,
diff --git a/pelita/viewer.py b/pelita/viewer.py
index 73ab01b9..c9d6c414 100644
--- a/pelita/viewer.py
+++ b/pelita/viewer.py
@@ -6,6 +6,7 @@ import logging
import zmq
from . import layout
+from .network import SetEncoder
_logger = logging.getLogger(__name__)
@@ -128,7 +129,7 @@ class ReplyToViewer:
def _send(self, message):
socks = dict(self.pollout.poll(300))
if socks.get(self.sock) == zmq.POLLOUT:
- as_json = json.dumps(message)
+ as_json = json.dumps(message, cls=SetEncoder)
self.sock.send_unicode(as_json, flags=zmq.NOBLOCK)
def show_state(self, game_state):
@@ -142,7 +143,7 @@ class ReplayWriter:
self.stream = stream
def _send(self, message):
- as_json = json.dumps(message)
+ as_json = json.dumps(message, cls=SetEncoder)
self.stream.write(as_json)
# We use 0x04 (EOT) as a separator between the events.
# The additional newline is for improved readability
|
Add width and height to the layout dictionary
As it is needed in several places, it makes sense to just stick two additional keys into the layout dictionary. Fixing this bug also means getting rid of all `max(walls)[0]+1`, `max(walls)[1]+1`, `sorted(walls)[-1][0]`, `sorted(walls)[-1][1]` spread in the pelita and pelita_template code.
|
ASPP/pelita
|
diff --git a/test/test_filter_gamestates.py b/test/test_filter_gamestates.py
index a12fcd27..2110f957 100644
--- a/test/test_filter_gamestates.py
+++ b/test/test_filter_gamestates.py
@@ -85,10 +85,11 @@ def test_noiser_no_negative_coordinates(bot_id):
gamestate = make_gamestate()
old_bots = gamestate["bots"][:]
walls = gamestate['walls']
+ shape = gamestate['shape']
bot_position = gamestate['bots'][bot_id]
enemy_group = 1 - (bot_id // 2)
enemy_positions = gamestate['bots'][enemy_group::2]
- noised = gf.noiser(walls, bot_position=bot_position, enemy_positions=enemy_positions,
+ noised = gf.noiser(walls, shape=shape, bot_position=bot_position, enemy_positions=enemy_positions,
noise_radius=5, sight_distance=5, rnd=None)
new_bots = noised["enemy_positions"]
print(noised)
@@ -291,6 +292,7 @@ def test_noiser_noising_at_noise_radius_extreme(ii):
team_bots = old_bots[team_id::2]
enemy_bots = old_bots[1 - team_id::2]
noised = gf.noiser(walls=gamestate["walls"],
+ shape=gamestate["shape"],
bot_position=gamestate["bots"][gamestate["turn"]],
enemy_positions=enemy_bots,
noise_radius=50, sight_distance=5, rnd=None)
@@ -326,6 +328,7 @@ def test_uniform_noise_manhattan(noise_radius, expected, test_layout=None):
position_bucket = collections.defaultdict(int)
for i in range(200):
noised = gf.noiser(walls=parsed['walls'],
+ shape=parsed["shape"],
bot_position=parsed['bots'][1],
enemy_positions=[parsed['bots'][0]],
noise_radius=noise_radius)
@@ -474,6 +477,7 @@ def test_uniform_noise_manhattan_graphical_distance(test_layout, is_noisy):
NUM_TESTS = 400
for i in range(NUM_TESTS):
noised = gf.noiser(walls=parsed['walls'],
+ shape=parsed['shape'],
bot_position=parsed['bots'][1],
enemy_positions=[parsed['bots'][0]])
# use default values for radius and distance
@@ -511,6 +515,7 @@ def test_uniform_noise_4_bots_manhattan():
for i in range(200):
noised = gf.noiser(walls=parsed['walls'],
+ shape=parsed['shape'],
bot_position=parsed['bots'][1],
enemy_positions=parsed['bots'][0::2])
@@ -544,6 +549,7 @@ def test_uniform_noise_4_bots_no_noise_manhattan():
for i in range(200):
noised = gf.noiser(walls=parsed['walls'],
+ shape=parsed['shape'],
bot_position=parsed['bots'][1],
enemy_positions=parsed['bots'][0::2])
@@ -575,6 +581,7 @@ def test_noise_manhattan_failure():
# check a few times
for i in range(5):
noised = gf.noiser(walls=parsed['walls'],
+ shape=parsed['shape'],
bot_position=parsed['bots'][1],
enemy_positions=parsed['bots'][0::2])
diff --git a/test/test_game.py b/test/test_game.py
index 23916ac9..9d3be610 100644
--- a/test/test_game.py
+++ b/test/test_game.py
@@ -34,8 +34,8 @@ def test_initial_positions_basic():
#x y #
########
"""
- walls = layout.parse_layout(simple_layout)['walls']
- out = initial_positions(walls)
+ parsed = layout.parse_layout(simple_layout)
+ out = initial_positions(parsed['walls'], parsed['shape'])
exp = [(1, 1), (6, 2), (1, 2), (6, 1)]
assert len(out) == 4
assert out == exp
@@ -72,7 +72,7 @@ def test_initial_positions_basic():
])
def test_initial_positions(simple_layout):
parsed = layout.parse_layout(simple_layout)
- i_pos = initial_positions(parsed['walls'])
+ i_pos = initial_positions(parsed['walls'], parsed['shape'])
expected = parsed['bots']
assert len(i_pos) == 4
assert i_pos == expected
@@ -85,7 +85,8 @@ def test_initial_positions_same_in_layout_random(layout_t):
parsed_l = layout.parse_layout(layout_string)
exp = parsed_l["bots"]
walls = parsed_l["walls"]
- out = initial_positions(walls)
+ shape = parsed_l["shape"]
+ out = initial_positions(walls, shape)
assert out == exp
@pytest.mark.parametrize('layout_name', layout.get_available_layouts())
@@ -95,14 +96,15 @@ def test_initial_positions_same_in_layout(layout_name):
parsed_l = layout.parse_layout(l)
exp = parsed_l["bots"]
walls = parsed_l["walls"]
- out = initial_positions(walls)
+ shape = parsed_l["shape"]
+ out = initial_positions(walls, shape)
assert out == exp
def test_get_legal_positions_basic():
"""Check that the output of legal moves contains all legal moves for one example layout"""
l = layout.get_layout_by_name(layout_name="small_100")
parsed_l = layout.parse_layout(l)
- legal_positions = get_legal_positions(parsed_l["walls"], parsed_l["bots"][0])
+ legal_positions = get_legal_positions(parsed_l["walls"], parsed_l["shape"], parsed_l["bots"][0])
exp = [(1, 4), (1, 6), (1, 5)]
assert legal_positions == exp
@@ -113,7 +115,7 @@ def test_get_legal_positions_random(layout_t, bot_idx):
layout_name, layout_string = layout_t # get_random_layout returns a tuple of name and string
parsed_l = layout.parse_layout(layout_string)
bot = parsed_l["bots"][bot_idx]
- legal_positions = get_legal_positions(parsed_l["walls"], bot)
+ legal_positions = get_legal_positions(parsed_l["walls"], parsed_l["shape"], bot)
for move in legal_positions:
assert move not in parsed_l["walls"]
assert abs((move[0] - bot[0])+(move[1] - bot[1])) <= 1
@@ -134,7 +136,7 @@ def test_play_turn_apply_error(turn):
# so that the error dictionaries are sane
game_state["round"] = 3
- illegal_position = game_state["walls"][0]
+ illegal_position = (0, 0) # should always be a wall
game_state_new = apply_move(game_state, illegal_position)
assert game_state_new["gameover"]
assert len(game_state_new["errors"][team]) == 5
@@ -150,7 +152,7 @@ def test_play_turn_fatal(turn):
fatal_list = [{}, {}]
fatal_list[team] = {"error":True}
game_state["fatal_errors"] = fatal_list
- move = get_legal_positions(game_state["walls"], game_state["bots"][turn])
+ move = get_legal_positions(game_state["walls"], game_state["shape"], game_state["bots"][turn])
game_state_new = apply_move(game_state, move[0])
assert game_state_new["gameover"]
assert game_state_new["whowins"] == int(not team)
@@ -161,11 +163,11 @@ def test_play_turn_illegal_position(turn):
game_state = setup_random_basic_gamestate()
game_state["turn"] = turn
team = turn % 2
- illegal_position = game_state["walls"][0]
+ illegal_position = (0, 0) # should always be a wall
game_state_new = apply_move(game_state, illegal_position)
assert len(game_state_new["errors"][team]) == 1
assert game_state_new["errors"][team][(1, turn)].keys() == set(["reason", "bot_position"])
- assert game_state_new["bots"][turn] in get_legal_positions(game_state["walls"], game_state["bots"][turn])
+ assert game_state_new["bots"][turn] in get_legal_positions(game_state["walls"], game_state["shape"], game_state["bots"][turn])
@pytest.mark.parametrize('turn', (0, 1, 2, 3))
@pytest.mark.parametrize('which_food', (0, 1))
@@ -729,6 +731,7 @@ def test_play_turn_move():
"food": parsed_l["food"],
"walls": parsed_l["walls"],
"bots": parsed_l["bots"],
+ "shape": parsed_l["shape"],
"max_rounds": 300,
"team_names": ("a", "b"),
"turn": turn,
@@ -746,7 +749,7 @@ def test_play_turn_move():
"fatal_errors": [{}, {}],
"rnd": random.Random()
}
- legal_positions = get_legal_positions(game_state["walls"], game_state["bots"][turn])
+ legal_positions = get_legal_positions(game_state["walls"], game_state["shape"], game_state["bots"][turn])
game_state_new = apply_move(game_state, legal_positions[0])
assert game_state_new["bots"][turn] == legal_positions[0]
diff --git a/test/test_layout.py b/test/test_layout.py
index 110fd98a..72363c71 100644
--- a/test/test_layout.py
+++ b/test/test_layout.py
@@ -56,18 +56,19 @@ def test_legal_layout():
######
"""
parsed_layout = parse_layout(layout)
- ewalls = []
+ ewalls = set()
for x in range(6):
for y in range(6):
if (x == 0 or x == 5) or (y == 0 or y == 5):
- ewalls.append((x,y))
- ewalls.extend([(3, 2),(2, 3)])
- ewalls.sort()
+ ewalls.add((x,y))
+ ewalls.update([(3, 2),(2, 3)])
efood = sorted([(2, 1), (1, 2), (4, 3), (3, 4)])
ebots = [(1, 3), (4, 2), (1, 4), (4, 1)]
assert parsed_layout['walls'] == ewalls
assert parsed_layout['food'] == efood
assert parsed_layout['bots'] == ebots
+ assert parsed_layout['shape'] == (6, 6)
+ assert wall_dimensions(parsed_layout['walls']) == parsed_layout['shape']
def test_legal_layout_with_added_items():
layout = """
@@ -81,18 +82,19 @@ def test_legal_layout_with_added_items():
added_food = [(1,1), (4,4)]
added_bots = {'b': (1,4)}
parsed_layout = parse_layout(layout, food=added_food, bots=added_bots)
- ewalls = []
+ ewalls = set()
for x in range(6):
for y in range(6):
if (x == 0 or x == 5) or (y == 0 or y == 5):
- ewalls.append((x,y))
- ewalls.extend([(3, 2),(2, 3)])
- ewalls.sort()
+ ewalls.add((x,y))
+ ewalls.update([(3, 2),(2, 3)])
efood = sorted([(2, 1), (1, 2), (4, 3), (3, 4)]+added_food)
ebots = [(1, 3), (4, 2), (1, 4), (4, 1)]
assert parsed_layout['walls'] == ewalls
assert parsed_layout['food'] == efood
assert parsed_layout['bots'] == ebots
+ assert parsed_layout['shape'] == (6, 6)
+ assert wall_dimensions(parsed_layout['walls']) == parsed_layout['shape']
def test_hole_in_horizontal_border():
layout = """
@@ -335,7 +337,7 @@ def test_legal_positions(pos, legal_positions):
#xy #
###### """)
parsed = parse_layout(test_layout)
- assert set(get_legal_positions(parsed['walls'], pos)) == legal_positions
+ assert set(get_legal_positions(parsed['walls'], parsed['shape'], pos)) == legal_positions
@pytest.mark.parametrize('pos', [
@@ -354,7 +356,7 @@ def test_legal_positions_fail(pos):
###### """)
parsed = parse_layout(test_layout)
with pytest.raises(ValueError):
- get_legal_positions(parsed['walls'], pos)
+ get_legal_positions(parsed['walls'], parsed['shape'], pos)
def test_load():
diff --git a/test/test_network.py b/test/test_network.py
index 49de48e7..f1c6a6d5 100644
--- a/test/test_network.py
+++ b/test/test_network.py
@@ -76,6 +76,7 @@ def test_simpleclient(zmq_context):
(0, 2), (3, 2),
(0, 3), (1, 3), (2, 3), (3, 3),
],
+ 'shape': (4, 4)
}
}
}
diff --git a/test/test_team.py b/test/test_team.py
index 24ac7fd8..703ed53d 100644
--- a/test/test_team.py
+++ b/test/test_team.py
@@ -328,7 +328,7 @@ def test_initial_position(_n_test):
""" Test that out test team receives the correct initial positions."""
layout_name, layout_string = get_random_layout()
l = parse_layout(layout_string)
- initial_pos = initial_positions(l['walls'])
+ initial_pos = initial_positions(l['walls'], l['shape'])
def move(bot, state):
if bot.is_blue and bot.turn == 0:
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 10
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
networkx==3.2.1
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
-e git+https://github.com/ASPP/pelita.git@8c47e30cdf8b6dabf173ebfe71170e36b2aaa35e#egg=pelita
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
PyYAML==6.0.2
pyzmq==26.3.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- networkx==3.2.1
- numpy==2.0.2
- pytest-cov==6.0.0
- pyyaml==6.0.2
- pyzmq==26.3.0
prefix: /opt/conda/envs/pelita
|
[
"test/test_filter_gamestates.py::test_noiser_no_negative_coordinates[0]",
"test/test_filter_gamestates.py::test_noiser_no_negative_coordinates[1]",
"test/test_filter_gamestates.py::test_noiser_no_negative_coordinates[2]",
"test/test_filter_gamestates.py::test_noiser_no_negative_coordinates[3]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[0]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[1]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[2]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[3]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[4]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[5]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[6]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[7]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[8]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[9]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[10]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[11]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[12]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[13]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[14]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[15]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[16]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[17]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[18]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[19]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[20]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[21]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[22]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[23]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[24]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[25]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[26]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[27]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[28]",
"test/test_filter_gamestates.py::test_noiser_noising_at_noise_radius_extreme[29]",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan[0-expected0]",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan[1-expected1]",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan[2-expected2]",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan[5-expected3]",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan_graphical[0-\\n",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan_graphical[1-\\n",
"test/test_filter_gamestates.py::test_uniform_noise_manhattan_graphical_distance[\\n",
"test/test_filter_gamestates.py::test_uniform_noise_4_bots_manhattan",
"test/test_filter_gamestates.py::test_uniform_noise_4_bots_no_noise_manhattan",
"test/test_filter_gamestates.py::test_noise_manhattan_failure",
"test/test_game.py::test_initial_positions_basic",
"test/test_game.py::test_initial_positions[\\n",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t0]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t1]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t2]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t3]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t4]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t5]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t6]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t7]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t8]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t9]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t10]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t11]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t12]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t13]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t14]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t15]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t16]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t17]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t18]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t19]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t20]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t21]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t22]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t23]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t24]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t25]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t26]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t27]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t28]",
"test/test_game.py::test_initial_positions_same_in_layout_random[layout_t29]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_001]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_002]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_003]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_004]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_005]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_006]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_007]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_008]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_009]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_010]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_011]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_012]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_013]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_014]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_015]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_016]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_017]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_018]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_019]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_020]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_021]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_022]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_023]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_024]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_025]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_026]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_027]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_028]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_029]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_030]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_031]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_032]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_033]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_034]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_035]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_036]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_037]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_038]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_039]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_040]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_041]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_042]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_043]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_044]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_045]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_046]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_047]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_048]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_049]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_050]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_051]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_052]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_053]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_054]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_055]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_056]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_057]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_058]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_059]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_060]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_061]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_062]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_063]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_064]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_065]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_066]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_067]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_068]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_069]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_070]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_071]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_072]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_073]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_074]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_075]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_076]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_077]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_078]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_079]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_080]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_081]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_082]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_083]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_084]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_085]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_086]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_087]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_088]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_089]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_090]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_091]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_092]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_093]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_094]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_095]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_096]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_097]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_098]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_099]",
"test/test_game.py::test_initial_positions_same_in_layout[normal_100]",
"test/test_game.py::test_get_legal_positions_basic",
"test/test_game.py::test_get_legal_positions_random[0-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[0-layout_t49]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[1-layout_t49]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[2-layout_t49]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t0]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t1]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t2]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t3]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t4]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t5]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t6]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t7]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t8]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t9]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t10]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t11]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t12]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t13]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t14]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t15]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t16]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t17]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t18]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t19]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t20]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t21]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t22]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t23]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t24]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t25]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t26]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t27]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t28]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t29]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t30]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t31]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t32]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t33]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t34]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t35]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t36]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t37]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t38]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t39]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t40]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t41]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t42]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t43]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t44]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t45]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t46]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t47]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t48]",
"test/test_game.py::test_get_legal_positions_random[3-layout_t49]",
"test/test_game.py::test_play_turn_fatal[0]",
"test/test_game.py::test_play_turn_fatal[1]",
"test/test_game.py::test_play_turn_fatal[2]",
"test/test_game.py::test_play_turn_fatal[3]",
"test/test_game.py::test_play_turn_illegal_position[0]",
"test/test_game.py::test_play_turn_illegal_position[1]",
"test/test_game.py::test_play_turn_illegal_position[2]",
"test/test_game.py::test_play_turn_illegal_position[3]",
"test/test_game.py::test_play_turn_move",
"test/test_layout.py::test_legal_layout",
"test/test_layout.py::test_legal_layout_with_added_items",
"test/test_layout.py::test_legal_positions[pos0-legal_positions0]",
"test/test_layout.py::test_legal_positions[pos1-legal_positions1]",
"test/test_layout.py::test_legal_positions[pos2-legal_positions2]",
"test/test_layout.py::test_legal_positions[pos3-legal_positions3]",
"test/test_layout.py::test_legal_positions_fail[pos0]",
"test/test_layout.py::test_legal_positions_fail[pos1]",
"test/test_layout.py::test_legal_positions_fail[pos2]",
"test/test_layout.py::test_legal_positions_fail[pos3]",
"test/test_layout.py::test_legal_positions_fail[pos4]",
"test/test_team.py::test_initial_position[0]",
"test/test_team.py::test_initial_position[1]",
"test/test_team.py::test_initial_position[2]",
"test/test_team.py::test_initial_position[3]",
"test/test_team.py::test_initial_position[4]",
"test/test_team.py::test_initial_position[5]",
"test/test_team.py::test_initial_position[6]",
"test/test_team.py::test_initial_position[7]",
"test/test_team.py::test_initial_position[8]",
"test/test_team.py::test_initial_position[9]"
] |
[] |
[
"test/test_filter_gamestates.py::test_noiser_noising_odd_turn1",
"test/test_filter_gamestates.py::test_noiser_noising_odd_turn3",
"test/test_filter_gamestates.py::test_noiser_noising_even_turn0",
"test/test_filter_gamestates.py::test_noiser_noising_even_turn2",
"test/test_filter_gamestates.py::test_noiser_not_noising_own_team_even0",
"test/test_filter_gamestates.py::test_noiser_not_noising_own_team_even2",
"test/test_filter_gamestates.py::test_noiser_not_noising_own_team_odd1",
"test/test_filter_gamestates.py::test_noiser_not_noising_own_team_odd3",
"test/test_filter_gamestates.py::test_noiser_not_noising_at_noise_radius0",
"test/test_game.py::test_play_turn_apply_error[0]",
"test/test_game.py::test_play_turn_apply_error[1]",
"test/test_game.py::test_play_turn_apply_error[2]",
"test/test_game.py::test_play_turn_apply_error[3]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-0]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-1]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-2]",
"test/test_game.py::test_play_turn_eating_enemy_food[0-3]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-0]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-1]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-2]",
"test/test_game.py::test_play_turn_eating_enemy_food[1-3]",
"test/test_game.py::test_play_turn_killing[0]",
"test/test_game.py::test_play_turn_killing[1]",
"test/test_game.py::test_play_turn_killing[2]",
"test/test_game.py::test_play_turn_killing[3]",
"test/test_game.py::test_play_turn_friendly_fire[setups0]",
"test/test_game.py::test_play_turn_friendly_fire[setups1]",
"test/test_game.py::test_play_turn_friendly_fire[setups2]",
"test/test_game.py::test_play_turn_friendly_fire[setups3]",
"test/test_game.py::test_multiple_enemies_killing",
"test/test_game.py::test_suicide",
"test/test_game.py::test_cascade_kill",
"test/test_game.py::test_cascade_kill_2",
"test/test_game.py::test_cascade_kill_rescue_1",
"test/test_game.py::test_cascade_kill_rescue_2",
"test/test_game.py::test_cascade_suicide",
"test/test_game.py::test_moving_through_maze",
"test/test_game.py::test_play_turn_maxrounds[score0]",
"test/test_game.py::test_play_turn_maxrounds[score1]",
"test/test_game.py::test_play_turn_maxrounds[score2]",
"test/test_game.py::test_max_rounds",
"test/test_game.py::test_update_round_counter",
"test/test_game.py::test_last_round_check",
"test/test_game.py::test_error_finishes_game[team_errors0-False]",
"test/test_game.py::test_error_finishes_game[team_errors1-False]",
"test/test_game.py::test_error_finishes_game[team_errors2-False]",
"test/test_game.py::test_error_finishes_game[team_errors3-False]",
"test/test_game.py::test_error_finishes_game[team_errors4-False]",
"test/test_game.py::test_error_finishes_game[team_errors5-False]",
"test/test_game.py::test_error_finishes_game[team_errors6-False]",
"test/test_game.py::test_error_finishes_game[team_errors7-1]",
"test/test_game.py::test_error_finishes_game[team_errors8-0]",
"test/test_game.py::test_error_finishes_game[team_errors9-2]",
"test/test_game.py::test_error_finishes_game[team_errors10-1]",
"test/test_game.py::test_error_finishes_game[team_errors11-0]",
"test/test_game.py::test_error_finishes_game[team_errors12-2]",
"test/test_game.py::test_error_finishes_game[team_errors13-2]",
"test/test_game.py::test_error_finishes_game[team_errors14-1]",
"test/test_game.py::test_error_finishes_game[team_errors15-0]",
"test/test_game.py::test_finished_when_no_food[0]",
"test/test_game.py::test_finished_when_no_food[1]",
"test/test_game.py::test_finished_when_no_food[2]",
"test/test_game.py::test_finished_when_no_food[3]",
"test/test_game.py::test_minimal_game",
"test/test_game.py::test_minimal_losing_game_has_one_error",
"test/test_game.py::test_minimal_remote_game",
"test/test_game.py::test_non_existing_file",
"test/test_game.py::test_remote_errors",
"test/test_game.py::test_bad_move_function[0]",
"test/test_game.py::test_bad_move_function[1]",
"test/test_game.py::test_setup_game_run_game_have_same_args",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags0-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags1-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags2-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags3-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags4-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags5-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags6-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags7-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags8-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags9-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags10-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags11-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags12-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags13-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags14-3]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-0]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-1]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-2]",
"test/test_game.py::test_apply_move_resets_bot_was_killed[bot_was_killed_flags15-3]",
"test/test_game.py::test_bot_does_not_eat_own_food",
"test/test_game.py::test_suicide_win",
"test/test_game.py::test_double_suicide",
"test/test_game.py::test_remote_game_closes_players_on_exit",
"test/test_game.py::test_manual_remote_game_closes_players",
"test/test_game.py::test_invalid_setup_game_closes_players",
"test/test_layout.py::test_get_available_layouts",
"test/test_layout.py::test_get_layout_by_name",
"test/test_layout.py::test_get_random_layout",
"test/test_layout.py::test_get_random_layout_returns_correct_layout",
"test/test_layout.py::test_get_random_layout_random_seed",
"test/test_layout.py::test_hole_in_horizontal_border",
"test/test_layout.py::test_odd_width",
"test/test_layout.py::test_different_widths",
"test/test_layout.py::test_hole_in_vertical_border",
"test/test_layout.py::test_last_row_not_complete",
"test/test_layout.py::test_twice_the_same_bot",
"test/test_layout.py::test_missing_one_bot",
"test/test_layout.py::test_broken_added_food",
"test/test_layout.py::test_broken_added_bot",
"test/test_layout.py::test_override_bot",
"test/test_layout.py::test_wrong_bot_names",
"test/test_layout.py::test_roundtrip",
"test/test_layout.py::test_incomplete_roundtrip",
"test/test_layout.py::test_empty_lines",
"test/test_layout.py::test_load",
"test/test_layout.py::test_bots_in_same_position",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden0]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden1]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden2]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden3]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden4]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden5]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden6]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden7]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden8]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden9]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden10]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden11]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden12]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden13]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden14]",
"test/test_layout.py::test_parse_layout_game_bad_number_of_bots[bots_hidden15]",
"test/test_network.py::test_bind_socket_success",
"test/test_network.py::test_bind_socket_fail",
"test/test_network.py::test_extract_port_range",
"test/test_network.py::test_simpleclient",
"test/test_team.py::TestStoppingTeam::test_stopping",
"test/test_team.py::test_track_and_kill_count",
"test/test_team.py::test_eaten_flag_kill[0]",
"test/test_team.py::test_eaten_flag_kill[1]",
"test/test_team.py::test_eaten_flag_kill[2]",
"test/test_team.py::test_eaten_flag_kill[3]",
"test/test_team.py::test_eaten_flag_suicide[0]",
"test/test_team.py::test_eaten_flag_suicide[1]",
"test/test_team.py::test_eaten_flag_suicide[2]",
"test/test_team.py::test_eaten_flag_suicide[3]",
"test/test_team.py::test_bot_attributes",
"test/test_team.py::test_bot_str_repr",
"test/test_team.py::test_bot_html_repr"
] |
[] |
BSD License
| null |
ASPP__pelita-798
|
245a9ca445eccda07998cb58fbee340308d425a7
|
2024-05-30 16:39:47
|
6e70daf7313ca878e3a46240ca6a20811024e9db
|
Debilski: wow. Fixing these tests took way longer than expected …
|
diff --git a/pelita/game.py b/pelita/game.py
index 6cbacc56..efc51f3a 100644
--- a/pelita/game.py
+++ b/pelita/game.py
@@ -555,7 +555,8 @@ def prepare_bot_state(game_state, idx=None):
'bot_was_killed': game_state['bot_was_killed'][own_team::2],
'error_count': len(game_state['errors'][own_team]),
'food': list(game_state['food'][own_team]),
- 'name': game_state['team_names'][own_team]
+ 'name': game_state['team_names'][own_team],
+ 'team_time': game_state['team_time'][own_team]
}
enemy_state = {
@@ -568,7 +569,8 @@ def prepare_bot_state(game_state, idx=None):
'bot_was_killed': game_state['bot_was_killed'][enemy_team::2],
'error_count': 0, # TODO. Could be left out for the enemy
'food': list(game_state['food'][enemy_team]),
- 'name': game_state['team_names'][enemy_team]
+ 'name': game_state['team_names'][enemy_team],
+ 'team_time': game_state['team_time'][enemy_team]
}
bot_state = {
diff --git a/pelita/team.py b/pelita/team.py
index dab0930c..02c66bca 100644
--- a/pelita/team.py
+++ b/pelita/team.py
@@ -522,6 +522,7 @@ class Bot:
bot_char,
is_blue,
team_name,
+ team_time,
error_count,
is_noisy,
bot_turn=None):
@@ -551,6 +552,7 @@ class Bot:
self.char = bot_char
self.is_blue = is_blue
self.team_name = team_name
+ self.team_time = team_time
self.error_count = error_count
self.is_noisy = is_noisy
self.graph = graph
@@ -745,7 +747,8 @@ def make_bots(*, walls, shape, initial_positions, homezone, team, enemy, round,
initial_position=team_initial_positions[idx],
is_blue=team_index % 2 == 0,
homezone=homezone[team_index],
- team_name=team['name'])
+ team_name=team['name'],
+ team_time=team['team_time'])
b._bots = bots
team_bots.append(b)
@@ -770,7 +773,8 @@ def make_bots(*, walls, shape, initial_positions, homezone, team, enemy, round,
initial_position=enemy_initial_positions[idx],
is_blue=enemy_index % 2 == 0,
homezone=homezone[enemy_index],
- team_name=enemy['name'])
+ team_name=enemy['name'],
+ team_time=enemy['team_time'])
b._bots = bots
enemy_bots.append(b)
diff --git a/pelita/utils.py b/pelita/utils.py
index 6db44810..10f15473 100644
--- a/pelita/utils.py
+++ b/pelita/utils.py
@@ -245,7 +245,8 @@ def setup_test_game(*, layout, is_blue=True, round=None, score=None, seed=None,
'bot_was_killed' : [False]*2,
'error_count': 0,
'food': food[team_index],
- 'name': "blue" if is_blue else "red"
+ 'name': "blue" if is_blue else "red",
+ 'team_time': 0.0,
}
enemy = {
'bot_positions': enemy_positions,
@@ -257,7 +258,8 @@ def setup_test_game(*, layout, is_blue=True, round=None, score=None, seed=None,
'error_count': 0,
'food': food[enemy_index],
'is_noisy': is_noisy_enemy,
- 'name': "red" if is_blue else "blue"
+ 'name': "red" if is_blue else "blue",
+ 'team_time': 0.0,
}
bot = make_bots(walls=layout['walls'],
|
make the cumulative time counter available to clients
The `Bot` object should have an attribute `time` where the cumulative time for the team shown in the GUI is made available. This is useful for example when benchmarking different strategies. There's no way at the moment to programmatically access that value, as far as I could see.
Of course the client could time itself, but this has its own pitfalls. So it's better to just make that value available, even if we all know it's not super precise...
|
ASPP/pelita
|
diff --git a/test/test_network.py b/test/test_network.py
index 701d5307..9fcaca7f 100644
--- a/test/test_network.py
+++ b/test/test_network.py
@@ -88,6 +88,7 @@ def test_simpleclient(zmq_context):
'error_count': 0,
'food': [(1, 1)],
'name': 'dummy',
+ 'team_time': 0,
},
'enemy': {
'team_index': 1,
@@ -98,6 +99,7 @@ def test_simpleclient(zmq_context):
'bot_was_killed': [False]*2,
'food': [(2, 2)],
'name': 'other dummy',
+ 'team_time': 0,
'is_noisy': [False, False],
'error_count': 0
},
diff --git a/test/test_team.py b/test/test_team.py
index aa2a7d62..6544ed7c 100644
--- a/test/test_team.py
+++ b/test/test_team.py
@@ -1,3 +1,5 @@
+import time
+
import pytest
import networkx
@@ -523,6 +525,103 @@ def test_team_names():
assert state['fatal_errors'] == [[], []]
+def test_team_time():
+ test_layout = (
+ """ ##################
+ #a#. . # . #
+ #b##### #####x#
+ # . # . .#y#
+ ################## """)
+
+ def team_pattern(fn):
+ # The pattern for a local team.
+ return f'local-team ({fn})'
+
+ # NB: time.monotonic() makes huge leaps on windows,
+ # we must therefore test with >= instead of just >
+ # although this is a little stupid
+
+ check = [None, None]
+
+ def team_1(bot, state):
+ if bot.round == 1 and bot.turn == 0:
+ assert bot.team_time == 0
+ assert bot.enemy[0].team_time == 0
+ else:
+ assert bot.team_time >= 0
+
+ # we fake the time in round 2!!
+ if bot.round == 2 and bot.turn == 0:
+ assert bot.team_time == 1.0
+ assert bot.enemy[0].team_time == 2.0
+
+ if bot.round == 2 and bot.turn == 1:
+ assert bot.team_time >= 1.0
+ assert bot.enemy[0].team_time >= 2.0
+
+ check[0] = bot.team_time
+
+ return bot.position
+
+ def team_2(bot, state):
+ if bot.round == 1 and bot.turn == 0:
+ assert bot.team_time == 0
+ assert bot.enemy[0].team_time >= 0
+ else:
+ assert bot.team_time >= 0
+
+ # we fake the time in round 2!!
+ if bot.round == 2 and bot.turn == 0:
+ assert bot.team_time == 2.0
+ assert bot.enemy[0].team_time >= 1.0
+
+ if bot.round == 2 and bot.turn == 1:
+ assert bot.team_time >= 2.0
+ assert bot.enemy[0].team_time >= 1.0
+
+ check[1] = bot.team_time
+
+ return bot.position
+
+ state = setup_game([team_1, team_2], layout_dict=parse_layout(test_layout), max_rounds=3, allow_exceptions=True)
+
+ state = play_turn(state)
+ assert state['team_time'][0] >= 0
+ assert state['team_time'][1] == 0
+
+ state = play_turn(state)
+ assert state['team_time'][0] >= 0
+ assert state['team_time'][1] >= 0
+
+ # time before bots get updated
+ old_time = list(state['team_time'])
+
+ state = play_turn(state)
+ state = play_turn(state)
+
+ assert check == old_time
+
+ # Round 2. We fake the time so we do not have to sleep!
+ state['team_time'] = [1.0, 2.0]
+
+ state = play_turn(state)
+ state = play_turn(state)
+
+ # time before bots get updated
+ old_time = list(state['team_time'])
+
+ state = play_turn(state)
+ state = play_turn(state)
+
+ assert check == old_time
+
+ # check that player did not fail
+ assert state['errors'] == [{}, {}]
+ assert state['fatal_errors'] == [[], []]
+ assert state['team_time'][0] >= 1.0
+ assert state['team_time'][1] >= 2.0
+
+
def test_bot_str_repr():
test_layout = """
##################
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 3
}
|
2.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest-cov",
"pytest-timestamper",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
click==8.1.8
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
ifaddr==0.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
markdown-it-py==3.0.0
mdurl==0.1.2
networkx==3.2.1
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
-e git+https://github.com/ASPP/pelita.git@245a9ca445eccda07998cb58fbee340308d425a7#egg=pelita
pluggy @ file:///croot/pluggy_1733169602837/work
Pygments==2.19.1
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
pytest-timestamper==0.0.10
PyYAML==6.0.2
pyzmq==26.3.0
rich==14.0.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0
zeroconf==0.146.1
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- click==8.1.8
- coverage==7.8.0
- ifaddr==0.2.0
- markdown-it-py==3.0.0
- mdurl==0.1.2
- networkx==3.2.1
- numpy==2.0.2
- pelita==2.4.0
- pygments==2.19.1
- pytest-cov==6.0.0
- pytest-timestamper==0.0.10
- pyyaml==6.0.2
- pyzmq==26.3.0
- rich==14.0.0
- typing-extensions==4.13.0
- zeroconf==0.146.1
prefix: /opt/conda/envs/pelita
|
[
"test/test_team.py::test_team_time"
] |
[] |
[
"test/test_network.py::test_bind_socket_success",
"test/test_network.py::test_bind_socket_fail",
"test/test_network.py::test_simpleclient",
"test/test_team.py::TestStoppingTeam::test_stopping",
"test/test_team.py::test_track_and_kill_count",
"test/test_team.py::test_eaten_flag_kill[0]",
"test/test_team.py::test_eaten_flag_kill[1]",
"test/test_team.py::test_eaten_flag_kill[2]",
"test/test_team.py::test_eaten_flag_kill[3]",
"test/test_team.py::test_eaten_flag_suicide[0]",
"test/test_team.py::test_eaten_flag_suicide[1]",
"test/test_team.py::test_eaten_flag_suicide[2]",
"test/test_team.py::test_eaten_flag_suicide[3]",
"test/test_team.py::test_initial_position[0]",
"test/test_team.py::test_initial_position[1]",
"test/test_team.py::test_initial_position[2]",
"test/test_team.py::test_initial_position[3]",
"test/test_team.py::test_initial_position[4]",
"test/test_team.py::test_initial_position[5]",
"test/test_team.py::test_initial_position[6]",
"test/test_team.py::test_initial_position[7]",
"test/test_team.py::test_initial_position[8]",
"test/test_team.py::test_initial_position[9]",
"test/test_team.py::test_bot_attributes",
"test/test_team.py::test_bot_graph",
"test/test_team.py::test_bot_graph_is_half_mutable",
"test/test_team.py::test_team_names",
"test/test_team.py::test_bot_str_repr",
"test/test_team.py::test_bot_html_repr"
] |
[] |
BSD License
|
swerebench/sweb.eval.x86_64.aspp_1776_pelita-798
|
ASPP__pelita-815
|
6e70daf7313ca878e3a46240ca6a20811024e9db
|
2024-08-07 18:48:50
|
6e70daf7313ca878e3a46240ca6a20811024e9db
|
diff --git a/contrib/ci_engine.py b/contrib/ci_engine.py
index c1cb84d0..f44194f1 100755
--- a/contrib/ci_engine.py
+++ b/contrib/ci_engine.py
@@ -120,11 +120,15 @@ class CI_Engine:
self.dbwrapper.add_player(pname, new_hash)
for player in self.players:
+ path = player['path']
+ pname = player['name']
try:
- check_team(player['path'])
+ _logger.debug('Querying team name for %s.' % pname)
+ team_name = check_team(player['path'])
+ self.dbwrapper.add_team_name(pname, team_name)
except ZMQClientError as e:
e_type, e_msg = e.args
- _logger.debug(f'Could not import {pname} ({e_type}): {e_msg}')
+ _logger.debug(f'Could not import {player} at path {path} ({e_type}): {e_msg}')
player['error'] = e.args
def run_game(self, p1, p2):
@@ -254,7 +258,6 @@ class CI_Engine:
elif r == -1: draw += 1
return win, loss, draw
-
def get_errorcount(self, idx):
"""Gets the error count for team idx
@@ -273,6 +276,14 @@ class CI_Engine:
error_count, fatalerror_count = self.dbwrapper.get_errorcount(p_name)
return error_count, fatalerror_count
+ def get_team_name(self, idx):
+ """Get last registered team name.
+
+ team_name : string
+ """
+
+ p_name = self.players[idx]['name']
+ return self.dbwrapper.get_team_name(p_name)
def gen_elo(self):
k = 32
@@ -351,8 +362,12 @@ class CI_Engine:
for idx, p in enumerate(good_players):
win, loss, draw = self.get_results(idx)
error_count, fatalerror_count = self.get_errorcount(idx)
+ try:
+ team_name = self.get_team_name(idx)
+ except ValueError:
+ team_name = None
score = 0 if (win+loss+draw) == 0 else (win-loss) / (win+loss+draw)
- result.append([score, win, draw, loss, p['name'], error_count, fatalerror_count])
+ result.append([score, win, draw, loss, p['name'], team_name, error_count, fatalerror_count])
wdl = f"{win:3d},{draw:3d},{loss:3d}"
try:
@@ -392,8 +407,9 @@ class CI_Engine:
elo = self.gen_elo()
result.sort(reverse=True)
- for [score, win, draw, loss, name, error_count, fatalerror_count] in result:
+ for [score, win, draw, loss, name, team_name, error_count, fatalerror_count] in result:
style = "bold" if name in highlight else None
+ name = f"{name} ({team_name})" if team_name else f"{name}"
table.add_row(
name,
f"{win+draw+loss}",
@@ -440,15 +456,20 @@ class DB_Wrapper:
"""
self.cursor.execute("""
+ CREATE TABLE IF NOT EXISTS players
+ (name text PRIMARY KEY, hash text)
+ """)
+ self.cursor.execute("""
+ CREATE TABLE IF NOT EXISTS team_names
+ (name text PRIMARY KEY, team_name text,
+ FOREIGN KEY(name) REFERENCES players(name) ON DELETE CASCADE)
+ """)
+ self.cursor.execute("""
CREATE TABLE IF NOT EXISTS games
(player1 text, player2 text, result int, final_state text, stdout text, stderr text,
FOREIGN KEY(player1) REFERENCES players(name) ON DELETE CASCADE,
FOREIGN KEY(player2) REFERENCES players(name) ON DELETE CASCADE)
""")
- self.cursor.execute("""
- CREATE TABLE IF NOT EXISTS players
- (name text PRIMARY KEY, hash text)
- """)
self.connection.commit()
def get_players(self):
@@ -504,6 +525,24 @@ class DB_Wrapper:
except sqlite3.IntegrityError:
raise ValueError('Player %s already exists in database' % name)
+ def add_team_name(self, name, team_name):
+ """Adds or updates team name to database
+
+ Parameters
+ ----------
+ name : str
+ team_name : str
+
+ """
+ try:
+ self.cursor.execute("""
+ INSERT OR REPLACE INTO team_names
+ VALUES (?, ?)
+ """, [name, team_name])
+ self.connection.commit()
+ except sqlite3.IntegrityError:
+ raise ValueError('Cannot add team name for %s' % name)
+
def remove_player(self, pname):
"""Remove a player from the database.
@@ -573,6 +612,27 @@ class DB_Wrapper:
return relevant_results
+ def get_team_name(self, p_name):
+ """Gets the last registered team name of p_name.
+
+ Parameters
+ ----------
+ p_name : str
+ the name of the player
+
+ Returns
+ -------
+ team_name : str
+
+ """
+ self.cursor.execute("""
+ SELECT team_name FROM team_names
+ WHERE name = ?""", (p_name,))
+ res = self.cursor.fetchone()
+ if res is None:
+ raise ValueError('Player %s does not exist in database.' % p_name)
+ return res[0]
+
def get_game_count(self, p1_name, p2_name=None):
"""Get number of games involving player1 (AND player2 if specified).
|
Add team name in CI table
Remote players only show their team names making comparisons harder.
Conversely, the remote player should/could also include the spec name.
|
ASPP/pelita
|
diff --git a/contrib/test_ci_engine.py b/contrib/test_ci_engine.py
index 998d7a4c..52c2b811 100644
--- a/contrib/test_ci_engine.py
+++ b/contrib/test_ci_engine.py
@@ -83,6 +83,17 @@ def test_get_player_hash(db_wrapper):
assert db_wrapper.get_player_hash('p1') == 'h1'
assert db_wrapper.get_player_hash('p2') == 'h2'
+def test_get_team_name(db_wrapper):
+ db_wrapper.add_player('p1', 'h1')
+ db_wrapper.add_player('p2', 'h2')
+ db_wrapper.add_team_name('p1', 'tn1')
+ db_wrapper.add_team_name('p2', 'tn2')
+ db_wrapper.add_team_name('p2', 'tn3') # check that override works
+ with pytest.raises(ValueError):
+ db_wrapper.get_team_name('p0')
+ assert db_wrapper.get_team_name('p1') == 'tn1'
+ assert db_wrapper.get_team_name('p2') == 'tn3'
+
def test_wins_losses(db_wrapper):
db_wrapper.add_player('p1', 'h1')
db_wrapper.add_player('p2', 'h2')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 1
}
|
2.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "numpy pyzmq PyYAML networkx pytest>=4 zeroconf rich click",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
async-timeout @ file:///croot/async-timeout_1732661977001/work
click @ file:///croot/click_1698129812380/work
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
ifaddr @ file:///home/conda/feedstock_root/build_artifacts/ifaddr_1734770417027/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
markdown-it-py @ file:///croot/markdown-it-py_1684279902645/work
mdurl @ file:///opt/conda/conda-bld/mdurl_1659716024347/work
networkx @ file:///croot/networkx_1717597493534/work
numpy @ file:///croot/numpy_and_numpy_base_1736283260865/work/dist/numpy-2.0.2-cp39-cp39-linux_x86_64.whl#sha256=3387e3e62932fa288bc18e8f445ce19e998b418a65ed2064dd40a054f976a6c7
packaging @ file:///croot/packaging_1734472117206/work
-e git+https://github.com/ASPP/pelita.git@6e70daf7313ca878e3a46240ca6a20811024e9db#egg=pelita
pluggy @ file:///croot/pluggy_1733169602837/work
Pygments @ file:///croot/pygments_1684279966437/work
pytest @ file:///croot/pytest_1738938843180/work
PyYAML @ file:///croot/pyyaml_1728657952215/work
pyzmq @ file:///croot/pyzmq_1734687138743/work
rich @ file:///croot/rich_1732638981168/work
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1734714854207/work
zeroconf @ file:///home/conda/feedstock_root/build_artifacts/zeroconf_1741152776558/work
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- async-timeout=5.0.1=py39h06a4308_0
- blas=1.0=openblas
- ca-certificates=2025.2.25=h06a4308_0
- click=8.1.7=py39h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- ifaddr=0.2.0=pyhd8ed1ab_1
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgfortran-ng=11.2.0=h00389a5_1
- libgfortran5=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libopenblas=0.3.21=h043d6bf_0
- libsodium=1.0.18=h7b6447c_0
- libstdcxx-ng=11.2.0=h1234567_1
- markdown-it-py=2.2.0=py39h06a4308_1
- mdurl=0.1.0=py39h06a4308_0
- ncurses=6.4=h6a678d5_0
- networkx=3.2.1=py39h06a4308_0
- numpy=2.0.2=py39heeff2f4_0
- numpy-base=2.0.2=py39h8a23956_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pygments=2.15.1=py39h06a4308_1
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- pyyaml=6.0.2=py39h5eee18b_0
- pyzmq=26.2.0=py39h6a678d5_0
- readline=8.2=h5eee18b_0
- rich=13.9.4=py39h06a4308_0
- setuptools=72.1.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- typing_extensions=4.12.2=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- yaml=0.2.5=h7b6447c_0
- zeroconf=0.146.1=pyhd8ed1ab_0
- zeromq=4.3.5=h6a678d5_0
- zlib=1.2.13=h5eee18b_1
- pip:
- pelita==2.4.0
prefix: /opt/conda/envs/pelita
|
[
"contrib/test_ci_engine.py::test_get_team_name"
] |
[] |
[
"contrib/test_ci_engine.py::test_foreign_keys_enabled",
"contrib/test_ci_engine.py::test_add_player",
"contrib/test_ci_engine.py::test_remove_player",
"contrib/test_ci_engine.py::test_add_remove_weirdly_named_player",
"contrib/test_ci_engine.py::test_get_players",
"contrib/test_ci_engine.py::test_get_results",
"contrib/test_ci_engine.py::test_get_player_hash",
"contrib/test_ci_engine.py::test_wins_losses"
] |
[] |
BSD License
| null |
|
ASPP__pelita-863
|
ab9217f298fa4897b06e5e9e9e7fad7e29ba7114
|
2025-03-13 17:07:06
|
ab9217f298fa4897b06e5e9e9e7fad7e29ba7114
|
diff --git a/pelita/team.py b/pelita/team.py
index a3ef1138..aea97327 100644
--- a/pelita/team.py
+++ b/pelita/team.py
@@ -726,6 +726,9 @@ class Bot:
out.write(footer)
return out.getvalue()
+ def __repr__(self):
+ return f'<Bot: {self.char} ({"blue" if self.is_blue else "red"}), {self.position}, turn: {self.turn}, round: {self.round}>'
+
# def __init__(self, *, bot_index, position, initial_position, walls, homezone, food, is_noisy, score, random, round, is_blue):
def make_bots(*, walls, shape, initial_positions, homezone, team, enemy, round, bot_turn, rng, graph):
|
Better Bot repr
For reference, this is the current `repr(bot)`:
<pelita.team.Bot object at 0x102778b90>
This is `str(bot)`:
```
Playing on red side. Current turn: 1. Bot: y. Round: 1, score: 0:0. timeouts: 0:0
################################
#. . #. . . #.y#
# # #### ### . # . .x#
# . ##..# ######### #
#. # # #.### . .. .. .# #
######## #. # #### #.### ##
# .# #. # .# . # #
# ## ##. ##..# # .# # ##
## # #. # #..## .## ## #
#a # . #. # .# #. #
##b###.# #### # .# ########
# #. .. .. . ###.# # # .#
# ######### #..## . #
# . . # . ### #### # #
# .# . . .# . .#
################################
Bots: {'a': (1, 9), 'x': (30, 2), 'b': (2, 10), 'y': (30, 1)}
Noisy: {'a': True, 'x': False, 'b': True, 'y': False}
Food: [(30, 14), (21, 10), (24, 4), (20, 14), (26, 1), (24, 7), (27, 4), (29, 9), (18, 6), (21, 8), (20, 12), (21, 4), (25, 4), (27, 2), (18, 4), (24, 14), (17, 7), (18, 7), (29, 1), (20, 4), (27, 14), (21, 9), (21, 12), (18, 11), (24, 6), (25, 5), (29, 2), (19, 2), (26, 12), (30, 11), (11, 1), (10, 5), (10, 11), (13, 4), (12, 13), (2, 13), (7, 9), (10, 6), (6, 10), (10, 3), (4, 1), (13, 11), (11, 11), (2, 14), (13, 8), (14, 8), (7, 1), (4, 13), (6, 11), (5, 14), (1, 1), (11, 3), (10, 7), (1, 4), (13, 9), (2, 6), (5, 3), (4, 11), (7, 11), (7, 8)]
```
At the least I think it should be something like:
<Bot: y (red), (30, 1), turn: 1, round: 1>
|
ASPP/pelita
|
diff --git a/test/test_team.py b/test/test_team.py
index f6db4eb9..babe7ccc 100644
--- a/test/test_team.py
+++ b/test/test_team.py
@@ -695,3 +695,34 @@ def test_bot_html_repr():
# check that all is good
assert state['fatal_errors'] == [[], []]
+
+def test_bot_repr():
+ test_layout = """
+ ##################
+ #.#... .##. y#
+ # # # . .### #x#
+ # ####. . #
+ # . .#### #
+ #a# ###. . # # #
+ #b .##. ...#.#
+ ##################
+ """
+
+ parsed = parse_layout(test_layout)
+
+ def asserting_team(bot, state):
+ bot_repr = repr(bot)
+ if bot.is_blue and bot.round == 1:
+ assert bot_repr == f"<Bot: {bot.char} (blue), {bot.position}, turn: {bot.turn}, round: 1>"
+ elif not bot.is_blue and bot.round == 1:
+ assert bot_repr == f"<Bot: {bot.char} (red), {bot.position}, turn: {bot.turn}, round: 1>"
+ else:
+ assert False, "Should never be here."
+
+ return bot.position
+
+ state = run_game([asserting_team, asserting_team], max_rounds=1, layout_dict=parsed,
+ allow_exceptions=True)
+ # assertions might have been caught in run_game
+ # check that all is good
+ assert state['fatal_errors'] == [[], []]
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 1
}
|
2.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-timestamper flit sphinx",
"pytest"
],
"pre_install": [
"python -m pip install --upgrade pip"
],
"python": "3.11",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==1.0.0
babel==2.17.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
coverage==7.8.0
docutils==0.21.2
flit==3.12.0
flit_core==3.12.0
idna==3.10
ifaddr==0.2.0
imagesize==1.4.1
iniconfig==2.1.0
Jinja2==3.1.6
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
networkx==3.4.2
numpy==2.2.4
packaging==24.2
-e git+https://github.com/ASPP/pelita.git@ab9217f298fa4897b06e5e9e9e7fad7e29ba7114#egg=pelita
pluggy==1.5.0
Pygments==2.19.1
pytest==8.3.5
pytest-cov==6.1.0
pytest-timestamper==0.0.10
PyYAML==6.0.2
pyzmq==26.3.0
requests==2.32.3
rich==14.0.0
roman-numerals-py==3.1.0
snowballstemmer==2.2.0
Sphinx==8.2.3
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli_w==1.2.0
urllib3==2.3.0
zeroconf==0.146.3
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- bzip2=1.0.8=h5eee18b_6
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- libuuid=1.41.5=h5eee18b_0
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- python=3.11.11=he870216_0
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py311h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py311h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==1.0.0
- babel==2.17.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- coverage==7.8.0
- docutils==0.21.2
- flit==3.12.0
- flit-core==3.12.0
- idna==3.10
- ifaddr==0.2.0
- imagesize==1.4.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mdurl==0.1.2
- networkx==3.4.2
- numpy==2.2.4
- packaging==24.2
- pelita==2.5.1
- pip==25.0.1
- pluggy==1.5.0
- pygments==2.19.1
- pytest==8.3.5
- pytest-cov==6.1.0
- pytest-timestamper==0.0.10
- pyyaml==6.0.2
- pyzmq==26.3.0
- requests==2.32.3
- rich==14.0.0
- roman-numerals-py==3.1.0
- snowballstemmer==2.2.0
- sphinx==8.2.3
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli-w==1.2.0
- urllib3==2.3.0
- zeroconf==0.146.3
prefix: /opt/conda/envs/pelita
|
[
"test/test_team.py::test_bot_repr"
] |
[] |
[
"test/test_team.py::TestStoppingTeam::test_stopping",
"test/test_team.py::test_track_and_kill_count",
"test/test_team.py::test_eaten_flag_kill[0]",
"test/test_team.py::test_eaten_flag_kill[1]",
"test/test_team.py::test_eaten_flag_kill[2]",
"test/test_team.py::test_eaten_flag_kill[3]",
"test/test_team.py::test_eaten_flag_suicide[0]",
"test/test_team.py::test_eaten_flag_suicide[1]",
"test/test_team.py::test_eaten_flag_suicide[2]",
"test/test_team.py::test_eaten_flag_suicide[3]",
"test/test_team.py::test_initial_position[0]",
"test/test_team.py::test_initial_position[1]",
"test/test_team.py::test_initial_position[2]",
"test/test_team.py::test_initial_position[3]",
"test/test_team.py::test_initial_position[4]",
"test/test_team.py::test_initial_position[5]",
"test/test_team.py::test_initial_position[6]",
"test/test_team.py::test_initial_position[7]",
"test/test_team.py::test_initial_position[8]",
"test/test_team.py::test_initial_position[9]",
"test/test_team.py::test_bot_attributes",
"test/test_team.py::test_bot_graph",
"test/test_team.py::test_bot_graph_is_half_mutable",
"test/test_team.py::test_team_names",
"test/test_team.py::test_team_time",
"test/test_team.py::test_bot_str_repr",
"test/test_team.py::test_bot_html_repr"
] |
[] |
BSD License
|
swerebench/sweb.eval.x86_64.aspp_1776_pelita-863
|
|
ASPP__pelita-875
|
68af15d8d4199882d32bb4ede363195e2c5b5a99
|
2025-04-28 23:00:41
|
68af15d8d4199882d32bb4ede363195e2c5b5a99
|
diff --git a/pelita/utils.py b/pelita/utils.py
index c5bdf54c..1f3bec36 100644
--- a/pelita/utils.py
+++ b/pelita/utils.py
@@ -104,7 +104,7 @@ def run_background_game(*, blue_move, red_move, layout=None, max_rounds=300, see
if layout is None:
layout_dict = generate_maze(rng=rng)
else:
- layout_dict = parse_layout(layout, food=food, bots=bots)
+ layout_dict = parse_layout(layout)
game_state = run_game((blue_move, red_move), layout_dict=layout_dict,
max_rounds=max_rounds, rng=rng,
|
run_background_game breaks when layout= is passed
```
def test_run_background_game_with_layout():
test_layout = (
""" ##################
#a#. . # . #
#b##### #####x#
# . # . .#y#
################## """)
result = utils.run_background_game(blue_move=stopping_player, red_move=stopping_player, layout=test_layout)
```
```
if layout is None:
layout_dict = generate_maze(rng=rng)
else:
> layout_dict = parse_layout(layout, food=food, bots=bots)
E NameError: name 'food' is not defined
pelita/utils.py:104: NameError
```
|
ASPP/pelita
|
diff --git a/test/test_utils.py b/test/test_utils.py
index 10118cbc..a06bde11 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -112,6 +112,38 @@ def test_run_background_game():
'draw': True
}
+def test_run_background_game_with_layout():
+ test_layout = (
+ """ ##################
+ #a#. . # . #
+ #b##### #####x#
+ # . # . .#y#
+ ################## """)
+ result = utils.run_background_game(blue_move=stopping_player, red_move=stopping_player, layout=test_layout)
+ assert result['walls'] == set(parse_layout(test_layout)['walls'])
+
+ result.pop('seed')
+ result.pop('walls')
+ result.pop('layout')
+ result.pop('blue_food')
+ result.pop('red_food')
+ assert result == {
+ 'round': 300,
+ 'blue_bots': [(1, 1), (1, 2)],
+ 'red_bots': [(16, 2), (16, 3)],
+ 'blue_score': 0,
+ 'red_score': 0,
+ 'blue_errors': {},
+ 'red_errors': {},
+ 'blue_deaths': [0, 0],
+ 'red_deaths': [0, 0],
+ 'blue_kills': [0, 0],
+ 'red_kills': [0, 0],
+ 'blue_wins': False,
+ 'red_wins': False,
+ 'draw': True
+ }
+
def test_walls_to_graph():
test_layout = (
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
2.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest-cov",
"pytest-timestamper",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==1.0.0
babel==2.17.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
coverage==7.8.0
docutils==0.21.2
flit==3.12.0
flit_core==3.12.0
idna==3.10
ifaddr==0.2.0
imagesize==1.4.1
iniconfig==2.1.0
Jinja2==3.1.6
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
networkx==3.4.2
numpy==2.2.4
packaging==24.2
-e git+https://github.com/ASPP/pelita.git@ab9217f298fa4897b06e5e9e9e7fad7e29ba7114#egg=pelita
pluggy==1.5.0
Pygments==2.19.1
pytest==8.3.5
pytest-cov==6.1.0
pytest-timestamper==0.0.10
PyYAML==6.0.2
pyzmq==26.3.0
requests==2.32.3
rich==14.0.0
roman-numerals-py==3.1.0
snowballstemmer==2.2.0
Sphinx==8.2.3
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli_w==1.2.0
urllib3==2.3.0
zeroconf==0.146.3
|
name: pelita
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- bzip2=1.0.8=h5eee18b_6
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- libuuid=1.41.5=h5eee18b_0
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- python=3.11.11=he870216_0
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py311h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py311h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==1.0.0
- babel==2.17.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- coverage==7.8.0
- docutils==0.21.2
- flit==3.12.0
- flit-core==3.12.0
- idna==3.10
- ifaddr==0.2.0
- imagesize==1.4.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- mdurl==0.1.2
- networkx==3.4.2
- numpy==2.2.4
- packaging==24.2
- pelita==2.5.1
- pip==25.0.1
- pluggy==1.5.0
- pygments==2.19.1
- pytest==8.3.5
- pytest-cov==6.1.0
- pytest-timestamper==0.0.10
- pyyaml==6.0.2
- pyzmq==26.3.0
- requests==2.32.3
- rich==14.0.0
- roman-numerals-py==3.1.0
- snowballstemmer==2.2.0
- sphinx==8.2.3
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli-w==1.2.0
- urllib3==2.3.0
- zeroconf==0.146.3
prefix: /opt/conda/envs/pelita
|
[
"test/test_utils.py::test_run_background_game_with_layout"
] |
[] |
[
"test/test_utils.py::test_default_rng",
"test/test_utils.py::test_default_rng_init_self",
"test/test_utils.py::test_default_rng_init_none",
"test/test_utils.py::test_setup_test_game[True]",
"test/test_utils.py::test_setup_test_game[False]",
"test/test_utils.py::test_setup_test_game_incomplete_noisy_dict[True]",
"test/test_utils.py::test_setup_test_game_incomplete_noisy_dict[False]",
"test/test_utils.py::test_run_background_game",
"test/test_utils.py::test_walls_to_graph"
] |
[] |
BSD License
|
swerebench/sweb.eval.x86_64.aspp_1776_pelita-875
|
|
AVEgame__AVE-108
|
29c1a6f2f58198e3af2bde3b457af6cf8053b6af
|
2020-07-04 20:53:39
|
f7eb0efebe81657e15d91310c132658859195ff6
|
diff --git a/ave/components/numbers.py b/ave/components/numbers.py
index 19fe14d..e321b64 100644
--- a/ave/components/numbers.py
+++ b/ave/components/numbers.py
@@ -10,6 +10,10 @@ class Number:
"""Get the value of the Number."""
raise NotImplementedError()
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ raise NotImplementedError()
+
class Constant(Number):
"""A constant."""
@@ -22,6 +26,10 @@ class Constant(Number):
"""Get the value of the Number."""
return self.value
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ return []
+
class Sum(Number):
"""The sum of multiple Numbers."""
@@ -34,6 +42,13 @@ class Sum(Number):
"""Get the value of the Number."""
return sum(i.get_value(character) for i in self.items)
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ out = []
+ for i in self.items:
+ out += i.get_all_variables()
+ return out
+
class Product(Number):
"""The product of multiple Numbers."""
@@ -49,6 +64,13 @@ class Product(Number):
out *= i.get_value(character)
return out
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ out = []
+ for i in self.items:
+ out += i.get_all_variables()
+ return out
+
class Division(Number):
"""The result of a division."""
@@ -65,6 +87,13 @@ class Division(Number):
out /= i.get_value(character)
return out
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ out = []
+ for i in self.items:
+ out += i.get_all_variables()
+ return out
+
class Negative(Number):
"""The negative of another Number."""
@@ -77,6 +106,10 @@ class Negative(Number):
"""Get the value of the Number."""
return -self.item.get_value(character)
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ return self.item.get_all_variables()
+
class Variable(Number):
"""The value of a variable."""
@@ -89,6 +122,10 @@ class Variable(Number):
"""Get the value of the Number."""
return character.numbers[self.item]
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ return [self.item]
+
class Random(Number):
"""A random number."""
@@ -111,3 +148,7 @@ class Random(Number):
end = self.end.get_value(character)
size = end - start
return start + random.random() * size
+
+ def get_all_variables(self):
+ """Get a list of all variables used in this expression."""
+ return self.start.get_all_variables() + self.end.get_all_variables()
diff --git a/ave/components/requirements.py b/ave/components/requirements.py
index 4eb410f..b859c2e 100644
--- a/ave/components/requirements.py
+++ b/ave/components/requirements.py
@@ -10,6 +10,10 @@ class Requirement:
"""Check if the character satisifies this."""
raise NotImplementedError()
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ raise NotImplementedError()
+
class RequiredItem(Requirement):
"""The character must have an item."""
@@ -22,6 +26,10 @@ class RequiredItem(Requirement):
"""Check if the character satisifies this."""
return character.has(self.item)
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ return [self.item]
+
class RequiredNumber(Requirement):
"""A numerical variable must satisfy a condition."""
@@ -47,6 +55,10 @@ class RequiredNumber(Requirement):
if self.sign == "=" or self.sign == "==":
return v1 == v2
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ return self.v1.get_all_variables() + self.v1.get_all_variables()
+
class Or(Requirement):
"""One of a set of Requirements must be satisfied."""
@@ -62,6 +74,13 @@ class Or(Requirement):
return True
return False
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ out = []
+ for i in self.items:
+ out += i.get_all()
+ return out
+
class And(Requirement):
"""A set of Requirements must all be satisfied."""
@@ -77,6 +96,13 @@ class And(Requirement):
return False
return True
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ out = []
+ for i in self.items:
+ out += i.get_all()
+ return out
+
class Not(Requirement):
"""The negation of another Requirement."""
@@ -89,6 +115,10 @@ class Not(Requirement):
"""Check if the character satisifies this."""
return not self.item.has(character)
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ return self.item.get_all()
+
class Satisfied(Requirement):
"""This requirement is always satisfied."""
@@ -96,3 +126,7 @@ class Satisfied(Requirement):
def has(self, character):
"""Check if the character satisifies this."""
return True
+
+ def get_all(self):
+ """Get all items involved in this requirement."""
+ return []
|
Write code to run detailed checks that a game works
Put this in `ave.test`. It can then be used by the AVE pytest tests, and for AVEgame/AVE-usergames#2
|
AVEgame/AVE
|
diff --git a/ave/test/__init__.py b/ave/test/__init__.py
new file mode 100644
index 0000000..d09c7cc
--- /dev/null
+++ b/ave/test/__init__.py
@@ -0,0 +1,2 @@
+"""Code used to test games."""
+from .game_validation import check_game # noqa: F401
diff --git a/ave/test/error_handlers.py b/ave/test/error_handlers.py
new file mode 100644
index 0000000..8c60c30
--- /dev/null
+++ b/ave/test/error_handlers.py
@@ -0,0 +1,55 @@
+"""Error handlers."""
+
+
+class AVEErrorHandler:
+ """Class to store errors found when checking games."""
+
+ def __init__(self, description, error_type, error_value):
+ """Make the error handler."""
+ self.description = description
+ self.error_type = error_type
+ self.error_value = error_value
+
+ def __str__(self):
+ """Return a string describing the error."""
+ return self.error_type + ": " + self.description
+
+
+class AVEFatalError(AVEErrorHandler):
+ """This error is so bad that the game will not run."""
+
+ def __init__(self, description):
+ """Make the error handler."""
+ super().__init__(description, "Fatal Error", 5)
+
+
+class AVEError(AVEErrorHandler):
+ """There is an error but part of the game will still run."""
+
+ def __init__(self, description):
+ """Make the error handler."""
+ super().__init__(description, "Error", 4)
+
+
+class AVEWarning(AVEErrorHandler):
+ """The game will run, but there may is a small problem."""
+
+ def __init__(self, description):
+ """Make the error handler."""
+ super().__init__(description, "Warning", 3)
+
+
+class AVEInfo(AVEErrorHandler):
+ """The game will run, but there maybe is a small problem."""
+
+ def __init__(self, description):
+ """Make the error handler."""
+ super().__init__(description, "Info", 2)
+
+
+class AVENote(AVEErrorHandler):
+ """The game will run, but there maybe is a tiny problem."""
+
+ def __init__(self, description):
+ """Make the error handler."""
+ super().__init__(description, "Note", 1)
diff --git a/ave/test/game_validation.py b/ave/test/game_validation.py
new file mode 100644
index 0000000..34a5b1e
--- /dev/null
+++ b/ave/test/game_validation.py
@@ -0,0 +1,127 @@
+"""Check that games are valid."""
+from .error_handlers import (
+ AVEFatalError, AVEError, AVEWarning, AVEInfo, AVENote)
+from ..game import Character
+
+
+def check_game(game):
+ """Check a game for errors."""
+ errors = []
+ errors += check_first_room(game)
+ errors += get_inaccessible_rooms(game)
+ errors += get_undefined_rooms(game)
+ errors += get_trapped_rooms(game)
+ errors += get_undefined_numbers(game)
+ errors += explore_items(game)
+ return errors
+
+
+def check_first_room(game):
+ """Check that the first room of the game works."""
+ errors = []
+ if "start" not in game.rooms:
+ return [AVEFatalError("There is no 'start' room.")]
+ if len(game.rooms["start"].options) == 0:
+ errors.append(AVEFatalError("You cannot leave the first room."))
+ c = Character()
+ c.reset(game.items)
+ try:
+ game["start"].get_text(c)
+ except: # noqa: E722
+ errors.append(AVEFatalError("Could not load text for first room."))
+ try:
+ game["start"].get_options(c)
+ except: # noqa: E722
+ errors.append(AVEFatalError("Could not load options for first room."))
+ return errors
+
+
+def get_inaccessible_rooms(game):
+ """Find room that cannot be reached."""
+ ach = {"start"}
+ for room in game.rooms.values():
+ for option in room.options:
+ for d in option.get_all_destinations():
+ ach.add(d)
+ return [AVEWarning("The room '" + i + "' is not accessible.")
+ for i in game.rooms if i not in ach]
+
+
+def get_undefined_rooms(game):
+ """Get rooms that can be reached but are not defined."""
+ not_inc = set()
+ for room in game.rooms.values():
+ for option in room.options:
+ for d in option.get_all_destinations():
+ if d == "__GAMEOVER__" or d == "__WINNER__":
+ continue
+ if d not in game.rooms:
+ not_inc.add(d)
+ return [AVEError("The room '" + i + "' does not exist.")
+ for i in not_inc]
+
+
+def get_trapped_rooms(game):
+ """Get rooms that there is no option to leave."""
+ return [AVEError("There is no way to leave the room '" + id + "'.")
+ for id, room in game.rooms.items() if len(room.options) == 0]
+
+
+def get_undefined_numbers(game):
+ """Get numbers that can be added to but are not defined."""
+ not_def = set()
+ c = Character()
+ c.reset(game.items)
+ for room in game.rooms.values():
+ for thing in room.options + room.text:
+ for item in thing.items:
+ if not c.is_number(item.item) and item.value.get_value(c) != 1:
+ not_def.add(item.item)
+ return [AVEWarning("The game wants to add a number to '" + i + "',"
+ " but it is not a variable.") for i in not_def]
+
+
+def explore_items(game):
+ """Look for items that are required but never added and other issues."""
+ used = set()
+ asked_for = set()
+ c = Character()
+ c.reset(game.items)
+ for room in game.rooms.values():
+ for thing in room.options + room.text:
+ for item in thing.items:
+ used.add(item.item)
+ for item in thing.needs.get_all():
+ asked_for.add(item)
+
+ used_num = set()
+ numbers = set()
+ named_items = set()
+ for i in game.items:
+ if c.is_number(i):
+ numbers.add(i)
+ if i.default.get_value(c) != 0:
+ used_num.add(i)
+ else:
+ named_items.add(i)
+
+ errors = []
+ errors += [AVEWarning("A line in your file requires '" + i + "',"
+ " but this item is never added.")
+ for i in asked_for - used - used_num]
+ errors += [AVEWarning("A line in your file asks about '" + i + "',"
+ " but this number is never changed.")
+ for i in (asked_for - used).intersection(numbers)]
+ errors += [AVEInfo("The number '" + i + "' is defined but is not "
+ "used in the game.")
+ for i in numbers - used - asked_for]
+ errors += [AVEInfo("The item '" + i + "' is named but is not "
+ "used in the game.")
+ for i in named_items - used - asked_for]
+ errors += [AVENote("The item '" + i + "' is not named, so will be hidden "
+ "from the inventory by default.")
+ for i in used.union(asked_for) - named_items - numbers]
+ return errors
+
+
+# Info: unnamed items will default to hidden
diff --git a/test/test_games.py b/test/test_games.py
index 78f2eb0..0020bf0 100644
--- a/test/test_games.py
+++ b/test/test_games.py
@@ -1,7 +1,8 @@
import pytest
import os
-from ave import config, AVE, Character, exceptions
+from ave import config, AVE, exceptions
from ave import load_game_from_file, load_game_from_library
+from ave.test import check_game
config.debug = True
games_path = os.path.join(
@@ -30,58 +31,31 @@ def test_version_checking(filename):
@pytest.mark.parametrize('filename', games)
-def test_all_rooms_acessible(filename):
+def test_games_for_errors(filename):
game = load_game_from_file(filename)
game.load()
- ach = {"start"}
- for room in game.rooms.values():
- for option in room.options:
- for d in option.get_all_destinations():
- ach.add(d)
- not_ach = [i for i in game.rooms if i not in ach]
- if len(not_ach) > 0:
- print("Rooms not accessible:")
- for key in not_ach:
- print(" ", key)
- assert False
-
-
[email protected]('filename', games)
-def test_all_rooms_defined(filename):
- game = load_game_from_file(filename)
- game.load()
- not_inc = set()
- for room in game.rooms.values():
- for option in room.options:
- for d in option.get_all_destinations():
- if d == "__GAMEOVER__" or d == "__WINNER__":
- continue
- if d not in game.rooms:
- not_inc.add(d)
-
- if len(not_inc) > 0:
- print("Rooms not defined:")
- for key in not_inc:
- print(" ", key)
- assert "test.ave" in filename
- assert len(not_inc) == 1 and "fakeroom" in not_inc
-
-
[email protected]('filename', games)
-def test_has_start(filename):
- game = load_game_from_file(filename)
- game.load()
- assert game["start"].id != "fail"
-
-
[email protected]('filename', games)
-def test_first_room(filename):
- ave = AVE(character=Character())
- game = load_game_from_file(filename)
- game.load()
- game["start"].get_text(ave.character)
- game["start"].get_options(ave.character)
+ issues = check_game(game)
+ errors = [i for i in issues if i.error_value > 3]
+ info = [i for i in issues if i.error_value <= 3]
+ errors.sort(key=lambda e: -e.error_value)
+ info.sort(key=lambda e: -e.error_value)
+
+ if len(errors) > 0:
+ print("\n " + str(len(errors)) + " errors(s) in " + filename)
+ for e in errors:
+ print(e)
+ if len(info) > 0:
+ print("\n " + str(len(info)) + " info(s) in " + filename)
+ for e in info:
+ print(e)
+
+ if filename.endswith("test.ave"):
+ assert len(errors) == 1
+ assert "fakeroom" in errors[0].description
+ else:
+ # Assert that the worst error is a Warning or lower
+ assert len(errors) == 0
def test_game_library():
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 3,
"test_score": 1
},
"num_modified_files": 2
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"flake8",
"pydocstyle"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/AVEgame/AVE.git@29c1a6f2f58198e3af2bde3b457af6cf8053b6af#egg=avegame
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
flake8==7.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.2
pytest @ file:///croot/pytest_1738938843180/work
snowballstemmer==2.2.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: AVE
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- flake8==7.2.0
- mccabe==0.7.0
- pycodestyle==2.13.0
- pydocstyle==6.3.0
- pyflakes==3.3.2
- snowballstemmer==2.2.0
prefix: /opt/conda/envs/AVE
|
[
"test/test_games.py::test_games_for_errors[/AVE/test/../games/test.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/tea.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/make.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/Moscow.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/shop.ave]"
] |
[
"test/test_games.py::test_game_library",
"test/test_games.py::test_load_game_from_library"
] |
[
"test/test_games.py::test_version_checking[/AVE/test/../test/games/hidden_test.ave]"
] |
[] |
MIT License
| null |
|
AVEgame__AVE-113
|
b39a5ed00692e456e4d2533cde44e46830cc90a2
|
2020-07-05 09:15:50
|
62be6f46cfe33504f841bfe2b74338ccc7554447
|
diff --git a/ave/ave.py b/ave/ave.py
index 52fb295..cb4a94d 100644
--- a/ave/ave.py
+++ b/ave/ave.py
@@ -135,16 +135,12 @@ class AVE:
A list of the title, author and local url for each game.
"""
try:
- the_json = load_library_json()
+ library = load_library_json()
except AVENoInternet:
self.no_internet()
raise AVEToMenu
- menu_items = []
- for key, value in the_json.items():
- if 'user/' in key:
- menu_items.append([value['title'], value['author'],
- key])
- return menu_items
+ return [(game["title"], game["author"], i)
+ for i, game in enumerate(library)]
def show_download_menu(self):
"""Show a menu of games from the online library."""
diff --git a/ave/parsing/game_loader.py b/ave/parsing/game_loader.py
index 1ddf398..ce94d9f 100644
--- a/ave/parsing/game_loader.py
+++ b/ave/parsing/game_loader.py
@@ -4,6 +4,7 @@ import re
import json
import urllib.request
from ..game import Game
+from .. import config
from ..exceptions import AVENoInternet
from .string_functions import clean
from .file_parsing import parse_room, parse_item
@@ -16,9 +17,14 @@ def load_library_json():
global library_json
try:
if library_json is None:
+ library_json = []
with urllib.request.urlopen(
- "http://avegame.co.uk/gamelist.json") as f:
- library_json = json.load(f)
+ "https://avegame.co.uk/gamelist.json") as f:
+ for game in json.load(f):
+ game["ave_version"] = tuple(game["ave_version"])
+ if game["user"]:
+ if game["ave_version"] <= config.version_tuple:
+ library_json.append(game)
except: # noqa: E722
raise AVENoInternet
return library_json
@@ -79,13 +85,14 @@ def load_game_from_file(file, filename=None):
version=version, ave_version=ave_version)
-def load_game_from_library(url):
+def load_game_from_library(n):
"""Load the metadata of a game from the online library."""
- info = load_library_json()[url]
- return Game(url="http://avegame.co.uk/download/" + url,
+ info = load_library_json()[n]
+ print(info)
+ return Game(url="https://avegame.co.uk/download/user/" + info["filename"],
title=info["title"], description=info["desc"],
author=info["author"], active=info["active"],
- number=info["n"])
+ number=info["number"])
def load_full_game_from_file(file):
|
Check that running AVE version is high enough to play library games
I think I already did this, but needs testing.
|
AVEgame/AVE
|
diff --git a/test/test_games.py b/test/test_games.py
index 21b63bb..dad232b 100644
--- a/test/test_games.py
+++ b/test/test_games.py
@@ -1,7 +1,7 @@
import pytest
import os
from ave import config, AVE, exceptions
-from ave import load_game_from_file, load_game_from_library
+from ave import load_game_from_file
from ave.test import check_game
config.debug = True
@@ -54,15 +54,3 @@ def test_games_for_errors(filename):
else:
# Assert that the worst error is a Warning or lower
assert len(errors) == 0
-
-
-def xtest_game_library():
- ave = AVE()
- ave.get_download_menu()
-
-
-def xtest_load_game_from_library():
- ave = AVE()
- game = load_game_from_library(ave.get_download_menu()[0][2])
- game.load()
- assert game["start"].id != "fail"
diff --git a/test/test_library.py b/test/test_library.py
new file mode 100644
index 0000000..99d1c9c
--- /dev/null
+++ b/test/test_library.py
@@ -0,0 +1,14 @@
+from ave import AVE
+from ave import load_game_from_library
+
+
+def test_game_library():
+ ave = AVE()
+ ave.get_download_menu()
+
+
+def test_load_game_from_library():
+ ave = AVE()
+ game = load_game_from_library(ave.get_download_menu()[0][2])
+ game.load()
+ assert game["start"].id != "fail"
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 2
}
|
1.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/AVEgame/AVE.git@b39a5ed00692e456e4d2533cde44e46830cc90a2#egg=avegame
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
tomli==2.2.1
|
name: AVE
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- tomli==2.2.1
prefix: /opt/conda/envs/AVE
|
[
"test/test_library.py::test_game_library",
"test/test_library.py::test_load_game_from_library"
] |
[] |
[
"test/test_games.py::test_version_checking[/AVE/test/../test/games/hidden_test.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/test.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/make.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/Moscow.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/tea.ave]",
"test/test_games.py::test_games_for_errors[/AVE/test/../games/shop.ave]"
] |
[] |
MIT License
| null |
Subsets and Splits
Unique Repositories in Tests
Lists unique repository names from the dataset, providing a basic overview of the repositories present.
Filter Test Data by Instance ID
Retrieves all records for a specific instance, providing limited insight into the data structure but no broader analytical value.