Beispiel #1
0
def add_tile_colliders(script_settings):
    try:
        # instantiate the msfsProject and create the necessary resources if it does not exist
        msfs_project = MsfsProject(script_settings.projects_path,
                                   script_settings.project_name,
                                   script_settings.definition_file,
                                   script_settings.author_name,
                                   script_settings.sources_path)

        check_configuration(script_settings, msfs_project)

        if script_settings.backup_enabled:
            msfs_project.backup(
                Path(os.path.abspath(__file__)).stem.replace(
                    SCRIPT_PREFIX, str()))

        isolated_print(EOL)
        msfs_project.add_tile_colliders()

        if script_settings.build_package_enabled:
            build_package(msfs_project, script_settings)

        pr_bg_green("Script correctly applied" + constants.CEND)

    except ScriptError as ex:
        error_report = "".join(ex.value)
        isolated_print(constants.EOL + error_report)
        pr_bg_red("Script aborted" + constants.CEND)
    except RuntimeError as ex:
        isolated_print(constants.EOL + str(ex))
        pr_bg_red("Script aborted" + constants.CEND)
def compress_built_package(script_settings):
    try:
        # instantiate the msfsProject and create the necessary resources if it does not exist
        msfs_project = MsfsProject(script_settings.projects_path,
                                   script_settings.project_name,
                                   script_settings.definition_file,
                                   script_settings.author_name,
                                   script_settings.sources_path,
                                   fast_init=True)

        check_configuration(script_settings,
                            msfs_project,
                            check_built_package=True,
                            check_compressonator=True)

        isolated_print(EOL)
        print_title("COMPRESS BUILT PACKAGE")

        msfs_project.compress_built_package(script_settings)

        if script_settings.build_package_enabled:
            build_package(msfs_project, script_settings)

        pr_bg_green("Script correctly applied" + constants.CEND)

    except ScriptError as ex:
        error_report = "".join(ex.value)
        isolated_print(constants.EOL + error_report)
        pr_bg_red("Script aborted" + constants.CEND)
    except RuntimeError as ex:
        isolated_print(constants.EOL + str(ex))
        pr_bg_red("Script aborted" + constants.CEND)
def optimize_scenery(script_settings):
    try:
        # instantiate the msfsProject and create the necessary resources if it does not exist
        msfs_project = MsfsProject(script_settings.projects_path,
                                   script_settings.project_name,
                                   script_settings.definition_file,
                                   script_settings.author_name,
                                   script_settings.sources_path)

        check_configuration(
            script_settings,
            msfs_project,
            check_optimisation=True,
            check_lily_texture_packer=script_settings.bake_textures_enabled)

        if script_settings.backup_enabled:
            msfs_project.backup(
                Path(os.path.abspath(__file__)).stem.replace(
                    SCRIPT_PREFIX, str()))

        clean_scene()
        msfs_project.optimize(script_settings)

        if script_settings.build_package_enabled:
            build_package(msfs_project, script_settings)

        pr_bg_green("Script correctly applied" + CEND)

    except ScriptError as ex:
        error_report = "".join(ex.value)
        isolated_print(constants.EOL + error_report)
        pr_bg_red("Script aborted" + CEND)
    except RuntimeError as ex:
        isolated_print(constants.EOL + str(ex))
        pr_bg_red("Script aborted" + CEND)
def merge_sceneries(script_settings):
    try:
        # instantiate the msfsProject and create the necessary resources if it does not exist
        msfs_project = MsfsProject(script_settings.projects_path,
                                   script_settings.project_name,
                                   script_settings.definition_file,
                                   script_settings.author_name,
                                   script_settings.sources_path)
        project_folder_to_merge = os.path.dirname(
            script_settings.project_path_to_merge) + os.path.sep
        project_name_to_merge = os.path.relpath(
            script_settings.project_path_to_merge,
            start=project_folder_to_merge)
        msfs_project_to_merge = MsfsProject(
            script_settings.projects_path, project_name_to_merge,
            script_settings.definition_file_to_merge,
            script_settings.author_name, script_settings.sources_path)

        check_configuration(script_settings, msfs_project)
        check_configuration(script_settings, msfs_project_to_merge)

        if script_settings.backup_enabled:
            msfs_project.backup(
                Path(os.path.abspath(__file__)).stem.replace(
                    SCRIPT_PREFIX, str()))

        msfs_project.merge(msfs_project_to_merge)

        if script_settings.build_package_enabled:
            build_package(msfs_project, script_settings)

        pr_bg_green("Script correctly applied" + CEND)

    except ScriptError as ex:
        error_report = "".join(ex.value)
        isolated_print(constants.EOL + error_report)
        pr_bg_red("Script aborted" + CEND)
    except RuntimeError as ex:
        isolated_print(constants.EOL + str(ex))
        pr_bg_red("Script aborted" + CEND)
Beispiel #5
0
# along with twitter2rss.  If not, see <http://www.gnu.org/licenses/>.

def get_search(term):
    """Searches for term and returns the result from Twython."""
    twython = Twython(config.consumer_key, config.consumer_secret,
        config.access_token, config.access_token_secret)

    search = twython.search(q=term)

    return search

def get_rss(term):
    rss_config = {}

    rss_config['title'] = 'Twitter Search for %s' % (term)
    rss_config['link'] = ''
    rss_config['description'] = 'Proxy between Twitter API and RSS'

    twitter2rss = Twitter2Rss(rss_config)

    for tweet in get_search(term)['statuses']:
        twitter2rss.add_tweet_from_twython(tweet)

    return twitter2rss.get_rss()

if __name__ == '__main__':
    utils.check_configuration()

    # Poor man test
    print(get_rss('mendeley'))
Beispiel #6
0
from utils import configure_logging, check_configuration
from v1meo import Vimeo
import sys

configure_logging()
check_configuration()

if len(sys.argv[1:]) > 0:
    video_ids = sys.argv[1:]
else:
    video_ids = [
        257287904, 174711575, 253228558, 259134302, 242489394, 218931671,
        212776244, 210852792, 179894471, 175431434, 136312133, 130884254,
        125577982, 117267988, 110593414, 106527959, 94253228, 82319610,
        78480375, 77508680, 70849253, 67722234, 57689746, 259700795, 187094433,
        187819553, 189750813, 258678587, 190544188, 258693816, 189530509,
        190785902, 191602887, 253772687, 257125928, 256368414, 257012133,
        194353922, 256347169, 193599881, 255508592, 193773669, 150519302,
        253888523, 255627840, 255528714, 255590680, 155855866, 259075537,
        258999878
    ]  # put video_ids here or pass them in the command line

client = Vimeo()
data = client.get_data(video_ids)
client.download_thumbups(data)
Beispiel #7
0
import os
import sys
import argparse
import argparse
import logging

import extensions
import database
import commands
import html2latex
import utils

# Check for the necessary packages, this does a load so they should all get loaded.
if utils.check_configuration(['yaml', 'mkdocs', 'markdown', 'markdown_include', 'mdx_math']):
  sys.exit(1)

import yaml
import mkdocs
from mkdocs.commands import serve, build

from MarkdownTable import MarkdownTable
from MooseObjectParameterTable import MooseObjectParameterTable
from MooseApplicationSyntax import MooseApplicationSyntax

import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())

MOOSE_DIR = os.getenv('MOOSE_DIR', os.path.join(os.getcwd(), 'moose'))
if not os.path.exists(MOOSE_DIR):
  MOOSE_DIR = os.path.join(os.getenv('HOME'), 'projects', 'moose')
Beispiel #8
0
import os
import sys
import argparse
import argparse
import logging

import extensions
import database
import commands
import utils

# Check for the necessary packages, this does a load so they should all get loaded.
if utils.check_configuration(['yaml', 'mkdocs', 'markdown', 'markdown_include', 'mdx_math']):
    sys.exit(1)

import yaml
import mkdocs
from mkdocs.commands import serve, build

from MarkdownTable import MarkdownTable
from MooseObjectParameterTable import MooseObjectParameterTable
from MooseApplicationSyntax import MooseApplicationSyntax

import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())

MOOSE_DIR = os.getenv('MOOSE_DIR', os.path.join(os.getcwd(), 'moose'))
if not os.path.exists(MOOSE_DIR):
    MOOSE_DIR = os.path.join(os.getenv('HOME'), 'projects', 'moose')

class MkMooseDocsFormatter(logging.Formatter):
Beispiel #9
0
It then does a LLH minimization with GF.

