SIGCHLD handling
        :param sig:
        :param frame:
        :return:
965640
def handle_chld(self, sig, frame):
        
        try:
            while True:
                wpid, status = waitpid(-1, WNOHANG)
                if not wpid:
                    break
                    # self.stdout.write('%d,%d\n' % (wpid, status))
        except:
            pass
862230
def _validate_signal(self, sig):
        
        if not isinstance(sig, int):
            raise TypeError('sig must be an int, not {!r}'.format(sig))
        if signal is None:
            raise RuntimeError('Signals are not supported')
        if not (1 <= sig < signal.NSIG):
            raise ValueError('sig {} out of range(1, {})'.format(sig, signal.NSIG))
        if sys.platform == 'win32':
            raise RuntimeError('Signals are not really supported on Windows')
782116
def get_stack_frame(N=0, strict=True):
    
    frame_cur = inspect.currentframe()
    for _ix in range(N + 1):
        # always skip the frame of this function
        frame_next = frame_cur.f_back
        if frame_next is None:
            if strict:
                raise AssertionError('Frame level %r is root' % _ix)
            else:
                break
        frame_cur = frame_next
    return frame_cur
776265
def sign(self, h, sig_format=SER_BINARY):
        
        outlen = (self.curve.sig_len_compact if sig_format == SER_COMPACT
                  else self.curve.sig_len_bin)
        sig = self._ECDSA_sign(h)
        return serialize_number(sig, sig_format, outlen)
712177
def handle_sigint(self, signum, frame):
        
        self.finish()
        self.original_handler(signum, frame)
988056
def _register_process_with_cgrulesengd(pid):
    
    # Logging/printing from inside preexec_fn would end up in the output file,
    # not in the correct logger, thus it is disabled here.
    from ctypes import cdll
    try:
        libcgroup = cdll.LoadLibrary('libcgroup.so.1')
        failure = libcgroup.cgroup_init()
        if failure:
            pass
            #print('Could not initialize libcgroup, error {}'.format(success))
        else:
            CGROUP_DAEMON_UNCHANGE_CHILDREN = 0x1
            failure = libcgroup.cgroup_register_unchanged_process(pid, CGROUP_DAEMON_UNCHANGE_CHILDREN)
            if failure:
                pass
                #print('Could not register process to cgrulesndg, error {}. '
                #      'Probably the daemon will mess up our cgroups.'.format(success))
    except OSError:
        pass
257062
def __advice_stack_frame_protection(self, frame):
        

        if frame is None:
            logger.debug(
                'currentframe() returned None; frame protection disabled')
            return

        f_back = frame.f_back
        while f_back:
            if f_back.f_code is self.handle.__code__:
                raise RuntimeError(
                    "indirect invocation of '%s' by 'handle' is forbidden" %
                    frame.f_code.co_name,
                )
            f_back = f_back.f_back
165829
private void parseFlags(byte[] flags) throws ID3v2FormatException
	{
		if (flags.length != FRAME_FLAGS_SIZE)
		{
			throw new ID3v2FormatException("Error parsing flags of frame: " + id + ".  Expected 2 bytes.");
		}
		else
		{
			tagAlterDiscard = (flags[0]&0x40)!=0;
			fileAlterDiscard = (flags[0]&0x20)!=0;
			readOnly = (flags[0]&0x10)!=0;
			grouped = (flags[1]&0x40)!=0;
			compressed = (flags[1]&0x08)!=0;
			encrypted = (flags[1]&0x04)!=0;
			unsynchronised = (flags[1]&0x02)!=0;
			lengthIndicator = (flags[1]&0x01)!=0;

			if (compressed && !lengthIndicator)
			{
				throw new ID3v2FormatException("Error parsing flags of frame: " + id + ".  Compressed bit set without data length bit set.");
			}
		}
	}
640219
def frame_message(self):
        
        if self._frame is not None:
            self.discard_message()
        panes = []
        p = origin = self._origin
        extent = self._extent
        while p < extent:
            available = extent - p
            if available < 2:
                break
            chunk_size, = struct_unpack(">H", self._view[p:(p + 2)])
            p += 2
            if chunk_size == 0:
                self._limit = p
                self._frame = MessageFrame(memoryview(self._view[origin:self._limit]), panes)
                return True
            q = p + chunk_size
            panes.append((p - origin, q - origin))
            p = q
        return False
