Exemple #1
0
 def schema(cls):
     return syml.Map({
         **cls._schema_base(),
         "location":
         syml.FixedSeq([syml.Float()] * 3),
         syml.Optional("frames", 1):
         syml.Int(),
     })
Exemple #2
0
def _get_match_schema(self):
    return strictyaml.Map(
        {
            "duration": strictyaml.Int(),
            "matches": strictyaml.Seq(
                strictyaml.Map(
                    {
                        "away": strictyaml.Str(),
                        "date": strictyaml.Str(),
                        "newdate": strictyaml.Str(),
                        "our_score": strictyaml.Int(),
                        "opp_score": strictyaml.Int(),
                    }
                )
            ),
        }
    )
Exemple #3
0
 def schema(cls):
     return syml.Map({
         **cls._schema_base(),
         syml.Optional("interp_order", None):
         syml.Enum([str(x) for x in range(6)]),
         syml.Optional("extrap_mode", None):
         syml.Enum(EXTRAP_MODES),
         syml.Optional("extrap_cval", None):
         syml.Float() | syml.Int(),
     })
Exemple #4
0
 def schema(cls):
     return syml.Map({
         **cls._schema_base(),
         syml.Optional("roll", 0):
         syml.Float(),
         syml.Optional("pitch", 0):
         syml.Float(),
         syml.Optional("yaw", 0):
         syml.Float(),
         syml.Optional("degrees", True):
         syml.Bool(),
         syml.Optional("frames", 1):
         syml.Int(),
     })
Exemple #5
0
 def schema(cls):
     return syml.Map({
         **cls._schema_base(),
         syml.Optional("forward", 0):
         syml.Float(),
         syml.Optional("down", 0):
         syml.Float(),
         syml.Optional("right", 0):
         syml.Float(),
         syml.Optional("right", 0):
         syml.Float(),
         syml.Optional("frames", 1):
         syml.Int(),
     })
Exemple #6
0
def _ProtoFieldToSchema(field):
  """Convert a Proto Field to strictyaml schema."""
  if field.type == field.TYPE_STRING:
    return syaml.Str()
  if field.type == field.TYPE_BOOL:
    return syaml.Bool()
  if field.type in (field.TYPE_INT32, field.TYPE_UINT32,
                    field.TYPE_INT64, field.TYPE_UINT64):
    return syaml.Int()
  if field.type in (field.TYPE_DOUBLE, field.TYPE_FLOAT):
    return syaml.Decimal()
  if field.type == field.TYPE_MESSAGE:
    return _ProtoDescriptorToSchema(field.message_type)
  if field.type == field.TYPE_ENUM:
    return syaml.Str()
  raise ConfigError('Unknown field type in lab_config_pb2: %r.' % field.type)
Exemple #7
0
                    "non-commercial",
                    "other",
                ])),
            sy.Optional("information"):
            sy.Seq(
                sy.Map({
                    "type": sy.Str(),
                    "url": sy.Url(),
                    "title": sy.Str(),
                }), ),
            "date_added":
            sy.Datetime(),
            sy.Optional("date_updated"):
            sy.Datetime(),
            sy.Optional("maturity"):
            sy.Int(),
            sy.Optional("in_incubator"):
            sy.Bool(),
            sy.Optional("demo"):
            sy.Map({
                "title": sy.Str(),
                "url": sy.Url(),
                "code": sy.Url(),
            }),
        }))
})


@lru_cache(maxsize=1)
def load():
    with codecs.open(os.path.join(DATA_PATH, LABS_FILENAME),
Exemple #8
0
        strictyaml.Optional("action"):
        strictyaml.Enum(["allow", "deny", "ask"]),
        strictyaml.Optional("codeSignature"):
        strictyaml.Enum(["ignore"]),
        strictyaml.Optional("direction"):
        strictyaml.Enum(["incoming", "outgoing"]),
        strictyaml.Optional("disabled"):
        strictyaml.Bool(),
        strictyaml.Optional("notes"):
        strictyaml.Str(),
        strictyaml.Optional("ports"):
        strictyaml.Regex("^(any|\d+((\s+)?\-(\s+)?\d+)?)$"),
        strictyaml.Optional("priority"):
        strictyaml.Enum(["regular", "high"]),
        strictyaml.Optional("protocol"):
        strictyaml.Int() | strictyaml.Str(),
        strictyaml.Optional("remote"):
        strictyaml.Enum([
            "any", "local-net", "multicast", "broadcast", "bonjour",
            "dns-servers"
        ]),
        strictyaml.Optional("remote-addresses"):
        strictyaml.Seq(strictyaml.Str()),
        strictyaml.Optional("remote-domains"):
        strictyaml.Seq(strictyaml.Str()),
        strictyaml.Optional("remote-hosts"):
        strictyaml.Seq(strictyaml.Str()),
        strictyaml.Optional("via"):
        strictyaml.Str(),
    }))
Exemple #9
0
 def schema(cls):
     return syml.Map({
         **cls._schema_base(),
         "factor": syml.Float(),
         syml.Optional("frames", 1): syml.Int(),
     })