id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
23,200 | test_topics.py | python-gitlab_python-gitlab/tests/unit/objects/test_topics.py | """
GitLab API:
https://docs.gitlab.com/ce/api/topics.html
"""
import pytest
import responses
from gitlab.v4.objects import Topic
name = "GitLab"
topic_title = "topic title"
new_name = "gitlab-test"
topic_content = {
"id": 1,
"name": name,
"title": topic_title,
"description": "GitLab is an open sourc... | 3,299 | Python | .py | 111 | 22.954955 | 101 | 0.629114 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,201 | test_merge_request_pipelines.py | python-gitlab_python-gitlab/tests/unit/objects/test_merge_request_pipelines.py | """
GitLab API: https://docs.gitlab.com/ee/api/merge_requests.html#list-mr-pipelines
"""
import pytest
import responses
from gitlab.v4.objects import ProjectMergeRequestPipeline
pipeline_content = {
"id": 1,
"sha": "959e04d7c7a30600c894bd3c0cd0e1ce7f42c11d",
"ref": "main",
"status": "success",
}
@p... | 1,645 | Python | .py | 43 | 31.883721 | 86 | 0.694532 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,202 | test_merge_trains.py | python-gitlab_python-gitlab/tests/unit/objects/test_merge_trains.py | """
GitLab API:
https://docs.gitlab.com/ee/api/merge_trains.html
"""
import pytest
import responses
from gitlab.v4.objects import ProjectMergeTrain
mr_content = {
"id": 110,
"merge_request": {
"id": 1,
"iid": 1,
"project_id": 3,
"title": "Test merge train",
"descriptio... | 2,012 | Python | .py | 59 | 27.423729 | 106 | 0.608428 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,203 | test_members.py | python-gitlab_python-gitlab/tests/unit/objects/test_members.py | """
GitLab API: https://docs.gitlab.com/ee/api/members.html
"""
import pytest
import responses
from gitlab.const import AccessLevel
from gitlab.v4.objects import GroupBillableMember
billable_members_content = [
{
"id": 1,
"username": "raymond_smith",
"name": "Raymond Smith",
"stat... | 2,236 | Python | .py | 61 | 29.704918 | 106 | 0.660185 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,204 | test_group_access_tokens.py | python-gitlab_python-gitlab/tests/unit/objects/test_group_access_tokens.py | """
GitLab API: https://docs.gitlab.com/ee/api/group_access_tokens.html
"""
import pytest
import responses
from gitlab.v4.objects import GroupAccessToken
@pytest.fixture
def resp_list_group_access_token(token_content):
with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps:
rsps.add(
... | 3,914 | Python | .py | 106 | 29.066038 | 77 | 0.640951 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,205 | test_deployments.py | python-gitlab_python-gitlab/tests/unit/objects/test_deployments.py | """
GitLab API: https://docs.gitlab.com/ce/api/deployments.html
"""
import pytest
import responses
@pytest.fixture
def resp_deployment_get():
with responses.RequestsMock() as rsps:
rsps.add(
method=responses.GET,
url="http://localhost/api/v4/projects/1/deployments/42",
... | 5,438 | Python | .py | 159 | 25.389937 | 123 | 0.561727 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,206 | test_ci_lint.py | python-gitlab_python-gitlab/tests/unit/objects/test_ci_lint.py | import pytest
import responses
from gitlab import exceptions
ci_lint_create_content = {"status": "valid", "errors": [], "warnings": []}
ci_lint_create_invalid_content = {
"status": "invalid",
"errors": ["invalid format"],
"warnings": [],
}
project_ci_lint_content = {
"valid": True,
"merged_yaml"... | 2,699 | Python | .py | 77 | 28.207792 | 77 | 0.641154 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,207 | test_repositories.py | python-gitlab_python-gitlab/tests/unit/objects/test_repositories.py | """
GitLab API:
https://docs.gitlab.com/ee/api/repositories.html
https://docs.gitlab.com/ee/api/repository_files.html
"""
from urllib.parse import quote
import pytest
import responses
from requests.structures import CaseInsensitiveDict
from gitlab.v4.objects import ProjectFile
file_path = "app/models/key.rb"
ref = ... | 3,251 | Python | .py | 81 | 32.975309 | 102 | 0.661807 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,208 | test_iterations.py | python-gitlab_python-gitlab/tests/unit/objects/test_iterations.py | """
GitLab API: https://docs.gitlab.com/ee/api/iterations.html
"""
import re
import pytest
import responses
iterations_content = [
{
"id": 53,
"iid": 13,
"group_id": 5,
"title": "Iteration II",
"description": "Ipsum Lorem ipsum",
"state": 2,
"created_at": "... | 1,210 | Python | .py | 38 | 25.342105 | 86 | 0.623388 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,209 | test_deploy_tokens.py | python-gitlab_python-gitlab/tests/unit/objects/test_deploy_tokens.py | """
GitLab API: https://docs.gitlab.com/ce/api/deploy_tokens.html
"""
import pytest
import responses
from gitlab.v4.objects import ProjectDeployToken
create_content = {
"id": 1,
"name": "test_deploy_token",
"username": "custom-user",
"expires_at": "2022-01-01T00:00:00.000Z",
"token": "jMRvtPNxrn3... | 1,300 | Python | .py | 39 | 26.923077 | 69 | 0.638756 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,210 | test_hooks.py | python-gitlab_python-gitlab/tests/unit/objects/test_hooks.py | """
GitLab API: https://docs.gitlab.com/ce/api/system_hooks.html
GitLab API: https://docs.gitlab.com/ce/api/groups.html#hooks
GitLab API: https://docs.gitlab.com/ee/api/projects.html#hooks
"""
import re
import pytest
import responses
import gitlab
from gitlab.v4.objects import GroupHook, Hook, ProjectHook
hooks_con... | 7,083 | Python | .py | 220 | 24.809091 | 87 | 0.613803 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,211 | test_registry_repositories.py | python-gitlab_python-gitlab/tests/unit/objects/test_registry_repositories.py | """
GitLab API: https://docs.gitlab.com/ee/api/container_registry.html
"""
import re
import pytest
import responses
from gitlab.v4.objects import ProjectRegistryRepository, RegistryRepository
repositories_content = [
{
"id": 1,
"name": "",
"path": "group/project",
"project_id": 9... | 2,680 | Python | .py | 74 | 29.081081 | 86 | 0.663833 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,212 | test_bulk_imports.py | python-gitlab_python-gitlab/tests/unit/objects/test_bulk_imports.py | """
GitLab API: https://docs.gitlab.com/ce/api/bulk_imports.html
"""
import pytest
import responses
from gitlab.v4.objects import BulkImport, BulkImportAllEntity, BulkImportEntity
migration_content = {
"id": 1,
"status": "finished",
"source_type": "gitlab",
"created_at": "2021-06-18T09:45:55.358Z",
... | 4,437 | Python | .py | 132 | 26.530303 | 82 | 0.63885 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,213 | test_job_artifacts.py | python-gitlab_python-gitlab/tests/unit/objects/test_job_artifacts.py | """
GitLab API: https://docs.gitlab.com/ee/api/job_artifacts.html
"""
import pytest
import responses
ref_name = "main"
job = "build"
@pytest.fixture
def resp_artifacts_by_ref_name(binary_content):
url = f"http://localhost/api/v4/projects/1/jobs/artifacts/{ref_name}/download?job={job}"
with responses.Reques... | 1,226 | Python | .py | 37 | 26.972973 | 92 | 0.673175 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,214 | test_snippets.py | python-gitlab_python-gitlab/tests/unit/objects/test_snippets.py | """
GitLab API: https://docs.gitlab.com/ce/api/project_snippets.html
https://docs.gitlab.com/ee/api/snippets.html (todo)
"""
import pytest
import responses
title = "Example Snippet Title"
visibility = "private"
new_title = "new-title"
@pytest.fixture
def resp_snippet():
content = {
"title":... | 2,498 | Python | .py | 75 | 25.12 | 77 | 0.616438 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,215 | test_resource_state_events.py | python-gitlab_python-gitlab/tests/unit/objects/test_resource_state_events.py | """
GitLab API: https://docs.gitlab.com/ee/api/resource_state_events.html
"""
import pytest
import responses
from gitlab.v4.objects import (
ProjectIssueResourceStateEvent,
ProjectMergeRequestResourceStateEvent,
)
issue_event_content = {"id": 1, "resource_type": "Issue"}
mr_event_content = {"id": 1, "resourc... | 3,195 | Python | .py | 83 | 31.939759 | 94 | 0.696862 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,216 | test_groups.py | python-gitlab_python-gitlab/tests/unit/objects/test_groups.py | """
GitLab API: https://docs.gitlab.com/ce/api/groups.html
"""
import re
import pytest
import responses
import gitlab
from gitlab.v4.objects import (
GroupDescendantGroup,
GroupLDAPGroupLink,
GroupSAMLGroupLink,
GroupSubgroup,
)
from gitlab.v4.objects.projects import GroupProject, SharedProject
cont... | 14,876 | Python | .py | 411 | 28.481752 | 94 | 0.632805 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,217 | test_meta_mixins.py | python-gitlab_python-gitlab/tests/unit/mixins/test_meta_mixins.py | from gitlab.mixins import (
CreateMixin,
CRUDMixin,
DeleteMixin,
GetMixin,
ListMixin,
NoUpdateMixin,
RetrieveMixin,
UpdateMixin,
)
def test_retrieve_mixin():
class M(RetrieveMixin):
pass
obj = M()
assert hasattr(obj, "list")
assert hasattr(obj, "get")
asser... | 1,391 | Python | .py | 49 | 23.367347 | 43 | 0.686422 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,218 | test_object_mixins_attributes.py | python-gitlab_python-gitlab/tests/unit/mixins/test_object_mixins_attributes.py | from gitlab.mixins import (
AccessRequestMixin,
SetMixin,
SubscribableMixin,
TimeTrackingMixin,
TodoMixin,
UserAgentDetailMixin,
)
def test_access_request_mixin():
class TestClass(AccessRequestMixin):
pass
obj = TestClass()
assert hasattr(obj, "approve")
def test_subscri... | 1,218 | Python | .py | 43 | 23.093023 | 46 | 0.691443 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,219 | test_mixin_methods.py | python-gitlab_python-gitlab/tests/unit/mixins/test_mixin_methods.py | from unittest.mock import mock_open, patch
import pytest
import requests
import responses
from gitlab import base, GitlabUploadError
from gitlab import types as gl_types
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
GetMixin,
GetWithoutIdMixin,
ListMixin,
RefreshMixin,
SaveMixin,
... | 16,409 | Python | .py | 488 | 27.358607 | 88 | 0.628486 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,220 | test_requests_backend.py | python-gitlab_python-gitlab/tests/unit/_backends/test_requests_backend.py | import pytest
from requests_toolbelt.multipart.encoder import MultipartEncoder # type: ignore
from gitlab._backends import requests_backend
class TestSendData:
def test_senddata_json(self) -> None:
result = requests_backend.SendData(
json={"a": 1}, content_type="application/json"
)
... | 1,765 | Python | .py | 43 | 32.139535 | 80 | 0.6021 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,221 | test_rest_object.py | python-gitlab_python-gitlab/tests/unit/base/test_rest_object.py | import pickle
import pytest
import gitlab
from gitlab import base
from tests.unit import helpers
from tests.unit.helpers import FakeManager # noqa: F401, needed for _create_managers
def test_instantiate(gl, fake_manager):
attrs = {"foo": "bar"}
obj = helpers.FakeObject(fake_manager, attrs.copy())
asse... | 11,027 | Python | .py | 261 | 36.858238 | 85 | 0.652097 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,222 | test_rest_manager.py | python-gitlab_python-gitlab/tests/unit/base/test_rest_manager.py | from gitlab import base
from tests.unit import helpers
def test_computed_path_simple(gl):
class MGR(base.RESTManager):
_path = "/tests"
_obj_cls = object
mgr = MGR(gl)
assert mgr._computed_path == "/tests"
def test_computed_path_with_parent(gl, fake_manager):
class MGR(base.RESTMana... | 734 | Python | .py | 21 | 29.142857 | 76 | 0.637784 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,223 | test_imports.py | python-gitlab_python-gitlab/tests/unit/meta/test_imports.py | """
Ensure objects defined in gitlab.v4.objects are imported in
`gitlab/v4/objects/__init__.py`
"""
import pkgutil
from typing import Set
import gitlab.exceptions
import gitlab.v4.objects
def test_all_exceptions_imports_are_exported() -> None:
assert gitlab.exceptions.__all__ == sorted(
[
n... | 1,243 | Python | .py | 33 | 31.484848 | 86 | 0.642202 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,224 | test_ensure_type_hints.py | python-gitlab_python-gitlab/tests/unit/meta/test_ensure_type_hints.py | """
Ensure type-hints are setup correctly and detect if missing functions.
Original notes by John L. Villalovos
"""
import dataclasses
import functools
import inspect
from typing import Optional, Type
import pytest
import gitlab.mixins
import gitlab.v4.objects
@functools.total_ordering
@dataclasses.dataclass(fro... | 4,353 | Python | .py | 109 | 32.155963 | 87 | 0.63908 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,225 | test_mro.py | python-gitlab_python-gitlab/tests/unit/meta/test_mro.py | """
Ensure objects defined in gitlab.v4.objects have REST* as last item in class
definition
Original notes by John L. Villalovos
An example of an incorrect definition:
class ProjectPipeline(RESTObject, RefreshMixin, ObjectDeleteMixin):
^^^^^^^^^^ This should be at the end.
Correct way w... | 3,996 | Python | .py | 89 | 35.089888 | 88 | 0.622549 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,226 | test_dists.py | python-gitlab_python-gitlab/tests/smoke/test_dists.py | import subprocess
import sys
import tarfile
import zipfile
from pathlib import Path
import pytest
from gitlab._version import __title__, __version__
DOCS_DIR = "docs"
TEST_DIR = "tests"
DIST_NORMALIZED_TITLE = f"{__title__.replace('-', '_')}-{__version__}"
SDIST_FILE = f"{DIST_NORMALIZED_TITLE}.tar.gz"
WHEEL_FILE = ... | 1,513 | Python | .py | 34 | 41.235294 | 86 | 0.717599 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,227 | conftest.py | python-gitlab_python-gitlab/tests/functional/conftest.py | import dataclasses
import datetime
import logging
import pathlib
import tempfile
import time
import uuid
from subprocess import check_output
from typing import Optional
import pytest
import requests
import gitlab
import gitlab.base
from tests.functional import helpers
from tests.functional.fixtures.docker import * #... | 20,667 | Python | .py | 521 | 32.934741 | 115 | 0.674414 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,228 | helpers.py | python-gitlab_python-gitlab/tests/functional/helpers.py | import logging
import time
from typing import Optional, TYPE_CHECKING
import pytest
import gitlab
import gitlab.base
import gitlab.exceptions
SLEEP_INTERVAL = 0.5
TIMEOUT = 60 # seconds before timeout will occur
MAX_ITERATIONS = int(TIMEOUT / SLEEP_INTERVAL)
def get_gitlab_plan(gl: gitlab.Gitlab) -> Optional[str]... | 2,885 | Python | .py | 61 | 36.885246 | 96 | 0.637171 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,229 | test_releases.py | python-gitlab_python-gitlab/tests/functional/api/test_releases.py | release_name = "Demo Release"
release_tag_name = "v1.2.3"
release_description = "release notes go here"
link_data = {"url": "https://example.com", "name": "link_name"}
def test_create_project_release(project, project_file):
project.refresh() # Gets us the current default branch
release = project.releases.cr... | 2,016 | Python | .py | 46 | 37.695652 | 66 | 0.699591 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,230 | test_issues.py | python-gitlab_python-gitlab/tests/functional/api/test_issues.py | import gitlab
def test_create_issue(project):
issue = project.issues.create({"title": "my issue 1"})
issue2 = project.issues.create({"title": "my issue 2"})
issues = project.issues.list()
issue_iids = [issue.iid for issue in issues]
assert {issue, issue2} <= set(issues)
# Test 'iids' as a li... | 3,538 | Python | .py | 78 | 40.269231 | 79 | 0.716496 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,231 | test_repository.py | python-gitlab_python-gitlab/tests/functional/api/test_repository.py | import base64
import os
import sys
import tarfile
import time
import zipfile
from io import BytesIO
import pytest
import gitlab
def test_repository_files(project):
project.files.create(
{
"file_path": "README.md",
"branch": "main",
"content": "Initial content",
... | 5,638 | Python | .py | 139 | 34.755396 | 86 | 0.673271 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,232 | test_graphql.py | python-gitlab_python-gitlab/tests/functional/api/test_graphql.py | import logging
import pytest
import gitlab
@pytest.fixture
def gl_gql(gitlab_url: str, gitlab_token: str) -> gitlab.GraphQL:
logging.info("Instantiating gitlab.GraphQL instance")
instance = gitlab.GraphQL(gitlab_url, token=gitlab_token)
return instance
def test_query_returns_valid_response(gl_gql: gi... | 469 | Python | .py | 12 | 35.416667 | 65 | 0.759465 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,233 | test_boards.py | python-gitlab_python-gitlab/tests/functional/api/test_boards.py | def test_project_boards(project):
assert not project.boards.list()
board = project.boards.create({"name": "testboard"})
board = project.boards.get(board.id)
project.boards.delete(board.id)
def test_group_boards(group):
assert not group.boards.list()
board = group.boards.create({"name": "tes... | 404 | Python | .py | 10 | 35.6 | 56 | 0.71134 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,234 | test_epics.py | python-gitlab_python-gitlab/tests/functional/api/test_epics.py | import pytest
pytestmark = pytest.mark.gitlab_premium
def test_epics(group):
epic = group.epics.create({"title": "Test epic"})
epic.title = "Fixed title"
epic.labels = ["label1", "label2"]
epic.save()
epic = group.epics.get(epic.iid)
assert epic.title == "Fixed title"
assert epic.labels ... | 743 | Python | .py | 21 | 31 | 59 | 0.682138 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,235 | test_import_export.py | python-gitlab_python-gitlab/tests/functional/api/test_import_export.py | import time
import pytest
import gitlab
# https://github.com/python-gitlab/python-gitlab/pull/2790#pullrequestreview-1873617123
def test_group_import_export(gl, group, temp_dir):
export = group.exports.create()
assert export.message == "202 Accepted"
# We cannot check for export_status with group expor... | 3,683 | Python | .py | 87 | 35.747126 | 87 | 0.678232 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,236 | test_project_job_token_scope.py | python-gitlab_python-gitlab/tests/functional/api/test_project_job_token_scope.py | # https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html#allow-any-project-to-access-your-project
def test_enable_limit_access_to_this_project(gl, project):
scope = project.job_token_scope.get()
scope.enabled = True
scope.save()
scope.refresh()
assert scope.inbound_enabled
def test_disable_limit_... | 3,295 | Python | .py | 73 | 39.821918 | 95 | 0.703366 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,237 | test_keys.py | python-gitlab_python-gitlab/tests/functional/api/test_keys.py | """
GitLab API:
https://docs.gitlab.com/ce/api/keys.html
"""
import base64
import hashlib
def key_fingerprint(key: str) -> str:
key_part = key.split()[1]
decoded = base64.b64decode(key_part.encode("ascii"))
digest = hashlib.sha256(decoded).digest()
return f"SHA256:{base64.b64encode(digest).rstrip(b'=... | 1,256 | Python | .py | 31 | 36.290323 | 76 | 0.692498 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,238 | test_current_user.py | python-gitlab_python-gitlab/tests/functional/api/test_current_user.py | def test_current_user_email(gl):
gl.auth()
mail = gl.user.emails.create({"email": "current@user.com"})
assert mail in gl.user.emails.list()
mail.delete()
def test_current_user_gpg_keys(gl, GPG_KEY):
gl.auth()
gkey = gl.user.gpgkeys.create({"key": GPG_KEY})
assert gkey in gl.user.gpgkeys.l... | 927 | Python | .py | 28 | 28.25 | 67 | 0.660654 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,239 | test_lazy_objects.py | python-gitlab_python-gitlab/tests/functional/api/test_lazy_objects.py | import time
import pytest
import gitlab
@pytest.fixture
def lazy_project(gl, project):
assert "/" in project.path_with_namespace
return gl.projects.get(project.path_with_namespace, lazy=True)
def test_lazy_id(project, lazy_project):
assert isinstance(lazy_project.id, str)
assert isinstance(lazy_pr... | 1,290 | Python | .py | 27 | 43.740741 | 111 | 0.751801 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,240 | test_push_rules.py | python-gitlab_python-gitlab/tests/functional/api/test_push_rules.py | import pytest
import gitlab
@pytest.mark.gitlab_premium
def test_project_push_rules(project):
with pytest.raises(gitlab.GitlabParsingError):
# when no rules are defined the API call returns back `None` which
# causes a gitlab.GitlabParsingError in RESTObject.__init__()
project.pushrules.g... | 710 | Python | .py | 18 | 34 | 74 | 0.72807 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,241 | test_merge_requests.py | python-gitlab_python-gitlab/tests/functional/api/test_merge_requests.py | import datetime
import time
import pytest
import gitlab
import gitlab.v4.objects
def test_merge_requests(project):
project.files.create(
{
"file_path": "README.rst",
"branch": "main",
"content": "Initial content",
"commit_message": "Initial commit",
... | 9,797 | Python | .py | 231 | 36.554113 | 111 | 0.696587 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,242 | test_projects.py | python-gitlab_python-gitlab/tests/functional/api/test_projects.py | import time
import uuid
import pytest
import gitlab
from gitlab.const import AccessLevel
from gitlab.v4.objects.projects import ProjectStorage
def test_projects_head(gl):
headers = gl.projects.head()
assert headers["x-total"]
def test_project_head(gl, project):
headers = gl.projects.head(project.id)
... | 11,088 | Python | .py | 276 | 34.90942 | 115 | 0.698044 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,243 | test_packages.py | python-gitlab_python-gitlab/tests/functional/api/test_packages.py | """
GitLab API:
https://docs.gitlab.com/ce/api/packages.html
https://docs.gitlab.com/ee/user/packages/generic_packages
"""
from collections.abc import Iterator
import pytest
from gitlab import Gitlab
from gitlab.v4.objects import GenericPackage, Project, ProjectPackageProtectionRule
package_name = "hello-world"
pac... | 4,879 | Python | .py | 132 | 30.833333 | 83 | 0.696467 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,244 | test_statistics.py | python-gitlab_python-gitlab/tests/functional/api/test_statistics.py | """
GitLab API: https://docs.gitlab.com/ee/api/statistics.html
"""
def test_get_statistics(gl):
statistics = gl.statistics.get()
assert statistics.snippets.isdigit()
assert statistics.users.isdigit()
assert statistics.groups.isdigit()
assert statistics.projects.isdigit()
| 295 | Python | .py | 9 | 29.222222 | 58 | 0.749117 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,245 | test_variables.py | python-gitlab_python-gitlab/tests/functional/api/test_variables.py | """
GitLab API:
https://docs.gitlab.com/ee/api/instance_level_ci_variables.html
https://docs.gitlab.com/ee/api/project_level_variables.html
https://docs.gitlab.com/ee/api/group_level_variables.html
"""
def test_instance_variables(gl):
variable = gl.variables.create({"key": "key1", "value": "value1"})
assert v... | 1,289 | Python | .py | 33 | 34.787879 | 75 | 0.710611 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,246 | test_wikis.py | python-gitlab_python-gitlab/tests/functional/api/test_wikis.py | """
GitLab API:
https://docs.gitlab.com/ee/api/wikis.html
"""
def test_project_wikis(project):
page = project.wikis.create({"title": "title/subtitle", "content": "test content"})
page.content = "update content"
page.title = "subtitle"
page.save()
page.delete()
def test_project_wiki_file_upload... | 1,728 | Python | .py | 46 | 32.73913 | 87 | 0.665666 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,247 | test_users.py | python-gitlab_python-gitlab/tests/functional/api/test_users.py | """
GitLab API:
https://docs.gitlab.com/ee/api/users.html
https://docs.gitlab.com/ee/api/users.html#delete-authentication-identity-from-user
"""
import datetime
import time
import requests
def test_create_user(gl, fixture_dir):
user = gl.users.create(
{
"email": "foo@bar.com",
"u... | 5,007 | Python | .py | 136 | 30.860294 | 111 | 0.663068 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,248 | test_branches.py | python-gitlab_python-gitlab/tests/functional/api/test_branches.py | """
GitLab API:
https://docs.gitlab.com/ee/api/branches.html
"""
def test_branch_name_with_period(project):
# Make sure we can create and get a branch name containing a period '.'
branch_name = "my.branch.name"
branch = project.branches.create({"branch": branch_name, "ref": "main"})
assert branch.name... | 494 | Python | .py | 13 | 34.230769 | 76 | 0.708595 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,249 | test_services.py | python-gitlab_python-gitlab/tests/functional/api/test_services.py | """
GitLab API:
https://docs.gitlab.com/ee/api/integrations.html
"""
import gitlab
def test_get_service_lazy(project):
service = project.services.get("jira", lazy=True)
assert isinstance(service, gitlab.v4.objects.ProjectService)
def test_update_service(project):
service_dict = project.services.update(... | 944 | Python | .py | 24 | 35.333333 | 71 | 0.751101 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,250 | test_topics.py | python-gitlab_python-gitlab/tests/functional/api/test_topics.py | """
GitLab API:
https://docs.gitlab.com/ce/api/topics.html
"""
def test_topics(gl, gitlab_version):
assert not gl.topics.list()
create_dict = {"name": "my-topic", "description": "My Topic"}
if gitlab_version.major >= 15:
create_dict["title"] = "my topic title"
topic = gl.topics.create(create_... | 971 | Python | .py | 25 | 33.84 | 79 | 0.667377 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,251 | test_deploy_tokens.py | python-gitlab_python-gitlab/tests/functional/api/test_deploy_tokens.py | import datetime
def test_project_deploy_tokens(gl, project):
today = datetime.date.today().isoformat()
deploy_token = project.deploytokens.create(
{
"name": "foo",
"username": "bar",
"expires_at": today,
"scopes": ["read_registry"],
}
)
a... | 1,216 | Python | .py | 32 | 31.09375 | 74 | 0.642553 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,252 | test_bulk_imports.py | python-gitlab_python-gitlab/tests/functional/api/test_bulk_imports.py | import time
import pytest
import gitlab
@pytest.fixture
def bulk_import_enabled(gl: gitlab.Gitlab):
settings = gl.settings.get()
bulk_import_default = settings.bulk_import_enabled
settings.bulk_import_enabled = True
settings.save()
# todo: why so fussy with feature flag timing?
time.sleep(... | 1,908 | Python | .py | 52 | 31.057692 | 87 | 0.701468 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,253 | test_snippets.py | python-gitlab_python-gitlab/tests/functional/api/test_snippets.py | import pytest
import gitlab
def test_snippets(gl):
snippets = gl.snippets.list(get_all=True)
assert not snippets
snippet = gl.snippets.create(
{
"title": "snippet1",
"files": [{"file_path": "snippet1.py", "content": "import gitlab"}],
}
)
snippet = gl.snip... | 2,435 | Python | .py | 61 | 34.098361 | 80 | 0.684412 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,254 | test_deploy_keys.py | python-gitlab_python-gitlab/tests/functional/api/test_deploy_keys.py | def test_project_deploy_keys(gl, project, DEPLOY_KEY):
deploy_key = project.keys.create({"title": "foo@bar", "key": DEPLOY_KEY})
assert deploy_key in project.keys.list()
project2 = gl.projects.create({"name": "deploy-key-project"})
project2.keys.enable(deploy_key.id)
assert deploy_key in project2.k... | 395 | Python | .py | 8 | 44.5 | 77 | 0.708333 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,255 | test_gitlab.py | python-gitlab_python-gitlab/tests/functional/api/test_gitlab.py | import pytest
import requests
import gitlab
@pytest.fixture(
scope="session",
params=[{"get_all": True}, {"all": True}],
ids=["get_all=True", "all=True"],
)
def get_all_kwargs(request):
"""A tiny parametrized fixture to inject both `get_all=True` and
`all=True` to ensure they behave the same way ... | 7,787 | Python | .py | 197 | 34.340102 | 87 | 0.698734 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,256 | test_registry.py | python-gitlab_python-gitlab/tests/functional/api/test_registry.py | import pytest
from gitlab import Gitlab
from gitlab.v4.objects import Project, ProjectRegistryProtectionRule
@pytest.fixture(scope="module", autouse=True)
def protected_registry_feature(gl: Gitlab):
gl.features.set(name="container_registry_protected_containers", value=True)
@pytest.mark.skip(reason="Not releas... | 986 | Python | .py | 21 | 41.809524 | 79 | 0.755741 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,257 | test_groups.py | python-gitlab_python-gitlab/tests/functional/api/test_groups.py | import pytest
import gitlab
def test_groups(gl):
# TODO: This one still needs lots of work
user = gl.users.create(
{
"email": "user@test.com",
"username": "user",
"name": "user",
"password": "E4596f8be406Bc3a14a4ccdb1df80587#!1",
}
)
use... | 9,934 | Python | .py | 239 | 35.979079 | 88 | 0.685699 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,258 | conftest.py | python-gitlab_python-gitlab/tests/functional/cli/conftest.py | import pytest
import responses
from gitlab.const import DEFAULT_URL
@pytest.fixture
def gitlab_cli(script_runner, gitlab_config):
"""Wrapper fixture to help make test cases less verbose."""
def _gitlab_cli(subcommands):
"""
Return a script_runner.run method that takes a default gitlab
... | 1,408 | Python | .py | 42 | 26.97619 | 79 | 0.623799 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,259 | test_cli_variables.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_variables.py | import copy
import pytest
import responses
from gitlab.const import DEFAULT_URL
def test_list_instance_variables(gitlab_cli, gl):
cmd = ["variable", "list"]
ret = gitlab_cli(cmd)
assert ret.success
def test_list_group_variables(gitlab_cli, group):
cmd = ["group-variable", "list", "--group-id", gr... | 1,416 | Python | .py | 39 | 30.666667 | 85 | 0.681618 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,260 | test_cli.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli.py | """
Some test cases are run in-process to intercept requests to gitlab.com
and example servers.
"""
import copy
import json
import pytest
import responses
import yaml
from gitlab import __version__, config
from gitlab.const import DEFAULT_URL
PRIVATE_TOKEN = "glpat-abc123"
CI_JOB_TOKEN = "ci-job-token"
CI_SERVER_UR... | 7,330 | Python | .py | 162 | 40.895062 | 87 | 0.696863 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,261 | test_cli_projects.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_projects.py | import subprocess
import time
import pytest
import responses
@pytest.mark.script_launch_mode("inprocess")
@responses.activate
def test_project_registry_delete_in_bulk(
script_runner, resp_delete_registry_tags_in_bulk
):
responses.add(**resp_delete_registry_tags_in_bulk)
cmd = [
"gitlab",
... | 1,692 | Python | .py | 57 | 23.491228 | 78 | 0.626001 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,262 | test_cli_resource_access_tokens.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_resource_access_tokens.py | import datetime
def test_list_project_access_tokens(gitlab_cli, project):
cmd = ["project-access-token", "list", "--project-id", project.id]
ret = gitlab_cli(cmd)
assert ret.success
def test_create_project_access_token_with_scopes(gitlab_cli, project):
cmd = [
"project-access-token",
... | 1,144 | Python | .py | 39 | 22.487179 | 70 | 0.587374 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,263 | test_cli_repository.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_repository.py | import json
import time
def test_project_create_file(gitlab_cli, project):
file_path = "README"
branch = "main"
content = "CONTENT"
commit_message = "Initial commit"
cmd = [
"project-file",
"create",
"--project-id",
project.id,
"--file-path",
file_p... | 3,791 | Python | .py | 124 | 23.548387 | 111 | 0.591209 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,264 | test_cli_artifacts.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_artifacts.py | import subprocess
import textwrap
import time
from io import BytesIO
from zipfile import is_zipfile
import pytest
content = textwrap.dedent(
"""\
test-artifact:
script: echo "test" > artifact.txt
artifacts:
untracked: true
"""
)
data = {
"file_path": ".gitlab-ci.yml",
"branch":... | 2,386 | Python | .py | 82 | 22.768293 | 76 | 0.628771 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,265 | test_cli_v4.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_v4.py | import datetime
import os
import time
branch = "BRANCH-cli-v4"
def test_create_project(gitlab_cli):
name = "test-project1"
cmd = ["project", "create", "--name", name]
ret = gitlab_cli(cmd)
assert ret.success
assert name in ret.stdout
def test_update_project(gitlab_cli, project):
descripti... | 15,703 | Python | .py | 575 | 20.652174 | 111 | 0.587004 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,266 | test_cli_packages.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_packages.py | package_name = "hello-world"
package_version = "v1.0.0"
file_name = "hello.tar.gz"
file_content = "package content"
def test_list_project_packages(gitlab_cli, project):
cmd = ["project-package", "list", "--project-id", project.id]
ret = gitlab_cli(cmd)
assert ret.success
def test_list_group_packages(gi... | 1,320 | Python | .py | 47 | 21.531915 | 65 | 0.588889 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,267 | test_cli_users.py | python-gitlab_python-gitlab/tests/functional/cli/test_cli_users.py | import datetime
def test_create_user_impersonation_token_with_scopes(gitlab_cli, user):
cmd = [
"user-impersonation-token",
"create",
"--user-id",
user.id,
"--name",
"test-token",
"--scopes",
"api,read_user",
"--expires-at",
datetime.... | 558 | Python | .py | 20 | 21.2 | 71 | 0.578947 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,268 | docker.py | python-gitlab_python-gitlab/tests/functional/fixtures/docker.py | """
pytest-docker fixture overrides.
See https://github.com/avast/pytest-docker#available-fixtures.
"""
import pytest
@pytest.fixture(scope="session")
def docker_compose_project_name():
"""Set a consistent project name to enable optional reuse of containers."""
return "pytest-python-gitlab"
@pytest.fixture... | 697 | Python | .py | 19 | 33.210526 | 81 | 0.740686 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,269 | test_install.py | python-gitlab_python-gitlab/tests/install/test_install.py | import pytest
def test_install() -> None:
with pytest.raises(ImportError):
import aiohttp # type: ignore # noqa
| 127 | Python | .py | 4 | 27.25 | 45 | 0.694215 | python-gitlab/python-gitlab | 2,230 | 648 | 106 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,270 | setup.py | koalalorenzo_python-digitalocean/setup.py | #!/usr/bin/env python
import os
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
long_description = """This library provides easy access to Digital Ocean APIs to deploy droplets, images and more."""
if os.path.isfil... | 903 | Python | .py | 25 | 32.12 | 117 | 0.726857 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,271 | conf.py | koalalorenzo_python-digitalocean/docs/conf.py | # -*- coding: utf-8 -*-
#
# Python Digitalocean documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 25 13:52:17 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated... | 5,590 | Python | .py | 141 | 37.617021 | 80 | 0.701332 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,272 | Image.py | koalalorenzo_python-digitalocean/digitalocean/Image.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE, PUT, NotFoundError
class Image(BaseAPI):
"""
An object representing an DigitalOcean Image.
Attributes accepted at creation time:
Args:
name (str): The name to be given to an image.
url (str): A URL from which the vir... | 5,686 | Python | .py | 140 | 30.542857 | 83 | 0.573135 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,273 | Domain.py | koalalorenzo_python-digitalocean/digitalocean/Domain.py | # -*- coding: utf-8 -*-
from .Record import Record
from .baseapi import BaseAPI, GET, POST, DELETE, PUT
class Domain(BaseAPI):
def __init__(self, *args, **kwargs):
self.name = None
self.ttl = None
self.zone_file = None
self.ip_address = None
super(Domain, self).__init__(*a... | 5,348 | Python | .py | 136 | 28.352941 | 88 | 0.537345 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,274 | Metadata.py | koalalorenzo_python-digitalocean/digitalocean/Metadata.py | # -*- coding: utf-8 -*-
import requests
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin
from .baseapi import BaseAPI
class Metadata(BaseAPI):
"""
Metadata API: Provide useful information about the current Droplet.
See: https://developers.digitalocean... | 1,328 | Python | .py | 35 | 30 | 77 | 0.622465 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,275 | Certificate.py | koalalorenzo_python-digitalocean/digitalocean/Certificate.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE
class Certificate(BaseAPI):
"""
An object representing an SSL Certificate stored on DigitalOcean.
Attributes accepted at creation time:
Args:
name (str): A name for the Certificate
private_key (str, optional): The con... | 4,385 | Python | .py | 99 | 34.474747 | 79 | 0.618178 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,276 | Snapshot.py | koalalorenzo_python-digitalocean/digitalocean/Snapshot.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE, PUT
class Snapshot(BaseAPI):
def __init__(self, *args, **kwargs):
self.id = None
self.name = None
self.created_at = None
self.regions = []
self.resource_id = None
self.resource_type = None
s... | 1,201 | Python | .py | 35 | 26.085714 | 68 | 0.575627 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,277 | Record.py | koalalorenzo_python-digitalocean/digitalocean/Record.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE, PUT
class Record(BaseAPI):
"""
An object representing an DigitalOcean Domain Record.
Args:
type (str): The type of the DNS record (e.g. A, CNAME, TXT).
name (str): The host name, alias, or service being defined by the
... | 4,016 | Python | .py | 111 | 25.891892 | 80 | 0.537018 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,278 | Manager.py | koalalorenzo_python-digitalocean/digitalocean/Manager.py | # -*- coding: utf-8 -*-
try:
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlparse, parse_qs # noqa
from .baseapi import BaseAPI
from .Account import Account
from .Action import Action
from .Balance import Balance
from .Certificate import Certificate
from... | 14,777 | Python | .py | 424 | 24.837264 | 87 | 0.565193 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,279 | Region.py | koalalorenzo_python-digitalocean/digitalocean/Region.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI
class Region(BaseAPI):
def __init__(self, *args, **kwargs):
self.name = None
self.slug = None
self.sizes = []
self.available = None
self.features = []
super(Region, self).__init__(*args, **kwargs)
def __str__... | 386 | Python | .py | 12 | 25.583333 | 57 | 0.549865 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,280 | Tag.py | koalalorenzo_python-digitalocean/digitalocean/Tag.py | from .baseapi import BaseAPI
from .Droplet import Droplet
from .Snapshot import Snapshot
class Tag(BaseAPI):
def __init__(self, *args, **kwargs):
self.name = ""
self.resources = {}
super(Tag, self).__init__(*args, **kwargs)
@classmethod
def get_object(cls, api_token, tag_name):
... | 5,846 | Python | .py | 141 | 30.496454 | 88 | 0.58394 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,281 | Action.py | koalalorenzo_python-digitalocean/digitalocean/Action.py | # -*- coding: utf-8 -*-
from time import sleep
from .baseapi import BaseAPI
class Action(BaseAPI):
def __init__(self, *args, **kwargs):
self.id = None
self.status = None
self.type = None
self.started_at = None
self.completed_at = None
self.resource_id = None
... | 2,271 | Python | .py | 65 | 24.353846 | 77 | 0.538952 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,282 | LoadBalancer.py | koalalorenzo_python-digitalocean/digitalocean/LoadBalancer.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, GET, POST, PUT, DELETE
class StickySessions(object):
"""
An object holding information on a LoadBalancer's sticky sessions settings.
Args:
type (str): The type of sticky sessions used. Can be "cookies" or
"none"
cookie_name... | 15,837 | Python | .py | 333 | 36.681682 | 93 | 0.610015 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,283 | Balance.py | koalalorenzo_python-digitalocean/digitalocean/Balance.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI
class Balance(BaseAPI):
def __init__(self, *args, **kwargs):
self.month_to_date_balance = None
self.account_balance = None
self.month_to_date_usage = None
self.generated_at = None
super(Balance, self).__init__(*args, **k... | 847 | Python | .py | 24 | 27.5 | 63 | 0.595588 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,284 | FloatingIP.py | koalalorenzo_python-digitalocean/digitalocean/FloatingIP.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, GET, POST, DELETE
class FloatingIP(BaseAPI):
def __init__(self, *args, **kwargs):
self.ip = None
self.droplet = []
self.region = []
super(FloatingIP, self).__init__(*args, **kwargs)
@classmethod
def get_object(cls, api... | 3,095 | Python | .py | 88 | 23.943182 | 75 | 0.514247 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,285 | SSHKey.py | koalalorenzo_python-digitalocean/digitalocean/SSHKey.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, GET, POST, DELETE, PUT
class SSHKey(BaseAPI):
def __init__(self, *args, **kwargs):
self.id = ""
self.name = None
self.public_key = None
self.fingerprint = None
super(SSHKey, self).__init__(*args, **kwargs)
@classme... | 2,609 | Python | .py | 79 | 23.126582 | 77 | 0.523297 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,286 | __init__.py | koalalorenzo_python-digitalocean/digitalocean/__init__.py | # -*- coding: utf-8 -*-
"""digitalocean API to manage droplets"""
__version__ = "1.16.0"
__author__ = "Lorenzo Setale ( http://who.is.lorenzo.setale.me/? )"
__author_email__ = "lorenzo@setale.me"
__license__ = "LGPL v3"
__copyright__ = "Copyright (c) 2012-2020 Lorenzo Setale"
from .Manager import Manager
from .Drople... | 1,165 | Python | .py | 31 | 36.516129 | 83 | 0.80742 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,287 | VPC.py | koalalorenzo_python-digitalocean/digitalocean/VPC.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, PATCH, POST, DELETE
class VPC(BaseAPI):
"""
An object representing a DigitalOcean VPC.
Attributes accepted at creation time:
Args:
name (str): A name for the VPC
region (str): The slug for the region where the VPC will be created
... | 3,820 | Python | .py | 106 | 25.603774 | 80 | 0.527944 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,288 | Account.py | koalalorenzo_python-digitalocean/digitalocean/Account.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI
class Account(BaseAPI):
def __init__(self, *args, **kwargs):
self.droplet_limit = None
self.floating_ip_limit = None
self.email = None
self.uuid = None
self.email_verified = None
self.status = None
self.st... | 904 | Python | .py | 28 | 24.321429 | 60 | 0.573072 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,289 | Volume.py | koalalorenzo_python-digitalocean/digitalocean/Volume.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE
from .Snapshot import Snapshot
class Volume(BaseAPI):
def __init__(self, *args, **kwargs):
self.id = None
self.name = None
self.droplet_ids = []
self.region = None
self.description = None
self.size_gi... | 6,778 | Python | .py | 167 | 27.161677 | 79 | 0.519988 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,290 | Size.py | koalalorenzo_python-digitalocean/digitalocean/Size.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI
class Size(BaseAPI):
def __init__(self, *args, **kwargs):
self.slug = None
self.memory = None
self.vcpus = None
self.disk = None
self.transfer = None
self.price_monthly = None
self.price_hourly = None
... | 453 | Python | .py | 15 | 23.066667 | 51 | 0.552995 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,291 | Kernel.py | koalalorenzo_python-digitalocean/digitalocean/Kernel.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI
class Kernel(BaseAPI):
def __init__(self, *args, **kwargs):
self.name = ""
self.id = ""
self.version = ""
super(Kernel, self).__init__(*args, **kwargs)
def __str__(self):
return "<Kernel: %s %s>" % (self.name, self.v... | 328 | Python | .py | 10 | 26.7 | 60 | 0.539683 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,292 | Project.py | koalalorenzo_python-digitalocean/digitalocean/Project.py | from .baseapi import BaseAPI, GET, POST, DELETE, PUT
class Project(BaseAPI):
def __init__(self,*args, **kwargs):
self.name = None
self.description = None
self.purpose = None
self.environment = None
self.id = None
self.is_default = None
self.owner_uuid = None... | 5,027 | Python | .py | 125 | 30.072 | 87 | 0.578128 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,293 | baseapi.py | koalalorenzo_python-digitalocean/digitalocean/baseapi.py | # -*- coding: utf-8 -*-
import os
import json
import logging
import requests
from . import __name__, __version__
try:
import urlparse
except ImportError:
from urllib import parse as urlparse
GET = 'GET'
POST = 'POST'
DELETE = 'DELETE'
PUT = 'PUT'
PATCH = 'PATCH'
REQUEST_TIMEOUT_ENV_VAR = 'PYTHON_DIGITALOCEAN_... | 8,831 | Python | .py | 219 | 29.812785 | 96 | 0.568089 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,294 | Droplet.py | koalalorenzo_python-digitalocean/digitalocean/Droplet.py | # -*- coding: utf-8 -*-
import re
from .Action import Action
from .Image import Image
from .Kernel import Kernel
from .baseapi import BaseAPI, Error, GET, POST, DELETE
from .SSHKey import SSHKey
from .Volume import Volume
class DropletError(Error):
"""Base exception class for this module"""
pass
class BadK... | 21,150 | Python | .py | 536 | 27.843284 | 87 | 0.547074 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,295 | Firewall.py | koalalorenzo_python-digitalocean/digitalocean/Firewall.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE, PUT
import jsonpickle
class _targets(object):
"""
An internal object that both `Sources` and `Destinations` derive from.
Not for direct use by end users.
"""
def __init__(self, **kwargs):
self.addresses = []
self.... | 10,260 | Python | .py | 254 | 30.933071 | 79 | 0.598273 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,296 | CDNEndpoint.py | koalalorenzo_python-digitalocean/digitalocean/CDNEndpoint.py | # -*- coding: utf-8 -*-
from .baseapi import BaseAPI, POST, DELETE, PUT
class CDNEndpoint(BaseAPI):
"""
An object representing an DigitalOcean CDN Endpoint.
Args:
origin (str): The fully qualified domain name (FQDN) for the
origin server which provides the content for the CDN.
... | 3,179 | Python | .py | 84 | 28.166667 | 87 | 0.573936 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,297 | test_manager.py | koalalorenzo_python-digitalocean/digitalocean/tests/test_manager.py | import json
import unittest
import responses
import digitalocean
from .BaseTest import BaseTest
class TestManager(BaseTest):
def setUp(self):
super(TestManager, self).setUp()
self.manager = digitalocean.Manager(token=self.token)
self.image = digitalocean.Image(
id=449676856, ... | 31,186 | Python | .py | 644 | 36.399068 | 147 | 0.604485 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,298 | test_domain.py | koalalorenzo_python-digitalocean/digitalocean/tests/test_domain.py | import json
import unittest
import responses
import digitalocean
from .BaseTest import BaseTest
class TestDomain(BaseTest):
def setUp(self):
super(TestDomain, self).setUp()
self.domain = digitalocean.Domain(name='example.com', token=self.token)
@responses.activate
def test_load(self):
... | 7,801 | Python | .py | 160 | 36.36875 | 113 | 0.583684 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
23,299 | test_volume.py | koalalorenzo_python-digitalocean/digitalocean/tests/test_volume.py | import unittest
import responses
import digitalocean
from .BaseTest import BaseTest
class TestVolume(BaseTest):
def setUp(self):
super(TestVolume, self).setUp()
self.volume = digitalocean.Volume(
id='506f78a4-e098-11e5-ad9f-000f53306ae1', token=self.token)
@responses.activate
... | 8,895 | Python | .py | 186 | 32.650538 | 87 | 0.546693 | koalalorenzo/python-digitalocean | 1,252 | 301 | 11 | LGPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |