uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
4c1e9bf4fd8f7219d1585588
train
class
class Opera(BrowserSetup): name = "opera" browser_cls = browser.Opera def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_binary is None: install = self.prompt_install("operadri...
class Opera(BrowserSetup):
name = "opera" browser_cls = browser.Opera def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_binary is None: install = self.prompt_install("operadriver") if i...
=self.venv.bin_path) else: logger.info("Using webdriver binary %s" % webdriver_binary) if webdriver_binary: kwargs["webdriver_binary"] = webdriver_binary else: raise WptrunError("Unable to locate or install chromedriver binary") class ...
64
64
148
6
58
CanonMukai/wpt
tools/wpt/run.py
Python
Opera
Opera
419
439
419
419
84a99e44e5d43c492d41dfce73322f7cd59104fa
bigcode/the-stack
train
a8c8e18cec413349bf675259
train
class
class EdgeChromium(BrowserSetup): name = "MicrosoftEdge" browser_cls = browser.EdgeChromium def setup_kwargs(self, kwargs): browser_channel = kwargs["browser_channel"] if kwargs["binary"] is None: binary = self.browser.find_binary(channel=browser_channel) if binary: ...
class EdgeChromium(BrowserSetup):
name = "MicrosoftEdge" browser_cls = browser.EdgeChromium def setup_kwargs(self, kwargs): browser_channel = kwargs["browser_channel"] if kwargs["binary"] is None: binary = self.browser.find_binary(channel=browser_channel) if binary: kwargs["binary"] =...
.info("Downloading operadriver") webdriver_binary = self.browser.install_webdriver(dest=self.venv.bin_path) else: logger.info("Using webdriver binary %s" % webdriver_binary) if webdriver_binary: kwargs["webdriver_binary"] = webdriver_binary ...
84
84
282
8
76
CanonMukai/wpt
tools/wpt/run.py
Python
EdgeChromium
EdgeChromium
442
473
442
442
0395d5b1c3c01d03241ddbcbab7dff5ba5d82274
bigcode/the-stack
train
88834efebe68a4b386c11dfa
train
class
class Epiphany(BrowserSetup): name = "epiphany" browser_cls = browser.Epiphany def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["binary"] is None: binary = self.browser.find_binary() if binary is None: ...
class Epiphany(BrowserSetup):
name = "epiphany" browser_cls = browser.Epiphany def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["binary"] is None: binary = self.browser.find_binary() if binary is None: raise WptrunError("Un...
webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver(channel=kwargs["browser_channel"]) if webdriver_binary is None: raise WptrunError("Unable to find WebKitWebDriver in PATH") kwargs["webdriver_binary"] = webdriver_binary class Epiphany(Browser...
64
64
149
8
55
CanonMukai/wpt
tools/wpt/run.py
Python
Epiphany
Epiphany
609
629
609
609
72c74365c10f39414346b0db8b3e91a315db62ee
bigcode/the-stack
train
eef7280527cd69582582ba53
train
class
class ServoWebDriver(Servo): name = "servodriver" browser_cls = browser.ServoWebDriver
class ServoWebDriver(Servo):
name = "servodriver" browser_cls = browser.ServoWebDriver
(self, kwargs): if kwargs["binary"] is None: binary = self.browser.find_binary(self.venv.path, None) if binary is None: raise WptrunError("Unable to find servo binary in PATH") kwargs["binary"] = binary class ServoWebDriver(Servo):
64
64
25
7
56
CanonMukai/wpt
tools/wpt/run.py
Python
ServoWebDriver
ServoWebDriver
570
572
570
570
290d51c48194c1d929dfe2ae072dea72e8141b7b
bigcode/the-stack
train
835be1b0439b22c99d1c6b02
train
class
class WebKitGTKMiniBrowser(BrowserSetup): name = "webkitgtk_minibrowser" browser_cls = browser.WebKitGTKMiniBrowser def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["binary"] is None: binary = self.browser.find_binary(chan...
class WebKitGTKMiniBrowser(BrowserSetup):
name = "webkitgtk_minibrowser" browser_cls = browser.WebKitGTKMiniBrowser def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["binary"] is None: binary = self.browser.find_binary(channel=kwargs["browser_channel"]) ...
_cls = browser.ServoWebDriver class WebKit(BrowserSetup): name = "webkit" browser_cls = browser.WebKit def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): pass class WebKitGTKMiniBrowser(BrowserSetup):
64
64
164
10
53
CanonMukai/wpt
tools/wpt/run.py
Python
WebKitGTKMiniBrowser
WebKitGTKMiniBrowser
586
606
586
586
599a2a5550b33d09a26b17431164a687dda9bd1e
bigcode/the-stack
train
81c59c3f2ffde295e56505eb
train
class
class Firefox(BrowserSetup): name = "firefox" browser_cls = browser.Firefox def setup_kwargs(self, kwargs): if kwargs["binary"] is None: if kwargs["browser_channel"] is None: kwargs["browser_channel"] = "nightly" logger.info("No browser channel specified....
class Firefox(BrowserSetup):
name = "firefox" browser_cls = browser.Firefox def setup_kwargs(self, kwargs): if kwargs["binary"] is None: if kwargs["browser_channel"] is None: kwargs["browser_channel"] = "nightly" logger.info("No browser channel specified. Running nightly instead.") ...
_product def prompt_install(self, component): if not self.prompt: return True while True: resp = input("Download and install %s [Y/n]? " % component).strip().lower() if not resp or resp == "y": return True elif resp == "n": ...
166
166
554
6
160
CanonMukai/wpt
tools/wpt/run.py
Python
Firefox
Firefox
187
251
187
187
0280896c22005274b61e352193a17ea14d69416b
bigcode/the-stack
train
bdf30c4d30aa6b345fa1ae34
train
class
class Servo(BrowserSetup): name = "servo" browser_cls = browser.Servo def install(self, channel=None): if self.prompt_install(self.name): return self.browser.install(self.venv.path) def setup_kwargs(self, kwargs): if kwargs["binary"] is None: binary = self.brows...
class Servo(BrowserSetup):
name = "servo" browser_cls = browser.Servo def install(self, channel=None): if self.prompt_install(self.name): return self.browser.install(self.venv.path) def setup_kwargs(self, kwargs): if kwargs["binary"] is None: binary = self.browser.find_binary(self.venv.pa...
def setup_kwargs(self, kwargs): kwargs.set_if_none("sauce_browser", self.sub_product[0]) kwargs.set_if_none("sauce_version", self.sub_product[1]) kwargs["test_types"] = ["testharness", "reftest"] class Servo(BrowserSetup):
63
64
108
6
57
CanonMukai/wpt
tools/wpt/run.py
Python
Servo
Servo
553
567
553
553
0d2fb08e461808b2d7d2d3a069a221d87432b6c5
bigcode/the-stack
train
6476b2a641a24014ba127abd
train
class
class WptrunnerHelpAction(argparse.Action): def __init__(self, option_strings, dest=argparse.SUPPRESS, default=argparse.SUPPRESS, help=None): super(WptrunnerHelpAction, self).__init__( option_strings=option_strings, ...
class WptrunnerHelpAction(argparse.Action):
def __init__(self, option_strings, dest=argparse.SUPPRESS, default=argparse.SUPPRESS, help=None): super(WptrunnerHelpAction, self).__init__( option_strings=option_strings, dest=dest, default=default, ...
.path.insert(0, os.path.abspath(os.path.join(wpt_root, "tools"))) from . import browser, install, testfiles, utils, virtualenv from ..serve import serve logger = None class WptrunError(Exception): pass class WptrunnerHelpAction(argparse.Action):
64
64
144
10
53
CanonMukai/wpt
tools/wpt/run.py
Python
WptrunnerHelpAction
WptrunnerHelpAction
21
39
21
21
8891731753eb35a6da349e03a0ce1fe42ca70c16
bigcode/the-stack
train
a69530b998b8612a1e55ac04
train
function
def create_parser(): from wptrunner import wptcommandline parser = argparse.ArgumentParser(add_help=False) parser.add_argument("product", action="store", help="Browser to run tests in") parser.add_argument("--affected", action="store", default=None, help=...
def create_parser():
from wptrunner import wptcommandline parser = argparse.ArgumentParser(add_help=False) parser.add_argument("product", action="store", help="Browser to run tests in") parser.add_argument("--affected", action="store", default=None, help="Run affected tests s...
dest, default=default, nargs=0, help=help) def __call__(self, parser, namespace, values, option_string=None): from wptrunner import wptcommandline wptparser = wptcommandline.create_parser() wptparser.usage = parser.usage wptparser.print_help() ...
83
83
278
4
79
CanonMukai/wpt
tools/wpt/run.py
Python
create_parser
create_parser
42
65
42
42
f15666667e5b0b44316df6d9f3099d032d6e3bf2
bigcode/the-stack
train
98b4f18c99a37f483a726a04
train
class
class EdgeWebDriver(Edge): name = "edge_webdriver" browser_cls = browser.EdgeWebDriver
class EdgeWebDriver(Edge):
name = "edge_webdriver" browser_cls = browser.EdgeWebDriver
which version to download. Please go to the following URL and install the correct version for your Edge/Windows release somewhere on the %PATH%: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ """) kwargs["webdriver_binary"] = webdriver_binary class EdgeWebDriver(Edge):
64
64
24
7
56
CanonMukai/wpt
tools/wpt/run.py
Python
EdgeWebDriver
EdgeWebDriver
497
499
497
497
f79bbdd9d3dc70781a80101188c5dde21c1a6194
bigcode/the-stack
train
f44af5efcd7cffe78ba01e2d
train
class
class BrowserSetup(object): name = None browser_cls = None def __init__(self, venv, prompt=True, sub_product=None): self.browser = self.browser_cls(logger) self.venv = venv self.prompt = prompt self.sub_product = sub_product def prompt_install(self, component): ...
class BrowserSetup(object):
name = None browser_cls = None def __init__(self, venv, prompt=True, sub_product=None): self.browser = self.browser_cls(logger) self.venv = venv self.prompt = prompt self.sub_product = sub_product def prompt_install(self, component): if not self.prompt: ...
_path) else: message = """Missing hosts file configuration. Run %s make-hosts-file | sudo tee -a %s""" % ("./wpt" if wpt_path == "wpt" else wpt_path, hosts_path) raise WptrunError(message) class BrowserSetup(object):
66
66
223
5
61
CanonMukai/wpt
tools/wpt/run.py
Python
BrowserSetup
BrowserSetup
155
184
155
155
ba45f77c88e4fcf4954e3b0161d40ccb6a821ce6
bigcode/the-stack
train
ce6138f8ab8fa5ad00b331ba
train
function
def check_environ(product): if product not in ("android_webview", "chrome", "chrome_android", "firefox", "firefox_android", "servo"): config_builder = serve.build_config(os.path.join(wpt_root, "config.json")) # Override the ports to avoid looking for free ports config_builder.ssl = {"type": ...
def check_environ(product):
if product not in ("android_webview", "chrome", "chrome_android", "firefox", "firefox_android", "servo"): config_builder = serve.build_config(os.path.join(wpt_root, "config.json")) # Override the ports to avoid looking for free ports config_builder.ssl = {"type": "none"} config_build...
== "Windows": raise WptrunError("""OpenSSL binary not found. If you need HTTPS tests, install OpenSSL from https://slproweb.com/products/Win32OpenSSL.html Ensuring that libraries are added to /bin and add the resulting bin directory to your PATH. Otherwise run with --ssl-type=none""") el...
121
121
406
6
115
CanonMukai/wpt
tools/wpt/run.py
Python
check_environ
check_environ
108
152
108
108
dec0f78c8a62520a86141025c71f509860c65f4e
bigcode/the-stack
train
f0b47b1c174947ecaf79eb0f
train
function
def main(): try: parser = create_parser() args = parser.parse_args() venv = virtualenv.Virtualenv(os.path.join(wpt_root, "_venv_%s") % platform.uname()[0]) venv.start() venv.install_requirements(os.path.join(wpt_root, "tools", "wptrunner", "requirements.txt")) venv.i...
def main():
try: parser = create_parser() args = parser.parse_args() venv = virtualenv.Virtualenv(os.path.join(wpt_root, "_venv_%s") % platform.uname()[0]) venv.start() venv.install_requirements(os.path.join(wpt_root, "tools", "wptrunner", "requirements.txt")) venv.install("requ...
, install_browser=install_browser, **kwargs) rv = run_single(venv, **kwargs) > 0 return rv def run_single(venv, **kwargs): from wptrunner import wptrunner return wptrunner.start(**kwargs) def main():
64
64
108
3
61
CanonMukai/wpt
tools/wpt/run.py
Python
main
main
771
783
771
771
0a03458d6a6d6ba07dd47eebb5e4980bb780f7a0
bigcode/the-stack
train
5c8c9275724e382fde078bdf
train
class
class Sauce(BrowserSetup): name = "sauce" browser_cls = browser.Sauce def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): kwargs.set_if_none("sauce_browser", self.sub_product[0]) kwargs.set_if_none("sauce_version", self.sub_product[1]) ...
class Sauce(BrowserSetup):
name = "sauce" browser_cls = browser.Sauce def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): kwargs.set_if_none("sauce_browser", self.sub_product[0]) kwargs.set_if_none("sauce_version", self.sub_product[1]) kwargs["test_types"] =...
if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver(channel=kwargs["browser_channel"]) if webdriver_binary is None: raise WptrunError("Unable to locate safaridriver binary") kwargs["webdriver_binary"] = webdriver_binary class Sauce...
64
64
92
6
57
CanonMukai/wpt
tools/wpt/run.py
Python
Sauce
Sauce
540
550
540
540
f30f641ef12eca80c010f8116d2cd35a0158f5f0
bigcode/the-stack
train
981e78eccd78f6a5c3bea80e
train
function
def run_single(venv, **kwargs): from wptrunner import wptrunner return wptrunner.start(**kwargs)
def run_single(venv, **kwargs):
from wptrunner import wptrunner return wptrunner.start(**kwargs)
.pop("install_browser", False) kwargs = setup_wptrunner(venv, prompt=prompt, install_browser=install_browser, **kwargs) rv = run_single(venv, **kwargs) > 0 return rv def run_single(venv, **kwargs):
64
64
29
10
53
CanonMukai/wpt
tools/wpt/run.py
Python
run_single
run_single
766
768
766
766
fa0dcfc3151b28c7b6ab8859b80ed79f58dfe247
bigcode/the-stack
train
8f1535c5bbeb5edddf334334
train
function
def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs): from wptrunner import wptcommandline kwargs = utils.Kwargs(kwargs.iteritems()) product_parts = kwargs["product"].split(":") kwargs["product"] = product_parts[0].replace("-", "_") sub_product = product_parts[1:] check_env...
def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
from wptrunner import wptcommandline kwargs = utils.Kwargs(kwargs.iteritems()) product_parts = kwargs["product"].split(":") kwargs["product"] = product_parts[0].replace("-", "_") sub_product = product_parts[1:] check_environ(kwargs["product"]) args_general(kwargs) if kwargs["product"...
Safari, "servo": Servo, "servodriver": ServoWebDriver, "sauce": Sauce, "opera": Opera, "webkit": WebKit, "webkitgtk_minibrowser": WebKitGTKMiniBrowser, "epiphany": Epiphany, } def setup_logging(kwargs, default_config=None, formatter_defaults=None): import mozlog from wptrunner imp...
211
211
705
19
191
CanonMukai/wpt
tools/wpt/run.py
Python
setup_wptrunner
setup_wptrunner
672
746
672
672
e7db271449be28906166f4698f32e5a99bb5f3cc
bigcode/the-stack
train
fb1ec2047d090b3192d2eca9
train
class
class Chrome(BrowserSetup): name = "chrome" browser_cls = browser.Chrome def setup_kwargs(self, kwargs): browser_channel = kwargs["browser_channel"] if kwargs["binary"] is None: binary = self.browser.find_binary(channel=browser_channel) if binary: kwa...
class Chrome(BrowserSetup):
name = "chrome" browser_cls = browser.Chrome def setup_kwargs(self, kwargs): browser_channel = kwargs["browser_channel"] if kwargs["binary"] is None: binary = self.browser.find_binary(channel=browser_channel) if binary: kwargs["binary"] = binary ...
ADB_PATH"] device = mozdevice.ADBDevice(adb=adb_path, device=kwargs["device_serial"]) if install: device.uninstall_app(app) device.install_app(apk_path) elif not device.is_app_installed(app): raise WptrunError("app %s not...
87
88
294
6
81
CanonMukai/wpt
tools/wpt/run.py
Python
Chrome
Chrome
314
349
314
314
43d50ac555c61aa004510379ee697fbf2c0c3441
bigcode/the-stack
train
96d278a0d3a210af01ec7e86
train
class
class FirefoxAndroid(BrowserSetup): name = "firefox_android" browser_cls = browser.FirefoxAndroid def install(self, channel): # The install needs to happen in setup so that we have access to all the kwargs self._install_browser = True return None def setup_kwargs(self, kwargs):...
class FirefoxAndroid(BrowserSetup):
name = "firefox_android" browser_cls = browser.FirefoxAndroid def install(self, channel): # The install needs to happen in setup so that we have access to all the kwargs self._install_browser = True return None def setup_kwargs(self, kwargs): from . import android ...
kwargs["browser_channel"]) kwargs["prefs_root"] = prefs_root if kwargs["headless"] is None: kwargs["headless"] = True logger.info("Running in headless mode, pass --no-headless to disable") # Turn off Firefox WebRTC ICE logging on WPT (turned on by mozrunner) ...
137
137
459
7
130
CanonMukai/wpt
tools/wpt/run.py
Python
FirefoxAndroid
FirefoxAndroid
254
311
254
254
7814468f43bc8fffed55777b6cf23d8492cc8062
bigcode/the-stack
train
6d55e148318c0fd676c7621a
train
class
class Edge(BrowserSetup): name = "edge" browser_cls = browser.Edge def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_bi...
class Edge(BrowserSetup):
name = "edge" browser_cls = browser.Edge def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_binary is None: ...
else: raise WptrunError("Unable to locate or install msedgedriver binary") if browser_channel == "dev": logger.info("Automatically turning on experimental features for Edge Dev") kwargs["binary_args"].append("--enable-experimental-web-platform-features") class...
64
64
146
6
58
CanonMukai/wpt
tools/wpt/run.py
Python
Edge
Edge
476
494
476
476
b20143a577e0611e16f5884ffa757cc2f2626f58
bigcode/the-stack
train
9a138e42b042514f1c281026
train
class
class WptrunError(Exception): pass
class WptrunError(Exception):
pass
file__), os.pardir, os.pardir)) sys.path.insert(0, os.path.abspath(os.path.join(wpt_root, "tools"))) from . import browser, install, testfiles, utils, virtualenv from ..serve import serve logger = None class WptrunError(Exception):
64
64
10
7
56
CanonMukai/wpt
tools/wpt/run.py
Python
WptrunError
WptrunError
17
18
17
17
f593d60c700eae2009fd3fad86dcc692db9a7cb4
bigcode/the-stack
train
f3a6eacc28cb2dd48db2bbc4
train
function
def run(venv, **kwargs): setup_logging(kwargs) # Remove arguments that aren't passed to wptrunner prompt = kwargs.pop("prompt", True) install_browser = kwargs.pop("install_browser", False) kwargs = setup_wptrunner(venv, prompt=prompt, insta...
def run(venv, **kwargs):
setup_logging(kwargs) # Remove arguments that aren't passed to wptrunner prompt = kwargs.pop("prompt", True) install_browser = kwargs.pop("install_browser", False) kwargs = setup_wptrunner(venv, prompt=prompt, install_browser=install_browse...
the command line. if not kwargs["browser_version"]: kwargs["browser_version"] = setup_cls.browser.version( binary=kwargs.get("binary") or kwargs.get("package_name"), webdriver_binary=kwargs.get("webdriver_binary"), ) return kwargs def run(venv, **kwargs):
64
64
95
9
54
CanonMukai/wpt
tools/wpt/run.py
Python
run
run
749
763
749
749
292562ff6b9325a9d76c6b2e1753b7e8d2be5d83
bigcode/the-stack
train
6d9de2603db30dea938b5a55
train
class
class Safari(BrowserSetup): name = "safari" browser_cls = browser.Safari def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver(channel=kwargs["browser_...
class Safari(BrowserSetup):
name = "safari" browser_cls = browser.Safari def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver(channel=kwargs["browser_channel"]) if w...
aren't yet clever enough to work out which version to download. Please go to the following URL and install the driver for Internet Explorer somewhere on the %PATH%: https://selenium-release.storage.googleapis.com/index.html """) kwargs["webdriver_binary"] = webdriver_binary class Safari(BrowserSetup):
64
64
102
6
57
CanonMukai/wpt
tools/wpt/run.py
Python
Safari
Safari
523
537
523
523
00bf6293652ff7caa9f7a2711a3fda83990d71ed
bigcode/the-stack
train
bb0153dfed9b6bd058085c93
train
function
def setup_logging(kwargs, default_config=None, formatter_defaults=None): import mozlog from wptrunner import wptrunner global logger # Use the grouped formatter by default where mozlog 3.9+ is installed if default_config is None: if hasattr(mozlog.formatters, "GroupingFormatter"): ...
def setup_logging(kwargs, default_config=None, formatter_defaults=None):
import mozlog from wptrunner import wptrunner global logger # Use the grouped formatter by default where mozlog 3.9+ is installed if default_config is None: if hasattr(mozlog.formatters, "GroupingFormatter"): default_formatter = "grouped" else: default_forma...
river": ServoWebDriver, "sauce": Sauce, "opera": Opera, "webkit": WebKit, "webkitgtk_minibrowser": WebKitGTKMiniBrowser, "epiphany": Epiphany, } def setup_logging(kwargs, default_config=None, formatter_defaults=None):
64
64
129
13
51
CanonMukai/wpt
tools/wpt/run.py
Python
setup_logging
setup_logging
654
669
654
654
ab48298f69cf61b199c8529060589ddd902f1cb5
bigcode/the-stack
train
71113a017c5e4ab8e0e69c29
train
class
class AndroidWebview(BrowserSetup): name = "android_webview" browser_cls = browser.AndroidWebview def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_binary is None: install = s...
class AndroidWebview(BrowserSetup):
name = "android_webview" browser_cls = browser.AndroidWebview def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_binary is None: install = self.prompt_install("chromedriver") ...
iOS(BrowserSetup): name = "chrome_ios" browser_cls = browser.ChromeiOS def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: raise WptrunError("Unable to locate or install chromedriver binary") class AndroidWebview(BrowserSetup):
64
64
150
8
56
CanonMukai/wpt
tools/wpt/run.py
Python
AndroidWebview
AndroidWebview
396
416
396
396
baef7ddb73eb4481809edcda01cdada37ad5d2e0
bigcode/the-stack
train
29c7489f9e3f8fdc601eab0b
train
function
def args_general(kwargs): kwargs.set_if_none("tests_root", wpt_root) kwargs.set_if_none("metadata_root", wpt_root) kwargs.set_if_none("manifest_update", True) kwargs.set_if_none("manifest_download", True) if kwargs["ssl_type"] in (None, "pregenerated"): cert_root = os.path.join(wpt_root, "t...
def args_general(kwargs):
kwargs.set_if_none("tests_root", wpt_root) kwargs.set_if_none("metadata_root", wpt_root) kwargs.set_if_none("manifest_update", True) kwargs.set_if_none("manifest_download", True) if kwargs["ssl_type"] in (None, "pregenerated"): cert_root = os.path.join(wpt_root, "tools", "certs") if...
development release. (For WebDriver ' 'installs, we attempt to select an appropriate, compatible version for ' 'the latest browser release on the selected channel.) ' 'This flag overrides --browser-channel.') parser._add_container_actions(wptc...
97
97
324
5
92
CanonMukai/wpt
tools/wpt/run.py
Python
args_general
args_general
76
105
76
76
27c613448b6aa06d611642333156d74f8994512e
bigcode/the-stack
train
aa460ea9cc00c2f841fa2429
train
class
class ChromeiOS(BrowserSetup): name = "chrome_ios" browser_cls = browser.ChromeiOS def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: raise WptrunError("Unable to locate or install chromedriver binary")
class ChromeiOS(BrowserSetup):
name = "chrome_ios" browser_cls = browser.ChromeiOS def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: raise WptrunError("Unable to locate or install chromedriver binary")
/Canary") kwargs["binary_args"].append("--enable-experimental-web-platform-features") # HACK(Hexcles): work around https://github.com/web-platform-tests/wpt/issues/16448 kwargs["webdriver_args"].append("--disable-build-check") class ChromeiOS(BrowserSetup):
64
64
58
8
56
CanonMukai/wpt
tools/wpt/run.py
Python
ChromeiOS
ChromeiOS
387
393
387
387
3cfce7c2eefb5e317097361ab7b6c9a7019c21f4
bigcode/the-stack
train
ba2b9e92c33dc84cdd8983f1
train
class
class WebKit(BrowserSetup): name = "webkit" browser_cls = browser.WebKit def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): pass
class WebKit(BrowserSetup):
name = "webkit" browser_cls = browser.WebKit def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): pass
, None) if binary is None: raise WptrunError("Unable to find servo binary in PATH") kwargs["binary"] = binary class ServoWebDriver(Servo): name = "servodriver" browser_cls = browser.ServoWebDriver class WebKit(BrowserSetup):
64
64
46
7
56
CanonMukai/wpt
tools/wpt/run.py
Python
WebKit
WebKit
575
583
575
575
e551b93575aecea65db61b76834087ab8bac79f8
bigcode/the-stack
train
b9842462e4a73dcb8b39782c
train
class
class ChromeAndroid(BrowserSetup): name = "chrome_android" browser_cls = browser.ChromeAndroid def setup_kwargs(self, kwargs): browser_channel = kwargs["browser_channel"] if kwargs["package_name"] is None: kwargs["package_name"] = self.browser.find_binary( channe...
class ChromeAndroid(BrowserSetup):
name = "chrome_android" browser_cls = browser.ChromeAndroid def setup_kwargs(self, kwargs): browser_channel = kwargs["browser_channel"] if kwargs["package_name"] is None: kwargs["package_name"] = self.browser.find_binary( channel=browser_channel) if kwarg...
in ("dev", "canary"): logger.info("Automatically turning on experimental features for Chrome Dev/Canary") kwargs["binary_args"].append("--enable-experimental-web-platform-features") # HACK(Hexcles): work around https://github.com/web-platform-tests/wpt/issues/16448 kwarg...
83
83
277
7
76
CanonMukai/wpt
tools/wpt/run.py
Python
ChromeAndroid
ChromeAndroid
352
384
352
352
ec0723c849d1eb94a2d6860a646348bfd2079350
bigcode/the-stack
train
6eb5addf51ded6af1b3e3281
train
function
def exit(msg=None): if msg: logger.critical(msg) sys.exit(1) else: sys.exit(0)
def exit(msg=None):
if msg: logger.critical(msg) sys.exit(1) else: sys.exit(0)
(For WebDriver ' 'installs, we attempt to select an appropriate, compatible version for ' 'the latest browser release on the selected channel.) ' 'This flag overrides --browser-channel.') parser._add_container_actions(wptcommandline.create_par...
64
64
30
5
58
CanonMukai/wpt
tools/wpt/run.py
Python
exit
exit
68
73
68
68
7e62a84521025cf0f4d90835cfdec50ac5a0d758
bigcode/the-stack
train
233c1d5b3c802b4d3ac09e4f
train
class
class InternetExplorer(BrowserSetup): name = "ie" browser_cls = browser.InternetExplorer def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() ...
class InternetExplorer(BrowserSetup):
name = "ie" browser_cls = browser.InternetExplorer def install(self, channel=None): raise NotImplementedError def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: webdriver_binary = self.browser.find_webdriver() if webdriver_binary is None: ...
somewhere on the %PATH%: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ """) kwargs["webdriver_binary"] = webdriver_binary class EdgeWebDriver(Edge): name = "edge_webdriver" browser_cls = browser.EdgeWebDriver class InternetExplorer(BrowserSetup):
64
64
143
7
56
CanonMukai/wpt
tools/wpt/run.py
Python
InternetExplorer
InternetExplorer
502
520
502
502
fc9c86242d7c96f230a9b8f07aa215a0823d2ae8
bigcode/the-stack
train
20183de447dab61b2b1f2332
train
class
class TelaMagia(TelaGenerica): def __init__(self, controlador): super(TelaMagia, self).__init__(controlador) self.init_components() def init_components(self): sg.ChangeLookAndFeel('Reddit') layout = [ [sg.Button('Nova magia', key='NOVA_MAGIA')], [sg.Butto...
class TelaMagia(TelaGenerica):
def __init__(self, controlador): super(TelaMagia, self).__init__(controlador) self.init_components() def init_components(self): sg.ChangeLookAndFeel('Reddit') layout = [ [sg.Button('Nova magia', key='NOVA_MAGIA')], [sg.Button('Alterar magia', key='ALTERA_...
from limite.telaGenerica import TelaGenerica import PySimpleGUI as sg class TelaMagia(TelaGenerica):
27
64
144
9
17
Castagnna/dungeons-and-dragons
limite/telaMagia.py
Python
TelaMagia
TelaMagia
5
19
5
5
c7e3b2c91914530ded67dcc493a747c4fca4c434
bigcode/the-stack
train
a08fc03cfea6006c1f08cc78
train
function
def run_suite(): unittest.TextTestRunner(verbosity=2).run(create_suite())
def run_suite():
unittest.TextTestRunner(verbosity=2).run(create_suite())
"unittests/reopen_cache_tester.py"], stdout=subprocess.PIPE, env=env) print(p.stdout.read()) p.wait() p.stdout.close() def create_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test)) return suite def run_suite():
64
64
18
4
59
iMichka/pygccxml
unittests/file_cache_tester.py
Python
run_suite
run_suite
114
115
114
114
211adb9d295465cc5ea5a442877359484ee692c7
bigcode/the-stack
train
8c473811ab8ac8a9b3bb6a89
train
function
def create_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test)) return suite
def create_suite():
suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test)) return suite
_START"] = path + "/../.coveragerc" p = subprocess.Popen( [sys.executable, "unittests/reopen_cache_tester.py"], stdout=subprocess.PIPE, env=env) print(p.stdout.read()) p.wait() p.stdout.close() def create_suite():
64
64
24
4
60
iMichka/pygccxml
unittests/file_cache_tester.py
Python
create_suite
create_suite
108
111
108
108
2f27a9b703d2d86a80227cca6b5ad0794f80d436
bigcode/the-stack
train
c3edf4bb13d42e2b2df932e3
train
class
class Test(parser_test_case.parser_test_case_t): COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE def __init__(self, *args): parser_test_case.parser_test_case_t.__init__(self, *args) self.header = os.path.join(autoconfig.data_directory, 'core_cache.hpp') self.cache_file = os.path....
class Test(parser_test_case.parser_test_case_t):
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE def __init__(self, *args): parser_test_case.parser_test_case_t.__init__(self, *args) self.header = os.path.join(autoconfig.data_directory, 'core_cache.hpp') self.cache_file = os.path.join( autoconfig.data_directory, ...
# Copyright 2014-2017 Insight Software Consortium. # Copyright 2004-2009 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. # See http://www.boost.org/LICENSE_1_0.txt import os import sys import unittest import autoconfig import subprocess import parser_test_case from pygccxml import parser ...
93
199
665
10
82
iMichka/pygccxml
unittests/file_cache_tester.py
Python
Test
Test
15
105
15
15
9c2354b6d8507be84ecf627f33b73ee5b24f0ae7
bigcode/the-stack
train
85d76d6d67d17bfd0ce33cc3
train
function
def test_getsubstruct(): def f(i): s = "hello" return s[i] # does not crash t, adi, graph = build_adi(f, [int])
def test_getsubstruct():
def f(i): s = "hello" return s[i] # does not crash t, adi, graph = build_adi(f, [int])
0].result state = adi.getstate(avar) assert not state.does_escape() def test_call_external(): import time def f(): return time.time() #does not crash t, adi, graph = build_adi(f, []) def test_getsubstruct():
64
64
43
6
58
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_getsubstruct
test_getsubstruct
354
359
354
354
09bc8cb34144ca43d2a82879e3bb4d3a8d07a18e
bigcode/the-stack
train
c278c2487e8b6092e739c1f0
train
function
def test_big(): from pypy.translator.goal.targetrpystonex import make_target_definition entrypoint, _, _ = make_target_definition(10) # does not crash t, adi, graph = build_adi(entrypoint, [int])
def test_big():
from pypy.translator.goal.targetrpystonex import make_target_definition entrypoint, _, _ = make_target_definition(10) # does not crash t, adi, graph = build_adi(entrypoint, [int])
(): a = ValueError() raise a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert state.does_escape() assert state.does_change() def test_big():
64
64
56
4
60
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_big
test_big
384
388
384
384
c4fd957e9cd20e552b52fb01ca963abd15743b72
bigcode/the-stack
train
d852c940017f3177e0a45d3b
train
function
def test_global(): class A(object): pass globala = A() def f(): a = A() a.next = None globala.next = a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = st...
def test_global():
class A(object): pass globala = A() def f(): a = A() a.next = None globala.next = a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points...
assert not crep.escapes avarinloop = graph.startblock.exits[0].target.inputargs[1] state1 = adi.getstate(avarinloop) assert crep in state1.creation_points assert len(state1.creation_points) == 2 def test_global():
64
64
112
4
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_global
test_global
97
111
97
97
f2542915292d2be8ba7a66d87044017461d1ce8b
bigcode/the-stack
train
50d9f485f3a6617384ffdb66
train
function
def test_loop(): class A(object): pass def f(): a = A() i = 0 while i < 3: a.x = i a = A() i += 1 return a.x t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert...
def test_loop():
class A(object): pass def f(): a = A() i = 0 while i < 3: a.x = i a = A() i += 1 return a.x t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creati...
tvar = graph.startblock.operations[0].result state = adi.getstate(tvar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.changes assert not crep.escapes def test_loop():
64
64
181
4
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_loop
test_loop
74
95
74
74
044739555c73a149208b6f9813da9b734c80584d
bigcode/the-stack
train
6939cbd9469a62ad58f74ece
train
function
def test_getarraysubstruct(): def createdict(i, j): d = {2 : 23, 3 : 21} return d[i] + d[j] # does not crash, for now t, adi, graph = build_adi(createdict, [int, int]) dvar = graph.startblock.operations[0].result dstate = adi.getstate(dvar) assert dstate.does_change(...
def test_getarraysubstruct():
def createdict(i, j): d = {2 : 23, 3 : 21} return d[i] + d[j] # does not crash, for now t, adi, graph = build_adi(createdict, [int, int]) dvar = graph.startblock.operations[0].result dstate = adi.getstate(dvar) assert dstate.does_change() assert not dstate.does_e...
t, adi, graph = build_adi(f, []) def test_getsubstruct(): def f(i): s = "hello" return s[i] # does not crash t, adi, graph = build_adi(f, [int]) def test_getarraysubstruct():
64
64
107
7
57
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_getarraysubstruct
test_getarraysubstruct
361
371
361
361
970fda2241cc2d0d225f9ef8791301a815c96270
bigcode/the-stack
train
e468b605573a5eb6ed8ac767
train
function
def test_raise_escapes(): def f(): a = ValueError() raise a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert state.does_escape() assert state.does_change()
def test_raise_escapes():
def f(): a = ValueError() raise a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert state.does_escape() assert state.does_change()
t, adi, graph = build_adi(createdict, [int, int]) dvar = graph.startblock.operations[0].result dstate = adi.getstate(dvar) assert dstate.does_change() assert not dstate.does_escape() def test_raise_escapes():
64
64
70
7
57
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_raise_escapes
test_raise_escapes
373
381
373
373
c3c656ed97cb400235497aba71653fe1927f55aa
bigcode/the-stack
train
d8da2d32c745253f01a5a2c8
train
function
def build_adi(function, types): t = TranslationContext() t.buildannotator().build_types(function, types) t.buildrtyper().specialize() if conftest.option.view: t.view() adi = AbstractDataFlowInterpreter(t) graph = graphof(t, function) adi.schedule_function(graph) adi.complete() ...
def build_adi(function, types):
t = TranslationContext() t.buildannotator().build_types(function, types) t.buildrtyper().specialize() if conftest.option.view: t.view() adi = AbstractDataFlowInterpreter(t) graph = graphof(t, function) adi.schedule_function(graph) adi.complete() return t, adi, graph
FlowInterpreter, malloc_to_stack from pypy.translator.backendopt.support import find_backedges, find_loop_blocks from pypy.rpython.llinterp import LLInterpreter from pypy.rlib.objectmodel import instantiate from pypy import conftest import py def build_adi(function, types):
64
64
84
8
55
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
build_adi
build_adi
10
20
10
10
50f3ab397b8fe7d5f8461802d81d438730541e36
bigcode/the-stack
train
30de0b6a2c9268e41d26e5df
train
function
def test_indirect_call_unknown_graphs(): class A: pass class B: pass def f(i): if i: klass = A else: klass = B a = instantiate(klass) # does not crash t, adi, graph = build_adi(f, [int])
def test_indirect_call_unknown_graphs():
class A: pass class B: pass def f(i): if i: klass = A else: klass = B a = instantiate(klass) # does not crash t, adi, graph = build_adi(f, [int])
_points.keys()[0] a2crep = a2state.creation_points.keys()[0] assert a1crep.changes and a2crep.changes assert not a1crep.escapes and a2crep.escapes def test_indirect_call_unknown_graphs():
64
64
73
9
54
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_indirect_call_unknown_graphs
test_indirect_call_unknown_graphs
303
315
303
303
d4983d131672099eedb668d89e0584cbdc3b3d5b
bigcode/the-stack
train
2f60cf92b5ea72cb832953ee
train
function
def test_dont_alloca_in_loops(): class A(object): pass def f(x): result = 0 for i in range(x): a = A() a.i = i result += a.i return result t = check_malloc_removal(f, [int], [3], 3, must_remove=False) graph = graphof(t, f) assert gr...
def test_dont_alloca_in_loops():
class A(object): pass def f(x): result = 0 for i in range(x): a = A() a.i = i result += a.i return result t = check_malloc_removal(f, [int], [3], 3, must_remove=False) graph = graphof(t, f) assert graph.startblock.exits[0].target.ex...
A(object): pass def g(b): return b.i + 2 def f(): a = A() a.i = 2 return g(a) t = check_malloc_removal(f, [], [], 4) def test_dont_alloca_in_loops():
64
64
115
10
54
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_dont_alloca_in_loops
test_dont_alloca_in_loops
455
467
455
455
54ba94a7c3158552f52329fc17fcea0f395752f3
bigcode/the-stack
train
881e2640d64212d175eea0c7
train
function
def test_branch(): class T: pass def fn2(x, y): t = T() t.x = x t.y = y if x > 0: return t.x + t.y else: return t.x - t.y t, adi, graph = build_adi(fn2, [int, int]) tvar = graph.startblock.operations[0].result state = adi.getsta...
def test_branch():
class T: pass def fn2(x, y): t = T() t.x = x t.y = y if x > 0: return t.x + t.y else: return t.x - t.y t, adi, graph = build_adi(fn2, [int, int]) tvar = graph.startblock.operations[0].result state = adi.getstate(tvar) assert...
avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.changes assert not crep.escapes def test_branch():
64
64
140
4
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_branch
test_branch
55
72
55
55
2aea68651d0b04edc06a1b0ed06a08fa0513e07e
bigcode/the-stack
train
0555ee8e8853e66643a417c6
train
function
def test_remove_aliasing(): class A: pass def fn6(n): a1 = A() a1.x = 5 a2 = A() a2.x = 6 if n > 0: a = a1 else: a = a2 a.x = 12 return a1.x t = check_malloc_removal(fn6, [int], [2], 12)
def test_remove_aliasing():
class A: pass def fn6(n): a1 = A() a1.x = 5 a2 = A() a2.x = 6 if n > 0: a = a1 else: a = a2 a.x = 12 return a1.x t = check_malloc_removal(fn6, [int], [2], 12)
oes_escape() #__________________________________________________________ # malloc removal tests def test_remove_simple(): class A(object): pass def f(): a = A() a.x = 1 return a.x check_malloc_removal(f, [], [], 1) def test_remove_aliasing():
64
64
101
6
58
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_remove_aliasing
test_remove_aliasing
428
442
428
428
690d27a669dd220e6668c83f50c9d41c6df22f8d
bigcode/the-stack
train
930f3f16d84f74ab267ff0c2
train
function
def test_extfunc_resultonheap(): py.test.skip("not a valid test anymore") import os def f(i): s = str(i) return len(s) t, adi, graph = build_adi(f, [float]) svar = graph.startblock.operations[0].result state = adi.getstate(svar) assert not state.does_escape()
def test_extfunc_resultonheap():
py.test.skip("not a valid test anymore") import os def f(i): s = str(i) return len(s) t, adi, graph = build_adi(f, [float]) svar = graph.startblock.operations[0].result state = adi.getstate(svar) assert not state.does_escape()
return len(s) t, adi, graph = build_adi(f, [int]) svar = graph.startblock.operations[0].result state = adi.getstate(svar) assert not state.does_escape() assert state.does_change() def test_extfunc_resultonheap():
63
64
83
8
55
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_extfunc_resultonheap
test_extfunc_resultonheap
403
412
403
403
3c552e2ca754d60faee8032a99b3fb1897d15701
bigcode/the-stack
train
0242b04158effb96aa315370
train
function
def test_dont_remove_del_objects(): class A(object): def __del__(self): pass def f(): a = A() a.i = 1 return a.i t = check_malloc_removal(f, [], [], 1, must_remove=False) graph = graphof(t, f) assert graph.startblock.operations[0].opname == "malloc...
def test_dont_remove_del_objects():
class A(object): def __del__(self): pass def f(): a = A() a.i = 1 return a.i t = check_malloc_removal(f, [], [], 1, must_remove=False) graph = graphof(t, f) assert graph.startblock.operations[0].opname == "malloc"
= check_malloc_removal(f, [int], [3], 3, must_remove=False) graph = graphof(t, f) assert graph.startblock.exits[0].target.exits[0].target.operations[0].opname == "malloc" def test_dont_remove_del_objects():
64
64
86
8
56
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_dont_remove_del_objects
test_dont_remove_del_objects
469
479
469
469
3a4b170641150ae7998686d70de1cbdb8c93d362
bigcode/the-stack
train
8246f3993303ef43161e5f34
train
function
def test_classattrs(): class A: attr = 666 class B(A): attr = 42 def fn5(): b = B() return b.attr t, adi, graph = build_adi(fn5, []) bvar = graph.startblock.operations[0].result state = adi.getstate(bvar) assert len(state.creation_points) == 1 crep = state...
def test_classattrs():
class A: attr = 666 class B(A): attr = 42 def fn5(): b = B() return b.attr t, adi, graph = build_adi(fn5, []) bvar = graph.startblock.operations[0].result state = adi.getstate(bvar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()...
avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.changes assert crep.escapes def test_classattrs():
64
64
115
5
58
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_classattrs
test_classattrs
113
127
113
113
dc885fe5ef5145044f27fda140f05c3171ea60c1
bigcode/the-stack
train
6e7393a9b1677673069b6d64
train
function
def test_dependencies(): class A(object): pass globala = A() globala.l = [1] def g(a): a.append(1) globala.l = a def f(): a = [0] a.append(1) # g(a) return globala.l[0] t, adi, graph = build_adi(f, []) avar = graph.startblock.operations...
def test_dependencies():
class A(object): pass globala = A() globala.l = [1] def g(a): a.append(1) globala.l = a def f(): a = [0] a.append(1) # g(a) return globala.l[0] t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result astate = a...
.keys()[0] assert not bcrep.changes assert not bcrep.escapes avar = graph.startblock.operations[0].result astate = adi.getstate(avar) assert len(astate.creation_points) == 1 acrep = astate.creation_points.keys()[0] assert acrep.changes assert not acrep.escapes def test_dependencies():
90
90
302
4
85
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_dependencies
test_dependencies
175
203
175
175
c983d5ec12db17e80d323bcacec718ebffe288ed
bigcode/the-stack
train
565addbe9e84753bd1421d36
train
function
def test_remove_call(): class A(object): pass def g(b): return b.i + 2 def f(): a = A() a.i = 2 return g(a) t = check_malloc_removal(f, [], [], 4)
def test_remove_call():
class A(object): pass def g(b): return b.i + 2 def f(): a = A() a.i = 2 return g(a) t = check_malloc_removal(f, [], [], 4)
.x = 6 if n > 0: a = a1 else: a = a2 a.x = 12 return a1.x t = check_malloc_removal(fn6, [int], [2], 12) def test_remove_call():
64
64
61
5
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_remove_call
test_remove_call
444
453
444
444
dc47b469c36e795caed9d796c1f9fe65b624ff2a
bigcode/the-stack
train
47674c5d485a571ceeac5b3e
train
function
def test_remove_simple(): class A(object): pass def f(): a = A() a.x = 1 return a.x check_malloc_removal(f, [], [], 1)
def test_remove_simple():
class A(object): pass def f(): a = A() a.x = 1 return a.x check_malloc_removal(f, [], [], 1)
) return len(s) t, adi, graph = build_adi(f, [float]) svar = graph.startblock.operations[0].result state = adi.getstate(svar) assert not state.does_escape() #__________________________________________________________ # malloc removal tests def test_remove_simple():
64
64
46
5
58
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_remove_simple
test_remove_simple
419
426
419
419
dfb715da80d615afc1f4080fe4bbc9ce4444a79e
bigcode/the-stack
train
51ffed56c979c6459b10795f
train
function
def check_malloc_removal(function, types, args, expected_result, must_remove=True): t = TranslationContext() t.buildannotator().build_types(function, types) t.buildrtyper().specialize() interp = LLInterpreter(t.rtyper) graph = graphof(t, function) res = interp.eval_graph(graph, args) assert ...
def check_malloc_removal(function, types, args, expected_result, must_remove=True):
t = TranslationContext() t.buildannotator().build_types(function, types) t.buildrtyper().specialize() interp = LLInterpreter(t.rtyper) graph = graphof(t, function) res = interp.eval_graph(graph, args) assert res == expected_result malloc_to_stack(t) if must_remove: for block ...
conftest.option.view: t.view() adi = AbstractDataFlowInterpreter(t) graph = graphof(t, function) adi.schedule_function(graph) adi.complete() return t, adi, graph def check_malloc_removal(function, types, args, expected_result, must_remove=True):
64
64
154
18
45
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
check_malloc_removal
check_malloc_removal
22
38
22
22
48f5ce001c3d2ec3b74fa53c94091f4be4b370c9
bigcode/the-stack
train
d97eb4420ed595cb8063c561
train
function
def test_simple(): class A(object): pass def f(): a = A() a.x = 1 return a.x t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] ...
def test_simple():
class A(object): pass def f(): a = A() a.x = 1 return a.x t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.cha...
for block in graph.iterblocks(): for op in block.operations: if op.opname == "malloc": assert op.args[1].value['flavor'] == 'stack' res = interp.eval_graph(graph, args) assert res == expected_result return t def test_simple():
64
64
106
4
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_simple
test_simple
40
53
40
40
e82012e44c7baae9cd34de00268cccbe7000e47e
bigcode/the-stack
train
8a11570ce5584cf069c5af0a
train
function
def test_call_external(): import time def f(): return time.time() #does not crash t, adi, graph = build_adi(f, [])
def test_call_external():
import time def f(): return time.time() #does not crash t, adi, graph = build_adi(f, [])
+ 2 t, adi, graph = build_adi(f, []) avar = graph.startblock.exits[0].target.exits[1].target.operations[0].result state = adi.getstate(avar) assert not state.does_escape() def test_call_external():
64
64
37
5
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_call_external
test_call_external
347
352
347
347
e41fafae13b68662b83aee9726ab07559e04e74b
bigcode/the-stack
train
64c39d123a5aeab34849cd00
train
function
def test_getarray(): class A(object): pass def f(): a = A() l = [None] l[0] = a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[...
def test_getarray():
class A(object): pass def f(): a = A() l = [None] l[0] = a t, adi, graph = build_adi(f, []) avar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.ch...
pass class B: pass def f(i): if i: klass = A else: klass = B a = instantiate(klass) # does not crash t, adi, graph = build_adi(f, [int]) def test_getarray():
64
64
108
5
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_getarray
test_getarray
317
330
317
317
2ebd83e1caf7d015353dd5b967b60462dfb10ac4
bigcode/the-stack
train
40f85f4a5f28882cb054f3ee
train
function
def test_flow_blocksonce(): class A(object): pass def f(): a = 0 for i in range(10): a += i b = A() b.x = 1 return b.x + 2 t, adi, graph = build_adi(f, []) avar = graph.startblock.exits[0].target.exits[1].target.operations[0].result state =...
def test_flow_blocksonce():
class A(object): pass def f(): a = 0 for i in range(10): a += i b = A() b.x = 1 return b.x + 2 t, adi, graph = build_adi(f, []) avar = graph.startblock.exits[0].target.exits[1].target.operations[0].result state = adi.getstate(avar) asse...
ar = graph.startblock.operations[0].result state = adi.getstate(avar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.changes assert crep.escapes def test_flow_blocksonce():
64
64
113
7
56
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_flow_blocksonce
test_flow_blocksonce
332
345
332
332
a9dc01d321f8a9a6d8e4123ae12591b0fb2c3d36
bigcode/the-stack
train
01ef02e254934c7b4a5d44a3
train
function
def test_aliasing(): class A: pass def fn6(n): a1 = A() a1.x = 5 a2 = A() a2.x = 6 if n > 0: a = a1 else: a = a2 a.x = 12 return a1.x t, adi, graph = build_adi(fn6, [int]) avar = graph.startblock.exits[0].tar...
def test_aliasing():
class A: pass def fn6(n): a1 = A() a1.x = 5 a2 = A() a2.x = 6 if n > 0: a = a1 else: a = a2 a.x = 12 return a1.x t, adi, graph = build_adi(fn6, [int]) avar = graph.startblock.exits[0].target.inputargs[1] ...
bvar = graph.startblock.operations[0].result state = adi.getstate(bvar) assert len(state.creation_points) == 1 crep = state.creation_points.keys()[0] assert crep.changes assert not crep.escapes def test_aliasing():
64
64
161
5
58
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_aliasing
test_aliasing
129
149
129
129
6661e4a77e460b351ad96c4092b893bc15fb34cc
bigcode/the-stack
train
849a356cf4506d42d2b89e95
train
function
def test_call(): class A(object): pass def g(b): return b.i + 2 def f(): a = A() a.i = 2 return g(a) t, adi, graph = build_adi(f, []) g_graph = graphof(t, g) bvar = g_graph.startblock.inputargs[0] bstate = adi.getstate(bvar) assert len(bstate.creat...
def test_call():
class A(object): pass def g(b): return b.i + 2 def f(): a = A() a.i = 2 return g(a) t, adi, graph = build_adi(f, []) g_graph = graphof(t, g) bvar = g_graph.startblock.inputargs[0] bstate = adi.getstate(bvar) assert len(bstate.creation_points) == 1 ...
graph.startblock.exits[0].target.inputargs[1] state = adi.getstate(avar) assert len(state.creation_points) == 2 for crep in state.creation_points.keys(): assert crep.changes assert not crep.escapes def test_call():
64
64
199
4
59
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_call
test_call
151
173
151
151
2222ddbfaa2091d3235510ad4ad8eb511201642c
bigcode/the-stack
train
81159473f51ff9c727f93845
train
function
def test_extfunc_onheaparg(): py.test.skip("not a valid test anymore") import os def f(i): s = str(i) os.write(2, s) return len(s) t, adi, graph = build_adi(f, [int]) svar = graph.startblock.operations[0].result state = adi.getstate(svar) assert not state.does_escape(...
def test_extfunc_onheaparg():
py.test.skip("not a valid test anymore") import os def f(i): s = str(i) os.write(2, s) return len(s) t, adi, graph = build_adi(f, [int]) svar = graph.startblock.operations[0].result state = adi.getstate(svar) assert not state.does_escape() assert state.does_change...
def test_big(): from pypy.translator.goal.targetrpystonex import make_target_definition entrypoint, _, _ = make_target_definition(10) # does not crash t, adi, graph = build_adi(entrypoint, [int]) def test_extfunc_onheaparg():
64
64
98
8
56
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_extfunc_onheaparg
test_extfunc_onheaparg
390
401
390
390
9bb93ead5b67a473d8860da6a0fa1ffe1805dd07
bigcode/the-stack
train
c06ddf5305b61f3391da5e2d
train
function
def test_multiple_calls(): class A(object): pass def h(a, b): a.x = 1 return b def g(a, b): return h(b, a) def f(): a1 = A() a2 = A() a3 = A() a4 = h(a1, a2) a5 = g(a3, a4) t, adi, graph = build_adi(f, []) a1var = graph.star...
def test_multiple_calls():
class A(object): pass def h(a, b): a.x = 1 return b def g(a, b): return h(b, a) def f(): a1 = A() a2 = A() a3 = A() a4 = h(a1, a2) a5 = g(a3, a4) t, adi, graph = build_adi(f, []) a1var = graph.startblock.operations[0].result...
.creation_points) == 1 a0crep = a0state.creation_points.keys()[0] assert not a0crep.escapes assert a0crep.changes assert len(b0state.creation_points) == 1 b0crep = b0state.creation_points.keys()[0] assert b0crep.escapes assert b0crep.changes def test_multiple_calls():
94
94
314
5
88
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_multiple_calls
test_multiple_calls
233
261
233
233
f1f4647b1d1c524cb189856d40821a1dfac421f0
bigcode/the-stack
train
4666588525a107e8767eab4e
train
function
def test_substruct(): class A(object): pass class B(object): pass def g(a, b): a.b = b a.b.x = 1 return a.b def f(): a0 = A() b0 = B() return g(a0, b0).x t, adi, graph = build_adi(f, []) g_graph = graphof(t, g) a0var = graph.sta...
def test_substruct():
class A(object): pass class B(object): pass def g(a, b): a.b = b a.b.x = 1 return a.b def f(): a0 = A() b0 = B() return g(a0, b0).x t, adi, graph = build_adi(f, []) g_graph = graphof(t, g) a0var = graph.startblock.operations[0]....
args[0].value._obj.graph reallyarg0 = reallygraph.startblock.inputargs[0] reallystate = adi.getstate(reallyarg0) assert reallystate.does_change() assert resizestate.does_change() assert appendstate.does_change() assert astate.does_change() def test_substruct():
73
73
244
5
68
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_substruct
test_substruct
205
231
205
205
c611cebe5e804a4cb1fc2f44a188615b386eacb3
bigcode/the-stack
train
3e14fd25604c192c8ad965c0
train
function
def test_indirect_call(): class A(object): pass def f1(a): return a.x def f2(a): return a.x + 1 def g1(a): return a def g2(a): return None def f(i): a1 = A() a2 = A() a1.x = 1 a2.x = 2 if i: f = f1 ...
def test_indirect_call():
class A(object): pass def f1(a): return a.x def f2(a): return a.x + 1 def g1(a): return a def g2(a): return None def f(i): a1 = A() a2 = A() a1.x = 1 a2.x = 2 if i: f = f1 g = g1 else:...
1state.creation_points.keys()[0] a2crep = a2state.creation_points.keys()[0] a3crep = a3state.creation_points.keys()[0] assert a1crep.changes and a2crep.changes and a3crep.changes assert not a1crep.escapes and a2crep.escapes and a3crep.escapes def test_indirect_call():
94
94
316
6
87
camillobruni/pygirl
pypy/translator/backendopt/test/test_escape.py
Python
test_indirect_call
test_indirect_call
263
301
263
263
7781488028ddf9c2a168b6a2d6c189704b1ba1e5
bigcode/the-stack
train
29909fd60b7d5b561ee70ad6
train
function
@jsonschema.FormatChecker.cls_checks('uri') def _validate_uri(instance): return rfc3986.is_valid_uri(instance, require_scheme=True, require_authority=True)
@jsonschema.FormatChecker.cls_checks('uri') def _validate_uri(instance):
return rfc3986.is_valid_uri(instance, require_scheme=True, require_authority=True)
return False if re.search('\s', cidr): return False return True @jsonschema.FormatChecker.cls_checks('uuid') def _validate_uuid_format(instance): return uuidutils.is_uuid_like(instance) @jsonschema.FormatChecker.cls_checks('uri') def _validate_uri(instance):
64
64
37
16
48
panguan737/nova
nova/api/validation/validators.py
Python
_validate_uri
_validate_uri
90
93
90
91
c3ca8b1145f5ec5aab8f5bbb865df290ac4dbbca
bigcode/the-stack
train
8a0e9ac101fdc641e60ed033
train
function
def _soft_validate_additional_properties(validator, additional_properties_value, instance, schema): """This validator function is used for legacy v2 compatible mode in v2.1. This will skip ...
def _soft_validate_additional_properties(validator, additional_properties_value, instance, schema):
"""This validator function is used for legacy v2 compatible mode in v2.1. This will skip all the additional properties checking but keep check the 'patternProperties'. 'patternProperties' is used for metadata API. If there are not any properties on the instance that are not specified in the schema,...
TypeError will be raised at here. pass raise exception.InvalidName(reason=regex.reason) @jsonschema.FormatChecker.cls_checks('cell_name', exception.InvalidName) def _validate_cell_name(instance): regex = parameter_types.valid_cell_name_regex try: if re.search(regex.regex, instance): ...
135
135
451
21
114
panguan737/nova
nova/api/validation/validators.py
Python
_soft_validate_additional_properties
_soft_validate_additional_properties
177
231
177
180
eb4da7b07460a781e2ef588256b1e9ef06220dad
bigcode/the-stack
train
c0871eaaba20388869f302dc
train
function
@jsonschema.FormatChecker.cls_checks('base64') def _validate_base64_format(instance): try: if isinstance(instance, six.text_type): instance = instance.encode('utf-8') base64.decodestring(instance) except base64.binascii.Error: return False except TypeError: # The ...
@jsonschema.FormatChecker.cls_checks('base64') def _validate_base64_format(instance):
try: if isinstance(instance, six.text_type): instance = instance.encode('utf-8') base64.decodestring(instance) except base64.binascii.Error: return False except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will ...
jsonschema.FormatChecker.cls_checks('date-time') def _validate_datetime_format(instance): try: timeutils.parse_isotime(instance) except ValueError: return False else: return True @jsonschema.FormatChecker.cls_checks('base64') def _validate_base64_format(instance):
64
64
102
19
44
panguan737/nova
nova/api/validation/validators.py
Python
_validate_base64_format
_validate_base64_format
56
69
56
57
2c8cdf4b304f095b5f5bd7f6c2f7a7bc8712643a
bigcode/the-stack
train
c0653ca92d95558505c4cd66
train
function
@jsonschema.FormatChecker.cls_checks('az_name', exception.InvalidName) def _validate_az_name(instance): regex = parameter_types.valid_az_name_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string typ...
@jsonschema.FormatChecker.cls_checks('az_name', exception.InvalidName) def _validate_az_name(instance):
regex = parameter_types.valid_az_name_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=r...
: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=regex.reason) @jsonschema.FormatChecker.cls_checks('az_name', exception.InvalidName) def _validate_az_name(instance):
64
64
95
23
41
panguan737/nova
nova/api/validation/validators.py
Python
_validate_az_name
_validate_az_name
137
147
137
138
628f6e7e824c6b8988644386b6301b90b6752d20
bigcode/the-stack
train
7666b7af3aa0b9203862e933
train
function
@jsonschema.FormatChecker.cls_checks('cell_name_with_leading_trailing_spaces', exception.InvalidName) def _validate_cell_name_with_leading_trailing_spaces(instance): regex = parameter_types.valid_cell_name_leading_trailing_spaces_regex try: if re.search(regex.regex, ...
@jsonschema.FormatChecker.cls_checks('cell_name_with_leading_trailing_spaces', exception.InvalidName) def _validate_cell_name_with_leading_trailing_spaces(instance):
regex = parameter_types.valid_cell_name_leading_trailing_spaces_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exce...
isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=regex.reason) @jsonschema.FormatChecker.cls_checks('cell_name_with_leading_trailing_spaces', exception.InvalidName) def _validate_cell_name_with_leading_trailing_s...
64
64
111
35
29
panguan737/nova
nova/api/validation/validators.py
Python
_validate_cell_name_with_leading_trailing_spaces
_validate_cell_name_with_leading_trailing_spaces
150
161
150
152
fb71d117adc9479c17fd644504ee6e0fcc0d445c
bigcode/the-stack
train
630c4a7d7d011f88773c21b9
train
function
@jsonschema.FormatChecker.cls_checks('name_with_leading_trailing_spaces', exception.InvalidName) def _validate_name_with_leading_trailing_spaces(instance): regex = parameter_types.valid_name_leading_trailing_spaces_regex try: if re.search(regex.regex, instance): ...
@jsonschema.FormatChecker.cls_checks('name_with_leading_trailing_spaces', exception.InvalidName) def _validate_name_with_leading_trailing_spaces(instance):
regex = parameter_types.valid_name_leading_trailing_spaces_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception...
_checks('uri') def _validate_uri(instance): return rfc3986.is_valid_uri(instance, require_scheme=True, require_authority=True) @jsonschema.FormatChecker.cls_checks('name_with_leading_trailing_spaces', exception.InvalidName) def _validate_name_with...
64
64
108
33
31
panguan737/nova
nova/api/validation/validators.py
Python
_validate_name_with_leading_trailing_spaces
_validate_name_with_leading_trailing_spaces
96
107
96
98
e4a60be809bcec35074484b0994dd592e16c8645
bigcode/the-stack
train
fe26a8f6554b09e0df36a78e
train
class
class _SchemaValidator(object): """A validator class This class is changed from Draft4Validator to validate minimum/maximum value of a string number(e.g. '10'). This changes can be removed when we tighten up the API definition and the XML conversion. Also FormatCheckers are added for checking data ...
class _SchemaValidator(object):
"""A validator class This class is changed from Draft4Validator to validate minimum/maximum value of a string number(e.g. '10'). This changes can be removed when we tighten up the API definition and the XML conversion. Also FormatCheckers are added for checking data formats which would be passe...
When a custom checker has an exception, the FormatChecker will output a readable message provided by the checker. """ def check(self, instance, format): """Check whether the instance conforms to the given format. :argument instance: the instance to check :type: any primi...
230
230
768
6
224
panguan737/nova
nova/api/validation/validators.py
Python
_SchemaValidator
_SchemaValidator
269
358
269
269
9e869b87e4979f661df929032f4b7a99c924212d
bigcode/the-stack
train
b8d15610f7267223eb46d951
train
function
@jsonschema.FormatChecker.cls_checks('name', exception.InvalidName) def _validate_name(instance): regex = parameter_types.valid_name_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the ...
@jsonschema.FormatChecker.cls_checks('name', exception.InvalidName) def _validate_name(instance):
regex = parameter_types.valid_name_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=rege...
except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=regex.reason) @jsonschema.FormatChecker.cls_checks('name', exception.InvalidName) def _validate_name(instance):
64
64
90
20
44
panguan737/nova
nova/api/validation/validators.py
Python
_validate_name
_validate_name
110
120
110
111
694e5b3802fa053b3d75f7404cd6be77deb08b2e
bigcode/the-stack
train
ea9f77d5349d314736f5e34b
train
function
@jsonschema.FormatChecker.cls_checks('cidr') def _validate_cidr_format(cidr): try: netaddr.IPNetwork(cidr) except netaddr.AddrFormatError: return False if '/' not in cidr: return False if re.search('\s', cidr): return False return True
@jsonschema.FormatChecker.cls_checks('cidr') def _validate_cidr_format(cidr):
try: netaddr.IPNetwork(cidr) except netaddr.AddrFormatError: return False if '/' not in cidr: return False if re.search('\s', cidr): return False return True
return False except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. return False return True @jsonschema.FormatChecker.cls_checks('cidr') def _validate_cidr_format(cidr):
64
64
74
20
43
panguan737/nova
nova/api/validation/validators.py
Python
_validate_cidr_format
_validate_cidr_format
72
82
72
73
e1812a2c23723a5f4db5321600b2c2bfcb3ee73d
bigcode/the-stack
train
91f252ad461a699d5b633e86
train
function
@jsonschema.FormatChecker.cls_checks('uuid') def _validate_uuid_format(instance): return uuidutils.is_uuid_like(instance)
@jsonschema.FormatChecker.cls_checks('uuid') def _validate_uuid_format(instance):
return uuidutils.is_uuid_like(instance)
Network(cidr) except netaddr.AddrFormatError: return False if '/' not in cidr: return False if re.search('\s', cidr): return False return True @jsonschema.FormatChecker.cls_checks('uuid') def _validate_uuid_format(instance):
64
64
26
17
46
panguan737/nova
nova/api/validation/validators.py
Python
_validate_uuid_format
_validate_uuid_format
85
87
85
86
53fde662e2569f5db4453e80e0c0bdfa1fedd465
bigcode/the-stack
train
dd86a3b9cbea1aa39fdc7d8a
train
function
@jsonschema.FormatChecker.cls_checks('regex') def _validate_regex_format(instance): if not instance or not isinstance(instance, six.text_type): return False try: re.compile(instance) except re.error: return False return True
@jsonschema.FormatChecker.cls_checks('regex') def _validate_regex_format(instance):
if not instance or not isinstance(instance, six.text_type): return False try: re.compile(instance) except re.error: return False return True
netaddr from oslo_utils import timeutils from oslo_utils import uuidutils import rfc3986 import six from nova.api.validation import parameter_types from nova import exception from nova.i18n import _ @jsonschema.FormatChecker.cls_checks('regex') def _validate_regex_format(instance):
63
64
55
17
46
panguan737/nova
nova/api/validation/validators.py
Python
_validate_regex_format
_validate_regex_format
35
43
35
36
f9b7a01bd55ea5348d12ec076204662ba2d7c17a
bigcode/the-stack
train
4bf8cac6ed9bdd55c4c5dbd3
train
function
@jsonschema.FormatChecker.cls_checks('cell_name', exception.InvalidName) def _validate_cell_name(instance): regex = parameter_types.valid_cell_name_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't stri...
@jsonschema.FormatChecker.cls_checks('cell_name', exception.InvalidName) def _validate_cell_name(instance):
regex = parameter_types.valid_cell_name_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason...
Error: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=regex.reason) @jsonschema.FormatChecker.cls_checks('cell_name', exception.InvalidName) def _validate_cell_name(instance):
64
64
93
22
42
panguan737/nova
nova/api/validation/validators.py
Python
_validate_cell_name
_validate_cell_name
164
174
164
165
448f5d870819f9b0d39ce196def14870c42e7ea3
bigcode/the-stack
train
e7345220e1144424be35a719
train
function
@jsonschema.FormatChecker.cls_checks('az_name_with_leading_trailing_spaces', exception.InvalidName) def _validate_az_name_with_leading_trailing_spaces(instance): regex = parameter_types.valid_az_name_leading_trailing_spaces_regex try: if re.search(regex.regex, instan...
@jsonschema.FormatChecker.cls_checks('az_name_with_leading_trailing_spaces', exception.InvalidName) def _validate_az_name_with_leading_trailing_spaces(instance):
regex = parameter_types.valid_az_name_leading_trailing_spaces_regex try: if re.search(regex.regex, instance): return True except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. pass raise except...
string type, the # TypeError will be raised at here. pass raise exception.InvalidName(reason=regex.reason) @jsonschema.FormatChecker.cls_checks('az_name_with_leading_trailing_spaces', exception.InvalidName) def _validate_az_name_with_leading_trailing_spaces(inst...
64
64
113
36
28
panguan737/nova
nova/api/validation/validators.py
Python
_validate_az_name_with_leading_trailing_spaces
_validate_az_name_with_leading_trailing_spaces
123
134
123
125
a7873a92705b1bc2d21db3da2c3dd56f857354a1
bigcode/the-stack
train
3ef68d5044730265c1182764
train
class
class FormatChecker(jsonschema.FormatChecker): """A FormatChecker can output the message from cause exception We need understandable validation errors messages for users. When a custom checker has an exception, the FormatChecker will output a readable message provided by the checker. """ ...
class FormatChecker(jsonschema.FormatChecker):
"""A FormatChecker can output the message from cause exception We need understandable validation errors messages for users. When a custom checker has an exception, the FormatChecker will output a readable message provided by the checker. """ def check(self, instance, format): ...
if len(extra_properties) == 1: verb = "was" else: verb = "were" yield jsonschema_exc.ValidationError( error % (", ".join(repr(extra) for extra in extra_properties), verb)) else: for prop in extra_properties: del ins...
76
76
255
8
68
panguan737/nova
nova/api/validation/validators.py
Python
FormatChecker
FormatChecker
234
266
234
234
d6fd77e496ce6be1d91f41887d089332a9013f4d
bigcode/the-stack
train
279518307ef8dc30e7d2cad7
train
function
@jsonschema.FormatChecker.cls_checks('date-time') def _validate_datetime_format(instance): try: timeutils.parse_isotime(instance) except ValueError: return False else: return True
@jsonschema.FormatChecker.cls_checks('date-time') def _validate_datetime_format(instance):
try: timeutils.parse_isotime(instance) except ValueError: return False else: return True
') def _validate_regex_format(instance): if not instance or not isinstance(instance, six.text_type): return False try: re.compile(instance) except re.error: return False return True @jsonschema.FormatChecker.cls_checks('date-time') def _validate_datetime_format(instance):
64
64
46
18
45
panguan737/nova
nova/api/validation/validators.py
Python
_validate_datetime_format
_validate_datetime_format
46
53
46
47
554f5344ac895c41149f642ec2264f819f26d98d
bigcode/the-stack
train
34e6207f297b89de25fa6fbe
train
function
def get(): sock = socket.socket() sock.bind(('', 0)) _, port = sock.getsockname() sock.close() return port
def get():
sock = socket.socket() sock.bind(('', 0)) _, port = sock.getsockname() sock.close() return port
import socket def get():
6
64
34
3
2
whatArePeopleDownloading/getport
getport/__init__.py
Python
get
get
3
9
3
4
5272e01af1066d2e1688455348a855a002dcd5db
bigcode/the-stack
train
c3f29e6ad5403b6f2a5145e3
train
class
class ParametersLogger: """Logs parameter and run information throughout into a file during optimization. Parameters ---------- filepath: str or pathlib.Path the path to dump data to append: bool whether to append the file (otherwise it replaces it) order: int order ...
class ParametersLogger:
"""Logs parameter and run information throughout into a file during optimization. Parameters ---------- filepath: str or pathlib.Path the path to dump data to append: bool whether to append the file (otherwise it replaces it) order: int order of the internal/model pa...
: int max number of evaluation before performing another print print_interval_seconds: float max number of seconds before performing another print """ def __init__(self, print_interval_tells: int = 1, print_interval_seconds: float = 60.0) -> None: assert print_interval_tells > 0 ...
256
256
1,401
4
251
9-si/nevergrad
nevergrad/optimization/callbacks.py
Python
ParametersLogger
ParametersLogger
47
185
47
47
c89372f4bda4e853735545d421f06ad3ad332e73
bigcode/the-stack
train
a37e3745de14cc81bab0f9e2
train
class
class OptimizerDump: """Dumps the optimizer to a pickle file at every call. Parameters ---------- filepath: str or Path path to the pickle file """ def __init__(self, filepath: tp.Union[str, Path]) -> None: self._filepath = filepath def __call__(self, opt: base.Optimizer, ...
class OptimizerDump:
"""Dumps the optimizer to a pickle file at every call. Parameters ---------- filepath: str or Path path to the pickle file """ def __init__(self, filepath: tp.Union[str, Path]) -> None: self._filepath = filepath def __call__(self, opt: base.Optimizer, *args: tp.Any, **kwar...
': '#num-tell', 'axis_y': '#loss'}) # for the record, some more options: exp.display_data(hip.Displays.XY).update({'lines_thickness': 1.0, 'lines_opacity': 1.0}) return exp class OptimizerDump:
64
64
101
5
58
9-si/nevergrad
nevergrad/optimization/callbacks.py
Python
OptimizerDump
OptimizerDump
188
201
188
188
de1c04595a9858357e676643ac2bc8a2590e1df7
bigcode/the-stack
train
25744725f670670c98549ef8
train
class
class OptimizationPrinter: """Printer to register as callback in an optimizer, for printing best point regularly. Parameters ---------- print_interval_tells: int max number of evaluation before performing another print print_interval_seconds: float max number of seconds before p...
class OptimizationPrinter:
"""Printer to register as callback in an optimizer, for printing best point regularly. Parameters ---------- print_interval_tells: int max number of evaluation before performing another print print_interval_seconds: float max number of seconds before performing another print ...
# This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import time import warnings import inspect import datetime import typing as tp from pathlib import Path import numpy as np from nevergrad.parametrization import parameter as p from ne...
85
85
285
4
80
9-si/nevergrad
nevergrad/optimization/callbacks.py
Python
OptimizationPrinter
OptimizationPrinter
19
44
19
19
947f1bea937a1cd038eb5be343846d7c5109798c
bigcode/the-stack
train
d8da8d2accd8b07cb14f8652
train
class
class ProgressBar: """Progress bar to register as callback in an optimizer """ def __init__(self) -> None: from tqdm import tqdm # Inline import to avoid additional dependency self.progress_bar = tqdm() def __call__(self, optimizer: base.Optimizer, *args: tp.Any, **kwargs: tp.Any) -> ...
class ProgressBar:
"""Progress bar to register as callback in an optimizer """ def __init__(self) -> None: from tqdm import tqdm # Inline import to avoid additional dependency self.progress_bar = tqdm() def __call__(self, optimizer: base.Optimizer, *args: tp.Any, **kwargs: tp.Any) -> None: self....
def __init__(self, filepath: tp.Union[str, Path]) -> None: self._filepath = filepath def __call__(self, opt: base.Optimizer, *args: tp.Any, **kwargs: tp.Any) -> None: opt.dump(self._filepath) class ProgressBar:
64
64
95
4
60
9-si/nevergrad
nevergrad/optimization/callbacks.py
Python
ProgressBar
ProgressBar
204
214
204
204
a6e114fba89263cc1361262585f1f625bdd29a17
bigcode/the-stack
train
09fb22d5cfc1202971956b15
train
class
class pxssh (spawn): '''This class extends pexpect.spawn to specialize setting up SSH connections. This adds methods for login, logout, and expecting the shell prompt. It does various tricky things to handle many situations in the SSH login process. For example, if the session is your first login, then ...
class pxssh (spawn):
'''This class extends pexpect.spawn to specialize setting up SSH connections. This adds methods for login, logout, and expecting the shell prompt. It does various tricky things to handle many situations in the SSH login process. For example, if the session is your first login, then pxssh automatical...
EVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ''' from pipenv.vendor.pexpect import ExceptionPexpect, TIMEOUT, EOF, spawn import time import os import sys im...
256
256
4,908
6
249
offby1/pipenv
pipenv/vendor/pexpect/pxssh.py
Python
pxssh
pxssh
52
535
52
52
7af596fc70bf1e15fe69c9d20a757e5942068bc3
bigcode/the-stack
train
a334a760e4a695d65d4446a3
train
class
class ExceptionPxssh(ExceptionPexpect): '''Raised for pxssh exceptions. '''
class ExceptionPxssh(ExceptionPexpect):
'''Raised for pxssh exceptions. '''
THIS SOFTWARE. ''' from pipenv.vendor.pexpect import ExceptionPexpect, TIMEOUT, EOF, spawn import time import os import sys import re __all__ = ['ExceptionPxssh', 'pxssh'] # Exception classes used by this module. class ExceptionPxssh(ExceptionPexpect):
64
64
18
8
56
offby1/pipenv
pipenv/vendor/pexpect/pxssh.py
Python
ExceptionPxssh
ExceptionPxssh
32
34
32
32
86ff59ae3c584818638a79d603bf881d8c9a9aa8
bigcode/the-stack
train
0e44821106c547a64984546a
train
class
class AST: def __init__(self): self.count = 0 def makeAst(self, root): self.defineTreeNodes(root) self.joinTreeNodes(root) self.drawGraph() def defineTreeNodes(self, root): root.setId(str(self.count)) dot.node(str(self.count), root.getVal()) self.cou...
class AST:
def __init__(self): self.count = 0 def makeAst(self, root): self.defineTreeNodes(root) self.joinTreeNodes(root) self.drawGraph() def defineTreeNodes(self, root): root.setId(str(self.count)) dot.node(str(self.count), root.getVal()) self.count += 1 ...
from graphviz import Digraph from analizer.reports.Nodo import Nodo dot = Digraph(comment="AST") class AST:
28
64
203
3
25
webdev188/tytus
parser/team29/analizer/reports/AST.py
Python
AST
AST
7
35
7
7
e89c9c6698d4380e7af0bdc751d8e4d1b5bda1db
bigcode/the-stack
train
cd0c47c72c44ebae3353de12
train
function
def expand_user(d): if isinstance(d, dict): dnew = dict() for key, v in d.items(): if key.endswith('_path') and isinstance(v, str) and v.startswith('~'): dnew[key] = os.path.expanduser(v) else: dnew[key] = expand_user(v) return dnew ...
def expand_user(d):
if isinstance(d, dict): dnew = dict() for key, v in d.items(): if key.endswith('_path') and isinstance(v, str) and v.startswith('~'): dnew[key] = os.path.expanduser(v) else: dnew[key] = expand_user(v) return dnew return d
(os.path.join(basepath, 'config')): with open(os.path.join(basepath, 'config'), 'w+') as f: json.dump(configuration, f) with open(os.path.join(basepath, 'config'), 'r') as f: configuration.update(**json.load(f)) def expand_user(d):
64
64
80
5
59
jkulhanek/robot-visual-navigation
python/configuration.py
Python
expand_user
expand_user
24
34
24
24
c7d5513248a331762a5a9fc3d3379f23786b0400
bigcode/the-stack
train
96297dbb6db2a0dd003b36fb
train
function
def test_feature_store_override(): store = MyFeatureStoreNoGroupName() tensor = torch.Tensor([[0, 0, 0], [1, 1, 1], [2, 2, 2]]) attr_name = 'feat' index = torch.tensor([0, 1, 2]) # Only use attr_name and index, in that order: store[attr_name, index] = tensor # A few assertions to ensure g...
def test_feature_store_override():
store = MyFeatureStoreNoGroupName() tensor = torch.Tensor([[0, 0, 0], [1, 1, 1], [2, 2, 2]]) attr_name = 'feat' index = torch.tensor([0, 1, 2]) # Only use attr_name and index, in that order: store[attr_name, index] = tensor # A few assertions to ensure group_name is not needed: assert...
View) assert torch.equal(store[group_name](), tensor) # Deletion: del store[group_name, attr_name, index] assert store[group_name, attr_name, index] is None del store[group_name] assert store[group_name]() is None def test_feature_store_override():
64
64
162
6
57
aur3l14no/pytorch_geometric
test/data/test_feature_store.py
Python
test_feature_store_override
test_feature_store_override
139
154
139
139
5d59eb7f05bc621d5f8353d9c301cab7681c508b
bigcode/the-stack
train
6fc229710c8aa623c8edbc85
train
function
def test_feature_store(): r"""Tests basic API and indexing functionality of a feature store.""" store = MyFeatureStore() tensor = torch.Tensor([[0, 0, 0], [1, 1, 1], [2, 2, 2]]) group_name = 'A' attr_name = 'feat' index = torch.tensor([0, 1, 2]) attr = TensorAttr(group_name, attr_name, inde...
def test_feature_store():
r"""Tests basic API and indexing functionality of a feature store.""" store = MyFeatureStore() tensor = torch.Tensor([[0, 0, 0], [1, 1, 1], [2, 2, 2]]) group_name = 'A' attr_name = 'feat' index = torch.tensor([0, 1, 2]) attr = TensorAttr(group_name, attr_name, index) # Normal API: ...
: del self.store[MyFeatureStore.key(attr)] return True def __len__(self): raise NotImplementedError @dataclass class MyTensorAttrNoGroupName(TensorAttr): def __init__(self, attr_name=_field_status.UNSET, index=_field_status.UNSET): # Treat group_name as option...
168
168
563
5
162
aur3l14no/pytorch_geometric
test/data/test_feature_store.py
Python
test_feature_store
test_feature_store
79
136
79
79
fac746b0a8bf6666c2020bd8c1a069253dd545fa
bigcode/the-stack
train
1b9d417b1177eba97c8e54b9
train
class
@dataclass class MyTensorAttrNoGroupName(TensorAttr): def __init__(self, attr_name=_field_status.UNSET, index=_field_status.UNSET): # Treat group_name as optional, and move it to the end super().__init__(None, attr_name, index)
@dataclass class MyTensorAttrNoGroupName(TensorAttr):
def __init__(self, attr_name=_field_status.UNSET, index=_field_status.UNSET): # Treat group_name as optional, and move it to the end super().__init__(None, attr_name, index)
1) return tensor[idx] def _remove_tensor(self, attr: TensorAttr) -> bool: del self.store[MyFeatureStore.key(attr)] return True def __len__(self): raise NotImplementedError @dataclass class MyTensorAttrNoGroupName(TensorAttr):
64
64
64
14
49
aur3l14no/pytorch_geometric
test/data/test_feature_store.py
Python
MyTensorAttrNoGroupName
MyTensorAttrNoGroupName
58
63
58
59
6615b535e6c3162015490dfaa378e46788e3fbd6
bigcode/the-stack
train
9ce8e4d63f1c35f250d20221
train
class
class MyFeatureStore(FeatureStore): def __init__(self): super().__init__() self.store = {} @staticmethod def key(attr: TensorAttr) -> str: return (attr.group_name, attr.attr_name) def _put_tensor(self, tensor: FeatureTensorType, attr: TensorAttr) -> bool: index = attr.i...
class MyFeatureStore(FeatureStore):
def __init__(self): super().__init__() self.store = {} @staticmethod def key(attr: TensorAttr) -> str: return (attr.group_name, attr.attr_name) def _put_tensor(self, tensor: FeatureTensorType, attr: TensorAttr) -> bool: index = attr.index # None indices define ...
from dataclasses import dataclass from typing import Optional import pytest import torch from torch_geometric.data.feature_store import ( AttrView, FeatureStore, TensorAttr, _field_status, ) from torch_geometric.typing import FeatureTensorType class MyFeatureStore(FeatureStore):
64
81
271
8
55
aur3l14no/pytorch_geometric
test/data/test_feature_store.py
Python
MyFeatureStore
MyFeatureStore
16
55
16
16
c7883cdf05980d05f4fcd4e37224fa9adb5b6bdb
bigcode/the-stack
train
8ee262b30b543821dffb8848
train
class
class MyFeatureStoreNoGroupName(MyFeatureStore): def __init__(self): super().__init__() self._attr_cls = MyTensorAttrNoGroupName @staticmethod def key(attr: TensorAttr) -> str: return attr.attr_name def __len__(self): raise NotImplementedError
class MyFeatureStoreNoGroupName(MyFeatureStore):
def __init__(self): super().__init__() self._attr_cls = MyTensorAttrNoGroupName @staticmethod def key(attr: TensorAttr) -> str: return attr.attr_name def __len__(self): raise NotImplementedError
ensorAttr): def __init__(self, attr_name=_field_status.UNSET, index=_field_status.UNSET): # Treat group_name as optional, and move it to the end super().__init__(None, attr_name, index) class MyFeatureStoreNoGroupName(MyFeatureStore):
64
64
70
11
53
aur3l14no/pytorch_geometric
test/data/test_feature_store.py
Python
MyFeatureStoreNoGroupName
MyFeatureStoreNoGroupName
66
76
66
66
9c34200750e22c4ff41ea3dd63dc8b2446e5f418
bigcode/the-stack
train
788c8be5dd95ff54b3ba76f0
train
function
def readContract(w3, file, address): with open(file) as f: abi = json.load(f) if 'result' in abi: abi = abi['result'] return w3.eth.contract(address=address, abi=abi)
def readContract(w3, file, address):
with open(file) as f: abi = json.load(f) if 'result' in abi: abi = abi['result'] return w3.eth.contract(address=address, abi=abi)
Common utility functions import json from web3 import Web3 def initWeb3(): with open('./infura.json') as f: infuraUrl = json.load(f)['url'] return Web3(Web3.HTTPProvider(infuraUrl)) def readContract(w3, file, address):
64
64
54
10
54
Mleekko/DFPBot
utils.py
Python
readContract
readContract
12
17
12
12
b1368f2ee1a2371c2fe545a143d728fe81beb256
bigcode/the-stack
train
1cc9b09277e3ab1f3f414182
train
function
def days(num: int): return num * 60 * 60 * 24
def days(num: int):
return num * 60 * 60 * 24
furaUrl)) def readContract(w3, file, address): with open(file) as f: abi = json.load(f) if 'result' in abi: abi = abi['result'] return w3.eth.contract(address=address, abi=abi) def days(num: int):
64
64
19
6
58
Mleekko/DFPBot
utils.py
Python
days
days
20
21
20
20
1ebfe9c582980d7089bf24e0a431ac340b7373f6
bigcode/the-stack
train
59787289dad75ed3ed34fa18
train
function
def initWeb3(): with open('./infura.json') as f: infuraUrl = json.load(f)['url'] return Web3(Web3.HTTPProvider(infuraUrl))
def initWeb3():
with open('./infura.json') as f: infuraUrl = json.load(f)['url'] return Web3(Web3.HTTPProvider(infuraUrl))
# Common utility functions import json from web3 import Web3 def initWeb3():
20
64
40
5
14
Mleekko/DFPBot
utils.py
Python
initWeb3
initWeb3
6
9
6
6
72b031cd5bc58ec723bc69a2c73e6dfe63a0caca
bigcode/the-stack
train
dc2c9336dcc551502605be31
train
function
def fmt(dfp: float, decimals: int): return ("{:,." + str(decimals) + "f}").format(round(dfp, decimals))
def fmt(dfp: float, decimals: int):
return ("{:,." + str(decimals) + "f}").format(round(dfp, decimals))
= json.load(f) if 'result' in abi: abi = abi['result'] return w3.eth.contract(address=address, abi=abi) def days(num: int): return num * 60 * 60 * 24 def fmt(dfp: float, decimals: int):
64
64
34
11
52
Mleekko/DFPBot
utils.py
Python
fmt
fmt
24
25
24
24
30d5eb0c60e13538c161b30fae72e8f936cc0d90
bigcode/the-stack
train
774c1db6c232bba0a20d169b
train
class
class Plugin(LabelsPlugin): @hook def load_wallet(self, wallet, window): self.window = window self.start_wallet(wallet) def on_pulled(self, wallet): self.print_error('on pulled') self.window._trigger_update_history()
class Plugin(LabelsPlugin): @hook
def load_wallet(self, wallet, window): self.window = window self.start_wallet(wallet) def on_pulled(self, wallet): self.print_error('on pulled') self.window._trigger_update_history()
from .labels import LabelsPlugin from electrum_sparks.plugin import hook class Plugin(LabelsPlugin): @hook
26
64
58
10
15
sparkspay/electrum-sparks
electrum_sparks/plugins/labels/kivy.py
Python
Plugin
Plugin
4
13
4
6
581e065bc9320cbddff676ebd8d718f7c7966a81
bigcode/the-stack
train
720e63f195c98990777b481c
train
function
@mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_mov_tos(mock_extract_dialog): """Test sources.mov_tos attempts parsing expected number of movie scripts.""" expected_count = 6 dummy_dialog = ('SPORK', 'Fascinating.') mock_extract_dialog.return_value = [dummy_dialog] ...
@mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_mov_tos(mock_extract_dialog):
"""Test sources.mov_tos attempts parsing expected number of movie scripts.""" expected_count = 6 dummy_dialog = ('SPORK', 'Fascinating.') mock_extract_dialog.return_value = [dummy_dialog] extracted_dialog = sources.mov_tos(sources.chakoteya) assert mock_extract_dialog.call_count == expected_cou...
from trekipsum.scrape import sources try: from unittest import mock except ImportError: import mock @mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_mov_tos(mock_extract_dialog):
55
64
126
30
24
infinitewarp/trekipsum
tests/scrape/sources/test_sources.py
Python
test_mov_tos
test_mov_tos
9
19
9
10
61652b0863ccd683e9598873ea5ab417b664553c
bigcode/the-stack
train
bb1c245833dbd4a8db7b2eaa
train
function
@mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_tng(mock_extract_dialog): """Test sources.tng attempts parsing expected number of TNG scripts.""" expected_count = 176 # TODO verify should this actually be 178? dummy_dialog = ('PIKARD', 'Make it so.') mock_extract_dialo...
@mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_tng(mock_extract_dialog):
"""Test sources.tng attempts parsing expected number of TNG scripts.""" expected_count = 176 # TODO verify should this actually be 178? dummy_dialog = ('PIKARD', 'Make it so.') mock_extract_dialog.return_value = [dummy_dialog] extracted_dialog = sources.tng(sources.chakoteya) assert mock_extra...
assert mock_extract_dialog.call_count == expected_count assert len(extracted_dialog) == expected_count assert extracted_dialog == [dummy_dialog] * expected_count @mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_tng(mock_extract_dialog):
64
64
135
29
34
infinitewarp/trekipsum
tests/scrape/sources/test_sources.py
Python
test_tng
test_tng
22
32
22
23
eb0f47c29a9312bda712e11c0feb3411d523b609
bigcode/the-stack
train
057ade20530ed4c43c324c5a
train
function
@mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_ds9(mock_extract_dialog): """Test sources.ds9 attempts parsing expected number of DS9 scripts.""" expected_count = 173 # TODO verify should this actually be 176? dummy_dialog = ('SISQO', 'What the hell is going on?') mock...
@mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_ds9(mock_extract_dialog):
"""Test sources.ds9 attempts parsing expected number of DS9 scripts.""" expected_count = 173 # TODO verify should this actually be 176? dummy_dialog = ('SISQO', 'What the hell is going on?') mock_extract_dialog.return_value = [dummy_dialog] extracted_dialog = sources.ds9(sources.chakoteya) ass...
assert mock_extract_dialog.call_count == expected_count assert len(extracted_dialog) == expected_count assert extracted_dialog == [dummy_dialog] * expected_count @mock.patch('trekipsum.scrape.sources.chakoteya.Scraper.extract_dialog') def test_ds9(mock_extract_dialog):
64
64
140
29
34
infinitewarp/trekipsum
tests/scrape/sources/test_sources.py
Python
test_ds9
test_ds9
35
45
35
36
d9034692ecd7d92c47594e5d94b7742bcfde6bd4
bigcode/the-stack
train
d7cf9a776f469cb256d6f97c
train
class
class UpdateSources(genpy.Message): _md5sum = "b3b428bf55e80e83d378830c33b3405b" _type = "baxter_maintenance_msgs/UpdateSources" _has_header = False #flag to mark the presence of a Header object _full_text = """string uuid UpdateSource[] sources =======================================================...
class UpdateSources(genpy.Message):
_md5sum = "b3b428bf55e80e83d378830c33b3405b" _type = "baxter_maintenance_msgs/UpdateSources" _has_header = False #flag to mark the presence of a Header object _full_text = """string uuid UpdateSource[] sources ================================================================================ MSG: baxte...
# This Python file uses the following encoding: utf-8 """autogenerated by genpy from baxter_maintenance_msgs/UpdateSources.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct import baxter_maintenance_msgs.msg class UpdateSources(genpy.Message):
77
256
2,256
7
69
roop-pal/robotic-folding
catkin_ws/devel/.private/baxter_maintenance_msgs/lib/python2.7/dist-packages/baxter_maintenance_msgs/msg/_UpdateSources.py
Python
UpdateSources
UpdateSources
10
273
10
10
8f4fb9674649f8d29d465cb7cf3fc0608343f7e1
bigcode/the-stack
train