profile
viewpoint

buildbot/buildbot 4415

Python-based continuous integration testing framework; your pull requests are more than welcome!

rodrigc/anchore-engine 0

A service that analyzes docker images and applies user-defined acceptance policies to allow automated container image validation and certification

rodrigc/atf 0

Libraries to write tests in C, C++ and shell

rodrigc/atf-packaging 0

packaging files for ATF

rodrigc/automat 0

Self-service finite-state machines for the programmer on the go.

rodrigc/azure-cli 0

Command-line tools for Azure.

rodrigc/azure-sdk-for-go 0

Microsoft Azure SDK for Go

rodrigc/blueocean-plugin 0

Blue Ocean is a reboot of the Jenkins CI/CD User Experience

rodrigc/braid 0

Automation scripts for twistedmatrix.com

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):      if crypt is None:         raise NotImplementedError("cred_unix not supported on this platform")-    if not isinstance(pw, StringType):+    if isinstance(pw, bytes):         pw = pw.decode('utf-8')-    if not isinstance(crypted, StringType):+    if isinstance(crypted, bytes):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted

Thanks, this looks ok now, and coverage is better: https://coveralls.io/builds/32572286

mgorny

comment created time in 7 days

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):      if crypt is None:         raise NotImplementedError("cred_unix not supported on this platform")-    if not isinstance(pw, StringType):+    if isinstance(pw, bytes):         pw = pw.decode('utf-8')-    if not isinstance(crypted, StringType):+    if isinstance(crypted, bytes):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted

No worries. :) It looks like Travis also has a 3.9-dev target, see: https://github.com/jazzband/pip-tools/pull/1126/files .

If you want, we can also add 3.9-dev to .travis.yml . That will be another way to get the coverage numbers up.

mgorny

comment created time in 7 days

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):      if crypt is None:         raise NotImplementedError("cred_unix not supported on this platform")-    if not isinstance(pw, StringType):+    if isinstance(pw, bytes):         pw = pw.decode('utf-8')-    if not isinstance(crypted, StringType):+    if isinstance(crypted, bytes):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted

Yes, but that only fails like that on Python 3.9, and Twisted's CI does not yet run on Python 3.9

mgorny

comment created time in 7 days

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):      if crypt is None:         raise NotImplementedError("cred_unix not supported on this platform")-    if not isinstance(pw, StringType):+    if isinstance(pw, bytes):         pw = pw.decode('utf-8')-    if not isinstance(crypted, StringType):+    if isinstance(crypted, bytes):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted

Ah, maybe it's because crypt.crypt only throws OSError on Python 3.9, but none of the CI for Twisted runs on Python 3.9. In that case it would be good to write a test which mocks out crypt.crypt and always throws OSError.

mgorny

comment created time in 7 days

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):      if crypt is None:         raise NotImplementedError("cred_unix not supported on this platform")-    if not isinstance(pw, StringType):+    if isinstance(pw, bytes):         pw = pw.decode('utf-8')-    if not isinstance(crypted, StringType):+    if isinstance(crypted, bytes):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted

Looks like crypt.crypt() throws an OSError if the underlying crypt() C function fails due to this change in Python 3.9:

https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c

It might not be so easy to write a test for this using the existing Python crypt.crypt function. Using a mock of crypt which always throws an OSError as @glyph suggested might be the easier way to go.

mgorny

comment created time in 7 days

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):      if crypt is None:         raise NotImplementedError("cred_unix not supported on this platform")-    if not isinstance(pw, StringType):+    if isinstance(pw, bytes):         pw = pw.decode('utf-8')-    if not isinstance(crypted, StringType):+    if isinstance(crypted, bytes):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted

@mgorny In what case does crypt.crypt() throw an OSError?

In this PR: https://github.com/ansible/ansible/pull/70246

it mentions that crypt.crypt in Python 3.9 will throw an OSError if the algorithm is not supported. Is there a test that we can write to trigger this error, so that there is test coverage of the except OSError: branch?

mgorny

comment created time in 7 days

pull request commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

@mgorny Thanks a lot to Michał Górny who was patient in helping me track down the problem and come up with a fix. I found it very weird that if I did a PR from the exact same branch as @mgorny, my branch would pass CI, but if @mgorny did another PR from the same branch, the CI on his PR would fail.

It took me a long time to track it down to an environment variable:

BUILD_SOURCEVERSIONAUTHOR Michał Górny

which had non-ASCII characters in the value, and thus triggered CI failures on Windows. :)

rodrigc

comment created time in 7 days

push eventmgorny/twisted

Craig Rodrigues

commit sha 20b9a5a31682424e7fd8a77f225f7e89166c7d01

Remove unused import

view details

Craig Rodrigues

commit sha 14e8d3bd6a35888ed9b6cfbcd46346e19888a6fe

Remove unneeded use of twisted.python.compat.StringType

view details

push time in 7 days

Pull request review commenttwisted/twisted

Fix verifyCryptedPassword() for crypt.crypt() throwing in py3.9

 def verifyCryptedPassword(crypted, pw):         pw = pw.decode('utf-8')     if not isinstance(crypted, StringType):         crypted = crypted.decode('utf-8')-    return crypt.crypt(pw, crypted) == crypted+    try:+        return crypt.crypt(pw, crypted) == crypted+    except OSError:+        return False

@mgorny fixed this by adding from twisted.plugins.cred_unix import verifyCryptedPassword in src/twisted/conch/checkers.py

mgorny

comment created time in 7 days

push eventmgorny/twisted

mesozoic

commit sha f5bff4d8382ac9e729d85d93706484dd0fd9f445

Branching to no-usernamehashedpassword-3648-3. git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44838 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

mesozoic

commit sha 634cb28b66afc1afbff8d1c1e47f15fae5cfae12

UsernameHashedPassword deprecated in 15.2.0 git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44839 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

mesozoic

commit sha c6009d08f32931d0af07d1a12c004b23e4294036

Stupid missed imports git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44840 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

mesozoic

commit sha b406e94555f71c004fa7821e0c635d214c235c63

Fixing missing news file git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44841 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

Alex Levy

commit sha 8590b82b30aac0d74e3f989b4dbda506cebbf800

Change ticket number in twisted/topfiles

view details

Alex Levy

commit sha 981cb449dfba97dc709e011d6e139e74fd8a61c7

Update UsernameHashedPassword deprecation to 16.3.0

view details

Alex Levy

commit sha 8c7671e1eef53d4bc43c15d48e5932615c99acdc

Merge remote-tracking branch 'origin/trunk' into deprecated-usernamehashedpassword-8368 Conflicts: twisted/cred/test/test_cred.py

view details

Alex Levy

commit sha dda878d6c32df6709f5d8f739f80b3d1508fc0e4

Merge remote-tracking branch 'upstream/trunk' into deprecated-usernamehashedpassword-8368

view details

Alex Levy

commit sha b60ad5fde92d95221fa266bb031f11c509781b81

Use deprecatedModuleAttribute, not warnings.warn

view details

Alex Levy

commit sha dd573d27c32b17c3d8b29c1243af0c7067424c22

Fix twistedchecker and pyflakes errors

view details

Alex Levy

commit sha bde9b0d9954b4c825bc2049abaee80c26a9926be

Remove other references and uses of UsernameHashedPassword

view details

Alex Levy

commit sha 003a0721895f98284758e9249b4eec72bdd280f4

Merge remote-tracking branch 'upstream/trunk' into deprecated-usernamehashedpassword-8368

view details

Alex Levy

commit sha 2fb204c8af07f910c640dc3d9860fd95afbd879c

Restore deleted tests

view details

Alex Levy

commit sha 60c07f450b89644af636a7c9a423b131d8f39652

Introduce getDeprecatedModuleAttribute and use for UsernameHashedPassword

view details

Alex Levy

commit sha 0d4c323dfdf4e181b8bd20cae866fe44eea096bf

Update notes on testing deprecated code

view details

Jean-Paul Calderone

commit sha 1a27eaa968266fba073dcfa277a9e72c62e1a783

Merge remote-tracking branch 'origin/trunk' into 8368-deprecate-usernamehashedpassword

view details

Jean-Paul Calderone

commit sha d53f651490ef48afa5cc28e3001d40afea6210d0

Update deprecation version again

view details

Jean-Paul Calderone

commit sha fa78ce52146c3d4ba55068ff422616cf5026e865

markup fixes

view details

Jean-Paul Calderone

commit sha 3365d005e5a4b7822da5b42c3877d9a5d263166f

Put the recommended approach first.

view details

Mark Williams

commit sha c23785d7af00fe5cd0831ad37ff08edd43978922

Merge branch 'trunk' into 8368-deprecate-usernamehashedpassword

view details

push time in 7 days

pull request commenttwisted/twisted

Fix AsyncioSelectorReactor on Windows Python 3.8+

This PR affects a reactor implementation. Reactor implementations typically have been implemented in the core of Twisted, not outside.

rodrigc

comment created time in 10 days

pull request commenttwisted/twisted

Fix AsyncioSelectorReactor on Windows Python 3.8+

@adiroiban can you have another look? I don't think that many people are using Twisted with Python's asyncio, because:

  1. Python's asyncio works on Python-3 only, and many Twisted users were on Python 2 for a long time
  2. Python's asyncio has been changing in every Python release

The main intent of this PR is to just keep up with all the changes in Python's asyncio, so that for people who want to use it in Twisted, they will have a better time, especially on Windows.

rodrigc

comment created time in 10 days

push eventtwisted/twisted

mesozoic

commit sha f5bff4d8382ac9e729d85d93706484dd0fd9f445

Branching to no-usernamehashedpassword-3648-3. git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44838 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

mesozoic

commit sha 634cb28b66afc1afbff8d1c1e47f15fae5cfae12

UsernameHashedPassword deprecated in 15.2.0 git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44839 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

mesozoic

commit sha c6009d08f32931d0af07d1a12c004b23e4294036

Stupid missed imports git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44840 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

mesozoic

commit sha b406e94555f71c004fa7821e0c635d214c235c63

Fixing missing news file git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/no-usernamehashedpassword-3648-3@44841 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb

view details

Alex Levy

commit sha 8590b82b30aac0d74e3f989b4dbda506cebbf800

Change ticket number in twisted/topfiles

view details

Alex Levy

commit sha 981cb449dfba97dc709e011d6e139e74fd8a61c7

Update UsernameHashedPassword deprecation to 16.3.0

view details

Alex Levy

commit sha 8c7671e1eef53d4bc43c15d48e5932615c99acdc

Merge remote-tracking branch 'origin/trunk' into deprecated-usernamehashedpassword-8368 Conflicts: twisted/cred/test/test_cred.py

view details

Alex Levy

commit sha dda878d6c32df6709f5d8f739f80b3d1508fc0e4

Merge remote-tracking branch 'upstream/trunk' into deprecated-usernamehashedpassword-8368

view details

Alex Levy

commit sha b60ad5fde92d95221fa266bb031f11c509781b81

Use deprecatedModuleAttribute, not warnings.warn

view details

Alex Levy

commit sha dd573d27c32b17c3d8b29c1243af0c7067424c22

Fix twistedchecker and pyflakes errors

view details

Alex Levy

commit sha bde9b0d9954b4c825bc2049abaee80c26a9926be

Remove other references and uses of UsernameHashedPassword

view details

Alex Levy

commit sha 003a0721895f98284758e9249b4eec72bdd280f4

Merge remote-tracking branch 'upstream/trunk' into deprecated-usernamehashedpassword-8368

view details

Alex Levy

commit sha 2fb204c8af07f910c640dc3d9860fd95afbd879c

Restore deleted tests

view details

Alex Levy

commit sha 60c07f450b89644af636a7c9a423b131d8f39652

Introduce getDeprecatedModuleAttribute and use for UsernameHashedPassword

view details

Alex Levy

commit sha 0d4c323dfdf4e181b8bd20cae866fe44eea096bf

Update notes on testing deprecated code

view details

Jean-Paul Calderone

commit sha 1a27eaa968266fba073dcfa277a9e72c62e1a783

Merge remote-tracking branch 'origin/trunk' into 8368-deprecate-usernamehashedpassword

view details

