##// END OF EJS Templates
convert: stop using the `pycompat.open()` shim
Matt Harbison -
r53272:bb07b1ca default
parent child Browse files
Show More
@@ -22,7 +22,6 from typing import (
22 )
22 )
23
23
24 from mercurial.i18n import _
24 from mercurial.i18n import _
25 from mercurial.pycompat import open
26 from mercurial import (
25 from mercurial import (
27 encoding,
26 encoding,
28 error,
27 error,
@@ -91,7 +90,7 def shlexer(
91 whitespace: Optional[bytes] = None,
90 whitespace: Optional[bytes] = None,
92 ):
91 ):
93 if data is None:
92 if data is None:
94 data = open(filepath, b'r', encoding='latin1')
93 data = open(filepath, 'r', encoding='latin1')
95 else:
94 else:
96 if filepath is not None:
95 if filepath is not None:
97 raise error.ProgrammingError(
96 raise error.ProgrammingError(
@@ -574,7 +573,7 class mapfile(dict):
574 if not self.path:
573 if not self.path:
575 return
574 return
576 try:
575 try:
577 fp = open(self.path, b'rb')
576 fp = open(self.path, 'rb')
578 except FileNotFoundError:
577 except FileNotFoundError:
579 return
578 return
580
579
@@ -600,7 +599,7 class mapfile(dict):
600 def __setitem__(self, key, value) -> None:
599 def __setitem__(self, key, value) -> None:
601 if self.fp is None:
600 if self.fp is None:
602 try:
601 try:
603 self.fp = open(self.path, b'ab')
602 self.fp = open(self.path, 'ab')
604 except IOError as err:
603 except IOError as err:
605 raise error.Abort(
604 raise error.Abort(
606 _(b'could not open map file %r: %s')
605 _(b'could not open map file %r: %s')
General Comments 0
You need to be logged in to leave comments. Login now