#------------------------------------------------------------------------------- # Author: Bob Daribouca # # Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python from _logging._logging import logged, mkLogger import _slpp, logging, Exceptions, mizfile, os.path mkLogger(__name__,logging.INFO) class Mission(): """ Context-manager pour la classe __ManagedMission Le contexte permet de s'assurer que toutes les opérations satellites sont effectuées avant et après l'instanciationde l'object "Mission" """ def __init__(self, path_to_miz_file, temp_dir=None): self.path_to_miz_file = path_to_miz_file self.temp_dir = temp_dir def __enter__(self): self.mission_object = _ManagedMission(self.path_to_miz_file,self.temp_dir) return self.mission_object
import os import sys import winreg import traceback from time import strftime, gmtime from lib.configobj import ConfigObj from mod import Mod import config from config import Config import ui_server from bobgit.git import Repo from optparse import OptionParser from _logging._logging import mkLogger, DEBUG, WARN logger = mkLogger(__name__, DEBUG, "../logs/{} - TDCSKI.log".format(strftime("%Y%m%d - %Hh%Mm%S", gmtime()))) mods = [] skins = [] def main(): # config = Config() # print(config.values) # print(config.keys) # print(config.items) # # print(config.get("general", "python_path")) # # config.create("test", "test2", "test3", "test43") # # print(config.get("test", "test2", "test3"))
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: owner # # Created: 21/05/2013 # Copyright: (c) owner 2013 # Licence: <your licence> #------------------------------------------------------------------------------- #!/usr/bin/env python import unittest, glob from _logging._logging import mkLogger, logged, DEBUG, INFO mkLogger(__name__, INFO) if __name__ == '__main__': try: import nose nose.run() except ImportError: import unittest try: from . import test_ground_unit_resolve, tests_slpp except ImportError: import test_ground_unit_resolve, tests_slpp except KeyboardInterrupt: pass test_file_strings = glob.glob('test*.py') module_strings = [str[0:len(str)-3] for str in test_file_strings]
# coding=utf-8 __author__ = 'bob' import os import re import shutil import bobgit.git as git from hashlib import md5 as MD5 from _logging._logging import mkLogger, DEBUG, logged import config import sys import imp logger = mkLogger(__name__, DEBUG) try: conf = config.Config() except: logger.error("votre fichier de configuration est corrompu, supprimez le et j'en réinstallerai un nouveau") input() exit(1) class Mod(): @logged def __init__(self, name, _type, parent_dir, args): self.logger.debug("création d'un Mod") # try: # self.conf = config.Config() # except:
# Purpose: # # Author: owner # # Created: 19/05/2013 # Copyright: (c) owner 2013 # Licence: <your licence> #------------------------------------------------------------------------------- #!/usr/bin/env python try: import bobgit.git as git except ImportError: import git from _logging._logging import logged, mkLogger, DEBUG, INFO, WARN, ERROR logger = mkLogger(__name__, DEBUG) def main(): local = r"C:\Documents and Settings\owner\My Documents\BORIS\TDC\TDCMEME.git" remote = "https://github.com/TDC-bob/_logging.git" repo = git.Repo(local, remote) ## repo.fetch() ## print(repo) ## print(repo.current_commit) repo.checkout("master") print("Press ENTER to close this window") ## input() return remote = "https://github.com/TDC-bob/_logging.git"
#------------------------------------------------------------------------------- # Author: Bob Daribouca # # Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python import logging, makeTemp, mission from _logging._logging import mkLogger, logged logger = mkLogger(__name__, logging.INFO) ##from os.path import isfile, exists, join, abspath, dirname, basename import os, shutil, zipfile, Exceptions ##from os import remove, mkdir, rename, listdir ##from shutil import copyfile, rmtree ##from os.path import exists, basename, dirname ##import string, zipfile, Exceptions class MizFile: """ Représente un fichier *.miz Permet de décompresser, manipuler puis recompresser le fichier pour édition Effectue quelques vérifications de bases quant à l'intégrité du fichier *.miz
# -*- coding: UTF-8 -*- #------------------------------------------------------------------------------- # Author: Bob Daribouca # # Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python from _logging._logging import mkLogger, logged, DEBUG, INFO, WARN, ERROR logger = mkLogger("EXCEPTION") def write_error_to_log(base_info, long_msg, logger=logger): logger.error('''{}\nMessage:\n{}'''.format(base_info, long_msg)) class Error(Exception): def __init__(self, base_info="Pas d'information sur cette erreur", long_msg="Pas de message pour cette erreur", logger=logger): write_error_to_log(base_info, long_msg, logger=logger) class GitRunError(Error): def __init__(self, long_msg="Pas d'information supplémentaire", logger=logger): write_error_to_log("GIT RUN ERROR", long_msg, logger=logger) class GitNotFound(Error): def __init__(self, long_msg="Pas d'information supplémentaire", logger=logger): write_error_to_log("GIT NOT FOUND", long_msg, logger=logger)
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: owner # # Created: 28/05/2013 # Copyright: (c) owner 2013 # Licence: <your licence> #------------------------------------------------------------------------------- #!/usr/bin/env python from _logging._logging import mkLogger logger = mkLogger(__name__) import cherrypy class HelloWorld(): def index(self): return "Hello BEN !" index.exposed = True def http_error_401_hander(status, message, traceback, version): """ Custom handler for 401 error """ if status != "401 Unauthorized": logger.log(u"CherryPy caught an error: %s %s" % (status, message), logger.ERROR) logger.log(traceback, logger.DEBUG)
# Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python import unittest, os from campaign import conflict from campaign.ground_unit import GroundUnit from _logging._logging import mkLogger, logged, DEBUG, INFO, WARN logger=mkLogger(__name__, INFO, "tests.log") number_of_tests_to_run = 10 T54 = { "name":"T54", "role":"assault", "weight": "medium", "unit_type": "vehicle", "against": {"light":75,"medium":50,"heavy":25}, "division":None, "speed_on_map":1, "speed_on_ground":4, "unit_range": 0, "fuel": 4, "ammo": 4,
# Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python import unittest, os from campaign import conflict from campaign.ground_unit import GroundUnit from _logging._logging import mkLogger, logged, DEBUG, INFO, WARN logger = mkLogger(__name__, INFO, "tests.log") number_of_tests_to_run = 10 T54 = { "name": "T54", "role": "assault", "weight": "medium", "unit_type": "vehicle", "against": { "light": 75, "medium": 50, "heavy": 25 }, "division": None, "speed_on_map": 1,
# Author: Bob Daribouca # # Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python import re import Exceptions from _logging._logging import logged, mkLogger, INFO from collections import OrderedDict logger = mkLogger(__name__, INFO) r_SecStart = re.compile(r'^(?P<spaces> *)\[?(?P<name>"?[0-9A-Za-z_]+"?)\]? = $', re.M) def dummy(*args, **kwargs): pass class SLPP: @logged def __init__(self): self.text = '' self.ch = '' self.at = 0 self.len = 0
# Author: Bob Daribouca # # Copyright: (c) Bob Daribouca 2013 # Licence: CC BY-NC-SA 3.0 # # Please refer to the "LICENSE" file distributed with the package, # or to http://creativecommons.org/licenses/by-nc-sa/3.0/ # #------------------------------------------------------------------------------- #!/usr/bin/env python from random import randint from copy import deepcopy from _logging._logging import mkLogger, logged, DEBUG, INFO logger = mkLogger(__name__) class Conflict(): @logged def __init__(self, attacker, defender): self.logger.debug("Instanciating a new conflict between {} (attacking) and {} (defending)" .format(attacker.name, defender.name)) ## self.a = deepcopy(attacker) ## self.d = deepcopy(defender) self.round_count = 0 self.resolved = False self.outcome = "" self.a = attacker self.d = defender self.a.has_fled = False self.d.has_fled = False
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: owner # # Created: 21/05/2013 # Copyright: (c) owner 2013 # Licence: <your licence> #------------------------------------------------------------------------------- #!/usr/bin/env python import unittest, glob from _logging._logging import mkLogger, logged, DEBUG, INFO mkLogger(__name__, INFO) if __name__ == '__main__': try: import nose nose.run() except ImportError: import unittest try: from . import test_ground_unit_resolve, tests_slpp except ImportError: import test_ground_unit_resolve, tests_slpp except KeyboardInterrupt: pass test_file_strings = glob.glob('test*.py') module_strings = [str[0:len(str) - 3] for str in test_file_strings]