Jean-Paul Calderone

commit sha d53f651490ef48afa5cc28e3001d40afea6210d0

Update deprecation version again

view details

Jean-Paul Calderone

commit sha fa78ce52146c3d4ba55068ff422616cf5026e865

markup fixes

view details

Jean-Paul Calderone

commit sha 3365d005e5a4b7822da5b42c3877d9a5d263166f

Put the recommended approach first.

view details

Mark Williams

commit sha c23785d7af00fe5cd0831ad37ff08edd43978922

Merge branch 'trunk' into 8368-deprecate-usernamehashedpassword

view details

push time in 10 days

PR merged twisted/twisted

[DO NOT MERGE] PR for testing windows encoding problems

Followup for https://github.com/twisted/twisted/pull/1278#issuecomment-647051463

CC @rodrigc

+75 -35

12 comments

5 changed files

mgorny

pr closed time in 10 days

delete branch twisted/twisted

delete branch : 9858-rodrigc-mgorny-unicode

delete time in 10 days

push eventtwisted/twisted

Craig Rodrigues

commit sha 0fe1573439277bcb4e682f79901b4d57e8cd7b36

Add newsfragment

view details

Craig Rodrigues

commit sha a1900d3baca3e7452c4526a39a43c58803532c33

Pass the correct os.environ dictionary to GetEnvironmentDictionary() Also, remove an extraneous comment about Python 2, since the minimum Python version that Twisted supports is Python 3.5

view details

Craig Rodrigues

commit sha 5ec85f644c9b5c9cb21a9923ec22a6e6ee577ec4

Add more debugging in case of bad arg or env variables which can't be decoded

view details

Craig Rodrigues

commit sha 9ad444dbcb0b7a91e3997551633c7938115739e0

Set PYTHONUTF8 environment variable to force UTF-8 mode on Python 3.7+ on Windows Set PYTHONIOENCODING variable to utf8 for Python 3.5, 3.6

view details

Craig Rodrigues

commit sha 6781b53fccb8a793fc64cb2d5ccf3b72cbfa10b8

Print environment variables

view details

Craig Rodrigues

commit sha d36c6130c47af5e57062653d166a0b78e040a1c2

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

Craig Rodrigues

commit sha 85069b5ccdc92745809a8287ab24d6127c1a75da

Check unicode args using the encoding defined by sys.stdout.encoding

view details

Glyph

commit sha cef8bd8cb9f57c2b2b99da79e5e86f7330885050

Merge branch 'trunk' into 9858-rodrigc-mgorny-unicode

view details

Craig Rodrigues

commit sha 27f727c5deec70a1dc0cbea6a7f7ee8184f8d67a

Fix on Python 3.5 where PYTHONUTF8 mode doesn't exist

view details

Craig Rodrigues

commit sha 7851e99880061b21856aa6aaee880c538f0d5e99

Merge branch 'trunk' into 9858-rodrigc-mgorny-unicode

view details

Craig Rodrigues

commit sha 484d2762c728a770279856e71995daece5d3b660

Merge pull request #1302 from twisted/9858-rodrigc-mgorny-unicode Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines Author: rodrigc Reviewer: glyph Fixes: ticket:9858

view details

push time in 10 days

PR merged twisted/twisted

Reviewers
Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

https://twistedmatrix.com/trac/ticket/9858

@mgorny helped me debug this under this PR: https://github.com/twisted/twisted/pull/1305

When mgorny does a pull request from his GitHub ID, they following environment variable is set on Azure pipelines:

BUILD_SOURCEVERSIONAUTHOR Michał Górny

That triggered a codepath which caused the CI to fail on Windows, even if he did trivial changes like only changing whitespace.

This patch fixes the problem. I also added another test, putting an environment variable similar to Michał's name.

+80 -35

8 comments

5 changed files

rodrigc

pr closed time in 10 days

push eventtwisted/twisted

Maarten ter Huurne

commit sha bc82968a79eaac3d3498064250f9f516fe2ee8ee

Remove _shouldEnableNewStyle() and _EXPECT_NEWSTYLE from compat

view details

Maarten ter Huurne

commit sha bd261050448a7d481bf509064e1354f548eba8d1

Remove _PY35PLUS from compat

view details

Maarten ter Huurne

commit sha e994f9882e25c9623110a5a3e0a69f15f675ca70

Remove _PY3 from compat

view details

Maarten ter Huurne

commit sha feec3ca6aeddd6df0a0f22aeb9ccaba087f392fb

Remove _tokenize() from compat

view details

Maarten ter Huurne

commit sha 9ff48a1fa8f228d0cffd2d029cbcf702fc3704a8

Remove _keys() from compat

view details

Maarten ter Huurne

commit sha 03e2f0417bde10f750c7f5bdb9c9fb94749a982b

Remove _bytesChr() from compat

view details

Maarten ter Huurne

commit sha bcadfe8e004e53222b6ff28a92646e3d36232bb4

Remove _coercedUnicode() from compat

view details

Maarten ter Huurne

commit sha 2e06e29fad752a945f236e3a59c5be5d6d50dc87

Remove _bytesRepr() from compat

view details

Maarten ter Huurne

commit sha 714f7c841ef83df88651b2d8a0c011c9cdd41180

Remove __b64decodebytes() and _b64encodebytes() from compat

view details

Maarten ter Huurne

commit sha 21d83c1f98c858d815115383c838b983927dd90a

Add empty news fragment

view details

Maarten ter Huurne

commit sha a84b58d2a0c2da60ddf5ad83d4b2f6bd4a0ccd51

Merge pull request #1367 from twisted/9921-mthuurne-cleanup_compat_private Drop obsolete private definitions from twisted.python.compat Author: mthuurne Reviewer: twm Fixes: ticket:9921

view details

Craig Rodrigues

commit sha 27f727c5deec70a1dc0cbea6a7f7ee8184f8d67a

Fix on Python 3.5 where PYTHONUTF8 mode doesn't exist

view details

Craig Rodrigues

commit sha 7851e99880061b21856aa6aaee880c538f0d5e99

Merge branch 'trunk' into 9858-rodrigc-mgorny-unicode

view details

push time in 10 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

Regarding the development process, I should have waited for explicit approval instead of interpreting the situation on my own. Exactly.

mthuurne

comment created time in 16 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

@mthuurne it is quite clear that I did not transition this PR into the approved state in GitHub, nor did I tag Trac ticket 9921 as approved. Twisted's development process is not perfect, but keeping logs of review approvals before merging is important to the project.

These documents are a bit long, sometimes a bit outdated, and sometimes a little bit hard to follow, but I suggest you re-read them to get a feel for the Twisted review process:

  • https://twistedmatrix.com/trac/wiki/UltimateQualityDevelopmentSystem
  • https://twistedmatrix.com/trac/wiki/ReviewProcess

Looking at the audit trail of this PR, it is quite clear that you were very eager to merge this PR (which is OK to be motivated and eager), and ignore my review feedback (which is not ideal, but sometimes difference of opinions exit). If you got another Twisted developer to approve this PR, over my objections, I would have been OK with that.

But the fact that you merged, put my name as Reviewer:, even though I did not fully approve the PR, is just plain dishonest. Hopefully it was just a mistake on your part, but I don't fully believe this.

I'm going to stop reviewing your PR's.

There are other Twisted developers that you can work with to review your PR's, so you hopefully you can still move forward and contribute to the project.

mthuurne

comment created time in 17 days

pull request commenttwisted/twisted

Deprecate obsolete public definitions from twisted.python.compat

If you are going to merge things into Twisted, and ignore review feedback from me, please don't ask me to review your PR's.

mthuurne

comment created time in 20 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

So it looks like you chose to merge this PR into Twisted, and put my name as a reviewer without me actually approving the review.

That's not very nice.

mthuurne

comment created time in 20 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

The feedback that I was suggesting you incorporate into this PR was this:

diff --git a/src/twisted/conch/client/default.py b/src/twisted/conch/client/default.py
index 60416d530..f6ac8a84d 100644
--- a/src/twisted/conch/client/default.py
+++ b/src/twisted/conch/client/default.py
@@ -13,7 +13,7 @@ interact with a known_hosts database, use L{twisted.conch.client.knownhosts}.
 
 
 from twisted.python import log
-from twisted.python.compat import nativeString, raw_input
+from twisted.python.compat import nativeString
 from twisted.python.filepath import FilePath
 
 from twisted.conch.error import ConchError
@@ -307,7 +307,7 @@ class SSHUserAuthClient(userauth.SSHUserAuthClient):
             for prompt, echo in prompts:
                 prompt = prompt.decode("utf-8")
                 if echo:
-                    responses.append(raw_input(prompt))
+                    responses.append(input(prompt))
                 else:
                     responses.append(getpass.getpass(prompt))
         return defer.succeed(responses)
diff --git a/src/twisted/conch/ssh/keys.py b/src/twisted/conch/ssh/keys.py
index 413542600..8f02d46f6 100644
--- a/src/twisted/conch/ssh/keys.py
+++ b/src/twisted/conch/ssh/keys.py
@@ -32,7 +32,7 @@ from pyasn1.type import univ
 from twisted.conch.ssh import common, sexpy
 from twisted.conch.ssh.common import int_from_bytes, int_to_bytes
 from twisted.python import randbytes
-from twisted.python.compat import iterbytes, long, izip, nativeString, unicode
+from twisted.python.compat import iterbytes, izip, nativeString
 from twisted.python.constants import NamedConstant, Names
 from twisted.python.deprecate import _mutuallyExclusiveArguments
 
@@ -124,7 +124,7 @@ def _normalizePassphrase(passphrase):
     Normalization Process for Stabilized Strings using NFKC normalization.
     The passphrase is then encoded using UTF-8.
 
-    @type passphrase: L{bytes} or L{unicode} or L{None}
+    @type passphrase: L{bytes} or L{str} or L{None}
     @param passphrase: The passphrase to normalize.
 
     @return: The normalized passphrase, if any.
@@ -132,7 +132,7 @@ def _normalizePassphrase(passphrase):
     @raises PassphraseNormalizationError: if the passphrase is Unicode and
     cannot be normalized using the available Unicode character database.
     """
-    if isinstance(passphrase, unicode):
+    if isinstance(passphrase, str):
         # The Normalization Process for Stabilized Strings requires aborting
         # with an error if the string contains any unassigned code point.
         if any(unicodedata.category(c) == 'Cn' for c in passphrase):
@@ -199,7 +199,7 @@ class Key(object):
         @rtype: L{Key}
         @return: The loaded key.
         """
-        if isinstance(data, unicode):
+        if isinstance(data, str):
             data = data.encode("utf-8")
         passphrase = _normalizePassphrase(passphrase)
         if type is None:
@@ -562,7 +562,7 @@ class Key(object):
                 raise BadKeyError('RSA key failed to decode properly')
 
             n, e, d, p, q, dmp1, dmq1, iqmp = [
-                long(value) for value in decodedKey[1:9]
+                int(value) for value in decodedKey[1:9]
                 ]
             return cls(
                 rsa.RSAPrivateNumbers(
@@ -576,7 +576,7 @@ class Key(object):
                 ).private_key(default_backend())
             )
         elif kind == b'DSA':
