python类JSONDecoder()的实例源码

manager.py 文件源码 项目:db_wlan_manager 作者: sistason 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, user_mode):
        self.user_mode = user_mode
        self.interface = None
        self.quota = None

        self.is_online = None
        self.new_api = None

        self.json_decoder = json.JSONDecoder()
        self.session = requests.Session()
        self.csrf_token = None

        self.resolver = dns.resolver.Resolver()
        self.resolver.nameservers = ['172.16.0.1']
        self.api_host_ip = self.resolve_url(self.api_host)
        self.api_host_new_ip = self.resolve_url(self.api_host_new)
addon_updater.py 文件源码 项目:Blender-WMO-import-export-scripts 作者: WowDevTools 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_api(self, url):
        # return the json version
        get = None
        get = self.get_api_raw(url) # this can fail by self-created error raising
        if get is not None:
            return json.JSONDecoder().decode( get )
        else:
            return None


    # create a working directory and download the new files
session.py 文件源码 项目:gdb.vim 作者: dbgx 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, ctrl, vimx):
        import logging
        self.logger = logging.getLogger(__name__)

        self.ctrl = ctrl
        self.vimx = vimx
        self.state = OrderedDict()
        self.internal = {}
        self.json_decoder = json.JSONDecoder(object_pairs_hook=OrderedDict)
        self.help_flags = {"new": False, "launch_prompt": True, "session_show": True}
        self.bpid_map = {}
sender.py 文件源码 项目:abusehelper 作者: Exploit-install 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _read_stdin(self):
        loads = json.JSONDecoder(parse_float=unicode, parse_int=unicode).decode

        while True:
            yield select.select([sys.stdin], [], [])

            line = sys.stdin.readline()
            if not line:
                break
            if not line.strip():
                continue

            in_dict = loads(line)
            yield idiokit.send(events.Event(in_dict))
docker_module.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def json_decode(self, encoded_json):
        json_decoder = json.JSONDecoder()
        try:
            return json_decoder.decode(encoded_json)
        except:
            logging.debug("JSON error from {} container \n==\n {} \n==\n".format(self.module_cls_name, encoded_json))
            return None
cuckoo_parser.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, malware, module_cls_name, task_id,
                 cuckoo_url, all_result=False):
        self.json_decoder = json.JSONDecoder()
        self._malware = malware
        self._module_cls_name = module_cls_name
        self._task_id = task_id
        self._all = all_result
        self._ms = malware.get_module_status(self._module_cls_name)
        self._cuckoo_url = cuckoo_url
cuckoo_parser.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, malware, module_cls_name, task_id,
                 cuckoo_url, all_result=False):
        self.json_decoder = json.JSONDecoder()
        self._malware = malware
        self._module_cls_name = module_cls_name
        self._task_id = task_id
        self._all = all_result
        self._ms = malware.get_module_status(self._module_cls_name)
        self._cuckoo_url = cuckoo_url
utils.py 文件源码 项目:sketal 作者: vk-brain 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def json_iter_parse(response_text):
    decoder = json.JSONDecoder(strict=False)
    idx = 0
    while idx < len(response_text):
        obj, idx = decoder.raw_decode(response_text, idx)
        yield obj
json_decoder_object_hook.py 文件源码 项目:pymotw3 作者: reingart 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        json.JSONDecoder.__init__(
            self,
            object_hook=self.dict_to_object,
        )
rpc.py 文件源码 项目:bap-python 作者: BinaryAnalysisPlatform 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def jsons(r, p=0):
    dec = json.JSONDecoder(encoding='utf-8')
    while True:
        obj,p = dec.scan_once(r.text,p)
        yield obj
wiki.py 文件源码 项目:Socrates 作者: Curlybear 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def wiki(self, ctx, *, search_query):
        logger.info('!wiki ' + search_query + ' - User: ' + str(ctx.message.author))
        data = self.utils.search_wiki(search_query)

        if len(data) == 1:
            result_id = 0
        else:
            if 1 < len(data) <= 10:
                # Display all results then await choice
                i = 1
                text = ''
                for entry in data:
                    text += str(i) + ') **' + entry[1] + '** - *Category: ' + str(entry[2]) + '*\n'
                    i += 1
                em = discord.Embed(title='Please enter the number of the targeted wiki entry',
                                   description=text,
                                   colour=0x3D9900)
                await self.bot.send_message(ctx.message.channel, '', embed=em)
                msg = await self.bot.wait_for_message(author=ctx.message.author)
                if int(msg.content) >= i or int(msg.content) < 1:
                    await self.bot.say('Invalid choice')
                    return
                result_id = int(msg.content) - 1
            else:
                await self.bot.send_message(ctx.message.channel, 'No matching entry found.')
                return
        temp = json.JSONDecoder().decode(data[result_id][3])
        tempembed = discord.Embed().from_data(temp)
        await self.bot.send_message(ctx.message.channel, '', embed=tempembed)
base.py 文件源码 项目:BGmi 作者: RicterZ 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def get_json(self):
        try:
            return json.loads(self.request.body.decode('utf-8'))
        except (json.JSONDecoder, ValueError):
            return {}
logic.py 文件源码 项目:zamia-prolog 作者: gooofy 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def json_to_prolog(jstr):
    return json.JSONDecoder(object_hook = _prolog_from_json).decode(jstr)
addon_updater.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def get_api(self, url):
        # return the json version
        get = None
        get = self.get_api_raw(url) # this can fail by self-created error raising
        if get != None:
            return json.JSONDecoder().decode( get )
        else:
            return None


    # create a working directory and download the new files
addon_updater.py 文件源码 项目:kaleidoscope 作者: blenderskool 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def get_api(self, url):
        # return the json version
        get = None
        get = self.get_api_raw(url) # this can fail by self-created error raising
        if get != None:
            return json.JSONDecoder().decode( get )
        else:
            return None


    # create a working directory and download the new files
fields.py 文件源码 项目:nanopores 作者: mitschabaude 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        json.JSONDecoder.__init__(self, object_hook=self.object_hook, *args, **kwargs)
stream.py 文件源码 项目:twittershade 作者: nicolavic98 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self):
        self.buf = ""
        self.raw_decode = json.JSONDecoder().raw_decode
fill.py 文件源码 项目:oamap 作者: diana-hep 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def fromjsons(values, generator=None, fillables=None, pointer_fromequal=False):
    if hasattr(values, "read"):
        def iterator():
            j = json.JSONDecoder()
            buf = ""
            while True:
                try:
                    obj, i = j.raw_decode(buf)
                except ValueError:
                    extra = values.read(8192)
                    if len(extra) == 0:
                        break
                    else:
                        buf = buf.lstrip() + extra
                else:
                    yield obj
                    buf = buf[i:].lstrip()

    else:
        def iterator():
            j = json.JSONDecoder()
            index = 0
            while True:
                try:
                    obj, i = j.raw_decode(values[index:])
                except ValueError:
                    break
                yield obj
                _, index = fromjsons._pattern.match(values, index + i).span()

    return fromiterdata(iterator(), generator=generator, fillables=fillables, pointer_fromequal=pointer_fromequal)
jsonutils.py 文件源码 项目:pyVirtualize 作者: rocky1109 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, date_format, *args, **kwargs):
        self.date_format = date_format
        json.JSONDecoder.__init__(self, object_hook=self.date_to_object, *args, **kwargs)
jsonutils.py 文件源码 项目:pyVirtualize 作者: rocky1109 项目源码 文件源码 阅读 45 收藏 0 点赞 0 评论 0
def __init__(self, base_url, key_contains=[], *args, **kwargs):
        self.base_url = base_url
        self.key_contains = key_contains
        json.JSONDecoder.__init__(self, object_hook=self.url_to_object, *args, **kwargs)


问题


面经


文章

微信
公众号

扫码关注公众号