Then it outputs a set of parameters from the fit to a json file.
'''

configuration_file = "configuration.json"
# using os to open the file correctly, regardless of how this script is called
f = open(os.path.join(os.path.dirname(__file__), configuration_file), 'r')
config = json.load(f)
f.close()

# load in configuration data
# do the implicit conversion to make sure all the strings are strings!
run_options = explicit_convert(config['run_options'])
# verify that these run options are valid before doing any heavy lifting
check_configuration(run_options)

# load in all the other data from the configuration file
fit_config = explicit_convert(config['central_values'])
steering_config = explicit_convert(config['steering_options'])
parameters = explicit_convert(config['parameters'])
flags_config = explicit_convert(config['fitflags'])
priors_config = explicit_convert(config['priors'])
raw_seeds = config['seeds']

# use the loaded parameters to seed the RNG (Affects seed generation)
random.seed(parameters['rng_seed'])

# contruct meta-GF objects
datapaths = gf.DataPaths(run_options['datapath'])
npp = gf.NewPhysicsParams()
Beispiel #10
0
import os
import sys
import argparse
import argparse
import logging
import multiprocessing

import extensions
import commands
import html2latex
import utils

# Check for the necessary packages, this does a load so they should all get loaded.
if utils.check_configuration(['yaml', 'jinja2', 'markdown', 'markdown_include', 'mdx_math', 'bs4']):
  sys.exit(1)

import yaml
from MarkdownTable import MarkdownTable
from MooseObjectParameterTable import MooseObjectParameterTable
from MooseApplicationSyntax import MooseApplicationSyntax
from MooseLinkDatabase import MooseLinkDatabase

import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())

MOOSE_DIR = os.getenv('MOOSE_DIR', os.path.join(os.getcwd(), '..', 'moose'))
if not os.path.exists(MOOSE_DIR):
  MOOSE_DIR = os.path.join(os.getenv('HOME'), 'projects', 'moose')


class MkMooseDocsFormatter(logging.Formatter):
Beispiel #11
0
#!/usr/bin/env python
import os
import logging
import sys

import utils
import argparse

# Check for the necessary packages, this does a load so they should all get loaded.
if utils.check_configuration(['yaml', 'mkdocs', 'markdown', 'markdown_include', 'mdx_math', 'mkdocs_bootswatch', 'mkdocs_bootstrap']):
    sys.exit(1)

from mkdocs.commands import serve, build
from mkdocs.config import load_config
import MooseDocs

def command_line_options():
    """
    Return the command line options for the script.
    """

    # Command-line options
    parser = argparse.ArgumentParser(description="Tool for building and developing MOOSE and MOOSE-based application documentation.")
    parser.add_argument('--verbose', '-v', action='store_true', help="Execute with verbose (debug) output.")
    subparser = parser.add_subparsers(title='Commands', description="Documenation creation command to execute.", dest='command')

    # Generate options
    generate_parser = subparser.add_parser('generate', help="Generate the markdown documentation from MOOSE application executable. This is done by the serve and build command automatically.")
    generate_parser.add_argument('--moosedocs-config-file', type=str, default=os.path.join('moosedocs.yml'), help="The configuration file to use for building the documentation using MOOSE. (Default: %(default)s)")
    generate_parser.add_argument('--purge', action='store_true', help="Remove all content from the install directories.")
Beispiel #12
0
import os
import sys
import argparse
import argparse
import logging
import multiprocessing

import extensions
import commands
import html2latex
import utils

# Check for the necessary packages, this does a load so they should all get loaded.
if utils.check_configuration(
    ['yaml', 'jinja2', 'markdown', 'markdown_include', 'mdx_math', 'bs4']):
    sys.exit(1)

import yaml
from MarkdownTable import MarkdownTable
from MooseObjectParameterTable import MooseObjectParameterTable
from MooseApplicationSyntax import MooseApplicationSyntax
from MooseLinkDatabase import MooseLinkDatabase

import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())

MOOSE_DIR = os.getenv('MOOSE_DIR', os.path.join(os.getcwd(), '..', 'moose'))
if not os.path.exists(MOOSE_DIR):
    MOOSE_DIR = os.path.join(os.getenv('HOME'), 'projects', 'moose')