comparison mercurial/hgweb/server.py @ 51762:ca7bde5dbafb

black: format the codebase with 23.3.0 The CI has moved to 23.3.0, which is the last version that supports 3.7 at runtime, so we should honor this change. # skip-blame mass-reformating only
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 18 Jul 2024 12:36:12 +0200
parents 7f0cb9ee0534
children f4733654f144
comparison
equal deleted inserted replaced
51761:b0a4de6c14f8 51762:ca7bde5dbafb
64 for msg in seq: 64 for msg in seq:
65 self.handler.log_error("HG error: %s", encoding.strfromlocal(msg)) 65 self.handler.log_error("HG error: %s", encoding.strfromlocal(msg))
66 66
67 67
68 class _httprequesthandler(httpservermod.basehttprequesthandler): 68 class _httprequesthandler(httpservermod.basehttprequesthandler):
69
70 url_scheme = b'http' 69 url_scheme = b'http'
71 70
72 @staticmethod 71 @staticmethod
73 def preparehttpserver(httpserver, ui): 72 def preparehttpserver(httpserver, ui):
74 """Prepare .socket of new HTTPServer instance""" 73 """Prepare .socket of new HTTPServer instance"""
356 return open(opt, b'ab') 355 return open(opt, b'ab')
357 return default 356 return default
358 357
359 358
360 class MercurialHTTPServer(_mixin, httpservermod.httpserver, object): 359 class MercurialHTTPServer(_mixin, httpservermod.httpserver, object):
361
362 # SO_REUSEADDR has broken semantics on windows 360 # SO_REUSEADDR has broken semantics on windows
363 if pycompat.iswindows: 361 if pycompat.iswindows:
364 allow_reuse_address = 0 362 allow_reuse_address = 0
365 363
366 def __init__(self, ui, app, addr, handler, **kwargs): 364 def __init__(self, ui, app, addr, handler, **kwargs):
394 raise error.RepoError(_(b'IPv6 is not available on this system')) 392 raise error.RepoError(_(b'IPv6 is not available on this system'))
395 super(IPv6HTTPServer, self).__init__(*args, **kwargs) 393 super(IPv6HTTPServer, self).__init__(*args, **kwargs)
396 394
397 395
398 def create_server(ui, app): 396 def create_server(ui, app):
399
400 if ui.config(b'web', b'certificate'): 397 if ui.config(b'web', b'certificate'):
401 handler = _httprequesthandlerssl 398 handler = _httprequesthandlerssl
402 else: 399 else:
403 handler = _httprequesthandler 400 handler = _httprequesthandler
404 401