Beispiel #1
0
 def lineReceived(self, line):
     print "recieved command: %s" % line
     try:
         command = parse_command(line)
         result = self.factory.service.process_command(command)
         self.handle_result(result)
     except (IndexError, ValueError):
         print "Invalid Command: %s" % line
Beispiel #2
0
 def lineReceived(self, line):
     print "recieved command: %s" % line
     try:
         command = parse_command(line)
         result = self.factory.service.process_command(command)
         self.handle_result(result)
     except (IndexError, ValueError):
         print "Invalid Command: %s" % line
 def lineReceived(self, line):
     print('from {} received line {}'.format(self.transport.getPeer(),
                                             line))
     if line == 'commander':
         self._is_commander = True
     elif self._is_commander:
         valid, cmd = command.parse_command(line.rstrip())
         if valid:
             self._raw_telemetry_source.async_tx(cmd)
         else:
             print('command not valid')
 def lineReceived(self, line):
     print('from {} received line {}'.format(
         self.transport.getPeer(), line))
     if line == 'commander':
         self._is_commander = True
     elif self._is_commander:
         valid, cmd = command.parse_command(line.rstrip())
         if valid:
             self._raw_telemetry_source.async_tx(cmd)
         else:
             print('command not valid')
Beispiel #5
0
def main():
    chess_board = Board(variants.normal_game)
    print(chess_board)
    while True:
        try:
            inputted_command = command.parse_command(input(), chess_board)
            if inputted_command.piece is None:
                print('No pice at that tile')
                print(chess_board)
                continue
            if chess_board.is_valid_move(inputted_command):
                chess_board.execute_move(inputted_command)
                chess_board.change_turn()
            elif chess_board.is_valid_attack(inputted_command):
                chess_board.execute_attack(inputted_command)
                chess_board.change_turn()
            else:
                print('Invalid move command')
        except (ValueError, IndexError):
            print('Cannnot parse the command')
        print(chess_board)
Beispiel #6
0
 def do_cmd(self, line):
     valid, cmd = command.parse_command(line.rstrip())
     if valid:
         self.data_lines.async_tx(cmd)
     else:
         print('command not valid')
Beispiel #7
0
 def parse(self, message=None):
     """
     parse command
     """
     return parse_command(self.csetting, message)
Beispiel #8
0
import os, sys
from command import parse_command
from settings import Settings
from parser import *
from file_types import *
from utils import *
from execution import *

# First step : We parse and set the command sent by the user
# We will store the settings in the Settings class (settings.py)
# For exemple : quiet or not (-q arg), delete the non music track files or not (-d)
# Also, an argument -t which allow to just print the incoming changes, not
# apply them
# We get arguments from user
list_root_path = parse_command(sys.argv)
# Second step : We use listfiles to recursively get all the files
# present in the tree with the specified folder as root
# Last arg have to be the root path.
# As you know, options start with '-',
# but the root path doesn't
# We get lists of all what we'll need into each root_path given by the user
for root_path in list_root_path:
    l_music_files = list_music_files(root_path)
    l_not_music_files = list_not_music_files(root_path)
    l_directories = list_directories(root_path)
# Third step : We create a loop which will, for each file:
#   - Parse it with the Parser (parser.py)
#   - Take the File_ext given by the parser and execute the execution function
    for music_file in l_music_files:
        # We get a dictionnary of all new value properties of the current file