-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ameshアップデート2022/05 #997
ameshアップデート2022/05 #997
Conversation
formatが間違ってたので直してあげたよ!PRをマージしてね! #997
|
いや、それするとテストうまくいかない説あるか。 |
pr-formatでPipfile.lockの差分のPRが出るようにする
formatが間違ってたので直してあげたよ!PRをマージしてね! #997
Co-authored-by: Goryudyuma(Kei.Matsumoto) <6211370+Goryudyuma@users.noreply.github.com>
data = [TimeJsonElement(**i) for i in json.loads(response.text)] | ||
timejson += data | ||
|
||
elements = list(set([e for i in timejson for e in i.elements])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elements = list(set([e for i in timejson for e in i.elements])) | |
elements = list(set(e for i in timejson for e in i.elements)) |
こんな感じでもできるはず。
…amesh-new-engine .pre-commit-config.yamlを直してあげたよ!PRをマージしてね! #997
formatが間違ってたので直してあげたよ! #997
formatが間違ってたので直してあげたよ! #997
self.mapbox.height = height - offset_top | ||
if width is not None: | ||
self.mapbox.width = width | ||
body_img = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body_img = None | |
body_img: Optional[np.ndarray] = None |
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:462:27: E1136: Value 'body_img' is unsubscriptable (unsubscriptable-object)
は上記のようにすると良さそう?
.T | ||
) | ||
|
||
def geocoords2pixel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:145: error: Argument 1 to "_ndarray_geocoords2pixel" of "WebMercatorPixelBBox" has incompatible type "Union[ndarray[Any, Any], GeoCoord, List[GeoCoord]]"; expected "ndarray[Any, Any]"
library/hatomap.py:148: error: Argument 1 to "geocoord2pixel" of "WebMercatorPixelBBox" has incompatible type "Union[ndarray[Any, Any], GeoCoord, List[GeoCoord]]"; expected "GeoCoord"
library/hatomap.py:150: error: Item "GeoCoord" of "Union[ndarray[Any, Any], GeoCoord, List[GeoCoord]]" has no attribute "__iter__" (not iterable)
geocoords
の型ごとにメソッドを分けた方が良い説。
np.asarray(bytearray(requests.get(url).content), dtype=np.uint8), -1 | ||
) | ||
|
||
def request(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def request(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: | |
def request(self, bbox: WebMercatorPixelBBox = None) -> Optional[np.ndarray]: |
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:185: error: Incompatible return value type (got "None", expected "ndarray[Any, Any]")
上記が正しそう。
color: Tuple[int, int, int, int] = (255, 0, 255, 255) | ||
|
||
def get_image(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: | ||
img = np.zeros((bbox.height, bbox.width, 4), np.uint8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:225: error: Item "None" of "Optional[WebMercatorPixelBBox]" has no attribute "height"
library/hatomap.py:225: error: Item "None" of "Optional[WebMercatorPixelBBox]" has no attribute "width"
library/hatomap.py:235: error: Item "None" of "Optional[WebMercatorPixelBBox]" has no attribute "geocoords2pixel"
ここの前に bbox
が None
かどうかのチェックを入れる必要がありそう。
|
||
@dataclass | ||
class LineTrace: | ||
coords: Union[List["np.ndarray"], List[List[GeoCoord]]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:230: error: Value of type "Union[Any, GeoCoord]" is not indexable
library/hatomap.py:263: error: Value of type "Union[Any, GeoCoord]" is not indexable
coords
をそれぞれの型ごとに設けると良さそう?
|
||
@dataclass | ||
class RasterLayer: | ||
url: Union[List[str], str] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:354: error: Incompatible types in assignment (expression has type "Union[List[str], str]", variable has type "str")
url
をそれぞれの型ごとに設けると良さそう?
|
||
mapbox: MapBox = MapBox() | ||
basemap: str = "open-street-map" | ||
extra_basemap_server: str = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra_basemap_server: str = None | |
extra_basemap_server: Optional[str] = None |
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:395: error: Incompatible types in assignment (expression has type "None", variable has type "str")
mapbox: MapBox = MapBox() | ||
basemap: str = "open-street-map" | ||
extra_basemap_server: str = None | ||
layers: List[Union[RasterLayer, LineTrace]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layers: List[Union[RasterLayer, LineTrace]] = None | |
layers: Optional[List[Union[RasterLayer, LineTrace]]] = None |
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:396: error: Incompatible types in assignment (expression has type "None", variable has type "List[Union[RasterLayer, LineTrace]]")
basemap: str = "open-street-map" | ||
extra_basemap_server: str = None | ||
layers: List[Union[RasterLayer, LineTrace]] = None | ||
title: str = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: str = None | |
title: Optional[str] = None |
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:397: error: Incompatible types in assignment (expression has type "None", variable has type "str")
1 - layer_img[..., 3:] / 255 | ||
) + layer_img[..., :3] * (layer_img[..., 3:] / 255) | ||
|
||
img = np.zeros((height, width, 3), np.uint8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/hatomap.py:466: error: Argument 1 to "zeros" has incompatible type "Tuple[Optional[int], Optional[int], int]"; expected "Union[SupportsIndex, Sequence[SupportsIndex]]"
ここより前に height
や width
が None
だった時の処理を入れると良さそう。
layers=[ | ||
RasterLayer( | ||
url=get_jma_image_server(jma_timestamp["hrpns_nd"]), opacity=128 / 256 | ||
) | ||
] | ||
+ [ | ||
LineTrace( | ||
coords=[get_circle(lat, lng, d * 1000)], color=(100, 100, 100, 255) | ||
) | ||
for d in range(10, 60, 10) | ||
] | ||
+ [ | ||
MarkerTrace( | ||
[GeoCoord(e[0], e[1]) for e in get_liden(jma_timestamp["liden"])], | ||
size=14, | ||
symbol="thunder", | ||
fill_color=(0, 255, 255, 255), | ||
border_color=(0, 64, 64, 255), | ||
) | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/jma_amesh.py:126: error: Argument "layers" to "HatoMap" has incompatible type "List[RasterLayer]"; expected "List[Union[RasterLayer, LineTrace]]"
library/jma_amesh.py:126: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
library/jma_amesh.py:126: note: Consider using "Sequence" instead, which is covariant
library/jma_amesh.py:132: error: List comprehension has incompatible type List[LineTrace]; expected List[RasterLayer]
library/jma_amesh.py:138: error: List item 0 has incompatible type "MarkerTrace"; expected "RasterLayer"
RasterLayer
, LineTrace
, LineTrace
の各配列を List[Union[RasterLayer, LineTrace]]
として変数定義して結合させれば良さそう?
] | ||
+ [ | ||
MarkerTrace( | ||
[GeoCoord(e[0], e[1]) for e in get_liden(jma_timestamp["liden"])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dev-hato/hato-bot/actions/runs/2783525807/jobs/4380588635
library/jma_amesh.py:139: error: Item "None" of "Optional[List[Tuple[float, float, int]]]" has no attribute "__iter__" (not iterable)
ここより前で get_liden(jma_timestamp["liden"])
が None
かのチェックを入れると良さそう。
|
ameshの改良( #640 )
雷レーダーの追加( closes: #983 )