Bump cherrypy from 18.8.0 to 18.9.0 (#2266)

* Bump cherrypy from 18.8.0 to 18.9.0

Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.8.0 to 18.9.0.
- [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst)
- [Commits](https://github.com/cherrypy/cherrypy/compare/v18.8.0...v18.9.0)

---
updated-dependencies:
- dependency-name: cherrypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update cherrypy==18.9.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2024-03-24 15:25:44 -07:00 committed by GitHub
commit faef9a94c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
673 changed files with 159850 additions and 11583 deletions

View file

@ -0,0 +1,75 @@
import os
import win32api
from win32com.shell import shell, shellcon
def testSHFileOperation(file_cnt):
temp_dir = os.environ["temp"]
orig_fnames = [
win32api.GetTempFileName(temp_dir, "sfo")[0] for x in range(file_cnt)
]
new_fnames = [
os.path.join(temp_dir, "copy of " + os.path.split(orig_fnames[x])[1])
for x in range(file_cnt)
]
pFrom = "\0".join(orig_fnames)
pTo = "\0".join(new_fnames)
shell.SHFileOperation(
(
0,
shellcon.FO_MOVE,
pFrom,
pTo,
shellcon.FOF_MULTIDESTFILES | shellcon.FOF_NOCONFIRMATION,
)
)
for fname in orig_fnames:
assert not os.path.isfile(fname)
for fname in new_fnames:
assert os.path.isfile(fname)
shell.SHFileOperation(
(
0,
shellcon.FO_DELETE,
fname,
None,
shellcon.FOF_NOCONFIRMATION | shellcon.FOF_NOERRORUI,
)
)
def testSHNAMEMAPPINGS(file_cnt):
## attemps to move a set of files to names that already exist, and generated filenames should be returned
## as a sequence of 2-tuples created from SHNAMEMAPPINGS handle
temp_dir = os.environ["temp"]
orig_fnames = [
win32api.GetTempFileName(temp_dir, "sfo")[0] for x in range(file_cnt)
]
new_fnames = [win32api.GetTempFileName(temp_dir, "sfo")[0] for x in range(file_cnt)]
pFrom = "\0".join(orig_fnames)
pTo = "\0".join(new_fnames)
rc, banyaborted, NameMappings = shell.SHFileOperation(
(
0,
shellcon.FO_MOVE,
pFrom,
pTo,
shellcon.FOF_MULTIDESTFILES
| shellcon.FOF_NOCONFIRMATION
| shellcon.FOF_RENAMEONCOLLISION
| shellcon.FOF_WANTMAPPINGHANDLE,
)
)
for old_fname, new_fname in NameMappings:
print("Old:", old_fname, "New:", new_fname)
assert len(NameMappings) == file_cnt
testSHFileOperation(10)
testSHFileOperation(1)
testSHNAMEMAPPINGS(5)

View file

@ -0,0 +1,21 @@
from win32com.shell import shell
from win32com.shell.shellcon import *
sf = shell.SHGetDesktopFolder()
print("Shell Folder is", sf)
names = []
for i in sf: # Magically calls EnumObjects
name = sf.GetDisplayNameOf(i, SHGDN_NORMAL)
names.append(name)
# And get the enumerator manually
enum = sf.EnumObjects(0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN)
num = 0
for i in enum:
num += 1
if num != len(names):
print("Should have got the same number of names!?")
print("Found", len(names), "items on the desktop")
for name in names:
print(name)

View file

@ -0,0 +1,69 @@
# Test IShellItem and related interfaces
import unittest
from win32com.shell import knownfolders, shell, shellcon
class TestShellItem(unittest.TestCase):
def assertShellItemsEqual(self, i1, i2):
n1 = i1.GetDisplayName(shellcon.SHGDN_FORPARSING)
n2 = i2.GetDisplayName(shellcon.SHGDN_FORPARSING)
self.assertEqual(n1, n2)
def test_idlist_roundtrip(self):
pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
item = shell.SHCreateItemFromIDList(pidl, shell.IID_IShellItem)
pidl_back = shell.SHGetIDListFromObject(item)
self.assertEqual(pidl, pidl_back)
def test_parsing_name(self):
sf = shell.SHGetDesktopFolder()
flags = shellcon.SHCONTF_FOLDERS | shellcon.SHCONTF_NONFOLDERS
children = sf.EnumObjects(0, flags)
child_pidl = next(children)
name = sf.GetDisplayNameOf(child_pidl, shellcon.SHGDN_FORPARSING)
item = shell.SHCreateItemFromParsingName(name, None, shell.IID_IShellItem)
# test the name we get from the item is the same as from the folder.
self.assertEqual(name, item.GetDisplayName(shellcon.SHGDN_FORPARSING))
def test_parsing_relative(self):
desktop_pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
desktop_item = shell.SHCreateItemFromIDList(desktop_pidl, shell.IID_IShellItem)
sf = shell.SHGetDesktopFolder()
flags = shellcon.SHCONTF_FOLDERS | shellcon.SHCONTF_NONFOLDERS
children = sf.EnumObjects(0, flags)
child_pidl = next(children)
name_flags = shellcon.SHGDN_FORPARSING | shellcon.SHGDN_INFOLDER
name = sf.GetDisplayNameOf(child_pidl, name_flags)
item = shell.SHCreateItemFromRelativeName(
desktop_item, name, None, shell.IID_IShellItem
)
# test the name we get from the item is the same as from the folder.
self.assertEqual(name, item.GetDisplayName(name_flags))
def test_create_in_known_folder(self):
item = shell.SHCreateItemInKnownFolder(
knownfolders.FOLDERID_Desktop, 0, None, shell.IID_IShellItem
)
# this will do for now :)
def test_create_item_with_parent(self):
desktop_pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
desktop_item = shell.SHCreateItemFromIDList(desktop_pidl, shell.IID_IShellItem)
sf = shell.SHGetDesktopFolder()
flags = shellcon.SHCONTF_FOLDERS | shellcon.SHCONTF_NONFOLDERS
children = sf.EnumObjects(0, flags)
child_pidl = next(children)
item1 = shell.SHCreateItemWithParent(
desktop_pidl, None, child_pidl, shell.IID_IShellItem
)
item2 = shell.SHCreateItemWithParent(None, sf, child_pidl, shell.IID_IShellItem)
self.assertShellItemsEqual(item1, item2)
if __name__ == "__main__":
unittest.main()