Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-93096: Removepython -m base64 -t#94230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
corona10 merged 8 commits intopython:mainfromarhadthedev:remove-base64-cli
Jul 2, 2022
Merged
Show file tree
Hide file tree
Changes from5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletionsLib/base64.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -570,8 +570,7 @@ def main():
usage = """usage: %s [-h|-d|-e|-u|-t] [file|-]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nit: Can we updateusage to use f-string?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Done. Should I go further and convert it to argparse?

-h: print this help message and exit
-d, -u: decode
-e: encode (default)
-t: encode and decode string 'Aladdin:open sesame'"""%sys.argv[0]
-e: encode (default)"""%sys.argv[0]
try:
opts, args = getopt.getopt(sys.argv[1:], 'hdeut')
except getopt.error as msg:
Expand All@@ -584,7 +583,6 @@ def main():
if o == '-e': func = encode
if o == '-d': func = decode
if o == '-u': func = decode
if o == '-t': test(); return
if o == '-h': print(usage); return
if args and args[0] != '-':
with open(args[0], 'rb') as f:
Expand All@@ -593,15 +591,5 @@ def main():
func(sys.stdin.buffer, sys.stdout.buffer)


def test():
s0 = b"Aladdin:open sesame"
print(repr(s0))
s1 = encodebytes(s0)
print(repr(s1))
s2 = decodebytes(s1)
print(repr(s2))
assert s0 == s2


if __name__ == '__main__':
main()
8 changes: 0 additions & 8 deletionsLib/test/test_base64.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -762,14 +762,6 @@ def tearDown(self):
def get_output(self, *args):
return script_helper.assert_python_ok('-m', 'base64', *args).out

def test_encode_decode(self):
output = self.get_output('-t')
self.assertSequenceEqual(output.splitlines(), (
b"b'Aladdin:open sesame'",
br"b'QWxhZGRpbjpvcGVuIHNlc2FtZQ==\n'",
b"b'Aladdin:open sesame'",
))

def test_encode_file(self):
with open(os_helper.TESTFN, 'wb') as fp:
fp.write(b'a\xffb\n')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
Removed undocumented ``-t`` argument of ``python -m base64``. Use
``python -m unittest test.test_base64.LegacyBase64TestCase.test_encodebytes``
instead.

[8]ページ先頭

©2009-2025 Movatter.jp