prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
cast_cls = str def _validate(self, value): if not isinstance(value, (str, unicode)): return False return True
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
if not isinstance(value, (str, unicode)): return False return True
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
cast_cls = int _cast_fallback_value = 0 def __init__(self, *args, **kwargs): super(IntField, self).__init__(*args, **kwargs) if self.missing_value is None: self.missing_value = self._cast_fallback_value def _cast_type(self, value): try: return self.cast...
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
super(IntField, self).__init__(*args, **kwargs) if self.missing_value is None: self.missing_value = self._cast_fallback_value
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
try: return self.cast_cls(value) except ValueError, exc: if self.missing_value is False: raise FieldTypeConversionError('Could not convert ' 'data or use missing_value: %s' ...
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
cast_class = float _cast_fallback_value = 0.0
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
cls = None """Field class to represent list items""" def __init__(self, cls, *args, **kwargs): assert isinstance(cls, Field), 'cls is not a valid Field instance' self.cls = cls super(ListField, self).__init__(*args, **kwargs) def _validate(self, value): if not isinsta...
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
assert isinstance(cls, Field), 'cls is not a valid Field instance' self.cls = cls super(ListField, self).__init__(*args, **kwargs)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
if not isinstance(value, (list, tuple)): raise FieldValidationException('ListField requires data ' 'to be a sequence type') for x in value: self.cls.set_data(value) self.data = value return True
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
def __init__(self): self.input_data = {} self._fields = {} self._map = {} self._required = [] self._setup_fields() def get_name(self): return self.__class__.__name__ def __call__(self, data): return self.input(data) def input(self, data): ...
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self.input_data = {} self._fields = {} self._map = {} self._required = [] self._setup_fields()
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
return self.__class__.__name__
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
return self.input(data)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self._map = {} if not isinstance(data, dict): raise VectorInputTypeError('Vector input not a dictionary') self._validate(data) self._map_attrs(data)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self._fields = {} for a in dir(self): v = getattr(self, a) if isinstance(v, Field): self._fields[a] = v if v.required: self._required.append(a) self._reset_fields()
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
for f in self.get_fields(): setattr(self, f, None)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
for f in self._required: if f not in input_data: raise FieldRequiredError('Missing field %s is a required field' % f) for k, v in input_data.iteritems(): if k in self.get_fields(): f = self.get_field(k) ...
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self.input_data = input_data for k, v in self.input_data.iteritems(): if k in self.get_fields(): # setattr(self, k, self.get_field(k).data) self._map[k] = self.get_field(k).data else: # setattr(self, k, v) self._map...
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
return self._fields
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
return self._fields[name]
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
return self._map
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
if not self._validate(value): raise FieldValidationException('%s does not ' 'except this value' % self.__class__.__name__)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
raise FieldValidationException('%s does not ' 'except this value' % self.__class__.__name__)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
value = self._cast_type(value)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
return False
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self.missing_value = self._cast_fallback_value
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
raise FieldTypeConversionError('Could not convert ' 'data or use missing_value: %s' % exc)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
raise FieldValidationException('ListField requires data ' 'to be a sequence type')
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
raise VectorInputTypeError('Vector input not a dictionary')
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self._fields[a] = v if v.required: self._required.append(a)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self._required.append(a)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
raise FieldRequiredError('Missing field %s is a required field' % f)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
f = self.get_field(k) f.set_data(v)
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self._map[k] = self.get_field(k).data
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
self._map[k] = v
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
__init__
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_validate
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_cast_type
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
set_data
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_validate
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
__init__
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_cast_type
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
__init__
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_validate
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
__init__
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
get_name
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
__call__
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
input
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_setup_fields
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_reset_fields
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_validate
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
_map_attrs
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
get_fields
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
get_field
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import ( FieldValidationException, FieldTypeConversionError, FieldRequiredError, VectorInputTypeError ) class Field(object): required = True """Field is required and an exception will be raised if missing""" missin...
data
<|file_name|>6.py<|end_file_name|><|fim▁begin|># Nov 22, 2014 # This patch is to create all the prep/sample template files and link them in # the database so they are present for download from os.path import join from time import strftime from qiita_db.util import get_mountpoint from qiita_db.sql_connection import SQ...
if SampleTemplate.exists(study_id): st = SampleTemplate(study_id)
<|file_name|>6.py<|end_file_name|><|fim▁begin|># Nov 22, 2014 # This patch is to create all the prep/sample template files and link them in # the database so they are present for download from os.path import join from time import strftime from qiita_db.util import get_mountpoint from qiita_db.sql_connection import SQ...
st = SampleTemplate(study_id) fp = join(fp_base, '%d_%s.txt' % (study_id, strftime("%Y%m%d-%H%M%S"))) st.to_file(fp) st.add_filepath(fp)
<|file_name|>mesh2vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import numpy as np mdir = "mesh3d/" fname = "out_p6-p4-p8" #################### print "input mesh data file" f1 = open(mdir+fname+".mesh", 'r') for line in f1: if line.startswith("Vertices"): break pcount = int(f1.next()) xyz = np.empty((pco...
f2.write("CELL_TYPES "+str(vol_count[i])+"\n") for t in range(vol_count[i]): f2.write("10 ")
<|file_name|>mesh2vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import numpy as np mdir = "mesh3d/" fname = "out_p6-p4-p8" #################### print "input mesh data file" f1 = open(mdir+fname+".mesh", 'r') for line in f1: if line.startswith("Vertices"): <|fim_middle|> ...
break
<|file_name|>mesh2vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import numpy as np mdir = "mesh3d/" fname = "out_p6-p4-p8" #################### print "input mesh data file" f1 = open(mdir+fname+".mesh", 'r') for line in f1: if line.startswith("Vertices"): break pcount = int(f1.next()) xyz = np.empty((pco...
break
<|file_name|>mesh2vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import numpy as np mdir = "mesh3d/" fname = "out_p6-p4-p8" #################### print "input mesh data file" f1 = open(mdir+fname+".mesh", 'r') for line in f1: if line.startswith("Vertices"): break pcount = int(f1.next()) xyz = np.empty((pco...
break
<|file_name|>mesh2vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import numpy as np mdir = "mesh3d/" fname = "out_p6-p4-p8" #################### print "input mesh data file" f1 = open(mdir+fname+".mesh", 'r') for line in f1: if line.startswith("Vertices"): break pcount = int(f1.next()) xyz = np.empty((pco...
f2.write("3 "+str(v[0]-1)+' '+str(v[1]-1)+' '+str(v[2]-1)+'\n')
<|file_name|>mesh2vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import numpy as np mdir = "mesh3d/" fname = "out_p6-p4-p8" #################### print "input mesh data file" f1 = open(mdir+fname+".mesh", 'r') for line in f1: if line.startswith("Vertices"): break pcount = int(f1.next()) xyz = np.empty((pco...
f2.write("4 "+str(v[0]-1)+' '+str(v[1]-1)+' '+str(v[2]-1)+' '+str(v[3]-1)+'\n')
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
return str(args.major) + "." + str(args.minor) + "." + str(args.maintenance)
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
print("--- Processing " + os.path.basename(name)) with open(name) as source: data = rule(source.read(), args) if not data: return print("Writing " + name) with open(name) as dest: dest = open(name, "w") dest.write(data)
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
new_version = version_str(args) regex = r"## \[Unreleased\]" subst = r"## [Unreleased]\n\n## [" + new_version + r"] - " + datetime.date.today().isoformat() result = re.subn(regex, subst, data) if result[1] != 1: return None regex = r"(\[Unreleased)(\]: https://github.com/morinim/vita/...
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
regex = r"([\s]+)(\*[\s]+\\mainpage VITA v)([\d]+)\.([\d]+)\.([\d]+)([\s]*)" subst = r"\g<1>\g<2>" + version_str(args) + r"\g<6>" result = re.subn(regex, subst, data) return result[0] if result[1] > 0 else None
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
description = "Helps to set up a new version of Vita" parser = argparse.ArgumentParser(description = description) parser.add_argument("-v", "--verbose", action = "store_true", help = "Turn on verbose mode") # Now the positional arguments. parser.add_argument("major", type=i...
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
args = get_cmd_line_options().parse_args() print("Setting version to v" + str(args.major) + "." + str(args.minor) + "." + str(args.maintenance)) file_process("../NEWS.md", changelog_rule, args) file_process("../doc/doxygen/doxygen.h", doxygen_rule, args) print("\n\nRELEASE NOT...
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
return
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
return None
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
main()
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
version_str
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
file_process
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
changelog_rule
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
doxygen_rule
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
get_cmd_line_options
<|file_name|>setversion.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # Copyright (C) 2017-2020 EOS di Manlio Morini. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla....
main
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
try: if not isinstance(contact, list):
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
"""get list of messages""" frappe.form_dict['limit_start'] = int(frappe.form_dict['limit_start']) frappe.form_dict['limit_page_length'] = int(frappe.form_dict['limit_page_length']) frappe.form_dict['user'] = frappe.session['user'] # set all messages as read frappe.db.begin() frappe.db.sql("""UPDATE `tabCommunic...
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
data = frappe.db.sql("""select name, (select count(*) from tabSessions where user=tabUser.name and timediff(now(), lastupdate) < time("01:00:00")) as has_session from tabUser where enabled=1 and ifnull(user_type, '')!='Website User' and name not in ({}) order by first_name""".format(", ".join(["%s"]*le...
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
"""post message""" d = frappe.new_doc('Communication') d.communication_type = 'Notification' if parenttype else 'Chat' d.subject = subject d.content = txt d.reference_doctype = 'User' d.reference_name = contact d.sender = frappe.session.user d.insert(ignore_permissions=True) delete_notification_count_for("M...
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
frappe.get_doc("Communication", frappe.form_dict['name']).delete()
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
from frappe.utils import get_fullname, get_url try: if not isinstance(contact, list): contact = [frappe.db.get_value("User", contact, "email") or contact] frappe.sendmail(\ recipients=contact, sender= frappe.db.get_value("User", frappe.session.user, "email"), subject=subject or "New Message from " + ...
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
return frappe.db.sql("""select * from `tabCommunication` where communication_type in ('Chat', 'Notification') and reference_doctype ='User' and (owner=%(contact)s or reference_name=%(user)s or owner=reference_name) order by creation desc limit %(limit_start)s, %(limit_page_length)s""", ...
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
return frappe.db.sql("""select * from `tabCommunication` where communication_type in ('Chat', 'Notification') and reference_doctype ='User' and ((owner=%(contact)s and reference_name=%(user)s) or (owner=%(contact)s and reference_name=%(contact)s)) order by creation desc limit %(limit_start)s...
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
data[users.index(frappe.session.user)]["has_session"] = 100
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
data.append({"name": frappe.session.user, "has_session": 100})
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
if contact==frappe.session.user: _notify([user.name for user in get_enabled_system_users()], txt) else: _notify(contact, txt, subject)
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
_notify([user.name for user in get_enabled_system_users()], txt)
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
_notify(contact, txt, subject)
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
contact = [frappe.db.get_value("User", contact, "email") or contact]
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
get_list
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
get_active_users
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
post
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
delete
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.desk.notifications import delete_notification_count_for from frappe.core.docty...
_notify
<|file_name|>hamming_distance.py<|end_file_name|><|fim▁begin|>def hamming(s,t): <|fim▁hole|> dist = 0 for x in range(len(s)): if s[x]!=t[x]: dist+=1 return dist<|fim▁end|>
<|file_name|>hamming_distance.py<|end_file_name|><|fim▁begin|>def hamming(s,t): <|fim_middle|> <|fim▁end|>
dist = 0 for x in range(len(s)): if s[x]!=t[x]: dist+=1 return dist