prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
want = "bool" want_type = bool
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
want = "string" want_type = str
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
want = "ip" want_type = str def validate(self, pre, structure): TypeCheck.validate(self, pre, structure) try: socket.inet_pton(socket.AF_INET, structure) return True except socket.error: try: socket.inet_pton(socket.AF_INET6, stru...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
TypeCheck.validate(self, pre, structure) try: socket.inet_pton(socket.AF_INET, structure) return True except socket.error: try: socket.inet_pton(socket.AF_INET6, structure) return True except socket.error: ...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
want = "memory" want_type = str validator = re.compile("(?P<value>\d+)(\ *)(?P<unit>[kMGT])") def validate(self, pre, structure): TypeCheck.validate(self, pre, structure) if self.validator.match(structure): return True else: raise error.ValidatorError("{}...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
TypeCheck.validate(self, pre, structure) if self.validator.match(structure): return True else: raise error.ValidatorError("{} is not a valid memory size".format(pre))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
want = "list" want_type = list def __init__(self, schema, desc=None): TypeCheck.__init__(self, desc) self.schema = schema def validate(self, pre, structure): TypeCheck.validate(self, pre, structure) def _validate_each(item): return self.schema.validate(pre,...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
TypeCheck.__init__(self, desc) self.schema = schema
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
TypeCheck.validate(self, pre, structure) def _validate_each(item): return self.schema.validate(pre, item) return sum(map(_validate_each, structure)) > 1
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return self.schema.validate(pre, item)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return [self.schema.structure(accessor)]
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
def __init__(self, schemas, desc=None, exclusive=True): Validator.__init__(self, desc) self.schemas = schemas self.exclusive = exclusive def validate(self, pre, structure): errors = [] def _validate_each(schema): try: return schema.validate(p...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
Validator.__init__(self, desc) self.schemas = schemas self.exclusive = exclusive
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
errors = [] def _validate_each(schema): try: return schema.validate(pre, structure) except error.ValidatorError as err: errors.append(err) return False state = sum(map(_validate_each, self.schemas)) if self.exclus...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
try: return schema.validate(pre, structure) except error.ValidatorError as err: errors.append(err) return False
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
it = iter(errors) yield " ".join(next(it).error()) for err in it: yield "or" yield " ".join(err.error())
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
desc = [] descs = [ s.structure(accessor) for s in self.schemas ] for d in descs[:-1]: desc.append(d) desc.append("__or__") desc.append(descs[-1]) return desc
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
def structure(self, accessor, overwrite=None): name = self.name if overwrite: name = overwrite return ("{}".format(name), self.schema.structure(accessor))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
name = self.name if overwrite: name = overwrite return ("{}".format(name), self.schema.structure(accessor))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
def __init__(self, schema, example, desc=None): KeyValidator.__init__(self, desc, example) self.name = "*" self.example = example self.schema = schema def validate(self, pre, structure): if not isinstance(structure, dict): raise error.ValidatorError("{} need...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
KeyValidator.__init__(self, desc, example) self.name = "*" self.example = example self.schema = schema
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
if not isinstance(structure, dict): raise error.ValidatorError("{} needs to be a dict".format(pre)) def _validate_each(pair): (name, next_structure) = pair return self.schema.validate(pre + " > " + name, next_structure) return sum(map(_validate_each, structur...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
(name, next_structure) = pair return self.schema.validate(pre + " > " + name, next_structure)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
if accessor == "example": return KeyValidator.structure(self, accessor, self.example) return KeyValidator.structure(self, accessor)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
def __init__(self, name, schema, desc=None, example=None): KeyValidator.__init__(self, desc, example) self.name = name self.schema = schema def validate(self, pre, structure): if not isinstance(structure, dict): raise error.ValidatorError("{} needs to be a dict".form...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
KeyValidator.__init__(self, desc, example) self.name = name self.schema = schema
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
if not isinstance(structure, dict): raise error.ValidatorError("{} needs to be a dict".format(pre)) value_of_key = util.safe_get(self.name, structure) if not value_of_key: return False return self.schema.validate(pre + " > " + self.name, value_of_key)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
def __init__(self, name, schema, desc=None, example=None): Validator.__init__(self, desc, example) self.name = name self.schema = schema def validate(self, pre, structure): value_of_key = util.safe_get(self.name, structure) if not value_of_key: raise error.Va...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
Validator.__init__(self, desc, example) self.name = name self.schema = schema
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
value_of_key = util.safe_get(self.name, structure) if not value_of_key: raise error.ValidatorError("{} must have {} " "defined".format(pre, self.name)) return self.schema.validate(pre + " > " + self.name, value_of_key)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
want = "dictonary" want_type = dict def __init__(self, schemas, desc=None): TypeCheck.__init__(self, desc) self.schemas = schemas def validate(self, pre, structure): TypeCheck.validate(self, pre, structure) def _validate(schema): return schema.validate(pre,...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
TypeCheck.__init__(self, desc) self.schemas = schemas
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
TypeCheck.validate(self, pre, structure) def _validate(schema): return schema.validate(pre, structure) return sum(map(_validate, self.schemas)) >= 1
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return schema.validate(pre, structure)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
desc_dict = {} for key, value in [s.structure(accessor) for s in self.schemas]: desc_dict[key] = value return desc_dict
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return self._example
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
desc = self.want
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return True
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return True
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
raise error.ValidatorError("{} is not a valid memory size".format(pre))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
def _error_lines(): it = iter(errors) yield " ".join(next(it).error()) for err in it: yield "or" yield " ".join(err.error()) raise error.ValidatorError(["{} is ambigous:".format(pre)] + ...
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
name = overwrite
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
raise error.ValidatorError("{} needs to be a dict".format(pre))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return KeyValidator.structure(self, accessor, self.example)
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
raise error.ValidatorError("{} needs to be a dict".format(pre))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
return False
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
raise error.ValidatorError("{} must have {} " "defined".format(pre, self.name))
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
structure
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
_validate_each
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
structure
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
_validate_each
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
_error_lines
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
structure
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
structure
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
_validate_each
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
structure
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
__init__
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
_validate
<|file_name|>validator.py<|end_file_name|><|fim▁begin|>import socket import re from xii import error, util # sample validator # keys = Dict( # [ # RequiredKey("foo", String(), desc="A string to manipulate something"), # Key("bar", String(), desc="something usefull") # ], # desc="Implement...
structure
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
#
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
''' This way everytime a User is created, a Profile is created too. ''' if kwargs['created']: profile = Profile() if not kwargs['instance'].__dict__.has_key("birth_date"): profile.birth_date = date.today() if not kwargs['instance'].__dict__.has_key("address"): ...
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
''' <<<<<<< HEAD User with timebank settings. ======= User with time bank settings. >>>>>>> 2db144ba2c6c34a8f17f795a1186a524059b1aa6 ''' photo = models.ImageField(_("Avatar"), blank=True, null=True, upload_to=os.path.join(settings.STATIC_DOC_ROOT, "photos"))
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
if self.balance % 60 == 0: return self.balance/60 return self.balance/60.0
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
rbose_name = _("User") verbose_name_plural = _("Users") >
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
turn self.username
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
turn value and self.id == value.id or False
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
' Transfers from this user which are not in a final state ''' from serv.models import Transfer return Transfer.objects.filter(Q(credits_payee=self) \ | Q(credits_payee=self)).filter(status__in=['r', 'd'])
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
' Average of the user's transfer scores ''' karma = self.transfers_received.aggregate(Avg('rating_score')) if karma['rating_score__avg']: return int(karma['rating_score__avg']) else: return 0
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
profile = Profile() if not kwargs['instance'].__dict__.has_key("birth_date"): profile.birth_date = date.today() if not kwargs['instance'].__dict__.has_key("address"): profile.address = _("address") profile.__dict__.update(kwargs['instance'].__dict__) profi...
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
profile.birth_date = date.today()
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
profile.address = _("address")
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
return self.balance/60
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
turn int(karma['rating_score__avg'])
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
turn 0
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
create_profile_for_user
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
balance_hours
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
unicode__(s
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
eq__(s
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
ansfers_pending(s
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foun...
rma(s
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from distutils.core import setup setup( name='sequencehelpers', py_modules=['sequencehelpers'], version='0.2.1',<|fim▁hole|> url='https://github.com/2achary/sequencehelpers', download_url='https://github.com/2achary/sequence/tarball/0.2.1', keywords=['seque...
description="A library consisting of functions for interacting with sequences and iterables.", author='Zach Swift', author_email='cras.zswift@gmail.com',
<|file_name|>example1.py<|end_file_name|><|fim▁begin|># cs.???? = currentstate, any variable on the status tab in the planner can be used. # Script = options are # Script.Sleep(ms) # Script.ChangeParam(name,value) # Script.GetParam(name) # Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO' ...
Script.Sleep(300) Script.SendRC(3,1000,False)
<|file_name|>whoispy.py<|end_file_name|><|fim▁begin|>import re import sys import whoisSrvDict import whoispy_sock import parser_branch <|fim▁hole|>FAIL = '\033[91m' ENDC = '\033[0m' def query(domainName): rawMsg = "" tldName = "" whoisSrvAddr = "" regex = re.compile('.+\..+') match = regex.search(...
OK = '\033[92m'
<|file_name|>whoispy.py<|end_file_name|><|fim▁begin|>import re import sys import whoisSrvDict import whoispy_sock import parser_branch OK = '\033[92m' FAIL = '\033[91m' ENDC = '\033[0m' def query(domainName): <|fim_middle|> # Display method def _display_fail(msg): sys.stdout.write( FAIL ) sys.stdout.wri...
rawMsg = "" tldName = "" whoisSrvAddr = "" regex = re.compile('.+\..+') match = regex.search(domainName) if not match: # Invalid domain _display_fail("Invalid domain format") return None # Divice TLD regex = re.compile('\..+') match = regex.search(domainName...