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

Refactor/cleanup upgrade#980

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
bufferoverflow merged 5 commits intomasterfromrefactor/cleanup-upgrade
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes fromall 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
28 changes: 5 additions & 23 deletions.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,49 +21,31 @@ jobs:
- stage: lint
name: black_lint
dist: bionic
python: 3.7
python: 3.8
script:
- pip3 install -U --pre black
- black --check .
- stage: test
name: cli_func_v4
dist: bionic
python: 3.7
python: 3.8
script:
- pip3 install tox
- tox -e cli_func_v4
- stage: test
name: py_func_v4
dist: bionic
python: 3.7
python: 3.8
script:
- pip3 install tox
- tox -e py_func_v4
- stage: test
name: docs
dist: bionic
python: 3.7
python: 3.8
script:
- pip3 install tox
- tox -e docs
- stage: test
name: py27
python: 2.7
script:
- pip2 install tox
- tox -e py27
- stage: test
name: py34
python: 3.4
script:
- pip3 install tox
- tox -e py34
- stage: test
name: py35
python: 3.5
script:
- pip3 install tox
- tox -e py35
- stage: test
name: py36
python: 3.6
Expand All@@ -81,7 +63,7 @@ jobs:
- stage: test
dist: bionic
name: py38
python: 3.8-dev
python: 3.8
script:
- pip3 install tox
- tox -e py38
4 changes: 2 additions & 2 deletionsDockerfile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
FROM python:3.7-alpine AS build
FROM python:3.8-alpine AS build

WORKDIR /opt/python-gitlab
COPY . .
RUN python setup.py bdist_wheel

FROM python:3.7-alpine
FROM python:3.8-alpine

WORKDIR /opt/python-gitlab
COPY --from=build /opt/python-gitlab/dist dist/
Expand Down
1 change: 0 additions & 1 deletionREADME.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ Requirements
python-gitlab depends on:

* `python-requests <http://docs.python-requests.org/en/latest/>`_
* `six <https://six.readthedocs.io/>`_

Install with pip
----------------
Expand Down
2 changes: 1 addition & 1 deletiondocs/cli.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -162,7 +162,7 @@ These options must be defined before the mandatory arguments.
**Notice:**

The `PyYAML package <https://pypi.org/project/PyYAML/>`_ is required to use the yaml output option.
You need to install itseparately using ``pip installPyYAML``
You need to install itexplicitly using ``pip installpython-gitlab[yaml]``

