repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
LowFat
LowFat-master/llvm-4.0.0.src/utils/prepare-code-coverage-artifact.py
#!/usr/bin/env python from __future__ import print_function '''Prepare a code coverage artifact. - Collate raw profiles into one indexed profile. - Generate html reports for the given binaries. ''' import argparse import glob import os import subprocess import sys def merge_raw_profiles(host_llvm_profdata, profile...
4,697
42.5
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/update_llc_test_checks.py
#!/usr/bin/env python2.7 """A test case update script. This script is a utility to update LLVM X86 'llc' based test cases with new FileCheck patterns. It can either update all of the tests in the file or a single test function. """ import argparse import os # Used to advertise this file's name ("autogenerate...
12,178
34.199422
86
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/DSAclean.py
#! /usr/bin/python #changelog: #10/13/2005b: replaced the # in tmp(.#*)* with alphanumeric and _, this will then remove #nodes such as %tmp.1.i and %tmp._i.3 #10/13/2005: exntended to remove variables of the form %tmp(.#)* rather than just #%tmp.#, i.e. it now will remove %tmp.12.3.15 etc, additionally fixed a spell...
1,187
35
89
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/create_ladder_graph.py
#!/usr/bin/env python """A ladder graph creation program. This is a python program that creates c source code that will generate CFGs that are ladder graphs. Ladder graphs are generally the worst case for a lot of dominance related algorithms (Dominance frontiers, etc), and often generate N^2 or worse behavior. One ...
1,293
28.409091
77
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/shuffle_fuzz.py
#!/usr/bin/env python """A shuffle vector fuzz tester. This is a python program to fuzz test the LLVM shufflevector instruction. It generates a function with a random sequnece of shufflevectors, maintaining the element mapping accumulated across the function. It then generates a main function which calls it with a di...
10,060
38.300781
148
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/DSAextract.py
#! /usr/bin/python #this is a script to extract given named nodes from a dot file, with #the associated edges. An edge is kept iff for edge x -> y # x and y are both nodes specified to be kept. #known issues: if a line contains '->' and is not an edge line #problems will occur. If node labels do not begin with #Nod...
3,350
28.919643
70
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/wciia.py
#!/usr/bin/env python """ wciia - Whose Code Is It Anyway Determines code owner of the file/folder relative to the llvm source root. Code owner is determined from the content of the CODE_OWNERS.TXT by parsing the D: field usage: utils/wciia.py path limitations: - must be run from llvm source root - very simplist...
2,944
22.373016
74
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/sort_includes.py
#!/usr/bin/env python """Script to sort the top-most block of #include lines. Assumes the LLVM coding conventions. Currently, this script only bothers sorting the llvm/... headers. Patches welcome for more functionality, and sorting other header groups. """ import argparse import os def sort_includes(f): """Sort...
2,859
29.425532
92
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/schedcover.py
#!/usr/bin/python # This creates a CSV file from the output of the debug output of subtarget: # llvm-tblgen --gen-subtarget --debug-only=subtarget-emitter # With thanks to Dave Estes for mentioning the idea at 2014 LLVM Developers' Meeting import os; import sys; import re; import operator; table = {} models = set(...
2,311
28.641026
86
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/gdb-scripts/prettyprinters.py
import gdb.printing class SmallStringPrinter: """Print an llvm::SmallString object.""" def __init__(self, val): self.val = val def to_string(self): begin = self.val['BeginX'] end = self.val['EndX'] return begin.cast(gdb.lookup_type("char").pointer()).string(length = end - begin) def display_h...
5,967
28.112195
144
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/llvm-build/llvmbuild/main.py
from __future__ import absolute_import import filecmp import os import sys import llvmbuild.componentinfo as componentinfo import llvmbuild.configutil as configutil from llvmbuild.util import fatal, note ### def cmake_quote_string(value): """ cmake_quote_string(value) -> str Return a quoted form of the...
40,402
39.242032
95
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/llvm-build/llvmbuild/configutil.py
""" Defines utilities useful for performing standard "configuration" style tasks. """ import re import os def configure_file(input_path, output_path, substitutions): """configure_file(input_path, output_path, substitutions) -> bool Given an input and output path, "configure" the file at the given input path ...
2,084
30.119403
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/llvm-build/llvmbuild/util.py
import os import sys def _write_message(kind, message): program = os.path.basename(sys.argv[0]) sys.stderr.write('%s: %s: %s\n' % (program, kind, message)) note = lambda message: _write_message('note', message) warning = lambda message: _write_message('warning', message) error = lambda message: _write_message...
466
32.357143
77
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/llvm-build/llvmbuild/__init__.py
from llvmbuild.main import main
32
15.5
31
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/llvm-build/llvmbuild/componentinfo.py
""" Descriptor objects for entities that are part of the LLVM project. """ from __future__ import absolute_import try: import configparser except: import ConfigParser as configparser import sys from llvmbuild.util import fatal, warning class ParseError(Exception): pass class ComponentInfo(object): "...
16,943
34.596639
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/testgen/mc-bundling-x86-gen.py
#!/usr/bin/python # Auto-generates an exhaustive and repetitive test for correct bundle-locked # alignment on x86. # For every possible offset in an aligned bundle, a bundle-locked group of every # size in the inclusive range [1, bundle_size] is inserted. An appropriate CHECK # is added to verify that NOP padding occ...
3,818
35.721154
84
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/opt-viewer/opt-viewer.py
#!/usr/bin/env python2.7 from __future__ import print_function desc = '''Generate HTML output to visualize optimization records from the YAML files generated with -fsave-optimization-record and -fdiagnostics-show-hotness. The tools requires PyYAML and Pygments Python packages. For faster parsing, you may want to us...
8,866
26.796238
112
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/Target/ARM/analyze-match-table.py
#!/usr/bin/env python def analyze_match_table(path): # Extract the instruction table. data = open(path).read() start = data.index("static const MatchEntry MatchTable") end = data.index("\n};\n", start) lines = data[start:end].split("\n")[1:] # Parse the instructions. insns = [] for ln ...
2,129
33.354839
78
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit.py
#!/usr/bin/env python from lit.main import main if __name__=='__main__': main()
86
11.428571
25
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/setup.py
import lit import os from setuptools import setup, find_packages # setuptools expects to be invoked from within the directory of setup.py, but it # is nice to allow: # python path/to/setup.py install # to work (for scripts, etc.) os.chdir(os.path.dirname(os.path.abspath(__file__))) setup( name = "lit", ver...
1,878
23.089744
85
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/shtest-shell.py
# Check the internal shell handling component of the ShTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out # RUN: FileCheck --input-file %t.out %s # # END. # CHECK: -- Testing: # CHECK: FAIL: shtest-shell :: error-0.txt # CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED *** # CHECK: $ "not-a-...
997
28.352941
67
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/shtest-encoding.py
# RUN: true # Here is a string that cannot be decoded in line mode: .
71
17
57
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/shtest-timeout.py
# REQUIRES: python-psutil # Test per test timeout using external shell # RUN: not %{lit} \ # RUN: %{inputs}/shtest-timeout/infinite_loop.py \ # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \ # RUN: %{inputs}/shtest-timeout/short.py \ # RUN: %{inputs}/shtest-timeout/slow.py \ # RUN: -j 1 -v --debug --timeout 1 --pa...
5,009
42.189655
84
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/shell-parsing.py
# Just run the ShUtil unit tests. # # RUN: %{python} -m lit.ShUtil
67
16
33
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/xunit-output.py
# Check xunit output # RUN: %{lit} --xunit-xml-output %t.xunit.xml %{inputs}/test-data # RUN: FileCheck < %t.xunit.xml %s # CHECK: <?xml version="1.0" encoding="UTF-8" ?> # CHECK: <testsuites> # CHECK: <testsuite name='test-data' tests='1' failures='0'> # CHECK: <testcase classname='test-data.test-data' name='metrics....
392
34.727273
91
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/discovery.py
# Check the basic discovery process, including a sub-suite. # # RUN: %{lit} %{inputs}/discovery \ # RUN: -j 1 --debug --show-tests --show-suites \ # RUN: -v > %t.out 2> %t.err # RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s # RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s # # CHECK-BASIC-ERR:...
4,093
40.77551
84
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/shtest-format.py
# Check the various features of the ShTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/shtest-format > %t.out # RUN: FileCheck < %t.out %s # # END. # CHECK: -- Testing: # CHECK: PASS: shtest-format :: argv0.txt # CHECK: FAIL: shtest-format :: external_shell/fail.txt # CHECK-NEXT: *** TEST 'shtest-format :: external...
2,598
31.898734
94
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/max-failures.py
# Check the behavior of --max-failures option. # # RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out # RUN: not %{lit} --max-failures=1 -j 1 -v %{inputs}/shtest-shell >> %t.out # RUN: not %{lit} --max-failures=2 -j 1 -v %{inputs}/shtest-shell >> %t.out # RUN: not %{lit} --max-failures=0 -j 1 -v %{inputs}/shtest-s...
526
34.133333
76
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/googletest-format.py
# Check the various features of the GoogleTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/googletest-format > %t.out # RUN: FileCheck < %t.out %s # # END. # CHECK: -- Testing: # CHECK: PASS: googletest-format :: DummySubDir/OneTest/FirstTest.subTestA # CHECK: FAIL: googletest-format :: DummySubDir/OneTest/FirstTest...
781
36.238095
95
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/googletest-upstream-format.py
# Check the various features of the GoogleTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/googletest-upstream-format > %t.out # RUN: FileCheck < %t.out %s # # END. # CHECK: -- Testing: # CHECK: PASS: googletest-upstream-format :: DummySubDir/OneTest/FirstTest.subTestA # CHECK: FAIL: googletest-upstream-format :: Du...
882
41.047619
104
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/unittest-adaptor.py
# Check the lit adaption to run under unittest. # # RUN: %{python} %s %{inputs}/unittest-adaptor 2> %t.err # RUN: FileCheck < %t.err %s # # CHECK-DAG: unittest-adaptor :: test-two.txt ... FAIL # CHECK-DAG: unittest-adaptor :: test-one.txt ... ok import unittest import sys import lit import lit.discovery input_path =...
467
23.631579
60
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/usage.py
# Basic sanity check that usage works. # # RUN: %{lit} --help > %t.out # RUN: FileCheck < %t.out %s # # CHECK: usage: lit.py [-h]
130
17.714286
38
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/googletest-timeout.py
# REQUIRES: python-psutil # Check that the per test timeout is enforced when running GTest tests. # # RUN: not %{lit} -j 1 -v %{inputs}/googletest-timeout --timeout=1 > %t.cmd.out # RUN: FileCheck < %t.cmd.out %s # Check that the per test timeout is enforced when running GTest tests via # the configuration file # # R...
1,241
40.4
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/test-data.py
# Test features related to formats which support reporting additional test data. # RUN: %{lit} -j 1 -v %{inputs}/test-data > %t.out # RUN: FileCheck < %t.out %s # CHECK: -- Testing: # CHECK: PASS: test-data :: metrics.ini # CHECK-NEXT: *** TEST 'test-data :: metrics.ini' RESULTS *** # CHECK-NEXT: value0: 1 # CHECK-N...
358
26.615385
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/progress-bar.py
# Check the simple progress bar. # # RUN: not %{lit} -j 1 -s %{inputs}/progress-bar > %t.out # RUN: FileCheck < %t.out %s # # CHECK: Testing: 0 .. 10.. 20 # CHECK: FAIL: shtest-shell :: test-1.txt (1 of 4) # CHECK: Testing: 0 .. 10.. 20.. 30.. 40.. # CHECK: FAIL: shtest-shell :: test-2.txt (2 of 4) # CHECK: Testing: 0...
528
36.785714
68
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/shtest-output-printing.py
# Check the various features of the ShTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/shtest-output-printing > %t.out # RUN: FileCheck --input-file %t.out %s # # END. # CHECK: -- Testing: # CHECK: FAIL: shtest-output-printing :: basic.txt # CHECK-NEXT: *** TEST 'shtest-output-printing :: basic.txt' FAILED *** # CH...
829
27.62069
71
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/test-output.py
# RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out # RUN: FileCheck < %t.results.out %s # CHECK: { # CHECK: "__version__" # CHECK: "elapsed" # CHECK-NEXT: "tests": [ # CHECK-NEXT: { # CHECK-NEXT: "code": "PASS", # CHECK-NEXT: "elapsed": {{[0-9.]+}}, # CHECK-NEXT: "metrics": { # CH...
553
26.7
74
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/unit/TestRunner.py
# RUN: %{python} %s # # END. import unittest import platform import os.path import tempfile import lit from lit.TestRunner import ParserKind, IntegratedTestKeywordParser, \ parseIntegratedTestScript class TestIntegratedTestKeywordParser(unittest.TestCase): inputTestCase = None @...
4,358
36.904348
82
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/unit/ShUtil.py
# RUN: %{python} %s import unittest from lit.ShUtil import Command, Pipeline, Seq, ShLexer, ShParser class TestShLexer(unittest.TestCase): def lex(self, str, *args, **kwargs): return list(ShLexer(str, *args, **kwargs).lex()) def test_basic(self): self.assertEqual(self.lex('a|b>c&d<e;f'), ...
4,682
40.442478
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/Inputs/shtest-timeout/short.py
# RUN: %{python} %s from __future__ import print_function print("short program")
82
15.6
37
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py
# RUN: %{python} %s from __future__ import print_function import sys print("Running infinite loop") sys.stdout.flush() # Make sure the print gets flushed so it appears in lit output. while True: pass
206
19.7
82
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/Inputs/shtest-timeout/slow.py
# RUN: %{python} %s from __future__ import print_function import time import sys print("Running slow program") sys.stdout.flush() # Make sure the print gets flushed so it appears in lit output. time.sleep(6)
210
20.1
82
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/Inputs/shtest-timeout/quick_then_slow.py
# RUN: %{python} %s quick # RUN: %{python} %s slow from __future__ import print_function import time import sys if len(sys.argv) != 2: print("Wrong number of args") sys.exit(1) mode = sys.argv[1] if mode == 'slow': print("Running in slow mode") sys.stdout.flush() # Make sure the print gets flushed ...
525
20.04
86
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/tests/Inputs/discovery/subdir/test-three.py
# RUN: true
12
5.5
11
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/LitTestCase.py
from __future__ import absolute_import import unittest import lit.Test """ TestCase adaptor for providing a 'unittest' compatible interface to 'lit' tests. """ class UnresolvedError(RuntimeError): pass class LitTestCase(unittest.TestCase): def __init__(self, test, run): unittest.TestCase.__i...
850
23.314286
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/main.py
#!/usr/bin/env python """ lit - LLVM Integrated Tester. See lit.pod for more information. """ from __future__ import absolute_import import os import platform import random import re import sys import time import argparse import tempfile import shutil import lit.ProgressBar import lit.LitConfig import lit.Test impo...
22,727
39.513369
86
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/ProgressBar.py
#!/usr/bin/env python # Source: http://code.activestate.com/recipes/475116/, with # modifications by Daniel Dunbar. import sys, re, time def to_bytes(str): # Encode to UTF-8 to get binary data. return str.encode('utf-8') class TerminalController: """ A class that can be used to portably generate for...
10,717
35.705479
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/TestingConfig.py
import os import sys class TestingConfig: """" TestingConfig - Information on the tests inside a suite. """ @staticmethod def fromdefaults(litConfig): """ fromdefaults(litConfig) -> TestingConfig Create a TestingConfig object with default values. """ # Set...
5,932
37.525974
89
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/LitConfig.py
from __future__ import absolute_import import inspect import os import sys import lit.Test import lit.formats import lit.TestingConfig import lit.util # LitConfig must be a new style class for properties to work class LitConfig(object): """LitConfig - Configuration data for a 'lit' test runner instance, shared ...
5,549
34.576923
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/TestRunner.py
from __future__ import absolute_import import os, signal, subprocess, sys import re import platform import tempfile import threading import lit.ShUtil as ShUtil import lit.Test as Test import lit.util from lit.util import to_bytes, to_string class InternalShellError(Exception): def __init__(self, command, message...
38,501
36.933005
106
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/Test.py
import os from xml.sax.saxutils import escape from json import JSONEncoder # Test result codes. class ResultCode(object): """Test result codes.""" # We override __new__ and __getnewargs__ to ensure that pickling still # provides unique ResultCode objects in any particular instance. _instances = {} ...
8,541
30.061818
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/ShCommands.py
class Command: def __init__(self, args, redirects): self.args = list(args) self.redirects = list(redirects) def __repr__(self): return 'Command(%r, %r)' % (self.args, self.redirects) def __eq__(self, other): if not isinstance(other, Command): return False ...
2,696
30.360465
69
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/discovery.py
""" Test discovery functions. """ import copy import os import sys import lit.run from lit.TestingConfig import TestingConfig from lit import LitConfig, Test def dirContainsTestSuite(path, lit_config): cfgpath = os.path.join(path, lit_config.site_config_name) if os.path.exists(cfgpath): return cfgpat...
9,059
34.390625
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/run.py
import os import threading import time import traceback try: import Queue as queue except ImportError: import queue try: import win32api except ImportError: win32api = None try: import multiprocessing except ImportError: multiprocessing = None import lit.Test ### # Test Execution Implementat...
10,076
31.931373
80
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/util.py
import errno import itertools import math import os import platform import signal import subprocess import sys import threading def to_bytes(str): # Encode to UTF-8 to get binary data. return str.encode('utf-8') def to_string(bytes): if isinstance(bytes, str): return bytes return to_bytes(byte...
9,754
32.180272
83
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/ShUtil.py
from __future__ import absolute_import import itertools import lit.util from lit.ShCommands import Command, Pipeline, Seq class ShLexer: def __init__(self, data, win32Escapes = False): self.data = data self.pos = 0 self.end = len(data) self.win32Escapes = win32Escapes def eat(...
7,565
29.508065
78
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/__init__.py
"""'lit' Testing Tool""" __author__ = 'Daniel Dunbar' __email__ = 'daniel@minormatter.com' __versioninfo__ = (0, 6, 0) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = [] from .main import main
222
19.272727
63
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/formats/base.py
from __future__ import absolute_import import os import lit.Test import lit.util class TestFormat(object): pass ### class FileBasedTest(TestFormat): def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig): source_path = testSuite.getSourcePath(path...
3,947
32.457627
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/formats/shtest.py
from __future__ import absolute_import import lit.TestRunner from .base import FileBasedTest class ShTest(FileBasedTest): def __init__(self, execute_external = False): self.execute_external = execute_external def execute(self, test, litConfig): return lit.TestRunner.executeShTest(test, litCon...
392
29.230769
66
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/formats/__init__.py
from lit.formats.base import ( # noqa: F401 TestFormat, FileBasedTest, OneCommandPerFileTest ) from lit.formats.googletest import GoogleTest # noqa: F401 from lit.formats.shtest import ShTest # noqa: F401
221
23.666667
59
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lit/lit/formats/googletest.py
from __future__ import absolute_import import os import subprocess import sys import lit.Test import lit.TestRunner import lit.util from .base import TestFormat kIsWindows = sys.platform in ['win32', 'cygwin'] class GoogleTest(TestFormat): def __init__(self, test_sub_dir, test_suffix): self.test_sub_dir ...
5,878
39.267123
93
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lint/common_lint.py
#!/usr/bin/python # # Common lint functions applicable to multiple types of files. import re def VerifyLineLength(filename, lines, max_length): """Checks to make sure the file has no lines with lines exceeding the length limit. Args: filename: the file under consideration as string lines: contents of t...
2,589
25.428571
78
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lint/cpp_lint.py
#!/usr/bin/python # # Checks C++ files to make sure they conform to LLVM standards, as specified in # http://llvm.org/docs/CodingStandards.html . # # TODO: add unittests for the verifier functions: # http://docs.python.org/library/unittest.html . import common_lint import re import sys def VerifyIncludes(filename, li...
3,031
30.915789
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/lint/generic_lint.py
#!/usr/bin/python # # Checks files to make sure they conform to LLVM standards which can be applied # to any programming language: at present, line length and trailing whitespace. import common_lint import sys class GenericCodeLint(common_lint.BaseLint): MAX_LINE_LENGTH = 80 def RunOnFile(self, filename, lines):...
683
26.36
79
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/abtest/mark_armfns.py
#!/usr/bin/env python # # Mark functions in an arm assembly file. This is done by surrounding the # function with "# -- Begin Name" and "# -- End Name" # (This script is designed for arm ios assembly syntax) import sys import re inp = open(sys.argv[1], "r").readlines() # First pass linenum = 0 INVALID=-100 last_align...
1,415
24.745455
73
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/abtest/abtest.py
#!/usr/bin/env python # # Given a previous good compile narrow down miscompiles. # Expects two directories named "before" and "after" each containing a set of # assembly or object files where the "after" version is assumed to be broken. # You also have to provide a script called "link_test". It is called with a list # ...
8,132
33.608511
85
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/abtest/mark_aarch64fns.py
#!/usr/bin/env python # # Mark functions in an arm assembly file. This is done by surrounding the # function with "# -- Begin Name" and "# -- End Name" # (This script is designed for aarch64 ios assembly syntax) import sys import re inp = open(sys.argv[1], "r").readlines() # First pass linenum = 0 INVALID=-100 last_a...
1,700
24.772727
78
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/release/findRegressions-nightly.py
#!/usr/bin/env python import re, string, sys, os, time DEBUG = 0 testDirName = 'llvm-test' test = ['compile', 'llc', 'jit', 'cbe'] exectime = ['llc-time', 'jit-time', 'cbe-time',] comptime = ['llc', 'jit-comptime', 'compile'] (tp, exp) = ('compileTime_', 'executeTime_') def parse(file): f=open(file, '...
3,193
23.381679
72
py
LowFat
LowFat-master/llvm-4.0.0.src/utils/release/findRegressions-simple.py
#!/usr/bin/env python import re, string, sys, os, time, math DEBUG = 0 (tp, exp) = ('compile', 'exec') def parse(file): f = open(file, 'r') d = f.read() # Cleanup weird stuff d = re.sub(r',\d+:\d', '', d) r = re.findall(r'TEST-(PASS|FAIL|RESULT.*?):\s+(.*?)\s+(.*?)\r*\n', d) test = {} fname = '' ...
4,045
24.446541
112
py
DMASTE
DMASTE-main/Span-ASTE/train.py
import sys sys.path.append('aste') from wrapper import SpanModel import argparse import os def main(): parser = argparse.ArgumentParser(description='Bidirectional MRC-based sentiment triplet extraction') parser.add_argument('--data_dir', type=str, default="../dataset/") parser.add_argument('--log_dir', ...
1,857
53.647059
182
py
DMASTE
DMASTE-main/Span-ASTE/span_model/__init__.py
0
0
0
py
DMASTE
DMASTE-main/Span-ASTE/span_model/training/ner_metrics.py
from overrides import overrides from typing import Optional import torch from allennlp.training.metrics.metric import Metric from span_model.training.f1 import compute_f1 # TODO: Need to use the decoded predictions so that we catch the gold examples longer than # the span boundary. class NERMetrics(Metric): "...
2,358
29.636364
95
py
DMASTE
DMASTE-main/Span-ASTE/span_model/training/f1.py
""" Function to compute F1 scores. """ def safe_div(num, denom): if denom > 0: return num / denom else: return 0 def compute_f1(predicted, gold, matched): precision = safe_div(matched, predicted) recall = safe_div(matched, gold) f1 = safe_div(2 * precision * recall, precision + r...
360
19.055556
61
py
DMASTE
DMASTE-main/Span-ASTE/span_model/training/relation_metrics.py
from overrides import overrides from allennlp.training.metrics.metric import Metric from span_model.training.f1 import compute_f1 class RelationMetrics(Metric): """ Computes precision, recall, and micro-averaged F1 from a list of predicted and gold spans. """ def __init__(self): self.reset(...
2,156
32.703125
94
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/ner.py
import logging from typing import Any, Dict, List, Optional, Callable import torch from torch.nn import functional as F from overrides import overrides from allennlp.data import Vocabulary from allennlp.models.model import Model from allennlp.modules import TimeDistributed from allennlp.nn import util, InitializerApp...
10,868
39.707865
121
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/embedder.py
from typing import Optional, Tuple from overrides import overrides import torch from allennlp.modules.token_embedders import PretrainedTransformerEmbedder, TokenEmbedder from allennlp.nn import util from allennlp.modules.scalar_mix import ScalarMix @TokenEmbedder.register("double_mix_ptm") class DoubleMixPTMEmbedde...
7,218
44.689873
131
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/relation_proper.py
import logging from typing import Any, Dict, List, Optional, Callable import torch import torch.nn.functional as F from overrides import overrides from allennlp.data import Vocabulary from allennlp.models.model import Model from allennlp.nn import util, RegularizerApplicator from allennlp.modules import TimeDistribut...
20,888
39.561165
128
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/shared.py
""" Short utility functions. """ from typing import Optional, Callable import torch import torch.nn.functional as F from allennlp.modules import FeedForward from allennlp.modules.span_extractors import EndpointSpanExtractor, SpanExtractor from allennlp.nn.util import batched_span_select from overrides import override...
10,701
33.634304
106
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/span_model.py
import logging from typing import Dict, List, Optional, Union import copy import torch import torch.nn.functional as F from overrides import overrides from allennlp.data import Vocabulary from allennlp.common.params import Params from allennlp.models.model import Model from allennlp.modules import TextFieldEmbedder, ...
17,657
35.941423
111
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/entity_beam_pruner.py
""" This is basically a copy of AllenNLP's Pruner module, but with support for entity beams. """ from typing import Tuple, Union from overrides import overrides import torch from allennlp.nn import util from allennlp.modules import TimeDistributed def make_pruner(scorer, entity_beam=False, gold_beam=False): ""...
18,631
43.46778
99
py
DMASTE
DMASTE-main/Span-ASTE/span_model/models/__init__.py
from span_model.models.span_model import SpanModel
51
25
50
py
DMASTE
DMASTE-main/Span-ASTE/span_model/predictors/span_model.py
from typing import List import numpy as np import warnings from overrides import overrides import numpy import json from allennlp.common.util import JsonDict from allennlp.nn import util from allennlp.data import Batch from allennlp.data import DatasetReader from allennlp.models import Model from allennlp.predictors....
2,612
34.310811
91
py
DMASTE
DMASTE-main/Span-ASTE/span_model/predictors/__init__.py
from span_model.predictors.span_model import SpanModelPredictor
64
31.5
63
py
DMASTE
DMASTE-main/Span-ASTE/span_model/data/__init__.py
from span_model.data.dataset_readers.span_model import SpanModelReader from span_model.data.dataset_readers.document import Document
133
43.666667
70
py
DMASTE
DMASTE-main/Span-ASTE/span_model/data/dataset_readers/document.py
from span_model.models.shared import fields_to_batches, batches_to_fields import copy import numpy as np import re import json def format_float(x): return round(x, 4) class SpanCrossesSentencesError(ValueError): pass def get_sentence_of_span(span, sentence_starts, doc_tokens): """ Return the index...
13,593
30.836066
133
py
DMASTE
DMASTE-main/Span-ASTE/span_model/data/dataset_readers/span_model.py
import json import logging import pickle as pkl import warnings from typing import Any, DefaultDict, Dict, List, Optional, Set, Tuple, Union from allennlp.common.file_utils import cached_path from allennlp.data.dataset_readers.dataset_reader import DatasetReader from allennlp.data.dataset_readers.dataset_utils import ...
9,644
33.819495
96
py
DMASTE
DMASTE-main/Span-ASTE/scripts/cross-domain/run_eq.py
import os import sys import time import random import threading import itertools as it source_list = ['electronics', 'home', 'beauty', 'fashion'] # source_list = ['_'.join(sorted(x)) for x in it.combinations(t_list, 2)] + ['_'.join(sorted(x)) for x in it.combinations(t_list, 3)] target_list = ['book', 'grocery', 'p...
1,784
30.875
133
py
DMASTE
DMASTE-main/Span-ASTE/scripts/cross-domain/run_multi.py
import os import sys import time import random import threading import itertools as it t_list = ['electronics', 'home', 'beauty', 'fashion'] # source_list = ['_'.join(sorted(x)) for x in it.combinations(t_list, 2)] + ['_'.join(sorted(x)) for x in it.combinations(t_list, 3)] source_list = ['_'.join(sorted(x)) for x ...
1,873
31.310345
133
py
DMASTE
DMASTE-main/Span-ASTE/aste/main.py
import json import shutil import time from os import remove from pathlib import Path from typing import List, Tuple, Optional import _jsonnet # noqa import pandas as pd from fire import Fire from pydantic import BaseModel from data_utils import ( LabelEnum, SplitEnum, Sentence, SentimentTriple, D...
9,999
33.129693
99
py
DMASTE
DMASTE-main/Span-ASTE/aste/wrapper.py
import json import os from pathlib import Path from typing import List import _jsonnet from fire import Fire from pydantic import BaseModel from tqdm import tqdm from data_utils import Data, SentimentTriple, SplitEnum from main import SpanModelData, SpanModelPrediction from utils import Shell, safe_divide class Spa...
5,884
33.617647
85
py
DMASTE
DMASTE-main/Span-ASTE/aste/utils.py
import copy import hashlib import pickle import subprocess import time from pathlib import Path from typing import List, Set, Tuple, Union from fire import Fire from pydantic import BaseModel class Shell(BaseModel): verbose: bool = True @classmethod def format_kwargs(cls, **kwargs) -> str: outpu...
4,805
26.306818
104
py
DMASTE
DMASTE-main/Span-ASTE/aste/data_utils.py
import ast import copy import json import os from collections import Counter from enum import Enum from pathlib import Path from typing import Dict, List, Optional, Set, Tuple import numpy as np import pandas as pd from fire import Fire from pydantic import BaseModel from sklearn.metrics import classification_report f...
23,239
34.589587
88
py
DMASTE
DMASTE-main/Span-ASTE/aste/__init__.py
0
0
0
py
DMASTE
DMASTE-main/Span-ASTE/aste/evaluation.py
from abc import abstractmethod class Instance: def __init__(self, instance_id, weight, inputs=None, output=None): self.instance_id = instance_id self.weight = weight self.input = inputs self.output = output self.labeled_instance = None self.unlabeled_instance = None...
18,132
33.020638
98
py
DMASTE
DMASTE-main/BMRC/main.py
# coding: UTF-8 # @Author: Shaowei Chen, Contact: chenshaowei0507@163.com # @Date: 2021-5-4 import argparse import Data import Model import utils import torch from torch.nn import functional as F from transformers import AdamW, get_linear_schedule_with_warmup, BertTokenizer import os from torch.utils.data import...
34,866
52.3951
156
py
DMASTE
DMASTE-main/BMRC/DANN_main.py
# coding: UTF-8 # @Author: Shaowei Chen, Contact: chenshaowei0507@163.com # @Date: 2021-5-4 import argparse import Data import DANN_Model as Model import utils import torch from torch.nn import functional as F from transformers import AdamW, get_linear_schedule_with_warmup, BertTokenizer import os from torch.uti...
40,827
54.928767
229
py
DMASTE
DMASTE-main/BMRC/DANN_Model.py
# coding: UTF-8 # @Author: Shaowei Chen, Contact: chenshaowei0507@163.com # @Date: 2021-5-4 from transformers import BertTokenizer, BertModel, BertConfig import torch.nn as nn from functions import ReverseLayerF class BERTModel(nn.Module): def __init__(self, args): hidden_size = args.hidden_size ...
2,062
38.673077
112
py
DMASTE
DMASTE-main/BMRC/Data.py
# coding: UTF-8 # @Author: Shaowei Chen, Contact: chenshaowei0507@163.com # @Date: 2021-5-4 from torch.utils.data import Dataset, DataLoader import numpy as np class OriginalDataset(Dataset): def __init__(self, pre_data): self._forward_asp_query = pre_data['_forward_asp_query'] self._forwar...
8,838
53.561728
87
py
DMASTE
DMASTE-main/BMRC/functions.py
from torch.autograd import Function class ReverseLayerF(Function): @staticmethod def forward(ctx, x, alpha): ctx.alpha = alpha return x.view_as(x) @staticmethod def backward(ctx, grad_output): output = grad_output.neg() * ctx.alpha return output, None
305
18.125
46
py
DMASTE
DMASTE-main/BMRC/dataProcess.py
# @Author: Shaowei Chen, Contact: chenshaowei0507@163.com # @Date: 2021-5-4 import pickle import torch import os class dual_sample(object): def __init__(self, original_sample, text, forward_querys, forward_answers, backward...
7,431
42.209302
230
py