function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def __init__(self, dim, depth, kernel_size=9, patch_size=7, in_chans=3, num_classes=1000, activation=nn.GELU, **kwargs):
super().__init__()
self.num_classes = num_classes
self.num_features = dim
self.head = nn.Linear(dim, num_classes) if num_classes > 0 else nn.Identity()
self.st... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def reset_classifier(self, num_classes, global_pool=''):
self.num_classes = num_classes
self.head = nn.Linear(self.num_features, num_classes) if num_classes > 0 else nn.Identity() | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def forward_features(self, x):
x = self.stem(x)
x = self.blocks(x)
x = self.pooling(x)
return x | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def forward(self, x):
x = self.forward_features(x)
x = self.head(x)
return x | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def convmixer_1536_20(pretrained=False, **kwargs):
model_args = dict(dim=1536, depth=20, kernel_size=9, patch_size=7, **kwargs)
return _create_convmixer('convmixer_1536_20', pretrained, **model_args) | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def convmixer_768_32(pretrained=False, **kwargs):
model_args = dict(dim=768, depth=32, kernel_size=7, patch_size=7, activation=nn.ReLU, **kwargs)
return _create_convmixer('convmixer_768_32', pretrained, **model_args) | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def _cfg(url=''):
return {
'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7),
'crop_pct': 0.875, 'interpolation': 'bicubic',
'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD,
'first_conv': 'features.conv0', 'classifier': 'classifier',
} | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def __init__(self, num_input_features, growth_rate, bn_size, norm_layer=BatchNormAct2d,
drop_rate=0., memory_efficient=False):
super(DenseLayer, self).__init__()
self.add_module('norm1', norm_layer(num_input_features)),
self.add_module('conv1', nn.Conv2d(
num_input_f... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def any_requires_grad(self, x):
# type: (List[torch.Tensor]) -> bool
for tensor in x:
if tensor.requires_grad:
return True
return False | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def call_checkpoint_bottleneck(self, x):
# type: (List[torch.Tensor]) -> torch.Tensor
def closure(*xs):
return self.bottleneck_fn(xs)
return cp.checkpoint(closure, *x) | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def forward(self, x):
# type: (List[torch.Tensor]) -> (torch.Tensor)
pass | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def forward(self, x):
# type: (torch.Tensor) -> (torch.Tensor)
pass | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def forward(self, x): # noqa: F811
if isinstance(x, torch.Tensor):
prev_features = [x]
else:
prev_features = x
if self.memory_efficient and self.any_requires_grad(prev_features):
if torch.jit.is_scripting():
raise Exception("Memory Efficient ... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def __init__(self, num_layers, num_input_features, bn_size, growth_rate, norm_layer=nn.ReLU,
drop_rate=0., memory_efficient=False):
super(DenseBlock, self).__init__()
for i in range(num_layers):
layer = DenseLayer(
num_input_features + i * growth_rate,
... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def __init__(self, num_input_features, num_output_features, norm_layer=nn.BatchNorm2d, aa_layer=None):
super(DenseTransition, self).__init__()
self.add_module('norm', norm_layer(num_input_features))
self.add_module('conv', nn.Conv2d(
num_input_features, num_output_features, kernel_si... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def __init__(self, growth_rate=32, block_config=(6, 12, 24, 16), bn_size=4, stem_type='',
num_classes=1000, in_chans=3, global_pool='avg',
norm_layer=BatchNormAct2d, aa_layer=None, drop_rate=0, memory_efficient=False,
aa_stem_only=True):
self.num_classes = num_... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def reset_classifier(self, num_classes, global_pool='avg'):
self.num_classes = num_classes
self.global_pool, self.classifier = create_classifier(
self.num_features, self.num_classes, pool_type=global_pool) | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def forward(self, x):
x = self.forward_features(x)
x = self.global_pool(x)
# both classifier and block drop?
# if self.drop_rate > 0.:
# x = F.dropout(x, p=self.drop_rate, training=self.training)
x = self.classifier(x)
return x | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def _create_densenet(variant, growth_rate, block_config, pretrained, **kwargs):
kwargs['growth_rate'] = growth_rate
kwargs['block_config'] = block_config
return build_model_with_cfg(
DenseNet, variant, pretrained,
default_cfg=default_cfgs[variant],
feature_cfg=dict(flatten_sequential... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet121(pretrained=False, **kwargs):
r"""Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenet121', growth_rate=32, block_config=(6, 12, 24, 16), pretrained=pretrained, **kwargs)
return mode... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenetblur121d(pretrained=False, **kwargs):
r"""Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenetblur121d', growth_rate=32, block_config=(6, 12, 24, 16), pretrained=pretrained, stem_type='deep... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet121d(pretrained=False, **kwargs):
r"""Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenet121d', growth_rate=32, block_config=(6, 12, 24, 16), stem_type='deep',
pretrained=pretraine... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet169(pretrained=False, **kwargs):
r"""Densenet-169 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenet169', growth_rate=32, block_config=(6, 12, 32, 32), pretrained=pretrained, **kwargs)
return mode... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet201(pretrained=False, **kwargs):
r"""Densenet-201 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenet201', growth_rate=32, block_config=(6, 12, 48, 32), pretrained=pretrained, **kwargs)
return mode... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet161(pretrained=False, **kwargs):
r"""Densenet-161 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenet161', growth_rate=48, block_config=(6, 12, 36, 24), pretrained=pretrained, **kwargs)
return mode... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet264(pretrained=False, **kwargs):
r"""Densenet-264 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`
"""
model = _create_densenet(
'densenet264', growth_rate=48, block_config=(6, 12, 64, 48), pretrained=pretrained, **kwargs)
return mode... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def densenet264d_iabn(pretrained=False, **kwargs):
r"""Densenet-264 model with deep stem and Inplace-ABN
"""
def norm_act_fn(num_features, **kwargs):
return create_norm_act('iabn', num_features, **kwargs)
model = _create_densenet(
'densenet264d_iabn', growth_rate=48, block_config=(6, 12,... | rwightman/pytorch-image-models | [
23978,
3956,
23978,
96,
1549086672
] |
def outsideLights(value):
if value = 1
BareBonesBrowserLaunch.openURL("http://ip_address:3480/data_request?id=action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=01")
else
BareBonesBrowserLaunch.openURL("http://ip_address:3480/data_request?id=a... | MyRobotLab/pyrobotlab | [
62,
140,
62,
5,
1413898155
] |
def __init__(self, chrome_path, *args, **kwargs):
"""Creates Display instance.
Args:
chrome_path: path to chrome executable.
"""
super(Display, self).__init__(*args, **kwargs)
self._chrome_path = chrome_path
self._temp_path = tempfile.gettempdir()
self._index_file = tempfile.mktemp(su... | google/flight-lab | [
11,
14,
11,
18,
1536808527
] |
def show_message(self, message, template_path='./data/display_message.html'):
"""Shows a text message in full screen.
Args:
message: text to show.
template_path: a html template to use. It should contain "{{ message }}".
"""
self._generate_page(
template_path=template_path, kwargs={... | google/flight-lab | [
11,
14,
11,
18,
1536808527
] |
def _generate_page(self, template_path, kwargs={}):
with open(template_path, 'r') as f:
template = jinja2.Template(f.read())
with open(self._index_file, 'w') as f:
f.write(template.render(**kwargs)) | google/flight-lab | [
11,
14,
11,
18,
1536808527
] |
def fetch_arns_for_findings(inspector_client):
"""
Fetch all ARNs for findings discovered in the latest run of all enabled Assessment Templates.
:param inspector_client:
:return:
"""
# at: Assessment template
# arn: Amazon resource name
findings = set()
# Get all assessment template... | CloudBoltSoftware/cloudbolt-forge | [
34,
32,
34,
16,
1437063482
] |
def update_instances(findings):
"""
For each finding build-up a dict keyed by instance ID with an array value of all applicable
findings. Then create or update the aws_inspector_findings custom field for each
corresponding CloudBolt server record.
:param findings:
:return:
"""
instances ... | CloudBoltSoftware/cloudbolt-forge | [
34,
32,
34,
16,
1437063482
] |
def run(job, *args, **kwargs):
rh: AWSHandler
for rh in AWSHandler.objects.all():
regions = set([env.aws_region for env in rh.environment_set.all()])
# For each region currently used by the current AWSHandler
for region in regions:
inspector = rh.get_boto3_client(service_name... | CloudBoltSoftware/cloudbolt-forge | [
34,
32,
34,
16,
1437063482
] |
def main(unused_argv):
out_dir = FLAGS.out_dir
exp_dir = 'exp%s' % FLAGS.exp
model_dir = 'rescale%s' % FLAGS.rescale_pixel_value
param_dir = 'reg%.2f_mr%.2f' % (FLAGS.reg_weight, FLAGS.mutation_rate)
job_dir = os.path.join(out_dir, exp_dir, model_dir, param_dir)
print('job_dir={}'.format(job_dir))
job_... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def get_msvc_version_numeric(msvc_version):
"""Get the raw version numbers from a MSVC_VERSION string, so it
could be cast to float or other numeric values. For example, '14.0Exp'
would get converted to '14.0'.
Args:
msvc_version: str
string representing the version number, could co... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def msvc_version_to_maj_min(msvc_version):
msvc_version_numeric = get_msvc_version_numeric(msvc_version)
t = msvc_version_numeric.split(".")
if not len(t) == 2:
raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric))
try:
maj = int(t[0])
min = int(... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def find_vc_pdir_vswhere(msvc_version):
"""
Find the MSVC product directory using the vswhere program.
:param msvc_version: MSVC version to search for
:return: MSVC install dir or None
:raises UnsupportedVersion: if the version is not known by this file
"""
try:
vswhere_version = _... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def find_batch_file(env,msvc_version,host_arch,target_arch):
"""
Find the location of the batch script which should set up the compiler
for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
"""
pdir = find_vc_pdir(msvc_version)
if pdir is None:
raise NoVersionFoun... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version):
"""Find the cl.exe on the filesystem in the vc_dir depending on
TARGET_ARCH, HOST_ARCH and the msvc version. TARGET_ARCH and
HOST_ARCH can be extracted from the passed env, unless its None,
which then the native platform is assumed the host and ... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def get_installed_vcs(env=None):
installed_versions = []
for ver in _VCVER:
debug('trying to find VC %s' % ver)
try:
VC_DIR = find_vc_pdir(ver)
if VC_DIR:
debug('found VC %s' % ver)
if _check_cl_exists_in_vc_dir(env, VC_DIR, ver):
... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def script_env(script, args=None):
global script_env_cache
if script_env_cache is None:
script_env_cache = common.read_script_env_cache()
cache_key = "{}--{}".format(script, args)
cache_data = script_env_cache.get(cache_key, None)
if cache_data is None:
stdout = common.get_output(sc... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def msvc_setup_env_once(env):
try:
has_run = env["MSVC_SETUP_RUN"]
except KeyError:
has_run = False
if not has_run:
msvc_setup_env(env)
env["MSVC_SETUP_RUN"] = True | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def msvc_setup_env(env):
debug('msvc_setup_env()')
version = get_default_version(env)
if version is None:
warn_msg = "No version of Visual Studio compiler found - C/C++ " \
"compilers most likely not set correctly"
# Nuitka: Useless warning for us.
# SCons.Warnin... | kayhayen/Nuitka | [
8411,
456,
8411,
240,
1366731633
] |
def extractDellstoriesWordpressCom(item):
'''
Parser for 'dellstories.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Lo... | fake-name/ReadableWebProxy | [
191,
16,
191,
3,
1437712243
] |
def respond_to_message(self,message,response_msg,poll):
if response_msg == poll.default_response:
try:
batch=MessageBatch.objects.get(name=str(poll.pk))
batch.status="Q"
batch.save()
msg=Message.objects.create(text=response_msg,status=... | unicefuganda/edtrac | [
7,
3,
7,
3,
1324013652
] |
def latest_platform_fallback_path(cls):
return cls.FALLBACK_PATHS[cls.SUPPORTED_VERSIONS[-1]] | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def determine_full_port_name(cls, host, options, port_name):
"""Return a fully-specified port name that can be used to construct objects."""
# Subclasses will usually override this.
assert port_name.startswith(cls.port_name)
return port_name | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def __str__(self):
return 'Port{name=%s, version=%s, architecture=%s, test_configuration=%s}' % (
self._name, self._version, self._architecture,
self._test_configuration) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def flag_specific_config_name(self):
"""Returns the name of the flag-specific configuration which best matches
self._specified_additional_driver_flags(), or the first specified flag
with leading '-'s stripped if no match in the configuration is found.
"""
specified_flags = ... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _flag_specific_configs(self):
"""Reads configuration from FlagSpecificConfig and returns a dictionary from name to args."""
config_file = self._filesystem.join(self.web_tests_dir(),
'FlagSpecificConfig')
if not self._filesystem.exists(config_file):... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def additional_driver_flags(self):
flags = self._specified_additional_driver_flags()
if self.driver_name() == self.CONTENT_SHELL_NAME:
flags += [
'--run-web-tests',
'--ignore-certificate-errors-spki-list=' + WPT_FINGERPRINT +
',' + SXG_FINGERPR... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def default_smoke_test_only(self):
return False | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def timeout_ms(self):
timeout_ms = self._default_timeout_ms()
if self.get_option('configuration') == 'Debug':
# Debug is about 5x slower than Release.
return 5 * timeout_ms
if self._build_has_dcheck_always_on():
# Release with DCHECK is also slower than pure R... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _build_has_dcheck_always_on(self):
args_gn_file = self._build_path('args.gn')
if not self._filesystem.exists(args_gn_file):
_log.error('Unable to find %s', args_gn_file)
return False
contents = self._filesystem.read_text_file(args_gn_file)
return bool(
... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def default_batch_size(self):
"""Returns the default batch size to use for this port."""
if self.get_option('enable_sanitizer'):
# ASAN/MSAN/TSAN use more memory than regular content_shell. Their
# memory usage may also grow over time, up to a certain point.
# Relaunc... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def default_max_locked_shards(self):
"""Returns the number of "locked" shards to run in parallel (like the http tests)."""
max_locked_shards = int(self.default_child_processes()) // 4
if not max_locked_shards:
return 1
return max_locked_shards | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def baseline_flag_specific_dir(self):
"""If --additional-driver-flag is specified, returns the absolute path to the flag-specific
platform-independent results. Otherwise returns None."""
flag_specific_path = self._flag_specific_baseline_search_path()
return flag_specific_path[-1] if f... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def default_baseline_search_path(self):
"""Returns a list of absolute paths to directories to search under for baselines.
The directories are searched in order.
"""
return map(self._absolute_baseline_path,
self.FALLBACK_PATHS[self.version()]) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _compare_baseline(self):
factory = PortFactory(self.host)
target_port = self.get_option('compare_port')
if target_port:
return factory.get(target_port).default_baseline_search_path()
return [] | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def check_build(self, needs_http, printer):
if not self._check_file_exists(self._path_to_driver(), 'test driver'):
return exit_codes.UNEXPECTED_ERROR_EXIT_STATUS
if not self._check_driver_build_up_to_date(
self.get_option('configuration')):
return exit_codes.UNEX... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def check_httpd(self):
httpd_path = self.path_to_apache()
if httpd_path:
try:
env = self.setup_environ_for_server()
if self._executive.run_command(
[httpd_path, '-v'], env=env, return_exit_code=True) != 0:
_log.error('ht... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def do_audio_results_differ(self, expected_audio, actual_audio):
return expected_audio != actual_audio | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def driver_name(self):
if self.get_option('driver_name'):
return self.get_option('driver_name')
return self.CONTENT_SHELL_NAME | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def output_filename(self, test_name, suffix, extension):
"""Generates the output filename for a test.
This method gives a proper filename for various outputs of a test,
including baselines and actual results. Usually, the output filename
follows the pattern: test_name_without_ext+suffix... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def expected_filename(self,
test_name,
extension,
return_default=True,
fallback_base_for_virtual=True,
match=True):
"""Given a test name, returns an absolute path to its expected res... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def expected_checksum(self, test_name):
"""Returns the checksum of the image we expect the test to produce,
or None if it is a text-only test.
"""
png_path = self.expected_filename(test_name, '.png')
if self._filesystem.exists(png_path):
with self._filesystem.open_bi... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def expected_audio(self, test_name):
baseline_path = self.expected_filename(test_name, '.wav')
if not self._filesystem.exists(baseline_path):
return None
return self._filesystem.read_binary_file(baseline_path) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def expected_subtest_failure(self, test_name):
baseline = self.expected_text(test_name)
if baseline:
baseline = baseline.decode('utf8', 'replace')
if re.search(r"^(FAIL|NOTRUN|TIMEOUT)", baseline, re.MULTILINE):
return True
return False | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def reference_files(self, test_name):
"""Returns a list of expectation (== or !=) and filename pairs"""
# Try to find -expected.* or -expected-mismatch.* in the same directory.
reftest_list = []
for expectation in ('==', '!='):
for extension in Port.supported_file_extensions... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def real_tests_from_dict(self, paths, tests_by_dir):
"""Find all real tests in paths, using results saved in dict."""
files = []
for path in paths:
if self._has_supported_extension_for_all(path):
files.append(path)
continue
path = path + '/... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def is_reference_html_file(filesystem, dirname, filename):
# TODO(robertma): We probably do not need prefixes/suffixes other than
# -expected{-mismatch} any more. Or worse, there might be actual tests
# with these prefixes/suffixes.
if filename.startswith('ref-') or filename.startswith('... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _has_supported_extension_for_all(self, filename):
extension = self._filesystem.splitext(filename)[1]
if 'inspector-protocol' in filename and extension == '.js':
return True
if 'devtools' in filename and extension == '.js':
return True
return extension in self.... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def is_non_wpt_test_file(self, dirname, filename):
# Convert dirname to a relative path to web_tests with slashes
# normalized and ensure it has a trailing slash.
normalized_test_dir = self.relative_test_filename(
dirname) + self.TEST_PATH_SEPARATOR
if any(
no... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def wpt_manifest(self, path):
assert path in self.WPT_DIRS
# Convert '/' to the platform-specific separator.
path = self._filesystem.normpath(path)
manifest_path = self._filesystem.join(self.web_tests_dir(), path,
MANIFEST_NAME)
if no... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def is_slow_wpt_test(self, test_name):
# When DCHECK is enabled, idlharness tests run 5-6x slower due to the
# amount of JavaScript they use (most web_tests run very little JS).
# This causes flaky timeouts for a lot of them, as a 0.5-1s test becomes
# close to the default 6s timeout.
... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def get_file_path_for_wpt_test(self, test_name):
"""Returns the real file path for the given WPT test.
Or None if the test is not a WPT.
"""
match = self.WPT_REGEX.match(test_name)
if not match:
return None
wpt_path = match.group(1)
path_in_wpt = matc... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _natural_sort_key(self, string_to_split):
"""Turns a string into a list of string and number chunks.
For example: "z23a" -> ["z", 23, "a"]
This can be used to implement "natural sort" order. See:
http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html
... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def test_isfile(self, test_name):
"""Returns True if the test name refers to an existing test file."""
# Used by test_expectations.py to apply rules to a file.
if self._filesystem.isfile(self.abspath_for_test(test_name)):
return True
base = self.lookup_virtual_test_base(test_... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def test_isdir(self, test_name):
"""Returns True if the test name refers to an existing directory of tests."""
# Used by test_expectations.py to apply rules to whole directories.
if self._filesystem.isdir(self.abspath_for_test(test_name)):
return True
base = self.lookup_virtu... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def test_exists(self, test_name):
"""Returns True if the test name refers to an existing test directory or file."""
# Used by lint_test_expectations.py to determine if an entry refers to a
# valid test.
if self.is_wpt_test(test_name):
# A virtual WPT test must have valid virt... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def normalize_test_name(self, test_name):
"""Returns a normalized version of the test name or test directory."""
if test_name.endswith('/'):
return test_name
if self.test_isdir(test_name):
return test_name + '/'
return test_name | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def update_baseline(self, baseline_path, data):
"""Updates the baseline for a test.
Args:
baseline_path: the actual path to use for baseline, not the path to
the test. This function is used to update either generic or
platform-specific baselines, but we can't inf... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _perf_tests_dir(self):
return self._path_finder.perf_tests_dir() | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def skips_test(self, test):
"""Checks whether the given test is skipped for this port.
Returns True if the test is skipped because the port runs smoke tests
only or because the test is marked as Skip in NeverFixTest (otherwise
the test is only marked as Skip indicating a temporary skip)... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def _tests_from_file(self, filename):
tests = set()
file_contents = self._filesystem.read_text_file(filename)
for line in file_contents.splitlines():
line = line.strip()
if line.startswith('#') or not line:
continue
tests.add(line)
retu... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def path_to_smoke_tests_file(self):
return self._filesystem.join(self.web_tests_dir(), 'SmokeTests') | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def path_to_never_fix_tests_file(self):
return self._filesystem.join(self.web_tests_dir(), 'NeverFixTests') | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def operating_system(self):
raise NotImplementedError | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def architecture(self):
return self._architecture | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def get_option(self, name, default_value=None):
return getattr(self._options, name, default_value) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def relative_test_filename(self, filename):
"""Returns a Unix-style path for a filename relative to web_tests.
Ports may legitimately return absolute paths here if no relative path
makes sense.
"""
# Ports that run on windows need to override this method to deal with
# f... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def abspath_for_test(self, test_name):
"""Returns the full path to the file for a given test name.
This is the inverse of relative_test_filename().
"""
return self._filesystem.join(self.web_tests_dir(), test_name) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def args_for_test(self, test_name):
args = self._lookup_virtual_test_args(test_name)
tracing_categories = self.get_option('enable_tracing')
if tracing_categories:
args.append('--trace-startup=' + tracing_categories)
# Do not finish the trace until the test is finished.
... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def name_for_test(self, test_name):
test_base = self.lookup_virtual_test_base(test_name)
if test_base and not self._filesystem.exists(
self.abspath_for_test(test_name)):
return test_base
return test_name | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def results_directory(self):
"""Returns the absolute path directory which will store all web tests outputted
files. It may include a sub directory for artifacts and it may store performance test results."""
if not self._results_directory:
option_val = self.get_option(
... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def perf_results_directory(self):
return self.results_directory() | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def generated_sources_directory(self):
return self._build_path('gen') | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def default_results_directory(self):
"""Returns the absolute path to the build directory."""
return self._build_path() | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def num_workers(self, requested_num_workers):
"""Returns the number of available workers (possibly less than the number requested)."""
return requested_num_workers | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.