Exemplo n.º 1
0
Arquivo: download.py Projeto: T2BE/lfm
def download_gist(uri, dest):
	gid = GitURL(uri).repo
	clip.echo('Downloading Gist "{}" to "{}"...'.format(gid, dest))
	ret = []
	req = requests.get('https://api.github.com/gists/{}'.format(gid))
	res = req.json()
	for k, v in utils.iteritems(res['files']):
		ret.append(k)
		with open(os.path.join(dest, k), 'w') as f:
			f.write(v['content'])
	return ret
Exemplo n.º 2
0
Arquivo: init.py Projeto: T2BE/lfm
def run():
	config = LambdaConfig().load_from_cwd()
	clip.echo(PROMPT)
	user_input = {
		'FunctionName': clip.prompt('Function name: ', skip=True),
		'Handler': clip.prompt('Handler: ', skip=True),
		'Description': clip.prompt('Description: ', skip=True),
		'Runtime': clip.prompt('Runtime', default='nodejs'),
		'Timeout': clip.prompt('Timeout: ', type=int, skip=True),
		'MemorySize': clip.prompt('Memory size: ', type=int, skip=True)
	}
	config.update_config({k: v for k, v in utils.iteritems(user_input) if v})
	install_task = clip.prompt('Install task: ', skip=True)
	if install_task is not None:
		config.update({
			'install': install_task
		})
	config.dump_to_cwd()
Exemplo n.º 3
0
def lfm_deploy(path, **kwargs):
	deploy.run(path, {k: v for k, v in utils.iteritems(kwargs) if v})
Exemplo n.º 4
0
    if(direction.__eq__('E')):
        return (maze[i][j+1] == '1')
    if(direction.__eq__('W')):
        return (maze[i][j-1] == '1')
    if(direction.__eq__('S')):
        return (maze[i+1][j] == '1')

left = {'N':'W','W':'S','S':'E','E':'N'}
def turnLeft(orient):
    """
    Return the orientation to the left of ``orient``.
    """
    global left
    return left[orient]

right = {v: k for (k, v) in iteritems(left)}
def turnRight(orient):
    """
    Returns the orientation to the right of ``orient``.
    """
    global right
    return right[orient]

def mazeBoundaries(maze):
    """
    Returns the reachable boundaries of the maze.
    """
    width, height = len(maze), len(maze[0])
    # Find min x
    for x in xrange(width):
      if not all(z == '1' for z in maze[x]):