FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Updated many Python-side global variables to their proper naming sche… · ericentin/Source.Python@c033fb3 · GitHub

Repository navigation

Commit c033fb3

Browse files
committed
Updated many Python-side global variables to their proper naming scheme (lower_case_with_underscores).
Updated all defined Color instances in colors.py to be use their proper constant naming scheme (UPPER_CASE_WITH_UNDERSCORES). Removed file from .gitignore that has already been removed from the repository. The naming scheme updates are almost done on the Python-side. The C++ side will be updated soon, as well.
1 parent 8c3f21d commit c033fb3

72 files changed

Lines changed: 482 additions & 485 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ test/
2222
tests/
2323
src/Builds/
2424
src/hl2sdk/*
25-
!src/hl2sdk/readme.txt
2625
!src/hl2sdk/readme.md

‎addons/source-python/packages/source-python/__init__.py‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
# Cvars
3939
from cvars import ConVar
4040
# Hooks - These are imported to implement the exceptions and warnings hooks
41-
from hooks.exceptions import ExceptHooks
42-
from hooks.warnings import WarningHooks
41+
from hooks.exceptions import except_hooks
42+
from hooks.warnings import warning_hooks
4343

4444

4545
# =============================================================================
@@ -49,15 +49,15 @@
4949
try:
5050

5151
# Import the core settings dictionary
52-
from core.settings import _CoreSettingsInstance
52+
from core.settings import _core_settings
5353

5454
# Set the logging level
5555
ConVar('sp_logging_level').set_int(
56-
int(_CoreSettingsInstance['LOG_SETTINGS']['level']))
56+
int(_core_settings['LOG_SETTINGS']['level']))
5757

5858
# Set the logging areas
5959
ConVar('sp_logging_areas').set_int(
60-
int(_CoreSettingsInstance['LOG_SETTINGS']['areas']))
60+
int(_core_settings['LOG_SETTINGS']['areas']))
6161

6262
# Was an exception raised?
6363
except (ValueError, ConfigObjError):
@@ -68,11 +68,11 @@
6868
# Set the logging area to include console, SP logs, and main log
6969
ConVar('sp_logging_areas').set_int(7)
7070

71-
# Import the _SPLogger
72-
from loggers import _SPLogger
71+
# Import the _sp_logger
72+
from loggers import _sp_logger
7373

7474
# Log a message about the value
75-
_SPLogger.log_message(
75+
_sp_logger.log_message(
7676
'[Source.Python] Plugin did not load properly ' +
7777
'due to the following error:')
7878

@@ -84,59 +84,59 @@
8484
# >> TRANSLATIONS SETUP
8585
# =============================================================================
8686
# Import the Language Manager
87-
from translations.manager import LanguageManager
87+
from translations.manager import language_manager
8888

8989
# Set the default language
90-
LanguageManager._register_default_language(
91-
_CoreSettingsInstance['BASE_SETTINGS']['language'])
90+
language_manager._register_default_language(
91+
_core_settings['BASE_SETTINGS']['language'])
9292

9393

9494
# =============================================================================
9595
# >> INITIALIZE SP COMMAND
9696
# =============================================================================
97-
from core.command import _CoreCommandInstance
97+
from core.command import _core_command
9898

9999

100100
# =============================================================================
101101
# >> AUTH SETUP
102102
# =============================================================================
103103
# Get the auth providers that should be loaded
104-
auth_providers = _CoreSettingsInstance['AUTH_SETTINGS']['providers'].split()
104+
auth_providers = _core_settings['AUTH_SETTINGS']['providers'].split()
105105

106106
# Should any providers be loaded?
107107
if auth_providers:
108108

109109
# Load the auth providers
110-
_CoreCommandInstance.call_command('auth', ['load'] + auth_providers)
110+
_core_command.call_command('auth', ['load'] + auth_providers)
111111

112112

113113
# =============================================================================
114114
# >> USER_SETTINGS SETUP
115115
# =============================================================================
116-
from commands.client import ClientCommandManager
117-
from commands.say import SayCommandManager
118-
from settings.menu import _AvailableSettingsDictionary
116+
from commands.client import client_command_manager
117+
from commands.say import say_command_manager
118+
from settings.menu import _player_settings
119119

120120
# Are there any private user settings say commands?
121-
if _CoreSettingsInstance['USER_SETTINGS']['private_say_commands']:
121+
if _core_settings['USER_SETTINGS']['private_say_commands']:
122122

123123
# Register the private user settings say commands
124-
SayCommandManager.register_commands(_CoreSettingsInstance[
124+
say_command_manager.register_commands(_core_settings[
125125
'USER_SETTINGS']['private_say_commands'].split(
126-
','), _AvailableSettingsDictionary._private_send_menu)
126+
','), _player_settings._private_send_menu)
127127

128128
# Are there any public user settings say commands?
129-
if _CoreSettingsInstance['USER_SETTINGS']['public_say_commands']:
129+
if _core_settings['USER_SETTINGS']['public_say_commands']:
130130

131131
# Register the public user settings say commands
132-
SayCommandManager.register_commands(_CoreSettingsInstance[
132+
say_command_manager.register_commands(_core_settings[
133133
'USER_SETTINGS']['public_say_commands'].split(
134-
','), _AvailableSettingsDictionary._send_menu)
134+
','), _player_settings._send_menu)
135135

136136
# Are there any client user settings commands?
137-
if _CoreSettingsInstance['USER_SETTINGS']['client_commands']:
137+
if _core_settings['USER_SETTINGS']['client_commands']:
138138

139139
# Register the client user settings commands
140-
ClientCommandManager.register_commands(_CoreSettingsInstance[
140+
client_command_manager.register_commands(_core_settings[
141141
'USER_SETTINGS']['client_commands'].split(
142-
','), _AvailableSettingsDictionary._send_menu)
142+
','), _player_settings._send_menu)

‎addons/source-python/packages/source-python/auth/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# =============================================================================
88
# Source.Python Imports
99
# Loggers
10-
from loggers import _SPLogger
10+
from loggers import _sp_logger
1111
# Translations
1212
from translations.strings import LangStrings
1313

@@ -16,7 +16,7 @@
1616
# >> GLOBAL VARIABLES
1717
# =============================================================================
1818
# Get the sp.auth logger
19-
AuthLogger = _SPLogger.auth
19+
auth_logger = _sp_logger.auth
2020

2121
# Get the auth language strings
2222
_auth_strings = LangStrings('_core/auth_strings')

‎addons/source-python/packages/source-python/auth/base.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# =============================================================================
88
# Source.Python Imports
99
# Auth
10-
from auth import AuthLogger
10+
from auth import auth_logger
1111
from auth import _auth_strings
1212

1313

@@ -22,7 +22,7 @@
2222
# >> GLOBAL VARIABLES
2323
# =============================================================================
2424
# Get sp.auth.base logger
25-
AuthBaseLogger = AuthLogger.base
25+
auth_base_logger = auth_logger.base
2626

2727

2828
# =============================================================================
@@ -34,13 +34,13 @@ class AuthBase(object):
3434

3535
def load(self):
3636
"""Base implementation of load that if called will print an error."""
37-
AuthBaseLogger.log_warning(
37+
auth_base_logger.log_warning(
3838
'[SP Auth] ' + _auth_strings['Not Implemented'].get_string(
3939
classname=self.__class__.__name__, method='load'))
4040

4141
def unload(self):
4242
"""Base implementation of unload that if called will print an error."""
43-
AuthBaseLogger.log_warning(
43+
auth_base_logger.log_warning(
4444
'[SP Auth] ' + _auth_strings['Not Implemented'].get_string(
4545
classname=self.__class__.__name__, method='unload'))
4646

@@ -49,7 +49,7 @@ def is_player_authorized(self, *args):
4949
5050
If base method is called, it will print an error.
5151
"""
52-
AuthBaseLogger.log_warning(
52+
auth_base_logger.log_warning(
5353
'[SP Auth] ' + _auth_strings['Not Implemented'].get_string(
5454
classname=self.__class__.__name__,
5555
method='is_player_authorized'))

‎addons/source-python/packages/source-python/auth/commands.py‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
# Source.Python imports
1313
# Auth
14-
from auth import AuthLogger
14+
from auth import auth_logger
1515
from auth import _auth_strings
16-
from auth.manager import AuthManager
16+
from auth.manager import auth_manager
1717

1818

1919
# =============================================================================
2020
# >> GLOBAL VARIABLES
2121
# =============================================================================
2222
# Get the sp.auth.commands logger
23-
AuthCommandsLogger = AuthLogger.commands
23+
auth_commands_logger = auth_logger.commands
2424

2525

2626
# =============================================================================
@@ -84,7 +84,7 @@ def print_auth_help(self, message=''):
8484

8585
def print_help(self, pretext='', posttext=''):
8686
"""Print all "sp auth" sub-commands."""
87-
AuthCommandsLogger.log_message(
87+
auth_commands_logger.log_message(
8888
pretext + '\n' + self.get_help_text() + '\n' + posttext)
8989

9090
def get_help_text(self):
@@ -120,7 +120,7 @@ def _load_auth_providers(providers):
120120
if not providers:
121121

122122
# Send a message about the required argument
123-
AuthCommandsLogger.log_message(
123+
auth_commands_logger.log_message(
124124
'[SP Auth] ' + _auth_strings['Missing Load'].get_string())
125125

126126
# No need to go further
@@ -130,7 +130,7 @@ def _load_auth_providers(providers):
130130
for provider in providers:
131131

132132
# Load the current provider
133-
AuthManager.load_auth(provider)
133+
auth_manager.load_auth(provider)
134134

135135

136136
def _unload_auth_providers(providers):
@@ -139,7 +139,7 @@ def _unload_auth_providers(providers):
139139
if not providers:
140140

141141
# Send a message about the required argument
142-
AuthCommandsLogger.log_message(
142+
auth_commands_logger.log_message(
143143
'[SP Auth] ' + _auth_strings['Missing Unload'].get_string())
144144

145145
# No need to go further
@@ -149,7 +149,7 @@ def _unload_auth_providers(providers):
149149
for provider in providers:
150150

151151
# Unload the current provider
152-
AuthManager.unload_auth(provider)
152+
auth_manager.unload_auth(provider)
153153

154154

155155
def _reload_auth_providers(providers=None):
@@ -158,13 +158,13 @@ def _reload_auth_providers(providers=None):
158158
if not providers:
159159

160160
# Set providers to all currently loaded providers
161-
providers = list(AuthManager)
161+
providers = list(auth_manager)
162162

163163
# Loop through the providers
164164
for provider in providers:
165165

166166
# Reload the given provider
167-
AuthManager.reload_auth(provider)
167+
auth_manager.reload_auth(provider)
168168

169169

170170
def _print_auth_providers():
@@ -174,25 +174,25 @@ def _print_auth_providers():
174174
'Providers'].get_string() + '\n' + '=' * 61 + '\n'
175175

176176
# Loop through all loaded auth providers
177-
for provider in AuthManager:
177+
for provider in auth_manager:
178178

179179
# Add the current provider to the message
180180
message += provider + '\n'
181181

182182
# Print ending messages
183-
AuthCommandsLogger.log_message(message + '=' * 61)
183+
auth_commands_logger.log_message(message + '=' * 61)
184184

185185
# Get the _AuthCommands instance
186-
_AuthCommandsInstance = _AuthCommands()
186+
_auth_commands = _AuthCommands()
187187

188188
# Add all auth loading/unloading commands to the dictionary
189-
_AuthCommandsInstance['load'] = _load_auth_providers
190-
_AuthCommandsInstance['load'].args = ['<provider>', '[provider]', '...']
191-
_AuthCommandsInstance['unload'] = _unload_auth_providers
192-
_AuthCommandsInstance['unload'].args = ['<provider>', '[provider]', '...']
193-
_AuthCommandsInstance['reload'] = _reload_auth_providers
194-
_AuthCommandsInstance['reload'].args = ['[provider]', '[provider]', '...']
189+
_auth_commands['load'] = _load_auth_providers
190+
_auth_commands['load'].args = ['<provider>', '[provider]', '...']
191+
_auth_commands['unload'] = _unload_auth_providers
192+
_auth_commands['unload'].args = ['<provider>', '[provider]', '...']
193+
_auth_commands['reload'] = _reload_auth_providers
194+
_auth_commands['reload'].args = ['[provider]', '[provider]', '...']
195195

196196
# Add all printing commands to the dictionary
197-
_AuthCommandsInstance['list'] = _print_auth_providers
198-
_AuthCommandsInstance['help'] = _AuthCommandsInstance.print_auth_help
197+
_auth_commands['list'] = _print_auth_providers
198+
_auth_commands['help'] = _auth_commands.print_auth_help

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL