Commit Graph

22 Commits

Author SHA1 Message Date
Radostin Stoyanov
19b3d2ac66 progress: Resolve E714
E714: test for object identity should be ‘is not’

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
6d125cca72 progress: Resolve E265
E265: block comment should start with ‘# ‘

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
3468a2ec1f progress: Resolve E722
E722: do not use bare except, specify exception instead

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
c3453422f2 progress: Resolve E261
E261: at least two spaces before inline comment

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
cd1a46c2ae progress: Resolve E701
E701: multiple statements on one line (colon)

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
9a472f506d progress: Resolve E221
E221: multiple spaces before operator

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
ed98a29dda progress: Resolve E302
E302: expected 2 blank lines

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Radostin Stoyanov
b7c7c27f7c progress: Resolve W0201
W0201: Attribute %r defined outside __init__

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Stefan Weil
633534c8b8 Fix some typos in comments and documentation (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-05 14:27:29 -04:00
Daniel P. Berrangé
b1460ba065 Chagne most URIs to use https:// instead of http://
All URLs were checked to see if they supported https://, those which did
were converted.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-30 13:35:39 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Radostin Stoyanov
8ebab1f27e virtinst: progress: Simplify if-statement
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:24:02 -05:00
Cole Robinson
e47b34c05a Fix initrdinject and urltests with py3
A few random issues scattered about
2018-02-06 18:56:15 -05:00
Radostin Stoyanov
95c695d774 Convert long to int
- Python 2 only
k = 9223372036854775808L

- Python 2 and 3:
k = 9223372036854775808

See http://python-future.org/compatible_idioms.html#long-integers
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
6712261510 Python 2/3 division compatability
In Python 2 the classic devision of integers returns an integer
but in Python 3 it might return float.

Example:
- Python 2:          - Python 3:
    >>> 9 / 4            >>> 9 / 4
    2                    2.25
    >>> 9 // 4           >>> 9 // 4
    2                    2
    >>> 9 / 4.0          >>> 9 / 4.0
    2.25                 2.25
    >>> 9 // 4.0         >>> 9 // 4.0
    2.0                  2.0

For more info see: https://www.python.org/dev/peps/pep-0238/
2018-01-27 15:30:17 -05:00
Radostin Stoyanov
2d276ebed8 progress: Don't overwrite "format"
Do not overwrite built-in format. [1]

https://docs.python.org/2/library/functions.html#format
2017-10-20 11:49:14 -04:00
Radostin Stoyanov
bc3c9a9d7b progress: Remove unused import 2017-10-20 11:49:14 -04:00
Radostin Stoyanov
63fce081ed pycodestyle: Use isinstance() for type checking
This is E721 in pycodestyle [1]:
   "do not compare types, use ‘isinstance()’"

The main differece between "type() is" and "isinstance()" is that
isinstance() supports inheritance. [1]

This can be seen in the example below:
    >>> type(True) is int
    False
    >>> isinstance(True, int)
    True

As we can see in python 'bool' a subclass of 'int'.

[1] https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
[2] https://docs.python.org/2/library/functions.html#isinstance
2017-10-20 11:49:13 -04:00
Radostin Stoyanov
d1e1cf64a7 progress: Remove trailing white space 2017-10-20 11:49:12 -04:00
Cole Robinson
fab55c128f Drop use of python2 long() syntax
Plus one more python3 syntax issue
2017-05-05 14:54:35 -04:00
Cole Robinson
d5d6cfff2c Copy urlgrabber progress bar code into virt-manager.git
This is so we can drop the dep on system python-urlgrabber, which will
block us from going to python3.

All we need is like 300 lines from python-urlgrabber for the progress
bar. In reality our needs are much lower, we don't need the fancy
progress bar that urlgrabber provides, but it's nice to have. So if
keeping a copy of this code causes issues in the future, we can probably
come up with something simpler (or hopefully there's a more common
python progressbar impl that we can use at that point).
2015-09-18 20:55:44 -04:00