id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
300
from bisect import bisect_left, bisect_right import itertools import logging from typing import Any, Callable, Dict, Iterable, Mapping, Sequence, Tuple, Union import warnings import numpy as np import pandas as pd from merlion.utils.misc import ValIterOrderedDict from merlion.utils.resample import ( AggregationPoli...
Checks that all time deltas in the time series are equal, either to each other, or a pre-specified timedelta (in seconds).
301
from abc import ABC, abstractmethod import copy import logging from typing import Tuple import numpy as np import pandas as pd from scipy.special import gammaln, multigammaln from scipy.linalg import pinv, pinvh from scipy.stats import ( bernoulli, beta, norm, t as student_t, invgamma, multivari...
Log pseudo-determinant of a (possibly singular) matrix A.
302
from collections import OrderedDict import inspect from typing import List, Union import pandas as pd from merlion.utils.misc import combine_signatures, parse_basic_docstring from merlion.utils.time_series import TimeSeries def df_to_time_series( df: pd.DataFrame, time_col: str = None, timestamp_unit="s", data_cols...
Decorator to standardize docstrings for data I/O functions.
303
from collections import OrderedDict import inspect from typing import List, Union import pandas as pd from merlion.utils.misc import combine_signatures, parse_basic_docstring from merlion.utils.time_series import TimeSeries def df_to_time_series( df: pd.DataFrame, time_col: str = None, timestamp_unit="s", data_cols...
Reads a CSV file and converts it to a `TimeSeries` object.
304
from abc import ABCMeta from collections import OrderedDict from copy import deepcopy from functools import wraps import importlib import inspect import re from typing import Callable, Union The provided code snippet includes necessary dependencies for implementing the `dynamic_import` function. Write a Python functio...
Dynamically import a member from the specified module. :param import_path: syntax 'module_name:member_name', e.g. 'merlion.transform.normalize:BoxCoxTransform' :param alias: dict which maps shortcuts for the registered classes, to their full import paths. :return: imported class
305
from abc import ABCMeta from collections import OrderedDict from copy import deepcopy from functools import wraps import importlib import inspect import re from typing import Callable, Union The provided code snippet includes necessary dependencies for implementing the `call_with_accepted_kwargs` function. Write a Pyt...
Given a function and a list of keyword arguments, call the function with only the keyword arguments that are accepted by the function.
306
from abc import ABCMeta from collections import OrderedDict from copy import deepcopy from functools import wraps import importlib import inspect import re from typing import Callable, Union The provided code snippet includes necessary dependencies for implementing the `initializer` function. Write a Python function `...
Decorator for the __init__ method. Automatically assigns the parameters.
307
from enum import Enum from functools import partial import logging import math import re from typing import Iterable, Sequence, Union import numpy as np import pandas as pd from pandas.tseries.frequencies import to_offset as pd_to_offset import scipy.stats The provided code snippet includes necessary dependencies for ...
Converts a time gap to a ``pd.Timedelta`` if possible, otherwise a ``pd.DateOffset``.
308
from enum import Enum from functools import partial import logging import math import re from typing import Iterable, Sequence, Union import numpy as np import pandas as pd from pandas.tseries.frequencies import to_offset as pd_to_offset import scipy.stats The provided code snippet includes necessary dependencies for ...
Converts a datetime to a Unix timestamp.
309
from enum import Enum from functools import partial import logging import math import re from typing import Iterable, Sequence, Union import numpy as np import pandas as pd from pandas.tseries.frequencies import to_offset as pd_to_offset import scipy.stats class MissingValuePolicy(Enum): """ Missing value imput...
Reindexes a Datetime-indexed dataframe ``df`` to have the same time stamps as a reference sequence of timestamps. Imputes missing values with the given `MissingValuePolicy`.
310
from collections import OrderedDict from typing import List import numpy as np import pandas as pd from merlion.utils.time_series import TimeSeries, to_pd_datetime class TimeSeries: """ Please read the `tutorial <tutorials/TimeSeries>` before reading this API doc. This class represents a general multivaria...
Computes the minimum trace reconciliation for hierarchical time series, as described by `Wickramasuriya et al. 2018 <https://robjhyndman.com/papers/mint.pdf>`__. This algorithm assumes that we have a number of time series aggregated at various levels (the aggregation tree is described by ``sum_matrix``), and we obtain ...
311
import argparse import copy import json import logging import os import sys import time import git from typing import Tuple import matplotlib.pyplot as plt import numpy as np import pandas as pd from tqdm import tqdm from merlion.evaluate.anomaly import ( TSADEvaluatorConfig, accumulate_tsad_score, TSADScor...
null
312
import argparse import copy import json import logging import os import sys import time import git from typing import Tuple import matplotlib.pyplot as plt import numpy as np import pandas as pd from tqdm import tqdm from merlion.evaluate.anomaly import ( TSADEvaluatorConfig, accumulate_tsad_score, TSADScor...
Trains a model on the time series dataset given, and save their predictions to a dataset.
313
import argparse import copy import json import logging import os import sys import time import git from typing import Tuple import matplotlib.pyplot as plt import numpy as np import pandas as pd from tqdm import tqdm from merlion.evaluate.anomaly import ( TSADEvaluatorConfig, accumulate_tsad_score, TSADScor...
Returns a list of lists all_preds, where all_preds[i] is the model's raw anomaly scores for time series i in the dataset.
314
import argparse import copy import json import logging import os import sys import time import git from typing import Tuple import matplotlib.pyplot as plt import numpy as np import pandas as pd from tqdm import tqdm from merlion.evaluate.anomaly import ( TSADEvaluatorConfig, accumulate_tsad_score, TSADScor...
null
315
import logging import os import requests from tqdm import tqdm import pandas as pd from ts_datasets.base import BaseDataset logger = logging.getLogger(__name__) def download(datapath, url, name, split=None): os.makedirs(datapath, exist_ok=True) if split is not None: namesplit = split + "/" + name e...
null
316
import os import sys import logging import requests import tarfile import numpy as np import pandas as pd from pathlib import Path from ts_datasets.anomaly.base import TSADBaseDataset def combine_train_test_datasets(train_df, test_df, test_labels): train_df.columns = [str(c) for c in train_df.columns] test_df....
null
317
import os import sys import logging import requests import tarfile import numpy as np import pandas as pd from pathlib import Path from ts_datasets.anomaly.base import TSADBaseDataset def download(logger, datapath, url, filename): os.makedirs(datapath, exist_ok=True) compressed_file = os.path.join(datapath, f"...
null
318
import os import sys import csv import ast import logging import pickle import numpy as np import pandas as pd from ts_datasets.anomaly.base import TSADBaseDataset from ts_datasets.anomaly.smd import download, combine_train_test_datasets def preprocess(logger, data_folder, dataset): if ( os.path.exists(os....
null
319
import os import sys import csv import ast import logging import pickle import numpy as np import pandas as pd from ts_datasets.anomaly.base import TSADBaseDataset from ts_datasets.anomaly.smd import download, combine_train_test_datasets def load_data(directory, dataset): with open(os.path.join(directory, f"{datas...
null
320
from __future__ import print_function from __future__ import absolute_import from __future__ import division import numpy as np import torch def to_tensor(array, dtype=torch.float32): if 'torch.tensor' not in str(type(array)): return torch.tensor(array, dtype=dtype)
null
321
from __future__ import print_function from __future__ import absolute_import from __future__ import division import numpy as np import torch def to_np(array, dtype=np.float32): if 'scipy.sparse' in str(type(array)): array = array.todense() return np.array(array, dtype=dtype)
null
322
from __future__ import absolute_import from __future__ import print_function from __future__ import division import numpy as np import torch import torch.nn.functional as F from .utils import rot_mat_to_euler def batch_rodrigues(rot_vecs, epsilon=1e-8, dtype=torch.float32): ''' Calculates the rotation matrices for ...
Compute the faces, barycentric coordinates for the dynamic landmarks To do so, we first compute the rotation of the neck around the y-axis and then use a pre-computed look-up table to find the faces and the barycentric coordinates that will be used. Special thanks to Soubhik Sanyal (soubhik.sanyal@tuebingen.mpg.de) for...
323
from __future__ import absolute_import from __future__ import print_function from __future__ import division import numpy as np import torch import torch.nn.functional as F from .utils import rot_mat_to_euler The provided code snippet includes necessary dependencies for implementing the `vertices2landmarks` function. ...
Calculates landmarks by barycentric interpolation Parameters ---------- vertices: torch.tensor BxVx3, dtype = torch.float32 The tensor of input vertices faces: torch.tensor Fx3, dtype = torch.long The faces of the mesh lmk_faces_idx: torch.tensor L, dtype = torch.long The tensor with the indices of the faces used to ca...
324
from __future__ import absolute_import from __future__ import print_function from __future__ import division import numpy as np import torch import torch.nn.functional as F from .utils import rot_mat_to_euler def vertices2joints(J_regressor, vertices): ''' Calculates the 3D joint locations from the vertices Par...
Performs Linear Blend Skinning with the given shape and pose parameters Parameters ---------- betas : torch.tensor BxNB The tensor of shape parameters pose : torch.tensor Bx(J + 1) * 3 The pose parameters in axis-angle format v_template torch.tensor BxVx3 The template mesh that will be deformed shapedirs : torch.tensor...
325
import torch import torch.nn.functional as F from .smpl import SMPLServer from pytorch3d import ops The provided code snippet includes necessary dependencies for implementing the `skinning` function. Write a Python function `def skinning(x, w, tfs, inverse=False)` to solve the following problem: Linear blend skinning ...
Linear blend skinning Args: x (tensor): canonical points. shape: [B, N, D] w (tensor): conditional input. [B, N, J] tfs (tensor): bone transformation matrices. shape: [B, J, D+1, D+1] Returns: x (tensor): skinned points. shape: [B, N, D]
326
from .networks import ImplicitNet, RenderingNet from .density import LaplaceDensity, AbsDensity from .ray_sampler import ErrorBoundSampler from .deformer import SMPLDeformer from .smpl import SMPLServer from .sampler import PointInSpace from ..utils import utils import numpy as np import torch import torch.nn as nn fro...
null
327
import torch class Embedder: def __init__(self, **kwargs): self.kwargs = kwargs self.create_embedding_fn() def create_embedding_fn(self): embed_fns = [] d = self.kwargs['input_dims'] out_dim = 0 if self.kwargs['include_input']: embed_fns.append(lambda ...
null
328
import numpy as np import cv2 import torch from torch.nn import functional as F The provided code snippet includes necessary dependencies for implementing the `split_input` function. Write a Python function `def split_input(model_input, total_pixels, n_pixels = 10000)` to solve the following problem: Split the input t...
Split the input to fit Cuda memory for large resolution. Can decrease the value of n_pixels in case of cuda out of memory error.
329
import numpy as np import cv2 import torch from torch.nn import functional as F The provided code snippet includes necessary dependencies for implementing the `merge_output` function. Write a Python function `def merge_output(res, total_pixels, batch_size)` to solve the following problem: Merge the split output. Here...
Merge the split output.
330
import numpy as np import cv2 import torch from torch.nn import functional as F def get_psnr(img1, img2, normalize_rgb=False): if normalize_rgb: # [-1,1] --> [0,1] img1 = (img1 + 1.) / 2. img2 = (img2 + 1. ) / 2. mse = torch.mean((img1 - img2) ** 2) psnr = -10. * torch.log(mse) / torch.log...
null
331
import numpy as np import cv2 import torch from torch.nn import functional as F def load_K_Rt_from_P(filename, P=None): if P is None: lines = open(filename).read().splitlines() if len(lines) == 4: lines = lines[1:] lines = [[x[0], x[1], x[2], x[3]] for x in (x.split(" ") for x i...
null
332
import numpy as np import cv2 import torch from torch.nn import functional as F def lift(x, y, z, intrinsics): # parse intrinsics intrinsics = intrinsics.cuda() fx = intrinsics[:, 0, 0] fy = intrinsics[:, 1, 1] cx = intrinsics[:, 0, 2] cy = intrinsics[:, 1, 2] sk = intrinsics[:, 0, 1] x_...
null
333
import numpy as np import cv2 import torch from torch.nn import functional as F def rot_to_quat(R): batch_size, _,_ = R.shape q = torch.ones((batch_size, 4)).cuda() R00 = R[:, 0,0] R01 = R[:, 0, 1] R02 = R[:, 0, 2] R10 = R[:, 1, 0] R11 = R[:, 1, 1] R12 = R[:, 1, 2] R20 = R[:, 2, 0]...
null
334
import numpy as np import cv2 import torch from torch.nn import functional as F def get_sphere_intersections(cam_loc, ray_directions, r = 1.0): # Input: n_rays x 3 ; n_rays x 3 # Output: n_rays x 1, n_rays x 1 (close and far) ray_cam_dot = torch.bmm(ray_directions.view(-1, 1, 3), ...
null
335
import numpy as np import cv2 import torch from torch.nn import functional as F def bilinear_interpolation(xs, ys, dist_map): x1 = np.floor(xs).astype(np.int32) y1 = np.floor(ys).astype(np.int32) x2 = x1 + 1 y2 = y1 + 1 dx = np.expand_dims(np.stack([x2 - xs, xs - x1], axis=1), axis=1) dy = np.ex...
More sampling within the bounding box
336
import numpy as np import torch from skimage import measure from lib.libmise import mise import trimesh def generate_mesh(func, verts, level_set=0, res_init=32, res_up=3, point_batch=5000): scale = 1.1 # Scale of the padded bbox regarding the tight one. verts = verts.data.cpu().numpy() gt_bbox =...
null
337
import trimesh from aitviewer.viewer import Viewer from aitviewer.renderables.meshes import Meshes, VariableTopologyMeshes import glob import argparse def vis_dynamic(args): vertices = [] faces = [] vertex_normals = [] deformed_mesh_paths = sorted(glob.glob(f'{args.path}/*_deformed.ply')) for defor...
null
338
import trimesh from aitviewer.viewer import Viewer from aitviewer.renderables.meshes import Meshes, VariableTopologyMeshes import glob import argparse def vis_static(args): mesh = trimesh.load(args.path, process=False) mesh = Meshes(mesh.vertices, mesh.faces, mesh.vertex_normals, name='mesh', flat_shading=True...
null
339
import sys import cv2 import os import numpy as np import argparse import time import glob from sklearn.neighbors import NearestNeighbors def get_bbox_center(img_path, mask_path): _img = cv2.imread(img_path) W, H = _img.shape[1], _img.shape[0] mask = cv2.imread(mask_path)[:, :, 0] where = np.asarray(n...
null
340
import numpy as np import cv2 import torch import torch.nn as nn import torch.nn.functional as F from pytorch3d.renderer import ( SfMPerspectiveCameras, RasterizationSettings, MeshRenderer, MeshRasterizer, SoftPhongShader, PointLights, ) from pytorch3d.structures import Meshes from pytorch3d.ren...
Returns the indices of the permutation that maps OpenPose to SMPL Parameters ---------- model_type: str, optional The type of SMPL-like model that is used. The default mapping returned is for the SMPLX model use_hands: bool, optional Flag for adding to the returned permutation the mapping for the hand keypoints. Defaul...
341
import numpy as np import cv2 import torch import torch.nn as nn import torch.nn.functional as F from pytorch3d.renderer import ( SfMPerspectiveCameras, RasterizationSettings, MeshRenderer, MeshRasterizer, SoftPhongShader, PointLights, ) from pytorch3d.structures import Meshes from pytorch3d.ren...
null
342
import numpy as np import cv2 import torch import torch.nn as nn import torch.nn.functional as F from pytorch3d.renderer import ( SfMPerspectiveCameras, RasterizationSettings, MeshRenderer, MeshRasterizer, SoftPhongShader, PointLights, ) from pytorch3d.structures import Meshes from pytorch3d.ren...
null
343
import numpy as np import cv2 import torch import torch.nn as nn import torch.nn.functional as F from pytorch3d.renderer import ( SfMPerspectiveCameras, RasterizationSettings, MeshRenderer, MeshRasterizer, SoftPhongShader, PointLights, ) from pytorch3d.structures import Meshes from pytorch3d.ren...
Creates a batch of transformation matrices Args: - R: Bx3x3 array of a batch of rotation matrices - t: Bx3x1 array of a batch of translation vectors Returns: - T: Bx4x4 Transformation matrix
344
import numpy as np import cv2 import torch import torch.nn as nn import torch.nn.functional as F from pytorch3d.renderer import ( SfMPerspectiveCameras, RasterizationSettings, MeshRenderer, MeshRasterizer, SoftPhongShader, PointLights, ) from pytorch3d.structures import Meshes from pytorch3d.ren...
null
345
from preprocessing_utils import GMoF import torch def get_loss_weights(): loss_weight = {'J2D_Loss': lambda cst, it: 1e-2 * cst, 'Temporal_Loss': lambda cst, it: 6e0 * cst, } return loss_weight
null
346
from preprocessing_utils import GMoF import torch joint_weights = torch.ones(num_joints) joint_weights[joints_to_ign] = 0 joint_weights = joint_weights.reshape((-1,1)).cuda() robustifier = GMoF(rho=100) def joints_2d_loss(gt_joints_2d=None, joints_2d=None, joint_confidence=None): joint_diff = robustifier(gt_jo...
null
347
from preprocessing_utils import GMoF import torch def pose_temporal_loss(last_pose, param_pose): temporal_loss = torch.mean(torch.square(last_pose - param_pose)) return temporal_loss
null
348
import cv2 import numpy as np import argparse def get_center_point(num_cams,cameras): def normalize_cameras(original_cameras_filename,output_cameras_filename,num_of_cameras, scene_bounding_sphere=3.0): cameras = np.load(original_cameras_filename) if num_of_cameras==-1: all_files=cameras.files m...
null
349
from typing import Optional, Dict, Union import os import os.path as osp import pickle import numpy as np import torch import torch.nn as nn from .lbs import ( lbs, vertices2landmarks, find_dynamic_lmk_idx_and_bcoords, vertices2joints, blend_shapes) from .vertex_ids import vertex_ids as VERTEX_IDS from .utils impor...
Method for creating a model from a path and a model type Parameters ---------- model_path: str Either the path to the model you wish to load or a folder, where each subfolder contains the differents types, i.e.: model_path: | |-- smpl |-- SMPL_FEMALE |-- SMPL_NEUTRAL |-- SMPL_MALE |-- smplh |-- SMPLH_FEMALE |-- SMPLH_M...
350
from typing import Optional, Dict, Union import os import os.path as osp import pickle import numpy as np import torch import torch.nn as nn from .lbs import ( lbs, vertices2landmarks, find_dynamic_lmk_idx_and_bcoords, vertices2joints, blend_shapes) from .vertex_ids import vertex_ids as VERTEX_IDS from .utils impor...
Method for creating a model from a path and a model type Parameters ---------- model_path: str Either the path to the model you wish to load or a folder, where each subfolder contains the differents types, i.e.: model_path: | |-- smpl |-- SMPL_FEMALE |-- SMPL_NEUTRAL |-- SMPL_MALE |-- smplh |-- SMPLH_FEMALE |-- SMPLH_M...
351
from typing import NewType, Union, Optional from dataclasses import dataclass, asdict, fields import numpy as np import torch def find_joint_kin_chain(joint_id, kinematic_tree): kin_chain = [] curr_idx = joint_id while curr_idx != -1: kin_chain.append(curr_idx) curr_idx = kinematic_tree[cur...
null
352
from typing import NewType, Union, Optional from dataclasses import dataclass, asdict, fields import numpy as np import torch Tensor = NewType('Tensor', torch.Tensor) Array = NewType('Array', np.ndarray) def to_tensor( array: Union[Array, Tensor], dtype=torch.float32 ) -> Tensor: if torch.is_tensor(array):...
null
353
from typing import NewType, Union, Optional from dataclasses import dataclass, asdict, fields import numpy as np import torch def to_np(array, dtype=np.float32): if 'scipy.sparse' in str(type(array)): array = array.todense() return np.array(array, dtype=dtype)
null
354
from __future__ import absolute_import from __future__ import print_function from __future__ import division from typing import Tuple, List import numpy as np import torch import torch.nn.functional as F from .utils import rot_mat_to_euler, Tensor def batch_rodrigues( rot_vecs: Tensor, epsilon: float = 1e-8, ) ...
Compute the faces, barycentric coordinates for the dynamic landmarks To do so, we first compute the rotation of the neck around the y-axis and then use a pre-computed look-up table to find the faces and the barycentric coordinates that will be used. Special thanks to Soubhik Sanyal (soubhik.sanyal@tuebingen.mpg.de) for...
355
from __future__ import absolute_import from __future__ import print_function from __future__ import division from typing import Tuple, List import numpy as np import torch import torch.nn.functional as F from .utils import rot_mat_to_euler, Tensor Tensor = NewType('Tensor', torch.Tensor) The provided code snippet inc...
Calculates landmarks by barycentric interpolation Parameters ---------- vertices: torch.tensor BxVx3, dtype = torch.float32 The tensor of input vertices faces: torch.tensor Fx3, dtype = torch.long The faces of the mesh lmk_faces_idx: torch.tensor L, dtype = torch.long The tensor with the indices of the faces used to ca...
356
from __future__ import absolute_import from __future__ import print_function from __future__ import division from typing import Tuple, List import numpy as np import torch import torch.nn.functional as F from .utils import rot_mat_to_euler, Tensor def vertices2joints(J_regressor: Tensor, vertices: Tensor) -> Tensor: ...
Performs Linear Blend Skinning with the given shape and pose parameters Parameters ---------- betas : torch.tensor BxNB The tensor of shape parameters pose : torch.tensor Bx(J + 1) * 3 The pose parameters in axis-angle format v_template torch.tensor BxVx3 The template mesh that will be deformed shapedirs : torch.tensor...
357
import os import io import ntpath import hashlib import fnmatch import shlex import speakeasy.winenv.defs.windows.windows as windefs import speakeasy.winenv.arch as _arch from speakeasy.errors import FileSystemEmuError def normalize_response_path(path): def _get_speakeasy_root(): return os.path.join(os.pat...
null
358
import collections import speakeasy.winenv.arch as e_arch def _lowercase_set(tt): return set([bb.lower() for bb in tt])
null
359
import io import os from urllib.parse import urlparse from io import BytesIO from speakeasy.errors import NetworkEmuError def is_empty(bio): if len(bio.getbuffer()) == bio.tell(): return True return False
null
360
import io import os from urllib.parse import urlparse from io import BytesIO from speakeasy.errors import NetworkEmuError def normalize_response_path(path): def _get_speakeasy_root(): return os.path.join(os.path.dirname(__file__), os.pardir) root_var = '$ROOT$' if root_var in path: root =...
null
361
import os import ntpath import hashlib from collections import namedtuple import pefile import speakeasy.winenv.arch as _arch import speakeasy.winenv.defs.nt.ddk as ddk from speakeasy.struct import Enum def normalize_dll_name(name): ret = name # Funnel CRTs into a single handler if name.lower().startswith...
null
362
import os import json import time import logging import argparse import multiprocessing as mp import speakeasy from speakeasy import Speakeasy import speakeasy.winenv.arch as e_arch def get_logger(): """ Get the default logger for speakeasy """ logger = logging.getLogger('speakeasy') if not logger.h...
Setup the binary for emulation
363
import os import json import ntpath import hashlib import zipfile from io import BytesIO from typing import Callable from pefile import MACHINE_TYPE import jsonschema import jsonschema.exceptions import speakeasy import speakeasy.winenv.arch as _arch from speakeasy import PeFile from speakeasy import Win32Emulator from...
Validates the given configuration objects against the built-in schemas. Raises jsonschema.exceptions.ValidationError on invalid configuration. Expose the underlying jsonschema exception due to it having lots of information about failures. On success, returns without exception.
364
import platform import ctypes as ct import unicorn as uc import unicorn.unicorn import unicorn.x86_const as u import speakeasy.winenv.arch as arch import speakeasy.common as common from speakeasy.errors import EmuEngineError def is_platform_intel(): mach = platform.machine() if mach in ('x86_64', 'i386', 'x86'...
null
365
import os The provided code snippet includes necessary dependencies for implementing the `normalize_package_path` function. Write a Python function `def normalize_package_path(path)` to solve the following problem: Get the supplied path in relation to the package root Here is the function: def normalize_package_path...
Get the supplied path in relation to the package root
366
from socket import inet_aton from urllib.parse import urlparse import speakeasy.winenv.arch as _arch import speakeasy.windows.netman as netman import speakeasy.winenv.defs.wininet as windefs from .. import api def is_ip_address(ip): try: inet_aton(ip) return True except Exception: retur...
null
368
import sys import inspect import speakeasy.winenv.arch as _arch from speakeasy.errors import ApiEmuError from speakeasy.winenv.api import api from speakeasy.winenv.api.kernelmode import * from speakeasy.winenv.api.usermode import * def autoload_api_handlers(): api_handlers = [] for modname, modobj in sys.modu...
null
369
def get_define_int(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k
null
370
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_create_disposition(flags): disp = None dispostions = ('CREATE_ALWAYS', 'CREATE_NEW', 'OPEN_ALWAYS', 'OPEN_EXISTING', 'TRUNCATE_EXISTING') for k, v in [(k, v) for k, v in globals().items() if k in dispostions]: ...
null
371
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_define(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return ...
null
372
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_flag_defines(flags, prefix=''): def get_page_rights(define): return get_flag_defines(define, prefix='PAGE_')
null
373
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_flag_defines(flags, prefix=''): def get_creation_flags(flags): return get_flag_defines(flags, prefix='CREATE_')
null
374
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct class SID(EmuStruct): def __init__(self, ptr_size, sub_authority_count): super().__init__(ptr_size) self.Revision = ct.c_uint8 self.SubAuthorityCount = ct.c_uint8 self.IdentifierAuthority = ct.c_uint8 * 6 self.Su...
null
376
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_define_value(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or k != define: continue if prefix: if k.startswith(prefix): return v else: r...
null
377
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_flag_defines(flags, prefix=''): defs = [] for k, v in globals().items(): if not isinstance(v, int): continue if v & flags: if prefix and k.startswith(prefix): defs.append(k) retur...
null
378
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_define_int(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: ret...
null
379
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct def get_flag_defines(flags, prefix=''): defs = [] for k, v in globals().items(): if not isinstance(v, int): continue if v == flags: if prefix and k.startswith(prefix): defs.append(k) retur...
null
380
import uuid from speakeasy.struct import EmuStruct, Ptr def get_define_str(define, prefix=''): for k, v in globals().items(): if not isinstance(v, str) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k de...
null
381
import uuid from speakeasy.struct import EmuStruct, Ptr def get_define_str(define, prefix=''): for k, v in globals().items(): if not isinstance(v, str) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k de...
null
382
import uuid from speakeasy.struct import EmuStruct, Ptr def get_define_int(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k de...
null
383
import uuid from speakeasy.struct import EmuStruct, Ptr def get_define_int(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k de...
null
384
import uuid from speakeasy.struct import EmuStruct, Ptr def convert_guid_bytes_to_str(guid_bytes): u = uuid.UUID(bytes_le=guid_bytes) return ('{%s}' % u).upper()
null
385
def get_define(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k
null
386
from speakeasy.struct import EmuStruct, Ptr import ctypes as ct MIB_IF_TYPE_ETHERNET = 6 def get_adapter_type(type_str): if type_str == 'ethernet': return MIB_IF_TYPE_ETHERNET
null
387
from speakeasy.struct import Enum def get_access_defines(flags): defs = [] accesses = ('DELETE', 'READ_CONTROL', 'WRITE_DAC', 'WRITE_OWNER', 'SYNCHRONIZE', 'GENERIC_READ', 'GENERIC_WRITE', 'GENERIC_EXECUTE', 'GENERIC_ALL') for k, v in [(k, v) for k, v in globals().items() i...
null
388
from speakeasy.struct import Enum def get_flag_defines(flags, prefix=''): defs = [] for k, v in globals().items(): if isinstance(v, int): if v & flags: if prefix: if k.startswith(prefix): defs.append(k) else: ...
null
389
from speakeasy.struct import Enum def get_const_defines(const, prefix=''): defs = [] for k, v in globals().items(): if isinstance(v, int): if v == const: if prefix: if k.startswith(prefix): defs.append(k) else: ...
null
390
import ctypes as ct from speakeasy.struct import EmuStruct, Ptr def get_const_defines(flags, prefix=''): def get_flag_defines(flags): return get_const_defines(flags, prefix='INTERNET_FLAG')
null
391
import ctypes as ct from speakeasy.struct import EmuStruct, Ptr def get_option_define(opt): for k, v in globals().items(): if k.startswith('INTERNET_OPTION_') and v == opt: return k
null
392
import ctypes as ct from speakeasy.struct import EmuStruct, Ptr def get_const_defines(flags, prefix=''): defs = [] for k, v in globals().items(): if isinstance(v, int): if v & flags: if prefix: if k.startswith(prefix): defs.append(k...
null
393
import ctypes as ct from speakeasy.struct import EmuStruct, Ptr def get_header_query(opt): for k, v in globals().items(): if k.startswith('WINHTTP_QUERY_') and v == opt: return k
null
394
from speakeasy.struct import EmuStruct, Enum import ctypes as ct def get_flag_value(flag): return globals().get(flag)
null
395
from speakeasy.struct import EmuStruct, Enum import ctypes as ct def get_defines(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return...
null
396
from speakeasy.struct import EmuStruct, Enum import ctypes as ct def get_defines(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return...
null
397
def get_flag_defines(flags, prefix=''): defs = [] for k, v in globals().items(): if not isinstance(v, int): continue if v & flags: if prefix and k.startswith(prefix): defs.append(k) return defs
null
398
def get_define(define, prefix=''): def get_addr_family(define): return get_define(define, prefix='AF_')
null
399
def get_define(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k def get_sock_type(define): return get_define(define, prefi...
null
400
def get_define(define, prefix=''): for k, v in globals().items(): if not isinstance(v, int) or v != define: continue if prefix: if k.startswith(prefix): return k else: return k def get_proto_type(define): return get_define(define, pref...
null
401
import os import sys import cmd import shlex import fnmatch import logging import binascii import argparse import traceback import hexdump import speakeasy import speakeasy.winenv.arch as e_arch from speakeasy.errors import SpeakeasyError The provided code snippet includes necessary dependencies for implementing the `...
Get the default logger for speakeasy