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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30,100 | sineModel.py | MTG_sms-tools/smstools/models/sineModel.py | # functions that implement analysis and synthesis of sounds using the Sinusoidal Model
# (for example usage check the examples in interface)
import math
import numpy as np
from scipy.fft import fftshift, ifft
from scipy.signal.windows import blackmanharris, triang
from smstools.models import dftModel as DFT
from sms... | 13,096 | Python | .py | 267 | 41.348315 | 122 | 0.636009 | MTG/sms-tools | 1,630 | 751 | 12 | AGPL-3.0 | 9/5/2024, 5:14:06 PM (Europe/Amsterdam) |
30,101 | sprModel.py | MTG_sms-tools/smstools/models/sprModel.py | # functions that implement analysis and synthesis of sounds using the Sinusoidal plus Residual Model
# (for example usage check the examples interface)
import math
import numpy as np
from scipy.fft import fft, ifft
from scipy.signal.windows import blackmanharris, triang
from smstools.models import dftModel as DFT
fr... | 5,003 | Python | .py | 97 | 45.587629 | 114 | 0.657131 | MTG/sms-tools | 1,630 | 751 | 12 | AGPL-3.0 | 9/5/2024, 5:14:06 PM (Europe/Amsterdam) |
30,102 | hpsModel.py | MTG_sms-tools/smstools/models/hpsModel.py | # functions that implement analysis and synthesis of sounds using the Harmonic plus Stochastic Model
# (for example usage check the examples interface)
import math
import numpy as np
from scipy.fft import fft, ifft
from scipy.signal import resample
from scipy.signal.windows import blackmanharris, hann, triang
from s... | 6,777 | Python | .py | 129 | 46.108527 | 119 | 0.649729 | MTG/sms-tools | 1,630 | 751 | 12 | AGPL-3.0 | 9/5/2024, 5:14:06 PM (Europe/Amsterdam) |
30,103 | stochasticModel.py | MTG_sms-tools/smstools/models/stochasticModel.py | # functions that implement analysis and synthesis of sounds using the Stochastic Model
# (for example usage check stochasticModel_function.py in the interface directory)
import numpy as np
from scipy.fft import fft, ifft
from scipy.interpolate import splev, splrep
from scipy.signal import resample
from scipy.signal.wi... | 7,769 | Python | .py | 166 | 39.542169 | 97 | 0.616623 | MTG/sms-tools | 1,630 | 751 | 12 | AGPL-3.0 | 9/5/2024, 5:14:06 PM (Europe/Amsterdam) |
30,104 | hprModel.py | MTG_sms-tools/smstools/models/hprModel.py | # functions that implement analysis and synthesis of sounds using the Harmonic plus Residual Model
# (for example usage check the interface directory)
import math
import numpy as np
from scipy.fft import fft, ifft
from scipy.signal.windows import blackmanharris, triang
from smstools.models import dftModel as DFT
fro... | 5,744 | Python | .py | 112 | 45.142857 | 105 | 0.652313 | MTG/sms-tools | 1,630 | 751 | 12 | AGPL-3.0 | 9/5/2024, 5:14:06 PM (Europe/Amsterdam) |
30,105 | cutilFunctions.pyx | MTG_sms-tools/smstools/models/utilFunctions_C/cutilFunctions.pyx | #this is a cython wrapper on C functions to call them in python
import numpy as np
cimport numpy as np
from cutilFunctions cimport *
from libc.stdlib cimport *
np.import_array()
def twm(pfreq, pmag, f0c):
"""This is a cython wrapper for a C function which is bit exact with the python version of this function
... | 2,406 | Python | .py | 46 | 45.869565 | 173 | 0.704113 | MTG/sms-tools | 1,630 | 751 | 12 | AGPL-3.0 | 9/5/2024, 5:14:06 PM (Europe/Amsterdam) |
30,106 | runserver.py | idank_explainshell/runserver.py | from explainshell import config
from explainshell.web import app
import logging.config
logging.config.dictConfig(config.LOGGING_DICT)
if __name__ == '__main__':
if config.HOST_IP:
app.run(debug=config.DEBUG, host=config.HOST_IP)
else:
app.run(debug=config.DEBUG)
| 289 | Python | .py | 9 | 28.222222 | 56 | 0.730216 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,107 | util.py | idank_explainshell/explainshell/util.py | import itertools
from operator import itemgetter
def consecutive(l, fn):
'''yield consecutive items from l that fn returns True for them
>>> even = lambda x: x % 2 == 0
>>> list(consecutive([], even))
[]
>>> list(consecutive([1], even))
[[1]]
>>> list(consecutive([1, 2], even))
[[1], [... | 3,810 | Python | .py | 134 | 20.985075 | 112 | 0.523602 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,108 | config.py | idank_explainshell/explainshell/config.py | import os
_currdir = os.path.dirname(os.path.dirname(__file__))
MANPAGEDIR = os.path.join(_currdir, 'manpages')
CLASSIFIER_CUTOFF = 0.7
TOOLSDIR = os.path.join(_currdir, 'tools')
MAN2HTML = os.path.join(TOOLSDIR, 'w3mman2html.cgi')
# host to pass into Flask's app.run.
HOST_IP = os.getenv('HOST_IP', False)
MONGO_URI... | 1,127 | Python | .py | 40 | 21.05 | 73 | 0.528651 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,109 | options.py | idank_explainshell/explainshell/options.py | import re, collections, logging
from explainshell import store
tokenstate = collections.namedtuple('tokenstate', 'startpos endpos token')
logger = logging.getLogger(__name__)
def extract(manpage):
'''extract options from all paragraphs that have been classified as containing
options'''
for i, p in enume... | 6,226 | Python | .py | 164 | 30.103659 | 133 | 0.501902 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,110 | manager.py | idank_explainshell/explainshell/manager.py | import sys, os, argparse, logging, glob
from explainshell import options, store, fixer, manpage, errors, util, config
from explainshell.algo import classifier
logger = logging.getLogger('explainshell.manager')
class managerctx(object):
def __init__(self, classifier, store, manpage):
self.classifier = cla... | 7,255 | Python | .py | 165 | 33.393939 | 134 | 0.595265 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,111 | helpconstants.py | idank_explainshell/explainshell/helpconstants.py | # -*- coding: utf-8 -*-
import textwrap
NOSYNOPSIS = 'no synopsis found'
PIPELINES = textwrap.dedent(''' <b>Pipelines</b>
A <u>pipeline</u> is a sequence of one or more commands separated by one of the control operators <b>|</b> or <b>|&</b>. The
format for a pipeline is:
[<b>tim... | 19,316 | Python | .py | 216 | 80.263889 | 178 | 0.639521 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,112 | store.py | idank_explainshell/explainshell/store.py | '''data objects to save processed man pages to mongodb'''
import pymongo, collections, re, logging
from explainshell import errors, util, helpconstants, config
logger = logging.getLogger(__name__)
class classifiermanpage(collections.namedtuple('classifiermanpage', 'name paragraphs')):
'''a man page that had its ... | 15,180 | Python | .py | 331 | 36.36858 | 111 | 0.596171 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,113 | fixer.py | idank_explainshell/explainshell/fixer.py | import textwrap, logging
from explainshell import util
class basefixer(object):
'''The base fixer class which other fixers inherit from.
Subclasses override the base methods in order to fix manpage content during
different parts of the parsing/classifying/saving process.'''
runbefore = []
runlast... | 6,002 | Python | .py | 164 | 27.902439 | 102 | 0.59403 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,114 | matcher.py | idank_explainshell/explainshell/matcher.py | import collections, logging, itertools
import bashlex.parser
import bashlex.ast
from explainshell import errors, util, helpconstants
class matchgroup(object):
'''a class to group matchresults together
we group all shell results in one group and create a new group for every
command'''
def __init__(se... | 26,896 | Python | .py | 526 | 36.555133 | 118 | 0.560862 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,115 | manpage.py | idank_explainshell/explainshell/manpage.py | import os, subprocess, re, logging, collections, urllib
from explainshell import config, store, errors
devnull = open(os.devnull, 'w')
SPLITSYNOP = re.compile(r'([^ ]+) - (.*)$')
ENV = dict(os.environ)
ENV["W3MMAN_MAN"] = "man --no-hyphenation"
ENV["MAN_KEEP_FORMATTING"] = "1"
ENV["MANWIDTH"] = "115"
ENV["LC_ALL"] =... | 7,602 | Python | .py | 185 | 33.448649 | 107 | 0.57993 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,116 | classifier.py | idank_explainshell/explainshell/algo/classifier.py | import itertools, collections, logging
import nltk
import nltk.metrics
import nltk.classify
import nltk.classify.maxent
from explainshell import algo, config
logger = logging.getLogger(__name__)
def get_features(paragraph):
features = {}
ptext = paragraph.cleantext()
assert ptext
features['starts_w... | 3,988 | Python | .py | 87 | 36.563218 | 93 | 0.634253 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,117 | features.py | idank_explainshell/explainshell/algo/features.py | import re
def extract_first_line(paragraph):
'''
>>> extract_first_line('a b cd')
'a b'
>>> extract_first_line('a b cd')
'a b cd'
>>> extract_first_line(' a b cd')
'a b cd'
>>> extract_first_line(' a b cd')
'a b'
'''
lines = paragraph.splitlines()
first = lines[0].s... | 1,759 | Python | .py | 52 | 28.923077 | 83 | 0.642099 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,118 | debugviews.py | idank_explainshell/explainshell/web/debugviews.py | import logging
from flask import render_template, request, abort, redirect, url_for, json
from explainshell import manager, config, store
from explainshell.web import app, helpers
logger = logging.getLogger(__name__)
@app.route('/debug')
def debug():
s = store.store('explainshell', config.MONGO_URI)
d = {'m... | 2,945 | Python | .py | 76 | 29.315789 | 88 | 0.573077 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,119 | __init__.py | idank_explainshell/explainshell/web/__init__.py | from flask import Flask
app = Flask(__name__)
from explainshell.web import views
from explainshell import store, config
if config.DEBUG:
from explainshell.web import debugviews
app.config.from_object(config)
| 215 | Python | .py | 7 | 28.714286 | 43 | 0.819512 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,120 | helpers.py | idank_explainshell/explainshell/web/helpers.py | from explainshell import util
def convertparagraphs(manpage):
for p in manpage.paragraphs:
p.text = p.text.decode('utf-8')
return manpage
def suggestions(matches, command):
'''enrich command matches with links to other man pages with the
same name'''
for m in matches:
if 'name' in ... | 792 | Python | .py | 18 | 33.888889 | 79 | 0.586788 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,121 | views.py | idank_explainshell/explainshell/web/views.py | import logging, itertools, urllib
import markupsafe
from flask import render_template, request, redirect
import bashlex.errors
from explainshell import matcher, errors, util, store, config
from explainshell.web import app, helpers
logger = logging.getLogger(__name__)
@app.route('/')
def index():
return render_... | 9,329 | Python | .py | 219 | 33.863014 | 105 | 0.611828 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,122 | shellbuiltins.py | idank_explainshell/tools/shellbuiltins.py | # -*- coding: utf-8 -*-
'''manually define and add shell builtins into the store
unfortunately the bash section for builtins isn't written in a way
explainshell can understannd, so we have to resort to manually
writing these down and adding them.'''
import textwrap
from explainshell import store, config
sp = store.... | 5,876 | Python | .py | 64 | 85.65625 | 306 | 0.615451 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,123 | test-options.py | idank_explainshell/tests/test-options.py | import unittest
from explainshell import options, store, errors
class test_options(unittest.TestCase):
def test_simple(self):
s = '\t-a description'
self.assertEquals(options.extract_option(s), (['-a'], []))
s = '\t-a, description'
self.assertEquals(options.extract_option(s), (['-... | 4,063 | Python | .py | 84 | 37.880952 | 84 | 0.498482 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,124 | test-fixer.py | idank_explainshell/tests/test-fixer.py | import unittest
import copy
from explainshell import fixer, options, store
class test_fixer(unittest.TestCase):
def setUp(self):
self._oldfixerscls = fixer.fixerscls[:]
def tearDown(self):
fixer.fixerscls = self._oldfixerscls
def test_changes(self):
class myfixer(fixer.basefixer)... | 2,101 | Python | .py | 46 | 36.021739 | 92 | 0.599511 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,125 | test-manager.py | idank_explainshell/tests/test-manager.py | import unittest, os
from explainshell import manager, config, store, errors
@unittest.skip("nltk usage is broken due to new version")
class test_manager(unittest.TestCase):
def setUp(self):
store.store('explainshell_tests').drop(True)
def _getmanager(self, names, **kwargs):
l = []
for... | 5,091 | Python | .py | 116 | 35.103448 | 135 | 0.607966 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,126 | test-integration.py | idank_explainshell/tests/test-integration.py | import unittest, subprocess, pymongo, os
from explainshell import manager, config, matcher
@unittest.skip("nltk usage is broken due to new version")
class test_integration(unittest.TestCase):
def test(self):
mngr = manager.manager(config.MONGO_URI, 'explainshell_tests', [os.path.join(os.path.dirname(__fil... | 1,289 | Python | .py | 22 | 50.772727 | 137 | 0.666667 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,127 | helpers.py | idank_explainshell/tests/helpers.py | from explainshell import matcher, store, errors, options, helpconstants
class mockstore(object):
def __init__(self):
sp = store.paragraph
so = store.option
sm = store.manpage
p0 = sp(0, '-a desc', '', True)
p1 = sp(1, '-b <arg> desc', '', True)
p2 = sp(2, '-? help t... | 1,774 | Python | .py | 36 | 37.666667 | 107 | 0.477759 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,128 | test-manpage.py | idank_explainshell/tests/test-manpage.py | import unittest, os, subprocess
from explainshell import manpage, store
class test_manpage(unittest.TestCase):
def test_first_paragraph_no_section(self):
m = 'foo\nbar'
l = list(manpage._parsetext(m.splitlines()))
self.assertEquals(l, [store.paragraph(0, 'foo\nbar', None, False)])
def... | 1,206 | Python | .py | 31 | 29.83871 | 90 | 0.567382 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,129 | test-matcher.py | idank_explainshell/tests/test-matcher.py | import unittest
import bashlex.errors, bashlex.ast
from explainshell import matcher, errors, helpconstants
from tests import helpers
s = helpers.mockstore()
class test_matcher(unittest.TestCase):
def assertMatchSingle(self, what, expectedmanpage, expectedresults):
m = matcher.matcher(what, s)
gr... | 25,908 | Python | .py | 506 | 38.488142 | 103 | 0.526132 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,130 | w3mman2html.cgi | idank_explainshell/tools/w3mman2html.cgi | #!/usr/bin/env perl
$MAN = $ENV{'W3MMAN_MAN'} || '@MAN@';
$QUERY = $ENV{'QUERY_STRING'} || $ARGV[0];
$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0;
$CGI = "file://$SCRIPT_NAME";
$CGI2 = "file:";
# $CGI2 = "file:///\$LIB/hlink.cgi?";
$SQUEEZE = 1;
$ENV{'PAGER'} = 'cat';
if ($QUERY =~ /\=/) {
for (split('&', $QUERY)) {
... | 5,895 | Python | .cgi | 266 | 19.018797 | 88 | 0.443612 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,131 | uwsgi.conf | idank_explainshell/misc/supervisord/uwsgi.conf | [program:explainshell]
command=/usr/local/bin/uwsgi
--socket /tmp/explainshell.sock
--logto /home/idan/logs/uwsgi.log
--home /home/idan/venv
--pythonpath /home/idan/code
--wsgi-file /home/idan/code/runserver.py
--callable app
--max-requests 1000
--master
--processes 1
--chmod
directory=/home/idan/co... | 365 | Python | .wsgi | 16 | 20.5625 | 42 | 0.759312 | idank/explainshell | 13,114 | 782 | 152 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,132 | conftest.py | ansible_ansible-lint/conftest.py | """PyTest Fixtures."""
import importlib
import os
import platform
import subprocess
import sys
import warnings
from pathlib import Path
import pytest
# Ensure we always run from the root of the repository
if Path.cwd() != Path(__file__).parent:
os.chdir(Path(__file__).parent)
# checking if user is running pytes... | 2,822 | Python | .py | 68 | 35.632353 | 168 | 0.67835 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,133 | conftest.py | ansible_ansible-lint/test/conftest.py | """PyTest fixtures for testing the project."""
from __future__ import annotations
import shutil
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
# pylint: disable=wildcard-import,unused-wildcard-import
from ansiblelint.testing.fixtures import * # noqa: F403
from ansiblelint... | 3,397 | Python | .py | 71 | 42.267606 | 83 | 0.719818 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,134 | test_app.py | ansible_ansible-lint/test/test_app.py | """Test for app module."""
from pathlib import Path
from ansiblelint.constants import RC
from ansiblelint.file_utils import Lintable
from ansiblelint.testing import run_ansible_lint
def test_generate_ignore(tmp_path: Path) -> None:
"""Validate that --generate-ignore dumps expected ignore to the file."""
lin... | 1,193 | Python | .py | 24 | 45.416667 | 83 | 0.726334 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,135 | test_constants.py | ansible_ansible-lint/test/test_constants.py | """Tests for constants module."""
from ansiblelint.constants import States
def test_states() -> None:
"""Test that states are evaluated as boolean false."""
assert bool(States.NOT_LOADED) is False
assert bool(States.LOAD_FAILED) is False
assert bool(States.UNKNOWN_DATA) is False
| 299 | Python | .py | 7 | 39 | 58 | 0.743945 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,136 | test_verbosity.py | ansible_ansible-lint/test/test_verbosity.py | """Tests related to our logging/verbosity setup."""
from __future__ import annotations
from pathlib import Path
import pytest
from ansiblelint.testing import run_ansible_lint
from ansiblelint.text import strip_ansi_escape
# substrs is a list of tuples, where:
# component 1 is the substring in question
# com... | 2,763 | Python | .py | 87 | 21.931034 | 77 | 0.511619 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,137 | test_skiputils.py | ansible_ansible-lint/test/test_skiputils.py | """Validate ansiblelint.skip_utils."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Any
import pytest
from ansiblelint.constants import SKIPPED_RULES_KEY
from ansiblelint.file_utils import Lintable
from ansiblelint.runner import Runner
from ansiblelint.skip_utils imp... | 9,395 | Python | .py | 233 | 21.450644 | 95 | 0.382192 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,138 | test_formatter.py | ansible_ansible-lint/test/test_formatter.py | """Test for output formatter."""
# Copyright (c) 2016 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | 2,517 | Python | .py | 62 | 36.741935 | 79 | 0.733442 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,139 | test_file_utils.py | ansible_ansible-lint/test/test_file_utils.py | """Tests for file utility functions."""
from __future__ import annotations
import copy
import logging
import os
import time
from pathlib import Path
from typing import TYPE_CHECKING, Any
import pytest
from ansiblelint import cli, file_utils
from ansiblelint.file_utils import (
Lintable,
cwd,
expand_path... | 17,164 | Python | .py | 484 | 27.683884 | 100 | 0.599314 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,140 | test_schemas.py | ansible_ansible-lint/test/test_schemas.py | """Test schemas modules."""
import json
import logging
import os
import subprocess
import sys
import urllib
import warnings
from pathlib import Path
from typing import Any
from unittest.mock import DEFAULT, MagicMock, patch
import license_expression
import pytest
from ansiblelint.file_utils import Lintable
from ansi... | 3,674 | Python | .py | 91 | 34.395604 | 149 | 0.680595 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,141 | test_dependencies_in_meta.py | ansible_ansible-lint/test/test_dependencies_in_meta.py | """Tests about dependencies in meta."""
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_external_dependency_is_ok(default_rules_collection: RulesCollection) -> None:
"""Check that external dep in role meta is not a violation."""
playbook_path = "examples/roles/dep... | 458 | Python | .py | 8 | 53.875 | 86 | 0.767338 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,142 | test_with_skip_tagid.py | ansible_ansible-lint/test/test_with_skip_tagid.py | """Tests related to skip tag id."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.yaml_rule import YamllintRule
from ansiblelint.runner import Runner
from ansiblelint.testing import run_ansible_lint
FILE = "examples/playbooks/with-skip-tag-id.yml"
collection = RulesCollection()
collection.regis... | 1,916 | Python | .py | 50 | 33.88 | 75 | 0.673514 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,143 | test_skip_inside_yaml.py | ansible_ansible-lint/test/test_skip_inside_yaml.py | """Tests related to use of inline noqa."""
import pytest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
from ansiblelint.testing import run_ansible_lint
def test_role_tasks_with_block(default_rules_collection: RulesCollection) -> None:
"""Check that blocks in role tasks can ... | 1,215 | Python | .py | 32 | 33.65625 | 82 | 0.70844 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,144 | test_cli.py | ansible_ansible-lint/test/test_cli.py | """Test cli arguments and config."""
from __future__ import annotations
import os
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from ansiblelint import cli
if TYPE_CHECKING:
from _pytest.monkeypatch import MonkeyPatch
@pytest.fixture(name="base_arguments")
def fixture_base_arguments... | 8,205 | Python | .py | 221 | 29.266968 | 116 | 0.580649 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,145 | test_rule_properties.py | ansible_ansible-lint/test/test_rule_properties.py | """Tests related to rule properties."""
from ansiblelint.rules import RulesCollection
def test_severity_valid(default_rules_collection: RulesCollection) -> None:
"""Test that rules collection only has allow-listed severities."""
valid_severity_values = [
"VERY_HIGH",
"HIGH",
"MEDIUM",... | 474 | Python | .py | 14 | 27.5 | 75 | 0.660832 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,146 | test_matcherrror.py | ansible_ansible-lint/test/test_matcherrror.py | """Tests for MatchError."""
import operator
from collections.abc import Callable
from typing import Any
import pytest
from ansiblelint.errors import MatchError
from ansiblelint.file_utils import Lintable
from ansiblelint.rules.no_changed_when import CommandHasChangesCheckRule
from ansiblelint.rules.partial_become im... | 6,919 | Python | .py | 175 | 33.434286 | 104 | 0.649144 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,147 | test_mockings.py | ansible_ansible-lint/test/test_mockings.py | """Test mockings module."""
from pathlib import Path
import pytest
from ansiblelint._mockings import _make_module_stub
from ansiblelint.config import Options
from ansiblelint.constants import RC
def test_make_module_stub(config_options: Options) -> None:
"""Test make module stub."""
config_options.cache_di... | 542 | Python | .py | 13 | 38.153846 | 65 | 0.757634 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,148 | test_load_failure.py | ansible_ansible-lint/test/test_load_failure.py | """Tests for LoadFailureRule."""
import pytest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
@pytest.mark.parametrize(
"path",
(
pytest.param("examples/broken/encoding.j2", id="jinja2"),
pytest.param("examples/broken/encoding.yml", id="yaml"),
),
)
d... | 784 | Python | .py | 22 | 31.545455 | 66 | 0.708443 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,149 | test_formatter_base.py | ansible_ansible-lint/test/test_formatter_base.py | """Tests related to base formatter."""
from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
from ansiblelint.formatters import BaseFormatter
@pytest.mark.parametrize(
("base_dir", "relative_path"),
(
pytest.param(None, True, id="0"),
pytest.param... | 2,040 | Python | .py | 68 | 25.205882 | 90 | 0.647089 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,150 | test_examples.py | ansible_ansible-lint/test/test_examples.py | """Assure samples produced desire outcomes."""
import pytest
from ansiblelint.app import get_app
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
from ansiblelint.testing import run_ansible_lint
def test_example(default_rules_collection: RulesCollection) -> None:
"""example.ym... | 3,868 | Python | .py | 93 | 35.516129 | 94 | 0.679702 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,151 | test_cli_role_paths.py | ansible_ansible-lint/test/test_cli_role_paths.py | """Tests related to role paths."""
from __future__ import annotations
import os
from pathlib import Path
import pytest
from ansiblelint.constants import RC
from ansiblelint.testing import run_ansible_lint
from ansiblelint.text import strip_ansi_escape
@pytest.fixture(name="local_test_dir")
def fixture_local_test_... | 7,952 | Python | .py | 178 | 39.438202 | 102 | 0.683904 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,152 | test_strict.py | ansible_ansible-lint/test/test_strict.py | """Test strict mode."""
import os
import pytest
from ansiblelint.testing import run_ansible_lint
@pytest.mark.parametrize(
("strict", "returncode", "message"),
(
pytest.param(True, 2, "Failed", id="on"),
pytest.param(False, 0, "Passed", id="off"),
),
)
def test_strict(strict: bool, retu... | 885 | Python | .py | 26 | 28.846154 | 69 | 0.653396 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,153 | test_rules_collection.py | ansible_ansible-lint/test/test_rules_collection.py | """Tests for rule collection class."""
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limi... | 6,869 | Python | .py | 148 | 42.013514 | 88 | 0.721375 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,154 | test_utils.py | ansible_ansible-lint/test/test_utils.py | # Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | 17,559 | Python | .py | 455 | 30.874725 | 90 | 0.599577 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,155 | test_adjacent_plugins.py | ansible_ansible-lint/test/test_adjacent_plugins.py | """Test ability to recognize adjacent modules/plugins."""
import logging
import pytest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_adj_action(
default_rules_collection: RulesCollection,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Assures local collec... | 730 | Python | .py | 18 | 36.277778 | 83 | 0.748936 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,156 | test_formatter_sarif.py | ansible_ansible-lint/test/test_formatter_sarif.py | """Test the codeclimate JSON formatter."""
from __future__ import annotations
import json
import os
import pathlib
import subprocess
import sys
from tempfile import NamedTemporaryFile
import pytest
from ansiblelint.errors import MatchError
from ansiblelint.file_utils import Lintable
from ansiblelint.formatters impo... | 8,595 | Python | .py | 201 | 32.373134 | 99 | 0.587385 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,157 | test_lint_rule.py | ansible_ansible-lint/test/test_lint_rule.py | """Tests for lintable."""
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ri... | 1,879 | Python | .py | 37 | 48.459459 | 79 | 0.765412 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,158 | test_ansiblesyntax.py | ansible_ansible-lint/test/test_ansiblesyntax.py | """Test Ansible Syntax.
This module contains tests that validate that linter does not produce errors
when encountering what counts as valid Ansible syntax.
"""
from ansiblelint.testing import RunFromText
PB_WITH_NULL_TASKS = """\
---
- name: Fixture for test_null_tasks
hosts: all
tasks:
"""
def test_null_tasks... | 516 | Python | .py | 15 | 32 | 76 | 0.762097 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,159 | test_yaml_utils.py | ansible_ansible-lint/test/test_yaml_utils.py | """Tests for yaml-related utility functions."""
# pylint: disable=too-many-lines
from __future__ import annotations
from io import StringIO
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
import pytest
from ruamel.yaml.main import YAML
from yamllint.linter import run as run_yamllint
import ansi... | 33,466 | Python | .py | 985 | 24.539086 | 216 | 0.548182 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,160 | test_local_content.py | ansible_ansible-lint/test/test_local_content.py | """Test playbooks with local content."""
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_local_collection(default_rules_collection: RulesCollection) -> None:
"""Assures local collections are found."""
playbook_path = "test/local-content/test-collection.yml"
ru... | 476 | Python | .py | 10 | 43.8 | 77 | 0.75974 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,161 | test_formatter_json.py | ansible_ansible-lint/test/test_formatter_json.py | """Test the codeclimate JSON formatter."""
from __future__ import annotations
import json
import pathlib
import subprocess
import sys
import pytest
from ansiblelint.errors import MatchError
from ansiblelint.file_utils import Lintable
from ansiblelint.formatters import CodeclimateJSONFormatter
from ansiblelint.rules... | 5,403 | Python | .py | 124 | 33.822581 | 114 | 0.622577 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,162 | test_skip_playbook_items.py | ansible_ansible-lint/test/test_skip_playbook_items.py | """Tests related to use of noqa inside playbooks."""
import pytest
from ansiblelint.testing import RunFromText
PLAYBOOK_PRE_TASKS = """\
---
- name: Fixture
hosts: all
tasks:
- name: Bad git 1 # noqa: latest[git]
action: ansible.builtin.git a=b c=d
- name: Bad git 2
action: ansible.builtin.g... | 3,154 | Python | .py | 111 | 23.495495 | 70 | 0.620712 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,163 | test_import_playbook.py | ansible_ansible-lint/test/test_import_playbook.py | """Test ability to import playbooks."""
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_task_hook_import_playbook(default_rules_collection: RulesCollection) -> None:
"""Assures import_playbook includes are recognized."""
playbook_path = "examples/playbooks/playboo... | 1,592 | Python | .py | 35 | 41.114286 | 86 | 0.739496 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,164 | test_main.py | ansible_ansible-lint/test/test_main.py | """Tests related to ansiblelint.__main__ module."""
import os
import shutil
import subprocess
import sys
import tempfile
import time
from http.client import RemoteDisconnected
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
from ansiblelint.config import get_version_warning, options
from... | 4,922 | Python | .py | 130 | 32.423077 | 83 | 0.669671 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,165 | test_import_tasks.py | ansible_ansible-lint/test/test_import_tasks.py | """Test related to import of invalid files."""
import pytest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
@pytest.mark.parametrize(
("playbook_path", "lintable_count", "match_count"),
(
pytest.param(
"examples/playbooks/test_import_with_conflicting_... | 1,021 | Python | .py | 29 | 29.62069 | 88 | 0.680851 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,166 | test_list_rules.py | ansible_ansible-lint/test/test_list_rules.py | """Tests related to our logging/verbosity setup."""
from pathlib import Path
import pytest
from ansiblelint.testing import run_ansible_lint
def test_list_rules_includes_opt_in_rules(project_path: Path) -> None:
"""Checks that listing rules also includes the opt-in rules."""
# Piggyback off the .yamllint in... | 2,559 | Python | .py | 65 | 33.476923 | 89 | 0.642569 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,167 | test_import_include_role.py | ansible_ansible-lint/test/test_import_include_role.py | """Tests related to role imports."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from ansiblelint.runner import Runner
if TYPE_CHECKING:
from pathlib import Path
from _pytest.fixtures import SubRequest
from ansiblelint.rules import RulesCollection
ROLE_TASKS_MAI... | 3,852 | Python | .py | 137 | 22.671533 | 87 | 0.632648 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,168 | test_text.py | ansible_ansible-lint/test/test_text.py | """Tests for text module."""
from typing import Any
import pytest
from ansiblelint.text import has_glob, has_jinja, strip_ansi_escape, toidentifier
@pytest.mark.parametrize(
("value", "expected"),
(
pytest.param("\x1b[1;31mHello", "Hello", id="0"),
pytest.param("\x1b[2;37;41mExample_file.zi... | 2,215 | Python | .py | 63 | 29.952381 | 82 | 0.602618 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,169 | test_internal_rules.py | ansible_ansible-lint/test/test_internal_rules.py | """Tests for internal rules."""
import pytest
from ansiblelint._internal.rules import BaseRule
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_base_rule_url() -> None:
"""Test that rule URL is set to expected value."""
rule = BaseRule()
assert rule.url == "ht... | 1,014 | Python | .py | 29 | 30.310345 | 85 | 0.691522 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,170 | test_transform_mixin.py | ansible_ansible-lint/test/test_transform_mixin.py | """Tests for TransformMixin."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from ansiblelint.rules import TransformMixin
if TYPE_CHECKING:
from collections.abc import MutableMapping, MutableSequence
from typing import Any
DUMMY_MAP: dict[str, Any] = {
"foo": "tex... | 5,551 | Python | .py | 143 | 30.244755 | 88 | 0.524736 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,171 | test_task_includes.py | ansible_ansible-lint/test/test_task_includes.py | """Tests related to task inclusions."""
import pytest
from ansiblelint.file_utils import Lintable
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
@pytest.mark.parametrize(
("filename", "file_count", "match_count"),
(
pytest.param(
"examples/playbooks/b... | 1,541 | Python | .py | 49 | 23.673469 | 85 | 0.610887 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,172 | test_requirements.py | ansible_ansible-lint/test/test_requirements.py | """Tests requirements module."""
from ansible_compat.runtime import Runtime
from ansiblelint.requirements import Reqs
def test_reqs() -> None:
"""Performs basic testing of Reqs class."""
reqs = Reqs()
runtime = Runtime()
assert "ansible-core" in reqs
# checks that this ansible core version is no... | 615 | Python | .py | 14 | 39.785714 | 70 | 0.726968 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,173 | test_profiles.py | ansible_ansible-lint/test/test_profiles.py | """Tests for the --profile feature."""
import platform
import subprocess
import sys
from _pytest.capture import CaptureFixture
from ansiblelint.rules import RulesCollection, filter_rules_with_profile
from ansiblelint.rules.risky_shell_pipe import ShellWithoutPipefail
from ansiblelint.text import strip_ansi_escape
... | 2,129 | Python | .py | 50 | 36.48 | 100 | 0.688104 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,174 | test_skip_import_playbook.py | ansible_ansible-lint/test/test_skip_import_playbook.py | """Test related to skipping import_playbook."""
from pathlib import Path
import pytest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
IMPORTED_PLAYBOOK = """\
---
- name: Fixture
hosts: all
tasks:
- name: Success # noqa: no-free-form
ansible.builtin.fail: msg="fail... | 1,229 | Python | .py | 39 | 28.179487 | 90 | 0.72095 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,175 | test_file_path_evaluation.py | ansible_ansible-lint/test/test_file_path_evaluation.py | """Testing file path evaluation when using import_tasks / include_tasks."""
from __future__ import annotations
import textwrap
from typing import TYPE_CHECKING
import pytest
from ansiblelint.runner import Runner
if TYPE_CHECKING:
from pathlib import Path
from ansiblelint.rules import RulesCollection
LAYO... | 3,690 | Python | .py | 118 | 23.822034 | 88 | 0.585839 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,176 | test_errors.py | ansible_ansible-lint/test/test_errors.py | """Test ansiblelint.errors."""
import pytest
from ansiblelint.errors import MatchError
def test_matcherror() -> None:
"""."""
match = MatchError("foo", lineno=1, column=2)
with pytest.raises(TypeError):
assert match <= 0
assert match != 0
assert match.position == "1:2"
match2 = Ma... | 529 | Python | .py | 16 | 28.25 | 49 | 0.666667 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,177 | test_runner.py | ansible_ansible-lint/test/test_runner.py | """Tests for runner submodule."""
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitatio... | 8,407 | Python | .py | 235 | 29.868085 | 85 | 0.670928 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,178 | test_config.py | ansible_ansible-lint/test/test_config.py | """Tests for config module."""
from ansiblelint.config import PROFILES
from ansiblelint.rules import RulesCollection
def test_profiles(default_rules_collection: RulesCollection) -> None:
"""Test the rules included in profiles are valid."""
profile_banned_tags = {"opt-in", "experimental"}
for name, data i... | 759 | Python | .py | 14 | 43.571429 | 123 | 0.633423 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,179 | test_include_miss_file_with_role.py | ansible_ansible-lint/test/test_include_miss_file_with_role.py | """Tests related to inclusions."""
import pytest
from _pytest.logging import LogCaptureFixture
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_cases_warning_message(default_rules_collection: RulesCollection) -> None:
"""Test that including a non-existing file produce... | 1,434 | Python | .py | 35 | 35.942857 | 84 | 0.715827 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,180 | test_ansiblelintrule.py | ansible_ansible-lint/test/test_ansiblelintrule.py | """Generic tests for AnsibleLintRule class."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import pytest
from ansiblelint.rules import AnsibleLintRule, RulesCollection
if TYPE_CHECKING:
from ansiblelint.config import Options
def test_unjinja() -> None:
"""Verify that unjinja ... | 1,040 | Python | .py | 24 | 38.791667 | 83 | 0.696127 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,181 | test_loaders.py | ansible_ansible-lint/test/test_loaders.py | """Tests for loaders submodule."""
import os
import tempfile
import uuid
from pathlib import Path
from textwrap import dedent
from ansiblelint.loaders import IGNORE_FILE, load_ignore_txt
def test_load_ignore_txt_default_empty() -> None:
"""Test load_ignore_txt when no ignore-file is present."""
with tempfil... | 3,787 | Python | .py | 95 | 29.147368 | 115 | 0.575716 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,182 | test_transformer.py | ansible_ansible-lint/test/test_transformer.py | # cspell:ignore classinfo
"""Tests for Transformer."""
from __future__ import annotations
import builtins
import os
import shutil
from pathlib import Path
from typing import TYPE_CHECKING, Any
from unittest import mock
import pytest
import ansiblelint.__main__ as main
from ansiblelint.app import App
from ansiblelin... | 19,690 | Python | .py | 540 | 28.601852 | 99 | 0.603317 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,183 | b_success.py | ansible_ansible-lint/test/local-content/test-roles-success/roles/role2/test_plugins/b_success.py | """A test plugin."""
def compatibility_in_test(element, container):
"""Return True when element contained in container."""
return element in container
# pylint: disable=too-few-public-methods
class TestModule:
"""Test plugin."""
@staticmethod
def tests():
"""Return tests."""
ret... | 389 | Python | .py | 13 | 24.230769 | 58 | 0.644205 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,184 | test_module_3_success.py | ansible_ansible-lint/test/local-content/test-roles-success/roles/role3/library/test_module_3_success.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 3!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,185 | test_module_1_success.py | ansible_ansible-lint/test/local-content/test-roles-success/roles/role1/library/test_module_1_success.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 1!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,186 | test_module_2.py | ansible_ansible-lint/test/local-content/collections/ansible_collections/testns/test_collection/plugins/modules/test_module_2.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 2!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,187 | test_filter.py | ansible_ansible-lint/test/local-content/collections/ansible_collections/testns/test_collection/plugins/filter/test_filter.py | """A filter plugin."""
def a_test_filter(a, b):
"""Return a string containing both a and b."""
return f"{a}:{b}"
# pylint: disable=too-few-public-methods
class FilterModule:
"""Filter plugin."""
@staticmethod
def filters():
"""Return filters."""
return {"test_filter": a_test_fil... | 325 | Python | .py | 11 | 24.818182 | 50 | 0.624595 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,188 | b_failed.py | ansible_ansible-lint/test/local-content/test-roles-failed/roles/role2/test_plugins/b_failed.py | """A test plugin."""
def compatibility_in_test(element, container):
"""Return True when element is contained in container."""
return element in container
# pylint: disable=too-few-public-methods
class TestModule:
"""Test plugin."""
@staticmethod
def tests():
"""Return tests."""
... | 391 | Python | .py | 13 | 24.384615 | 61 | 0.643432 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,189 | test_module_3_failed.py | ansible_ansible-lint/test/local-content/test-roles-failed/roles/role3/library/test_module_3_failed.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 3!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,190 | test_module_1_failed.py | ansible_ansible-lint/test/local-content/test-roles-failed/roles/role1/library/test_module_1_failed.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 1!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,191 | b_failed_complete.py | ansible_ansible-lint/test/local-content/test-roles-failed-complete/roles/role2/test_plugins/b_failed_complete.py | """A test plugin."""
def compatibility_in_test(a, b):
"""Return True when a is contained in b."""
return a in b
# pylint: disable=too-few-public-methods
class TestModule:
"""Test plugin."""
@staticmethod
def tests():
"""Return tests."""
return {
"b_test_failed_comple... | 358 | Python | .py | 13 | 21.846154 | 60 | 0.605882 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,192 | test_module_3_failed_complete.py | ansible_ansible-lint/test/local-content/test-roles-failed-complete/roles/role3/library/test_module_3_failed_complete.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 3!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,193 | test_module_1_failed_complete.py | ansible_ansible-lint/test/local-content/test-roles-failed-complete/roles/role1/library/test_module_1_failed_complete.py | #!/usr/bin/python
"""A module."""
from ansible.module_utils.basic import AnsibleModule
def main() -> None:
"""Execute module."""
module = AnsibleModule({})
module.exit_json(msg="Hello 1!")
if __name__ == "__main__":
main()
| 244 | Python | .py | 9 | 23.777778 | 52 | 0.630435 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,194 | test_inline_env_var.py | ansible_ansible-lint/test/rules/test_inline_env_var.py | """Tests for inline-env-var rule."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.inline_env_var import EnvVarsInCommandRule
from ansiblelint.testing import RunFromText
SUCCESS_PLAY_TASKS = """
- hosts: localhost
tasks:
- name: Actual use of environment
shell: echo $HELLO
environm... | 2,096 | Python | .py | 71 | 24.774648 | 65 | 0.674314 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,195 | test_package_latest.py | ansible_ansible-lint/test/rules/test_package_latest.py | """Tests for package-latest rule."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.package_latest import PackageIsNotLatestRule
from ansiblelint.runner import Runner
def test_package_not_latest_positive() -> None:
"""Positive test for package-latest."""
collection = RulesCollection()
... | 862 | Python | .py | 19 | 41.368421 | 67 | 0.754177 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,196 | test_role_names.py | ansible_ansible-lint/test/rules/test_role_names.py | """Test the RoleNames rule."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import pytest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.role_name import RoleNames
from ansiblelint.runner import Runner
if TYPE_CHECKING:
from pathlib import Path
from _pytes... | 2,536 | Python | .py | 73 | 29.972603 | 85 | 0.684124 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,197 | test_syntax_check.py | ansible_ansible-lint/test/rules/test_syntax_check.py | """Tests for syntax-check rule."""
from typing import Any
import pytest
from ansiblelint.file_utils import Lintable
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
@pytest.mark.parametrize(
("filename", "expected_results"),
(
pytest.param(
"examples/p... | 3,727 | Python | .py | 93 | 31.344086 | 100 | 0.623377 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,198 | test_args.py | ansible_ansible-lint/test/rules/test_args.py | """Tests for args rule."""
from ansiblelint.file_utils import Lintable
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
def test_args_module_relative_import(default_rules_collection: RulesCollection) -> None:
"""Validate args check of a module with a relative import."""
lin... | 754 | Python | .py | 16 | 42.6875 | 88 | 0.734694 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |
30,199 | test_deprecated_module.py | ansible_ansible-lint/test/rules/test_deprecated_module.py | """Tests for deprecated-module rule."""
from pathlib import Path
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.deprecated_module import DeprecatedModuleRule
from ansiblelint.testing import RunFromText
MODULE_DEPRECATED = """
- name: Task example
docker:
debug: test
"""
def test_module_... | 877 | Python | .py | 23 | 34.217391 | 78 | 0.744405 | ansible/ansible-lint | 3,433 | 653 | 91 | GPL-3.0 | 9/5/2024, 5:14:14 PM (Europe/Amsterdam) |