Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
348 commits
Select commit Hold shift + click to select a range
aeab0d4
Fix stacklevel for Message.interaction deprecation warning
Jackenmen Aug 28, 2024
624b5b7
Use fallback audioop package for Python v3.13 or higher
Rapptz Aug 28, 2024
643a7f4
Add DummyCookieJar to client owned ClientSession
DeepSJain Aug 28, 2024
fde7131
Add missing guild incident fields
Soheab Aug 28, 2024
62e5280
Add support Member.fetch_voice
codeofandrin Aug 28, 2024
463b4bd
Add support for application emojis
Soheab Aug 28, 2024
a08f7a1
Add a warning if interaction endpoint URL is set on login
Rapptz Aug 29, 2024
6d81981
Remove aiodns from being used on Windows
mikeshardmind Aug 29, 2024
d3e63a0
Fix Guild.invites_paused method
owocado Aug 29, 2024
dee5bf6
Update MemberFlags to have newest values
Rapptz Aug 29, 2024
733c583
Remove _get_poll lookup in Message constructor
Rapptz Aug 31, 2024
66d7405
Remove outdated leftover comment about polls
Rapptz Aug 31, 2024
df4b1c8
Move MissingApplicationID to top-level discord namespace
Rapptz Aug 31, 2024
59f877f
Fix and add test for missing discord.Permission bits
mikeshardmind Sep 2, 2024
a70217a
Support for Soundboard and VC effects
codeofandrin Oct 9, 2024
0298f81
Add more tests for colour, embeds, files, buttons and modals
junah201 Oct 9, 2024
053f29c
Update all channel clone implementations
Soheab Oct 9, 2024
3e168a9
Improve typing of app command transformers
mikeshardmind Oct 9, 2024
d10e70e
[docs] Fix spelling
lmaotrigine Oct 9, 2024
91f300a
Add zstd gateway compression to speed profile
LostLuma Oct 9, 2024
ec9fd57
Add support for AEAD XChaCha20 Poly1305 encryption mode
EvieePy Oct 9, 2024
1ad45f5
Add missing error for Guild.fetch_automod_rule
Gooraeng Oct 9, 2024
0ce75f3
[commands] Fix issue with category cooldowns outside of guild channels
bijij Oct 9, 2024
58b6929
Add SKU subscriptions support
MCausc78 Oct 9, 2024
9d7c253
Add missing error for Message.edit
iyad-f Oct 9, 2024
20c543f
Add support for message call
codeofandrin Oct 10, 2024
a5f9350
Add category parameter to abc.GuildChannel.clone
codeofandrin Oct 10, 2024
04b8f38
Remove leftover print statement
owocado Oct 10, 2024
b3141db
Add support for messages with type purchase_notification
Soheab Oct 10, 2024
48cf500
Fix Message.system_content for role_subscription_purchase renewal type
owocado Oct 11, 2024
b11f19a
Add proxy support for get_from_cdn
CloudyAvalon Oct 11, 2024
99a7093
Add support for message forwarding
DA-344 Oct 11, 2024
b207c8a
[commands] Add perms object param to default_permissions decorator
codeofandrin Oct 12, 2024
2087564
Fix MessageReferenceType not being public
z03h Oct 12, 2024
5734996
Fix soundboard sounds event data type
Rapptz Oct 12, 2024
442ad40
[commands] Add SoundboardSoundConverter
z03h Oct 13, 2024
ca85782
[commands] Fix Context.defer unconditionally deferring
Rapptz Oct 13, 2024
9da131e
Fix variance typing issue with CommandTree.error decorator
PythonCoderAS Oct 14, 2024
b0c66b7
Fix NameError in sku.py
Soheab Oct 16, 2024
c5e7406
[commands] Unwrap Parameter if given as default to commands.parameter
Soheab Oct 16, 2024
354ae42
Fix abc.GuildChannel.clone implementations
Soheab Oct 16, 2024
c8ecbd8
Add Message.forward flag
diceroll123 Oct 22, 2024
e94fb45
Add note about using venvs on Linux
Rapptz Oct 22, 2024
a0b0a97
Support enforce_nonce and add random nonce for message creation
Rapptz Oct 27, 2024
ed61588
Handle improper 1000 closures by Discord
Rapptz Oct 28, 2024
d08fd59
Avoid returning in finally
mikeshardmind Oct 30, 2024
af75985
Fix incorrect import
diceroll123 Oct 31, 2024
c7305b0
[commands] Respect enabled kwarg for hybrid app commands
Soheab Nov 7, 2024
814ce3c
Add command target to MessageInteractionMetadata
Soheab Nov 9, 2024
7db879b
Clear up add_roles and remove_roles documentation
MajorTanya Nov 9, 2024
5c4c281
Sanitize invite argument before calling the invite info endpoint
Rapptz Nov 24, 2024
e1b6310
Remove / from being safe from URI encoding when constructing paths
Rapptz Nov 24, 2024
7f95357
Add mention property to PartialMessageable
Soheab Dec 1, 2024
9806aeb
Add public method to get session start limits
mikeshardmind Dec 1, 2024
fcd9239
Add Client.fetch_guild_preview method
gingershaped Jan 15, 2025
bb5a470
Bump Sphinx to 5.3.0
LevBernstein Jan 15, 2025
f2aa0b8
[tasks] Fix race condition with set_result
mikeshardmind Jan 15, 2025
eb15aa8
Add exclude_deleted parameter to Client.entitlements
DA-344 Jan 15, 2025
6214942
Fix SessionStartLimits and SKU.subscriptions docstrings
DA-344 Jan 15, 2025
9dc8e27
Add ForumChannel.members property
LostLuma Jan 15, 2025
ed95f2f
Parse full message for raw message edit event
Soheab Jan 15, 2025
7c8503f
Fix callable FlagConverter defaults on hybrid commands
DA-344 Jan 15, 2025
1646471
Revert "Bump Sphinx to 5.3.0"
Rapptz Jan 15, 2025
55974eb
Fix MessageSnapshot sticker_items typo
vionya Jan 15, 2025
cf6d7ff
Fix bug due to typo in async pagination of entitlements loop
AbstractUmbra Jan 15, 2025
1537102
Temporary dependency for docs extra on python 3.13+
mikeshardmind Jan 15, 2025
fa1cc00
Return new instance in Poll.end to avoid inconsistencies
nthnwj Jan 15, 2025
1edec93
Update Member.timed_out_until docstring
scrazzz Jan 15, 2025
2c3938d
Update Client.create_application_emoji docs
tom-jm69 Jan 16, 2025
7db3911
Add __repr__ to Interaction
owocado Jan 16, 2025
d956058
[commands] Fix _fallback attr not being set on replace for Parameter
AbstractUmbra Jan 16, 2025
d5c80b6
Add optional dev dependencies
Soheab Jan 16, 2025
b1b7369
Added scopeless kwarg to discord.utils.oauth_url
Depreca1ed Jan 17, 2025
743ef27
[commands] Correct ExtensionNotFound error message
Soheab Jan 19, 2025
ff2ad34
Add support for multiple subscription tier SKUs
DA-344 Jan 19, 2025
afbbc07
Add support for poll result messages
DA-344 Jan 19, 2025
418a791
Add raw presence update evemt
EvieePy Jan 21, 2025
db7b2d9
Change default file size limit
mikeshardmind Jan 22, 2025
88d7bd1
Fix message_pin, message_unpin target id being None
iyad-f Feb 9, 2025
7f51136
Fix wait_for overloads
Soheab Feb 9, 2025
a8134df
Fix Embed type attribute ddocs link
MajorTanya Feb 9, 2025
42e4a87
Fix typo in voice server update state handling
dolfies Feb 9, 2025
52967ec
Fix path sanitation for absolute Windows paths
tailoric Feb 9, 2025
76eb126
Add 'mention' property in PartialWebhookChannel
Gooraeng Feb 9, 2025
8a95c01
Add support for embed flags and update attachment flags
DA-344 Feb 12, 2025
4c3ce8f
Fix Member.roles having None members
Depreca1ed Feb 12, 2025
8edf433
Implement rich role.move interface
LeoCx1000 Feb 12, 2025
6ab747f
Add support for sending views in stateless webhooks
DA-344 Feb 17, 2025
fa158a5
Add support for getting and editing integration_types_config applicat…
Soheab Feb 18, 2025
5b78097
Add support for Interaction Callback Resource
DA-344 Feb 18, 2025
776fc22
[commands] Use interaction response within Context.send
Rapptz Feb 18, 2025
1cdf710
Rename InteractionCallback to InteractionCallbackResponse
Rapptz Feb 18, 2025
8953938
Update Pyright to v1.1.394
Rapptz Feb 18, 2025
43e1c55
Remove with_response parameter documentation
Rapptz Feb 18, 2025
e8d571b
Add missing Poll attribute documentation
Rapptz Feb 18, 2025
3ad0662
Document SoundboardSoundConverter
Rapptz Feb 18, 2025
a1aa597
Add changelog for v2.5
Rapptz Feb 18, 2025
e837ac1
Version bump to v2.5.0
Rapptz Feb 18, 2025
2cf1bab
Version bump for development
Rapptz Feb 18, 2025
ae2410f
feat: Components V2
DA-344 Feb 18, 2025
b2f77b9
Merge branch 'master' of https://github.com/rapptz/discord.py
DA-344 Feb 18, 2025
4703234
Pass BotT type argument to DeferTyping
itswilliboy Feb 19, 2025
0e4f061
Fix InteractionCallbackResponse.resource having incorrect state
DA-344 Feb 19, 2025
19f02c4
Document message types that can have a default message reference
Jackenmen Feb 24, 2025
a8b4eb1
Create ScheduledEvent on cache miss in SCHEDULED_EVENT_DELETE
dolfies Feb 24, 2025
93426da
Improve on_timeout FAQ
Soheab Feb 24, 2025
7513456
feat: First components v2 commit
DA-344 Feb 28, 2025
66f3548
Add defaults for message object parsing
dolfies Feb 28, 2025
fbe2b35
Add note about NotFound for Messageable.send
Rapptz Feb 28, 2025
335b397
chore: Update components
DA-344 Mar 1, 2025
ce3f48e
fix: License quotes
DA-344 Mar 1, 2025
eea95d9
chore: Add more components and some things on weights and so
DA-344 Mar 1, 2025
8689718
chore: more things to components v2
DA-344 Mar 1, 2025
76e2028
chore: More v2 components on UI and idk some changes
DA-344 Mar 1, 2025
b872925
chore: Remove views things
DA-344 Mar 2, 2025
4467eba
chore: Donnot subclass AttachmentBase and fake payload for Attachment…
DA-344 Mar 2, 2025
4aef97e
chore: undo attachment file move
DA-344 Mar 2, 2025
0f04d48
chore: Remove views leftover
DA-344 Mar 2, 2025
2b14f0b
chore: message attachments things
DA-344 Mar 2, 2025
f42b15f
chore: Remove attachment.py
DA-344 Mar 2, 2025
39998b4
chore: Revert double quotes
DA-344 Mar 2, 2025
28efb15
chore: Finished first components v2 impl
DA-344 Mar 2, 2025
de8a723
chore: docs and some changes
DA-344 Mar 2, 2025
7824c3f
chore: fix everything lol
DA-344 Mar 2, 2025
5d1300d
fix: documentation errors
DA-344 Mar 2, 2025
a1bc73b
fix: add SeparatorComponent to __all__
DA-344 Mar 2, 2025
14d8f31
chore: Add missing enums to docs and fix docstrings
DA-344 Mar 2, 2025
4202ef4
chore: Format ValueError no row.setter to show the maxrow and not 10
DA-344 Mar 2, 2025
15ec28b
chore: yet more docs fix
DA-344 Mar 2, 2025
86d967c
fix: Docs failing due to :class:
DA-344 Mar 2, 2025
e7693d9
chore: buttons cannot be outside action rows
DA-344 Mar 2, 2025
5fda19e
chore: add ui.Section.is_dispatchable
DA-344 Mar 2, 2025
0a03968
chore: fix errors
DA-344 Mar 2, 2025
a4389cb
chore: Revert change View.to_components() sorting key
DA-344 Mar 2, 2025
70bdcfa
chore: Update item _view attr and # type: ignore self.accessory in se…
DA-344 Mar 2, 2025
568a3c3
chore: Run black
DA-344 Mar 2, 2025
bfae3a5
chore: Make type the first key on to_components_dict
DA-344 Mar 2, 2025
869b68f
fix: _ViewWeights.v2_weights always returning False
DA-344 Mar 2, 2025
faa31ff
chore: Add notes and versionaddeds
DA-344 Mar 2, 2025
de5720e
Fix attachment is_spoiler() and is_voice_message()
dolfies Mar 3, 2025
cab4732
Make embed flags required and add them to all media fields
dolfies Mar 4, 2025
6b0a6ee
Add v2.5.1 changelog
Rapptz Mar 4, 2025
73f261d
Version bump to v2.5.1
Rapptz Mar 4, 2025
973bb50
Version bump for development
Rapptz Mar 4, 2025
18f72f5
idk some things
DA-344 Mar 4, 2025
2f8b262
Fix improper class in audit log docs
LeoCx1000 Mar 4, 2025
8594dd1
Fix embed media flags regression
dolfies Mar 4, 2025
f4bce1c
Add changelog for v2.5.2
Rapptz Mar 5, 2025
d2a6ccf
Version bump to v2.5.2
Rapptz Mar 5, 2025
460d188
Version bump for development
Rapptz Mar 5, 2025
2685516
update PyNaCl minimum version dependency
rishitkhare Mar 5, 2025
cbdc618
chore: Finish ActionRow and fix ViewStore.add_view
DA-344 Mar 6, 2025
8f59216
chore: more components v2 things and finished danny's suggested impl
DA-344 Mar 6, 2025
6c02a7d
chore: docs
DA-344 Mar 6, 2025
67bfa57
chore: run black
DA-344 Mar 6, 2025
0b23f10
chore: fix discord.ui.View
DA-344 Mar 6, 2025
eae0895
chore: fix linting
DA-344 Mar 6, 2025
c63ad95
chore: more linting things and docs
DA-344 Mar 6, 2025
7338da2
fix linting yet again
DA-344 Mar 6, 2025
c5ffc6a
chore: fix LayoutView.to_components
DA-344 Mar 7, 2025
59991e9
chore: fix Container.to_components returning NotImplemented
DA-344 Mar 7, 2025
502051a
chore: update ActionRow and View
DA-344 Mar 7, 2025
f1f6ef8
chore: remove unused imports
DA-344 Mar 7, 2025
9e18c5a
chore: typing stuff
DA-344 Mar 7, 2025
e660010
chore: more typing stuff
DA-344 Mar 7, 2025
c48c512
chore: some fixes of bugs reported on the bikeshedding post
DA-344 Mar 9, 2025
8cb80bf
chore: improve check on container.__init_subclass__
DA-344 Mar 9, 2025
7601533
chore: add id attr to components and black item.py
DA-344 Mar 9, 2025
9891f85
chore: add id to every item
DA-344 Mar 9, 2025
c93ee07
fix: Container._colour raising ValueError
DA-344 Mar 9, 2025
09fceae
fix: Container.is_dispatchable making buttons not work
DA-344 Mar 9, 2025
8399677
fix: Container children not being added to view store
DA-344 Mar 9, 2025
9700606
chore: Update Container._update_store_data
DA-344 Mar 9, 2025
0f7d72b
chore: Update Container.is_dispatchable
DA-344 Mar 9, 2025
cf4db91
chore: Remove unused imports
DA-344 Mar 9, 2025
6d50c88
chore: Metadata for Section
DA-344 Mar 9, 2025
9655749
fix: Section.accessory not being dispatched
DA-344 Mar 9, 2025
5120b0d
chore: Update ViewStore to handle Section.accessory properly
DA-344 Mar 10, 2025
4c668ba
template
DA-344 Mar 10, 2025
84ad47f
chore: Remove unneccessary # type: ignore
DA-344 Mar 10, 2025
7433ad0
chore: Fix Section.accessory raising an error when clicked
DA-344 Mar 10, 2025
810fe57
chore: Update container to also take in account section accessories
DA-344 Mar 10, 2025
52f9b6a
chore: Some changes on how Section.accessory is handled in Container
DA-344 Mar 10, 2025
8561953
chore: Add container add/remove/clear_item(s)
DA-344 Mar 10, 2025
8926f28
fix: Section.accessory._view being None when in a container
DA-344 Mar 10, 2025
b1e8aef
fix: Containers not dispatching ActionRow items correctly
DA-344 Mar 10, 2025
4c662a9
chore: Some changes, fixes, and typo corrections
DA-344 Mar 20, 2025
dddf502
Merge branch 'feat/components-v2' of https://github.com/DA-344/d.py i…
DA-344 Mar 20, 2025
a93a639
Merge branch 'master' of https://github.com/rapptz/discord.py into fe…
DA-344 Mar 20, 2025
4ef1e46
chore: Add ActionRow to docs
DA-344 Mar 20, 2025
86dd8d8
chore: Add get_item_by_id to remaining items
DA-344 Apr 16, 2025
cd9f776
some fixes and typings
DA-344 Apr 18, 2025
5dddf65
run black
DA-344 Apr 18, 2025
a1216e7
fix error when using Message.components
DA-344 Apr 18, 2025
cba602d
chore: Add more params to MessageFlags.components_v2 docstring
DA-344 Apr 18, 2025
e9d942b
chore: typings
DA-344 Apr 18, 2025
ec186ab
chore: update docstrings
DA-344 Apr 18, 2025
b0bab6d
fix: `children` parameter being ignored on Container
DA-344 Apr 19, 2025
412caa6
update ActionRow.select docstring
DA-344 Apr 19, 2025
9026bcb
add note about Item.custom_id
DA-344 Apr 19, 2025
cf949c6
chore: some bunch fixes and make interaction_check's work on every item
DA-344 Apr 19, 2025
fb8e85d
fix: typings
DA-344 Apr 19, 2025
fe7d7f2
chore: Update view param docstring on send methods
DA-344 Apr 19, 2025
195b9e7
chore: Allow ints on accent_colo(u)r on Container's
DA-344 Apr 19, 2025
7028911
fix: Item.view not being correctly set when using 'add_item' methods
DA-344 Apr 19, 2025
86ec834
chore: Update BaseView.__repr__
DA-344 Apr 19, 2025
8376dbf
chore: Add Thumbnail.description char limit to docs
DA-344 Apr 20, 2025
9f3f8f1
chore: Add MediaGalleryItem.description char limit to docs
DA-344 Apr 20, 2025
e0c0753
chore: Update interactions docs
DA-344 Apr 20, 2025
2248df0
chore: Add char limit to TextDisplay
DA-344 Apr 20, 2025
22e4738
chore: Fix interaction_check not being called correctly
DA-344 Apr 20, 2025
92cb557
chore: Remove leftover code
DA-344 Apr 20, 2025
876397e
chore: Improve Items documentation
DA-344 Apr 22, 2025
4cb3b41
chore: more docs things ig
DA-344 Apr 22, 2025
f5ec966
chore: typings and docs and idk what more
DA-344 Apr 22, 2025
0dbd465
fix: g
DA-344 Apr 22, 2025
af952d3
chore: add LayoutView example
DA-344 Apr 22, 2025
f5415f5
chore: remove deprecation warning
DA-344 Apr 23, 2025
952a623
remove unused import
DA-344 Apr 23, 2025
c5d7450
fix: strange error: https://discord.com/channels/336642139381301249/1…
DA-344 Apr 23, 2025
01d3bb2
Merge branch 'feat/components-v2' of https://github.com/DA-344/d.py i…
DA-344 Apr 23, 2025
dbd8cd6
chore: update container and things
DA-344 Apr 23, 2025
7ed69ec
chore: children, * -> *children
DA-344 Apr 23, 2025
95a22ce
.
DA-344 Apr 24, 2025
776d5e1
unpack
DA-344 Apr 24, 2025
038ca4a
more unpack
DA-344 Apr 24, 2025
ab49798
chore: Update examples and things
DA-344 Apr 25, 2025
5a1afb6
chore: Update message.component doc types
DA-344 Apr 25, 2025
de4d8c4
fix: LayoutView’s duplicating items
DA-344 Apr 26, 2025
5162d17
fix typings and errors
DA-344 Apr 26, 2025
a8285e1
more typings
DA-344 Apr 26, 2025
aa41094
fix: Non-dispatchable items breaking persistent views
DA-344 Apr 29, 2025
7741166
chore: Add (View|Container|ActionRow|Section).walk_children methods
DA-344 Apr 29, 2025
0621b38
chore: Update overloads typings
DA-344 Apr 29, 2025
2da3a14
chore: Raise LayoutView component limit to 40 and remove component li…
DA-344 Apr 30, 2025
d41d711
list -> tuple
DA-344 Apr 30, 2025
50c40a2
fix: Change send type to None in Section.walk_children return type
DA-344 Apr 30, 2025
b0b332a
fix: Add/Modify View/Container.walk_children return types
DA-344 Apr 30, 2025
9c745bb
chore: run black
DA-344 Apr 30, 2025
4044b2c
chore: add *children param and validation for children
DA-344 Apr 30, 2025
145af2f
chore: update docstrings
DA-344 May 1, 2025
27db09a
chore: overloads
DA-344 May 1, 2025
0396417
rows
DA-344 May 1, 2025
7012cec
fix: LayoutView.__total_children being incorrectly set when adding/re…
DA-344 May 6, 2025
e29c10d
fix: Webhook.send overloads missing ephemeral kwarg
DA-344 May 6, 2025
6122b32
fix: Sorting LayoutView children defaulting to 0 instead of sys.maxsize
DA-344 May 6, 2025
7b5f247
chore: Add call to super().__init_subclass__()
DA-344 May 6, 2025
cf08c0e
chore: Remove ValueError on Container.add_item
DA-344 May 7, 2025
4ca483e
chore: fix is_persistent and default to sys.maxsize instead of 0 on s…
DA-344 May 8, 2025
4103a97
things
DA-344 May 9, 2025
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 .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Run Pyright
uses: jakebailey/pyright-action@v1
with:
version: '1.1.316'
version: '1.1.394'
warnings: false
no-comments: ${{ matrix.python-version != '3.x' }}

