This file contains hidden or 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
| if sys.version_info.major == 2: | |
| BaseStrType_ = basestring | |
| else: | |
| BaseStrType_ = str |
This file contains hidden or 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
| import platform | |
| import logging | |
| from logging.handlers import RotatingFileHandler | |
| class ConsoleLogger: | |
| handlers = [ | |
| (logging.StreamHandler, | |
| dict(), | |
| logging.DEBUG), |
This file contains hidden or 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
| generateDS.py -o scenario.py -f --super=scenario C:\path\to\file\Scenario.xsd | |
| # Если нужен сабмодуль (не нужная вещь) | |
| generateDS.py -o scenario.py -s scenariosubs.py -f --super=scenario C:\path\to\file\Scenario.xsd |
This file contains hidden or 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
| import pickle | |
| with open('data.pickle', 'wb') as f: | |
| pickle.dump(old_data, f, pickle.HIGHEST_PROTOCOL) | |
| with open(r'C:\path\to\file.pkl', 'rb') as f: | |
| new_data = pickle.load(f) |
This file contains hidden or 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
| import functools | |
| def debug(func): | |
| @functools.wraps(func) | |
| def wrapper_debug(*args, **kwargs): | |
| args_repr = [repr(a) for a in args] | |
| kwargs_repr = [f"{k}={v!r}" for k, v in kwargs.items()] | |
| signature = ", ".join(args_repr + kwargs_repr) | |
| print(f"Вызываем {func.__name__}({signature})") | |
| value = func(*args, **kwargs) |
This file contains hidden or 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
| # Byte-compiled / optimized / DLL files | |
| __pycache__/ | |
| *.py[cod] | |
| # C extensions | |
| *.so | |
| # Distribution / packaging | |
| .Python | |
| env/ |
This file contains hidden or 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
| from datetime import datetime | |
| datetime.now().strftime('%Y-%m-%d %H:%M:%S') |
This file contains hidden or 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
| import importlib | |
| import sys | |
| robot_folder_path = r'full\path\to\folder\with\packages' | |
| module_name = 'PackageName' | |
| file_path = f'{robot_folder_path}\\{module_name}\\__init__.py' | |
| spec = importlib.util.spec_from_file_location(module_name, file_path) | |
| module = importlib.util.module_from_spec(spec) | |
| sys.modules[module_name] = module |
This file contains hidden or 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
| 1. | |
| ls -la /etc | |
| ls -la /proc | |
| ls -la /home | |
| ___________________________________________ | |
| 2. | |
| cat - в основном служит для чтения файла и объяденения содержимого нескольких файлов в один. | |
| cat /etc/adduser.conf > file1 |
This file contains hidden or 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
| git config --global user.name [name] # set up user name | |
| git config --global user.email [email] # set up user email | |
| git config --global color.ui auto # if git command returns error msg. Msg will be highlighted red | |
| git init # initialize repo | |
| git remote add origin https://github.com/Farrukhraz/folder.git # synchronize local and remote repo's | |
| git remote -v # check if synchronization is done | |
| git status # current status | |
| git add . # to include in what will be commited |