This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
multipub/.pyenv/lib/python3.7/site-packages/pylint/test/functional/globals.py

33 lines
806 B
Python
Raw Normal View History

2019-02-09 02:45:25 -06:00
"""Warnings about global statements and usage of global variables."""
from __future__ import print_function
global CSTE # [global-at-module-level]
print(CSTE) # [undefined-variable]
CONSTANT = 1
def fix_contant(value):
"""all this is ok, but try not using global ;)"""
global CONSTANT # [global-statement]
print(CONSTANT)
CONSTANT = value
def other():
"""global behaviour test"""
global HOP # [global-variable-not-assigned]
print(HOP) # [undefined-variable]
def define_constant():
"""ok but somevar is not defined at the module scope"""
global SOMEVAR # [global-variable-undefined]
SOMEVAR = 2
# pylint: disable=invalid-name
def global_with_import():
"""should only warn for global-statement"""
global sys # [global-statement]
import sys