Skip to content

Commit

Permalink
Surround top-level function and class definitions with two blank lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
joren485 authored and abadger committed Jul 31, 2018
1 parent 9e31055 commit b954917
Show file tree
Hide file tree
Showing 373 changed files with 408 additions and 28 deletions.
1 change: 1 addition & 0 deletions contrib/inventory/apache-libcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,5 +344,6 @@ def json_format_dict(self, data, pretty=False):
def main():
LibcloudInventory()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions contrib/inventory/apstra_aos.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ def add_device_status_to_var(self, device_name, device):
for key, value in device.value['status'].items():
self.add_var_to_host(device.name, key, value)


# Run the script
if __name__ == '__main__':
AosInventory()
1 change: 1 addition & 0 deletions contrib/inventory/cloudforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,5 @@ def json_format_dict(self, data, pretty=False):
else:
return json.dumps(data)


CloudFormsInventory()
1 change: 1 addition & 0 deletions contrib/inventory/cobbler.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,5 @@ def json_format_dict(self, data, pretty=False):
else:
return json.dumps(data)


CobblerInventory()
1 change: 1 addition & 0 deletions contrib/inventory/consul_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,5 @@ def get_consul_api(self):
token = 'anonymous'
return consul.Consul(host=host, port=port, token=token, scheme=scheme)


ConsulInventory()
1 change: 1 addition & 0 deletions contrib/inventory/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,4 +889,5 @@ def main():

DockerInventory().run()


main()
1 change: 1 addition & 0 deletions contrib/inventory/foreman.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,5 +436,6 @@ def run(self):
self._print_data()
return True


if __name__ == '__main__':
sys.exit(not ForemanInventory().run())
1 change: 1 addition & 0 deletions contrib/inventory/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ def json_format_dict(self, data, pretty=False):
else:
return json.dumps(data)


# Run the script
if __name__ == '__main__':
GceInventory()
1 change: 1 addition & 0 deletions contrib/inventory/lxc_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ def main(argv):
else:
print("Need an argument, either --list or --host <host>", file=sys.stderr)


if __name__ == '__main__':
main(sys.argv)
1 change: 1 addition & 0 deletions contrib/inventory/mdt_dynamic_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def parse_cli_args(self):
parser.add_argument('--host', action='store', help='Get all the variables about a specific instance')
self.args = parser.parse_args()


if __name__ == "__main__":
# Run the script
MDTInventory()
1 change: 1 addition & 0 deletions contrib/inventory/nagios_livestatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,5 @@ def __init__(self):
else:
sys.exit("usage: --list or --host HOSTNAME [--pretty]")


NagiosLivestatusInventory()
1 change: 1 addition & 0 deletions contrib/inventory/nagios_ndo.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,5 @@ def __init__(self):
else:
sys.exit("Error: Database configuration is missing. See nagios_ndo.ini.")


NagiosNDOInventory()
1 change: 1 addition & 0 deletions contrib/inventory/nsot.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,5 +339,6 @@ def main():
elif args.host:
print(client.do_host(args.host))


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions contrib/inventory/ovirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,6 @@ def json_format_dict(data, pretty=False):
else:
return json.dumps(data)


# Run the script
OVirtInventory()
1 change: 1 addition & 0 deletions contrib/inventory/ovirt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,6 @@ def main():
)
)


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion contrib/inventory/rax.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def load_config_file():
return None
else:
return p
p = load_config_file()


def rax_slugify(value):
Expand Down Expand Up @@ -469,5 +468,6 @@ def main():
sys.exit(0)


p = load_config_file()
if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions contrib/inventory/rudder.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,5 +294,6 @@ def to_safe(self, word):

return re.sub(r'[^A-Za-z0-9\_]', '_', word)


# Run the script
RudderInventory()
1 change: 1 addition & 0 deletions contrib/inventory/softlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,5 @@ def get_all_servers(self):
self.get_virtual_servers()
self.get_physical_servers()


SoftLayerInventory()
1 change: 1 addition & 0 deletions contrib/inventory/vbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def default(self, obj):
return list(obj)
return json.JSONEncoder.default(self, obj)


VBOX = "VBoxManage"


Expand Down
1 change: 1 addition & 0 deletions contrib/inventory/zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,5 @@ def __init__(self):
print("Error: Configuration of server and credentials are required. See zabbix.ini.", file=sys.stderr)
sys.exit(1)


ZabbixInventory()
1 change: 1 addition & 0 deletions examples/scripts/uptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ def main():
for host, result in callback.host_unreachable.items():
print('{0} >>> {1}'.format(host, result._result['msg']))


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions hacking/get_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ def main():
print(C.DEFAULT_MODULE_PATH)
return 0


if __name__ == '__main__':
sys.exit(main())
2 changes: 2 additions & 0 deletions lib/ansible/compat/selectors/_selectors2.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def _fileobj_to_fd(fileobj):
raise ValueError("Invalid file descriptor: {0}".format(fd))
return fd


# Python 3.5 uses a more direct route to wrap system calls to increase speed.
if sys.version_info >= (3, 5):
def _syscall_wrapper(func, _, *args, **kwargs):
Expand Down Expand Up @@ -305,6 +306,7 @@ def __enter__(self):
def __exit__(self, *args):
self.close()


# Almost all platforms have select.select()
if hasattr(select, "select"):
class SelectSelector(BaseSelector):
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/module_utils/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SQLParseError(Exception):
class UnclosedQuoteError(SQLParseError):
pass


# maps a type of identifier to the maximum number of dot levels that are
# allowed to specify that identifier. For example, a database column can be
# specified by up to 4 levels: database.schema.table.column
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/module_utils/k8s/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def list_dict_str(value):
return value
raise TypeError


ARG_ATTRIBUTES_BLACKLIST = ('property_path',)

COMMON_ARG_SPEC = {
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/module_utils/network/aci/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def aci_argument_spec():
validate_certs=dict(type='bool', default=True),
)


'''
URL_MAPPING = dict(
action_rule=dict(aci_class='rtctrlAttrP', mo='attr-', key='name'),
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/module_utils/network/cnos/cnos_devicerules.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def getRuleString(deviceType, variableId):
return retVal
# EOM


default_cnos = {
'vlan_id': 'INTEGER_VALUE:1-3999',
'vlan_id_range': 'INTEGER_VALUE_RANGE:1-3999',
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/module_utils/pycompat24.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def get_exception():
"""
return sys.exc_info()[1]


try:
# Python 2.6+
from ast import literal_eval
Expand Down
2 changes: 2 additions & 0 deletions lib/ansible/module_utils/six/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def get_code(self, fullname):
return None
get_source = get_code # same as get_code


_importer = _SixMetaPathImporter(__name__)


Expand Down Expand Up @@ -490,6 +491,7 @@ class Module_six_moves_urllib(types.ModuleType):
def __dir__(self):
return ['parse', 'error', 'request', 'response', 'robotparser']


_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
"moves.urllib")

Expand Down
1 change: 1 addition & 0 deletions lib/ansible/module_utils/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class NoSSLError(SSLValidationError):
"""Needed to connect to an HTTPS url but no ssl library available to verify the certificate"""
pass


# Some environments (Google Compute Engine's CoreOS deploys) do not compile
# against openssl and thus do not have any HTTPS support.
CustomHTTPSConnection = CustomHTTPSHandler = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,6 @@ def main():

module.exit_json(**result)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/aws_glue_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,6 @@ def main():
else:
delete_glue_connection(connection_glue, module, glue_connection)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/aws_glue_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,5 +361,6 @@ def main():
else:
delete_glue_job(connection, module, glue_job)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/aws_s3_cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,6 @@ def main():
elif state == 'absent':
destroy_bucket_cors(client, module)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/ec2_vpc_vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,5 +727,6 @@ def main():

module.exit_json(changed=changed, **camel_dict_to_snake_dict(response))


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/elasticache.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,6 @@ def main():

module.exit_json(**facts_result)


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,6 @@ def main():

module.exit_json(**facts_result)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/elb_application_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,5 +569,6 @@ def main():
else:
delete_elb(elb)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/elb_network_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,5 +415,6 @@ def main():
else:
delete_elb(elb)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/elb_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,6 @@ def main():
else:
deregister_target(connection, module)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/amazon/route53_health_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def to_template_params(health_check):
params['string_match_part'] = HealthCheck.XMLStringMatchPart % {'string_match': health_check.string_match}
return params


XMLResourcePathPart = """<ResourcePath>%(resource_path)s</ResourcePath>"""

POSTXMLBody = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,6 @@ def main():
"""Main execution"""
AzureRMAvailabilitySet()


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,6 @@ def main():

AzureRMAvailabilitySetFacts()


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -424,5 +424,6 @@ def main():
"""Main execution"""
AzureRMContainerInstance()


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -424,5 +424,6 @@ def main():
"""Main execution"""
AzureRMContainerRegistry()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,6 @@ def gethash(self):
def main():
AzureRMRecordSet()


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,6 @@ def list_zone(self):
def main():
AzureRMRecordSetFacts()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_dnszone.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,6 @@ def zone_to_dict(zone):
def main():
AzureRMDNSZone()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,6 @@ def list_items(self):
def main():
AzureRMDNSZoneFacts()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_functionapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,6 @@ def main():

AzureRMFunctionApp()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,6 @@ def delete_image(self):
def main():
AzureRMImage()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_keyvault.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,5 +489,6 @@ def main():
"""Main execution"""
AzureRMVaults()


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions lib/ansible/modules/cloud/azure/azure_rm_keyvaultkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@ def _set_rsa_parameters(dest, src):
def main():
AzureRMKeyVaultKey()


if __name__ == '__main__':
main()
Loading

0 comments on commit b954917

Please sign in to comment.