umap-project 2.7.1__py3-none-any.whl → 2.7.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of umap-project might be problematic. Click here for more details.

umap/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "2.7.1"
1
+ VERSION = "2.7.3"
@@ -81,6 +81,8 @@ export class Formatter {
81
81
  {
82
82
  delimiter: 'auto',
83
83
  includeLatLon: false,
84
+ sexagesimal: false,
85
+ parseLatLon: (raw) => Number.parseFloat(raw.toString().replace(',', '.')),
84
86
  },
85
87
  (err, result) => {
86
88
  // csv2geojson fallback to null geometries when it cannot determine
@@ -115,7 +117,9 @@ export class Formatter {
115
117
  }
116
118
 
117
119
  async fromGeoRSS(str) {
118
- const GeoRSSToGeoJSON = await import('../../vendors/georsstogeojson/GeoRSSToGeoJSON.js')
120
+ const GeoRSSToGeoJSON = await import(
121
+ '../../vendors/georsstogeojson/GeoRSSToGeoJSON.js'
122
+ )
119
123
  return GeoRSSToGeoJSON.parse(this.toDom(str))
120
124
  }
121
125
 
@@ -78,7 +78,6 @@ export default class Dialog extends WithTemplate {
78
78
  event.preventDefault()
79
79
  this.dialog.returnValue = 'accept'
80
80
  this.close()
81
- this.dialog.returnValue = undefined
82
81
  })
83
82
  }
