| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8c3f21d commit c033fb3
72 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,5 +22,4 @@ test/ | |||
| 22 | 22 | tests/ | |
| 23 | 23 | src/Builds/ | |
| 24 | 24 | src/hl2sdk/* | |
| 25 | - !src/hl2sdk/readme.txt | ||
| 26 | 25 | !src/hl2sdk/readme.md | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,8 +38,8 @@ | |||
| 38 | 38 | # Cvars | |
| 39 | 39 | from cvars import ConVar | |
| 40 | 40 | # 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 | ||
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | 45 | # ============================================================================= | |
@@ -49,15 +49,15 @@ | |||
| 49 | 49 | try: | |
| 50 | 50 | ||
| 51 | 51 | # Import the core settings dictionary | |
| 52 | - from core.settings import _CoreSettingsInstance | ||
| 52 | + from core.settings import _core_settings | ||
| 53 | 53 | ||
| 54 | 54 | # Set the logging level | |
| 55 | 55 | ConVar('sp_logging_level').set_int( | |
| 56 | - int(_CoreSettingsInstance['LOG_SETTINGS']['level'])) | ||
| 56 | + int(_core_settings['LOG_SETTINGS']['level'])) | ||
| 57 | 57 | ||
| 58 | 58 | # Set the logging areas | |
| 59 | 59 | ConVar('sp_logging_areas').set_int( | |
| 60 | - int(_CoreSettingsInstance['LOG_SETTINGS']['areas'])) | ||
| 60 | + int(_core_settings['LOG_SETTINGS']['areas'])) | ||
| 61 | 61 | ||
| 62 | 62 | # Was an exception raised? | |
| 63 | 63 | except (ValueError, ConfigObjError): | |
@@ -68,11 +68,11 @@ | |||
| 68 | 68 | # Set the logging area to include console, SP logs, and main log | |
| 69 | 69 | ConVar('sp_logging_areas').set_int(7) | |
| 70 | 70 | ||
| 71 | - # Import the _SPLogger | ||
| 72 | - from loggers import _SPLogger | ||
| 71 | + # Import the _sp_logger | ||
| 72 | + from loggers import _sp_logger | ||
| 73 | 73 | ||
| 74 | 74 | # Log a message about the value | |
| 75 | - _SPLogger.log_message( | ||
| 75 | + _sp_logger.log_message( | ||
| 76 | 76 | '[Source.Python] Plugin did not load properly ' + | |
| 77 | 77 | 'due to the following error:') | |
| 78 | 78 | ||
@@ -84,59 +84,59 @@ | |||
| 84 | 84 | # >> TRANSLATIONS SETUP | |
| 85 | 85 | # ============================================================================= | |
| 86 | 86 | # Import the Language Manager | |
| 87 | - from translations.manager import LanguageManager | ||
| 87 | + from translations.manager import language_manager | ||
| 88 | 88 | ||
| 89 | 89 | # 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']) | ||
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | 94 | # ============================================================================= | |
| 95 | 95 | # >> INITIALIZE SP COMMAND | |
| 96 | 96 | # ============================================================================= | |
| 97 | - from core.command import _CoreCommandInstance | ||
| 97 | + from core.command import _core_command | ||
| 98 | 98 | ||
| 99 | 99 | ||
| 100 | 100 | # ============================================================================= | |
| 101 | 101 | # >> AUTH SETUP | |
| 102 | 102 | # ============================================================================= | |
| 103 | 103 | # 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() | ||
| 105 | 105 | ||
| 106 | 106 | # Should any providers be loaded? | |
| 107 | 107 | if auth_providers: | |
| 108 | 108 | ||
| 109 | 109 | # Load the auth providers | |
| 110 | - _CoreCommandInstance.call_command('auth', ['load'] + auth_providers) | ||
| 110 | + _core_command.call_command('auth', ['load'] + auth_providers) | ||
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | 113 | # ============================================================================= | |
| 114 | 114 | # >> USER_SETTINGS SETUP | |
| 115 | 115 | # ============================================================================= | |
| 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 | ||
| 119 | 119 | ||
| 120 | 120 | # 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']: | ||
| 122 | 122 | ||
| 123 | 123 | # Register the private user settings say commands | |
| 124 | - SayCommandManager.register_commands(_CoreSettingsInstance[ | ||
| 124 | + say_command_manager.register_commands(_core_settings[ | ||
| 125 | 125 | 'USER_SETTINGS']['private_say_commands'].split( | |
| 126 | - ','), _AvailableSettingsDictionary._private_send_menu) | ||
| 126 | + ','), _player_settings._private_send_menu) | ||
| 127 | 127 | ||
| 128 | 128 | # 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']: | ||
| 130 | 130 | ||
| 131 | 131 | # Register the public user settings say commands | |
| 132 | - SayCommandManager.register_commands(_CoreSettingsInstance[ | ||
| 132 | + say_command_manager.register_commands(_core_settings[ | ||
| 133 | 133 | 'USER_SETTINGS']['public_say_commands'].split( | |
| 134 | - ','), _AvailableSettingsDictionary._send_menu) | ||
| 134 | + ','), _player_settings._send_menu) | ||
| 135 | 135 | ||
| 136 | 136 | # Are there any client user settings commands? | |
| 137 | - if _CoreSettingsInstance['USER_SETTINGS']['client_commands']: | ||
| 137 | + if _core_settings['USER_SETTINGS']['client_commands']: | ||
| 138 | 138 | ||
| 139 | 139 | # Register the client user settings commands | |
| 140 | - ClientCommandManager.register_commands(_CoreSettingsInstance[ | ||
| 140 | + client_command_manager.register_commands(_core_settings[ | ||
| 141 | 141 | 'USER_SETTINGS']['client_commands'].split( | |
| 142 | - ','), _AvailableSettingsDictionary._send_menu) | ||
| 142 | + ','), _player_settings._send_menu) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ | |||
| 7 | 7 | # ============================================================================= | |
| 8 | 8 | # Source.Python Imports | |
| 9 | 9 | # Loggers | |
| 10 | - from loggers import _SPLogger | ||
| 10 | + from loggers import _sp_logger | ||
| 11 | 11 | # Translations | |
| 12 | 12 | from translations.strings import LangStrings | |
| 13 | 13 | ||
@@ -16,7 +16,7 @@ | |||
| 16 | 16 | # >> GLOBAL VARIABLES | |
| 17 | 17 | # ============================================================================= | |
| 18 | 18 | # Get the sp.auth logger | |
| 19 | - AuthLogger = _SPLogger.auth | ||
| 19 | + auth_logger = _sp_logger.auth | ||
| 20 | 20 | ||
| 21 | 21 | # Get the auth language strings | |
| 22 | 22 | _auth_strings = LangStrings('_core/auth_strings') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ | |||
| 7 | 7 | # ============================================================================= | |
| 8 | 8 | # Source.Python Imports | |
| 9 | 9 | # Auth | |
| 10 | - from auth import AuthLogger | ||
| 10 | + from auth import auth_logger | ||
| 11 | 11 | from auth import _auth_strings | |
| 12 | 12 | ||
| 13 | 13 | ||
@@ -22,7 +22,7 @@ | |||
| 22 | 22 | # >> GLOBAL VARIABLES | |
| 23 | 23 | # ============================================================================= | |
| 24 | 24 | # Get sp.auth.base logger | |
| 25 | - AuthBaseLogger = AuthLogger.base | ||
| 25 | + auth_base_logger = auth_logger.base | ||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | 28 | # ============================================================================= | |
@@ -34,13 +34,13 @@ class AuthBase(object): | |||
| 34 | 34 | ||
| 35 | 35 | def load(self): | |
| 36 | 36 | """Base implementation of load that if called will print an error.""" | |
| 37 | - AuthBaseLogger.log_warning( | ||
| 37 | + auth_base_logger.log_warning( | ||
| 38 | 38 | '[SP Auth] ' + _auth_strings['Not Implemented'].get_string( | |
| 39 | 39 | classname=self.__class__.__name__, method='load')) | |
| 40 | 40 | ||
| 41 | 41 | def unload(self): | |
| 42 | 42 | """Base implementation of unload that if called will print an error.""" | |
| 43 | - AuthBaseLogger.log_warning( | ||
| 43 | + auth_base_logger.log_warning( | ||
| 44 | 44 | '[SP Auth] ' + _auth_strings['Not Implemented'].get_string( | |
| 45 | 45 | classname=self.__class__.__name__, method='unload')) | |
| 46 | 46 | ||
@@ -49,7 +49,7 @@ def is_player_authorized(self, *args): | |||
| 49 | 49 | ||
| 50 | 50 | If base method is called, it will print an error. | |
| 51 | 51 | """ | |
| 52 | - AuthBaseLogger.log_warning( | ||
| 52 | + auth_base_logger.log_warning( | ||
| 53 | 53 | '[SP Auth] ' + _auth_strings['Not Implemented'].get_string( | |
| 54 | 54 | classname=self.__class__.__name__, | |
| 55 | 55 | method='is_player_authorized')) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,16 +11,16 @@ | |||
| 11 | 11 | ||
| 12 | 12 | # Source.Python imports | |
| 13 | 13 | # Auth | |
| 14 | - from auth import AuthLogger | ||
| 14 | + from auth import auth_logger | ||
| 15 | 15 | from auth import _auth_strings | |
| 16 | - from auth.manager import AuthManager | ||
| 16 | + from auth.manager import auth_manager | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | 19 | # ============================================================================= | |
| 20 | 20 | # >> GLOBAL VARIABLES | |
| 21 | 21 | # ============================================================================= | |
| 22 | 22 | # Get the sp.auth.commands logger | |
| 23 | - AuthCommandsLogger = AuthLogger.commands | ||
| 23 | + auth_commands_logger = auth_logger.commands | ||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 | # ============================================================================= | |
@@ -84,7 +84,7 @@ def print_auth_help(self, message=''): | |||
| 84 | 84 | ||
| 85 | 85 | def print_help(self, pretext='', posttext=''): | |
| 86 | 86 | """Print all "sp auth" sub-commands.""" | |
| 87 | - AuthCommandsLogger.log_message( | ||
| 87 | + auth_commands_logger.log_message( | ||
| 88 | 88 | pretext + '\n' + self.get_help_text() + '\n' + posttext) | |
| 89 | 89 | ||
| 90 | 90 | def get_help_text(self): | |
@@ -120,7 +120,7 @@ def _load_auth_providers(providers): | |||
| 120 | 120 | if not providers: | |
| 121 | 121 | ||
| 122 | 122 | # Send a message about the required argument | |
| 123 | - AuthCommandsLogger.log_message( | ||
| 123 | + auth_commands_logger.log_message( | ||
| 124 | 124 | '[SP Auth] ' + _auth_strings['Missing Load'].get_string()) | |
| 125 | 125 | ||
| 126 | 126 | # No need to go further | |
@@ -130,7 +130,7 @@ def _load_auth_providers(providers): | |||
| 130 | 130 | for provider in providers: | |
| 131 | 131 | ||
| 132 | 132 | # Load the current provider | |
| 133 | - AuthManager.load_auth(provider) | ||
| 133 | + auth_manager.load_auth(provider) | ||
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | 136 | def _unload_auth_providers(providers): | |
@@ -139,7 +139,7 @@ def _unload_auth_providers(providers): | |||
| 139 | 139 | if not providers: | |
| 140 | 140 | ||
| 141 | 141 | # Send a message about the required argument | |
| 142 | - AuthCommandsLogger.log_message( | ||
| 142 | + auth_commands_logger.log_message( | ||
| 143 | 143 | '[SP Auth] ' + _auth_strings['Missing Unload'].get_string()) | |
| 144 | 144 | ||
| 145 | 145 | # No need to go further | |
@@ -149,7 +149,7 @@ def _unload_auth_providers(providers): | |||
| 149 | 149 | for provider in providers: | |
| 150 | 150 | ||
| 151 | 151 | # Unload the current provider | |
| 152 | - AuthManager.unload_auth(provider) | ||
| 152 | + auth_manager.unload_auth(provider) | ||
| 153 | 153 | ||
| 154 | 154 | ||
| 155 | 155 | def _reload_auth_providers(providers=None): | |
@@ -158,13 +158,13 @@ def _reload_auth_providers(providers=None): | |||
| 158 | 158 | if not providers: | |
| 159 | 159 | ||
| 160 | 160 | # Set providers to all currently loaded providers | |
| 161 | - providers = list(AuthManager) | ||
| 161 | + providers = list(auth_manager) | ||
| 162 | 162 | ||
| 163 | 163 | # Loop through the providers | |
| 164 | 164 | for provider in providers: | |
| 165 | 165 | ||
| 166 | 166 | # Reload the given provider | |
| 167 | - AuthManager.reload_auth(provider) | ||
| 167 | + auth_manager.reload_auth(provider) | ||
| 168 | 168 | ||
| 169 | 169 | ||
| 170 | 170 | def _print_auth_providers(): | |
@@ -174,25 +174,25 @@ def _print_auth_providers(): | |||
| 174 | 174 | 'Providers'].get_string() + '\n' + '=' * 61 + '\n' | |
| 175 | 175 | ||
| 176 | 176 | # Loop through all loaded auth providers | |
| 177 | - for provider in AuthManager: | ||
| 177 | + for provider in auth_manager: | ||
| 178 | 178 | ||
| 179 | 179 | # Add the current provider to the message | |
| 180 | 180 | message += provider + '\n' | |
| 181 | 181 | ||
| 182 | 182 | # Print ending messages | |
| 183 | - AuthCommandsLogger.log_message(message + '=' * 61) | ||
| 183 | + auth_commands_logger.log_message(message + '=' * 61) | ||
| 184 | 184 | ||
| 185 | 185 | # Get the _AuthCommands instance | |
| 186 | - _AuthCommandsInstance = _AuthCommands() | ||
| 186 | + _auth_commands = _AuthCommands() | ||
| 187 | 187 | ||
| 188 | 188 | # 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]', '...'] | ||
| 195 | 195 | ||
| 196 | 196 | # 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 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments