コード例 #1
0
    def test_load_FileDoesNotExist_RaisesFileNotFoundError(self, tmpdir):
        config_file = tmpdir.join('config')  # file was not created here
        config_filepath = str(config_file)
        config = ConfigurationFile()

        with pytest.raises(FileNotFoundError):
            config.load(config_filepath)
コード例 #2
0
    def test_WithCacheDirCAndEpT1x1DownloadingDirA_MoveFromCBarATpCBarT1x1(
            self, mock_move):
        config = ConfigurationFile()
        config.cache_dir = 'c'
        downloader = Downloader(None, None, config)
        episode = Episode('t', 1, 1, None, None)
        downloading_dir = 'a'

        downloader._moveto_downloaded_dir(downloading_dir, episode)

        mock_move.assert_called_once_with(
            'c/a', 'c/t1x1')
コード例 #3
0
    def test_load_FileMissingOneOfThe3Params_RaisesLoadError(
            self, tmpdir):
        config_file = tmpdir.join('config')
        config_file.write("""
        {
            "db_file": "file.db",
            "cache_dir": "cache"
        }""")
        config = ConfigurationFile()

        with pytest.raises(LoadError) as error:
            config.load(str(config_file))
        assert str(error.value) == "configuration file '%s' " \
                                   "missing one parameter" % config_file
コード例 #4
0
    def test_load_FileMissingQuotesInTheParamNames_RaisesLoadError(
            self, tmpdir):
        config_file = tmpdir.join('config')
        config_file.write("""
        {
            db_file: "file.db",
            cache_dir: "cache",
            store_dir: "store"
        }""")
        config = ConfigurationFile()

        with pytest.raises(LoadError) as error:
            config.load(str(config_file))
        assert str(error.value).startswith("configuration file '%s' is not in "
                                           "the correct format: " % config_file)
コード例 #5
0
    def test_load_FileMissingColonsBetweenParamNamesAndValues_RaisesLoadError(
            self, tmpdir):
        config_file = tmpdir.join('config')
        config_file.write("""
        {
            "db_file" "file.db",
            "cache_dir" "cache",
            "store_dir" "store"
        }""")
        config = ConfigurationFile()

        with pytest.raises(LoadError) as error:
            config.load(str(config_file))
        assert str(error.value).startswith("configuration file '%s' is not in "
                                           "the correct format: " % config_file)
コード例 #6
0
    def test_load_FileWithThe3Params_LoadsConfigFileWithRespectiveValues(
            self, tmpdir):
        config_file = tmpdir.join('config')
        config_file.write("""
        {
            "db_file": "file.db",
            "cache_dir": "cache",
            "store_dir": "store"
        }""")
        config = ConfigurationFile()

        config.load(str(config_file))

        assert config.db_file == "file.db"
        assert config.cache_dir == "cache"
        assert config.store_dir == "store"
コード例 #7
0
    def test_load_FileWithThe3ParamsAndExtraInvalidParam_RaisesLoadError(
            self, tmpdir):
        config_file = tmpdir.join('config')
        config_file.write("""
        {
            "db_file": "file.db",
            "cache_dir": "cache",
            "store_dir": "store",
            "extra": "extra"
        }""")
        config = ConfigurationFile()

        with pytest.raises(LoadError) as error:
            config.load(str(config_file))
        assert str(error.value) == "configuration file '%s' has unknown " \
                                   "parameters" % config_file
コード例 #8
0
def main():
    args = docopt(__doc__, version='ShowTracker Version 0.1')

    # TODO change to real default
    if args['--config']:
        config_file = ConfigurationFile.from_file(args['--config'])
    else:
        config_file = ConfigurationFile()

    client = Client(config_file)
    ShowTrackerCmd(client).cmdloop()
コード例 #9
0
  eco_feature_size = 1536
  res_eco_features_size = 3584
  cnn_global_size = 512
  projected_size = 512
  hidden_size = 1024  # Number of hidden layer units of the cyclic network
  mid_size = 128  # The middle of the boundary detection layer represents the dimension

  n_tags = 300
  global_tagger_hidden_size = 1024
  specific_tagger_hidden_size = 128
  hidden_size = 1024
  embedding_size = 300  #1024
  rnn_in_size = 300  #1024
  rnn_hidden_size = 1024

  config = ConfigurationFile(os.path.join(args.dataset_folder, 'config.ini'), 'sem-syn-cn-max')

  # Models
  encoder = SCNEncoder(cnn_feature_size=cnn_feature_size,
                        c3d_feature_size=c3d_feature_size,
                        i3d_feature_size=i3d_feature_size,
                        eco_feature_size=eco_feature_size,
                        res_eco_features_size=res_eco_features_size,
                        n_tags=n_tags,
                        hidden_size=hidden_size,
                        global_tagger_hidden_size=global_tagger_hidden_size,
                        specific_tagger_hidden_size=specific_tagger_hidden_size,
                        n_layers=config.encoder_num_layers,
                        input_dropout_p=config.encoder_dropout_p,
                        rnn_dropout_p=config.encoder_dropout_p,
                        bidirectional=config.encoder_bidirectional,