当前位置: 首页>>代码示例>>Python>>正文


Python client.Client方法代码示例

本文整理汇总了Python中client.Client方法的典型用法代码示例。如果您正苦于以下问题:Python client.Client方法的具体用法?Python client.Client怎么用?Python client.Client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在client的用法示例。


在下文中一共展示了client.Client方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_client_encryption

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def get_client_encryption(self, additional_data):
		if self.serverorclient:
			# server mode
			# select client, based on public details
			c = self.lookup_client_pub(additional_data)
			if c:
				# if found, return object's encryption details
				return c.get_encryption()
			else:
				# this must be a new client, creating new encryption object
				e = encryption.Encryption_details()
				e.set_module(self.encryption_module)
				return e
		else:
			# client mode
			return self.encryption

	# set up the Client object for a new client 
开发者ID:earthquake,项目名称:XFLTReaT,代码行数:20,代码来源:Stateless_module.py

示例2: get_client_encryption

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def get_client_encryption(self, additional_data):
		return self.encryption

	# set up the Client object for a new client 
开发者ID:earthquake,项目名称:XFLTReaT,代码行数:6,代码来源:Stateful_module.py

示例3: listen

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def listen(self):
        self.sock.listen(5)
        logging.info("Server is ready to accept connections")
        thread = threading.Thread(target=self._background)
        thread.daemon = True
        thread.start()
        while True:
            client, address = self.sock.accept()
            thread = threading.Thread(target=Client(self).handle,
                                      args=(client, address))
            thread.daemon = True
            thread.start() 
开发者ID:AvaCity,项目名称:avacity-2.0,代码行数:14,代码来源:server.py

示例4: gen_plr

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def gen_plr(client, server):
    if isinstance(client, Client):
        uid = client.uid
    else:
        uid = client
    apprnc = server.get_appearance(uid)
    if not apprnc:
        return None
    user_data = server.get_user_data(uid)
    clths = server.get_clothes(uid, type_=2)
    plr = {"uid": uid, "apprnc": apprnc, "clths": clths,
           "mbm": {"ac": None, "sk": "blackMobileSkin"},
           "usrinf": {"rl": user_data["role"]}}
    if isinstance(client, Client):
        plr["locinfo"] = {"st": client.state, "s": "127.0.0.1",
                          "at": client.action_tag, "d": client.dimension,
                          "x": client.position[0], "y": client.position[1],
                          "shlc": True, "pl": "", "l": client.room}
    plr["ci"] = {"exp": user_data["exp"], "crt": user_data["crt"],
                 "hrt": user_data["hrt"], "fexp": 0, "gdc": 0, "lgt": 0,
                 "vip": True, "vexp": 1965298000, "vsexp": 1965298000,
                 "vsact": True, "vret": 0, "vfgc": 0, "ceid": 0, "cmid": 0,
                 "dr": True, "spp": 0, "tts": None, "eml": None, "ys": 0,
                 "ysct": 0, "fak": None, "shcr": True, "gtrfrd": 0,
                 "strfrd": 0, "rtrtm": 0, "kyktid": None, "actrt": 0,
                 "compid": 0, "actrp": 0, "actrd": 0, "shousd": False,
                 "rpt": 0, "as": None, "lvt": user_data["lvt"],
                 "lrnt": 0, "lwts": 0, "skid": None, "skrt": 0, "bcld": 0,
                 "trid": user_data["trid"], "trcd": 0, "sbid": None,
                 "sbrt": 0, "plcmt": {}, "pamns": {"amn": []}, "crst": 0}
    plr["pf"] = {"pf": {"jntr": {"tp": "jntr", "l": 20, "pgs": 0},
                        "phtghr": {"tp": "phtghr", "l": 20, "pgs": 0},
                        "grdnr": {"tp": "grdnr", "l": 20, "pgs": 0},
                        "vsgst": {"tp": "vsgst", "l": 20, "pgs": 0}}}
    return plr 
开发者ID:AvaCity,项目名称:avacity-2.0,代码行数:37,代码来源:location.py

示例5: __init__

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def __init__(self, server, handler):
        self._client = Client(server)
        self._handler = handler 
开发者ID:fbsamples,项目名称:fbctf-2019-challenges,代码行数:5,代码来源:bots.py

示例6: revsync_load

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def revsync_load(bv):
    global client

    # lets ensure auto-analysis is finished by forcing another analysis
    t0 = threading.Thread(target=do_analysis_and_wait, args=(bv,))
    t0.start()
    t0.join()

    try:
        client
    except:
        client = Client(**config)
    state = bv.session_data.get('revsync')
    if state:
        # close out the previous session
        client.leave(state.fhash)
        state.close()

    state = bv.session_data['revsync'] = State(bv)
    log_info('revsync: connecting with %s' % state.fhash)
    client.join(state.fhash, revsync_callback(bv))
    log_info('revsync: connected!')
    t1 = threading.Thread(target=watch_cur_func, args=(bv,))
    t2 = threading.Thread(target=watch_syms, args=(bv,SymbolType.DataSymbol))
    t3 = threading.Thread(target=watch_syms, args=(bv,SymbolType.FunctionSymbol))
    t4 = threading.Thread(target=watch_structs, args=(bv,))
    t1.daemon = True
    t2.daemon = True
    t3.daemon = True
    t4.daemon = True
    t1.start()
    t2.start()
    t3.start()
    t4.start() 
开发者ID:lunixbochs,项目名称:revsync,代码行数:36,代码来源:binja_frontend.py

示例7: create_clients

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def create_clients(users, groups, train_data, test_data, model):
    if len(groups) == 0:
        groups = [[] for _ in users]
    clients = [Client(u, g, train_data[u], test_data[u], model) for u, g in zip(users, groups)]
    return clients 
开发者ID:TalwalkarLab,项目名称:leaf,代码行数:7,代码来源:main.py

示例8: setup_clients

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def setup_clients(dataset, model=None, use_val_set=False):
    """Instantiates clients based on given train and test data directories.

    Return:
        all_clients: list of Client objects.
    """
    eval_set = 'test' if not use_val_set else 'val'
    train_data_dir = os.path.join('..', 'data', dataset, 'data', 'train')
    test_data_dir = os.path.join('..', 'data', dataset, 'data', eval_set)

    users, groups, train_data, test_data = read_data(train_data_dir, test_data_dir)

    clients = create_clients(users, groups, train_data, test_data, model)

    return clients 
开发者ID:TalwalkarLab,项目名称:leaf,代码行数:17,代码来源:main.py

示例9: extract_from_page

# 需要导入模块: import client [as 别名]
# 或者: from client import Client [as 别名]
def extract_from_page(provider, content):
    """ Sub-page extraction method

    Args:
        provider (str): Provider ID
        content  (str): Page content from Client instance

    Returns:
        str: Torrent or magnet link extracted from sub-page
    """
    definition = definitions[provider]
    definition = get_alias(definition, get_setting("%s_alias" % provider))

    if provider == "kinozal":
        matches = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', content)
        if matches:
            result = matches[0]
            log.debug('[%s] Matched magnet link: %s' % (provider, repr(result)))
            return result

        matches = re.findall(r'\: ([A-Fa-f0-9]{40})', content)  # kinozal
        if matches:
            result = "magnet:?xt=urn:btih:" + matches[0] + "&tr=http%3A%2F%2Ftr0.torrent4me.com%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Ftr0.torrent4me.com%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Ftr0.tor4me.info%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Ftr0.tor2me.info%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Fretracker.local%2Fannounce"
            log.debug('[%s] Make magnet from info_hash: %s' % (provider, repr(result)))
            return result

    matches = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', content)
    if matches:
        result = matches[0]
        log.debug('[%s] Matched magnet link: %s' % (provider, repr(result)))
        return result

    matches = re.findall('http(.*?).torrent["\']', content)
    if matches:
        result = 'http' + matches[0] + '.torrent'
        log.debug('[%s] Matched torrent link: %s' % (provider, repr(result)))
        return result

    matches = re.findall('"(/download/[A-Za-z0-9]+)"', content)
    if matches:
        result = definition['root_url'] + matches[0]
        log.debug('[%s] Matched download link: %s' % (provider, repr(result)))
        return result
    return None 
开发者ID:Nemiroff,项目名称:script.elementum.nova,代码行数:46,代码来源:nova.py


注:本文中的client.Client方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。