index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
46,623 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/tool_shed/api/create_categories.py | 29,30 | 1,75 | main | 30,52 | 30,52 | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each category) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the category
name and description from each dictionary and create a new category with that name and des... | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each category) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the category
name and description from each dictionary and create a new category with that name and des... | api_key = options.api
from_tool_shed = options.from_tool_shed.rstrip("/")
to_tool_shed = options.to_tool_shed.rstrip("/")
# Get the categories from the specified Tool Shed.
url = f"{from_tool_shed}/api/categories"
category_dicts = get(url)
create_response_dicts = []
for category_dict in ... | api_key = options.api
from_tool_shed = options.from_tool_shed.rstrip("/")
to_tool_shed = options.to_tool_shed.rstrip("/")
# Get the categories from the specified Tool Shed.
url = f"{from_tool_shed}/api/categories"
category_dicts = get(url)
create_response_dicts = []
for category_dict in ... | 86 | 573 | 301 | 874 | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each category) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the category
name and description from each dictionary and create a new category with that name and des... | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each category) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the category
name and description from each dictionary and create a new category with that name and des... | |
46,624 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/tool_shed/api/create_users.py | 30,31 | 1,73 | main | 31,54 | 31,54 | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each user) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the
username from each dictionary and create a new user with that username in the Tool Shed defined
by the ... | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each user) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the
username from each dictionary and create a new user with that username in the Tool Shed defined
by the ... | api_key = options.api
from_tool_shed = options.from_tool_shed.rstrip("/")
to_tool_shed = options.to_tool_shed.rstrip("/")
# Get the users from the specified Tool Shed.
url = f"{from_tool_shed}/api/users"
user_dicts = get(url)
create_response_dicts = []
for user_dict in user_dicts:
... | api_key = options.api
from_tool_shed = options.from_tool_shed.rstrip("/")
to_tool_shed = options.to_tool_shed.rstrip("/")
# Get the users from the specified Tool Shed.
url = f"{from_tool_shed}/api/users"
user_dicts = get(url)
create_response_dicts = []
for user_dict in user_dicts:
... | 84 | 592 | 307 | 899 | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each user) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the
username from each dictionary and create a new user with that username in the Tool Shed defined
by the ... | #!/usr/bin/env python
"""
This script will retrieve a list of dictionaries (one for each user) from the Tool Shed defined
by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the
username from each dictionary and create a new user with that username in the Tool Shed defined
by the ... | |
46,626 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/extract/liftOver_wrapper.py | 20,21 | 1,100 | safe_bed_file | 28,37 | 21,37 | #!/usr/bin/env python
# Guruprasad Ananda
"""
Converts coordinates from one build/assembly to another using liftOver binary and mapping files downloaded from UCSC.
"""
import os
import re
import subprocess
import sys
import tempfile
from typing import Union
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()... | #!/usr/bin/env python
# Guruprasad Ananda
"""
Converts coordinates from one build/assembly to another using liftOver binary and mapping files downloaded from UCSC.
"""
import os
import re
import subprocess
import sys
import tempfile
from typing import Union
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()... | fix_pat = re.compile("^(track|browser)")
with tempfile.NamedTemporaryFile(mode="w", delete=False) as out_handle, open(infile, "r") as in_handle:
for line in in_handle:
if fix_pat.match(line):
line = "#" + line
out_handle.write(line)
return out_handle.name
| """Make a BED file with track and browser lines ready for liftOver.
liftOver will fail with track or browser lines. We can make it happy
by converting these to comments. See:
https://lists.soe.ucsc.edu/pipermail/genome/2007-May/013561.html
"""
fix_pat = re.compile("^(track|browser)")
with ... | 26 | 860 | 112 | 972 | #!/usr/bin/env python
# Guruprasad Ananda
"""
Converts coordinates from one build/assembly to another using liftOver binary and mapping files downloaded from UCSC.
"""
import os
import re
import subprocess
import sys
import tempfile
from typing import Union
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()... | #!/usr/bin/env python
# Guruprasad Ananda
"""
Converts coordinates from one build/assembly to another using liftOver binary and mapping files downloaded from UCSC.
"""
import os
import re
import subprocess
import sys
import tempfile
from typing import Union
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()... | |
46,627 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/axt_to_concat_fasta.py | 22,23 | 1,50 | main | 23,42 | 23,42 | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_concat_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s... | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_concat_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s... | # check the command line
species1 = sys.argv[1]
species2 = sys.argv[2]
# convert the alignment blocks
reader = bx.align.axt.Reader(sys.stdin, support_ids=True, species1=species1, species2=species2)
sp1text = []
sp2text = []
for a in reader:
sp1text.append(a.components[0].text)
... | # check the command line
species1 = sys.argv[1]
species2 = sys.argv[2]
# convert the alignment blocks
reader = bx.align.axt.Reader(sys.stdin, support_ids=True, species1=species1, species2=species2)
sp1text = []
sp2text = []
for a in reader:
sp1text.append(a.components[0].text)
... | 54 | 201 | 235 | 436 | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_concat_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s... | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_concat_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s... | |
46,628 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/axt_to_fasta.py | 22,23 | 1,52 | main | 23,42 | 23,42 | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s\n%s" %... | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s\n%s" %... | # check the command line
species1 = sys.argv[1]
species2 = sys.argv[2]
# convert the alignment blocks
reader = bx.align.axt.Reader(sys.stdin, support_ids=True, species1=species1, species2=species2)
for a in reader:
if "id" in a.attributes:
id = a.attributes["id"]
e... | # check the command line
species1 = sys.argv[1]
species2 = sys.argv[2]
# convert the alignment blocks
reader = bx.align.axt.Reader(sys.stdin, support_ids=True, species1=species1, species2=species2)
for a in reader:
if "id" in a.attributes:
id = a.attributes["id"]
e... | 52 | 243 | 198 | 441 | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s\n%s" %... | #!/usr/bin/env python
"""
Adapted from bx/scripts/axt_to_fasta.py
"""
from __future__ import print_function
import sys
import bx.align.axt
def usage(s=None):
message = """
axt_to_fasta species1 species2 < axt_file > fasta_file
"""
if s is None:
sys.exit(message)
else:
sys.exit("%s\n%s" %... | |
46,629 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/axt_to_lav.py | 20,21 | 1,188 | usage | 21,46 | 21,46 | #!/usr/bin/env python
"""
Application to convert AXT file to LAV file
-------------------------------------------
:Author: Bob Harris (rsharris@bx.psu.edu)
:Version: $Revision: $
The application reads an AXT file from standard input and writes a LAV file to
standard out; some statistics are written to standard error... | #!/usr/bin/env python
"""
Application to convert AXT file to LAV file
-------------------------------------------
:Author: Bob Harris (rsharris@bx.psu.edu)
:Version: $Revision: $
The application reads an AXT file from standard input and writes a LAV file to
standard out; some statistics are written to standard error... | message = """
axt_to_lav primary_spec secondary_spec [--silent] < axt_file > lav_file
Each spec is of the form seq_file[:species_name]:lengths_file.
seq_file should be a format string for the file names for the individual
sequences, with %s to be replaced by the alignment's src field. For example,
"hg18/%... | message = """
axt_to_lav primary_spec secondary_spec [--silent] < axt_file > lav_file
Each spec is of the form seq_file[:species_name]:lengths_file.
seq_file should be a format string for the file names for the individual
sequences, with %s to be replaced by the alignment's src field. For example,
"hg18/%... | 125 | 1,444 | 323 | 1,767 | #!/usr/bin/env python
"""
Application to convert AXT file to LAV file
-------------------------------------------
:Author: Bob Harris (rsharris@bx.psu.edu)
:Version: $Revision: $
The application reads an AXT file from standard input and writes a LAV file to
standard out; some statistics are written to standard error... | #!/usr/bin/env python
"""
Application to convert AXT file to LAV file
-------------------------------------------
:Author: Bob Harris (rsharris@bx.psu.edu)
:Version: $Revision: $
The application reads an AXT file from standard input and writes a LAV file to
standard out; some statistics are written to standard error... | |
46,630 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/axt_to_lav_code.py | 1,2 | 1,6 | exec_after_process | 2,6 | 2,6 | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | data = out_data["seq_file2"]
data.dbkey = param_dict["dbkey_2"]
app.model.context.add(data)
app.model.context.flush()
| data = out_data["seq_file2"]
data.dbkey = param_dict["dbkey_2"]
app.model.context.add(data)
app.model.context.flush()
| 8 | 41 | 55 | 96 | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | |
46,631 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/catWrapper.py | 13,14 | 1,33 | main | 14,31 | 14,31 | #!/usr/bin/env python
# By Guruprasad Ananda.
import os
import shutil
import sys
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# By Guruprasad Ananda.
import os
import shutil
import sys
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| outfile = sys.argv[1]
infile = sys.argv[2]
if len(sys.argv) < 4:
shutil.copyfile(infile, outfile)
sys.exit()
cmdline = "cat %s " % (infile)
for inp in sys.argv[3:]:
cmdline = cmdline + inp + " "
cmdline = cmdline + ">" + outfile
try:
os.system(cmdline)
e... | outfile = sys.argv[1]
infile = sys.argv[2]
if len(sys.argv) < 4:
shutil.copyfile(infile, outfile)
sys.exit()
cmdline = "cat %s " % (infile)
for inp in sys.argv[3:]:
cmdline = cmdline + inp + " "
cmdline = cmdline + ">" + outfile
try:
os.system(cmdline)
e... | 47 | 87 | 163 | 250 | #!/usr/bin/env python
# By Guruprasad Ananda.
import os
import shutil
import sys
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# By Guruprasad Ananda.
import os
import shutil
import sys
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| |
46,632 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/gff/extract_GFF_Features.py | 20,21 | 1,55 | main | 21,53 | 21,53 | #!/usr/bin/env python
# Guruprasad Ananda
"""
Extract features from GFF file.
usage: %prog input1 out_file1 column features
"""
from __future__ import print_function
import sys
from bx.cookbook import doc_optparse
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ =... | #!/usr/bin/env python
# Guruprasad Ananda
"""
Extract features from GFF file.
usage: %prog input1 out_file1 column features
"""
from __future__ import print_function
import sys
from bx.cookbook import doc_optparse
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ =... | # Parsing Command Line here
options, args = doc_optparse.parse(__doc__)
try:
inp_file, out_file, column, features = args
except ValueError:
stop_err("One or more arguments is missing or invalid.\nUsage: prog input output column features")
try:
column = int(column)
except... | # Parsing Command Line here
options, args = doc_optparse.parse(__doc__)
try:
inp_file, out_file, column, features = args
except ValueError:
stop_err("One or more arguments is missing or invalid.\nUsage: prog input output column features")
try:
column = int(column)
except... | 111 | 129 | 328 | 457 | #!/usr/bin/env python
# Guruprasad Ananda
"""
Extract features from GFF file.
usage: %prog input1 out_file1 column features
"""
from __future__ import print_function
import sys
from bx.cookbook import doc_optparse
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ =... | #!/usr/bin/env python
# Guruprasad Ananda
"""
Extract features from GFF file.
usage: %prog input1 out_file1 column features
"""
from __future__ import print_function
import sys
from bx.cookbook import doc_optparse
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ =... | |
46,634 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/gff/gtf_filter_by_attribute_values_list.py | 12,13 | 1,74 | parse_gff_attributes | 23,49 | 13,49 | #
# Filters a GFF file using a list of attribute values. Attribute values must
# be in the first column of the file; subsequent columns are ignored.
# Usage:
# python gff_filter_by_attribute_values.py <gff_file> <attribute_name> <ids_file> <output_file>
#
from __future__ import print_function
import sys
def parse_gf... | #
# Filters a GFF file using a list of attribute values. Attribute values must
# be in the first column of the file; subsequent columns are ignored.
# Usage:
# python gff_filter_by_attribute_values.py <gff_file> <attribute_name> <ids_file> <output_file>
#
from __future__ import print_function
import sys
def parse_gf... | attributes_list = attr_str.split(";")
attributes = {}
for name_value_pair in attributes_list:
# Try splitting by space and, if necessary, by '=' sign.
pair = name_value_pair.strip().split(" ")
if len(pair) == 1:
pair = name_value_pair.strip().split("=")
if len(pai... | """
Parses a GFF/GTF attribute string and returns a dictionary of name-value
pairs. The general format for a GFF3 attributes string is
name1=value1;name2=value2
The general format for a GTF attribute string is
name1 "value1" ; name2 "value2"
The general format for a GFF attribute str... | 106 | 585 | 262 | 847 | #
# Filters a GFF file using a list of attribute values. Attribute values must
# be in the first column of the file; subsequent columns are ignored.
# Usage:
# python gff_filter_by_attribute_values.py <gff_file> <attribute_name> <ids_file> <output_file>
#
from __future__ import print_function
import sys
def parse_gf... | #
# Filters a GFF file using a list of attribute values. Attribute values must
# be in the first column of the file; subsequent columns are ignored.
# Usage:
# python gff_filter_by_attribute_values.py <gff_file> <attribute_name> <ids_file> <output_file>
#
from __future__ import print_function
import sys
def parse_gf... | |
46,635 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/grep.py | 39,40 | 1,143 | main | 40,141 | 40,141 | # Filename: grep.py
# Author: Ian N. Schenck
# Version: 8/23/2005
#
# This script accepts regular expressions, as well as an "invert"
# option, and applies the regular expression using grep. This wrapper
# provides security and pipeline.
#
# Grep is launched based on these inputs:
# -i Input file
# -o Output file
# -p... | # Filename: grep.py
# Author: Ian N. Schenck
# Version: 8/23/2005
#
# This script accepts regular expressions, as well as an "invert"
# option, and applies the regular expression using grep. This wrapper
# provides security and pipeline.
#
# Grep is launched based on these inputs:
# -i Input file
# -o Output file
# -p... | args = sys.argv[1:]
try:
opts = getopts(args)
except IndexError:
print("Usage:")
print(" -i Input file")
print(" -o Output file")
print(" -pattern RegEx pattern")
print(" -v true or false (Invert match)")
return 0
outputfile = opts.get("-o")
... | args = sys.argv[1:]
try:
opts = getopts(args)
except IndexError:
print("Usage:")
print(" -i Input file")
print(" -o Output file")
print(" -pattern RegEx pattern")
print(" -v true or false (Invert match)")
return 0
outputfile = opts.get("-o")
... | 346 | 295 | 1,001 | 1,296 | # Filename: grep.py
# Author: Ian N. Schenck
# Version: 8/23/2005
#
# This script accepts regular expressions, as well as an "invert"
# option, and applies the regular expression using grep. This wrapper
# provides security and pipeline.
#
# Grep is launched based on these inputs:
# -i Input file
# -o Output file
# -p... | # Filename: grep.py
# Author: Ian N. Schenck
# Version: 8/23/2005
#
# This script accepts regular expressions, as well as an "invert"
# option, and applies the regular expression using grep. This wrapper
# provides security and pipeline.
#
# Grep is launched based on these inputs:
# -i Input file
# -o Output file
# -p... | |
46,636 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/joinWrapper.py | 17,18 | 1,94 | main | 18,92 | 18,92 | #!/usr/bin/env python
# Guruprasad Ananda
"""
This tool provides the UNIX "join" functionality.
"""
import os
import subprocess
import sys
import tempfile
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# Guruprasad Ananda
"""
This tool provides the UNIX "join" functionality.
"""
import os
import subprocess
import sys
import tempfile
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| infile1 = sys.argv[1]
infile2 = sys.argv[2]
field1 = int(sys.argv[3])
field2 = int(sys.argv[4])
mode = sys.argv[5]
outfile = sys.argv[6]
tmpfile1 = tempfile.NamedTemporaryFile()
tmpfile2 = tempfile.NamedTemporaryFile()
try:
# Sort the two files based on specified fields
... | infile1 = sys.argv[1]
infile2 = sys.argv[2]
field1 = int(sys.argv[3])
field2 = int(sys.argv[4])
mode = sys.argv[5]
outfile = sys.argv[6]
tmpfile1 = tempfile.NamedTemporaryFile()
tmpfile2 = tempfile.NamedTemporaryFile()
try:
# Sort the two files based on specified fields
... | 299 | 105 | 876 | 981 | #!/usr/bin/env python
# Guruprasad Ananda
"""
This tool provides the UNIX "join" functionality.
"""
import os
import subprocess
import sys
import tempfile
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# Guruprasad Ananda
"""
This tool provides the UNIX "join" functionality.
"""
import os
import subprocess
import sys
import tempfile
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| |
46,637 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/lav_to_bed.py | 15,16 | 1,56 | main | 16,54 | 16,54 | #!/usr/bin/env python
# Reads a LAV file and writes two BED files.
from __future__ import print_function
import sys
import bx.align.lav
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# Reads a LAV file and writes two BED files.
from __future__ import print_function
import sys
import bx.align.lav
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| try:
lav_file = open(sys.argv[1])
bed_file1 = open(sys.argv[2], "w")
bed_file2 = open(sys.argv[3], "w")
except Exception as e:
stop_err(str(e))
lavsRead = 0
bedsWritten = 0
species = {}
# TODO: this is really bad since everything is read into memory. Can we elim... | try:
lav_file = open(sys.argv[1])
bed_file1 = open(sys.argv[2], "w")
bed_file2 = open(sys.argv[3], "w")
except Exception as e:
stop_err(str(e))
lavsRead = 0
bedsWritten = 0
species = {}
# TODO: this is really bad since everything is read into memory. Can we elim... | 124 | 103 | 456 | 559 | #!/usr/bin/env python
# Reads a LAV file and writes two BED files.
from __future__ import print_function
import sys
import bx.align.lav
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# Reads a LAV file and writes two BED files.
from __future__ import print_function
import sys
import bx.align.lav
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| |
46,638 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/lav_to_bed_code.py | 2,3 | 1,20 | exec_after_process | 3,20 | 3,20 | # Set build, name, and info for each output BED file
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | # Set build, name, and info for each output BED file
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | new_stdout = ""
filename_to_build = {}
for line in stdout.split("\n"):
if line.startswith("#FILE"):
fields = line.split("\t")
filename_to_build[fields[1]] = fields[2].strip()
else:
new_stdout = "%s%s" % (new_stdout, line)
for data in out_data.values():... | new_stdout = ""
filename_to_build = {}
for line in stdout.split("\n"):
if line.startswith("#FILE"):
fields = line.split("\t")
filename_to_build[fields[1]] = fields[2].strip()
else:
new_stdout = "%s%s" % (new_stdout, line)
for data in out_data.values():... | 51 | 56 | 226 | 282 | # Set build, name, and info for each output BED file
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | # Set build, name, and info for each output BED file
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | |
46,639 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/random_lines_two_pass.py | 20,21 | 1,140 | sample | 22,65 | 21,65 | #!/usr/bin/env python
# Dan Blankenberg
# Selects N random lines from a file and outputs to another file, maintaining original line order
# allows specifying a seed
# does two passes to determine line offsets/count, and then to output contents
from __future__ import print_function
import optparse
import random
from ma... | #!/usr/bin/env python
# Dan Blankenberg
# Selects N random lines from a file and outputs to another file, maintaining original line order
# allows specifying a seed
# does two passes to determine line offsets/count, and then to output contents
from __future__ import print_function
import optparse
import random
from ma... |
# Sampling without replacement entails tracking either potential
# selections (the pool) in a list or previous selections in a set.
# When the number of selections is small compared to the
# population, then tracking selections is efficient, requiring
# only a small set and an occasional reselecti... | """Copied straight from python 2.7."""
# Sampling without replacement entails tracking either potential
# selections (the pool) in a list or previous selections in a set.
# When the number of selections is small compared to the
# population, then tracking selections is efficient, requiring
# o... | 245 | 922 | 532 | 1,454 | #!/usr/bin/env python
# Dan Blankenberg
# Selects N random lines from a file and outputs to another file, maintaining original line order
# allows specifying a seed
# does two passes to determine line offsets/count, and then to output contents
from __future__ import print_function
import optparse
import random
from ma... | #!/usr/bin/env python
# Dan Blankenberg
# Selects N random lines from a file and outputs to another file, maintaining original line order
# allows specifying a seed
# does two passes to determine line offsets/count, and then to output contents
from __future__ import print_function
import optparse
import random
from ma... | |
46,640 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/randomlines.py | 9,10 | 1,37 | main | 10,35 | 10,35 | #!/usr/bin/env python
# Kanwei Li, 2010
# Selects N random lines from a file and outputs to another file
import random
import sys
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# Kanwei Li, 2010
# Selects N random lines from a file and outputs to another file
import random
import sys
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| infile = open(sys.argv[1])
total_lines = int(sys.argv[2])
if total_lines < 1:
sys.stderr.write("Must select at least one line.")
sys.exit()
kept = []
n = 0
for line in infile:
line = line.rstrip("\n")
n += 1
if n <= total_lines:
kept.append(l... | infile = open(sys.argv[1])
total_lines = int(sys.argv[2])
if total_lines < 1:
sys.stderr.write("Must select at least one line.")
sys.exit()
kept = []
n = 0
for line in infile:
line = line.rstrip("\n")
n += 1
if n <= total_lines:
kept.append(l... | 67 | 74 | 248 | 322 | #!/usr/bin/env python
# Kanwei Li, 2010
# Selects N random lines from a file and outputs to another file
import random
import sys
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
# Kanwei Li, 2010
# Selects N random lines from a file and outputs to another file
import random
import sys
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| |
46,642 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/sorter.py | 17,18 | 1,72 | main | 18,70 | 18,70 | """
Sorts tabular data on one or more columns. All comments of the file are collected
and placed at the beginning of the sorted output file.
"""
# 03/05/2013 guerler
import argparse
import subprocess
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
m... | """
Sorts tabular data on one or more columns. All comments of the file are collected
and placed at the beginning of the sorted output file.
"""
# 03/05/2013 guerler
import argparse
import subprocess
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
m... | # define options
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("-i", "--input", type=argparse.FileType("r"), help="Tabular file to be sorted")
parser.add_argument("-o", "--output", type=argparse.FileType("w"), help="Sorted output file")
parser.add_argument("-k", "--key", ... | # define options
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("-i", "--input", type=argparse.FileType("r"), help="Tabular file to be sorted")
parser.add_argument("-o", "--output", type=argparse.FileType("w"), help="Sorted output file")
parser.add_argument("-k", "--key", ... | 176 | 115 | 737 | 852 | """
Sorts tabular data on one or more columns. All comments of the file are collected
and placed at the beginning of the sorted output file.
"""
# 03/05/2013 guerler
import argparse
import subprocess
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
m... | """
Sorts tabular data on one or more columns. All comments of the file are collected
and placed at the beginning of the sorted output file.
"""
# 03/05/2013 guerler
import argparse
import subprocess
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
m... | |
46,643 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/trimmer.py | 12,13 | 1,92 | main | 13,90 | 13,90 | #!/usr/bin/env python
from __future__ import print_function
import optparse
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
from __future__ import print_function
import optparse
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| usage = """%prog [options]
options (listed below) default to 'None' if omitted
"""
parser = optparse.OptionParser(usage=usage)
parser.add_option(
"-a",
"--ascii",
action="store_true",
default=False,
help="Use ascii codes to defined ignored beginnings instead of ... | usage = """%prog [options]
options (listed below) default to 'None' if omitted
"""
parser = optparse.OptionParser(usage=usage)
parser.add_option(
"-a",
"--ascii",
action="store_true",
default=False,
help="Use ascii codes to defined ignored beginnings instead of ... | 263 | 74 | 877 | 951 | #!/usr/bin/env python
from __future__ import print_function
import optparse
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| #!/usr/bin/env python
from __future__ import print_function
import optparse
import sys
def stop_err(msg):
sys.exit(msg)
def main():
FILL_FUNC_BODYif __name__ == "__main__":
main()
| |
46,644 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/ucsc_gene_bed_to_exon_bed.py | 24,25 | 1,137 | main | 25,130 | 25,130 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | parser = optparse.OptionParser(usage="%prog [options] ")
parser.add_option(
"-r",
"--region",
dest="region",
default="transcribed",
help="Limit to region: one of coding, utr3, utr5, transcribed [default]",
)
parser.add_option(
"-e", "--exons", action="stor... | parser = optparse.OptionParser(usage="%prog [options] ")
parser.add_option(
"-r",
"--region",
dest="region",
default="transcribed",
help="Limit to region: one of coding, utr3, utr5, transcribed [default]",
)
parser.add_option(
"-e", "--exons", action="stor... | 401 | 289 | 1,377 | 1,666 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | |
46,645 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/ucsc_gene_bed_to_intron_bed.py | 24,25 | 1,83 | main | 25,76 | 25,76 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | parser = optparse.OptionParser(usage="%prog [options] ")
parser.add_option("-s", "--strand", action="store_true", dest="strand", help="Print strand after interval")
parser.add_option("-i", "--input", dest="input", default=None, help="Input file")
parser.add_option("-o", "--output", dest="output", defaul... | parser = optparse.OptionParser(usage="%prog [options] ")
parser.add_option("-s", "--strand", action="store_true", dest="strand", help="Print strand after interval")
parser.add_option("-i", "--input", dest="input", default=None, help="Input file")
parser.add_option("-o", "--output", dest="output", defaul... | 163 | 283 | 637 | 920 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | |
46,646 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/ucsc_gene_table_to_intervals.py | 24,25 | 1,121 | main | 25,114 | 25,114 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | parser = optparse.OptionParser(usage="%prog [options] ")
parser.add_option(
"-r",
"--region",
dest="region",
default="transcribed",
help="Limit to region: one of coding, utr3, utr5, transcribed [default]",
)
parser.add_option(
"-e", "--exons", action="stor... | parser = optparse.OptionParser(usage="%prog [options] ")
parser.add_option(
"-r",
"--region",
dest="region",
default="transcribed",
help="Limit to region: one of coding, utr3, utr5, transcribed [default]",
)
parser.add_option(
"-e", "--exons", action="stor... | 304 | 283 | 1,110 | 1,393 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options]
options:
-h, --help show this help message and exit
-rREGION, --region=REGION
... | |
46,647 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/filters/uniq.py | 37,38 | 1,142 | main | 38,140 | 38,140 | # Filename: uniq.py
# Author: Ian N. Schenck
# Version: 19/12/2005
#
# This script accepts an input file, an output file, a column
# delimiter, and a list of columns. The script then grabs unique
# lines based on the columns, and returns those records with a count
# of occurences of each unique column (ignoring traili... | # Filename: uniq.py
# Author: Ian N. Schenck
# Version: 19/12/2005
#
# This script accepts an input file, an output file, a column
# delimiter, and a list of columns. The script then grabs unique
# lines based on the columns, and returns those records with a count
# of occurences of each unique column (ignoring traili... | args = sys.argv[1:]
try:
opts = getopts(args)
except IndexError:
print("Usage:")
print(" -i Input file")
print(" -o Output file")
print(" -c Column list (comma seperated)")
print(" -d Delimiter:")
print(" ... | args = sys.argv[1:]
try:
opts = getopts(args)
except IndexError:
print("Usage:")
print(" -i Input file")
print(" -o Output file")
print(" -c Column list (comma seperated)")
print(" -d Delimiter:")
print(" ... | 436 | 316 | 1,132 | 1,448 | # Filename: uniq.py
# Author: Ian N. Schenck
# Version: 19/12/2005
#
# This script accepts an input file, an output file, a column
# delimiter, and a list of columns. The script then grabs unique
# lines based on the columns, and returns those records with a count
# of occurences of each unique column (ignoring traili... | # Filename: uniq.py
# Author: Ian N. Schenck
# Version: 19/12/2005
#
# This script accepts an input file, an output file, a column
# delimiter, and a list of columns. The script then grabs unique
# lines based on the columns, and returns those records with a count
# of occurences of each unique column (ignoring traili... | |
46,648 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/maf/maf_thread_for_species.py | 20,21 | 1,56 | main | 21,54 | 21,54 | #!/usr/bin/env python
"""
Read a maf file and write out a new maf with only blocks having all of
the passed in species, after dropping any other species and removing columns
containing only gaps. This will attempt to fuse together any blocks
which are adjacent after the unwanted species have been dropped.
usage: %prog... | #!/usr/bin/env python
"""
Read a maf file and write out a new maf with only blocks having all of
the passed in species, after dropping any other species and removing columns
containing only gaps. This will attempt to fuse together any blocks
which are adjacent after the unwanted species have been dropped.
usage: %prog... | input_file = sys.argv.pop(1)
output_file = sys.argv.pop(1)
species = sys.argv.pop(1).split(",")
try:
maf_reader = bx.align.maf.Reader(open(input_file))
except Exception:
print("Unable to open source MAF file", file=sys.stderr)
sys.exit()
try:
maf_writer = FusingA... | input_file = sys.argv.pop(1)
output_file = sys.argv.pop(1)
species = sys.argv.pop(1).split(",")
try:
maf_reader = bx.align.maf.Reader(open(input_file))
except Exception:
print("Unable to open source MAF file", file=sys.stderr)
sys.exit()
try:
maf_writer = FusingA... | 86 | 190 | 384 | 574 | #!/usr/bin/env python
"""
Read a maf file and write out a new maf with only blocks having all of
the passed in species, after dropping any other species and removing columns
containing only gaps. This will attempt to fuse together any blocks
which are adjacent after the unwanted species have been dropped.
usage: %prog... | #!/usr/bin/env python
"""
Read a maf file and write out a new maf with only blocks having all of
the passed in species, after dropping any other species and removing columns
containing only gaps. This will attempt to fuse together any blocks
which are adjacent after the unwanted species have been dropped.
usage: %prog... | |
46,649 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/maf/maf_to_bed_code.py | 1,2 | 1,20 | exec_after_process | 2,20 | 2,20 | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | output_data = next(iter(out_data.values()))
new_stdout = ""
split_stdout = stdout.split("\n")
for line in split_stdout:
if line.startswith("#FILE1"):
fields = line.split("\t")
dbkey = fields[1]
output_data.dbkey = dbkey
output_data.name = "%s (%s)"... | output_data = next(iter(out_data.values()))
new_stdout = ""
split_stdout = stdout.split("\n")
for line in split_stdout:
if line.startswith("#FILE1"):
fields = line.split("\t")
dbkey = fields[1]
output_data.dbkey = dbkey
output_data.name = "%s (%s)"... | 52 | 41 | 244 | 285 | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
FILL_FUNC_BODY | |
46,651 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/meme/fimo_wrapper.py | 22,23 | 1,89 | main | 23,87 | 23,87 | #!/usr/bin/env python
# Dan Blankenberg
"""
Read text output from FIMO and create an interval file.
"""
import os
import shutil
import subprocess
import sys
import tempfile
from galaxy_utils.sequence.transform import DNA_reverse_complement
buffsize = 1048576
def stop_err(msg):
sys.stderr.write(msg)
sys.exit... | #!/usr/bin/env python
# Dan Blankenberg
"""
Read text output from FIMO and create an interval file.
"""
import os
import shutil
import subprocess
import sys
import tempfile
from galaxy_utils.sequence.transform import DNA_reverse_complement
buffsize = 1048576
def stop_err(msg):
sys.stderr.write(msg)
sys.exit... | assert len(sys.argv) == 8, "Wrong number of arguments"
sys.argv.pop(0)
fimo_cmd = sys.argv.pop(0)
html_path = sys.argv.pop(0)
html_out = sys.argv.pop(0)
interval_out = sys.argv.pop(0)
txt_out = sys.argv.pop(0)
xml_out = sys.argv.pop(0)
gff_out = sys.argv.pop(0)
# run fimo
tr... | assert len(sys.argv) == 8, "Wrong number of arguments"
sys.argv.pop(0)
fimo_cmd = sys.argv.pop(0)
html_path = sys.argv.pop(0)
html_out = sys.argv.pop(0)
interval_out = sys.argv.pop(0)
txt_out = sys.argv.pop(0)
xml_out = sys.argv.pop(0)
gff_out = sys.argv.pop(0)
# run fimo
tr... | 199 | 139 | 814 | 953 | #!/usr/bin/env python
# Dan Blankenberg
"""
Read text output from FIMO and create an interval file.
"""
import os
import shutil
import subprocess
import sys
import tempfile
from galaxy_utils.sequence.transform import DNA_reverse_complement
buffsize = 1048576
def stop_err(msg):
sys.stderr.write(msg)
sys.exit... | #!/usr/bin/env python
# Dan Blankenberg
"""
Read text output from FIMO and create an interval file.
"""
import os
import shutil
import subprocess
import sys
import tempfile
from galaxy_utils.sequence.transform import DNA_reverse_complement
buffsize = 1048576
def stop_err(msg):
sys.stderr.write(msg)
sys.exit... | |
46,652 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/metag_tools/shrimp_color_wrapper.py | 15,16 | 1,161 | stop_err | 16,20 | 16,20 | #!/usr/bin/env python
"""
SHRiMP wrapper : Color space
"""
import os
import os.path
import re
import sys
import tempfile
assert sys.version_info[:2] >= (2, 4)
def stop_err(msg):
FILL_FUNC_BODYdef __main__():
# SHRiMP path
shrimp = "rmapper-cs"
# I/O
input_target_file = sys.argv[1] # fasta
inpu... | #!/usr/bin/env python
"""
SHRiMP wrapper : Color space
"""
import os
import os.path
import re
import sys
import tempfile
assert sys.version_info[:2] >= (2, 4)
def stop_err(msg):
FILL_FUNC_BODYdef __main__():
# SHRiMP path
shrimp = "rmapper-cs"
# I/O
input_target_file = sys.argv[1] # fasta
inpu... | sys.stderr.write("%s\n" % msg)
sys.exit()
| sys.stderr.write("%s\n" % msg)
sys.exit()
| 4 | 1,535 | 28 | 1,563 | #!/usr/bin/env python
"""
SHRiMP wrapper : Color space
"""
import os
import os.path
import re
import sys
import tempfile
assert sys.version_info[:2] >= (2, 4)
def stop_err(msg):
FILL_FUNC_BODYdef __main__():
# SHRiMP path
shrimp = "rmapper-cs"
# I/O
input_target_file = sys.argv[1] # fasta
inpu... | #!/usr/bin/env python
"""
SHRiMP wrapper : Color space
"""
import os
import os.path
import re
import sys
import tempfile
assert sys.version_info[:2] >= (2, 4)
def stop_err(msg):
FILL_FUNC_BODYdef __main__():
# SHRiMP path
shrimp = "rmapper-cs"
# I/O
input_target_file = sys.argv[1] # fasta
inpu... | |
46,653 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/next_gen_conversion/fastq_conversions.py | 22,23 | 1,46 | stop_err | 23,27 | 23,27 | #!/usr/bin/env python
"""
Performs various conversions around Sanger FASTQ data
usage: %prog [options]
-c, --command=c: Command to run
-i, --input=i: Input file to be converted
-o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std
-s, --outputFastqsolexa=s: FASTQ Solexa converted outpu... | #!/usr/bin/env python
"""
Performs various conversions around Sanger FASTQ data
usage: %prog [options]
-c, --command=c: Command to run
-i, --input=i: Input file to be converted
-o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std
-s, --outputFastqsolexa=s: FASTQ Solexa converted outpu... | sys.stderr.write("%s\n" % msg)
sys.exit()
| sys.stderr.write("%s\n" % msg)
sys.exit()
| 4 | 397 | 28 | 425 | #!/usr/bin/env python
"""
Performs various conversions around Sanger FASTQ data
usage: %prog [options]
-c, --command=c: Command to run
-i, --input=i: Input file to be converted
-o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std
-s, --outputFastqsolexa=s: FASTQ Solexa converted outpu... | #!/usr/bin/env python
"""
Performs various conversions around Sanger FASTQ data
usage: %prog [options]
-c, --command=c: Command to run
-i, --input=i: Input file to be converted
-o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std
-s, --outputFastqsolexa=s: FASTQ Solexa converted outpu... | |
46,654 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/next_gen_conversion/fastq_gen_conv.py | 25,26 | 1,178 | all_bases_valid | 27,34 | 26,34 | """
Converts any type of FASTQ file to Sanger type and makes small adjustments if necessary.
usage: %prog [options]
-i, --input=i: Input FASTQ candidate file
-r, --origType=r: Original type
-a, --allOrNot=a: Whether or not to check all blocks
-b, --blocks=b: Number of blocks to check
-o, --output=o: Ou... | """
Converts any type of FASTQ file to Sanger type and makes small adjustments if necessary.
usage: %prog [options]
-i, --input=i: Input FASTQ candidate file
-r, --origType=r: Original type
-a, --allOrNot=a: Whether or not to check all blocks
-b, --blocks=b: Number of blocks to check
-o, --output=o: Ou... | valid_bases = ["a", "A", "c", "C", "g", "G", "t", "T", "N"]
for base in seq:
if base not in valid_bases:
return False
return True
| """Confirm that the sequence contains only bases"""
valid_bases = ["a", "A", "c", "C", "g", "G", "t", "T", "N"]
for base in seq:
if base not in valid_bases:
return False
return True
| 24 | 1,742 | 70 | 1,812 | """
Converts any type of FASTQ file to Sanger type and makes small adjustments if necessary.
usage: %prog [options]
-i, --input=i: Input FASTQ candidate file
-r, --origType=r: Original type
-a, --allOrNot=a: Whether or not to check all blocks
-b, --blocks=b: Number of blocks to check
-o, --output=o: Ou... | """
Converts any type of FASTQ file to Sanger type and makes small adjustments if necessary.
usage: %prog [options]
-i, --input=i: Input FASTQ candidate file
-r, --origType=r: Original type
-a, --allOrNot=a: Whether or not to check all blocks
-b, --blocks=b: Number of blocks to check
-o, --output=o: Ou... | |
46,655 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/next_gen_conversion/solid_to_fastq.py | 29,30 | 1,91 | replaceNeg1 | 30,38 | 30,38 | #!/usr/bin/env python
"""
Converts SOLiD data to Sanger FASTQ format.
usage: %prog [options]
-i, --input1=i: Forward reads file
-q, --input2=q: Forward qual file
-I, --input3=I: Reverse reads file
-Q, --input4=Q: Reverse qual file
-o, --output1=o: Forward output
-r, --output2=r: Reverse output
usag... | #!/usr/bin/env python
"""
Converts SOLiD data to Sanger FASTQ format.
usage: %prog [options]
-i, --input1=i: Forward reads file
-q, --input2=q: Forward qual file
-I, --input3=I: Reverse reads file
-Q, --input4=Q: Reverse qual file
-o, --output1=o: Forward output
-r, --output2=r: Reverse output
usag... | line = fin.readline()
while line.strip():
fout.write(line.replace("-1", "1"))
line = fin.readline()
fout.seek(0)
return fout
| line = fin.readline()
while line.strip():
fout.write(line.replace("-1", "1"))
line = fin.readline()
fout.seek(0)
return fout
| 13 | 903 | 66 | 969 | #!/usr/bin/env python
"""
Converts SOLiD data to Sanger FASTQ format.
usage: %prog [options]
-i, --input1=i: Forward reads file
-q, --input2=q: Forward qual file
-I, --input3=I: Reverse reads file
-Q, --input4=Q: Reverse qual file
-o, --output1=o: Forward output
-r, --output2=r: Reverse output
usag... | #!/usr/bin/env python
"""
Converts SOLiD data to Sanger FASTQ format.
usage: %prog [options]
-i, --input1=i: Forward reads file
-q, --input2=q: Forward qual file
-I, --input3=I: Reverse reads file
-Q, --input4=Q: Reverse qual file
-o, --output1=o: Forward output
-r, --output2=r: Reverse output
usag... | |
46,658 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/phenotype_association/senatag.py | 86,87 | 75,103 | add_node | graph | 87,89 | 87,89 | class graph(object):
def __init__(self):
self.nodes = {}
def __str__(self):
string = ""
for n1 in self.nodes.values():
n2s = [x.name for x in n1.edges]
string += "%s %s\n" % (n1.name, ",".join(n2s))
return string[:-1]
def add_node(self, n):
FILL_FUNC... | class graph(object):
def __init__(self):
self.nodes = {}
def __str__(self):
string = ""
for n1 in self.nodes.values():
n2s = [x.name for x in n1.edges]
string += "%s %s\n" % (n1.name, ",".join(n2s))
return string[:-1]
def add_node(self, n):
FILL_FUNC... | self.nodes[n.name] = n
| self.nodes[n.name] = n
| 3 | 262 | 15 | 277 | #!/usr/bin/env python
"""
This tool takes the following file pairs as input:
a) input_snp : A file with identifiers for SNPs (one on each line)
b) ldfile : A file where each line has the following
snp list
where "snp" is an identifier for one SNP and the "list" is a
... | #!/usr/bin/env python
"""
This tool takes the following file pairs as input:
a) input_snp : A file with identifiers for SNPs (one on each line)
b) ldfile : A file where each line has the following
snp list
where "snp" is an identifier for one SNP and the "list" is a
... |
46,659 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/phenotype_association/senatag.py | 55,56 | 46,75 | num_not_visited | node | 56,62 | 56,62 | @total_ordering
class node(object):
def __init__(self, name):
self.name = name
self.edges = []
self.visited = False
# return the number of nodes connected to this node, that have yet to be
# visited
def num_not_visited(self):
FILL_FUNC_BODY def __eq__(self, other):
re... | @total_ordering
class node(object):
def __init__(self, name):
self.name = name
self.edges = []
self.visited = False
# return the number of nodes connected to this node, that have yet to be
# visited
def num_not_visited(self):
FILL_FUNC_BODY def __eq__(self, other):
re... | num = 0
for n in self.edges:
if n.visited is False:
num += 1
return num
| num = 0
for n in self.edges:
if n.visited is False:
num += 1
return num
| 16 | 192 | 41 | 233 | #!/usr/bin/env python
"""
This tool takes the following file pairs as input:
a) input_snp : A file with identifiers for SNPs (one on each line)
b) ldfile : A file where each line has the following
snp list
where "snp" is an identifier for one SNP and the "list" is a
... | #!/usr/bin/env python
"""
This tool takes the following file pairs as input:
a) input_snp : A file with identifiers for SNPs (one on each line)
b) ldfile : A file where each line has the following
snp list
where "snp" is an identifier for one SNP and the "list" is a
... |
46,661 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/solid_tools/maq_cs_wrapper_code.py | 1,2 | 1,5 | exec_before_job | 2,5 | 2,5 | def exec_before_job(app, inp_data, out_data, param_dict, tool):
FILL_FUNC_BODY | def exec_before_job(app, inp_data, out_data, param_dict, tool):
FILL_FUNC_BODY | out_data["output1"].name = out_data["output1"].name + " [ ALIGNMENT INFO ]"
out_data["output2"].name = out_data["output2"].name + " [ PILEUP ]"
out_data["output3"].name = out_data["output3"].name + " [ CUSTOM TRACK ]"
| out_data["output1"].name = out_data["output1"].name + " [ ALIGNMENT INFO ]"
out_data["output2"].name = out_data["output2"].name + " [ PILEUP ]"
out_data["output3"].name = out_data["output3"].name + " [ CUSTOM TRACK ]"
| 26 | 35 | 87 | 122 | def exec_before_job(app, inp_data, out_data, param_dict, tool):
FILL_FUNC_BODY | def exec_before_job(app, inp_data, out_data, param_dict, tool):
FILL_FUNC_BODY | |
46,662 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/solid_tools/solid_qual_stats.py | 18,19 | 1,158 | unzip | 19,27 | 19,27 | #!/usr/bin/env python
# Guruprasad Ananda
from __future__ import print_function
import sys
import tempfile
import zipfile
QUAL_UPPER_BOUND = 41
QUAL_LOWER_BOUND = 1
def stop_err(msg):
sys.stderr.write("%s\n" % msg)
sys.exit()
def unzip(filename):
FILL_FUNC_BODYdef __main__():
infile_score_name = sys.a... | #!/usr/bin/env python
# Guruprasad Ananda
from __future__ import print_function
import sys
import tempfile
import zipfile
QUAL_UPPER_BOUND = 41
QUAL_LOWER_BOUND = 1
def stop_err(msg):
sys.stderr.write("%s\n" % msg)
sys.exit()
def unzip(filename):
FILL_FUNC_BODYdef __main__():
infile_score_name = sys.a... | zip_file = zipfile.ZipFile(filename, "r")
tmpfilename = tempfile.NamedTemporaryFile().name
for name in zip_file.namelist():
open(tmpfilename, "a").write(zip_file.read(name))
zip_file.close()
return tmpfilename
| zip_file = zipfile.ZipFile(filename, "r")
tmpfilename = tempfile.NamedTemporaryFile().name
for name in zip_file.namelist():
open(tmpfilename, "a").write(zip_file.read(name))
zip_file.close()
return tmpfilename
| 16 | 1,429 | 88 | 1,517 | #!/usr/bin/env python
# Guruprasad Ananda
from __future__ import print_function
import sys
import tempfile
import zipfile
QUAL_UPPER_BOUND = 41
QUAL_LOWER_BOUND = 1
def stop_err(msg):
sys.stderr.write("%s\n" % msg)
sys.exit()
def unzip(filename):
FILL_FUNC_BODYdef __main__():
infile_score_name = sys.a... | #!/usr/bin/env python
# Guruprasad Ananda
from __future__ import print_function
import sys
import tempfile
import zipfile
QUAL_UPPER_BOUND = 41
QUAL_LOWER_BOUND = 1
def stop_err(msg):
sys.stderr.write("%s\n" % msg)
sys.exit()
def unzip(filename):
FILL_FUNC_BODYdef __main__():
infile_score_name = sys.a... | |
46,667 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/tools/stats/gsummary.py | 32,33 | 1,196 | S3_METHODS | 33,93 | 33,93 | #!/usr/bin/env python
from __future__ import print_function
import re
import sys
import tempfile
try:
from rpy2.rpy_classic import (
BASIC_CONVERSION,
NO_CONVERSION,
r,
RException,
set_default_mode,
)
except ImportError:
# RPy isn't maintained, and doesn't work with... | #!/usr/bin/env python
from __future__ import print_function
import re
import sys
import tempfile
try:
from rpy2.rpy_classic import (
BASIC_CONVERSION,
NO_CONVERSION,
r,
RException,
set_default_mode,
)
except ImportError:
# RPy isn't maintained, and doesn't work with... | Group_Math = [
"abs",
"sign",
"sqrt",
"floor",
"ceiling",
"trunc",
"round",
"signif",
"exp",
"log",
"cos",
"sin",
"tan",
"acos",
"asin",
"atan",
"cosh",
"sinh",
"ta... | Group_Math = [
"abs",
"sign",
"sqrt",
"floor",
"ceiling",
"trunc",
"round",
"signif",
"exp",
"log",
"cos",
"sin",
"tan",
"acos",
"asin",
"atan",
"cosh",
"sinh",
"ta... | 69 | 1,443 | 397 | 1,840 | #!/usr/bin/env python
from __future__ import print_function
import re
import sys
import tempfile
try:
from rpy2.rpy_classic import (
BASIC_CONVERSION,
NO_CONVERSION,
r,
RException,
set_default_mode,
)
except ImportError:
# RPy isn't maintained, and doesn't work with... | #!/usr/bin/env python
from __future__ import print_function
import re
import sys
import tempfile
try:
from rpy2.rpy_classic import (
BASIC_CONVERSION,
NO_CONVERSION,
r,
RException,
set_default_mode,
)
except ImportError:
# RPy isn't maintained, and doesn't work with... | |
46,700 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/analysis/queries.py | 58,59 | 1,86 | add_nonprivate_experiments_for_merge_with_clobber | 64,86 | 59,86 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | earliest_creation_time = None
with db_utils.session_scope() as session:
for result in session.query(Experiment.time_created).filter(
Experiment.name.in_(experiment_names)):
experiment_creation_time = result[0]
if not earliest_creation_time:
earlie... | """Returns a new list containing experiment names preeceeded by a list of
nonprivate experiments in the order in which they were run, such that
these nonprivate experiments executed before. This is useful
if you want to combine reports from |experiment_names| and all nonprivate
experiments."""
e... | 49 | 771 | 278 | 1,049 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,701 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/analysis/rendering.py | 23,25 | 1,51 | render_report | 37,51 | 25,51 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
templates_dir = os.path.join(utils.ROOT_DIR, 'analysis', 'report_templates')
environment = jinja2.Environment(
undefined=jinja2.StrictUndefined,
loader=jinja2.FileSystemLoader(templates_dir),
)
template = environment.get_template(template)
config_path = 'input/config/experiment.yam... | """Renders report with |template| using data provided by the
|experiment_results| context.
Arguments:
template: filename of the report template. E.g., 'default.html'.
experiment_results: an ExperimentResults object.
in_progress: Whether the experiment is still in progress.
coverage_... | 23 | 324 | 176 | 500 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,705 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/analysis/test_experiment_results.py | 21,23 | 1,36 | test_linkify_fuzzer_names_in_ranking | 24,36 | 23,36 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | experiment_df = test_data_utils.create_experiment_data()
results = experiment_results.ExperimentResults(experiment_df,
coverage_dict=None,
output_directory=None,
... | """Tests turning fuzzer names into links."""
experiment_df = test_data_utils.create_experiment_data()
results = experiment_results.ExperimentResults(experiment_df,
coverage_dict=None,
output_directory=None,... | 22 | 255 | 163 | 418 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,706 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/analysis/test_plotting.py | 22,23 | 1,60 | test_pariwise_unique_coverage_heatmap_plot | 25,39 | 23,39 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | fuzzer_num = 22
fuzzers = [f'fuzzer-{i}' for i in range(fuzzer_num)]
table_data = [range(1000, 1000 + fuzzer_num)] * fuzzer_num
table_df = pd.DataFrame(table_data, index=fuzzers, columns=fuzzers)
plotter = plotting.Plotter(fuzzers)
image_path = tmp_path / 'out.png'
plotter.write_pairwise_u... | """Tests that pairwise unique coverage heatmap looks as expected (even with
a large number of fuzzers)."""
fuzzer_num = 22
fuzzers = [f'fuzzer-{i}' for i in range(fuzzer_num)]
table_data = [range(1000, 1000 + fuzzer_num)] * fuzzer_num
table_df = pd.DataFrame(table_data, index=fuzzers, columns=f... | 39 | 546 | 229 | 775 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,707 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/analysis/test_queries.py | 65,67 | 1,86 | test_get_experiment_data_fuzzer_stats | 68,86 | 67,86 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | experiment_name = 'experiment-1'
db_utils.add_all([
models.Experiment(name=experiment_name,
time_created=ARBITRARY_DATETIME,
private=False)
])
trial = models.Trial(fuzzer='afl',
experiment=experiment_name,
... | """Tests that get_experiment_data handles fuzzer_stats correctly."""
experiment_name = 'experiment-1'
db_utils.add_all([
models.Experiment(name=experiment_name,
time_created=ARBITRARY_DATETIME,
private=False)
])
trial = models.Trial(fuzzer=... | 36 | 760 | 259 | 1,019 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,708 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/analysis/test_stat_tests.py | 23,24 | 1,43 | test_a12_paper | 26,34 | 24,34 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
x_values = [1, 2, 2, 2, 2, 2, 2, 3, 3, 3]
y_values = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3]
result = stat_tests.a12(x_values, y_values)
assert result == pytest.approx(0.66, 0.0001)
| """Example distribution from the paper, page 106.
"""
x_values = [1, 2, 2, 2, 2, 2, 2, 3, 3, 3]
y_values = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3]
result = stat_tests.a12(x_values, y_values)
assert result == pytest.approx(0.66, 0.0001)
| 33 | 372 | 127 | 499 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,710 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/benchmarks/oss_fuzz_benchmark_integration.py | 70,71 | 58,78 | find_digest | BaseBuilderDockerRepo | 72,78 | 71,78 | class BaseBuilderDockerRepo:
"""Repo of base-builder images."""
def __init__(self):
self.timestamps = []
self.digests = []
def add_digest(self, timestamp, digest):
"""Add a digest."""
self.timestamps.append(timestamp)
self.digests.append(digest)
def find_digest... | class BaseBuilderDockerRepo:
"""Repo of base-builder images."""
def __init__(self):
self.timestamps = []
self.digests = []
def add_digest(self, timestamp, digest):
"""Add a digest."""
self.timestamps.append(timestamp)
self.digests.append(digest)
def find_digest... | index = bisect.bisect_right(self.timestamps, timestamp)
if index > 0:
return self.digests[index - 1]
raise ValueError('Failed to find suitable base-builder.')
| """Finds the latest image before the given timestamp."""
index = bisect.bisect_right(self.timestamps, timestamp)
if index > 0:
return self.digests[index - 1]
raise ValueError('Failed to find suitable base-builder.')
| 18 | 128 | 63 | 191 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,711 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/benchmarks/oss_fuzz_benchmark_integration.py | 46,47 | 40,58 | git | GitRepoManager | 55,58 | 47,58 | class GitRepoManager:
"""Git repo manager."""
def __init__(self, repo_dir):
self.repo_dir = repo_dir
def git(self, cmd):
FILL_FUNC_BODY | class GitRepoManager:
"""Git repo manager."""
def __init__(self, repo_dir):
self.repo_dir = repo_dir
def git(self, cmd):
"""Runs a git command.
Args:
cmd: The git command as a list to be run.
Returns:
new_process.ProcessResult
"""
FILL_FUNC_BOD... | return new_process.execute(['git'] + cmd, cwd=self.repo_dir)
| """Runs a git command.
Args:
cmd: The git command as a list to be run.
Returns:
new_process.ProcessResult
"""
return new_process.execute(['git'] + cmd, cwd=self.repo_dir)
| 5 | 104 | 28 | 132 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,712 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/benchmark_config.py | 32,34 | 1,40 | get_config | 35,40 | 34,40 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | config_file = get_config_file(benchmark)
if os.path.isfile(config_file):
return yaml_utils.read(config_file)
logger.warning('Benchmark config does not exist: %s.', config_file)
return {}
| """Returns a dictionary containing the config for a benchmark."""
config_file = get_config_file(benchmark)
if os.path.isfile(config_file):
return yaml_utils.read(config_file)
logger.warning('Benchmark config does not exist: %s.', config_file)
return {}
| 16 | 329 | 74 | 403 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,713 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/benchmark_utils.py | 144,145 | 1,166 | get_bug_benchmarks | 146,152 | 145,152 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | return [
benchmark for benchmark in get_all_benchmarks()
if get_type(benchmark) == BenchmarkType.BUG.value
]
| """Returns the list of standard bug benchmarks."""
return [
benchmark for benchmark in get_all_benchmarks()
if get_type(benchmark) == BenchmarkType.BUG.value
]
| 12 | 1,630 | 47 | 1,677 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,714 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/config_utils.py | 18,19 | 1,22 | validate_and_expand | 20,22 | 19,22 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | # TODO: move the logic from experiment/run_experiment.py to here.
return config
| """Validates |config| and returns the expanded configuration."""
# TODO: move the logic from experiment/run_experiment.py to here.
return config
| 11 | 207 | 26 | 233 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | |
46,715 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/conftest.py | 36,38 | 1,46 | oss_fuzz_benchmark | 40,46 | 38,46 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | benchmark_config_contents = yaml.dump(OSS_FUZZ_BENCHMARK_CONFIG)
benchmark_config_file = os.path.join(utils.ROOT_DIR, 'benchmarks',
OSS_FUZZ_BENCHMARK_NAME,
'benchmark.yaml')
fs.create_file(benchmark_config_file, contents=benc... | """Fixutre that makes an OSS-Fuzz benchmark with OSS_FUZZ_BENCHMARK_CONFIG
as its config."""
benchmark_config_contents = yaml.dump(OSS_FUZZ_BENCHMARK_CONFIG)
benchmark_config_file = os.path.join(utils.ROOT_DIR, 'benchmarks',
OSS_FUZZ_BENCHMARK_NAME,
... | 13 | 431 | 126 | 557 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,716 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/environment.py | 29,30 | 1,47 | get | 31,42 | 30,42 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | value_string = os.getenv(environment_variable)
# value_string will be None if the variable is not defined.
if value_string is None:
return default_value
# Evaluate the value of the environment variable with string fallback.
return _eval_value(value_string)
# TODO(metzman): Use get and se... | """Return the value of |environment_variable| in the environment"""
value_string = os.getenv(environment_variable)
# value_string will be None if the variable is not defined.
if value_string is None:
return default_value
# Evaluate the value of the environment variable with string fallback... | 43 | 357 | 115 | 472 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,717 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/experiment_path.py | 26,27 | 1,34 | filestore | 29,34 | 27,34 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | path_str = str(path_obj)
work_dir = experiment_utils.get_work_dir()
experiment_filestore_path = experiment_utils.get_experiment_filestore_path()
assert path_str.startswith(work_dir)
return path_str.replace(work_dir, experiment_filestore_path)
| """Returns a string with WORK_DIR replaced with |experiment_filestore_path|.
|path_obj| should be created by path()."""
path_str = str(path_obj)
work_dir = experiment_utils.get_work_dir()
experiment_filestore_path = experiment_utils.get_experiment_filestore_path()
assert path_str.startswith(work... | 14 | 322 | 94 | 416 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,718 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/experiment_utils.py | 137,138 | 1,176 | get_crash_metadata_filename | 139,142 | 138,142 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | return get_cycle_filename('crashes', cycle) + '.json'
| """Returns a crash metadata name given a cycle."""
return get_cycle_filename('crashes', cycle) + '.json'
| 5 | 1,802 | 23 | 1,825 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,719 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/filestore_utils.py | 84,92 | 1,106 | rsync | 94,103 | 92,103 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | return get_impl().rsync(source,
destination,
delete,
recursive,
gsutil_options,
options,
parallel=parallel)
| """Syncs |source| and |destination| folders. |gsutil_options| and |parallel|
are only used by the gsutil implementation."""
return get_impl().rsync(source,
destination,
delete,
recursive,
gsutil_o... | 8 | 1,054 | 54 | 1,108 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,720 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/filesystem.py | 63,64 | 1,124 | copy | 66,74 | 64,74 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | try:
# str for Python3.5
shutil.copy2(str(src), str(dst))
except FileNotFoundError as error:
if not ignore_errors:
raise error
| """Copy a file from |src| to |dst|. Ignore errors while copying if
|ignore_errors|."""
try:
# str for Python3.5
shutil.copy2(str(src), str(dst))
except FileNotFoundError as error:
if not ignore_errors:
raise error
| 16 | 1,311 | 61 | 1,372 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,721 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/fuzzer_config.py | 29,31 | 1,36 | get_config | 32,36 | 31,36 | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | config_file = get_config_file(fuzzer)
if os.path.exists(config_file):
return yaml_utils.read(config_file)
return {}
| """Returns a dictionary containing the config for a fuzzer."""
config_file = get_config_file(fuzzer)
if os.path.exists(config_file):
return yaml_utils.read(config_file)
return {}
| 9 | 324 | 51 | 375 | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,722 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/fuzzer_stats.py | 21,22 | 1,39 | validate_fuzzer_stats | 24,39 | 22,39 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | stats = json.loads(stats_json_str)
if not isinstance(stats, dict):
raise ValueError(f'{stats} is not a dict.')
for key, value in stats.items():
if key not in SCHEMA:
raise ValueError(f'Key {key} is not a valid stat key.')
expected_type = SCHEMA[key]
if isinstanc... | """Validate that |stats_json_str| is a json representation of valid fuzzer
stats. Raises an exception if it is not, otherwise returns successfully."""
stats = json.loads(stats_json_str)
if not isinstance(stats, dict):
raise ValueError(f'{stats} is not a dict.')
for key, value in stats.item... | 55 | 253 | 178 | 431 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,723 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/fuzzer_utils.py | 102,103 | 1,149 | validate_name | 104,115 | 103,115 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Although importing probably allows a subset of what the regex allows, use
# the regex anyway to be safe. The regex is enforcing that the fuzzer is a
# valid path for GCS or a linux system.
if VALID_FUZZER_REGEX.match(fuzzer) is None:
logs.error('Fuzzer: %s does not conform to pattern: %s.', fu... | """Return True if |fuzzer| is a valid fuzzbench fuzzer name."""
# Although importing probably allows a subset of what the regex allows, use
# the regex anyway to be safe. The regex is enforcing that the fuzzer is a
# valid path for GCS or a linux system.
if VALID_FUZZER_REGEX.match(fuzzer) is None:
... | 56 | 1,418 | 139 | 1,557 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,724 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/fuzzer_utils.py | 53,55 | 35,72 | runner_dockerfile | FuzzerDirectory | 57,59 | 55,59 | class FuzzerDirectory:
"""Class representing a fuzzer directory in fuzzers/."""
def __init__(self, name):
# TOOD(metzman): Use this class to represent fuzzers in general.
# For example, replace the dict format we use for variants with this.
self.name = name
@property
def direct... | class FuzzerDirectory:
"""Class representing a fuzzer directory in fuzzers/."""
def __init__(self, name):
# TOOD(metzman): Use this class to represent fuzzers in general.
# For example, replace the dict format we use for variants with this.
self.name = name
@property
def direct... | return os.path.join(self.directory, 'runner.Dockerfile')
| """Returns the path to the runner.Dockerfile file in fuzzer
directory."""
return os.path.join(self.directory, 'runner.Dockerfile')
| 3 | 342 | 23 | 365 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,725 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/gce.py | 51,52 | 1,109 | get_preempted_instances | 53,59 | 52,59 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | for instance in _get_instance_items(project, zone):
if (instance['scheduling']['preemptible'] and
instance['status'] == 'TERMINATED'):
yield instance['name']
| """Return a list of preempted instance names in |project| and |zone|."""
for instance in _get_instance_items(project, zone):
if (instance['scheduling']['preemptible'] and
instance['status'] == 'TERMINATED'):
yield instance['name']
| 13 | 992 | 58 | 1,050 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,726 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/gcloud.py | 123,124 | 1,173 | set_default_project | 125,129 | 124,129 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | return new_process.execute(
['gcloud', 'config', 'set', 'project', cloud_project])
| """Set default project for future gcloud and gsutil commands."""
return new_process.execute(
['gcloud', 'config', 'set', 'project', cloud_project])
| 7 | 1,869 | 34 | 1,903 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,727 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/gsutil.py | 89,90 | 1,96 | cat | 91,96 | 90,96 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | command = ['cat', file_path]
# TODO(metzman): Consider replacing this technique with cp to temp file
# and a local `cat`. The problem with this technique is stderr output
# from gsutil can be included.
return gsutil_command(command, expect_zero=expect_zero)
| """Does gsutil cat on |file_path| and returns the result."""
command = ['cat', file_path]
# TODO(metzman): Consider replacing this technique with cp to temp file
# and a local `cat`. The problem with this technique is stderr output
# from gsutil can be included.
return gsutil_command(command, ex... | 37 | 1,029 | 83 | 1,112 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,728 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/local_filestore.py | 65,73 | 1,100 | rsync | 75,96 | 73,96 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Add check to behave like `gsutil.rsync`.
assert os.path.isdir(source), 'filestore_utils.rsync: source should be dir.'
# Create intermediate folders for `rsync` command to behave like
# `gsutil.rsync`.
filesystem.create_directory(destination)
command = ['rsync']
if delete:
command... | """Does local_filestore rsync from |source| to |destination| using useful
defaults that can be overriden."""
# Add check to behave like `gsutil.rsync`.
assert os.path.isdir(source), 'filestore_utils.rsync: source should be dir.'
# Create intermediate folders for `rsync` command to behave like
#... | 68 | 842 | 228 | 1,070 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,730 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/logs.py | 246,247 | 243,250 | filter | LengthFilter | 247,250 | 247,250 | class LengthFilter(logging.Filter):
"""Filter for truncating log messages that are too long for stackdriver."""
def filter(self, record):
FILL_FUNC_BODY | class LengthFilter(logging.Filter):
"""Filter for truncating log messages that are too long for stackdriver."""
def filter(self, record):
FILL_FUNC_BODY | if len(record.msg) > LOG_LENGTH_LIMIT:
record.msg = ('TRUNCATED: ' + record.msg)[:LOG_LENGTH_LIMIT]
return True
| if len(record.msg) > LOG_LENGTH_LIMIT:
record.msg = ('TRUNCATED: ' + record.msg)[:LOG_LENGTH_LIMIT]
return True
| 12 | 47 | 52 | 99 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,731 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/logs.py | 141,142 | 108,150 | _log_function_wrapper | Logger | 144,150 | 142,150 | class Logger:
"""Wrapper around logging.Logger that allows it to be used like we use the
root logger for stackdriver."""
_LOGGER_NAME = 'fuzzbench'
def __init__(self, default_extras=None, log_level=logging.INFO):
if not utils.is_local():
_initialize_cloud_clients()
self... | class Logger:
"""Wrapper around logging.Logger that allows it to be used like we use the
root logger for stackdriver."""
_LOGGER_NAME = 'fuzzbench'
def __init__(self, default_extras=None, log_level=logging.INFO):
if not utils.is_local():
_initialize_cloud_clients()
self... | extras = {} if extras is None else extras
extras = extras.copy()
extras.update(self.default_extras)
log_function(message, *args, extras=extras, logger=self.logger)
| """Wrapper around log functions that passes extras and the logger this
object wraps (self.logger)."""
extras = {} if extras is None else extras
extras = extras.copy()
extras.update(self.default_extras)
log_function(message, *args, extras=extras, logger=self.logger)
| 17 | 450 | 69 | 519 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,732 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/new_process.py | 71,82 | 1,129 | execute | 83,129 | 82,129 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | if write_to_stdout:
# Don't set stdout, it's default value None, causes it to be set to
# stdout.
assert output_file is None
elif not output_file:
output_file = subprocess.PIPE
kwargs['stdout'] = output_file
kwargs['stderr'] = subprocess.STDOUT
if kill_children:
... | """Execute |command| and return the returncode and the output"""
if write_to_stdout:
# Don't set stdout, it's default value None, causes it to be set to
# stdout.
assert output_file is None
elif not output_file:
output_file = subprocess.PIPE
kwargs['stdout'] = output_fil... | 144 | 807 | 569 | 1,376 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,733 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/queue_utils.py | 22,23 | 1,34 | initialize_queue | 24,30 | 23,30 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | queue_name = experiment_utils.get_experiment_name()
redis_connection = redis.Redis(host=redis_host)
queue = rq.Queue(queue_name, connection=redis_connection)
return queue
| """Returns a redis-backed rq queue."""
queue_name = experiment_utils.get_experiment_name()
redis_connection = redis.Redis(host=redis_host)
queue = rq.Queue(queue_name, connection=redis_connection)
return queue
| 12 | 282 | 69 | 351 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,734 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/random_corpus_fuzzing_utils.py | 41,42 | 1,102 | prepare_benchmark_random_corpus | 43,102 | 42,102 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Temporary location to park corpus files before get picked randomly.
benchmark_unarchived_corpora = os.path.join(
experiment_utils.get_oss_fuzz_corpora_unarchived_path(), benchmark)
filesystem.create_directory(benchmark_unarchived_corpora)
# Unzip oss fuzz corpus.
corpus_archive_filename =... | """Prepare corpus for given benchmark."""
# Temporary location to park corpus files before get picked randomly.
benchmark_unarchived_corpora = os.path.join(
experiment_utils.get_oss_fuzz_corpora_unarchived_path(), benchmark)
filesystem.create_directory(benchmark_unarchived_corpora)
# Unzip ... | 185 | 435 | 856 | 1,291 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,735 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/retry.py | 32,39 | 1,111 | wrap | 40,111 | 39,111 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
assert delay > 0
assert backoff >= 1
assert retries >= 0
def decorator(func):
"""Decorator for the given function."""
tries = retries + 1
is_generator = inspect.isgeneratorfunction(func)
function_with_type = function
if is_generator:
function_with_ty... | """Retry decorator for a function."""
assert delay > 0
assert backoff >= 1
assert retries >= 0
def decorator(func):
"""Decorator for the given function."""
tries = retries + 1
is_generator = inspect.isgeneratorfunction(func)
function_with_type = function
if ... | 190 | 334 | 674 | 1,008 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,736 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/sanitizer.py | 54,55 | 1,73 | set_sanitizer_options | 56,73 | 55,73 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | sanitizer_options_filtered = dict(SANITIZER_OPTIONS)
additional_ubsan_options_filtered = dict(ADDITIONAL_UBSAN_OPTIONS)
if is_fuzz_run:
# This is needed for fuzzing speed, also a requirement for AFL.
sanitizer_options_filtered['symbolize'] = 0
sanitizer_options_filtered['abort_on_err... | """Sets sanitizer options in |env|."""
sanitizer_options_filtered = dict(SANITIZER_OPTIONS)
additional_ubsan_options_filtered = dict(ADDITIONAL_UBSAN_OPTIONS)
if is_fuzz_run:
# This is needed for fuzzing speed, also a requirement for AFL.
sanitizer_options_filtered['symbolize'] = 0
... | 41 | 659 | 248 | 907 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,737 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_benchmark_config.py | 34,35 | 1,38 | test_get_config | 36,38 | 35,38 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | assert benchmark_config.get_config(conftest.OSS_FUZZ_BENCHMARK_NAME) == (
conftest.OSS_FUZZ_BENCHMARK_CONFIG)
| """Test that we can get the configuration of a benchmark."""
assert benchmark_config.get_config(conftest.OSS_FUZZ_BENCHMARK_NAME) == (
conftest.OSS_FUZZ_BENCHMARK_CONFIG)
| 5 | 376 | 55 | 431 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,738 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_benchmark_utils.py | 69,74 | 1,84 | test_validate_type_valid | 75,80 | 74,80 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | with mock.patch('common.benchmark_utils.get_type',
return_value=benchmark_type):
assert benchmark_utils.validate_type('benchmark')
| """Tests that validate_type returns True for an valid type."""
with mock.patch('common.benchmark_utils.get_type',
return_value=benchmark_type):
assert benchmark_utils.validate_type('benchmark')
| 5 | 938 | 50 | 988 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,739 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_common_utils.py | 19,20 | 1,32 | test_get_retry_delay | 21,32 | 20,32 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | delay = 3
backoff = 2
first_try = 1
first_try_delay = utils.get_retry_delay(first_try, delay, backoff)
# Backoff should have no effect on first try
assert first_try_delay == delay
second_try = 2
second_try_delay = utils.get_retry_delay(second_try, delay, backoff)
assert second_try_... | """"Tests if get delay is working as expected"""
delay = 3
backoff = 2
first_try = 1
first_try_delay = utils.get_retry_delay(first_try, delay, backoff)
# Backoff should have no effect on first try
assert first_try_delay == delay
second_try = 2
second_try_delay = utils.get_retry_del... | 41 | 205 | 127 | 332 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,740 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_experiment_utils.py | 19,20 | 1,35 | test_get_dispatcher_instance_name | 21,25 | 20,25 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | assert experiment_utils.get_dispatcher_instance_name(
'experiment-a') == 'd-experiment-a'
| """Tests that get_dispatcher_instance_name returns the expected result."""
assert experiment_utils.get_dispatcher_instance_name(
'experiment-a') == 'd-experiment-a'
| 5 | 357 | 39 | 396 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,743 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_fuzzer_stats.py | 33,34 | 1,48 | test_validate_invalid_key_fuzzer_stats | 36,41 | 34,41 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | with pytest.raises(ValueError,
match='Key fake_key is not a valid stat key.'):
fuzzer_stats.validate_fuzzer_stats('{"fake_key": 20.2}')
| """Tests that validate_fuzzer_stats throws an exception when given a json
string with an invalid key."""
with pytest.raises(ValueError,
match='Key fake_key is not a valid stat key.'):
fuzzer_stats.validate_fuzzer_stats('{"fake_key": 20.2}')
| 12 | 547 | 64 | 611 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,744 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_fuzzer_utils.py | 67,69 | 1,71 | test_validate_name_valid | 70,71 | 69,71 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | assert fuzzer_utils.validate_name(fuzzer_name)
| """Tests that validate_name returns True for a valid fuzzer name."""
assert fuzzer_utils.validate_name(fuzzer_name)
| 2 | 920 | 20 | 940 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,745 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_gce.py | 73,75 | 1,90 | test_get_instance_group_size | 77,90 | 75,90 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | mock_managers = mock.Mock()
mocked_get_instance_group_managers.return_value = mock_managers
mock_req = mock.Mock()
mock_managers.get.return_value = mock_req
size = 1
mock_req.execute.return_value = {'targetSize': size}
result = gce.get_instance_group_size(INSTANCE_GROUP, PROJECT, ZONE)
a... | """Tests that get_instance_group_size uses the GCE API correctly and returns
the right value."""
mock_managers = mock.Mock()
mocked_get_instance_group_managers.return_value = mock_managers
mock_req = mock.Mock()
mock_managers.get.return_value = mock_req
size = 1
mock_req.execute.return_v... | 36 | 921 | 175 | 1,096 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,747 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_gsutil.py | 24,25 | 1,84 | test_gsutil_command | 26,32 | 25,32 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | arguments = ['hello']
with test_utils.mock_popen_ctx_mgr() as mocked_popen:
gsutil.gsutil_command(arguments)
assert mocked_popen.commands == [['gsutil'] + arguments]
| """Tests gsutil_command works as expected."""
arguments = ['hello']
with test_utils.mock_popen_ctx_mgr() as mocked_popen:
gsutil.gsutil_command(arguments)
assert mocked_popen.commands == [['gsutil'] + arguments]
| 14 | 968 | 72 | 1,040 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,748 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_gsutil.py | 73,76 | 42,84 | test_no_flag | TestGsutilRsync | 78,84 | 76,84 | class TestGsutilRsync:
"""Tests for gsutil_command works as expected."""
SRC = '/src'
DST = 'gs://dst'
def test_rsync(self):
"""Tests that rsync works as intended."""
with mock.patch(
'common.gsutil.gsutil_command') as mocked_gsutil_command:
gsutil.rsync(self... | class TestGsutilRsync:
"""Tests for gsutil_command works as expected."""
SRC = '/src'
DST = 'gs://dst'
def test_rsync(self):
"""Tests that rsync works as intended."""
with mock.patch(
'common.gsutil.gsutil_command') as mocked_gsutil_command:
gsutil.rsync(self... | kwargs_for_rsync = {}
kwargs_for_rsync[kwarg_for_rsync] = False
with mock.patch(
'common.gsutil.gsutil_command') as mocked_gsutil_command:
gsutil.rsync(self.SRC, self.DST, **kwargs_for_rsync)
assert flag not in mocked_gsutil_command.call_args_list[0][0][0]
| """Tests that rsync works as intended when caller specifies not
to use specific flags."""
kwargs_for_rsync = {}
kwargs_for_rsync[kwarg_for_rsync] = False
with mock.patch(
'common.gsutil.gsutil_command') as mocked_gsutil_command:
gsutil.rsync(self.SRC, ... | 19 | 495 | 121 | 616 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,749 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_local_filestore.py | 25,26 | 1,137 | test_rm | 27,35 | 26,35 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | file_path = tmp_path / 'file'
data = 'hello'
with open(file_path, 'w', encoding='utf-8') as file_handle:
file_handle.write(data)
local_filestore.rm(str(file_path))
assert not os.path.exists(file_path)
| """Tests rm works as expected."""
file_path = tmp_path / 'file'
data = 'hello'
with open(file_path, 'w', encoding='utf-8') as file_handle:
file_handle.write(data)
local_filestore.rm(str(file_path))
assert not os.path.exists(file_path)
| 19 | 1,506 | 94 | 1,600 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,750 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_new_process.py | 26,27 | 1,64 | test_end_process | 29,38 | 27,38 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | mock_popen = mock.Mock()
mock_popen.pid = 1
mock_popen.poll.return_value = None
mock_popen.terminate.return_value = None
mock_popen.kill.return_value = None
new_process._end_process(new_process.WrappedPopen(mock_popen), False)
mock_popen.kill.assert_called()
| """Tests that _end_process terminates the process and then tries to wait
before killing it."""
mock_popen = mock.Mock()
mock_popen.pid = 1
mock_popen.poll.return_value = None
mock_popen.terminate.return_value = None
mock_popen.kill.return_value = None
new_process._end_process(new_process... | 18 | 601 | 115 | 716 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,751 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/test_new_process.py | 43,44 | 38,64 | test_timeout | TestIntegrationExecute | 45,52 | 44,52 | class TestIntegrationExecute:
"""Integration tests for execute."""
COMMAND = ['python3', os.path.join(TEST_DATA_PATH, 'printer.py')]
def test_timeout(self):
FILL_FUNC_BODY @mock.patch('common.logs.info')
def test_output_file(self, mocked_info, tmp_path):
"""Test that execute handles the out... | class TestIntegrationExecute:
"""Integration tests for execute."""
COMMAND = ['python3', os.path.join(TEST_DATA_PATH, 'printer.py')]
def test_timeout(self):
"""Test that the timeout parameter works as intended."""
FILL_FUNC_BODY @mock.patch('common.logs.info')
def test_output_file(self, moc... | start_time = time.time()
result = new_process.execute(self.COMMAND, timeout=.1)
end_time = time.time()
assert end_time - start_time < 5
# Give it a lot of slack to account for differences on people's macines.
assert result.retcode != 0
| """Test that the timeout parameter works as intended."""
start_time = time.time()
result = new_process.execute(self.COMMAND, timeout=.1)
end_time = time.time()
assert end_time - start_time < 5
# Give it a lot of slack to account for differences on people's macines.
... | 34 | 249 | 91 | 340 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,752 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/utils.py | 65,66 | 1,83 | file_hash | 67,80 | 66,80 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | chunk_size = 51200 # Read in 50 KB chunks.
digest = hashlib.sha1()
with open(file_path, 'rb') as file_handle:
chunk = file_handle.read(chunk_size)
while chunk:
digest.update(chunk)
chunk = file_handle.read(chunk_size)
return digest.hexdigest()
# Calculate a re... | """Returns the SHA-1 hash of |file_path| contents."""
chunk_size = 51200 # Read in 50 KB chunks.
digest = hashlib.sha1()
with open(file_path, 'rb') as file_handle:
chunk = file_handle.read(chunk_size)
while chunk:
digest.update(chunk)
chunk = file_handle.read(chu... | 46 | 725 | 143 | 868 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,753 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/common/yaml_utils.py | 24,25 | 1,28 | write | 26,28 | 25,28 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | with open(yaml_filename, 'w', encoding='utf-8') as file_handle:
return yaml.dump(data, file_handle)
| """Writes |data| to a new yaml file at |yaml_filename|."""
with open(yaml_filename, 'w', encoding='utf-8') as file_handle:
return yaml.dump(data, file_handle)
| 9 | 279 | 41 | 320 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,754 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/conftest.py | 64,66 | 1,98 | environ | 67,75 | 66,75 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # TODO(metzman): Make sure this is used by all tests that modify the
# environment.
patcher = mock.patch.dict(os.environ, {})
patcher.start()
yield
patcher.stop()
| """Patch environment."""
# TODO(metzman): Make sure this is used by all tests that modify the
# environment.
patcher = mock.patch.dict(os.environ, {})
patcher.start()
yield
patcher.stop()
| 22 | 995 | 70 | 1,065 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,755 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/database/utils.py | 93,94 | 1,111 | bulk_save | 95,100 | 94,100 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | with session_scope() as scoped_session:
scoped_session.bulk_save_objects(entities)
scoped_session.commit()
| """Save all |entities| to the database connected to by session."""
with session_scope() as scoped_session:
scoped_session.bulk_save_objects(entities)
scoped_session.commit()
| 6 | 890 | 46 | 936 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,756 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/docker/benchmark-builder/checkout_commit.py | 78,79 | 1,109 | main | 80,107 | 79,107 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | if len(sys.argv) != 3:
print(f'Usage: {sys.argv[0]}" <commit> <src_dir>')
return 1
commit = sys.argv[1]
src_dir = sys.argv[2]
if not commit:
print('No commit provided, skip.')
return 0
print('Checking out commit', commit)
# Infer the project repo directory in t... | """Check out an OSS-Fuzz project repo."""
if len(sys.argv) != 3:
print(f'Usage: {sys.argv[0]}" <commit> <src_dir>')
return 1
commit = sys.argv[1]
src_dir = sys.argv[2]
if not commit:
print('No commit provided, skip.')
return 0
print('Checking out commit', commit... | 82 | 845 | 285 | 1,130 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,758 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/docker/test_generate_makefile.py | 19,20 | 1,126 | test_get_rules_for_image | 21,45 | 20,45 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
name = 'afl-zlib-builder-intermediate'
image = {
'tag': 'builders/afl/zlib-intermediate',
'context': 'fuzzers/afl',
'dockerfile': 'fuzzers/afl/builder.Dockerfile',
'depends_on': ['zlib-project-builder'],
'build_arg': ['parent_image=gcr.io/fuzzbench/builders/benchmark/zli... | """Tests result of a makefile generation for an image."""
name = 'afl-zlib-builder-intermediate'
image = {
'tag': 'builders/afl/zlib-intermediate',
'context': 'fuzzers/afl',
'dockerfile': 'fuzzers/afl/builder.Dockerfile',
'depends_on': ['zlib-project-builder'],
'buil... | 48 | 1,636 | 380 | 2,016 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,759 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/build_utils.py | 22,23 | 1,44 | store_build_logs | 24,36 | 23,36 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | build_output = (f'Command returned {build_result.retcode}.\n'
f'Output: {build_result.output}')
with tempfile.NamedTemporaryFile(mode='w') as tmp:
tmp.write(build_output)
tmp.flush()
build_log_filename = build_config + '.txt'
filestore_utils.cp(
t... | """Save build results in the build logs bucket."""
build_output = (f'Command returned {build_result.retcode}.\n'
f'Output: {build_result.output}')
with tempfile.NamedTemporaryFile(mode='w') as tmp:
tmp.write(build_output)
tmp.flush()
build_log_filename = build_co... | 23 | 303 | 143 | 446 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,761 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/docker_images.py | 43,44 | 1,62 | _get_image_type_templates | 46,51 | 44,51 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | yaml_file = os.path.join(ROOT_DIR, 'docker', 'image_types.yaml')
all_templates = yaml_utils.read(yaml_file)
return all_templates
| """Loads the image types config that contains "templates" describing how to
build them and their dependencies."""
yaml_file = os.path.join(ROOT_DIR, 'docker', 'image_types.yaml')
all_templates = yaml_utils.read(yaml_file)
return all_templates
| 10 | 608 | 62 | 670 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,762 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/gcb_build.py | 41,42 | 1,126 | build_base_images | 43,54 | 42,54 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | buildable_images = _get_buildable_images()
image_templates = {
image: buildable_images[image] for image in ['base-image', 'worker']
}
config = generate_cloudbuild.create_cloudbuild_spec(image_templates,
benchmark=None,
... | """Build base images on GCB."""
buildable_images = _get_buildable_images()
image_templates = {
image: buildable_images[image] for image in ['base-image', 'worker']
}
config = generate_cloudbuild.create_cloudbuild_spec(image_templates,
b... | 22 | 1,218 | 121 | 1,339 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,764 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/local_build.py | 55,56 | 1,88 | build_coverage | 57,66 | 56,66 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | image_name = f'build-coverage-{benchmark}'
result = make([image_name])
if result.retcode:
return result
make_shared_coverage_binaries_dir()
copy_coverage_binaries(benchmark)
return result
| """Build (locally) coverage image for benchmark."""
image_name = f'build-coverage-{benchmark}'
result = make([image_name])
if result.retcode:
return result
make_shared_coverage_binaries_dir()
copy_coverage_binaries(benchmark)
return result
| 14 | 886 | 81 | 967 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
46,766 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/test_builder.py | 168,171 | 164,194 | test_build_changed_fuzzers | TestBuildChangedBenchmarksOrFuzzers | 172,176 | 171,176 | class TestBuildChangedBenchmarksOrFuzzers:
"""Integration tests for integrations of changed fuzzers or benchmarks.
Needs TEST_BUILD_CHANGED_BENCHMARKS or TEST_BUILD_CHANGED_FUZZERS to run."""
@pytest.mark.skipif(not os.getenv('TEST_BUILD_CHANGED_FUZZERS'),
reason='''Nothing to test ... | class TestBuildChangedBenchmarksOrFuzzers:
"""Integration tests for integrations of changed fuzzers or benchmarks.
Needs TEST_BUILD_CHANGED_BENCHMARKS or TEST_BUILD_CHANGED_FUZZERS to run."""
@pytest.mark.skipif(not os.getenv('TEST_BUILD_CHANGED_FUZZERS'),
reason='''Nothing to test ... | fuzzers = get_specified_fuzzers()
benchmarks = get_all_benchmarks()
_test_build_fuzzers_benchmarks(fuzzers, benchmarks)
| """Tests that the specified fuzzers can build with all benchmarks."""
fuzzers = get_specified_fuzzers()
benchmarks = get_all_benchmarks()
_test_build_fuzzers_benchmarks(fuzzers, benchmarks)
| 8 | 418 | 53 | 471 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,767 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/test_builder.py | 114,115 | 101,134 | test_integration_build_oss_fuzz_projects | TestIntegrationBuild | 117,121 | 115,121 | @pytest.mark.skipif(
not os.getenv('TEST_INTEGRATION_ALL'),
reason='Tests take too long and can interfere with real '
'experiments. Find some way of opting-in and isolating the tests.')
class TestIntegrationBuild:
"""Integration tests for building."""
def test_integration_build_all_fuzzer_benchmark... | @pytest.mark.skipif(
not os.getenv('TEST_INTEGRATION_ALL'),
reason='Tests take too long and can interfere with real '
'experiments. Find some way of opting-in and isolating the tests.')
class TestIntegrationBuild:
"""Integration tests for building."""
def test_integration_build_all_fuzzer_benchmark... | fuzzers = get_fuzzers()
benchmarks = get_oss_fuzz_benchmarks()
_test_build_fuzzers_benchmarks(fuzzers, benchmarks)
| """Test that build_all_measurers can build OSS-Fuzz projects on
GCB."""
fuzzers = get_fuzzers()
benchmarks = get_oss_fuzz_benchmarks()
_test_build_fuzzers_benchmarks(fuzzers, benchmarks)
| 8 | 395 | 53 | 448 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,768 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/test_docker_images.py | 44,45 | 1,55 | test_dependencies_exist | 47,55 | 45,55 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | fuzzers = ['afl', 'libfuzzer']
benchmarks = ['libxml', 'libpng']
all_images = docker_images.get_images_to_build(fuzzers, benchmarks)
for image in all_images.values():
if 'depends_on' in image:
for dep in image['depends_on']:
assert dep in all_images
| """Tests that if an image has a dependency, then the dependency exist among
the images."""
fuzzers = ['afl', 'libfuzzer']
benchmarks = ['libxml', 'libpng']
all_images = docker_images.get_images_to_build(fuzzers, benchmarks)
for image in all_images.values():
if 'depends_on' in image:
... | 28 | 667 | 107 | 774 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,769 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/build/test_gcb_build.py | 29,32 | 1,50 | test_build_error | 34,40 | 32,40 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | config_name = 'config'
with pytest.raises(subprocess.CalledProcessError):
gcb_build._build({}, config_name)
mocked_store_build_logs.assert_called_with(config_name, FAIL_RESULT)
| """Tests that on error, _build raises subprocess.CalledProcessError and
calls store_build_logs."""
config_name = 'config'
with pytest.raises(subprocess.CalledProcessError):
gcb_build._build({}, config_name)
mocked_store_build_logs.assert_called_with(config_name, FAIL_RESULT)
| 9 | 491 | 75 | 566 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,771 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/cloud/secret_manager.py | 30,31 | 1,67 | _create_secret | 33,47 | 31,47 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | client = get_secret_manager_client()
parent = get_parent_resource(project)
return client.create_secret(
request={
'parent': parent,
'secret_id': secret_id,
'secret': {
'replication': {
'automatic': {}
}
... | """Creates and returns a secret (identified by |secret_id| for |project|)
using |client."""
client = get_secret_manager_client()
parent = get_parent_resource(project)
return client.create_secret(
request={
'parent': parent,
'secret_id': secret_id,
'secret'... | 22 | 511 | 101 | 612 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,772 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/cloud/service_account_key.py | 61,62 | 1,77 | main | 64,75 | 62,75 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | logs.initialize()
try:
keyfile = sys.argv[1]
get_or_create_key(sys.argv[2], keyfile)
logs.info('Saved key to %s.', keyfile)
except Exception: # pylint: disable=broad-except
logs.error('Failed to get or create key.')
return 1
return 0
| """Creates or gets an already created service account key and saves it to
the provided path."""
logs.initialize()
try:
keyfile = sys.argv[1]
get_or_create_key(sys.argv[2], keyfile)
logs.info('Saved key to %s.', keyfile)
except Exception: # pylint: disable=broad-except
... | 27 | 681 | 114 | 795 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,773 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/conftest.py | 21,23 | 1,41 | experiment_config | 25,32 | 23,32 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | config_filepath = os.path.join(os.path.dirname(__file__), 'test_data',
'experiment-config.yaml')
with open(config_filepath, encoding='utf-8') as file_handle:
return yaml.load(file_handle, yaml.SafeLoader)
| """Fixture that returns the loaded yaml configuration
test_data/experiment-config.yaml."""
config_filepath = os.path.join(os.path.dirname(__file__), 'test_data',
'experiment-config.yaml')
with open(config_filepath, encoding='utf-8') as file_handle:
return yaml... | 13 | 358 | 89 | 447 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,776 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/coverage_utils.py | 121,122 | 87,193 | merge_profdata_files | CoverageReporter | 123,138 | 122,138 | class CoverageReporter: # pylint: disable=too-many-instance-attributes
"""Class used to generate coverage report for a pair of
fuzzer and benchmark."""
# pylint: disable=too-many-arguments
def __init__(self, experiment, fuzzer, benchmark, region_coverage):
self.fuzzer = fuzzer
self.ben... | class CoverageReporter: # pylint: disable=too-many-instance-attributes
"""Class used to generate coverage report for a pair of
fuzzer and benchmark."""
# pylint: disable=too-many-arguments
def __init__(self, experiment, fuzzer, benchmark, region_coverage):
self.fuzzer = fuzzer
self.ben... | logger.info('Merging profdata for fuzzer: %s, benchmark: %s.',
self.fuzzer, self.benchmark)
files_to_merge = []
for trial_id in self.trial_ids:
profdata_file = TrialCoverage(self.fuzzer, self.benchmark,
trial_id).profdata... | """Merge profdata files from |src_files| to |dst_files|."""
logger.info('Merging profdata for fuzzer: %s, benchmark: %s.',
self.fuzzer, self.benchmark)
files_to_merge = []
for trial_id in self.trial_ids:
profdata_file = TrialCoverage(self.fuzzer, self.ben... | 38 | 1,209 | 204 | 1,413 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,779 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/run_coverage.py | 41,44 | 1,71 | do_coverage_run | 46,71 | 44,71 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | with tempfile.TemporaryDirectory() as merge_dir:
command = [
coverage_binary, '-merge=1', '-dump_coverage=1',
f'-artifact_prefix={crashes_dir}/', f'-timeout={UNIT_TIMEOUT}',
f'-rss_limit_mb={RSS_LIMIT_MB}',
f'-max_total_time={MAX_TOTAL_TIME - EXIT_BUFFER}', me... | """Does a coverage run of |coverage_binary| on |new_units_dir|. Writes
the result to |profraw_file_pattern|."""
with tempfile.TemporaryDirectory() as merge_dir:
command = [
coverage_binary, '-merge=1', '-dump_coverage=1',
f'-artifact_prefix={crashes_dir}/', f'-timeout={UNIT_T... | 50 | 442 | 345 | 787 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,780 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/run_crashes.py | 104,105 | 1,115 | do_crashes_run | 107,115 | 105,115 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | crashes = {}
for root, _, filenames in os.walk(crashes_dir):
for filename in filenames:
crash_testcase_path = os.path.join(root, filename)
crash = process_crash(app_binary, crash_testcase_path, crashes_dir)
if crash:
crashes[_get_crash_key(crash)] = cr... | """Does a crashes run of |app_binary| on |crashes_dir|. Returns a list of
unique crashes."""
crashes = {}
for root, _, filenames in os.walk(crashes_dir):
for filename in filenames:
crash_testcase_path = os.path.join(root, filename)
crash = process_crash(app_binary, crash_... | 29 | 1,215 | 110 | 1,325 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,781 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/standalone.py | 25,26 | 1,72 | _initialize_db | 30,64 | 26,64 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # TODO(metzman): Most of the strings in this function should probably be
# configurable.
db_utils.initialize()
# One time set up for any db used by FuzzBench.
models.Base.metadata.create_all(db_utils.engine)
# Now set up the experiment.
with db_utils.session_scope() as session:
exp... | """Initializes |experiment| in the database by creating the experiment
entity. Warning you probably should not be using this method if connected to
anything other than a throwaway sqlite db. Most of this code is copied from
dispatcher.py which usually has the job of setting up an experiment."""
# TO... | 76 | 359 | 387 | 746 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,782 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/test_coverage_utils.py | 27,28 | 1,36 | test_extract_covered_branches_from_summary_json | 30,36 | 28,36 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | summary_json_file = get_test_data_path('cov_summary.json')
fs.add_real_file(summary_json_file, read_only=False)
covered_branches = coverage_utils. \
extract_covered_branches_from_summary_json(
summary_json_file)
assert len(covered_branches) == 9
| """Tests that extract_covered_branches_from_summary_json returns the covered
branches from summary json file."""
summary_json_file = get_test_data_path('cov_summary.json')
fs.add_real_file(summary_json_file, read_only=False)
covered_branches = coverage_utils. \
extract_covered_branches_from_summ... | 15 | 326 | 102 | 428 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.