[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ftp-team/dak][master] 2 commits: [py3] srcformats.py: use Python 3's metaclass syntax



Title: GitLab

Ansgar pushed to branch master at Debian FTP Team / dak

Commits:

4 changed files:

Changes:

  • dak/new_security_install.py
    ... ... @@ -33,7 +33,6 @@ import time
    33 33
     import apt_pkg
    
    34 34
     import errno
    
    35 35
     import fcntl
    
    36
    -import six
    
    37 36
     import subprocess
    
    38 37
     
    
    39 38
     from daklib import daklog
    
    ... ... @@ -194,7 +193,7 @@ def main():
    194 193
         if Options["No-Action"]:
    
    195 194
             sys.exit(0)
    
    196 195
         else:
    
    197
    -        six.moves.input("Press Enter to continue")
    
    196
    +        input("Press Enter to continue")
    
    198 197
     
    
    199 198
         for acceptfilename in acceptfiles:
    
    200 199
             with open(acceptfilename, "w") as accept_file:
    

  • daklib/import_repository.py
    ... ... @@ -26,9 +26,9 @@ import apt_pkg
    26 26
     import os
    
    27 27
     import shutil
    
    28 28
     import tempfile
    
    29
    -import six.moves.urllib.request
    
    30
    -import six.moves.urllib.error
    
    31
    -import six.moves.urllib.parse
    
    29
    +import urllib.request
    
    30
    +import urllib.error
    
    31
    +import urllib.parse
    
    32 32
     
    
    33 33
     from daklib.dbconn import DBSource, PoolFile
    
    34 34
     from sqlalchemy.orm import object_session
    
    ... ... @@ -93,7 +93,7 @@ def obtain_file(base, path):
    93 93
         fn = '{0}/{1}'.format(base, path)
    
    94 94
         tmp = File()
    
    95 95
         if fn.startswith('http://'):
    
    96
    -        fh = six.moves.urllib.request.urlopen(fn, timeout=300)
    
    96
    +        fh = urllib.request.urlopen(fn, timeout=300)
    
    97 97
             shutil.copyfileobj(fh, tmp._tmp)
    
    98 98
             fh.close()
    
    99 99
         else:
    

  • daklib/srcformats.py
    ... ... @@ -31,7 +31,6 @@
    31 31
     ################################################################################
    
    32 32
     
    
    33 33
     import re
    
    34
    -import six
    
    35 34
     
    
    36 35
     from .dak_exceptions import UnknownFormatError
    
    37 36
     
    
    ... ... @@ -75,7 +74,7 @@ class SourceFormat(type):
    75 74
                     yield "contains source files not allowed in format %s" % cls.name
    
    76 75
     
    
    77 76
     
    
    78
    -class FormatOne(six.with_metaclass(SourceFormat, SourceFormat)):
    
    77
    +class FormatOne(SourceFormat, metaclass=SourceFormat):
    
    79 78
         name = '1.0'
    
    80 79
         format = r'1\.0'
    
    81 80
     
    
    ... ... @@ -96,7 +95,7 @@ class FormatOne(six.with_metaclass(SourceFormat, SourceFormat)):
    96 95
                 yield msg
    
    97 96
     
    
    98 97
     
    
    99
    -class FormatThree(six.with_metaclass(SourceFormat, SourceFormat)):
    
    98
    +class FormatThree(SourceFormat, metaclass=SourceFormat):
    
    100 99
         name = '3.x (native)'
    
    101 100
         format = r'3\.\d+ \(native\)'
    
    102 101
     
    
    ... ... @@ -104,7 +103,7 @@ class FormatThree(six.with_metaclass(SourceFormat, SourceFormat)):
    104 103
         disallowed = ('orig_tar', 'debian_diff', 'debian_tar', 'more_orig_tar')
    
    105 104
     
    
    106 105
     
    
    107
    -class FormatThreeQuilt(six.with_metaclass(SourceFormat, SourceFormat)):
    
    106
    +class FormatThreeQuilt(SourceFormat, metaclass=SourceFormat):
    
    108 107
         name = '3.x (quilt)'
    
    109 108
         format = r'3\.\d+ \(quilt\)'
    
    110 109
     
    

  • daklib/utils.py
    ... ... @@ -71,8 +71,7 @@ def our_raw_input(prompt=""):
    71 71
         # TODO: py3: use `print(..., flush=True)`
    
    72 72
         sys.stdout.flush()
    
    73 73
         try:
    
    74
    -        ret = six.moves.input()
    
    75
    -        return ret
    
    74
    +        return input()
    
    76 75
         except EOFError:
    
    77 76
             print("\nUser interrupt (^D).", file=sys.stderr)
    
    78 77
             raise SystemExit
    


  • Reply to: