function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def GetStatus(self):
"""
返回本次Mutation的结果状态
Returns:
(class Status) 操作结果状态,可以获知成功或失败,若失败,具体原因
"""
return Status(lib.tera_row_mutation_get_status_code(self.mutation)) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def DeleteColumn(self, cf, qu):
""" 删除这一行上
ColumnFamily为<cf>, Qualifier为<qu>的cell
Args:
cf(string): ColumnFamily名
qu(string): Qualifier名
"""
lib.tera_row_mutation_delete_column(self.mutation, cf,
qu, c_uint6... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def PutInt64(self, cf, qu, value):
""" 写入(修改)这一行上
ColumnFamily为<cf>, Qualifier为<qu>的cell值为<value>
Args:
cf(string): ColumnFamily名
qu(string): Qualifier名
value(long): cell的值
"""
lib.tera_row_mutation_put_int64(self.mutation, cf,
... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def __init__(self, table):
""" init """
self.table = table | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def NewRowMutation(self, rowkey):
""" 生成一个对 rowkey 的RowMutation对象(修改一行)
一个RowMutation对某一行的操作(例如多列修改)是原子的
Args:
rowkey(string): 待变更的rowkey
Returns:
(class RowMutation): RowMutation对象
"""
return RowMutation(lib.tera_row_mutation(self.table, rowkey,
... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def NewRowReader(self, rowkey):
""" 生成一个对 rowkey 的RowReader对象(读取一行)
一个RowReader对某一行的操作(例如读取多列)是原子的
Args:
rowkey(string): 待读取的rowkey
Returns:
(class RowReader): RowReader对象
"""
return RowReader(lib.tera_row_reader(self.table, rowkey,
... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def IsPutFinished(self):
""" table的异步写操作是否*全部*完成
Returns:
(bool) 全部完成则返回true,否则返回false.
"""
return lib.tera_table_is_put_finished(self.table) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def BatchGet(self, row_reader_list):
""" 批量get
用法类似 ApplyReader
Args:
row_reader_list(RowReader): 预先构造好的RowReader列表
每一行的读取结果存储在row_reader_list里对应的每个RowReader内,
如果该行读取成功(即返回的状态码是OK),
那么可以调用诸如RowReader.Value()访问读取结果
否则读取出错,通过状态码... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def GetInt64(self, rowkey, cf, qu, snapshot):
""" 类同Get()接口,区别是将cell的内容作为int64计数器返回
对非int64计数器的cell调用此方法属于未定义行为
Args:
rowkey(string): Rowkey的值
cf(string): ColumnFamily名
qu(string): Qualifier名
snapshot(long): 快照,不关心的用户设置为0即可
Returns:
... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def BatchPut(self, row_mutation_list):
""" 批量put
用法类似 ApplyMutation
Args:
row_mutation_list(RowMutation): 预先构造好的RowMutation列表
每一行的写入操作返回状态存储在row_mutation_list里对应的每个RowMutation内,
如果写入失败,通过状态码确定原因。
用法详见sample.py
"""
num = len(r... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def Delete(self, rowkey, cf, qu):
""" 同步删除某个cell
Args:
rowkey(string): Rowkey的值
cf(string): ColumnFamily名
qu(string): Qualifier名
"""
lib.tera_table_delete(
self.table, rowkey, c_uint64(len(rowkey)),
cf, qu, c_uint64(len(qu))
... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def __init__(self, reader):
""" init """
self.reader = reader | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def AddColumn(self, cf, qu):
""" 添加期望读取的Column
默认读取一行(row)的全部Column(ColumnFamily + Qualifier)
Args:
cf(string): 期望读取的ColumnFamily
qu(string): 期望读取的Qualifier
"""
lib.tera_row_reader_add_column(self.reader, cf, qu, c_uint64(len(qu))) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def SetTimestamp(self, ts):
""" set timestamp """
lib.tera_row_reader_set_timestamp(self.reader, ts) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def SetSnapshot(self, snapshot):
""" set snapshot """
lib.tera_row_reader_set_snapshot(self.reader, snapshot) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def SetTimeout(self, timeout):
""" set timeout """
lib.tera_row_reader_set_timeout(self.reader, timeout) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def Next(self):
""" 迭代到下一个cell
"""
lib.tera_row_reader_next(self.reader) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def Value(self):
"""
Returns:
(string) 当前cell对应的value
"""
value = POINTER(c_ubyte)()
vallen = c_uint64()
lib.tera_row_reader_value(self.reader, byref(value), byref(vallen))
return copy_string_to_user(value, long(vallen.value)) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def Family(self):
"""
Returns:
(string) 当前cell对应的ColumnFamily
"""
value = POINTER(c_ubyte)()
vallen = c_uint64()
lib.tera_row_reader_family(self.reader, byref(value), byref(vallen))
return copy_string_to_user(value, long(vallen.value)) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def Timestamp(self):
"""
Returns:
(long) 当前cell对应的时间戳,Unix time
"""
return lib.tera_row_reader_timestamp(self.reader) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def Destroy(self):
"""
销毁这个mutation,释放底层资源,以后不得再使用这个对象
"""
lib.tera_row_reader_destroy(self.reader) | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def __init__(self, reason):
""" init """
self.reason = reason | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def init_function_prototype_for_scan():
""" scan """
######################
# scan result stream #
######################
lib.tera_result_stream_done.argtypes = [c_void_p,
POINTER(c_char_p)]
lib.tera_result_stream_done.restype = c_bool
lib.tera_re... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def init_function_prototype_for_table():
""" table """
lib.tera_table_get.argtypes = [c_void_p, c_char_p, c_uint64,
c_char_p, c_char_p, c_uint64,
POINTER(POINTER(c_ubyte)),
POINTER(c_uint64),
... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def init_function_prototype_for_row_reader():
""" row_reader """
lib.tera_row_reader.argtypes = [c_void_p, c_char_p, c_uint64]
lib.tera_row_reader.restype = c_void_p
lib.tera_row_reader_add_column_family.argtypes = [c_void_p, c_char_p]
lib.tera_row_reader_add_column_family.restype = None
lib.t... | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def copy_string_to_user(value, size):
""" copy string """
result = string_at(value, size)
libc.free(value)
return result | BaiduPS/tera | [
1876,
447,
1876,
171,
1395818525
] |
def main(filename):
""" Given an input file containing nothing but styles, print out an
unrolled list of declarations in cascade order.
"""
input = open(filename, 'r').read()
declarations = cascadenik.stylesheet_declarations(input, is_merc=True) | mapnik/Cascadenik | [
107,
19,
107,
13,
1281417927
] |
def __init__(self,**params):
self.warning("CFPLF_SOM is deprecated -- see the example in cfsom_or.ty for how to build a SOM") | ioam/topographica | [
51,
31,
51,
228,
1348109103
] |
def test_ClientAuthMethod_login(self):
ca = ClientAuthMethod(username,password)
self.assertNotEqual(ca, None) | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def test_bad_user_details(self):
self.assertRaises(IOError, ClientAuthMethod, 'asdsa', '') | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def automated_oauth_approval(url):
#general process is:
# 1. assume user isn't logged in, so get redirected to google accounts
# login page. login using test account credentials
# 2. redirected back to oauth approval page. br.submit() should choose the
# first submit on that page, which is the "Acce... | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def test_oauth_login(self):
auth = OAuthMethod(oauth_key, oauth_secret)
self.assertNotEqual(auth, None) | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def test_full_auth_process_without_callback(self):
auth = OAuthMethod(oauth_key, oauth_secret)
auth.setRequestToken()
auth_url = auth.buildAuthUrl()
response = automated_oauth_approval(auth_url)
auth.setAccessToken()
reader = GoogleReader(auth)
info = reader.getU... | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def mechanize_oauth2_approval(url):
"""
general process is:
1. assume user isn't logged in, so get redirected to google accounts
login page. login using account credentials
But, if the user has already granted access, the user is auto redirected without
having to confirm again.
2. redirected... | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def test_full_auth_and_access_userdata(self):
auth = OAuth2Method(client_id, client_secret)
auth.setRedirectUri(redirect_url)
url = auth.buildAuthUrl()
token = automated_oauth2_approval(url)
auth.code = token
auth.setAccessToken()
reader = GoogleReader(auth)
... | askedrelic/libgreader | [
70,
24,
70,
3,
1256666681
] |
def __init__(self, parent, view, model):
"""
Constructor of the navigation component
:param sakia.gui.network.view.NetworkView: the view
:param sakia.gui.network.model.NetworkModel model: the model
"""
super().__init__(parent)
self.view = view
self.model ... | ucoin-io/cutecoin | [
62,
24,
62,
67,
1391110718
] |
def create(cls, parent, app, network_service):
"""
:param PyQt5.QObject parent:
:param sakia.app.Application app:
:param sakia.services.NetworkService network_service:
:return:
"""
view = NetworkView(parent.view,)
model = NetworkModel(None, app, network_s... | ucoin-io/cutecoin | [
62,
24,
62,
67,
1391110718
] |
def refresh_nodes_manually(self):
self.model.refresh_nodes_once() | ucoin-io/cutecoin | [
62,
24,
62,
67,
1391110718
] |
def set_root_node(self):
node = self.sender().data()
self.model.add_root_node(node) | ucoin-io/cutecoin | [
62,
24,
62,
67,
1391110718
] |
def unset_root_node(self):
node = self.sender().data()
self.model.unset_root_node(node) | ucoin-io/cutecoin | [
62,
24,
62,
67,
1391110718
] |
def validate_filter_rules(filter_rules, all_categories):
"""Validate the given filter rules, and raise a ValueError if not valid.
Args:
filter_rules: A list of boolean filter rules, for example--
["-whitespace", "+whitespace/braces"]
all_categories: A list of all available categ... | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __init__(self, filter_rules=None):
"""Create a category filter.
Args:
filter_rules: A list of strings that are filter rules, which
are strings beginning with the plus or minus
symbol (+/-). The list should include any
... | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __eq__(self, other):
"""Return whether this CategoryFilter instance is equal to another."""
return self._filter_rules == other._filter_rules | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __ne__(self, other):
# Python does not automatically deduce from __eq__().
return not (self == other) | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __init__(self, base_rules=None, path_specific=None, user_rules=None):
"""Create a FilterConfiguration instance.
Args:
base_rules: The starting list of filter rules to use for
processing. The default is the empty list, which
by itself would mean... | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __eq__(self, other):
"""Return whether this FilterConfiguration is equal to another."""
if self._base_rules != other._base_rules:
return False
if self._path_specific != other._path_specific:
return False
if self.user_rules != other.user_rules:
retu... | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __ne__(self, other):
# Python does not automatically deduce this from __eq__().
return not self.__eq__(other) | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def _get_path_specific_lower(self):
"""Return a copy of self._path_specific with the paths lower-cased."""
if self._path_specific_lower is None:
self._path_specific_lower = []
for (sub_paths, path_rules) in self._path_specific:
sub_paths = map(str.lower, sub_paths... | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def _filter_from_path_rules(self, path_rules):
"""Return the CategoryFilter associated to a path rules tuple."""
# We reuse the same CategoryFilter where possible to take
# advantage of the caching they do.
if path_rules not in self._path_rules_to_filter:
rules = list(self._b... | cattleprod/samsung-kernel-gt-i9100 | [
1,
1,
1,
1,
1322678144
] |
def __init__(self, items = [], loop = False):
"""Initialisation.
items = set of items that can be iterated over. Must be finite.
If an iterator is supplied, it is enumerated into a list during initialisation.
"""
super(Chooser,self).__init__() | sparkslabs/kamaelia_ | [
13,
3,
13,
2,
1348148442
] |
def shutdown(self):
if self.dataReady("control"):
message = self.recv("control")
if isinstance(message, shutdownMicroprocess):
self.send(message, "signal")
return True
return False | sparkslabs/kamaelia_ | [
13,
3,
13,
2,
1348148442
] |
def __init__(self):
self._nodes = {}
self._params = {}
self._num_input = 0
self._num_param = 0 | TuSimple/mxnet | [
28,
25,
28,
1,
1457693796
] |
def from_onnx(self, graph):
"""Construct symbol from onnx graph.
Parameters
----------
graph : onnx protobuf object
The loaded onnx graph
Returns
-------
sym :symbol.Symbol
The returned mxnet symbol
params : dict
A dic... | TuSimple/mxnet | [
28,
25,
28,
1,
1457693796
] |
def testConstants(self):
self.assertIsInstance(NSMetadataQueryDidStartGatheringNotification, unicode)
self.assertIsInstance(NSMetadataQueryGatheringProgressNotification, unicode)
self.assertIsInstance(NSMetadataQueryDidFinishGatheringNotification, unicode)
self.assertIsInstance(NSMetadat... | albertz/music-player | [
483,
61,
483,
16,
1345772141
] |
def testConstants10_7(self):
self.assertIsInstance(NSMetadataQueryLocalDocumentsScope, unicode)
self.assertIsInstance(NSMetadataQueryUbiquitousDocumentsScope, unicode)
self.assertIsInstance(NSMetadataQueryUbiquitousDataScope, unicode)
self.assertIsInstance(NSMetadataItemFSNameKey, unico... | albertz/music-player | [
483,
61,
483,
16,
1345772141
] |
def uniform_path_format(native_path):
"""Alters the path if needed to be separated by forward slashes."""
return posixpath.normpath(native_path.replace(os.sep, posixpath.sep)) | nwjs/chromium.src | [
136,
133,
136,
45,
1453904223
] |
def aggregate_components_from_owners(all_owners_data, root):
"""Converts the team/component/os tags parsed from OWNERS into mappings.
Args:
all_owners_data (dict): A mapping from relative path to a dir to a dict
mapping the tag names to their values. See docstring for scrape_owners.
root (str): the... | nwjs/chromium.src | [
136,
133,
136,
45,
1453904223
] |
def __init__(self, sheet_key):
self.sheet_key = sheet_key | pmarks-net/dtella | [
5,
2,
5,
11,
1426380623
] |
def __init__(self, channel):
self._closed = False
self._local_namespace = {}
self.channel = channel
self.box = Box(self)
self.async_replies = {}
self.sync_replies = {}
self.module_cache = {}
self.remote_conn = self.sync_request("handle_getconn")
# ... | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def close(self):
"""closes down the connection and releases all cyclic dependecies"""
if not self._closed:
self.box.close()
self.channel.close()
self._closed = True
self._local_namespace = None
self.channel = None
self.box = None
... | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def send(self, type, seq, obj):
if self._closed:
raise EOFError("the connection is closed")
return self.channel.send(type, seq, self.box.pack(obj)) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def send_request(self, handlername, *args):
return self.send(FRAME_REQUEST, None, (handlername, args)) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def send_result(self, seq, obj):
self.send(FRAME_RESULT, seq, obj) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def dispatch_result(self, seq, obj):
if seq in self.async_replies:
self.async_replies.pop(seq)(obj, False)
else:
self.sync_replies[seq] = obj | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def dispatch_exception(self, seq, obj):
excobj = load_exception(obj)
if seq in self.async_replies:
self.async_replies.pop(seq)(excobj, True)
else:
raise_exception(*excobj) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def poll(self):
"""if available, serves a single request, otherwise returns (non-blocking serve)"""
if self.channel.is_available():
self.serve()
return True
else:
return False | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def serve(self):
"""serves a single request (may block)"""
type, seq, data = self.channel.recv()
if type == FRAME_RESULT:
self.dispatch_result(seq, self.box.unpack(data))
elif type == FRAME_REQUEST:
self.dispatch_request(seq, *self.box.unpack(data))
elif t... | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def sync_request(self, handlername, *args):
"""performs a synchronous (blocking) request"""
seq = self.send_request(handlername, *args)
while seq not in self.sync_replies:
self.serve()
return self.sync_replies.pop(seq) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def async_request(self, callback, handlername, *args):
"""performs an asynchronous (non-blocking) request"""
seq = self.send_request(handlername, *args)
self.async_replies[seq] = callback | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def rimport(self, modulename):
"""imports a module by name (as a string)"""
if modulename not in self.module_cache:
module = self.sync_request("handle_import", modulename)
self.module_cache[modulename] = module
return self.module_cache[modulename] | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_decref(self, oid):
self.box.decref(oid) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_delattr(self, oid, name):
delattr(self.box[oid], name) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_setattr(self, oid, name, value):
setattr(self.box[oid], name, value) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_getitem(self, oid, index):
return self.box[oid][index] | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_call(self, oid, args, kwargs):
return self.box[oid](*args, **kwargs) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_str(self, oid):
return str(self.box[oid]) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def handle_import(self, modulename):
return __import__(modulename, None, None, modulename.split(".")[-1]) | eBay/restcommander | [
904,
146,
904,
3,
1389402375
] |
def __init__(self, build_dir=None, target_os=None, target_cpu=None,
is_debug=None, is_verbose=None, apk_name='MojoRunner.apk'):
'''Function arguments take precedence over GN args and default values.'''
assert target_os in (None, Config.OS_ANDROID, Config.OS_CHROMEOS,
Conf... | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def GetHostOS():
if sys.platform == 'linux2':
return Config.OS_LINUX
if sys.platform == 'darwin':
return Config.OS_MAC
if sys.platform == 'win32':
return Config.OS_WINDOWS
raise NotImplementedError('Unsupported host OS') | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def GetHostCPU():
# Derived from //native_client/pynacl/platform.py
machine = platform.machine()
if machine in ('x86', 'x86-32', 'x86_32', 'x8632', 'i386', 'i686', 'ia32',
'32'):
return Config.ARCH_X86
if machine in ('x86-64', 'amd64', 'AMD64', 'x86_64', 'x8664', '64'):
re... | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def build_dir(self):
'''Build directory path.'''
return self.values['build_dir'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def target_os(self):
'''OS of the build/test target.'''
return self.values['target_os'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def target_cpu(self):
'''CPU arch of the build/test target.'''
return self.values['target_cpu'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def is_debug(self):
'''Is Debug build?'''
return self.values['is_debug'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def is_verbose(self):
'''Should print additional logging information?'''
return self.values['is_verbose'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def dcheck_always_on(self):
'''DCHECK is fatal even in release builds'''
return self.values['dcheck_always_on'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def is_asan(self):
'''Is ASAN build?'''
return self.values['is_asan'] | junhuac/MQUIC | [
2,
1,
2,
1,
1459966120
] |
def answer(query):
parts = query.query.split()
if len(parts) < 2:
return []
try:
args = list(map(float, parts[1:]))
except:
return []
func = parts[0]
answer = None
if func == b'min':
answer = min(args)
elif func == b'max':
answer = max(args)
... | asciimoo/searx | [
12627,
1696,
12627,
345,
1381854051
] |
def __init__(self, key, defining_class):
# type: (Any, Type[KeyBasedCompareMixin]) -> None
self._compare_key = key
self._defining_class = defining_class | google/material-design-icons | [
47694,
9554,
47694,
203,
1412791288
] |
def __lt__(self, other):
# type: (Any) -> bool
return self._compare(other, operator.__lt__) | google/material-design-icons | [
47694,
9554,
47694,
203,
1412791288
] |
def __gt__(self, other):
# type: (Any) -> bool
return self._compare(other, operator.__gt__) | google/material-design-icons | [
47694,
9554,
47694,
203,
1412791288
] |
def __eq__(self, other):
# type: (Any) -> bool
return self._compare(other, operator.__eq__) | google/material-design-icons | [
47694,
9554,
47694,
203,
1412791288
] |
def __init__(self, socket, config=None):
if config is None:
config = {} # Do not use mutables as default arguments!
threading.Thread.__init__(self)
self.config = SimpleConfig(config) if type(config) == type({}) else config
self.message_id = 0
self.unanswered_request... | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def run(self):
while self.is_running():
try:
response = self.pipe.get()
except util.timeout:
continue
if response is None:
break
self.process(response)
self.trigger_callback('stop')
if self.network:
... | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def send(self, messages, callback):
"""return the ids of the requests that we sent"""
# detect subscriptions
sub = []
for message in messages:
m, v = message
if m[-10:] == '.subscribe':
sub.append(message)
if sub:
with self.loc... | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def get_servers(self):
return self.servers | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def get_header(self, height):
return self.synchronous_get([('network.get_header',[height])])[0] | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def get_server_height(self):
return self.server_height | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def is_connecting(self):
return self.status == 'connecting' | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
def get_parameters(self):
return self.synchronous_get([('network.get_parameters',[])])[0] | Kefkius/electrum-frc | [
3,
5,
3,
1,
1423949169
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.