Exemple #1
0
 def _wrapped(checkboxes=True, ordered=True, *args, **kwargs):
     ordered = utils.strtobool(ordered)
     checkboxes = utils.strtobool(checkboxes)
     results = task_fn(*args, **kwargs)
     if not results:
         return
     if ordered:
         results = sorted(results, key=sort_by_env)
     print_list(results, checkboxes)
     return results
Exemple #2
0
def update(stackname, autostart="0", concurrency='serial'):
    """Updates the environment within the stack's ec2 instance.
    Does *not* call Cloudformation's `update` command on the stack (see `update_infrastructure`)."""
    instances = _check_want_to_be_running(stackname, utils.strtobool(autostart))
    if not instances:
        return
    return bootstrap.update_stack(stackname, service_list=['ec2'], concurrency=concurrency)
Exemple #3
0
 async def reset_waivers(self, message):
   await self.client.send_message(message.channel, "Are you sure you want to reset all the waivers?")
   msg_confirm = await self.client.wait_for_message(author=message.author, timeout=30, check=valid_boolean)
   if not msg_confirm:
     return "You didn't tell me if you wanted to delete the waivers. Aborting..."
   if strtobool(msg_confirm.content):
     self.redis.delete_waivers()
     return "All waivers are reset."
   return "Alright, I won't delete anything."
Exemple #4
0
    def test_strtobool(self):
        true_case_list = [
            True,
            1, "1",
            "y", "yes", "Yes", "YES",
            "t", "true", "True", "TRUE",
        ]
        for true_case in true_case_list:
            self.assertEqual(True, utils.strtobool(true_case))

        false_case_list = [
            False,
            0, "0",
            "n", "no", "No", "NO",
            "f", "false", "False", "FALSE"
        ]
        for false_case in false_case_list:
            self.assertEqual(False, utils.strtobool(false_case))

        self.assertRaises(ValueError, utils.strtobool, "this value is neither true nor false")
Exemple #5
0
 async def delete_player_waivers(self, message):
   if not self.redis.get_waivers(message.author.name):
     return "You don't have any waivers to delete!"
   await self.client.send_message(message.channel, "Are you sure you want to delete all of your waivers?")
   msg_confirm = await self.client.wait_for_message(author=message.author, timeout=30, check=valid_boolean)
   if not msg_confirm:
     return "You didn't tell me if you wanted to delete the waivers. Aborting..."
   if strtobool(msg_confirm.content):
     self.redis.delete_waivers(message.author.name)
     return "Deleted all waivers."
   return "Alright, I won't delete anything."
Exemple #6
0
    def farm(self):
        if options['farming'].has_key('enabled') and not strtobool(options['farming']['enabled']):
            return
        farms =[s.strip().split(' ')[0] for s in  options['farming']['farms'].split(',')]
        if not farms or not farms[0]:
            return
        ships_kind = options['farming']['ships_kind']
        ships_number = options['farming']['ships_number']
        next_farm = int(options['farming']['next_farm'])  % len(farms)

        farm = farms[next_farm]
        #if not self.get_player_status(farm)['inactive']:
        #    self.logger.error('farm %s seems not to be inactive!', farm)
        #    return
        if self.send_fleet(
            self.get_closest_planet(farm),
            farm,
            fleet={ships_kind: ships_number}
        ):
            next_farm = (next_farm+1) % len(farms)
            options.change_item('farming', 'next_farm', str(next_farm))
Exemple #7
0
    def farm(self):
        if options['farming'].has_key('enabled') and not strtobool(
                options['farming']['enabled']):
            return
        farms = [
            s.strip().split(' ')[0]
            for s in options['farming']['farms'].split(',')
        ]
        if not farms or not farms[0]:
            return
        ships_kind = options['farming']['ships_kind']
        ships_number = options['farming']['ships_number']
        next_farm = int(options['farming']['next_farm']) % len(farms)

        farm = farms[next_farm]
        #if not self.get_player_status(farm)['inactive']:
        #    self.logger.error('farm %s seems not to be inactive!', farm)
        #    return
        if self.send_fleet(self.get_closest_planet(farm),
                           farm,
                           fleet={ships_kind: ships_number}):
            next_farm = (next_farm + 1) % len(farms)
            options.change_item('farming', 'next_farm', str(next_farm))
