This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
url = "https://github.com/charliermarsh/ruff/issues/970" | |
response = requests.get(url) | |
html_content = response.content | |
soup = BeautifulSoup(html_content, "html.parser") | |
li_tags = soup.find_all("li") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Convert to feet/inches.""" | |
import math | |
def div32(number: float) -> int: | |
"""Return the closest 32nd of an inch. | |
:param number: number to be divided | |
:return: closest number divided by 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jinja2 | |
def to_template(string): | |
return f"{{{{ {string} }}}}" | |
env = jinja2.Environment() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Copyright 2020 Red Hat | |
# GNU General Public License v3.0+ | |
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
""" | |
flatten a complex object to dot bracket notation | |
""" | |
from __future__ import absolute_import, division, print_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Copyright 2020 Red Hat | |
# GNU General Public License v3.0+ | |
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
""" | |
flatten a complex object to dot bracket notation | |
""" | |
from __future__ import absolute_import, division, print_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# roles/template_test/filter_plugins/eth_builder.py | |
# -*- coding: utf-8 -*- | |
# Copyright 2020 Red Hat | |
# GNU General Public License v3.0+ | |
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
""" | |
sample use of dataclass in filter plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample pypyr file for running CI jobs locally | |
# example usage: | |
# - run with default parameters (python3.10 and ansible 2.13) | |
# $ pypyr run | |
# - run with default paramters, but stop at the first error | |
# $ pypyr run continue_on_error=False | |
# - run with py3.8 and ansible 2.12 | |
# $ pypyr run python_version=3.8 ansible_version=stable-2.12 | |
# - run with py3.10 and milestone, but only unit and sanity | |
# $ pypyr run python_version=3.10 ansible_version=stable-2.12 --groups unit sanity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cspell:ignore dpkg, getent, lineinfile, nxapi, nxos, rglob, ruamel, sysvinit | |
"""A test files updater.""" | |
import logging | |
import ruamel.yaml | |
from pathlib import Path | |
from typing import OrderedDict | |
from ansiblelint.yaml_utils import FormattedYAML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x1 ➜ collection_development ansible-navigator run parse.yml -m stdout --ee false | |
PLAY [localhost] *************************************************************** | |
TASK [Define some data] ******************************************************** | |
ok: [localhost] | |
TASK [Pass text and template_path] ********************************************* | |
ok: [localhost] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
gather_facts: false | |
tasks: | |
- name: Define some data | |
ansible.builtin.set_fact: | |
data: | |
wan: | |
- name: LAN3 | |
ipv4-address: 100.100.100.1 | |
subnet-mask: 255.255.255.248 |
NewerOlder