84
83
  this.dialog.addEventListener('keydown', (e) => {
@@ -143,6 +142,7 @@ export default class Dialog extends WithTemplate {
143
142
 
144
143
  close() {
145
144
  this.toggle(false)
145
+ this.dialog.returnValue = undefined
146
146
  }
147
147
 
148
148
  toggle(open = false) {
@@ -81,6 +81,8 @@ function csv2geojson(x, options, callback) {
81
81
  }
82
82
 
83
83
  options.delimiter = options.delimiter || ',';
84
+ options.parseLatLon = options.parseLatLon || parseFloat;
85
+ options.sexagesimal = options.sexagesimal !== false;
84
86
 
85
87
  var latfield = options.latfield || '',
86
88
  lonfield = options.lonfield || '',
@@ -129,6 +131,7 @@ function csv2geojson(x, options, callback) {
129
131
 
130
132
  if (!latfield) latfield = guessLatHeader(parsed[0]);
131
133
  if (!lonfield) lonfield = guessLonHeader(parsed[0]);
134
+
132
135
  var noGeometry = (!latfield || !lonfield);
133
136
 
134
137
  if (noGeometry) {
@@ -152,13 +155,15 @@ function csv2geojson(x, options, callback) {
152
155
  lonf, latf,
153
156
  a;
154
157
 
155
- a = sexagesimal(lonk, 'EW');
156
- if (a) lonk = a;
157
- a = sexagesimal(latk, 'NS');
158
- if (a) latk = a;
158
+ if (options.sexagesimal) {
159
+ a = sexagesimal(lonk, 'EW');
160
+ if (a) lonk = a;
161
+ a = sexagesimal(latk, 'NS');
162
+ if (a) latk = a;
163
+ }
159
164
 
160
- lonf = parseFloat(lonk);
161
- latf = parseFloat(latk);
165
+ lonf = options.parseLatLon(lonk);
166
+ latf = options.parseLatLon(latk);
162
167
 
163
168
  if (isNaN(lonf) ||
164
169
  isNaN(latf)) {
@@ -179,8 +184,8 @@ function csv2geojson(x, options, callback) {
179
184
  geometry: {
180
185
  type: 'Point',
181
186
  coordinates: [
182
- parseFloat(lonf),
183
- parseFloat(latf)
187
+ lonf,
188
+ latf
184
189
  ]
185
190
  }
186
191
  });
umap/tests/base.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import copy
2
2
  import json
3
+ from pathlib import Path
3
4
 
4
5
  import factory
5
6
  from django.contrib.auth import get_user_model
@@ -40,7 +41,7 @@ class LicenceFactory(factory.django.DjangoModelFactory):
40
41
 
41
42
  class TileLayerFactory(factory.django.DjangoModelFactory):
42
43
  name = "Test zoom layer"
43
- url_template = "http://{s}.test.org/{z}/{x}/{y}.png"
44
+ url_template = "https://{s}.test.org/osmfr/{z}/{x}/{y}.png"
44
45
  attribution = "Test layer attribution"
45
46
 
46
47
  class Meta:
@@ -150,3 +151,8 @@ def login_required(response):
150
151
  redirect_url = reverse("login")
151
152
  assert j["login_required"] == redirect_url
152
153
  return True
154
+
155
+
156
+ def mock_tiles(route):
157
+ path = Path(__file__).parent / "fixtures/empty_tile.png"
158
+ route.fulfill(path=path)
Binary file
@@ -6,6 +6,8 @@ from pathlib import Path
6
6
  import pytest
7
7
  from playwright.sync_api import expect
8
8
 
9
+ from ..base import mock_tiles
10
+
9
11
 
10
12
  @pytest.fixture(scope="session")
11
13
  def browser_context_args(browser_context_args):
@@ -23,7 +25,7 @@ def set_timeout(context):
23
25
  @pytest.fixture(autouse=True)
24
26
  def mock_osm_tiles(page):
25
27
  if not bool(os.environ.get("PWDEBUG", False)):
26
- page.route("*/**/osmfr/**", lambda route: route.fulfill())
28
+ page.route("*/**/osmfr/**", mock_tiles)
27
29
 
28
30
 
29
31
  @pytest.fixture
@@ -1,5 +1,4 @@
1
1
  import json
2
- import os
3
2
  import platform
4
3
  import re
5
4
  from pathlib import Path
@@ -10,6 +9,7 @@ from playwright.sync_api import expect
10
9
 
11
10
  from umap.models import DataLayer
12
11
 
12
+ from ..base import mock_tiles
13
13
  from .helpers import save_and_get_json
14
14
 
15
15
  pytestmark = pytest.mark.django_db
@@ -72,6 +72,8 @@ def test_umap_import_from_file(live_server, tilelayer, page):
72
72
 
73
73
 
74
74
  def test_umap_import_from_textarea(live_server, tilelayer, page, settings):
75
+ page.route("https://tile.openstreetmap.fr/hot/**", mock_tiles)
76
+
75
77
  settings.UMAP_ALLOW_ANONYMOUS = True
76
78
  page.goto(f"{live_server.url}/map/new/")
77
79
  page.get_by_role("button", name="Open browser").click()
@@ -494,6 +496,39 @@ def test_import_csv_without_valid_latlon_headers(tilelayer, live_server, page):
494
496
  expect(page.locator('umap-alert div[data-level="error"]')).to_be_visible()
495
497
 
496
498
 
499
+ def test_import_csv_with_commas_in_latlon(tilelayer, live_server, page, settings):
500
+ settings.UMAP_ALLOW_ANONYMOUS = True
501
+ page.goto(f"{live_server.url}/map/new/")
502
+ page.get_by_title("Open browser").click()
503
+ layers = page.locator(".umap-browser .datalayer")
504
+ markers = page.locator(".leaflet-marker-icon")
505
+ page.get_by_title("Import data").click()
506
+ textarea = page.locator(".umap-upload textarea")
507
+ textarea.fill("lat;lon;foobar\n12,24;48,34;mypoint\n12,23;48,35;mypoint2")
508
+ page.locator('select[name="format"]').select_option("csv")
509
+ page.get_by_role("button", name="Import data", exact=True).click()
510
+ expect(layers).to_have_count(1)
511
+ expect(markers).to_have_count(2)
512
+ with page.expect_response(re.compile(r".*/datalayer/create/.*")):
513
+ page.get_by_role("button", name="Save").click()
514
+ datalayer = DataLayer.objects.last()
515
+ saved_data = json.loads(Path(datalayer.geojson.path).read_text())
516
+ assert saved_data["features"][0]["geometry"] == {
517
+ "coordinates": [
518
+ 48.35,
519
+ 12.23,
520
+ ],
521
+ "type": "Point",
522
+ }
523
+ assert saved_data["features"][1]["geometry"] == {
524
+ "coordinates": [
525
+ 48.34,
526
+ 12.24,
527
+ ],
528
+ "type": "Point",
529
+ }
530
+
531
+
497
532
  def test_create_remote_data(page, live_server, tilelayer):
498
533
  def handle(route):
499
534
  route.fulfill(
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: umap-project
3
- Version: 2.7.1
3
+ Version: 2.7.3
4
4
  Summary: Create maps with OpenStreetMap layers in a minute and embed them in your site.
5
5
  Author-email: Yohan Boniface <yb@enix.org>
6
6
  Maintainer-email: David Larlet <david@larlet.fr>
7
- License-File: LICENSE
8
7
  Keywords: django,geodjango,leaflet,map,openstreetmap
9
8
  Classifier: Development Status :: 4 - Beta
10
9
  Classifier: Intended Audience :: Developers
@@ -1,4 +1,4 @@
1
- umap/__init__.py,sha256=9Q043H_lTm3CNUBFKtTHx5hfV_u0qzcsBuYqRMN36U4,18
1
+ umap/__init__.py,sha256=zIpjG_2UB2HkyYPrqLS6Yqc8i-nJHx9wup2trY-yyOQ,18
2
2
  umap/admin.py,sha256=LoQytPGK6pLBqZ5QgQ9DIPAxhTG31cTtHOCqO9BY5S4,2645
3
3
  umap/apps.py,sha256=5ssKqPUuNJlapaBmr4LY_HDb7J1NFCT3wzythxQOOfs,109
4
4
  umap/asgi.py,sha256=CuVSNBwNb4AvuaD_Ha3ehtvf-c46ijZoVOSoP6WhXp8,432
@@ -227,7 +227,7 @@ umap/static/umap/js/modules/browser.js,sha256=FXM-Dau0gxqFj77k9FUPBuf6gvrcN6ezsf
227
227
  umap/static/umap/js/modules/caption.js,sha256=WVesRXhlIlr5SAiKDv7nOquihvq1pv-dDHsG6i3nQeU,4041
228
228
  umap/static/umap/js/modules/dompurify.js,sha256=SOmoM-pTgYCKCKXFo6-znemWPLiLsFgR4lxM_moWaA8,328
229
229
  umap/static/umap/js/modules/facets.js,sha256=K4qfnCtgIK7oMkL4YvAvPovHfaCK_aRyW5rl7nAFqK0,4677
230
- umap/static/umap/js/modules/formatter.js,sha256=rdOA_HQ89euI1ttLm2CXCUdphMc5-oU-69qeV3hk1Rk,4473
230
+ umap/static/umap/js/modules/formatter.js,sha256=AgRVx9mX_ZYmz7H0AgtJBBp6cPbMhv7KMqia0-uEcIY,4596
231
231
  umap/static/umap/js/modules/global.js,sha256=8s61zn5EKFfZi7j8Ek1-QOpb1D3uRsTEtb3Uv47IQVU,2005
232
232
  umap/static/umap/js/modules/help.js,sha256=k0gUpRf8ik9_okGH7Jv4JOjveNbbvSdk1yV_oZ3kSkQ,9870
233
233
  umap/static/umap/js/modules/i18n.js,sha256=dEpjsWoEZa-Tr5_MDO0tuWkt7kLL3crxXqhttyP-khU,1387
@@ -264,7 +264,7 @@ umap/static/umap/js/modules/sync/updaters.js,sha256=WP6hB2gyQKF18hOCy1Ll3UBeYRe2
264
264
  umap/static/umap/js/modules/sync/websocket.js,sha256=1UtvsTAm-gkfpBRcLPykPvDyax3mQSxG0KOjWhqnAIU,647
265
265
  umap/static/umap/js/modules/ui/base.js,sha256=8PN8TRIBqTANRufwVvV0XzOdaYQuRCnlWGbTGq8FZiM,2491
266
266
  umap/static/umap/js/modules/ui/contextmenu.js,sha256=VzC94uGUt8DkzC60Gcbz-MxivfSITEqUC91Fkpq1gjk,2550
267
- umap/static/umap/js/modules/ui/dialog.js,sha256=fP51HDkucZpXnx1v0h5eAckj77RsADZO_CzPRbjeKSU,5407
267
+ umap/static/umap/js/modules/ui/dialog.js,sha256=Jh2jb4qjxx_eTGAU9cRZHwWhtyk2HFVg7dkP8eCtBLQ,5403
268
268
  umap/static/umap/js/modules/ui/panel.js,sha256=aPogrO5AkxHTwtjw6oQri21eyIwDlOKNKp79ZPp2Ogs,3121
269
269
  umap/static/umap/js/modules/ui/tooltip.js,sha256=M2KBb5CA4AvaA-6QgfpUKMYQuGXzTqx4ZVA9fkMRBEs,1642
270
270
  umap/static/umap/locale/am_ET.js,sha256=oNSeVIZMKnxigBUVokMJSzYjLFGs5u4n2zzNjAtOV0A,33119
@@ -381,7 +381,7 @@ umap/static/umap/unittests/hlc.js,sha256=GvpBaBSgfMs0Zym0_zOs2QldUOcbFNVIKweBhuw
381
381
  umap/static/umap/unittests/sync.js,sha256=JSyT4ZwuRF1mMUzLLJzjIs_6iZz8S2iF1imJGLpSdwQ,12751
382
382
  umap/static/umap/unittests/utils.js,sha256=oVckWaCK26yR8nX9NlVEL_eVKf0i8Z-UNnK5K9xY9t0,25609
383
383
  umap/static/umap/vendors/colorbrewer/colorbrewer.js,sha256=wEHf7UslhI09j7tfzC1V9FLgTbZELDbbtGiL2x0y9vY,23051
384
- umap/static/umap/vendors/csv2geojson/csv2geojson.js,sha256=Cb88gwY7oibx7WL1Y3bfxc_Cur6yo62nLGaEmzP7Fbw,15530
384
+ umap/static/umap/vendors/csv2geojson/csv2geojson.js,sha256=FARwXdqk_yf3ttJmSyrJ204B9glI2YaZ2vuhaQPmhVk,15712
385
385
  umap/static/umap/vendors/dompurify/purify.es.js,sha256=z-0CPcG0TCk11WMdauq46gDt65U61y_i-ltN5dKc500,64057
386
386
  umap/static/umap/vendors/dompurify/purify.es.mjs.map,sha256=wzzJMafObQYxw2FUcIM4AJShakCHU1hiEm1MotxK79g,123512
387
387
  umap/static/umap/vendors/editable/Leaflet.Editable.js,sha256=5-RlyT7RhocenG85yKIhSPdCvUrpxH2o-lvWS9St5uA,69568
@@ -479,7 +479,7 @@ umap/templates/umap/components/alerts/alert.html,sha256=eQRALES_PzIP3qs16eXq9SGz
479
479
  umap/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
480
480
  umap/templatetags/umap_tags.py,sha256=OumX1AI9uWzNP3zbjexTz7lGp10FweW0NRFSsdQ_cuU,1759
481
481
  umap/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
482
- umap/tests/base.py,sha256=VsyFT-cqXEL0scSI69WKUdItfagqOZ3t2omINyVpb1M,4471
482
+ umap/tests/base.py,sha256=gR0wgPfTy6rqFLqAGSG2rHkQiRSbVsg1Qqs5CrSQIQg,4618
483
483
  umap/tests/conftest.py,sha256=KQCZanCTl1ABLIKOuyxS_cpBoXGiwjDc29jsLBiSWxY,1633
484
484
  umap/tests/settings.py,sha256=tY70LMFXyo_WijswqGyeWai7vBzM62k7IA8pkkbc9y4,816
485
485
  umap/tests/test_clean_tilelayer.py,sha256=wGTd_AHOTmQ4QMswAyc-1_lJmQOSyhY3OahLAusEIdA,2515
@@ -500,6 +500,7 @@ umap/tests/fixtures/categorized_highway.geojson,sha256=p7QHOd8nXi7yVq37gY6Ca8BXk
500
500
  umap/tests/fixtures/choropleth_region_chomage.geojson,sha256=mVVbYlf92Sr3wWH9ETm43FdHz1U3zjsn91HuU5H5r4Y,21325
501
501
  umap/tests/fixtures/circle.svg,sha256=P37vV2PhFPecAtY8qR3VlRuB79_wFaMeqKm2tX-2tkA,254
502
502
  umap/tests/fixtures/display_on_load.umap,sha256=eo4ecB3QUeCVu1u7COp7mZ8sCPkf2j4gGERE7N1v8GU,1845
503
+ umap/tests/fixtures/empty_tile.png,sha256=HHezSHZcZimfhpKaSSVOPm14k9OTAyL_eHndptkHGJk,103
503
504
  umap/tests/fixtures/star.svg,sha256=zIi-j16L1Fzxtqz2rV2NDDm1NDHBWQfM5O6MIeoxgEU,256
504
505
  umap/tests/fixtures/test_circles_layer.geojson,sha256=8S_zh4MA-5qqm43ETKfGz0hw84vuN2cXB1vTz9Syu3k,6454
505
506
  umap/tests/fixtures/test_import_osm_relation.json,sha256=SjZFqZ-qnxcrUnVkb43jI9iMBF8Il3-OPqxh62nNH9o,4249
@@ -514,7 +515,7 @@ umap/tests/fixtures/test_upload_georss.xml,sha256=lfmVA0qGDakCG48jjsLmSIE1U6iZ9y
514
515
  umap/tests/fixtures/test_upload_missing_name.json,sha256=klSMHb6laTghzU4AdIG1_p5UZ1LbAJCCKnJea0qEFAI,4566
515
516
  umap/tests/fixtures/test_upload_non_linear_ring.json,sha256=WOR0NnJHNUUW6VKzZyIxU7WL1llnAmEVJwCWla6XOds,1525
516
517
  umap/tests/integration/__init__.py,sha256=nqQ2miDnSZOKDuFhQ5saFN3qQuK73Cs6xL9Od-mEKG4,57
517
- umap/tests/integration/conftest.py,sha256=bo-ndi3ARHnkwRGo8fGi6lqTd_LdXWSOpgNyXEMcO0I,2436
518
+ umap/tests/integration/conftest.py,sha256=BQOBTX83QcF_M75ufbEm96cmIUSHn-REAmv3gKdrHaE,2448
518
519
  umap/tests/integration/helpers.py,sha256=vvGX5b-DS2fMVDdeXz1lH2IleZkRHjyL7DVvatJU8Do,344
519
520
  umap/tests/integration/test_anonymous_owned_map.py,sha256=d7YBsnO79NHRHgdYCYqmyALzeHtV__9dWObtvEfv0VM,10673
520
521
  umap/tests/integration/test_basics.py,sha256=_aURyfOJen41AQtTvjQ2pHP5GNc1KVV6NRSspSuxKL0,3760
@@ -536,7 +537,7 @@ umap/tests/integration/test_edit_polygon.py,sha256=JeIW6NcBltIl958uJ_T-0dRCT5gOo
536
537
  umap/tests/integration/test_export_map.py,sha256=jH0BXm-7Ov26OEkve9-xKMfRwXwR73zRrZLIQusyUOY,12112
537
538
  umap/tests/integration/test_facets_browser.py,sha256=J--y2rpI__0RIPzcTx4Kn2UwuurFdh-6i_Y4c6GxUyY,10658
538
539
  umap/tests/integration/test_features_id_generation.py,sha256=e99_8AxeMAi53JjVGlsI32zlrXGAU19FHJfTuYdiBVQ,1511
539
- umap/tests/integration/test_import.py,sha256=k_lrh8HhMLGtpuzYxREyCi_fAQTZboeq6Wd34_MkgV4,28995
540
+ umap/tests/integration/test_import.py,sha256=uD-gSQmlqYv1-htuuadGBE-VWfA_915o0ToSTaLrNhA,30344
540
541
  umap/tests/integration/test_map.py,sha256=2ZO54RFVycJKGczfioX0nU1oCu29FVC9hR6wbT4s1NE,8736
541
542
  umap/tests/integration/test_map_list.py,sha256=l1FImKnJkY7DupYX8waKaUZqhnORR20L8dzaqu-eF8E,1280
542
543
  umap/tests/integration/test_map_preview.py,sha256=kP0vkEiUN7EJNCvZgNeUAzrrXfgwpU0S2UnmOBV4P5A,3540
@@ -554,8 +555,8 @@ umap/tests/integration/test_view_marker.py,sha256=f_WqtVe0ZfDX_SOeNXFh54ubvhJWeu
554
555
  umap/tests/integration/test_view_polygon.py,sha256=NMJC6Nt9VpQ8FIU9Pqq2OspHv49xsWlsoXCr8iBa0VA,2060
555
556
  umap/tests/integration/test_view_polyline.py,sha256=n1QVIdl-Xg9yN9o-Jc6VnPhFAuUspsgY0odiUe_jJC4,1598
556
557
  umap/tests/integration/test_websocket_sync.py,sha256=pcEoXgEFvLBdmQA_rGa5BcHE2eBe3P0qZ6X3j4goRzQ,12764
557
- umap_project-2.7.1.dist-info/METADATA,sha256=F5SItQUyySWPv1tWPgUcYWX6msZwnFSLyeYhfBqDBbY,2888
558
- umap_project-2.7.1.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
559
- umap_project-2.7.1.dist-info/entry_points.txt,sha256=gz-KDQfEsMLBae8ABOD3foJsCYGPW1tA4Y394R_1RW8,39
560
- umap_project-2.7.1.dist-info/licenses/LICENSE,sha256=kQtrtRKgiPhcl7aO0-lmvbrNAXu7WHyiXvPrUk-TD2Q,820
561
- umap_project-2.7.1.dist-info/RECORD,,
558
+ umap_project-2.7.3.dist-info/METADATA,sha256=Kf1Y2qkgxEHGHAZoAEfNtkNU240TvT3x7pV3gyDSsIw,2866
559
+ umap_project-2.7.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
560
+ umap_project-2.7.3.dist-info/entry_points.txt,sha256=gz-KDQfEsMLBae8ABOD3foJsCYGPW1tA4Y394R_1RW8,39
561
+ umap_project-2.7.3.dist-info/licenses/LICENSE,sha256=kQtrtRKgiPhcl7aO0-lmvbrNAXu7WHyiXvPrUk-TD2Q,820
562
+ umap_project-2.7.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.2
2
+ Generator: hatchling 1.26.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any