865335
def parse_indexer_signature(sig):
    
    match = IDXR_SIG_RE.match(sig.strip())
    if not match:
        raise RuntimeError('Indexer signature invalid: ' + sig)
    modifiers, return_type, params, getter, setter = match.groups()
    params = split_sig(params)
    params = [parse_param_signature(x) for x in params]
    return (modifiers.split(), return_type, params,
            getter is not None, setter is not None)
743604
def handler(self, signum, frame):  # pragma: no cover
        ''''''
        if signum == signal.SIGQUIT:
            # QUIT - Finish processing, but don't do any more work after that
            self.stop()
        elif signum == signal.SIGUSR1:
            # USR1 - Print the backtrace
            message = ''.join(traceback.format_stack(frame))
            message = 'Signaled traceback for %s:\n%s' % (os.getpid(), message)
            print(message, file=sys.stderr)
            logger.warn(message)
        elif signum == signal.SIGUSR2:
            # USR2 - Enter a debugger
            # Much thanks to http://stackoverflow.com/questions/132058
            data = {'_frame': frame}    # Allow access to frame object.
            data.update(frame.f_globals)  # Unless shadowed by global
            data.update(frame.f_locals)
            # Build up a message with a traceback
            message = ''.join(traceback.format_stack(frame))
            message = 'Traceback:\n%s' % message
            code.InteractiveConsole(data).interact(message)
938663
def signal_to_exception(signum, frame):
    
    if signum == signal.SIGALRM:
        raise SIGALRMException()
    if signum == signal.SIGHUP:
        raise SIGHUPException()
    if signum == signal.SIGUSR1:
        raise SIGUSR1Exception()
    if signum == signal.SIGUSR2:
        raise SIGUSR2Exception()
    raise SignalException(signum)
692939
private void visitFrameAfterOnMethodEntry() {
        if (!visitFramesAfterCallbacks)
            return;

        // The frame that is required after the trace guard must be
        // fully specified as 'this' is no longer an 'uninitialized this'
        if (isConstructor()) {
            List<Object> stackLocals = new ArrayList<Object>(argTypes.length + 1);
            stackLocals.add(classAdapter.getClassType().getInternalName());
            for (Type type : argTypes) {
                switch (type.getSort()) {
                    case Type.ARRAY:
                    case Type.OBJECT:
                        stackLocals.add(type.getInternalName());
                        break;
                    case Type.BOOLEAN:
                    case Type.CHAR:
                    case Type.BYTE:
                    case Type.SHORT:
                    case Type.INT:
                        stackLocals.add(INTEGER);
                        break;
                    case Type.LONG:
                        stackLocals.add(LONG);
                        break;
                    case Type.FLOAT:
                        stackLocals.add(FLOAT);
                        break;
                    case Type.DOUBLE:
                        stackLocals.add(DOUBLE);
                        break;
                }
            }
            visitFrame(F_FULL, stackLocals.size(), stackLocals.toArray(), 0, new Object[] {});
            visitInsn(NOP);
        } else {
            visitFrame(F_SAME, 0, null, 0, null);
            visitInsn(NOP);
        }
    }
778376
def _parseAtFrame(self, src):
        
        src = src[len('@frame '):].lstrip()
        box, src = self._getIdent(src)
        src, properties = self._parseDeclarationGroup(src.lstrip())
        result = [self.cssBuilder.atFrame(box, properties)]
        return src.lstrip(), result
1088993
def process_pad_frame(self,
                          id=None,
                          msg=None):
        

        # normalize into a dataframe
        df = json_normalize(msg)
        # convert to a flattened dictionary
        dt = json.loads(df.to_json())

        flat_msg = {}

        for k in dt:
            new_key = "pad_{}".format(k)
            flat_msg[new_key] = dt[k]["0"]
            if new_key not in self.pad_keys:
                self.pad_keys[new_key] = k
        # end of capturing all unique keys

        dt["pad_id"] = id
        self.all_pad.append(dt)

        log.debug("PAD data updated:")
        log.debug(self.pad_keys)
        log.debug(self.all_pad)
        log.debug("")

        return flat_msg
541232
def _add_crc(self, frame):
        
        crc = struct.pack('<H', crc16(frame))
        return frame + crc
1363608
def verify(self, h, sig):
        
        val = from_bytes_32(h)
        pubkey = self.public_pair()
        return self._generator.verify(pubkey, val, sigdecode_der(sig))