function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def dummy_export_progress_cb(*args, **kwargs):
pass | jflesch/paperwork-backend | [
19,
8,
19,
1,
1455881499
] |
def __init__(self, obj, export_format):
self.obj = obj
self.export_format = str(export_format)
self.can_change_quality = False | jflesch/paperwork-backend | [
19,
8,
19,
1,
1455881499
] |
def set_postprocess_func(self, postprocess_func):
raise NotImplementedError() | jflesch/paperwork-backend | [
19,
8,
19,
1,
1455881499
] |
def get_img(self):
"""
Returns a Pillow Image
"""
raise NotImplementedError() | jflesch/paperwork-backend | [
19,
8,
19,
1,
1455881499
] |
def get_file_extensions(self):
raise NotImplementedError() | jflesch/paperwork-backend | [
19,
8,
19,
1,
1455881499
] |
def __init__(self, config_path, user):
'''constructor
config_path -- the path where the base configuration is located
user -- the user account or identifier
'''
Cache.Cache.__init__(self, os.path.join(config_path,
user.strip()), 'pictures', True) | emesene/emesene | [
319,
167,
319,
34,
1262172530
] |
def list(self):
'''return a list of tuples (stamp, hash) of the elements on cache
'''
return self.parse().items() | emesene/emesene | [
319,
167,
319,
34,
1262172530
] |
def insert_url(self, url):
'''download and insert a new item into the cache
return the information (stamp, hash) on success None otherwise
item -- a path to an image
'''
path = os.path.join(tempfile.gettempdir(), "avatars")
try:
urlretrieve(url, path)
... | emesene/emesene | [
319,
167,
319,
34,
1262172530
] |
def __add_entry(self, hash_):
'''add an entry to the information file with the current timestamp
and the hash_ of the file that was saved
return (stamp, hash)
'''
time_info = int(time.time())
handle = file(self.info_path, 'a')
handle.write('%s %s\n' % (str(time_in... | emesene/emesene | [
319,
167,
319,
34,
1262172530
] |
def remove(self, item):
'''remove an item from cache
return True on success False otherwise
item -- the name of the image to remove
'''
if item not in self:
return False
os.remove(os.path.join(self.path, item))
self.__remove_entry(item)
return... | emesene/emesene | [
319,
167,
319,
34,
1262172530
] |
def inherit_docs(cls):
for name, func in vars(cls).items():
if not func.__doc__:
for parent in cls.__bases__:
parfunc = getattr(parent, name)
if parfunc and getattr(parfunc, '__doc__', None):
func.__doc__ = parfunc.__doc__
b... | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def __init__(self, size, position=None, colour=None):
Canvas.__init__(self, size, position, colour)
self._px_array = None | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def surface(self):
"""todo"""
if not self.has_surface:
ok = self._set_surface(self._get_surface()) # create surface
if not ok:
raise RuntimeError(Visual._compression_exception_message.format(
"surface"))
return self._surface | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def pixel_array(self):
"""todo"""
if self._px_array is None:
self._px_array = pygame.PixelArray(self.surface)
return self._px_array | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def pixel_array(self, value):
if self._px_array is None:
self._px_array = pygame.PixelArray(self.surface)
self._px_array = value | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def preload(self, inhibit_ogl_compress=False):
self.unlock_pixel_array()
return Canvas.preload(self, inhibit_ogl_compress) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def decompress(self):
self.unlock_pixel_array()
return Canvas.decompress(self) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def clear_surface(self):
self.unlock_pixel_array()
return Canvas.clear_surface(self) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def unload(self, keep_surface=False):
if not keep_surface:
self.unlock_pixel_array()
return Canvas.unload(self, keep_surface) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def scale(self, factors):
self.unlock_pixel_array()
return Canvas.scale(self, factors) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def flip(self, booleans):
self.unlock_pixel_array()
return Canvas.flip(self, booleans) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def scramble(self, grain_size):
self.unlock_pixel_array()
return Canvas.scramble(self, grain_size) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def __init__(self, n_data_rows, data_row_colours,
width=600, y_range=(-100, 100),
background_colour=(180, 180, 180),
marker_colour=(200, 200, 200),
position=None,
axis_colour=None):
self.n_data_rows = n_data_rows
self.d... | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def y_range(self):
return self.y_range | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def y_range(self, values):
"""tuple with lower and upper values"""
self._y_range = values
self._height = self._y_range[1] - self._y_range[0]
self._plot_axis = (self._y_range[0] <= 0 and \
self._y_range[1] >= 0) | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def data_row_colours(self):
return self._data_row_colours | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def data_row_colours(self, values):
"""data_row_colours: list of colour"""
try:
if not isinstance(values[0], list) and \
not isinstance(values[0], tuple): # one dimensional
values = [values]
except:
values = [[]] # values is not listp... | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def write_values(self, position, values, set_marker=False):
if set_marker:
self.pixel_array[position, :] = self.marker_colour
else:
self.pixel_array[position, :] = self._background_colour
if self._plot_axis and self.axis_colour != self._background_colour:
self... | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def __init__(self, n_data_rows, data_row_colours,
width=600, y_range=(-100, 100),
background_colour=(80, 80, 80),
marker_colour=(200, 200, 200),
position=None,
axis_colour=None):
super(PlotterThread, self).__init__()
se... | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def stop(self):
self.join() | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def run(self):
"""the plotter thread is constantly updating the the
pixel_area"""
while not self._stop_request.is_set():
# get data
if self._lock_new_values.acquire(False):
values = self._new_values
self._new_values = []
se... | lindemann09/pytrak | [
4,
3,
4,
1,
1402558831
] |
def __init__(self,root):
commands = map(
lambda m: m[8:].replace('_','-'),
filter(
lambda m: m.startswith('command_'),
runner.__dict__.keys())
)
commands.sort()
commands = "commands: %s" % ', '.join(commands) | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_cleanup(self,*args):
if not args or args == None or args == []: args = [ 'source', 'bin' ]
if 'source' in args:
self.log( 'Cleaning up "%s" directory ...' % self.boost_root )
self.rmtree( self.boost_root )
if 'bin' in args:
boost_bin_dir = os.pat... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_get_tools(self):
#~ Get Boost.Build v2...
self.log( 'Getting Boost.Build v2...' )
if self.user and self.user != '':
os.chdir( os.path.dirname(self.tools_bb_root) )
self.svn_command( 'co %s %s' % (
self.svn_repository_url(repo_path['build']),
... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_get_source(self):
self.refresh_timestamp()
self.log( 'Getting sources (%s)...' % self.timestamp() )
if self.user and self.user != '':
self.retry( self.svn_checkout )
else:
self.retry( self.get_tarball )
pass | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_update_source(self):
if self.user and self.user != '' \
or os.path.exists( os.path.join( self.boost_root, '.svn' ) ):
open( self.timestamp_path, 'w' ).close()
self.log( 'Updating sources from SVN (%s)...' % self.timestamp() )
self.retry( self.svn_updat... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_patch(self):
self.import_utils()
patch_boost_path = os.path.join( self.regression_root, self.patch_boost )
if os.path.exists( patch_boost_path ):
self.log( 'Found patch file "%s". Executing it.' % patch_boost_path )
os.chdir( self.regression_root )
... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_setup(self):
self.command_patch()
self.build_if_needed(self.bjam,self.bjam_toolset)
if self.pjl_toolset != 'python':
self.build_if_needed(self.process_jam_log,self.pjl_toolset) | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_test(self, *args):
if not args or args == None or args == []: args = [ "test", "process" ]
self.import_utils()
self.log( 'Making "%s" directory...' % self.regression_results )
utils.makedirs( self.regression_results )
results_libs = os.path.join( self.regression_res... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_test_clean(self):
results_libs = os.path.join( self.regression_results, 'libs' )
results_status = os.path.join( self.regression_results, 'status' )
self.rmtree( results_libs )
self.rmtree( results_status ) | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_test_run(self):
self.import_utils()
if self.pjl_toolset != 'python':
test_cmd = '%s -d2 preserve-test-targets=off --dump-tests %s "--build-dir=%s" >>"%s" 2>&1' % (
self.bjam_cmd( self.toolsets ),
self.bjam_options,
self.regression_r... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_test_process(self):
self.import_utils()
self.log( 'Getting test case results out of "%s"...' % self.regression_log )
cd = os.getcwd()
os.chdir( os.path.join( self.boost_root, 'status' ) )
utils.checked_system( [
'"%s" "%s" <"%s"' % (
self.t... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_collect_logs(self):
self.import_utils()
comment_path = os.path.join( self.regression_root, self.comment )
if not os.path.exists( comment_path ):
self.log( 'Comment file "%s" not found; creating default comment.' % comment_path )
f = open( comment_path, 'w' )
... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_upload_logs(self):
self.import_utils()
from collect_and_upload_logs import upload_logs
if self.ftp:
self.retry(
lambda:
upload_logs(
self.regression_results,
self.runner, self.tag,
... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_regression(self):
import socket
import string
try:
mail_subject = 'Boost regression for %s on %s' % ( self.tag,
string.split(socket.gethostname(), '.')[0] )
start_time = time.localtime()
if self.mail:
self.log( 'Send... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def command_show_revision(self):
modified = '$Date: 2010-01-13 13:03:18 -0500 (Wed, 13 Jan 2010) $'
revision = '$Revision: 58983 $'
import re
re_keyword_value = re.compile( r'^\$\w+:\s+(.*)\s+\$$' )
print '\n\tRevision: %s' % re_keyword_value.match( revision ).group( 1 )
... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def main(self):
for action in self.actions:
action_m = "command_"+action.replace('-','_')
if hasattr(self,action_m):
getattr(self,action_m)() | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def log(self,message):
sys.stdout.flush()
sys.stderr.flush()
sys.stderr.write( '# %s\n' % message )
sys.stderr.flush() | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def refresh_timestamp( self ):
if os.path.exists( self.timestamp_path ):
os.unlink( self.timestamp_path )
open( self.timestamp_path, 'w' ).close() | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def retry( self, f, max_attempts=5, sleep_secs=10 ):
for attempts in range( max_attempts, -1, -1 ):
try:
return f()
except Exception, msg:
self.log( '%s failed with message "%s"' % ( f.__name__, msg ) )
if attempts == 0:
... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def import_utils(self):
global utils
if utils is None:
sys.path.append( self.xsl_reports_dir )
import utils as utils_module
utils = utils_module | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def tool_path( self, name_or_spec ):
if isinstance( name_or_spec, basestring ):
return os.path.join( self.regression_root, name_or_spec )
if os.path.exists( name_or_spec[ 'path' ] ):
return name_or_spec[ 'path' ]
if name_or_spec.has_key( 'build_path' ):
retu... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def bjam_build_cmd( self, *rest ):
if sys.platform == 'win32':
cmd = 'build.bat %s' % self.bjam_toolset
else:
cmd = './build.sh %s' % self.bjam_toolset
env_setup_key = 'BJAM_ENVIRONMENT_SETUP'
if os.environ.has_key( env_setup_key ):
return '%s & %s' % ... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def bjam_cmd( self, toolsets, args = '', *rest ):
build_path = self.regression_root
if build_path[-1] == '\\': build_path += '\\' | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def send_mail( self, subject, msg = '' ):
import smtplib
if not self.smtp_login:
server_name = 'mail.%s' % mail.split( '@' )[-1]
user_name = None
password = None
else:
server_name = self.smtp_login.split( '@' )[-1]
( user_name, password... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def svn_checkout( self ):
os.chdir( self.regression_root )
self.svn_command( 'co %s %s' % (self.svn_repository_url(self.tag),'boost') ) | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def svn_command( self, command ):
svn_anonymous_command_line = 'svn --non-interactive %(command)s'
svn_command_line = 'svn --non-interactive --username=%(user)s %(command)s' | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def svn_repository_url( self, path ):
if self.user != 'anonymous' and self.user != '':
return '%s%s' % (repo_root['user'],path)
else:
return '%s%s' % (repo_root['anon'],path) | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def get_tarball( self, *args ):
if not args or args == []:
args = [ 'download', 'unpack' ]
tarball_path = None
if hasattr(self,'local') and self.local is not None:
tarball_path = self.local
elif 'download' in args:
tarball_path = self.download_tarbal... | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def tarball_url( self, path ):
return 'http://beta.boost.org/development/snapshot.php/%s' % path | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def boost_tarball_url( self ):
return self.tarball_url( self.tag ) | kelvindk/Video-Stabilization | [
1,
3,
1,
1,
1494752444
] |
def __init__(
self,
data,
name="test",
workdir="analysis-raxml",
*args,
**kwargs):
# path attributes
self._kwargs = {
"f": "a",
"T": 4, # <- change to zero !?
"m": "GTRGAMMA",
"N": 100,
"x": ... | dereneaton/ipyrad | [
63,
42,
63,
44,
1444236652
] |
def _command_list(self):
""" build the command list """
cmd = [
self.params.binary,
"-f", str(self.params.f),
"-T", str(self.params.T),
"-m", str(self.params.m),
"-n", str(self.params.n),
"-w", str(self.params.w),
"-s... | dereneaton/ipyrad | [
63,
42,
63,
44,
1444236652
] |
def command(self):
""" returns command as a string """
return " ".join(self._command_list) | dereneaton/ipyrad | [
63,
42,
63,
44,
1444236652
] |
def _get_binary_paths():
# check for binary
list_binaries = [
"raxmlHPC-PTHREADS-AVX2",
"raxmlHPC-PTHREADS-AVX",
"raxmlHPC-PTHREADS-SSE3",
"raxmlHPC-PTHREADS",
]
# expand for env path
list_binaries = [os.path.join(sys.prefix, "bin", i) for i in list_b... | dereneaton/ipyrad | [
63,
42,
63,
44,
1444236652
] |
def _call_raxml(command_list):
""" call the command as sps """
proc = subprocess.Popen(
command_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE
)
comm = proc.communicate()
return comm | dereneaton/ipyrad | [
63,
42,
63,
44,
1444236652
] |
def rx():
ifstat = open('/proc/net/dev').readlines()
for interface in ifstat:
#print '----', interface, '-----'
if INTERFACE in interface:
stat = float(interface.split()[1])
STATS[0:] = [stat] | soarpenguin/python-scripts | [
63,
40,
63,
1,
1397484324
] |
def setUp (self):
self.tb = gr.top_block ()
self.tp = drm.transm_params(1, 3, False, 0, 1, 0, 1, 1, 0, False, 24000, "station label", "text message")
vlen_msc = self.tp.msc().N_MUX() * self.tp.ofdm().M_TF()
vlen_sdc = self.tp.sdc().N()
vlen_fac = self.tp.fac().N() * self.tp.ofdm(... | kit-cel/gr-drm | [
64,
27,
64,
8,
1347630228
] |
def test_001_t (self):
# set up fg
self.tb.run ()
# check data | kit-cel/gr-drm | [
64,
27,
64,
8,
1347630228
] |
def check_create_table(conn):
global num
c = conn.cursor()
c.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='electrum_payments';")
data = c.fetchall()
if not data:
c.execute("""CREATE TABLE electrum_payments (address VARCHAR(40), amount FLOAT, confirmations INT(8), rece... | electrumalt/electrum-doge | [
20,
11,
20,
7,
1416825131
] |
def on_wallet_update():
for addr, v in pending_requests.items():
h = wallet.history.get(addr, [])
requested_amount = v.get('requested')
requested_confs = v.get('confirmations')
value = 0
for tx_hash, tx_height in h:
tx = wallet.transactions.get(tx_hash)
... | electrumalt/electrum-doge | [
20,
11,
20,
7,
1416825131
] |
def do_stop(password):
global stopping
if password != my_password:
return "wrong password"
stopping = True
return "ok" | electrumalt/electrum-doge | [
20,
11,
20,
7,
1416825131
] |
def do_dump(password):
if password != my_password:
return "wrong password"
conn = sqlite3.connect(database);
cur = conn.cursor()
# read pending requests from table
cur.execute("SELECT oid, * FROM electrum_payments;")
data = cur.fetchall()
return map(row_to_dict, data) | electrumalt/electrum-doge | [
20,
11,
20,
7,
1416825131
] |
def send_command(cmd, params):
import jsonrpclib
server = jsonrpclib.Server('http://%s:%d'%(my_host, my_port))
try:
f = getattr(server, cmd)
except socket.error:
print "Server not running"
return 1 | electrumalt/electrum-doge | [
20,
11,
20,
7,
1416825131
] |
def db_thread():
conn = sqlite3.connect(database);
# create table if needed
check_create_table(conn)
while not stopping:
cur = conn.cursor()
# read pending requests from table
cur.execute("SELECT address, amount, confirmations FROM electrum_payments WHERE paid IS NULL;")
... | electrumalt/electrum-doge | [
20,
11,
20,
7,
1416825131
] |
def ssh_key_string_to_obj(text):
key_f = StringIO(text)
key = None
try:
key = paramiko.RSAKey.from_private_key(key_f)
except paramiko.SSHException:
pass
try:
key = paramiko.DSSKey.from_private_key(key_f)
except paramiko.SSHException:
pass
return key | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def ssh_key_gen(length=2048, type='rsa', password=None,
username='jumpserver', hostname=None):
"""Generate user ssh private and public key
Use paramiko RSAKey generate it.
:return private key str and public key str
"""
if hostname is None:
hostname = os.uname()[1]
f = ... | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def to_unixtime(time_string, format_string):
with _STRPTIME_LOCK:
return int(calendar.timegm(time.strptime(str(time_string), format_string))) | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def http_to_unixtime(time_string):
"""把HTTP Date格式的字符串转换为UNIX时间(自1970年1月1日UTC零点的秒数)。
HTTP Date形如 `Sat, 05 Dec 2015 11:10:29 GMT` 。
"""
return to_unixtime(time_string, _GMT_FORMAT) | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def make_signature(access_key_secret, date=None):
if isinstance(date, bytes):
date = date.decode("utf-8")
if isinstance(date, int):
date_gmt = http_date(date)
elif date is None:
date_gmt = http_date(int(time.time()))
else:
date_gmt = date
data = str(access_key_secret... | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def __init__(self, width=80, height=24):
self.screen = pyte.Screen(width, height)
self.stream = pyte.ByteStream()
self.stream.attach(self.screen)
self.ps1_pattern = re.compile(r'^\[?.*@.*\]?[\$#]\s|mysql>\s') | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def parse_output(self, data, sep='\n'):
"""
Parse user command output
:param data: output data list like, [b'data', b'data']
:param sep: line separator
:return: output unicode data
"""
output = []
for d in data:
self.stream.feed(d)
f... | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def wrap_with_line_feed(s, before=0, after=1):
if isinstance(s, bytes):
return b'\r\n' * before + s + b'\r\n' * after
return '\r\n' * before + s + '\r\n' * after | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def wrap_with_warning(text, bolder=False):
return wrap_with_color(text, color='red', bolder=bolder) | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def wrap_with_primary(text, bolder=False):
return wrap_with_color(text, color='green', bolder=bolder) | ibuler/coco | [
1,
2,
1,
1,
1508170309
] |
def __init__(self, id=None, pmid="", pmc="", doi="", url="",
authors=None, year="", title="", journal="", abstract=""):
super(Reference, self).__init__()
self._linked_items = set()
self.id = id or str(uuid4())
self.pmid = pmid
self.pmc = pmc
self.doi = do... | JuBra/GEMEditor | [
1,
3,
1,
5,
1493549658
] |
def linked_items(self):
return self._linked_items.copy() | JuBra/GEMEditor | [
1,
3,
1,
5,
1493549658
] |
def annotation(self):
result = set()
if self.pmid:
result.add(Annotation("pubmed", self.pmid))
if self.pmc:
result.add(Annotation("pmc", self.pmc))
if self.doi:
result.add(Annotation("doi", self.doi))
return result | JuBra/GEMEditor | [
1,
3,
1,
5,
1493549658
] |
def remove_link(self, item, reciprocal=True):
""" Remove reference link from item
Parameters
----------
item: GEMEditor.model.classes.base.ReferenceLink
reciprocal: bool
"""
self._linked_items.discard(item)
if reciprocal:
item.remove_reference... | JuBra/GEMEditor | [
1,
3,
1,
5,
1493549658
] |
def reference_string(self):
""" Get the authors part of the usual citation of scientific literature i.e.:
Lastname F et al., YYYY if there are more than 2 authors
Lastname1 F1 and Lastname2 F2, YYYY if there are 2 authors
Lastname F, YYYY if there is only one author
... | JuBra/GEMEditor | [
1,
3,
1,
5,
1493549658
] |
def __new__(cls, lastname="", firstname="", initials=""):
self = super(Author, cls).__new__(cls,
lastname=lastname,
firstname=firstname,
initials=initials)
return self | JuBra/GEMEditor | [
1,
3,
1,
5,
1493549658
] |
def __init__(self, langid):
syndata.SyntaxDataBase.__init__(self, langid)
# Setup
self.SetLexer(stc.STC_LEX_HTML)
self.RegisterFeature(synglob.FEATURE_AUTOINDENT, AutoIndenter) | beiko-lab/gengis | [
28,
14,
28,
18,
1363614616
] |
def GetSyntaxSpec(self):
"""Syntax Specifications """
return _html.SYNTAX_ITEMS + SYNTAX_ITEMS | beiko-lab/gengis | [
28,
14,
28,
18,
1363614616
] |
def GetCommentPattern(self):
"""Returns a list of characters used to comment a block of code
@note: assuming pure php code for comment character(s)
"""
return [u'//'] | beiko-lab/gengis | [
28,
14,
28,
18,
1363614616
] |
def KeywordString(option=0):
"""Returns the specified Keyword String
@note: not used by most modules
"""
return PHP_KEYWORDS | beiko-lab/gengis | [
28,
14,
28,
18,
1363614616
] |
def __init__(self, context={}):
self.secret_manager = cis_publisher.secret.Manager()
self.context = context
self.report = None
self.config = cis_publisher.common.get_config()
self.s3_cache = None
self.s3_cache_require_update = False
# Only fields we care about for... | mozilla-iam/cis | [
11,
27,
11,
17,
1491581357
] |
def save_s3_cache(self, data):
"""
@data dict JSON
"""
if self.s3_cache_require_update is False:
return
s3 = boto3.client("s3")
bucket = os.environ.get("CIS_BUCKET_URL")
s3.put_object(Bucket=bucket, Key="cache.json", Body=json.dumps(data))
log... | mozilla-iam/cis | [
11,
27,
11,
17,
1491581357
] |
def fetch_all_cis_user_ids(self, publisher):
"""
Get all known CIS user ids for the whitelisted login methods
This is here because CIS only returns user ids per specific login methods
We also cache this
"""
self.s3_cache = self.get_s3_cache()
if self.s3_cache is ... | mozilla-iam/cis | [
11,
27,
11,
17,
1491581357
] |
def fetch_az_users(self, user_ids=None):
"""
Fetches ALL valid users from auth0'z database
Returns list of user attributes
"""
# Memory cached?
if self.az_users is not None:
return self.az_users
# S3 cached?
self.get_s3_cache()
if self... | mozilla-iam/cis | [
11,
27,
11,
17,
1491581357
] |
def process(self, publisher, user_ids):
"""
Process profiles and post them
@publisher object the publisher object to operate on
@user_ids list of user ids to process in this batch
"""
# Only process the requested user_ids from the list of all az users
# as the li... | mozilla-iam/cis | [
11,
27,
11,
17,
1491581357
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.