``--fields``, ``-f``
Comma-separated list of fields to display (``yaml`` and ``json`` output
Expand Down
3 changes: 1 addition & 2 deletionsdocs/ext/docstrings.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,6 @@
import os

import jinja2
import six
import sphinx
import sphinx.ext.napoleon as napoleon
from sphinx.ext.napoleon.docstring import GoogleDocstring
Expand All@@ -25,7 +24,7 @@ def setup(app):

conf = napoleon.Config._config_values

for name, (default, rebuild) insix.iteritems(conf):
for name, (default, rebuild) inconf.items():
app.add_config_value(name, default, rebuild)
return {"version": sphinx.__display_version__, "parallel_read_safe": True}

Expand Down
7 changes: 3 additions & 4 deletionsgitlab/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,15 +23,14 @@
import warnings

import requests
import six

import gitlab.config
from gitlab.const import * # noqa
from gitlab.exceptions import * # noqa
from gitlab import utils # noqa

__title__ = "python-gitlab"
__version__ = "1.15.0"
__version__ = "2.0.0"
__author__ = "Gauvain Pocentek"
__email__ = "gauvainpocentek@gmail.com"
__license__ = "LGPL3"
Expand All@@ -47,8 +46,8 @@

def _sanitize(value):
if isinstance(value, dict):
return dict((k, _sanitize(v)) for k, v insix.iteritems(value))
if isinstance(value,six.string_types):
return dict((k, _sanitize(v)) for k, v invalue.items())
if isinstance(value,str):
return value.replace("/", "%2F")
return value

Expand Down
3 changes: 1 addition & 2 deletionsgitlab/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,8 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os

from six.moves import configparser
import configparser

_DEFAULT_FILES = ["/etc/python-gitlab.cfg", os.path.expanduser("~/.python-gitlab.cfg")]

Expand Down
7 changes: 3 additions & 4 deletionsgitlab/tests/test_cli.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,7 @@
import os
import tempfile
import unittest
import io

try:
from contextlib import redirect_stderr # noqa: H302
Expand All@@ -34,8 +35,6 @@ def redirect_stderr(new_target):
sys.stderr = old_target


import six

from gitlab import cli
import gitlab.v4.cli

Expand All@@ -56,7 +55,7 @@ class TestClass(object):
self.assertEqual("class", cli.cls_to_what(Class))

def test_die(self):
fl =six.StringIO()
fl =io.StringIO()
with redirect_stderr(fl):
with self.assertRaises(SystemExit) as test:
cli.die("foobar")
Expand All@@ -83,7 +82,7 @@ def test_parse_value(self):
self.assertEqual(ret, "content")
os.unlink(temp_path)

fl =six.StringIO()
fl =io.StringIO()
with redirect_stderr(fl):
with self.assertRaises(SystemExit) as exc:
cli._parse_value("@/thisfileprobablydoesntexist")
Expand Down
22 changes: 11 additions & 11 deletionsgitlab/tests/test_config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
import unittest

import mock
importsix
importio

from gitlab import config

Expand DownExpand Up@@ -80,26 +80,26 @@ def test_missing_config(self, path_exists):
config.GitlabConfigParser("test")

@mock.patch("os.path.exists")
@mock.patch("six.moves.builtins.open")
@mock.patch("builtins.open")
def test_invalid_id(self, m_open, path_exists):
fd =six.StringIO(no_default_config)
fd =io.StringIO(no_default_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
path_exists.return_value = True
config.GitlabConfigParser("there")
self.assertRaises(config.GitlabIDError, config.GitlabConfigParser)

fd =six.StringIO(valid_config)
fd =io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
self.assertRaises(
config.GitlabDataError, config.GitlabConfigParser, gitlab_id="not_there"
)

@mock.patch("os.path.exists")
@mock.patch("six.moves.builtins.open")
@mock.patch("builtins.open")
def test_invalid_data(self, m_open, path_exists):
fd =six.StringIO(missing_attr_config)
fd =io.StringIO(missing_attr_config)
fd.close = mock.Mock(return_value=None, side_effect=lambda: fd.seek(0))
m_open.return_value = fd
path_exists.return_value = True
Expand All@@ -117,9 +117,9 @@ def test_invalid_data(self, m_open, path_exists):
self.assertEqual("Unsupported per_page number: 200", emgr.exception.args[0])

@mock.patch("os.path.exists")
@mock.patch("six.moves.builtins.open")
@mock.patch("builtins.open")
def test_valid_data(self, m_open, path_exists):
fd =six.StringIO(valid_config)
fd =io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
path_exists.return_value = True
Expand All@@ -133,7 +133,7 @@ def test_valid_data(self, m_open, path_exists):
self.assertEqual(True, cp.ssl_verify)
self.assertIsNone(cp.per_page)

fd =six.StringIO(valid_config)
fd =io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
cp = config.GitlabConfigParser(gitlab_id="two")
Expand All@@ -144,7 +144,7 @@ def test_valid_data(self, m_open, path_exists):
self.assertEqual(10, cp.timeout)
self.assertEqual(False, cp.ssl_verify)

fd =six.StringIO(valid_config)
fd =io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
cp = config.GitlabConfigParser(gitlab_id="three")
Expand All@@ -156,7 +156,7 @@ def test_valid_data(self, m_open, path_exists):
self.assertEqual("/path/to/CA/bundle.crt", cp.ssl_verify)
self.assertEqual(50, cp.per_page)

fd =six.StringIO(valid_config)
fd =io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
cp = config.GitlabConfigParser(gitlab_id="four")
Expand Down
4 changes: 2 additions & 2 deletionsgitlab/utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

importsix
from urllib.parseimporturlparse


class _StdoutStream(object):
Expand DownExpand Up@@ -52,6 +52,6 @@ def clean_str_id(id):


def sanitized_url(url):
parsed =six.moves.urllib.parse.urlparse(url)
parsed = urlparse(url)
new_path = parsed.path.replace(".", "%2E")
return parsed._replace(path=new_path).geturl()
6 changes: 2 additions & 4 deletionsgitlab/v4/cli.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,8 +21,6 @@
import operator
import sys

import six

import gitlab
import gitlab.base
from gitlab import cli
Expand DownExpand Up@@ -321,7 +319,7 @@ def extend_parser(parser):


def get_dict(obj, fields):
if isinstance(obj,six.string_types):
if isinstance(obj,str):
return obj

if fields:
Expand DownExpand Up@@ -441,7 +439,7 @@ def run(gl, what, action, args, verbose, output, fields):
printer.display_list(data, fields, verbose=verbose)
elif isinstance(data, gitlab.base.RESTObject):
printer.display(get_dict(data, fields), verbose=verbose, obj=data)
elif isinstance(data,six.string_types):
elif isinstance(data,str):
print(data)
elif hasattr(data, "decode"):
print(data.decode())
3 changes: 1 addition & 2 deletionsrequirements.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
requests>=2.4.2
six
requests>=2.22.0
11 changes: 5 additions & 6 deletionssetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ def get_version():
license="LGPLv3",
url="https://github.com/python-gitlab/python-gitlab",
packages=find_packages(),
install_requires=["requests>=2.4.2", "six"],
install_requires=["requests>=2.22.0"],
entry_points={"console_scripts": ["gitlab = gitlab.cli:main"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand All@@ -36,14 +36,13 @@ def get_version():
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
extras_require={"autocompletion": ["argcomplete>=1.10.0,<2"]},
extras_require={
"autocompletion": ["argcomplete>=1.10.0,<2"],
"yaml": ["PyYaml>=5.2"],
},
)
2 changes: 1 addition & 1 deletiontools/generate_token.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

fromsix.moves.urllib.parse import urljoin
from urllib.parse import urljoin
from requests_html import HTMLSession

ENDPOINT = "http://localhost:8080"
Expand Down
2 changes: 1 addition & 1 deletiontox.ini
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py38,py37,py36,py35,py34,py27,pep8,black
envlist = py38,py37,py36,pep8,black

[testenv]
setenv = VIRTUAL_ENV={envdir}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp