python_code stringlengths 0 456k |
|---|
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# --------------------------------------------------------------------------
import sys
from .trace import EventTypes
from .. import utils
logger = utils.get_logger()
class BaseNo... |
#!/usr/bin/env python
import distutils.log
from distutils.command.build import build
from setuptools.command.develop import develop
from distutils.cmd import Command
from setuptools import setup
def read_text_file(path):
import os
with open(os.path.join(os.path.dirname(__file__), path)) as f:
return f... |
import six
from peachpy.c.types import Type, \
int8_t, int16_t, int32_t, int64_t, \
uint8_t, uint16_t, uint32_t, uint64_t, \
float_, double_
from peachpy.parse import parse_assigned_variable_name
from peachpy.name import Name
class Constant:
_supported_sizes = [1, 2, 4, 8, 16, 32, 64]
_supported_t... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
def int_size(n):
assert is_int64(n)
if is_int8(n):
return 1
elif is_int16(n):
return 2
elif is_int32(n):
return 4
else... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
__version_info__ = (0, 2, 0)
__version__ = '.'.join(map(str, __version_info__))
from peachpy.stream import InstructionStream
from peachpy.c.types import Type, \
uint8_t, ... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
from peachpy.abi import Endianness
class Encoder:
def __init__(self, endianness, bitness=None):
assert endianness in {Endianness.Little, Endianness.B... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
active_stream = None
class InstructionStream(object):
def __init__(self):
self.instructions = list()
self.previous_stream = None
def __enter__(self)... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy import Constant, ConstantBucket, RegisterAllocationError
import peachpy.codegen
import peachpy.c
import string
import inspect
import time
active_function = None
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import sys
class Loader:
def __init__(self, code_size, data_size=0):
from peachpy.util import is_int
if not is_int(code_size):
raise TypeErro... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Endianness:
Big, Little = "Big-Endian", "Little-Endian"
class ABI(object):
def __init__(self, name, endianness,
bool_size, wchar_size, short_... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
active_writers = []
class TextWriter(object):
def __init__(self, output_path):
super(TextWriter, self).__init__()
self.output_path = output_path
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
def parse_assigned_variable_name(stack_frames, constructor_name):
"""Analyses the provided stack frames and parses Python assignment expressions like
some.namesp... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
class Name:
def __init__(self, name=None, prename=None):
assert name is None or isinstance(name, str)
assert prename is None or isinstance(pre... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class CodeGenerator(object):
def __init__(self, use_tabs=True):
self.indentationLevel = 0
self.use_tabs = use_tabs
self.code = []
def indent(... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Argument(object):
"""
Function argument.
An argument must have a C type and a name.
:ivar c_type: the type of the argument in C
:type c_type: :cla... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
|
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
|
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class SymbolVisibility(IntEnum):
external = 0x01
private_external = 0x10
class SymbolType(IntEnum):
undefined = 0x00
prebound_unde... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class MemoryProtection(IntEnum):
read = 0x01
write = 0x02
execute = 0x04
default = 0x07
class Segment:
def __init__(self, name... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class FileType(IntEnum):
# No file type
null = 0
# Relocatable file
object = 1
# Executable file
executable = 2
# Fixed ... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Image:
def __init__(self, abi):
from peachpy.formats.macho.section import Segment, TextSection, ConstSection, StringTable, SymbolTable
self.abi = a... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.formats.mscoff.image import MachineType, Image
from peachpy.formats.mscoff.section import Section, TextSection, ReadOnlyDataSection
from peachpy.formats.mscoff.sy... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class StorageClass(IntEnum):
"""
External symbol. If section number is undefined (0), value specifies symbol size. Otherwise value specifie... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
class SectionFlags:
# Section contains executable code
code = 0x00000020
# Section contains initialized data
initialized_data = 0x00000040
# Sec... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class MachineType(IntEnum):
# Machine-independent
unknown = 0
# IA32 (x86)
x86 = 0x14C
# x86-64 (AMD64, Intel64, x64)
x86_64... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.formats.elf.section import DataSection, TextSection
|
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class SymbolBinding(IntEnum):
local = 0
global_ = 1
weak = 2
class SymbolType:
# No type specified (e.g. an absolute symbol)
u... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class SectionFlags(IntEnum):
# Section contains writable data during process execution
writable = 0x1
# Section occupies memory during p... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import IntEnum
class FileType(IntEnum):
# No file type
null = 0
# Relocatable file
object = 1
# Executable file
executable = 2
# Shared... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Image:
def __init__(self, abi, source=None):
from peachpy.formats.elf.section import null_section, StringSection, SymbolSection, SectionIndex
from p... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
class RegisterAllocator:
def __init__(self):
# Map from virtual register id to internal id of conflicting registers (both virtual and physical)
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.common.regalloc import RegisterAllocator
|
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
active_function = None
|
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
class Register(object):
GPType = 1
WMMXType = 2
VFPType = 3
def __init__(self):
super(Register, self).__init__()
self.number = N... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.arm.isa import Extension, Extensions
class Microarchitecture:
def __init__(self, name, extensions):
self.name = name
self.extensions = Exten... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class QuasiInstruction(object):
def __init__(self, name, origin=None):
super(QuasiInstruction, self).__init__()
self.name = name
self.line_number =... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import inspect
import peachpy.stream
from peachpy.arm.instructions import QuasiInstruction, Instruction, Operand
class Label(object):
def __init__(self, name):
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import inspect
import peachpy.stream
import peachpy.arm.function
from peachpy.arm.instructions import QuasiInstruction, Instruction, Operand
from peachpy.arm.isa import Exten... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import peachpy
import peachpy.arm.abi
import peachpy.arm.isa
from peachpy.arm.microarchitecture import Microarchitecture
from peachpy.arm.registers import GeneralPurposeRegi... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import inspect
import peachpy.stream
import peachpy.arm.function
from peachpy.arm.instructions import Instruction, Operand
from peachpy.arm.isa import Extension
class VFPLo... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Extension:
def __init__(self, name):
if name in {'V4', 'V5', 'V5E', 'V6', 'V6K', 'V7', 'V7MP', 'Div', 'Thumb', 'Thumb2',
'VFP', 'VFP2', ... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.abi import ABI
from peachpy.abi import Endianness
from peachpy.formats.elf.file import ElfClass, MachineType, DataEncoding
from peachpy.arm.registers import r0, r... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from __future__ import print_function
import time
import peachpy.arm.instructions
import peachpy.arm.registers
from peachpy.arm.microarchitecture import Microarchitecture
ac... |
__author__ = 'marat'
|
class Type:
def __init__(self, base, size=None, is_const=False,
is_floating_point=False, is_signed_integer=False, is_unsigned_integer=False,
is_pointer_integer=False, is_size_integer=False, is_vector=False, is_mask=False,
is_char=False, is_wchar=False, is_bool=Fals... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
abi = None
target = None
debug_level = 0
package = None
assembly_format = "go"
generate_assembly = None
rtl_dump_file = None
name_mangling = "${Name}"
def get_debug_level()... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import six
class Register(object):
"""A base class for all encodable registers (rip is not encodable)"""
_mask_size_map = {
0x1: 1,
0x2: 1,
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
def optional_rex(r, rm, force_rex=False):
assert r in {0, 1}, "REX.R must be 0 or 1"
from peachpy.x86_64.operand import MemoryAddress, RIPRelativeOffset
from peac... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
def check_operand(operand):
"""Validates operand object as an instruction operand and converts it to a standard form"""
from peachpy.x86_64.registers import Register... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Instruction(object):
def __init__(self, name, origin=None, prototype=None):
super(Instruction, self).__init__()
self.name = name
self.line_... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import inspect
import peachpy.stream
import peachpy.x86_64.options
import peachpy.x86_64.isa
from peachpy.x86_64.instructions import Instruction
from peachpy.x86_64.operand i... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import peachpy.x86_64.abi
import peachpy.x86_64.uarch
import peachpy.x86_64.isa
from peachpy.x86_64.registers import GeneralPurposeRegister, \
GeneralPurposeRegister8, ... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy import Type
m64 = Type("__m64", size=8, is_vector=True, header="mmintrin.h")
m128 = Type("__m128", size=16, is_vector=True, header="xmmintrin.h")
m128d = Type("... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
class Extension:
def __init__(self, name, safe_name=None):
assert isinstance(name, str), "name must be a string"
self.name = name
if safe_name is ... |
from peachpy.x86_64.registers import GeneralPurposeRegister, MMXRegister, XMMRegister, YMMRegister
from peachpy.x86_64.generic import MOV, MOVZX, MOVSX, MOVSXD
from peachpy.x86_64.mmxsse import MOVQ, MOVAPS, MOVAPD, MOVSS, MOVSD, MOVDQA
from peachpy.x86_64.avx import VMOVAPS, VMOVAPD, VMOVSS, VMOVSD, VMOVDQA
from peach... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
import inspect
import peachpy.stream
from peachpy.x86_64.instructions import Instruction
from peachpy.x86_64.operand import check_operand, format_operand_type, is_r32, is_im... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.x86_64 import isa
class Microarchitecture:
def __init__(self, name, extensions, alu_width, fpu_width, load_with, store_width):
self.name = name
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.abi import ABI
from peachpy.abi import Endianness
from peachpy.x86_64.registers import rax, rbx, rcx, rdx, rsi, rdi, rbp, r8, r9, r10, r11, r12, r13, r14, r15, \
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from __future__ import absolute_import
from peachpy import *
from peachpy.x86_64 import *
import sys
import argparse
import six
parser = argparse.ArgumentParser(
descr... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from __future__ import print_function
import os
import operator
import bisect
import collections
import six
import peachpy
import peachpy.writer
import peachpy.name
import pe... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from enum import Enum
class SectionType(Enum):
code = 0
const_data = 1
class Section(object):
max_alignment = 4096
def __init__(self, type, alignment_byte... |
import unittest
from peachpy import *
class UInt32(unittest.TestCase):
def runTest(self):
Constant.uint32(-2147483648)
Constant.uint32(0)
Constant.uint32(2147483647)
Constant.uint32(2147483648)
Constant.uint32(4294967295)
class UInt32x2(unittest.TestCase):
def runTest... |
import six
def equal_codes(code, ref_code):
assert isinstance(code, list) or isinstance(code, six.string_types)
assert isinstance(ref_code, list) or isinstance(code, six.string_types)
if isinstance(code, six.string_types):
code = code.splitlines()
if isinstance(ref_code, six.string_types):
... |
import unittest
class FileHeaderSize(unittest.TestCase):
def runTest(self):
from peachpy.formats.elf.file import FileHeader
import peachpy.arm.abi
file_header = FileHeader(peachpy.arm.abi.arm_gnueabi)
file_header_bytes = file_header.as_bytearray
self.assertEqual(len(file_he... |
import unittest
from peachpy import *
from peachpy.arm import *
class TestARM(unittest.TestCase):
def runTest(self):
# Implement function void add_1(const uint32_t *src, uint32_t *dst, size_t length)
source_arg = Argument(ptr(const_uint32_t))
destination_arg = Argument(ptr(uint32_t))
... |
import unittest
from test import equal_codes
from peachpy import *
from peachpy.x86_64 import *
class Empty(unittest.TestCase):
def runTest(self):
with Function("empty", tuple()) as function:
RETURN()
code = function.finalize(abi.goasm_amd64_abi).format("go")
ref_code = """
/... |
import unittest
from test import equal_codes
from peachpy import *
from peachpy.x86_64 import *
class TestExplicitRegisterInputConflict(unittest.TestCase):
def runTest(self):
with Function("explicit_reg_input", (), uint64_t) as function:
reg_tmp = GeneralPurposeRegister64()
MOV(reg... |
import unittest
from peachpy import *
from peachpy.x86_64 import *
abi_list = [abi.microsoft_x64_abi, abi.system_v_x86_64_abi, abi.linux_x32_abi, abi.native_client_x86_64_abi]
class Return0(unittest.TestCase):
def runTest(self):
for abi in abi_list:
for return_type in [int8_t, int16_t, int32_... |
import unittest
from test import equal_codes
from peachpy import *
from peachpy.x86_64 import *
class TestBasicBlockAnalysis(unittest.TestCase):
def runTest(self):
x = Argument(uint32_t)
y = Argument(uint32_t)
with Function("integer_sum", (x, y), uint32_t) as function:
reg_x =... |
import unittest
from test import equal_codes
from peachpy.x86_64 import *
class TestInvalidLabelName(unittest.TestCase):
"""Test that Label constructor rejects invalid names"""
def runTest(self):
with self.assertRaises(TypeError):
Label(1)
with self.assertRaises(ValueError):
... |
import unittest
from test import equal_codes
from peachpy import *
from peachpy.x86_64 import *
class Empty(unittest.TestCase):
def runTest(self):
with Function("empty", tuple()) as function:
RETURN()
code = function.format()
ref_code = """
void empty()
RETURN
"""
... |
import unittest
from peachpy import *
from peachpy.x86_64 import *
class EndOfInstructionRelocation(unittest.TestCase):
def runTest(self):
constant = Constant.uint32(42)
constant.address = 0
instruction = ADD(ecx, constant)
instruction.bytecode = instruction.encode()
reloca... |
import unittest
from test import equal_codes
from peachpy import *
from peachpy.x86_64 import *
class LoadAsm(unittest.TestCase):
def runTest(self):
x = Argument(int32_t)
y = Argument(float_)
with Function("Multiply", (x, y), double_) as asm_multiply:
reg_x = GeneralPurposeRe... |
import unittest
from peachpy.x86_64 import *
class SALwithCL(unittest.TestCase):
def runTest(self):
with Function("test_sal_r32_cl", ()):
n = GeneralPurposeRegister32()
SAL(n, cl)
RETURN()
class SARwithCL(unittest.TestCase):
def runTest(self):
with Functio... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestAESDEC(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestKADDB(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0xC5, 0xD5, 0x4A, 0xE... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestVMOVSS(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0xC4, 0xC1, 0x7A, 0x... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestADD(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0x04, 0x02]), ADD(al, 2... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.25
from peachpy.x86_64 import *
import unittest
class TestImm8(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0x49, 0x83, 0xF8, 0x00]), CMP(r8, ... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestMOVSS(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0xF3, 0x41, 0x0F, 0x1... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestPAVGUSB(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0x0F, 0x0F, 0xDD, 0... |
# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
# GNU assembler (GNU Binutils) 2.28.51.20170402
from peachpy.x86_64 import *
import unittest
class TestVFMADD132SS(unittest.TestCase):
def runTest(self):
self.assertEqual(bytearray([0x62, 0x42, 0x5... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from __future__ import print_function
import opcodes
import copy
import six
from opcodes.x86_64 import *
from codegen.code import CodeWriter, CodeBlock
import operator
import ... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
active_writer = None
class CodeWriter:
def __init__(self):
self.lines = list()
self.indent = 0
self.previous_writer = None
def __enter__(sel... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from __future__ import print_function
from opcodes.x86_64 import *
from codegen.code import CodeWriter, CodeBlock
import operator
import json
instruction_set = read_instruct... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from __future__ import print_function
from opcodes.x86_64 import *
from codegen.code import CodeWriter, CodeBlock
import os
import json
import subprocess
import tempfile
ins... |
import sphinx_bootstrap_theme
from peachpy import __version__
extensions = [
'sphinx.ext.autodoc'
]
source_suffix = '.rst'
master_doc = 'index'
autoclass_content = "both"
project = u'PeachPy'
copyright = u'2013-2015, Georgia Institute of Technology'
version = __version__
release = __version__
pygments_style =... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.x86_64 import *
from peachpy import *
a = Argument(ptr(const_float_))
b = Argument(ptr(const_float_))
c = Argument(ptr(float_))
with Function("matmul", (a, b, c... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.x86_64 import *
from peachpy import *
matrix = Argument(ptr(float_))
with Function("transpose4x4_opt", (matrix,)):
reg_matrix = GeneralPurposeRegister64()
... |
# This file is part of PeachPy package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy import *
from peachpy.x86_64 import *
x = Argument(ptr(const_float_))
y = Argument(ptr(const_float_))
length = Argument(size_t)
with Function("DotProduct", (x, ... |
"""GitHub Label Utilities."""
import json
from functools import lru_cache
from typing import Any, List, Tuple, TYPE_CHECKING, Union
from urllib.request import Request, urlopen
from github_utils import gh_fetch_url, GitHubComment
# TODO: this is a temp workaround to avoid circular dependencies,
# and should be... |
#!/usr/bin/env python3
import base64
import json
import os
import re
import time
import urllib.parse
from dataclasses import dataclass
from datetime import datetime
from functools import lru_cache
import yaml
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Pattern,
T... |
import os
import re
from typing import List, Pattern, Tuple, Optional
BOT_COMMANDS_WIKI = "https://github.com/pytorch/pytorch/wiki/Bot-commands"
CIFLOW_LABEL = re.compile(r"^ciflow/.+")
CIFLOW_TRUNK_LABEL = re.compile(r"^ciflow/trunk")
OFFICE_HOURS_LINK = "https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Ho... |
"""GitHub Utilities"""
import json
import os
from dataclasses import dataclass
from typing import Any, Callable, cast, Dict, List, Optional
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import Request, urlopen
@dataclass
class GitHubComment:
body_text: str
created_at:... |
#!/usr/bin/env python3
"""Check whether a PR has required labels."""
from typing import Any
from github_utils import gh_delete_comment, gh_post_pr_comment
from gitutils import get_git_remote_name, get_git_repo_dir, GitRepo
from label_utils import has_required_labels, is_label_err_comment, LABEL_ERR_MSG
from trymerge... |
#!/usr/bin/env python3
import os
import re
import tempfile
from collections import defaultdict
from datetime import datetime
from typing import cast, Any, Dict, Iterator, List, Optional, Tuple, Union
RE_GITHUB_URL_MATCH = re.compile("^https://.*@?github.com/(.+)/(.+)$")
def get_git_remote_name() -> str:
return... |
#!/usr/bin/env python3
from gitutils import get_git_repo_dir, GitRepo
from typing import Any
def parse_args() -> Any:
from argparse import ArgumentParser
parser = ArgumentParser("Merge PR/branch into default branch")
parser.add_argument("--sync-branch", default="sync")
parser.add_argument("--default-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.