This repository has been archived by the owner on Dec 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring to read hitlocation and weapon code values from the B3 pa…
…rser if it provides them
- Loading branch information
1 parent
126bfe3
commit e17a25a
Showing
6 changed files
with
137 additions
and
90 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import b3.output # do not remove, needed because the module alters some defaults of the logging module | ||
import logging | ||
|
||
|
||
class logging_disabled(object): | ||
""" | ||
context manager that temporarily disable logging. | ||
USAGE: | ||
with logging_disabled(): | ||
# do stuff | ||
""" | ||
DISABLED = False | ||
|
||
def __init__(self): | ||
self.nested = logging_disabled.DISABLED | ||
|
||
def __enter__(self): | ||
if not self.nested: | ||
logging.getLogger('output').propagate = False | ||
logging_disabled.DISABLED = True | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
if not self.nested: | ||
logging.getLogger('output').propagate = True | ||
logging_disabled.DISABLED = False |
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
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
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