Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gui/wxpython/animation/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def test():
tempDir = "/tmp/test"
if Path(tempDir).exists():
shutil.rmtree(tempDir)
os.mkdir(tempDir)
Path(tempDir).mkdir()
# comment this line to keep the directory after program ends
# cleanUp = CleanUp(tempDir)
# import atexit
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ def SaveToFile(self, settings=None):
dirPath = GetSettingsPath()
if not Path(dirPath).exists():
try:
os.mkdir(dirPath)
Path(dirPath).mkdir()
except OSError:
GError(_("Unable to create settings directory"))
return None
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/toolboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _createPath(path):
"""Creates path (for toolboxes) if it doesn't exist'"""
if not Path(path).exists():
try:
os.mkdir(path)
Path(path).mkdir()
except OSError as e:
# we cannot use GError or similar because the gui doesn't start at
# all
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def ScheduleWatchCurrentMapset(self):
path = os.path.join(mapset_path, directory)
if not Path(path).exists():
try:
os.mkdir(path)
Path(path).mkdir()
except OSError:
pass
if Path(path).exists():
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/gcp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2705,8 +2705,7 @@ def MakeVGroup(self):

dirname = os.path.dirname(self.vgrpfile)

if not Path(dirname).exists():
os.makedirs(dirname)
Path(dirname).mkdir(parents=True, exist_ok=True)

with open(self.vgrpfile, mode="w") as f:
f.writelines(vect + "\n" for vect in vgrouplist)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/image2target/ii2t_gis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ def CreateNewMapset(self, mapset):
try:
self.gisdbase = self.tgisdbase.GetValue()
location = self.listOfLocations[self.lblocations.GetSelection()]
os.mkdir(os.path.join(self.gisdbase, location, mapset))
Path(os.path.join(self.gisdbase, location, mapset)).mkdir()
# copy WIND file and its permissions from PERMANENT and set
# permissions to u+rw,go+r
shutil.copy(
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/location_wizard/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2663,7 +2663,7 @@ def OnWizFinished(self):
if not Path(database).is_dir():
# create new directory
try:
os.mkdir(database)
Path(database).mkdir()
except OSError as error:
GError(
parent=self.wizard,
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/rlisetup/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def retRLiPath():
rlipath = os.path.join(grass_config_dir, "r.li")
if Path(rlipath).exists():
return rlipath
os.mkdir(rlipath)
Path(rlipath).mkdir()
return rlipath


Expand Down
2 changes: 1 addition & 1 deletion imagery/i.rectify/testsuite/test_i_rectify.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def setUpClass(cls):
cls.group_path = os.path.join(
env["GISDBASE"], env["LOCATION_NAME"], env["MAPSET"], "group", cls.group
)
os.makedirs(cls.group_path, exist_ok=True)
Path(cls.group_path).mkdir(exist_ok=True, parents=True)
cls.points_path = os.path.join(cls.group_path, "POINTS")
cls.runModule(
"i.target",
Expand Down
32 changes: 16 additions & 16 deletions imagery/i.signatures/testsuite/test_i_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
for details
"""

import os
import shutil
import json
from pathlib import Path

from grass.gunittest.case import TestCase
from grass.gunittest.main import test
Expand All @@ -34,27 +34,27 @@ def setUpClass(cls):
cls.sigdirs = []
# As signatures are created directly not via signature creation
# tools, we must ensure signature directories exist
os.makedirs(f"{cls.mpath}/signatures/sig/", exist_ok=True)
os.makedirs(f"{cls.mpath}/signatures/sigset/", exist_ok=True)
os.makedirs(f"{cls.mpath}/signatures/libsvm/", exist_ok=True)
Path(f"{cls.mpath}/signatures/sig/").mkdir(exist_ok=True, parents=True)
Path(f"{cls.mpath}/signatures/sigset/").mkdir(exist_ok=True, parents=True)
Path(f"{cls.mpath}/signatures/libsvm/").mkdir(exist_ok=True, parents=True)
# Fake signature of sig type
cls.sig_name1 = tempname(10)
sig_dir1 = f"{cls.mpath}/signatures/sig/{cls.sig_name1}"
os.makedirs(sig_dir1)
Path(sig_dir1).mkdir(parents=True)
cls.sigdirs.append(sig_dir1)
sigfile_name1 = f"{sig_dir1}/sig"
open(sigfile_name1, "a").close()
# Fake signature of sigset type
cls.sig_name2 = tempname(10)
sig_dir2 = f"{cls.mpath}/signatures/sigset/{cls.sig_name2}"
os.makedirs(sig_dir2)
Path(sig_dir2).mkdir(parents=True)
cls.sigdirs.append(sig_dir2)
sigfile_name2 = f"{sig_dir2}/sig"
open(sigfile_name2, "a").close()
# Fake signature of libsvm type
cls.sig_name3 = tempname(10)
sig_dir3 = f"{cls.mpath}/signatures/libsvm/{cls.sig_name3}"
os.makedirs(sig_dir3)
Path(sig_dir3).mkdir(parents=True)
cls.sigdirs.append(sig_dir3)
sigfile_name3 = f"{sig_dir3}/sig"
open(sigfile_name3, "a").close()
Expand Down Expand Up @@ -151,48 +151,48 @@ def setUpClass(cls):
cls.sigdirs = []
# As signatures are created directly not via signature creation
# tools, we must ensure signature directories exist
os.makedirs(f"{cls.mpath}/signatures/sig/", exist_ok=True)
os.makedirs(f"{cls.mpath}/signatures/sigset/", exist_ok=True)
os.makedirs(f"{cls.mpath}/signatures/libsvm/", exist_ok=True)
Path(f"{cls.mpath}/signatures/sig/").mkdir(exist_ok=True, parents=True)
Path(f"{cls.mpath}/signatures/sigset/").mkdir(exist_ok=True, parents=True)
Path(f"{cls.mpath}/signatures/libsvm/").mkdir(exist_ok=True, parents=True)
# sig
cls.sig_name1 = tempname(10)
sig_dir1 = f"{cls.mpath}/signatures/sig/{cls.sig_name1}"
os.makedirs(sig_dir1)
Path(sig_dir1).mkdir(parents=True)
cls.sigdirs.append(sig_dir1)
sigfile_name1 = f"{sig_dir1}/sig"
open(sigfile_name1, "a").close()
# sig
cls.sig_name2 = tempname(10)
sig_dir2 = f"{cls.mpath}/signatures/sig/{cls.sig_name2}"
os.makedirs(sig_dir2)
Path(sig_dir2).mkdir(parents=True)
cls.sigdirs.append(sig_dir2)
sigfile_name2 = f"{sig_dir2}/sig"
open(sigfile_name2, "a").close()
# sigset
cls.sig_name3 = tempname(10)
sig_dir3 = f"{cls.mpath}/signatures/sigset/{cls.sig_name3}"
os.makedirs(sig_dir3)
Path(sig_dir3).mkdir(parents=True)
cls.sigdirs.append(sig_dir3)
sigfile_name3 = f"{sig_dir3}/sig"
open(sigfile_name3, "a").close()
# sigset
cls.sig_name4 = tempname(10)
sig_dir4 = f"{cls.mpath}/signatures/sigset/{cls.sig_name4}"
os.makedirs(sig_dir4)
Path(sig_dir4).mkdir(parents=True)
cls.sigdirs.append(sig_dir4)
sigfile_name4 = f"{sig_dir4}/sig"
open(sigfile_name4, "a").close()
# libsvm
cls.sig_name5 = tempname(10)
sig_dir5 = f"{cls.mpath}/signatures/libsvm/{cls.sig_name5}"
os.makedirs(sig_dir5)
Path(sig_dir5).mkdir(parents=True)
cls.sigdirs.append(sig_dir5)
sigfile_name5 = f"{sig_dir5}/sig"
open(sigfile_name5, "a").close()
# libsvm
cls.sig_name6 = tempname(10)
sig_dir6 = f"{cls.mpath}/signatures/libsvm/{cls.sig_name6}"
os.makedirs(sig_dir6)
Path(sig_dir6).mkdir(parents=True)
cls.sigdirs.append(sig_dir6)
sigfile_name6 = f"{sig_dir6}/sig"
open(sigfile_name6, "a").close()
Expand Down
14 changes: 7 additions & 7 deletions lib/imagery/testsuite/test_imagery_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
for details
"""

import os
import shutil
from pathlib import Path

from grass.gunittest.case import TestCase
from grass.gunittest.main import test
Expand All @@ -35,22 +35,22 @@ def setUpClass(cls):
cls.sigdirs = []
# As signatures are created directly not via signature creation
# tools, we must ensure signature directories exist
os.makedirs(f"{cls.mpath}/signatures/sig/", exist_ok=True)
os.makedirs(f"{cls.mpath}/signatures/sigset/", exist_ok=True)
os.makedirs(f"{cls.mpath}/signatures/libsvm/", exist_ok=True)
Path(f"{cls.mpath}/signatures/sig/").mkdir(exist_ok=True, parents=True)
Path(f"{cls.mpath}/signatures/sigset/").mkdir(exist_ok=True, parents=True)
Path(f"{cls.mpath}/signatures/libsvm/").mkdir(exist_ok=True, parents=True)
cls.sig_name1 = tempname(10)
cls.sig_dir1 = f"{cls.mpath}/signatures/sigset/{cls.sig_name1}"
os.makedirs(cls.sig_dir1)
Path(cls.sig_dir1).mkdir(parents=True)
cls.sigdirs.append(cls.sig_dir1)
open(f"{cls.sig_dir1}/sig", "a").close()
cls.sig_name2 = tempname(10)
cls.sig_dir2 = f"{cls.mpath}/signatures/sig/{cls.sig_name2}"
os.makedirs(cls.sig_dir2)
Path(cls.sig_dir2).mkdir(parents=True)
cls.sigdirs.append(cls.sig_dir2)
open(f"{cls.sig_dir2}/sig", "a").close()
cls.sig_name3 = tempname(10)
cls.sig_dir3 = f"{cls.mpath}/signatures/libsvm/{cls.sig_name3}"
os.makedirs(cls.sig_dir3)
Path(cls.sig_dir3).mkdir(parents=True)
cls.sigdirs.append(cls.sig_dir3)
open(f"{cls.sig_dir3}/sig", "a").close()

Expand Down
Loading
Loading