Exemple #8
0
from utils.actor_service import ActorService
from utils.object_service import ObjectService

def noop():
    pass


CUSTOM_CACHE_HOOKS = False
try:
     from cache_hooks import purge as custom_cache_purge_hook
except ModuleNotFoundError:
    custom_cache_purge_hook = noop

VERSION = subprocess.check_output(['git', 'describe', '--always']).split()[0].decode('utf-8')

DEBUG_MODE = strtobool(os.getenv('MICROBLOGPUB_DEBUG', 'false'))


CTX_AS = 'https://www.w3.org/ns/activitystreams'
CTX_SECURITY = 'https://w3id.org/security/v1'
AS_PUBLIC = 'https://www.w3.org/ns/activitystreams#Public'
HEADERS = [
    'application/activity+json',
    'application/ld+json;profile=https://www.w3.org/ns/activitystreams',
    'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
    'application/ld+json',
]


with open(os.path.join(KEY_DIR, 'me.yml')) as f:
    conf = yaml.load(f)
Exemple #9
0
    "disable_existing_loggers": False,
    "formatters": {"ecs": {"()": "ecs_logging.StdlibFormatter"}},
    "handlers": {
        "wsgi": {
            "class": "logging.StreamHandler",
            "stream": "ext://flask.logging.wsgi_errors_stream",
            "formatter": "ecs",
        }
    },
    "root": {"level": "INFO", "handlers": ["wsgi"]},
    "taricapi": {"level": "INFO", "handlers": ["wsgi"]},
    "flask": {"level": "INFO", "handlers": ["wsgi"]},
}

STREAM_CHUNK_SIZE = 1024 * 512  # ~0.5mb

# This only needs to be set under testing conditions to use MinIO - in local and deployed envs, we use AWS S3.
S3_ENDPOINT_URL = os.environ.get("S3_ENDPOINT_URL", None)

NUM_PROXIES = int(os.environ.get("NUM_PROXIES", 0))
SENTRY_DSN = os.environ.get("SENTRY_DSN")

REQUIRE_AUTH_FOR_READS = strtobool(os.environ.get("REQUIRE_AUTH_FOR_READS", "true"))

ELASTIC_APM_URL = os.environ.get("ELASTIC_APM_URL", None)
ELASTIC_APM_TOKEN = os.environ.get("ELASTIC_APM_TOKEN", None)


GA_TRACKING_ID = os.environ.get("GA_TRACKING_ID", None)
GA_ENDPOINT = os.environ.get("GA_ENDPOINT", "https://www.google-analytics.com/collect")
Exemple #10
0
        "level": "INFO",
        "handlers": ["wsgi"]
    },
    "taricapi": {
        "level": "INFO",
        "handlers": ["wsgi"]
    },
    "flask": {
        "level": "INFO",
        "handlers": ["wsgi"]
    },
}

STREAM_CHUNK_SIZE = 1024 * 512  # ~0.5mb

# This only needs to be set under testing conditions to use MinIO - in local and deployed envs, we use AWS S3.
S3_ENDPOINT_URL = os.environ.get("S3_ENDPOINT_URL", None)

NUM_PROXIES = int(os.environ.get("NUM_PROXIES", 0))
SENTRY_DSN = os.environ.get("SENTRY_DSN")

REQUIRE_AUTH_FOR_READS = strtobool(
    os.environ.get('REQUIRE_AUTH_FOR_READS', 'true'))

ELASTIC_APM_URL = os.environ.get('ELASTIC_APM_URL', None)
ELASTIC_APM_TOKEN = os.environ.get('ELASTIC_APM_TOKEN', None)

GA_TRACKING_ID = os.environ.get('GA_TRACKING_ID', None)
GA_ENDPOINT = os.environ.get('GA_ENDPOINT',
                             'https://www.google-analytics.com/collect')
Exemple #11
0
 def test_false_vals(self, user_input):
     assert strtobool(user_input) is False
Exemple #12
0
 def test_true_vals(self, user_input):
     assert strtobool(user_input) is True