Skip to content

Refactor _from_server_socket()#819

Draft
julianz- wants to merge 1 commit intocherrypy:mainfrom
julianz-:refactor-from-server-socket
Draft

Refactor _from_server_socket()#819
julianz- wants to merge 1 commit intocherrypy:mainfrom
julianz-:refactor-from-server-socket

Conversation

@julianz-
Copy link
Copy Markdown
Member

@julianz- julianz- commented Apr 7, 2026

This function in connections.py had become highly nested and complex, triggering linter warnings (C901, WPS505). Decomposed the logic into several smaller private methods:

  • _wrap_tls_socket()
  • _create_conn()
  • _handle_socket_error()
  • _setup_conn_addr()

What kind of change does this PR introduce?

  • 🐞 bug fix
  • 🐣 feature
  • 📋 docs update
  • 📋 tests/coverage improvement
  • 📋 refactoring
  • 💥 other

📋 What is the related issue number (starting with #)

Resolves #

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

📋 Other information:

📋 Contribution checklist:

(If you're a first-timer, check out
this guide on making great pull requests)

  • I wrote descriptive pull request text above
  • I think the code is well written
  • I wrote good commit messages
  • I have squashed related commits together after
    the changes have been approved
  • Unit tests for the changes exist
  • Integration tests for the changes exist (if applicable)
  • I used the same coding conventions as the rest of the project
  • The new code doesn't generate linter offenses
  • Documentation reflects the changes
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 64.44444% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.20%. Comparing base (2ffb0ba) to head (4d67561).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #819      +/-   ##
==========================================
- Coverage   78.32%   78.20%   -0.12%     
==========================================
  Files          41       41              
  Lines        4788     4803      +15     
  Branches      547      549       +2     
==========================================
+ Hits         3750     3756       +6     
- Misses        900      907       +7     
- Partials      138      140       +2     

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community bot commented Apr 7, 2026

Documentation build overview

📚 cheroot | 🛠️ Build #32145455 | 📁 Comparing 4d67561 against latest (2ffb0ba)

  🔍 Preview build  

Show files changed (6 files in total): 📝 6 modified | ➕ 0 added | ➖ 0 deleted
File Status
genindex/index.html 📝 modified
history/index.html 📝 modified
pkg/cheroot/index.html 📝 modified
pkg/cheroot.connections/index.html 📝 modified
pkg/cheroot.server/index.html 📝 modified
pkg/cheroot.ssl.pyopenssl/index.html 📝 modified

@julianz- julianz- force-pushed the refactor-from-server-socket branch from ed64521 to 21e36e0 Compare April 7, 2026 07:22
@julianz- julianz- force-pushed the refactor-from-server-socket branch 2 times, most recently from 7f77695 to 53c228c Compare April 7, 2026 07:38
This function had become highly nested and complex, triggering
linter warnings (C901, WPS505). Decomposed the logic into
several smaller private methods:

- ``_wrap_tls_socket()``
- ``_create_conn()``
- ``_handle_socket_error()``
- ``_setup_conn_addr()``
@julianz- julianz- force-pushed the refactor-from-server-socket branch from 53c228c to 4d67561 Compare April 7, 2026 07:49
@julianz- julianz- marked this pull request as draft April 7, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant