Exemplo n.º 1
0
def _init_valid_functions(action_dimensions):
  """Initialize ValidFunctions and set up the callbacks."""
  sizes = {
      "screen": tuple(int(i) for i in action_dimensions.screen),
      "screen2": tuple(int(i) for i in action_dimensions.screen),
      "minimap": tuple(int(i) for i in action_dimensions.minimap),
  }

  types = actions.Arguments(*[
      actions.ArgumentType.spec(t.id, t.name, sizes.get(t.name, t.sizes))
      for t in actions.TYPES])

  functions = actions.Functions([
      actions.Function.spec(f.id, f.name, tuple(types[t.id] for t in f.args))
      for f in actions.FUNCTIONS])

  return actions.ValidActions(types, functions)
Exemplo n.º 2
0
 def testCanDeepcopyNumpyFunctionCall(self):
     arguments = [numpy.float32] * len(actions.Arguments._fields)
     dtypes = actions.FunctionCall(function=numpy.float32,
                                   arguments=actions.Arguments(*arguments))
     self.assertEqual(dtypes, copy.deepcopy(dtypes))