Expand Down
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Installing

To install the library without full voice support, you can just run the following command:

.. note::

A `Virtual Environment <https://docs.python.org/3/library/venv.html>`__ is recommended to install
the library, especially on Linux where the system Python is externally managed and restricts which
packages you can install on it.


.. code:: sh

# Linux/macOS
Expand Down
14 changes: 12 additions & 2 deletions discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
__author__ = 'Rapptz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015-present Rapptz'
__version__ = '2.4.0a'
__version__ = '2.6.0a'

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Expand Down Expand Up @@ -69,6 +69,10 @@
from .components import *
from .threads import *
from .automod import *
from .poll import *
from .soundboard import *
from .subscription import *
from .presences import *


class VersionInfo(NamedTuple):
Expand All @@ -79,8 +83,14 @@ class VersionInfo(NamedTuple):
serial: int


version_info: VersionInfo = VersionInfo(major=2, minor=4, micro=0, releaselevel='alpha', serial=0)
version_info: VersionInfo = VersionInfo(major=2, minor=6, micro=0, releaselevel='alpha', serial=0)

logging.getLogger(__name__).addHandler(logging.NullHandler())

# This is a backwards compatibility hack and should be removed in v3
# Essentially forcing the exception to have different base classes
# In the future, this should only inherit from ClientException
if len(MissingApplicationID.__bases__) == 1:
MissingApplicationID.__bases__ = (app_commands.AppCommandError, ClientException)

del logging, NamedTuple, Literal, VersionInfo
10 changes: 8 additions & 2 deletions discord/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import argparse
import sys
from pathlib import Path
from pathlib import Path, PurePath, PureWindowsPath

import discord
import importlib.metadata
Expand Down Expand Up @@ -225,8 +225,14 @@ def to_path(parser: argparse.ArgumentParser, name: str, *, replace_spaces: bool
)
if len(name) <= 4 and name.upper() in forbidden:
parser.error('invalid directory name given, use a different one')
path = PurePath(name)
if isinstance(path, PureWindowsPath) and path.drive:
drive, rest = path.parts[0], path.parts[1:]
transformed = tuple(map(lambda p: p.translate(_translation_table), rest))
name = drive + '\\'.join(transformed)

name = name.translate(_translation_table)
else:
name = name.translate(_translation_table)
if replace_spaces:
name = name.replace(' ', '-')
return Path(name)
Expand Down
Loading