-            p, q, g, y, x = [long(value) for value in decodedKey[1: 6]]
+            p, q, g, y, x = [int(value) for value in decodedKey[1: 6]]
             if len(decodedKey) < 6:
                 raise BadKeyError('DSA key failed to decode properly')
             return cls(
@@ -1334,7 +1334,7 @@ class Key(object):
             a comment.  For private OpenSSH keys, this is a passphrase to
             encrypt with.  (Deprecated since Twisted 20.3.0; use C{comment}
             or C{passphrase} as appropriate instead.)
-        @type extra: L{bytes} or L{unicode} or L{None}
+        @type extra: L{bytes} or L{str} or L{None}
 
         @param subtype: A subtype of the requested C{type} to emit.  Only
             supported for private OpenSSH keys, for which the currently
@@ -1347,14 +1347,14 @@ class Key(object):
 
             Present since Twisted 20.3.0.
 
-        @type comment: L{bytes} or L{unicode} or L{None}
+        @type comment: L{bytes} or L{str} or L{None}
 
         @param passphrase: A passphrase to encrypt the key with.  Only
             supported for private OpenSSH keys.
 
             Present since Twisted 20.3.0.
 
-        @type passphrase: L{bytes} or L{unicode} or L{None}
+        @type passphrase: L{bytes} or L{str} or L{None}
 
         @rtype: L{bytes}
         """
@@ -1369,7 +1369,7 @@ class Key(object):
                 comment = extra
             else:
                 passphrase = extra
-        if isinstance(comment, unicode):
+        if isinstance(comment, str):
             comment = comment.encode("utf-8")
         passphrase = _normalizePassphrase(passphrase)
         method = getattr(self, '_toString_%s' % (type.upper(),), None)
diff --git a/src/twisted/mail/imap4.py b/src/twisted/mail/imap4.py
index 2f0ba9095..2a19cc404 100644
--- a/src/twisted/mail/imap4.py
+++ b/src/twisted/mail/imap4.py
@@ -41,7 +41,7 @@ from twisted.internet import error
 from twisted.internet.defer import maybeDeferred
 from twisted.python import log, text
 from twisted.python.compat import (
-    unichr as chr, intToBytes, iterbytes, long, nativeString, networkString,
+    unichr as chr, intToBytes, iterbytes, nativeString, networkString,
     unicode, _matchingString, _get_async_param,
 )
 from twisted.internet import interfaces
@@ -5030,7 +5030,7 @@ def collapseNestedLists(items):
             i = i.encode("ascii")
         if i is None:
             pieces.extend([b' ', b'NIL'])
-        elif isinstance(i, (int, long)):
+        elif isinstance(i, int):
             pieces.extend([b' ', networkString(str(i))])
         elif isinstance(i, DontQuoteMe):
             pieces.extend([b' ', i.value])
diff --git a/src/twisted/mail/smtp.py b/src/twisted/mail/smtp.py
index 0e4ba2f24..dcb6011df 100644
--- a/src/twisted/mail/smtp.py
+++ b/src/twisted/mail/smtp.py
@@ -35,8 +35,7 @@ from twisted.internet.interfaces import ITLSTransport, ISSLTransport
 from twisted.internet._idna import _idnaText
 from twisted.python import log
 from twisted.python import util
-from twisted.python.compat import (long, unicode, networkString,
-                                   nativeString, iteritems, iterbytes)
+from twisted.python.compat import networkString, nativeString, iterbytes
 from twisted.python.runtime import platform
 
 from twisted.mail.interfaces import (IClientAuthentication,
@@ -914,7 +913,7 @@ class SMTPClient(basic.LineReceiver, policies.TimeoutMixin):
     timeout = None
 
     def __init__(self, identity, logsize=10):
-        if isinstance(identity, unicode):
+        if isinstance(identity, str):
             identity = identity.encode('ascii')
 
         self.identity = identity or b''
@@ -1634,7 +1633,7 @@ class ESMTP(SMTP):
 
     def listExtensions(self):
         r = []
-        for (c, v) in iteritems(self.extensions()):
+        for (c, v) in self.extensions().items():
             if v is not None:
                 if v:
                     # Intentionally omit extensions with empty argument lists
@@ -1879,9 +1878,9 @@ class SMTPSenderFactory(protocol.ClientFactory):
         @param timeout: Period, in seconds, for which to wait for
         server responses, or None to wait forever.
         """
-        assert isinstance(retries, (int, long))
+        assert isinstance(retries, int)
 
-        if isinstance(toEmail, unicode):
+        if isinstance(toEmail, str):
             toEmail = [toEmail.encode('ascii')]
         elif isinstance(toEmail, bytes):
             toEmail = [toEmail]
@@ -2126,11 +2125,11 @@ def sendmail(smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25,
     @type port: L{int}
 
     @param username: The username to use, if wanting to authenticate.
-    @type username: L{bytes} or L{unicode}
+    @type username: L{bytes} or L{str}
 
     @param password: The secret to use, if wanting to authenticate. If you do
         not specify this, SMTP authentication will not occur.
-    @type password: L{bytes} or L{unicode}
+    @type password: L{bytes} or L{str}
 
     @param requireTransportSecurity: Whether or not STARTTLS is required.
     @type requireTransportSecurity: L{bool}
@@ -2172,13 +2171,13 @@ def sendmail(smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25,
 
     d = defer.Deferred(cancel)
 
-    if isinstance(username, unicode):
+    if isinstance(username, str):
         username = username.encode("utf-8")
-    if isinstance(password, unicode):
+    if isinstance(password, str):
         password = password.encode("utf-8")
 
     tlsHostname = smtphost
-    if not isinstance(tlsHostname, unicode):
+    if not isinstance(tlsHostname, str):
         tlsHostname = _idnaText(tlsHostname)
 
     factory = ESMTPSenderFactory(
diff --git a/src/twisted/spread/banana.py b/src/twisted/spread/banana.py
index 44f3aee67..aa20684ff 100644
--- a/src/twisted/spread/banana.py
+++ b/src/twisted/spread/banana.py
@@ -20,7 +20,7 @@ from io import BytesIO
 from twisted.internet import protocol
 from twisted.persisted import styles
 from twisted.python import log
-from twisted.python.compat import iterbytes, long
+from twisted.python.compat import iterbytes
 from twisted.python.reflect import fullyQualifiedName
 
 
@@ -43,14 +43,13 @@ def int2b128(integer, stream):
 
 def b1282int(st):
     """
-    Convert an integer represented as a base 128 string into an L{int} or
-    L{long}.
+    Convert an integer represented as a base 128 string into an L{int}.
 
     @param st: The integer encoded in a byte string.
     @type st: L{bytes}
 
     @return: The integer value extracted from the byte string.
-    @rtype: L{int} or L{long}
+    @rtype: L{int}
     """
     e = 1
     i = 0
@@ -341,7 +340,7 @@ class Banana(protocol.Protocol, styles.Ephemeral):
             write(LIST)
             for elem in obj:
                 self._encode(elem, write)
-        elif isinstance(obj, (int, long)):
+        elif isinstance(obj, int):
             if obj < self._smallestLongInt or obj > self._largestLongInt:
                 raise BananaError(
                     "int/long is too large to send (%d)" % (obj,))
diff --git a/src/twisted/spread/pb.py b/src/twisted/spread/pb.py
index 0f47b46fd..7e4f05301 100644
--- a/src/twisted/spread/pb.py
+++ b/src/twisted/spread/pb.py
@@ -35,7 +35,7 @@ from zope.interface import implementer, Interface
 
 # Twisted Imports
 from twisted.python import log, failure, reflect
-from twisted.python.compat import unicode, range, comparable, cmp
+from twisted.python.compat import comparable, cmp
 from twisted.internet import defer, protocol
 from twisted.cred.portal import Portal
 from twisted.cred.credentials import IAnonymous, ICredentials
@@ -777,7 +777,7 @@ class Broker(banana.Banana):
             L{None} if there is no object which corresponds to the given
             identifier.
         """
-        if isinstance(luid, unicode):
+        if isinstance(luid, str):
             luid = luid.encode('utf8')
 
         lob = self.localObjects.get(luid)
@@ -827,7 +827,7 @@ class Broker(banana.Banana):
         @param name: An ID.
         @param object: The object.
         """
-        if isinstance(name, unicode):
+        if isinstance(name, str):
             name = name.encode('utf8')
 
         assert object is not None
@@ -844,7 +844,7 @@ class Broker(banana.Banana):
         @param name: The name to look up.
         @return: An object which maps to the name.
         """
-        if isinstance(name, unicode):
+        if isinstance(name, str):
             name = name.encode('utf8')
 
         return RemoteReference(None, self, name, 0)
@@ -1179,7 +1179,7 @@ class Broker(banana.Banana):
 
         @param objectID: The object ID.
         """
-        if isinstance(objectID, unicode):
+        if isinstance(objectID, str):
             objectID = objectID.encode('utf8')
         refs = self.localObjects[objectID].decref()
         if refs == 0:
diff --git a/src/twisted/spread/test/test_banana.py b/src/twisted/spread/test/test_banana.py
index c27431418..cfd079692 100644
--- a/src/twisted/spread/test/test_banana.py
+++ b/src/twisted/spread/test/test_banana.py
@@ -9,7 +9,7 @@ from io import BytesIO
 from twisted.trial.unittest import TestCase
 from twisted.spread import banana
 from twisted.python import failure
-from twisted.python.compat import long, iterbytes
+from twisted.python.compat import iterbytes
 from twisted.internet import protocol, main
 from twisted.test.proto_helpers import StringTransport
 
@@ -164,7 +164,7 @@ class BananaTests(BananaTestBase):
         banana without changing value and should come out represented
         as an C{int} (regardless of the type which was encoded).
         """
-        for value in (10151, long(10151)):
+        for value in (10151, int(10151)):
             self.enc.sendEncoded(value)
             self.enc.dataReceived(self.io.getvalue())
             self.assertEqual(self.result, 10151)
diff --git a/src/twisted/words/protocols/jabber/client.py b/src/twisted/words/protocols/jabber/client.py
index 016bf3af3..85bc96f39 100644
--- a/src/twisted/words/protocols/jabber/client.py
+++ b/src/twisted/words/protocols/jabber/client.py
@@ -4,7 +4,6 @@
 # See LICENSE for details.
 
 
-from twisted.python.compat import unicode
 from twisted.words.protocols.jabber import error, sasl, xmlstream
 from twisted.words.protocols.jabber.jid import JID
 from twisted.words.xish import domish, utility, xpath
@@ -126,9 +125,9 @@ class IQAuthInitializer(object):
         # Prefer digest over plaintext
         if DigestAuthQry.matches(iq):
             digest = xmlstream.hashPassword(self.xmlstream.sid, password)
-            reply.query.addElement("digest", content=unicode(digest))
+            reply.query.addElement("digest", content=str(digest))
         else:
-            reply.query.addElement("password", content = password)
+            reply.query.addElement("password", content=password)
 
         d = reply.send()
         d.addCallbacks(self._cbAuth, self._ebAuth)
@@ -275,7 +274,7 @@ class BindInitializer(xmlstream.BaseFeatureInitiatingInitializer):
 
     def onBind(self, iq):
         if iq.bind:
-            self.xmlstream.authenticator.jid = JID(unicode(iq.bind.jid))
+            self.xmlstream.authenticator.jid = JID(str(iq.bind.jid))
 
 
 
@@ -311,7 +310,7 @@ def XMPPClientFactory(jid, password, configurationForTLS=None):
     @type jid: L{jid.JID}
 
     @param password: password to authenticate with.
-    @type password: L{unicode}
+    @type password: L{str}
 
     @param configurationForTLS: An object which creates appropriately
         configured TLS connections. This is passed to C{startTLS} on the
@@ -362,7 +361,7 @@ class XMPPAuthenticator(xmlstream.ConnectAuthenticator):
     @type jid: L{jid.JID}
 
     @ivar password: password to be used during SASL authentication.
-    @type password: L{unicode}
+    @type password: L{str}
     """
 
     namespace = 'jabber:client'
diff --git a/src/twisted/words/protocols/jabber/component.py b/src/twisted/words/protocols/jabber/component.py
index 5563d909d..6ad0fd860 100644
--- a/src/twisted/words/protocols/jabber/component.py
+++ b/src/twisted/words/protocols/jabber/component.py
@@ -23,7 +23,6 @@ from zope.interface import implementer
 from twisted.application import service
 from twisted.internet import defer
 from twisted.python import log
-from twisted.python.compat import unicode
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import error, ijabber, jstrports, xmlstream
 from twisted.words.protocols.jabber.jid import internJID as JID
@@ -35,7 +34,7 @@ def componentFactory(componentid, password):
     XML stream factory for external server-side components.
 
     @param componentid: JID of the component.
-    @type componentid: L{unicode}
+    @type componentid: L{str}
     @param password: password used to authenticate to the server.
     @type password: C{str}
     """
@@ -59,7 +58,7 @@ class ComponentInitiatingInitializer(object):
         xs = self.xmlstream
         hs = domish.Element((self.xmlstream.namespace, "handshake"))
         digest = xmlstream.hashPassword(xs.sid, xs.authenticator.password)
-        hs.addContent(unicode(digest))
+        hs.addContent(str(digest))
 
         # Setup observer to watch for handshake result
         xs.addOnetimeObserver("/handshake", self._cbHandshake)
@@ -110,7 +109,7 @@ class ListenComponentAuthenticator(xmlstream.ListenAuthenticator):
     @since: 8.2
     @ivar secret: The shared secret used to authorized incoming component
                   connections.
-    @type secret: C{unicode}.
+    @type secret: C{str}.
     """
 
     namespace = NS_COMPONENT_ACCEPT
@@ -169,7 +168,7 @@ class ListenComponentAuthenticator(xmlstream.ListenAuthenticator):
         L{onHandshake}.
         """
         if (element.uri, element.name) == (self.namespace, 'handshake'):
-            self.onHandshake(unicode(element))
+            self.onHandshake(str(element))
         else:
             exc = error.StreamError('not-authorized')
             self.xmlstream.sendStreamError(exc)
@@ -185,7 +184,7 @@ class ListenComponentAuthenticator(xmlstream.ListenAuthenticator):
         be exchanged.
         """
         calculatedHash = xmlstream.hashPassword(self.xmlstream.sid,
-                                                unicode(self.secret))
+                                                str(self.secret))
         if handshake != calculatedHash:
             exc = error.StreamError('not-authorized', text='Invalid hash')
             self.xmlstream.sendStreamError(exc)
diff --git a/src/twisted/words/xish/domish.py b/src/twisted/words/xish/domish.py
index 04c705f8f..d94e96fdf 100644
--- a/src/twisted/words/xish/domish.py
+++ b/src/twisted/words/xish/domish.py
@@ -13,7 +13,6 @@ for use in streaming XML applications.
 
 from zope.interface import implementer, Interface, Attribute
 
-from twisted.python.compat import StringType, iteritems, itervalues
 from twisted.web import sux
 
 
@@ -69,7 +68,7 @@ class _ListSerializer:
             return
 
         # Shortcut, check to see if elem is actually a string (aka Cdata)
-        if isinstance(elem, StringType):
+        if isinstance(elem, str):
             write(escapeToXml(elem))
             return
 
@@ -78,7 +77,7 @@ class _ListSerializer:
         uri = elem.uri
         defaultUri, currentDefaultUri = elem.defaultUri, defaultUri
 
-        for p, u in iteritems(elem.localPrefixes):
+        for p, u in elem.localPrefixes.items():
             self.prefixes[u] = p
         self.prefixStack.append(list(elem.localPrefixes.keys()))
 
@@ -110,7 +109,7 @@ class _ListSerializer:
            (uri != defaultUri or not prefix or not inScope):
             write(" xmlns='%s'" % (defaultUri))
 
-        for p, u in iteritems(elem.localPrefixes):
+        for p, u in elem.localPrefixes.items():
             write(" xmlns:%s='%s'" % (p, u))
 
         # Serialize attributes
@@ -427,7 +426,7 @@ class Element(object):
         self.localPrefixes = localPrefixes or {}
         self.uri, self.name = qname
         if defaultUri is None and \
-           self.uri not in itervalues(self.localPrefixes):
+           self.uri not in self.localPrefixes.values():
             self.defaultUri = self.uri
         else:
             self.defaultUri = defaultUri
@@ -462,7 +461,7 @@ class Element(object):
         Retrieve the first CData (content) node
         """
         for n in self.children:
-            if isinstance(n, StringType):
+            if isinstance(n, str):
                 return n
         return ""
 

That would have been relatively easy to do.

mthuurne

comment created time in 20 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

Yes the compat needs to be looked at case by case. comparable is one good example you came up with.

mthuurne

comment created time in 21 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

compat is going to be around for a while yet, because unfortunately it was written as a public module, with publicly exported methods and variables. So it is not easy to know who is using it. In hindsight, it would have been better to have the compat module as a completely private module only to be used internally in Twisted. But it's too late for that now.

I think it would be nice if you could remove those uses of compat as I have suggested in this PR. I have made similar compat removal passes in other PR's that I have filed.

mthuurne

comment created time in 21 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

Oh I see what you are saying. No, what I meant to get across in my feedback is don't remove long, unicode, range from twisted.python.compat

Just remove the usages of those things in the twisted files that I indicated.

mthuurne

comment created time in 22 days

pull request commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

The ones I mentioned don't need to go through the whole deprecation cycle, since they were part of Python 2 to 3 porting, and Python 2 deprecation was announced over a year ago, with the last Twisted release supporting Python 2 being 20.3.0

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

   from twisted.python import log-from twisted.python.compat import (-    nativeString, raw_input, _b64decodebytes as decodebytes)+from twisted.python.compat import nativeString, raw_input

raw_input can be replaced with input

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.conch import error from twisted.internet import defer from twisted.python import log-from twisted.python.compat import (-    nativeString, networkString, long, _bytesChr as chr)+from twisted.python.compat import nativeString, networkString, long

long can go

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.conch.ssh import common, sexpy from twisted.conch.ssh.common import int_from_bytes, int_to_bytes from twisted.python import randbytes-from twisted.python.compat import (-    iterbytes, long, izip, nativeString, unicode,-    _b64decodebytes as decodebytes, _b64encodebytes as encodebytes,-    _bytesChr as chr)+from twisted.python.compat import iterbytes, long, izip, nativeString, unicode

long and unicode can go

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.internet.defer import maybeDeferred from twisted.python import log, text from twisted.python.compat import (-    _bytesChr, unichr as chr, _b64decodebytes as decodebytes,-    _b64encodebytes as encodebytes,-    intToBytes, iterbytes, long, nativeString, networkString, unicode,-    _matchingString, _get_async_param,+    unichr as chr, intToBytes, iterbytes, long, nativeString, networkString,

long and unicode can go

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.python import log from twisted.python import util from twisted.python.compat import (long, unicode, networkString,

long, unicode, and iteritems can be easily dropped here

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.internet import protocol from twisted.persisted import styles from twisted.python import log-from twisted.python.compat import iterbytes, long, _bytesChr as chr+from twisted.python.compat import iterbytes, long

long can go, replace with int

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

  # Twisted Imports from twisted.python import log, failure, reflect-from twisted.python.compat import (unicode, _bytesChr as chr, range,-                                   comparable, cmp)+from twisted.python.compat import unicode, range, comparable, cmp

unicode and range can go

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.trial.unittest import TestCase from twisted.spread import banana from twisted.python import failure-from twisted.python.compat import long, iterbytes, _bytesChr as chr+from twisted.python.compat import long, iterbytes

long can go, and be replaced by int. You can do that in this PR, or a separate one if you want.

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 # See LICENSE for details.  -from twisted.python.compat import _coercedUnicode, unicode+from twisted.python.compat import unicode

unicode can go

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

 from twisted.application import service from twisted.internet import defer from twisted.python import log-from twisted.python.compat import _coercedUnicode, unicode+from twisted.python.compat import unicode

unicode can go, and be replaced by str. You can do that in this PR, or a separate one if you want.

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Drop obsolete private definitions from twisted.python.compat

  from zope.interface import implementer, Interface, Attribute -from twisted.python.compat import (StringType, _coercedUnicode,-                                   iteritems, itervalues)+from twisted.python.compat import StringType, iteritems, itervalues

StringType, iteritems, and itervalues can all be easily dropped. You can do that in this PR, or do a separate one if you want.

mthuurne

comment created time in 22 days

Pull request review commenttwisted/twisted

Add type annotations to __repr__() and __str__()

 def test_repr(self):  class BrokenStr(Exception):     """-    An exception class the instances of which cannot be presented as strings via-    C{str}.+    An exception class the instances of which cannot be presented as strings+    via C{str}.

Should be L{str} in doc-string

mthuurne

comment created time in 22 days

pull request commenttwisted/twisted

Add type annotations to __repr__() and __str__()

If coveralls fails, don't worry about it. Sometimes coveralls fails randomly, and there is nothing we can do about it. I have enough access to re-trigger builds on Travis, so I can do that if need be.

mthuurne

comment created time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __eq__() et al

 def __init__(self, keyObject):         """         self._keyObject = keyObject -    def __eq__(self, other):+    def __eq__(self, other: object) -> bool:

Yes you are correct. In mypy, __eq__() is part of BINARY_MAGIC_METHODS: https://github.com/python/mypy/blob/23dba19098857a72e0ad2284b164e2fceaee44ac/mypy/sharedparse.py#L55

which is checked here: https://github.com/python/mypy/blob/259e0cfb65b656ce0847be7c41a3a12f7c8b00a0/mypy/checker.py#L3201

and with a specific exception for builtins.NotImplemented here: https://github.com/python/mypy/blob/259e0cfb65b656ce0847be7c41a3a12f7c8b00a0/mypy/checker.py#L5053

mthuurne

comment created time in 23 days

push eventmgorny/twisted

Thomas Westfeld

commit sha fa569f5214051f70e954c33278832f7454faaf23

Add howto for packaging applications #9243 * Add a howto to use setuptools to package twisted applications for easy deployment using pip.

view details

Thomas Westfeld

commit sha 49432ac04052ed2e24799a6dfc09bbedd0924e68

add newsfragment file

view details

Thomas Westfeld

commit sha 9447c453478c4fc81ac44b8b46cebdfb9fb2acd2

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Thomas Westfeld

commit sha 12d8bba698bbf0e0ef1e31029ee5f126949f31ec

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Thomas Westfeld

commit sha cca56aeedcd5d539f96c8fbf0de8e7bcd86e95a5

clarify changes in newsfragment

view details

Thomas Westfeld

commit sha 58f970b1d8e0ba38a3c5d348e9d96940bd78ec11

change description of the files in the plugins directory

view details

Thomas Westfeld

commit sha 04a3d44151ccf4274ac5e0d6eecfb4e7e7bc3e6f

change license to MIT to be in agreeement with twisted's license

view details

Thomas Westfeld

commit sha 109de42afeaad113b0ea5227a4a211f0f9d3b765

change to setuptools and add comment why twisted.plugins is added to packages

view details

Thomas Grainger

commit sha 079ac50bf5451ad2ce5c487e4dd8756c010b4fe7

construct and assign portal and checkers consistently The example uses a mix of constructor form and the register form. Use only the constructor form, and create all class properties in the classdef, move conch server example portal to factory __init__

view details

Mark Williams

commit sha 474af65c37c4fb1c2c4e462c951aa854b409f20f

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Glyph

commit sha 1f635e87b42905ef44e8448926d1e42137451b70

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Glyph

commit sha dba8db2f0a15aacd39726b9f683c1857ab6fbfd7

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Mark Williams

commit sha 9d0ad7ed6b3f6ab03c0f25e017a840af56bf19ee

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Thomas Westfeld

commit sha 1bd0583de3f70ff778e404ef9ca68c0b8f80e5b4

replaced distutils by setuptools

view details

Thomas Westfeld

commit sha 58c37fde4afb48c11320a1194fbfa1772b9075f2

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

mathieui

commit sha ad76e2808df5970e063cc1b13c3cfef474cc4d1a

Fix serialization of date, time, and timedelta objects in python 3 Unicode strings cannot be sent as is in Banana, and need to be byte-encoded. In python 3, this would fail for the date, time and timedelta objects as the jellyfication would use a unicode string and not a byte string.

view details

Glyph

commit sha a77fab11e44c0c03ef0404083c6004ccc8418676

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Colin Watson

commit sha e2f6adf542fdef7d94d8e50029d009478104fbf8

Normalize Unicode passphrases for SSH keys This is required by NIST 800-63B. We choose NFKC normalization here. It is possible, though unlikely, that some existing key files will have passphrases that are the UTF-8 encoding of a Unicode string not in NFKC; twisted.conch.ssh.keys.Key.fromString will fail to load those keys if given such a passphrase as a Unicode string. In that case the workaround is to provide the passphrase as bytes instead.

view details

Colin Watson

commit sha 0e9d5248208229850e9b658d7d2327a27b0bc79b

Fix lint

view details

Colin Watson

commit sha 535478946f2bfc4a485469bafec87bb0936c8ae3

Merge branch 'trunk' into 9736-conch-normalize-passphrase

view details

push time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __repr__() and __str__()

+New interface IEncodableRecord combines IEncodable and IRecord, which is useful when using type annotations.

Newsfragments which are misc need to be empty. See:

https://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles

Can you separate out the changes where you introduce a IEncodableRecord interface into a new PR, and leave this .misc file as empty?

Everything else in this PR is very simple in terms of adding return types to __repr__() and are easy to merge in.

mthuurne

comment created time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __repr__() and __str__()

 def __init__(self, filename, line, col, message):         self.col = col         self.message = message -    def __str__(self):-       return "%s:%s:%s: %s" % (self.filename, self.line, self.col,

Consider using format strings

mthuurne

comment created time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __repr__() and __str__()

 def __init__(self, filename, expect, got, endLine, endCol, begLine, begCol):          self.endCol) = filename, expect, got, begLine, begCol, endLine, endCol  -    def __str__(self):-        return ("expected </%s>, got </%s> line: %s col: %s, began line: %s col: %s"

consider using format strings

mthuurne

comment created time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __repr__() and __str__()

 def __repr__(self):              if uidgid:                 uidgid = '(' + uidgid + ')'-            l.append('%r%s: %r' % (name, uidgid, proc.args))

Not a big deal, but consider using format strings

mthuurne

comment created time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __repr__() and __str__()

 def getUsage(self, width=None):          return s + longdesc + commands -    #def __repr__(self):

Not a big deal but maybe better just to delete this commented out block

mthuurne

comment created time in 23 days

pull request commenttwisted/twisted

[9076] HTTP CONNECT chunked Content-Length suppression

This looks OK, but lint failures need to be fixed: https://travis-ci.com/github/twisted/twisted/jobs/362488290

You can use tox -e lint locally before pushing.

twm

comment created time in 23 days

Pull request review commenttwisted/twisted

Add type annotations to __eq__() et al

 def __init__(self, keyObject):         """         self._keyObject = keyObject -    def __eq__(self, other):+    def __eq__(self, other: object) -> bool:

The return type is specified as bool, but this function can also return NotImplemented. Is it correct to specify bool as the return type?

mthuurne

comment created time in 23 days

pull request commentcoveralls-clients/coveralls-python

Fix unhashable exception

Thanks for the response. Yes this was an intermittent problem and I have not hit it lately. The workaround for me was to push a new commit to my branch so that it would have a new Git SHA, and Coveralls did not error out after that.

rodrigc

comment created time in 23 days

push eventtwisted/twisted

Thomas Westfeld

commit sha fa569f5214051f70e954c33278832f7454faaf23

Add howto for packaging applications #9243 * Add a howto to use setuptools to package twisted applications for easy deployment using pip.

view details

Thomas Westfeld

commit sha 49432ac04052ed2e24799a6dfc09bbedd0924e68

add newsfragment file

view details

Thomas Westfeld

commit sha 9447c453478c4fc81ac44b8b46cebdfb9fb2acd2

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Thomas Westfeld

commit sha 12d8bba698bbf0e0ef1e31029ee5f126949f31ec

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Thomas Westfeld

commit sha cca56aeedcd5d539f96c8fbf0de8e7bcd86e95a5

clarify changes in newsfragment

view details

Thomas Westfeld

commit sha 58f970b1d8e0ba38a3c5d348e9d96940bd78ec11

change description of the files in the plugins directory

view details

Thomas Westfeld

commit sha 04a3d44151ccf4274ac5e0d6eecfb4e7e7bc3e6f

change license to MIT to be in agreeement with twisted's license

view details

Thomas Westfeld

commit sha 109de42afeaad113b0ea5227a4a211f0f9d3b765

change to setuptools and add comment why twisted.plugins is added to packages

view details

Thomas Grainger

commit sha 079ac50bf5451ad2ce5c487e4dd8756c010b4fe7

construct and assign portal and checkers consistently The example uses a mix of constructor form and the register form. Use only the constructor form, and create all class properties in the classdef, move conch server example portal to factory __init__

view details

Mark Williams

commit sha 474af65c37c4fb1c2c4e462c951aa854b409f20f

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Glyph

commit sha 1f635e87b42905ef44e8448926d1e42137451b70

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Glyph

commit sha dba8db2f0a15aacd39726b9f683c1857ab6fbfd7

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Mark Williams

commit sha 9d0ad7ed6b3f6ab03c0f25e017a840af56bf19ee

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Thomas Westfeld

commit sha 1bd0583de3f70ff778e404ef9ca68c0b8f80e5b4

replaced distutils by setuptools

view details

Thomas Westfeld

commit sha 58c37fde4afb48c11320a1194fbfa1772b9075f2

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

mathieui

commit sha ad76e2808df5970e063cc1b13c3cfef474cc4d1a

Fix serialization of date, time, and timedelta objects in python 3 Unicode strings cannot be sent as is in Banana, and need to be byte-encoded. In python 3, this would fail for the date, time and timedelta objects as the jellyfication would use a unicode string and not a byte string.

view details

Glyph

commit sha a77fab11e44c0c03ef0404083c6004ccc8418676

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Colin Watson

commit sha e2f6adf542fdef7d94d8e50029d009478104fbf8

Normalize Unicode passphrases for SSH keys This is required by NIST 800-63B. We choose NFKC normalization here. It is possible, though unlikely, that some existing key files will have passphrases that are the UTF-8 encoding of a Unicode string not in NFKC; twisted.conch.ssh.keys.Key.fromString will fail to load those keys if given such a passphrase as a Unicode string. In that case the workaround is to provide the passphrase as bytes instead.

view details

Colin Watson

commit sha 0e9d5248208229850e9b658d7d2327a27b0bc79b

Fix lint

view details

Colin Watson

commit sha 535478946f2bfc4a485469bafec87bb0936c8ae3

Merge branch 'trunk' into 9736-conch-normalize-passphrase

view details

push time in 24 days

Pull request review commenttwisted/twisted

Fix AsyncioSelectorReactor on Windows Python 3.8+

 def completed(future):         self.assertEqual(result, [True])  +    @skipIf(not _defaultEventLoopIsSelector,+            "default event loop: {}\nis not is of type SelectorEventLoop "+            "on Python {}.{} ({})".format(+                type(_defaultEventLoop), sys.version_info.major,+                sys.version_info.minor, platform.getType()))+    def test_defaultSelectorEventLoopFromGlobalPolicy(self):+        """+        L{AsyncioSelectorReactor} wraps the global policy's event loop+        by default.  This ensures that L{asyncio.Future}s and+        coroutines created by library code that uses+        L{asyncio.get_event_loop} are bound to the same loop.+        """+        reactor = AsyncioSelectorReactor()+        self._test_reactor(reactor)+++    @skipIf(not _defaultEventLoopIsSelector,+            "default event loop: {}\nis not of type SelectorEventLoop "+            "on Python {}.{} ({})".format(+                type(_defaultEventLoop), sys.version_info.major,+                sys.version_info.minor, platform.getType()))+    def test_newSelectorEventLoopFromDefaultEventLoopPolicy(self):+        event_loop = DefaultEventLoopPolicy().new_event_loop()+        reactor = AsyncioSelectorReactor(event_loop)+        set_event_loop(event_loop)+        self._test_reactor(reactor)+        set_event_loop_policy(None)+++    @skipIf(_defaultEventLoopIsSelector,+            "default event loop: {}\nis of type SelectorEventLoop "+            "on Python {}.{} ({})".format(+                type(_defaultEventLoop), sys.version_info.major,+                sys.version_info.minor, platform.getType()))+    def test_defaultNotASelectorEventLoopFromGlobalPolicy(self):+        """+        On Windows Python 3.5 to 3.7, L{get_event_loop()} returns a+        L{WindowsSelectorEventLoop} by default.+        On Windows Python 3.8+, L{get_event_loop()} returns a+        L{WindowsProactorEventLoop} by default.+        L{AsyncioSelectorReactor} should raise a+        L{ValueError} if the default event loop is not a+        L{WindowsSelectorEventLoop}.+        """+        self.assertRaises(ValueError, AsyncioSelectorReactor)+++    @skipIf(not hasWindowsProactorEventLoopPolicy,+            "WindowsProactorEventLoop not available")+    def test_WindowsProactorEventLoop(self):+        """+        L{AsyncioSelectorReactor} will raise a L{ValueError}+        if instantiated with a L{asyncio.WindowsProactorEventLoop}+        """+        event_loop = WindowsProactorEventLoopPolicy().new_event_loop()+        self.assertRaises(ValueError, AsyncioSelectorReactor, event_loop)+++    @skipIf(not hasWindowsSelectorEventLoopPolicy,+            "WindowsSelectorEventLoop only on Windows")+    def test_WindowsSelectorEventLoop(self):+        """+        L{WindowsSelectorEventLoop} works with L{AsyncioSelectorReactor}+        """+        event_loop = WindowsSelectorEventLoopPolicy().new_event_loop()+        reactor = AsyncioSelectorReactor(event_loop)+        set_event_loop(event_loop)+        self._test_reactor(reactor)+        set_event_loop_policy(None)+++    @skipIf(not hasWindowsProactorEventLoopPolicy,+            "WindowsProactorEventLoopPolicy only on Windows")+    def test_WindowsProactorEventLoopPolicy(self):+        """+        L{AsyncioSelectorReactor} will raise a L{ValueError}+        if L{asyncio.WindowsProactorEventLoopPolicy} is default.+        """+        set_event_loop_policy(WindowsProactorEventLoopPolicy())+        with self.assertRaises(ValueError):+            AsyncioSelectorReactor()+        set_event_loop_policy(None)+++    @skipIf(not hasWindowsSelectorEventLoopPolicy,+            "WindowsSelectorEventLoopPolicy only on Windows")+    def test_WindowsSelectorEventLoopPolicy(self):+        """+        L{AsyncioSelectorReactor} will work if+        if L{asyncio.WindowsSelectorEventLoopPolicy} is default.+        """+        set_event_loop_policy(WindowsSelectorEventLoopPolicy())+        reactor = AsyncioSelectorReactor()+        self._test_reactor(reactor)+        set_event_loop_policy(None)++     def test_seconds(self):         """L{seconds} should return a plausible epoch time."""+        if hasWindowsSelectorEventLoopPolicy:

Done

rodrigc

comment created time in 24 days

Pull request review commenttwisted/twisted

Fix AsyncioSelectorReactor on Windows Python 3.8+

 Tests for L{twisted.internet.asyncioreactor}. """ import gc+import sys from unittest import skipIf +from twisted.python.runtime import platform from twisted.trial.unittest import SynchronousTestCase from .reactormixins import ReactorBuilder +from twisted.internet.asyncioreactor import AsyncioSelectorReactor+from asyncio import (+    set_event_loop, set_event_loop_policy,+    DefaultEventLoopPolicy, Future, SelectorEventLoop)++hasWindowsProactorEventLoopPolicy = False+hasWindowsSelectorEventLoopPolicy = False+ try:-    from twisted.internet.asyncioreactor import AsyncioSelectorReactor-    import asyncio+    if sys.platform.startswith("win32"):+        from asyncio import (+            WindowsProactorEventLoopPolicy, WindowsSelectorEventLoopPolicy)+        hasWindowsProactorEventLoopPolicy = True+        hasWindowsSelectorEventLoopPolicy = True except ImportError:-    doSkip = True-else:-    doSkip = False+    pass   -@skipIf(doSkip, "Requires asyncio.") class AsyncioSelectorReactorTests(ReactorBuilder, SynchronousTestCase):     """     L{AsyncioSelectorReactor} tests.     """-    def test_defaultEventLoopFromGlobalPolicy(self):-        """-        L{AsyncioSelectorReactor} wraps the global policy's event loop-        by default.  This ensures that L{asyncio.Future}s and-        coroutines created by library code that uses-        L{asyncio.get_event_loop} are bound to the same loop.-        """-        reactor = AsyncioSelectorReactor()-        future = asyncio.Future()++    _defaultEventLoop = DefaultEventLoopPolicy().new_event_loop()+    _defaultEventLoopIsSelector = isinstance(_defaultEventLoop,+                                             SelectorEventLoop)++    def _test_reactor(self, reactor):+        future = Future()

Done

rodrigc

comment created time in 24 days

Pull request review commenttwisted/twisted

Fix AsyncioSelectorReactor on Windows Python 3.8+

  import errno +from typing import Dict, Optional, Type+ from zope.interface import implementer  from twisted.logger import Logger from twisted.internet.posixbase import (PosixReactorBase, _NO_FILEDESC,                                         _ContinuousPolling) from twisted.python.log import callWithLogger from twisted.python.runtime import seconds as runtimeSeconds+from twisted.internet.abstract import FileDescriptor from twisted.internet.interfaces import IReactorFDSet -try:-    from asyncio import get_event_loop-except ImportError:-    raise ImportError("Requires asyncio.")--# As per ImportError above, this module is never imported on python 2, but-# pyflakes still runs on python 2, so let's tell it where the errors come from.-from builtins import PermissionError, BrokenPipeError+from asyncio import get_event_loop, AbstractEventLoop, SelectorEventLoop    @implementer(IReactorFDSet) class AsyncioSelectorReactor(PosixReactorBase):     """     Reactor running on top of L{asyncio.SelectorEventLoop}.++    On POSIX platforms, the default event loop is+    L{asyncio.SelectorEventLoop}.+    On Windows, the default event loop on Python 3.7 and older+    is L{asyncio.WindowsSelectorEventLoop}, but on Python 3.8 and newer+    the default event loop is L{asyncio.WindowsProactorEventLoop} which+    is incompatible with L{AsyncioSelectorReactor}.+    Applications that use L{AsyncioSelectorReactor} on Windows+    with Python 3.8+ must call+    C{asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())}+    before instantiating and running L{AsyncioSelectorReactor}.     """     _asyncClosed = False     _log = Logger() -    def __init__(self, eventloop=None):-+    def __init__(self, eventloop: Optional[SelectorEventLoop] = None):         if eventloop is None:-            eventloop = get_event_loop()+            _eventloop = get_event_loop()  # type: AbstractEventLoop+            # On Python 3.8+, asyncio.get_event_loop() on+            # Windows was changed to return a ProactorEventLoop+            if not isinstance(_eventloop, SelectorEventLoop):+                raise ValueError(+                    "get_event_loop() returns: {} which is not a "+                    "SelectorEventLoop".format(_eventloop))++            eventloop = _eventloop+        else:+            if not isinstance(eventloop, SelectorEventLoop):+                raise ValueError(+                    "eventloop is: {} which is not a subclass of "+                    "SelectorEventLoop".format(eventloop))

Done

rodrigc

comment created time in 24 days

push eventtwisted/twisted

Craig Rodrigues

commit sha d36c6130c47af5e57062653d166a0b78e040a1c2

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

Craig Rodrigues

commit sha 85069b5ccdc92745809a8287ab24d6127c1a75da

Check unicode args using the encoding defined by sys.stdout.encoding

view details

push time in 25 days

push eventtwisted/twisted

Craig Rodrigues

commit sha e0cd02f31cdae775c01b0a727027f9191f5a6c45

Check unicode args using the encoding defined by sys.stdout.encoding

view details

push time in 25 days

push eventtwisted/twisted

Craig Rodrigues

commit sha 5ec85f644c9b5c9cb21a9923ec22a6e6ee577ec4

Add more debugging in case of bad arg or env variables which can't be decoded

view details

Craig Rodrigues

commit sha 9ad444dbcb0b7a91e3997551633c7938115739e0

Set PYTHONUTF8 environment variable to force UTF-8 mode on Python 3.7+ on Windows Set PYTHONIOENCODING variable to utf8 for Python 3.5, 3.6

view details

Craig Rodrigues

commit sha 6781b53fccb8a793fc64cb2d5ccf3b72cbfa10b8

Print environment variables

view details

Craig Rodrigues

commit sha ec627d3b7275ec7ac383553e179ef1428c916dc7

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

Craig Rodrigues

commit sha 2ea4bbe3d86a3b6397a906d5c0baa6ea74d31c98

Check unicode args using the encoding defined by sys.stdout.encoding

view details

push time in 25 days

pull request commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

I think changing the Reactor portion is wrong -- Windows environment variables are stored internally as Unicode, and the APIs take Unicode. Therefore, we should ask users to provide the native (Unicode) representation in the API, decoding it ourselves from bytes if need be, since if we pass bytes to the Python APIs, it may do implicit decoding based on the character map. There is no real bytes encoding of a Windows environment variable, unless we (or Python) encodes it.

The solution is basically not to change any of the code, but to ensure that these tests run under an accurate code page. The Unicode tests fail because of the Latin-1 code page, and so them failing is "correct". The issue is that we're dealing with Unicode, so we want a working Unicode input/output system.

@hawkowl OK, I took out the change which eliminated argChecker() from the reactor. I made one slight change to twisted/internet/base.py to put the actual bad key or value in the TypeError message, to make it a bit easier to debug when something goes wrong.

rodrigc

comment created time in 25 days

push eventtwisted/twisted

Craig Rodrigues

commit sha ae8a231338334aee618a2089b31a17015600b49e

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

push time in 25 days

push eventtwisted/twisted

Craig Rodrigues

commit sha 6c0585b7d05a8d3c3bc36fc8d982da668b298ade

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

push time in 25 days

push eventtwisted/twisted

Craig Rodrigues

commit sha 4b10cdab904b4378c1c563722130ed7c4b3be334

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

push time in 25 days

push eventtwisted/twisted

Craig Rodrigues

commit sha b07a07a20a08efb4c13cf9ce27f73d6647fef030

Add test with a UTF8 string in the environment. Inspired by Michał Górny

view details

push time in 25 days

PullRequestEvent

pull request commenttwisted/twisted

[DO NOT MERGE] PR for testing windows encoding problems

https://github.com/twisted/twisted/pull/1302 is not merged yet. We are leaving this PR open, to test when someone with non-ASCII characters in their name, specifically Michał Górny, files a PR.

mgorny

comment created time in 25 days

pull request commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

That is, extend Win32ProcessTests to have an test_osEnviron_bytes and test_osEnviron_unicode , similar to test_stdinReader_bytesArgs/test_stdinReader_unicodeArgs

Let me know if you need help with the tests and I suggest a path for such a test.

I don't understand what you are asking for here. On Windows, os.environ is Unicode. On Windows, there is no os.environbbecause os.supports_bytes_environ is always False. See: https://docs.python.org/3/library/os.html#os.environ https://docs.python.org/3/library/os.html#os.environb https://docs.python.org/3/library/os.html#os.supports_bytes_environ

rodrigc

comment created time in 25 days

pull request commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

I see that you made a change to posix_reactor, but I don't see any updated tests for Unicode env vars. Does it mean that posix Unicode env vars were already working, and we already have a test for that. In that case, I think that those existing tests should also be enabled for Windows.

On Python 3, os.environ is str on all platforms, including POSIX. In Python 3, str is Unicode, including on POSIX.

rodrigc

comment created time in 25 days

Pull request review commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

 class Win32UnicodeEnvironmentTests(unittest.TestCase):     """     Tests for Unicode environment on Windows     """-    goodKey = u'UNICODE'-    goodValue = u'UNICODE'+    goodKey = 'UNICODE'+    goodKeyBytes = b'UNICODE'+    goodValue = 'UNICODE'+    goodValueBytes = b'UNICODE'

Done

rodrigc

comment created time in 25 days

push eventtwisted/twisted

Thomas Westfeld

commit sha fa569f5214051f70e954c33278832f7454faaf23

Add howto for packaging applications #9243 * Add a howto to use setuptools to package twisted applications for easy deployment using pip.

view details

Thomas Westfeld

commit sha 49432ac04052ed2e24799a6dfc09bbedd0924e68

add newsfragment file

view details

Thomas Westfeld

commit sha 9447c453478c4fc81ac44b8b46cebdfb9fb2acd2

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Thomas Westfeld

commit sha 12d8bba698bbf0e0ef1e31029ee5f126949f31ec

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Thomas Westfeld

commit sha cca56aeedcd5d539f96c8fbf0de8e7bcd86e95a5

clarify changes in newsfragment

view details

Thomas Westfeld

commit sha 58f970b1d8e0ba38a3c5d348e9d96940bd78ec11

change description of the files in the plugins directory

view details

Thomas Westfeld

commit sha 04a3d44151ccf4274ac5e0d6eecfb4e7e7bc3e6f

change license to MIT to be in agreeement with twisted's license

view details

Thomas Westfeld

commit sha 109de42afeaad113b0ea5227a4a211f0f9d3b765

change to setuptools and add comment why twisted.plugins is added to packages

view details

Thomas Grainger

commit sha 079ac50bf5451ad2ce5c487e4dd8756c010b4fe7

construct and assign portal and checkers consistently The example uses a mix of constructor form and the register form. Use only the constructor form, and create all class properties in the classdef, move conch server example portal to factory __init__

view details

Mark Williams

commit sha 474af65c37c4fb1c2c4e462c951aa854b409f20f

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Glyph

commit sha 1f635e87b42905ef44e8448926d1e42137451b70

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Glyph

commit sha dba8db2f0a15aacd39726b9f683c1857ab6fbfd7

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Mark Williams

commit sha 9d0ad7ed6b3f6ab03c0f25e017a840af56bf19ee

Merge branch 'trunk' into 9578-better-conch-server-example

view details

Thomas Westfeld

commit sha 1bd0583de3f70ff778e404ef9ca68c0b8f80e5b4

replaced distutils by setuptools

view details

Thomas Westfeld

commit sha 58c37fde4afb48c11320a1194fbfa1772b9075f2

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Colin Watson

commit sha e2f6adf542fdef7d94d8e50029d009478104fbf8

Normalize Unicode passphrases for SSH keys This is required by NIST 800-63B. We choose NFKC normalization here. It is possible, though unlikely, that some existing key files will have passphrases that are the UTF-8 encoding of a Unicode string not in NFKC; twisted.conch.ssh.keys.Key.fromString will fail to load those keys if given such a passphrase as a Unicode string. In that case the workaround is to provide the passphrase as bytes instead.

view details

Colin Watson

commit sha 0e9d5248208229850e9b658d7d2327a27b0bc79b

Fix lint

view details

Colin Watson

commit sha 535478946f2bfc4a485469bafec87bb0936c8ae3

Merge branch 'trunk' into 9736-conch-normalize-passphrase

view details

Wilfredo Sánchez Vega

commit sha c8da16e1bcdf867f0e4f7fb4b5a52031b161fcb1

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

Wilfredo Sánchez Vega

commit sha 746cd12070b13e66290d01c044f13058c2afeba9

Merge branch 'trunk' into 9243-westfeld-add-deployment-docs-pip

view details

push time in 25 days

push eventtwisted/twisted

mathieui

commit sha ad76e2808df5970e063cc1b13c3cfef474cc4d1a

Fix serialization of date, time, and timedelta objects in python 3 Unicode strings cannot be sent as is in Banana, and need to be byte-encoded. In python 3, this would fail for the date, time and timedelta objects as the jellyfication would use a unicode string and not a byte string.

view details

Glyph

commit sha a77fab11e44c0c03ef0404083c6004ccc8418676

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Tom Most

commit sha c7600a13fdd6d267df3f0d199859fc563bb51485

Fix mixed content in readme

view details

Tom Most

commit sha 9546b2b6b408e28125414bcfc2fcf50f66453369

Fix ssl rst

view details

Tom Most

commit sha c7b8e5f8089a2cc9a773b228e78b55a857f15a12

Fix trial.rst

view details

Tom Most

commit sha 37beed63f8cbd2aa2030ac8a1b8552284c5d626b

Update twisted-template.rst links I removed the mention of clearsilver as it appears unmaintained.

view details

Tom Most

commit sha c553bec3ff1ca0f82b7264ab1c3ab8437b73d3fd

Merge branch 'trunk' into 9781-https-everywhere

view details

Craig Rodrigues

commit sha 690cdfd5fe0914b99d81473564a50fe0ef877d3d

Add newsfragment

view details

Craig Rodrigues

commit sha dc7e36bc1e513d96bed0f9a1c9c6256e9e852bc4

Add newsfragment

view details

Craig Rodrigues

commit sha a0407f9150513075bf0fcc2cc11ee64dbb7c8221

Add some comments for mypy to ignore assignment after ImportError

view details

Craig Rodrigues

commit sha 078dc6b313dccc1d12dd751a4eb2eb11dce8799d

Replace lambda with function

view details

Maarten ter Huurne

commit sha 1d79138d587acab9940d8caccd9b18bac36e5dfe

Fix typos in cross-references in docstrings

view details

Maarten ter Huurne

commit sha 5379c27233a87ee0eb98185bf9a04a446f29117a

Fix docstring cross-references to zope.interface.implementer While the decorator is implemented in zope.interface.declarations, it is exported and documented as part of the zope.interface module, so that is where documentation cross-references should point to.

view details

Maarten ter Huurne

commit sha b54f9eef4d120f816a5039337b0024e1986a8767

Add empty news fragment

view details

Craig Rodrigues

commit sha cd8807574c77b42856bb7def0840e3552113b1e4

Merge branch 'trunk' into 9862-rodrigc-mypy

view details

Craig Rodrigues

commit sha 3ddea5f4ff78b1c775a226069348c03365271be9

Merge pull request #1307 from twisted/9862-rodrigc-mypy [mypy] suppress errors after ImportError Author: rodrigc Reviewer: adiroiban Fixes: ticket:9862

view details

Craig Rodrigues

commit sha f436210ddc39ecd132c5f8442d2392e41f2239dc

Merge branch 'trunk' into 9865-rodrigc-mypy

view details

Glyph

commit sha dda6f5559cc7a1f94825c74c92f9092d4e280449

Merge branch 'trunk' into 9873-mthuurne-docstringxref

view details

Craig Rodrigues

commit sha 0c25daaa5be12912f2aa4d5ba539e7b7d75dce78

Merge pull request #1310 from twisted/9865-rodrigc-mypy [mypy] cannot infer type of lambda

view details

Craig Rodrigues

commit sha e49c535477503e1fb0d6a3dcfa39a1e51e4158ba

Add instructions for running lint and mypy Remove references to Python 2.7

view details

push time in 25 days

Pull request review commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

 class Win32UnicodeEnvironmentTests(unittest.TestCase):     """     Tests for Unicode environment on Windows     """-    goodKey = u'UNICODE'-    goodValue = u'UNICODE'+    goodKey = 'UNICODE'+    goodKeyBytes = b'UNICODE'+    goodValue = 'UNICODE'+    goodValueBytes = b'UNICODE'       def test_encodableUnicodeEnvironment(self):         """-        Test C{os.environ} (inherited by every subprocess on Windows) that-        contains an ascii-encodable Unicode string. This is different from-        passing Unicode environment explicitly to spawnProcess (which is not-        supported on Python 2).+        Test L{os.environ} (inherited by every subprocess on Windows) that+        contains an ascii-encodable Unicode string.

OK I added this doc string

rodrigc

comment created time in 25 days

Pull request review commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

 parameters:   - select   - iocp - jobs: - ${{ each pyver in parameters.pythonVersions }}:   - job: ${{ format('windows_{0}_{1}reactor', pyver.key, parameters.reactor) }}     displayName: ${{ format('Windows Py{0} {1}reactor', pyver.value, parameters.reactor) }}     pool:       vmImage: ${{ parameters.imageName }}+    variables:+      PYTHONUTF8: 1+      PYTHONIOENCODING: "utf-8:surrogateescape"

OK, I added a comment.

rodrigc

comment created time in 25 days

Pull request review commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

 class Win32UnicodeEnvironmentTests(unittest.TestCase):     """     Tests for Unicode environment on Windows     """-    goodKey = u'UNICODE'-    goodValue = u'UNICODE'+    goodKey = 'UNICODE'+    goodKeyBytes = b'UNICODE'+    goodValue = 'UNICODE'+    goodValueBytes = b'UNICODE'       def test_encodableUnicodeEnvironment(self):         """-        Test C{os.environ} (inherited by every subprocess on Windows) that-        contains an ascii-encodable Unicode string. This is different from-        passing Unicode environment explicitly to spawnProcess (which is not-        supported on Python 2).+        Test L{os.environ} (inherited by every subprocess on Windows) that+        contains an ascii-encodable Unicode string.         """         os.environ[self.goodKey] = self.goodValue         self.addCleanup(operator.delitem, os.environ, self.goodKey) -        p = GetEnvironmentDictionary.run(reactor, [], properEnv)-        def gotEnvironment(environ):-            self.assertEqual(-                environ[self.goodKey.encode('ascii')],-                self.goodValue.encode('ascii'))+        p = GetEnvironmentDictionary.run(reactor, [], os.environ)++        def gotEnvironment(environb):+            self.assertEqual(environb[self.goodKeyBytes], self.goodValueBytes)++        return p.getResult().addCallback(gotEnvironment)

OK I did this

rodrigc

comment created time in 25 days

Pull request review commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

 class Win32UnicodeEnvironmentTests(unittest.TestCase):     """     Tests for Unicode environment on Windows     """-    goodKey = u'UNICODE'-    goodValue = u'UNICODE'+    goodKey = 'UNICODE'+    goodKeyBytes = b'UNICODE'+    goodValue = 'UNICODE'+    goodValueBytes = b'UNICODE'       def test_encodableUnicodeEnvironment(self):         """-        Test C{os.environ} (inherited by every subprocess on Windows) that-        contains an ascii-encodable Unicode string. This is different from-        passing Unicode environment explicitly to spawnProcess (which is not-        supported on Python 2).+        Test L{os.environ} (inherited by every subprocess on Windows) that+        contains an ascii-encodable Unicode string.         """         os.environ[self.goodKey] = self.goodValue         self.addCleanup(operator.delitem, os.environ, self.goodKey) -        p = GetEnvironmentDictionary.run(reactor, [], properEnv)-        def gotEnvironment(environ):-            self.assertEqual(-                environ[self.goodKey.encode('ascii')],-                self.goodValue.encode('ascii'))+        p = GetEnvironmentDictionary.run(reactor, [], os.environ)++        def gotEnvironment(environb):+            self.assertEqual(environb[self.goodKeyBytes], self.goodValueBytes)++        return p.getResult().addCallback(gotEnvironment)+++    def test_UTF8StringInEnvironment(self):+        """+        L{os.environ} (inherited by every subprocess on Windows) can+        contain a UTF-8 string.

This is documented in the Python 3 docs: https://docs.python.org/3/library/os.html#os.environ os.environ contains str keys and values. str is Unicode on Python 3.

rodrigc

comment created time in 25 days

Pull request review commenttwisted/twisted

Fix Win32UnicodeEnvironmentTests.test_encodableUnicodeEnvironment for Azure pipelines

 parameters:   - select   - iocp - jobs: - ${{ each pyver in parameters.pythonVersions }}:   - job: ${{ format('windows_{0}_{1}reactor', pyver.key, parameters.reactor) }}     displayName: ${{ format('Windows Py{0} {1}reactor', pyver.value, parameters.reactor) }}     pool:       vmImage: ${{ parameters.imageName }}+    variables:+      PYTHONUTF8: 1+      PYTHONIOENCODING: "utf-8:surrogateescape"

@adiroiban Where in the public documentation?

rodrigc

comment created time in 25 days

push eventtwisted/twisted

alex

commit sha e99cb683da065cd26f0dea58e69f8d1a8549c9d6

imapserver: fix copy operation

view details

Craig Rodrigues

commit sha cb7e96f0eb2b692559918740720db6a62791e10a

Add newsfragment

view details

Craig Rodrigues

commit sha e0aab3281d9cd090d9af93da8a930a241440f413

Fix path to badge

view details

Craig Rodrigues

commit sha d99065087fd7b7c9a81e4b685f49c979b6454906

Merge pull request #1353 from devkral/bugfix/copy imapserver: fix copy operation Author: devkral Reviewer: rodrigc Fixes: ticket:9910

view details

push time in a month

PR merged twisted/twisted

imapserver: fix copy operation

Contributor Checklist:

  • [X] The associated ticket in Trac is here: https://twistedmatrix.com/trac/ticket/9910
  • [X] The changes pass minimal style checks (see: https://twistedmatrix.com/trac/wiki/TwistedDevelopment#GettingYourPatchAccepted )
  • [ ] I have created a newsfragment in src/twisted/newsfragments/ (see: https://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles )
  • [ ] I have updated the automated tests.
  • [x] I have submitted the associated Trac ticket for review by adding the word review to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.

_parseMbox is not an attribute. This fixes the copy operation.

+6 -5

2 comments

3 changed files

devkral

pr closed time in a month

pull request commenttwisted/twisted

imapserver: fix copy operation

OK I created https://twistedmatrix.com/trac/ticket/9910 for you.

devkral

comment created time in a month

push eventdevkral/twisted

Craig Rodrigues

commit sha 75b34bc5f49f0c225018482e9c97e1f3619e2ad2

Use typing.cast() to cast return value of decorator This follows the example here: https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators This eliminates a mypy errors

view details

Craig Rodrigues

commit sha 4be2e6beb94e87d12d0b59bccaa4338fcb26187e

Add newsfragment

view details

Craig Rodrigues

commit sha 3a862c63b082671d160bff0d67157b411dc6150b

Add newsfragment

view details

Craig Rodrigues

commit sha 9e0adce10729a0162252a808c9068ef1120de9ea

Merge pull request #1346 from twisted/9902-rodrigc-mypy [mypy] [9902] Fix mypy error in decorator.py Author: rodrigc Reviewer: wsanchez Fixes: ticket:9902

view details

Adi Roiban

commit sha 56c2a4bb6b9b6a22282662ab6a7771b085408224

Run mypy on GitHub actions. (#1349) * Run mypy on GitHub actions based on GitHub Actions template for Python. - Remove mypy from azure pipelines. - Run on any change. - Add a status badge for GitHub Actions on mypy - Update mypy run. Author: adiroiban Reviewer: rodrigc Fixes: ticket:9903

view details

alex

commit sha e99cb683da065cd26f0dea58e69f8d1a8549c9d6

imapserver: fix copy operation

view details

Craig Rodrigues

commit sha cb7e96f0eb2b692559918740720db6a62791e10a

Add newsfragment

view details

Craig Rodrigues

commit sha e0aab3281d9cd090d9af93da8a930a241440f413

Fix path to badge

view details

push time in a month

delete branch twisted/twisted

delete branch : 9903-github-actions-mypy

delete time in a month

push eventtwisted/twisted

Adi Roiban

commit sha 56c2a4bb6b9b6a22282662ab6a7771b085408224

Run mypy on GitHub actions. (#1349) * Run mypy on GitHub actions based on GitHub Actions template for Python. - Remove mypy from azure pipelines. - Run on any change. - Add a status badge for GitHub Actions on mypy - Update mypy run. Author: adiroiban Reviewer: rodrigc Fixes: ticket:9903

view details

push time in a month

PR merged twisted/twisted

Run mypy on GitHub actions.

https://twistedmatrix.com/trac/ticket/9903

Scope

This moves the mypy check from Azure Pipelines to GitHub Actions.

GitHub actions provides better integration with PR and at the same time can be managed without extra access to Azure DevOps admin portal.

Changes

Remove mypy from Azure Pipelines and moves it to GitHub Actions

It tries to run all the setup code in separate steps so that mypy step will have minimal noise and we can see how long it takes to run only the mypy test, without installing deps and creating the virtualenv

How to test

I have no idea how to test this. The problem is that GitHub actions will run an action only if it is first merged in master.

+52 -27

6 comments

5 changed files

adiroiban

pr closed time in a month

pull request commenttwisted/twisted

Run mypy on GitHub actions.

This looks fine.

adiroiban

comment created time in a month

pull request commenttwisted/twisted

Run mypy on GitHub actions.

@adiroiban does this look ok to you now? mypy run now passes on GitHub Actions

adiroiban

comment created time in a month

push eventtwisted/twisted

mathieui

commit sha ad76e2808df5970e063cc1b13c3cfef474cc4d1a

Fix serialization of date, time, and timedelta objects in python 3 Unicode strings cannot be sent as is in Banana, and need to be byte-encoded. In python 3, this would fail for the date, time and timedelta objects as the jellyfication would use a unicode string and not a byte string.

view details

Glyph

commit sha a77fab11e44c0c03ef0404083c6004ccc8418676

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Glyph

commit sha c95582c872653ee9c66028a37d9f62b45d0193b4

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Glyph

commit sha 06fe0412be47c27df5cf50e3a22dd39778bc96df

test case for bananability of jellied time types

view details

Glyph

commit sha 4ebd1e1aba557f31b988d1858b923a6125bc7125

Merge commit 'refs/pull/1191/head' of github.com:twisted/twisted into 9716-jelly-timedelta-redux

view details

Glyph

commit sha 8cc1bb03b1133a2eac274ee9a181d783c7e16303

python 3 isn't relevant any more, but what "serialization" means is

view details

Glyph

commit sha 7adb46869d9b215e2a01fe7194a715a60579ddbc

Merge pull request #1350 from twisted/9716-jelly-timedelta-redux Author: mathieui, glyph Reviewer: rodrigc Fixes: ticket:9716 Fixed serialization of timedelta, date, and time objects in twisted.spread.

view details

Craig Rodrigues

commit sha 75b34bc5f49f0c225018482e9c97e1f3619e2ad2

Use typing.cast() to cast return value of decorator This follows the example here: https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators This eliminates a mypy errors

view details

Craig Rodrigues

commit sha 4be2e6beb94e87d12d0b59bccaa4338fcb26187e

Add newsfragment

view details

Craig Rodrigues

commit sha 3a862c63b082671d160bff0d67157b411dc6150b

Add newsfragment

view details

Craig Rodrigues

commit sha 9e0adce10729a0162252a808c9068ef1120de9ea

Merge pull request #1346 from twisted/9902-rodrigc-mypy [mypy] [9902] Fix mypy error in decorator.py Author: rodrigc Reviewer: wsanchez Fixes: ticket:9902

view details

Adi Roiban

commit sha e04e4973fe67d80bbaa9daab421ace4490625fe0

Remove mypy from azure pipelines.

view details

Craig Rodrigues

commit sha 8533fef849f5ecb2b64e31ba1472c378bf400788

Run mypy on GitHub actions based on GitHub Actions template for Python.

view details

Craig Rodrigues

commit sha 7319df6ecf662e017aeb76e3ff0f1abb8cae9a1e

Add newsfragment

view details

Craig Rodrigues

commit sha 139fb52a1a5cb0a19f73968f079f8159ba59bf84

Add a status badge for GitHub Actions on mypy

view details

push time in a month

Pull request review commenttwisted/klein

Move IKleinRequest to _interfaces.py and remove _iapp.py.

 works, since mypy doesn't otherwise get along with Zope Interface. """ -from typing import TYPE_CHECKING+from typing import Mapping, Optional, TYPE_CHECKING, Text++from zope.interface import Attribute, Interface -from ._iapp import IKleinRequest from ._imessage import (     IHTTPHeaders as _IHTTPHeaders,     IHTTPMessage as _IHTTPMessage,     IHTTPRequest as _IHTTPRequest,     IHTTPResponse as _IHTTPResponse,     IMutableHTTPHeaders as _IMutableHTTPHeaders, )--IKleinRequest  # Silence linter+from ._typing import ifmethod+++class IKleinRequest(Interface):+    branch_segments = Attribute("Segments consumed by a branch route.")+    mapper = Attribute("L{werkzeug.routing.MapAdapter}")++    @ifmethod+    def url_for(+        request,  # type: IKleinRequest

If Klein's master branch is dropping support for Python 3.5, it might be worth using variable annotations here. But that can be done in a separate PR.

wsanchez

comment created time in a month

PR merged twisted/twisted

Reviewers
[mypy] [9902] Fix mypy error in decorator.py

https://twistedmatrix.com/trac/ticket/9902

This fixes this mypy error:

src/twisted/python/deprecate.py:856:16: error: Incompatible return value type (got "Callable[..., Any]", expected "_Tc")  [return-value]

and follows the example at: https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators

+2 -1

1 comment

2 changed files

rodrigc

pr closed time in a month

delete branch twisted/twisted

delete branch : 9902-rodrigc-mypy

delete time in a month

push eventtwisted/twisted

Craig Rodrigues

commit sha 75b34bc5f49f0c225018482e9c97e1f3619e2ad2

Use typing.cast() to cast return value of decorator This follows the example here: https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators This eliminates a mypy errors

view details

Craig Rodrigues

commit sha 4be2e6beb94e87d12d0b59bccaa4338fcb26187e

Add newsfragment

view details

Craig Rodrigues

commit sha 3a862c63b082671d160bff0d67157b411dc6150b

Add newsfragment

view details

Craig Rodrigues

commit sha 9e0adce10729a0162252a808c9068ef1120de9ea

Merge pull request #1346 from twisted/9902-rodrigc-mypy [mypy] [9902] Fix mypy error in decorator.py Author: rodrigc Reviewer: wsanchez Fixes: ticket:9902

view details

push time in a month

push eventtwisted/twisted

Craig Rodrigues

commit sha 3a862c63b082671d160bff0d67157b411dc6150b

Add newsfragment

view details

push time in a month

pull request commentcoveralls-clients/coveralls-python

Fix unhashable exception

I also saw this error at https://travis-ci.com/github/twisted/twisted/jobs/361796000


coveralls-push run-test: commands[1] | coveralls
Submitting coverage to coveralls.io...
Could not submit coverage: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs
Traceback (most recent call last):
  File "/home/travis/build/twisted/twisted/build/coveralls-push/lib/python3.6/site-packages/coveralls/api.py", line 205, in wear
    response.raise_for_status()
  File "/home/travis/build/twisted/twisted/build/coveralls-push/lib/python3.6/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/travis/build/twisted/twisted/build/coveralls-push/lib/python3.6/site-packages/coveralls/cli.py", line 85, in main
    result = coverallz.wear()
  File "/home/travis/build/twisted/twisted/build/coveralls-push/lib/python3.6/site-packages/coveralls/api.py", line 208, in wear
    raise CoverallsException('Could not submit coverage: {}'.format(e))
coveralls.exception.CoverallsException: Could not submit coverage: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs
ERROR: InvocationError for command /home/travis/build/twisted/twisted/build/coveralls-push/bin/coveralls (exited with code 1)
rodrigc

comment created time in a month

pull request commentcoveralls-clients/coveralls-python

Fix unhashable exception

@TheKevJames Thanks for merging the fix. I can confirm that it works. In the Twisted project, I am occasionally seeing errors, such as the one at this link: https://travis-ci.com/github/twisted/twisted/jobs/361796000

that look like:

Submitting coverage to coveralls.io...
Could not submit coverage: 504 Server Error: Gateway Time-out for url: https://coveralls.io/api/v1/jobs
Traceback (most recent call last):
  File "/home/travis/build/twisted/twisted/build/coveralls-push/lib/python3.6/site-packages/coveralls/api.py", line 205, in wear
    response.raise_for_status()
  File "/home/travis/build/twisted/twisted/build/coveralls-push/lib/python3.6/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: https://coveralls.io/api/v1/jobs

Is there a problem on the coveralls server?

rodrigc

comment created time in a month

pull request commenttwisted/twisted

imapserver: fix copy operation

This fix looks correct, but in order for something to be merged into Twisted, it needs a ticket in Trac at twistedmatrix.com, as specified in the contributor checklist:

Contributor Checklist:

  • [] The associated ticket in Trac is here: https://twistedmatrix.com/trac/ticket/<nnn>
  • [] The changes pass minimal style checks (see: https://twistedmatrix.com/trac/wiki/TwistedDevelopment#GettingYourPatchAccepted )
  • [] I have created a newsfragment in src/twisted/newsfragments/ (see: https://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles )
  • [ ] I have updated the automated tests.
  • [] I have submitted the associated Trac ticket for review by adding the word review to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.
devkral

comment created time in a month

pull request commenttwisted/twisted

[mypy] [9902] Fix mypy error in decorator.py

I'd suggest moving the cast up two lines to the assignment. It doesn't matter in this case, but I find it's a good practice to get the type correct ASAP, which enables mypy to check, eg. whether the first argument to _appendToDosctring() is the right type.

Done.

rodrigc

comment created time in a month

push eventtwisted/twisted

mathieui

commit sha ad76e2808df5970e063cc1b13c3cfef474cc4d1a

Fix serialization of date, time, and timedelta objects in python 3 Unicode strings cannot be sent as is in Banana, and need to be byte-encoded. In python 3, this would fail for the date, time and timedelta objects as the jellyfication would use a unicode string and not a byte string.

view details

Glyph

commit sha a77fab11e44c0c03ef0404083c6004ccc8418676

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Glyph

commit sha 5f7858b52cce3bf8bfe0cd310a635bfb4b3a031a

objgrep apparently already worked, so let's just enable the tests

view details

Glyph

commit sha 3cadd9a34c608502a401abdf20c2397165c9fd3c

add newline to appease linter

view details

Glyph

commit sha e5cca18f97a882bdbed11d7911b6dccbb588256f

Merge pull request #1347 from twisted/6986-already-done Author: glyph Reviewer: rodrigc Fixes: ticket:6896 objgrep apparently already worked, so let's just enable the tests

view details

Glyph

commit sha c95582c872653ee9c66028a37d9f62b45d0193b4

Merge branch 'trunk' into 9716-fix-jelly-timedelta

view details

Glyph

commit sha 06fe0412be47c27df5cf50e3a22dd39778bc96df

test case for bananability of jellied time types

view details

Glyph

commit sha 4ebd1e1aba557f31b988d1858b923a6125bc7125

Merge commit 'refs/pull/1191/head' of github.com:twisted/twisted into 9716-jelly-timedelta-redux

view details

Glyph

commit sha 8cc1bb03b1133a2eac274ee9a181d783c7e16303

python 3 isn't relevant any more, but what "serialization" means is

view details

Glyph

commit sha 7adb46869d9b215e2a01fe7194a715a60579ddbc

Merge pull request #1350 from twisted/9716-jelly-timedelta-redux Author: mathieui, glyph Reviewer: rodrigc Fixes: ticket:9716 Fixed serialization of timedelta, date, and time objects in twisted.spread.

view details

Craig Rodrigues

commit sha 75b34bc5f49f0c225018482e9c97e1f3619e2ad2

Use typing.cast() to cast return value of decorator This follows the example here: https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators This eliminates a mypy errors

view details

Craig Rodrigues

commit sha 4be2e6beb94e87d12d0b59bccaa4338fcb26187e

Add newsfragment

view details

push time in a month

pull request commenttwisted/twisted

Run mypy on GitHub actions.

@adiroiban can you look at https://github.com/twisted/twisted/pull/1346 ? With that one-liner, all the mypy errors are gone

adiroiban

comment created time in a month

delete branch twisted/twisted

delete branch : 9903-rodrigc-mypy-ci

delete time in a month

PR closed twisted/twisted

Reviewers
[mypy] If mypy CI fails, then report that error

https://twistedmatrix.com/trac/ticket/9903

This can be merged after https://github.com/twisted/twisted/pull/1346 is merged

+0 -1

2 comments

2 changed files

rodrigc

pr closed time in a month

pull request commenttwisted/twisted

[mypy] If mypy CI fails, then report that error

Closing in favor of https://github.com/twisted/twisted/pull/1349

rodrigc

comment created time in a month

delete branch twisted/twisted

delete branch : 9903-github-actions-mypy-2

delete time in a month

push eventtwisted/twisted

Craig Rodrigues

commit sha 1ed5bee1d68e73f3a37c6a5a6f00de363d254b31

Update based on GitHub Actions template for Python

view details

Craig Rodrigues

commit sha 3768e45a7c74c8140bd3a2697df80434e65f47dd

Merge pull request #1351 from twisted/9903-github-actions-mypy-2 Run mypy on GitHub actions. - part 2

view details

push time in a month

more