[Twisted-Python] Weekly Bug Summary

2020-06-27 Thread trac



Bug summary
__
Summary for 2020-06-21 through 2020-06-28
  Opened Closed  Total Change
Enhancements:  4 11   1441 -7
Defects:   3  3982 +0
Tasks: 0  0 97 +0
Regressions:   0  0  5 +0
Total: 7 14   2526 -7

|== Type Changes   |== Priority Changes   |== Component Changes   
|Defect:   +0  |Normal:  -7   |Core:   -6 
|Enhancement:  -7 |Trial:  -1 



Total Tickets
Open Tickets



New / Reopened Bugs
__
= Normal =
[#9868] Fix docstring syntax errors (opened by mthuurne) (CLOSED, fixed)
defect  core   http://twistedmatrix.com/trac/ticket/9868

[#9869] Reduce mypy errors (Part 16) (opened by rodrigc) (CLOSED, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9869

[#9870] Reduce mypy errors (Part 17) (opened by rodrigc) (CLOSED, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9870

[#9871] Reduce mypy errors (Part 18) (opened by rodrigc)
enhancement core   http://twistedmatrix.com/trac/ticket/9871

[#9872] Add instructions for running in mypy in top-level README (opened by rodrigc) (CLOSED, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9872

[#9873] Fix docstring cross-references (opened by mthuurne) (CLOSED, fixed)
defect  core   http://twistedmatrix.com/trac/ticket/9873

[#9874] Add missing names in @type docstring fields (opened by mthuurne) (CLOSED, fixed)
defect  core   http://twistedmatrix.com/trac/ticket/9874



Closed Bugs
__
= Normal =
[#9864] Reduce mypy errors (Part 12) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9864

[#9863] Reduce mypy errors (Part 11) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9863

[#9868] Fix docstring syntax errors (opened by mthuurne, closed by mthuurne, fixed)
defect  core   http://twistedmatrix.com/trac/ticket/9868

[#9853] Reduce mypy errors (Part 4):  Remove unused methods from IReporter (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement trial  http://twistedmatrix.com/trac/ticket/9853

[#9869] Reduce mypy errors (Part 16) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9869

[#9866] Reduce mypy errors (Part 14) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9866

[#9851] Reduce mypy errors (Part 2) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9851

[#9867] Reduce mypy errors (Part 15) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9867

[#9870] Reduce mypy errors (Part 17) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9870

[#9862] Reduce mypy errors (Part 10) (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9862

[#9872] Add instructions for running in mypy in top-level README (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9872

[#9865] Reduce mypy errors (Part 13) (opened by rodrigc, closed by rodrigc, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9865

[#9873] Fix docstring cross-references (opened by mthuurne, closed by Maarten ter Huurne , fixed)
defect  core   http://twistedmatrix.com/trac/ticket/9873

[#9874] Add missing names in @type docstring fields (opened by mthuurne, closed by Maarten ter Huurne , fixed)
defect  core   http://twistedmatrix.com/trac/ticket/9874



Ticket Lifetime Stats
__
Oldest open ticket - [#50] conch command-line client doesn't work in win32 (since 2003-07-12 14:41:06).
Newest open ticket - [#9871] Reduce mypy errors (Part 18) (since 2020-06-22 00:33:39.868976).

Mean open ticket age: 2859 days, 11:11:27.642226.
Median: 2811 days, 16:38:46.930823.
Standard deviation: 1427 days, 14:34:28.272346.
Interquartile range: 2062 days, 10:49:47.008683.

Mean time between ticket creation and ticket resolution: 622 days, 8:52:20.462847.
Median: 62 days, 16:13:21.
Standard deviation is 1024 days, 10:45:50.285050.
The interquartile range is 824 days, 4:46:37.

Mean time spent in review: 102 days, 7:05:10.086097.
Median: 4 days, 18:00:37.761543

Re: [Twisted-Python] composition VS. inheritance

2020-06-27 Thread Colin Dunklau
On Sat, Jun 27, 2020 at 8:48 AM Ian Haywood  wrote:

> In smb I have a SMBPacketReceiver that inherits from t.i.p.Protocol, it
> breaks the incoming TCP stream into logical packets (the analogue of
> LineReceiver in line-based protocols).
>
> I then subclass SMBPacketReceiver to SMBProtocol which does a lot of the
> "heavy lifting" analyzing incoming packets.
>
> I've been told in code review to use composition instead of inheritance,
> which is fine in a general sense but I have difficulty applying to
> twisted-specific tasks.
>
> 1. how to do Factory.buildProtocol? It has to return a t.i.p.Protocol,
> but with composition the Protocol object is a private variable of
> SMBPacketReceiver, in turn a private variable of SMBProtocol.
>
> 2. what to do instead of overriding Protocol.dataReceived and access
> incoming data if not allowed to subclass it?
>
> Now  its not that I cant think of workarounds to these two problems, but
> they're ugly
>
> Is there some recent twisted code using composition that I can look at?


Hi Ian,

Unfortunately we're stuck with inheritance in Twisted. Its developers made
the decision (nearly two decades ago?) to use inheritance (hindsight is
20/20 and all that) and that's permeated through the majority of the
codebase. It's quite difficult to even *imagine* a Twisted without it, let
alone make the necessary (huge and almost certainly breaking) changes to
shift to a composition-oriented design. The good news is that while you're
stuck with inheritance for interacting with the Twisted parts, you're free
to do whatever you want outside of that.

I suggest jumping out of the inheritance world as soon as possible; instead
of having a SMBProtocol inherit from SMBPacketReceiver, make the initial
Protocol subclass as general as possible -- maybe make it just deal with
framing. Then you wired the protocol up with some object(s) that the
protocol interacts with (and interacts with the protocol), and you have
your inheritance escape hatch.

I've been playing with this idea on infobob's functional tests, and will
probably use it in the long-due refactor of infobob's code itself:

- ComposedIRCController
https://github.com/pound-python/infobob/blob/7d6cc51bd6aeba735c6fb081cf042d1157fbc6ca/functional-tests/clients.py#L48
- _ComposedIRCClient subclass
https://github.com/pound-python/infobob/blob/7d6cc51bd6aeba735c6fb081cf042d1157fbc6ca/functional-tests/clients.py#L425

- _IRCClientState
https://github.com/pound-python/infobob/blob/7d6cc51bd6aeba735c6fb081cf042d1157fbc6ca/functional-tests/clients.py#L376

The protocol _ComposedIRCClient (an IRCClient subclass) deals with the
irritating bits of IRC and tells its attached _IRCClientState instance
about incoming protocol events (messages, joins, parts, etc). The protocol
is itself wrapped by ComposedIRCController which is the main interface for
other code to initiate actions which ultimately end up in a method call on
the protocol.

I hope that helps trigger some ideas in your head :)

Colin
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python