def __init__(self):
     super(DescribePlugin, self).__init__()
     config_file_path = os.path.join(os.path.dirname(__file__),
                                     self._default_plugin_config_file_name_)
     source = ConfigSource(
         load_yaml(config_file_path) or {}, config_file_path)
     self.config.add(source)
Exemple #2
0
def test_yaml():
    assert confuse.Subview is confuse_jinja.Subview

    config = confuse.Configuration('shhhh', read=False)
    config.set(
        confuse.load_yaml(os.path.join(os.path.dirname(__file__),
                                       'sample.yml')))

    assert config['asdf']['blah'].get() == 'asdf4'
    assert config['asdf'].get() == {'blah': 'asdf4'}
    assert config['nested'].get() == config['asdf'].get()
Exemple #3
0
    def __init__(self):
        super(GoingRunningPlugin, self).__init__()

        # Read default configuration
        config_file_path = os.path.join(os.path.dirname(__file__),
                                        self._default_plugin_config_file_name_)
        source = ConfigSource(load_yaml(config_file_path) or {},
                              config_file_path)
        self.config.add(source)

        # Add `play_count` field support
        fld_name = u'play_count'
        if fld_name not in mediafile.MediaFile.fields():
            field = mediafile.MediaField(
                mediafile.MP3DescStorageStyle(fld_name),
                mediafile.StorageStyle(fld_name),
                out_type=int
            )
            self.add_media_field(fld_name, field)
 def add_config(self, configfn):
     self.__config.add(
         confuse.ConfigSource(confuse.load_yaml(configfn), configfn))
     self.update_conf()
Exemple #5
0
 def _add_default_source(self):
     filename = self.default_config
     self.add(
         confuse.ConfigSource(confuse.load_yaml(filename), filename, True))
Exemple #6
0
            content = f.read()
        return content


def is_lyrics_content_ok(title, text):
    """Compare lyrics text to expected lyrics for given title."""
    if not text:
        return
    keywords = set(LYRICS_TEXTS[google.slugify(title)].split())
    words = set(x.strip(".?, ") for x in text.lower().split())
    return keywords <= words


LYRICS_ROOT_DIR = os.path.join(_common.RSRC, b'lyrics')
yaml_path = os.path.join(_common.RSRC, b'lyricstext.yaml')
LYRICS_TEXTS = confuse.load_yaml(yaml_path)


class LyricsGoogleBaseTest(unittest.TestCase):
    def setUp(self):
        """Set up configuration."""
        try:
            __import__('bs4')
        except ImportError:
            self.skipTest('Beautiful Soup 4 not available')
        if sys.version_info[:3] < (2, 7, 3):
            self.skipTest("Python's built-in HTML parser is not good enough")


class LyricsPluginSourcesTest(LyricsGoogleBaseTest):
    """Check that beets google custom search engine sources are correctly
Exemple #7
0
 def _add_user_source(self):
     if not Path(self._config).is_file():
         Path(self._config).write_bytes(Path(self._default).read_bytes())
     data = confuse.load_yaml(self._config, loader=self.loader)
     self.add(
         confuse.ConfigSource(data, filename=self._config, default=True))
Exemple #8
0
 def _add_default_source(self):
     assert Path(self._default).is_file()
     data = confuse.load_yaml(self._default, loader=self.loader)
     self.add(
         confuse.ConfigSource(data, filename=self._default, default=True))
            if spans.text == maindomain:
                beheren_link = product.find_element_by_link_text("beheren")
                # /pakketten/{id}/producten/dmp/instellingen
                link = beheren_link.get_attribute("href")
                productid_domain = link.split("/")[4]
    return productid_domain


parser = argparse.ArgumentParser(description='Update mijndomein DNS records')
parser.add_argument('--config',
                    type=str,
                    help='The path to the config file',
                    default="config.yml")

args = parser.parse_args()
config = confuse.load_yaml(args.config)

usernameValue = config['mijndomein']['username']
passwordValue = config['mijndomein']['password']

opts = Options()
opts.headless = True
browser = Firefox(options=opts)
browser.maximize_window()

ip = get('https://api.ipify.org').text
print('My public IP address is:', ip)

try:
    browser.get('https://auth.mijndomein.nl/login')
    username = browser.find_element_by_css_selector(
    'device': str,
    'username': str,
    'password': str,
    'domain': str,
    'ac_policy': str,
    'intrusion_policy': str,
    'file_policy': str,
    'variable_set': str,
    'syslog_to_server': str,
    'log_to_fmc': bool,
    'log_at_begin': bool,
    'log_at_end': bool
}
config = confuse.Configuration('fmc-tools', __name__)
try:
    config.add(confuse.ConfigSource(confuse.load_yaml('config.yaml'), 'config.yaml', True))
except confuse.ConfigReadError:
    pass
config.add(confuse.ConfigSource(confuse.load_yaml('config_default.yaml'), 'config_default.yaml', True))

valid = config.get(template)

# Set variables for execution.
# Make sure your credentials are correct.
# Make sure ACP and all logging and inspection objects already exist.

loglevel = valid.loglevel
device = valid.device
username = valid.username
password = valid.password
domain = valid.domain
Exemple #11
0
def test_default_config(default_config_path):
    try:
        confuse.load_yaml(default_config_path)
    except confuse.ConfigError as exc:
        pytest.fail(exc)
Exemple #12
0
 def _parse_contents(self, contents):
     with TempDir() as temp:
         path = temp.sub('test_config.yaml', contents)
         return confuse.load_yaml(path)