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
9a2c2309d359b95f8235bb13
train
class
class BaseDiscovery: def __call__(self, data, *, return_dict=False, threshold=None, **kwargs): raise NotImplementedError() # @staticmethod # def _matrix2dict_(matrix, names=None, threshold=0.1): # assert isinstance(matrix, np.ndarray) # assert matrix.ndim == 2 and matrix.shape[0] ==...
class BaseDiscovery:
def __call__(self, data, *, return_dict=False, threshold=None, **kwargs): raise NotImplementedError() # @staticmethod # def _matrix2dict_(matrix, names=None, threshold=0.1): # assert isinstance(matrix, np.ndarray) # assert matrix.ndim == 2 and matrix.shape[0] == matrix.shape[1] ...
from collections import OrderedDict import numpy as np import pandas as pd from ylearn.utils import to_repr class BaseDiscovery:
28
233
778
4
23
DataCanvasIO/YLearn
ylearn/causal_discovery/_base.py
Python
BaseDiscovery
BaseDiscovery
9
104
9
9
16ab74f20daef91d9a28464b7928242447572d5b
bigcode/the-stack
train
a5016fa99a82b6ed9ff37592
train
function
def pad_to(max_len, tokens, do_pad): if len(tokens) >= max_len: return tokens[: max_len-1] + [tokens[-1]] elif do_pad: return tokens + [0] * (max_len - len(tokens)) else: return tokens
def pad_to(max_len, tokens, do_pad):
if len(tokens) >= max_len: return tokens[: max_len-1] + [tokens[-1]] elif do_pad: return tokens + [0] * (max_len - len(tokens)) else: return tokens
_id, t_id]] # TODO EOT if (stop_eos and w == EOS) or (stop_pad and w == PAD): break if w != PAD: ws.append(w) return de_tknize(ws) def pad_to(max_len, tokens, do_pad):
64
64
62
11
53
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
pad_to
pad_to
833
839
833
833
f7084bc1c45db24e721f7e9abdb5e2fc5658ee8f
bigcode/the-stack
train
b0cdae37332a47449b2fdd4a
train
function
def addBookingPointer(state, pointer_vector): """Add information about availability of the booking option.""" # Booking pointer rest_vec = np.array([1, 0]) if "book" in state['restaurant']: if "booked" in state['restaurant']['book']: if state['restaurant']['book']["booked"]: ...
def addBookingPointer(state, pointer_vector):
"""Add information about availability of the booking option.""" # Booking pointer rest_vec = np.array([1, 0]) if "book" in state['restaurant']: if "booked" in state['restaurant']['book']: if state['restaurant']['book']["booked"]: if "reference" in state['restaurant'][...
[idx * 6: idx * 6 + 6] = np.array([0, 0, 0, 0, 1, 0]) elif num > 40: vector[idx * 6: idx * 6 + 6] = np.array([0, 0, 0, 0, 0, 1]) return vector def addBookingPointer(state, pointer_vector):
90
90
303
9
80
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
addBookingPointer
addBookingPointer
77
106
77
77
66cea38a7ea31a0e4342195a0033353a73040c83
bigcode/the-stack
train
76d9469f6b6ff3cb0df59f26
train
function
def prepare_batch_gen(rows, config): domains = ['hotel', 'restaurant', 'train', 'attraction', 'hospital', 'police', 'taxi'] ctx_utts, ctx_lens = [], [] out_utts, out_lens = [], [] out_bs, out_db = [], [] goals, goal_lens = [], [[] for _ in range(len(domains))] keys = [] for...
def prepare_batch_gen(rows, config):
domains = ['hotel', 'restaurant', 'train', 'attraction', 'hospital', 'police', 'taxi'] ctx_utts, ctx_lens = [], [] out_utts, out_lens = [], [] out_bs, out_db = [], [] goals, goal_lens = [], [[] for _ in range(len(domains))] keys = [] for row in rows: in_row, out_row...
_id]] # TODO EOT if (stop_eos and w == EOS) or (stop_pad and w == PAD): break if w != PAD: ws.append(w) return de_tknize(ws) def pad_to(max_len, tokens, do_pad): if len(tokens) >= max_len: return tokens[: max_len-1] + [tokens[-1]] elif do_pad: ...
120
120
402
8
111
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
prepare_batch_gen
prepare_batch_gen
842
883
842
842
a0cb2c7cb23188083b99a9455189019171b268d0
bigcode/the-stack
train
92a4cb3da94aa370458649d3
train
function
def oneHotVector(num, domain, vector): """Return number of available entities for particular domain.""" domains = ['restaurant', 'hotel', 'attraction', 'train'] number_of_options = 6 if domain != 'train': idx = domains.index(domain) if num == 0: vector[idx * 6: idx * 6 + 6] =...
def oneHotVector(num, domain, vector):
"""Return number of available entities for particular domain.""" domains = ['restaurant', 'hotel', 'attraction', 'train'] number_of_options = 6 if domain != 'train': idx = domains.index(domain) if num == 0: vector[idx * 6: idx * 6 + 6] = np.array([1, 0, 0, 0, 0, 0]) e...
ora_inference from convlab2.policy.larl.multiwoz.latent_dialog import domain from convlab2.policy.larl.multiwoz.latent_dialog.models_task import SysPerfectBD2Cat from convlab2.policy import Policy from convlab2.util.file_util import cached_path from convlab2.util.multiwoz.state import default_state from convlab2.util.m...
175
176
589
10
165
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
oneHotVector
oneHotVector
41
74
41
41
2aac63e887152722c776b7ddc07520acfc07cb71
bigcode/the-stack
train
acca9584ba4633e170eccf87
train
function
def get_sent(vocab, de_tknize, data, b_id, stop_eos=True, stop_pad=True): ws = [] for t_id in range(data.shape[1]): w = vocab[data[b_id, t_id]] # TODO EOT if (stop_eos and w == EOS) or (stop_pad and w == PAD): break if w != PAD: ws.append(w) return de...
def get_sent(vocab, de_tknize, data, b_id, stop_eos=True, stop_pad=True):
ws = [] for t_id in range(data.shape[1]): w = vocab[data[b_id, t_id]] # TODO EOT if (stop_eos and w == EOS) or (stop_pad and w == PAD): break if w != PAD: ws.append(w) return de_tknize(ws)
0]): # only one val for pred_str now pred_str = get_sent(self.model.vocab, de_tknize, pred_labels, b_id) return pred_str def get_sent(vocab, de_tknize, data, b_id, stop_eos=True, stop_pad=True):
64
64
99
25
38
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
get_sent
get_sent
820
830
820
820
0fd5049a3e83c79c5179c6e32d5fbd15bcb2cf6b
bigcode/the-stack
train
555ec0ee0ae84d64b9c4db8c
train
function
def get_summary_bstate(bstate): """Based on the mturk annotations we form multi-domain belief state""" domains = [u'taxi', u'restaurant', u'hospital', u'hotel', u'attraction', u'train', u'police'] summary_bstate = [] for domain in domains: domain_active = False booking =...
def get_summary_bstate(bstate):
"""Based on the mturk annotations we form multi-domain belief state""" domains = [u'taxi', u'restaurant', u'hospital', u'hotel', u'attraction', u'train', u'police'] summary_bstate = [] for domain in domains: domain_active = False booking = [] for slot in sorted(b...
and state[domain]['semi'][s] != '']) > 0: # for s in state[domain]['semi']: # if s != 'book' and state[domain]['semi'][s] == '': # state[domain]['semi'][s] = 'not mentioned' for s in state[domain]['semi']: if state[domain]['semi'][...
129
129
430
8
120
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
get_summary_bstate
get_summary_bstate
186
233
186
186
44f351566fb2fa7076d835c3a604bafcee1bdbb1
bigcode/the-stack
train
ae261557b8c1a4c18bb5a6c2
train
function
def mark_not_mentioned(state): for domain in state: # if domain == 'history': if domain not in ['police', 'hospital', 'taxi', 'train', 'attraction', 'restaurant', 'hotel']: continue try: # if len([s for s in state[domain]['semi'] if s != 'book' and state[domain]['semi...
def mark_not_mentioned(state):
for domain in state: # if domain == 'history': if domain not in ['police', 'hospital', 'taxi', 'train', 'attraction', 'restaurant', 'hotel']: continue try: # if len([s for s in state[domain]['semi'] if s != 'book' and state[domain]['semi'][s] != '']) > 0: ...
i', 'train', 'attraction', 'restaurant', 'hotel']: pass for s in state[active_domain]['semi']: if state[active_domain]['semi'][s] == '': state[active_domain]['semi'][s] = 'not mentioned' def mark_not_mentioned(state):
64
64
198
7
57
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
mark_not_mentioned
mark_not_mentioned
167
183
167
167
4f15e73664cc4230516cb2a9df64476b7bab786e
bigcode/the-stack
train
9e824db21eea829041ed3775
train
class
class LaRL(Policy): def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None): if not os.path.isfile(archive_file): if not model_file: raise Exception("No model for LaRL is specified...
class LaRL(Policy):
def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None): if not os.path.isfile(archive_file): if not model_file: raise Exception("No model for LaRL is specified!") arch...
) summary_bstate += booking for slot in bstate[domain]['semi']: slot_enc = [0, 0, 0] if bstate[domain]['semi'][slot] == 'not mentioned': slot_enc[0] = 1 elif bstate[domain]['semi'][slot] == 'dont care' or bstate[domain]['semi'][slot] == 'dontcare' or ...
256
256
4,744
6
250
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
LaRL
LaRL
241
817
241
241
71d71daaf9a885baf6ac550c10cee1cd245dd669
bigcode/the-stack
train
1c2c36fb2913f5743aabbd79
train
function
def addDBPointer(state,db): """Create database pointer for all related domains.""" domains = ['restaurant', 'hotel', 'attraction', 'train'] pointer_vector = np.zeros(6 * len(domains)) db_results = {} num_entities = {} for domain in domains: # entities = dbPointer.queryResultVenues(domain...
def addDBPointer(state,db):
"""Create database pointer for all related domains.""" domains = ['restaurant', 'hotel', 'attraction', 'train'] pointer_vector = np.zeros(6 * len(domains)) db_results = {} num_entities = {} for domain in domains: # entities = dbPointer.queryResultVenues(domain, {'metadata': state}) ...
= np.array([0, 1]) pointer_vector = np.append(pointer_vector, rest_vec) pointer_vector = np.append(pointer_vector, hotel_vec) pointer_vector = np.append(pointer_vector, train_vec) # pprint(pointer_vector) return pointer_vector def addDBPointer(state,db):
64
64
200
8
55
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
addDBPointer
addDBPointer
109
126
109
109
b51fe109b0b0e87a1e92138a8c4e10f5698946a0
bigcode/the-stack
train
ff32df8b567c380f697c5dc5
train
function
def delexicaliseReferenceNumber(sent, state): """Based on the belief state, we can find reference number that during data gathering was created randomly.""" domains = ['restaurant', 'hotel', 'attraction', 'train', 'taxi', 'hospital'] # , 'police'] for domain in domains: if state[...
def delexicaliseReferenceNumber(sent, state):
"""Based on the belief state, we can find reference number that during data gathering was created randomly.""" domains = ['restaurant', 'hotel', 'attraction', 'train', 'taxi', 'hospital'] # , 'police'] for domain in domains: if state[domain]['book']['booked']: for slo...
(domain) # db_results[domain] = dict(zip(fields, entities[0])) db_results[domain] = entities[0] # pointer_vector = dbPointer.oneHotVector(len(entities), domain, pointer_vector) pointer_vector = oneHotVector(len(entities), domain, pointer_vector) return list(pointer_vector), ...
87
87
291
11
75
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
delexicaliseReferenceNumber
delexicaliseReferenceNumber
129
155
129
129
4a60bf6a427d556b1fee0c6d5955bccd22dfd72f
bigcode/the-stack
train
8133824fe4920fbaa9955225
train
function
def domain_mark_not_mentioned(state, active_domain): if domain not in ['police', 'hospital', 'taxi', 'train', 'attraction', 'restaurant', 'hotel']: pass for s in state[active_domain]['semi']: if state[active_domain]['semi'][s] == '': state[active_domain]['semi'][s] = 'not mentioned'...
def domain_mark_not_mentioned(state, active_domain):
if domain not in ['police', 'hospital', 'taxi', 'train', 'attraction', 'restaurant', 'hotel']: pass for s in state[active_domain]['semi']: if state[active_domain]['semi'][s] == '': state[active_domain]['semi'][s] = 'not mentioned'
key = normalize( "ref#" + state[domain]['book']['booked'][0][slot]) sent = (' ' + sent + ' ').replace(' ' + key + ' ', ' ' + val + ' ') return sent def domain_mark_not_mentioned(state, active_domain):
64
64
82
11
52
haojiepan1/CrossWOZ
convlab2/policy/larl/multiwoz/larl.py
Python
domain_mark_not_mentioned
domain_mark_not_mentioned
158
164
158
158
39ea6b55e608cefe842eecc8f01ea054c668b2c5
bigcode/the-stack
train
3b35654142065fc455e42d71
train
class
class InstanceBinding(ElementBinding,IDisposable): """ The InstanceBinding object is used to signify a binding between a parameter definition and a parameter on each instance of an element,such as a wall. InstanceBinding(categories: CategorySet) InstanceBinding() """ def Dispose(self): """ D...
class InstanceBinding(ElementBinding,IDisposable):
""" The InstanceBinding object is used to signify a binding between a parameter definition and a parameter on each instance of an element,such as a wall. InstanceBinding(categories: CategorySet) InstanceBinding() """ def Dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def ...
class InstanceBinding(ElementBinding,IDisposable):
10
85
284
10
0
htlcnn/ironpython-stubs
release/stubs.min/Autodesk/Revit/DB/__init___parts/InstanceBinding.py
Python
InstanceBinding
InstanceBinding
1
38
1
1
f0c03c1e9ebd995fb3821dbc1bd4af70313aae74
bigcode/the-stack
train
42683ad4e597aa5486380871
train
class
class Migration(migrations.Migration): dependencies = [ ('home', '0003_auto_20190729_2213'), ] operations = [ migrations.AlterField( model_name='userprofile', name='avatar', field=models.ImageField(blank=True, default=None, upload_to=ghostwriter.home.mod...
class Migration(migrations.Migration):
dependencies = [ ('home', '0003_auto_20190729_2213'), ] operations = [ migrations.AlterField( model_name='userprofile', name='avatar', field=models.ImageField(blank=True, default=None, upload_to=ghostwriter.home.models.UserProfile.set_upload_destination),...
# Generated by Django 3.1.13 on 2022-01-25 23:58 from django.db import migrations, models import ghostwriter.home.models class Migration(migrations.Migration):
44
64
78
7
36
bbhunter/Ghostwriter
ghostwriter/home/migrations/0004_auto_20220125_2358.py
Python
Migration
Migration
7
19
7
8
5c6b9d08e2e620145128a6096af69a74a53d71be
bigcode/the-stack
train
9abebc3d839389351b604aa3
train
function
def _format_archive(d): return "{}={}={}".format(d.label, d.importmap, d.file.path)
def _format_archive(d):
return "{}={}={}".format(d.label, d.importmap, d.file.path)
zl", "as_set", "has_shared_lib_extension", ) load( "//go/private:mode.bzl", "LINKMODE_NORMAL", "LINKMODE_PLUGIN", "extld_from_cc_toolchain", "extldflags_from_cc_toolchain", ) def _format_archive(d):
64
64
24
6
58
Saser/rules_go
go/private/actions/link.bzl
Python
_format_archive
_format_archive
28
29
28
28
2f0f2e506712af1a30d11b7a6caca164ad26e215
bigcode/the-stack
train
732fa2d108f7ed236b90eaf4
train
function
def emit_link( go, archive = None, test_archives = [], executable = None, gc_linkopts = [], version_file = None, info_file = None): """See go/toolchains.rst#link for full documentation.""" if archive == None: fail("archive is a required parameter"...
def emit_link( go, archive = None, test_archives = [], executable = None, gc_linkopts = [], version_file = None, info_file = None):
"""See go/toolchains.rst#link for full documentation.""" if archive == None: fail("archive is a required parameter") if executable == None: fail("executable is a required parameter") #TODO: There has to be a better way to work out the rpath config_strip = len(go._ctx.configuration....
MODE_NORMAL", "LINKMODE_PLUGIN", "extld_from_cc_toolchain", "extldflags_from_cc_toolchain", ) def _format_archive(d): return "{}={}={}".format(d.label, d.importmap, d.file.path) def _transitive_archives_without_test_archives(archive, test_archives): # Build the set of transitive dependencies. Curr...
255
256
1,485
41
214
Saser/rules_go
go/private/actions/link.bzl
Python
emit_link
emit_link
41
184
41
48
bad77d2a54ba923efd70be25af7cdd2542138565
bigcode/the-stack
train
f3a356ac0f98fd57c1158b88
train
function
def _extract_extldflags(gc_linkopts, extldflags): """Extracts -extldflags from gc_linkopts and combines them into a single list. Args: gc_linkopts: a list of flags passed in through the gc_linkopts attributes. ctx.expand_make_variables should have already been applied. -extldflags may app...
def _extract_extldflags(gc_linkopts, extldflags):
"""Extracts -extldflags from gc_linkopts and combines them into a single list. Args: gc_linkopts: a list of flags passed in through the gc_linkopts attributes. ctx.expand_make_variables should have already been applied. -extldflags may appear multiple times in this list. extldflags:...
) go.actions.run( inputs = inputs, outputs = [executable], mnemonic = "GoLink", executable = go.toolchain._builder, arguments = [builder_args, "--", tool_args], env = go.env, ) def _extract_extldflags(gc_linkopts, extldflags):
68
68
229
14
54
Saser/rules_go
go/private/actions/link.bzl
Python
_extract_extldflags
_extract_extldflags
186
210
186
186
152575cb393146b97d80c168216cd51d2eb0f7db
bigcode/the-stack
train
549e3144ede1bce7f2c80685
train
function
def _transitive_archives_without_test_archives(archive, test_archives): # Build the set of transitive dependencies. Currently, we tolerate multiple # archives with the same importmap (though this will be an error in the # future), but there is a special case which is difficult to avoid: # If a go_test h...
def _transitive_archives_without_test_archives(archive, test_archives): # Build the set of transitive dependencies. Currently, we tolerate multiple # archives with the same importmap (though this will be an error in the # future), but there is a special case which is difficult to avoid: # If a go_test h...
deps = depset(transitive = [d.transitive for d in archive.direct]) return [d for d in deps.to_list() if not any([d.importmap == t.importmap for t in test_archives])]
def _transitive_archives_without_test_archives(archive, test_archives): # Build the set of transitive dependencies. Currently, we tolerate multiple # archives with the same importmap (though this will be an error in the # future), but there is a special case which is difficult to avoid: # If a go_test h...
114
64
161
114
0
Saser/rules_go
go/private/actions/link.bzl
Python
_transitive_archives_without_test_archives
_transitive_archives_without_test_archives
31
39
31
37
5ff95e3e72a5c528d0ba38db55a58eefb508dfc5
bigcode/the-stack
train
a77a90cd1d575accd3cccd0f
train
function
def _check_conflicts(arcs): importmap_to_label = {} for arc in arcs: if arc.importmap in importmap_to_label: return """package conflict error: {}: multiple copies of package passed to linker: {} {} Set "importmap" to different paths or use 'bazel cquery' to ensure only one package with thi...
def _check_conflicts(arcs):
importmap_to_label = {} for arc in arcs: if arc.importmap in importmap_to_label: return """package conflict error: {}: multiple copies of package passed to linker: {} {} Set "importmap" to different paths or use 'bazel cquery' to ensure only one package with this path is linked.""".format(...
contain multiple flags, separated by whitespace. """ filtered_gc_linkopts = [] is_extldflags = False for opt in gc_linkopts: if is_extldflags: is_extldflags = False extldflags.append(opt) elif opt == "-extldflags": is_extldflags = True else: ...
102
102
340
8
93
Saser/rules_go
go/private/actions/link.bzl
Python
_check_conflicts
_check_conflicts
212
248
212
212
0e2e834864a0d6ad9b483a23cb17a784e7b80320
bigcode/the-stack
train
b892f9c5f62abd4c78ae38ae
train
function
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ # this callback is used to prevent an auto-migration from being generated # when there are no changes to the schema # reference: h...
def run_migrations_online():
"""Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ # this callback is used to prevent an auto-migration from being generated # when there are no changes to the schema # reference: http://alembic.zzzcomputing.co...
and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output. """ url = config.get_main_option("sqlalchemy.url") context.configure...
93
93
311
6
87
pombredanne/vulncode-db
migrations/env.py
Python
run_migrations_online
run_migrations_online
52
97
52
52
577010aea4bcf45f61f93d9ab9d5b69cb8c6d418
bigcode/the-stack
train
a205c257f1444ed75c1213a6
train
function
def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the g...
def run_migrations_offline():
"""Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script ...
_DATABASE_URI") ) target_metadata = current_app.extensions["migrate"].db.metadata # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option") # ... etc. def run_migrations_offline():
64
64
114
7
57
pombredanne/vulncode-db
migrations/env.py
Python
run_migrations_offline
run_migrations_offline
33
49
33
33
7079bd0e08f6f36c3fce33af8e4a2e70123f4249
bigcode/the-stack
train
946fc56707dd004505de765d
train
function
async def test_click_offscreen_buttons(page, server): await page.goto(server.PREFIX + "/offscreenbuttons.html") messages = [] page.on("console", lambda msg: messages.append(msg.text)) for i in range(11): # We might've scrolled to click a button - reset to (0, 0). await page.evaluate("win...
async def test_click_offscreen_buttons(page, server):
await page.goto(server.PREFIX + "/offscreenbuttons.html") messages = [] page.on("console", lambda msg: messages.append(msg.text)) for i in range(11): # We might've scrolled to click a button - reset to (0, 0). await page.evaluate("window.scrollTo(0, 0)") await page.click(f"#btn{i...
", clickCount=3) assert ( await page.evaluate( """() => { textarea = document.querySelector('textarea') return textarea.value.substring(textarea.selectionStart, textarea.selectionEnd) }""" ) == text ) async def test_click_offscreen_...
64
64
178
11
53
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_offscreen_buttons
test_click_offscreen_buttons
140
160
140
140
b57e4ee6d8bd510df52dfb49cb3fca059a912f3c
bigcode/the-stack
train
8359b16128282bb67ccaa866
train
function
async def test_click_the_button_with_em_border_with_offset(page, server, is_webkit): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "button => button.style.borderWidth = '2em'") await page.evalOnSelector("button", "button => button.style.fontSize = '12px'") awa...
async def test_click_the_button_with_em_border_with_offset(page, server, is_webkit):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "button => button.style.borderWidth = '2em'") await page.evalOnSelector("button", "button => button.style.fontSize = '12px'") await page.click("button", position={"x": 20, "y": 10}) assert await page.evaluate("...
assert await page.evaluate("offsetX") == 20 + 8 if is_webkit else 20 assert await page.evaluate("offsetY") == 10 + 8 if is_webkit else 10 async def test_click_the_button_with_em_border_with_offset(page, server, is_webkit):
64
64
170
19
44
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_with_em_border_with_offset
test_click_the_button_with_em_border_with_offset
412
420
412
412
1a8df5af10c7e7bc3965f8e704c62f2bc8129306
bigcode/the-stack
train
43c21a926e44b84dd13c7249
train
function
async def test_not_retarget_when_element_changes_on_hover(page, server): await page.goto(server.PREFIX + "/react.html") await page.evaluate( """() => { renderComponent(e('div', {}, [e(MyButton, { name: 'button1', renameOnHover: true }), e(MyButton, { name: 'button2' })] )); }""" ) ...
async def test_not_retarget_when_element_changes_on_hover(page, server):
await page.goto(server.PREFIX + "/react.html") await page.evaluate( """() => { renderComponent(e('div', {}, [e(MyButton, { name: 'button1', renameOnHover: true }), e(MyButton, { name: 'button2' })] )); }""" ) await page.click("text=button1") assert await page.evaluate("wind...
error = None try: await promise except Error as e: error = e assert await page.evaluate("window.clicked") is None assert "Element is outside of the viewport" in error.message async def test_not_retarget_when_element_changes_on_hover(page, server):
64
64
115
15
48
arjun27/playwright-python
tests/async/test_click.py
Python
test_not_retarget_when_element_changes_on_hover
test_not_retarget_when_element_changes_on_hover
916
925
916
916
040e0520bc6e93dca585f0698ba855988197f612
bigcode/the-stack
train
f8c79ffa8f247ae709f1c86e
train
function
async def test_click_the_button_with_device_scale_factor_set(browser, server, utils): context = await browser.newContext( viewport={"width": 400, "height": 400}, deviceScaleFactor=5 ) page = await context.newPage() assert await page.evaluate("window.devicePixelRatio") == 5 await page.setCont...
async def test_click_the_button_with_device_scale_factor_set(browser, server, utils):
context = await browser.newContext( viewport={"width": 400, "height": 400}, deviceScaleFactor=5 ) page = await context.newPage() assert await page.evaluate("window.devicePixelRatio") == 5 await page.setContent('<div style="width:100px;height:100px">spacer</div>') await utils.attach_frame...
-test", server.PREFIX + "/input/button.html") frame = page.frames[1] button = await frame.querySelector("button") await button.click() assert await frame.evaluate("window.result") == "Clicked" async def test_click_the_button_with_device_scale_factor_set(browser, server, utils):
64
64
154
17
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_with_device_scale_factor_set
test_click_the_button_with_device_scale_factor_set
387
399
387
387
bc04f7838e23b6029213ca5f145a5d1ee498a0ea
bigcode/the-stack
train
26cae884ea3307983dc77071
train
function
async def test_select_the_text_by_triple_clicking(page, server): await page.goto(server.PREFIX + "/input/textarea.html") text = "This is the text that we are going to try to select. Let's see how it goes." await page.fill("textarea", text) await page.click("textarea", clickCount=3) assert ( ...
async def test_select_the_text_by_triple_clicking(page, server):
await page.goto(server.PREFIX + "/input/textarea.html") text = "This is the text that we are going to try to select. Let's see how it goes." await page.fill("textarea", text) await page.click("textarea", clickCount=3) assert ( await page.evaluate( """() => { texta...
= 42;'><i>woof</i><b>doggo</b></span> """ ) await page.click("span") assert await page.evaluate("() => window.CLICKED") == 42 async def test_select_the_text_by_triple_clicking(page, server):
64
64
120
15
48
arjun27/playwright-python
tests/async/test_click.py
Python
test_select_the_text_by_triple_clicking
test_select_the_text_by_triple_clicking
124
137
124
124
e5958ab34616f9c7a01d649be34aef6ec1e0534d
bigcode/the-stack
train
b6ce4f88f5d9994dc8f20615
train
function
async def test_click_the_button_with_px_border_with_offset(page, server, is_webkit): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "button => button.style.borderWidth = '8px'") await page.click("button", position={"x": 20, "y": 10}) assert await page.evaluate(...
async def test_click_the_button_with_px_border_with_offset(page, server, is_webkit):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "button => button.style.borderWidth = '8px'") await page.click("button", position={"x": 20, "y": 10}) assert await page.evaluate("result") == "Clicked" # Safari reports border-relative offsetX/offsetY. asse...
input/button.html") frame = page.frames[1] button = await frame.querySelector("button") await button.click() assert await frame.evaluate("window.result") == "Clicked" await context.close() async def test_click_the_button_with_px_border_with_offset(page, server, is_webkit):
64
64
143
19
45
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_with_px_border_with_offset
test_click_the_button_with_px_border_with_offset
402
409
402
402
73b31aa87d7d05af373f378cc0976af4199d450a
bigcode/the-stack
train
3ab6dae44f7df15336df943d
train
function
async def test_click_the_button_when_window_inner_width_is_corrupted(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evaluate("window.innerWidth = 0") await page.click("button") assert await page.evaluate("result") == "Clicked"
async def test_click_the_button_when_window_inner_width_is_corrupted(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evaluate("window.innerWidth = 0") await page.click("button") assert await page.evaluate("result") == "Clicked"
name: 'button2' })] )); }""" ) await page.click("text=button1") assert await page.evaluate("window.button1") is None assert await page.evaluate("window.button2") async def test_click_the_button_when_window_inner_width_is_corrupted(page, server):
64
64
61
17
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_when_window_inner_width_is_corrupted
test_click_the_button_when_window_inner_width_is_corrupted
944
948
944
944
34440a771af77bec45275e33fb4a30643ad782bc
bigcode/the-stack
train
9ac3777c39d7c8d335e81dbc
train
function
async def test_fail_when_element_is_animating_from_outside_the_viewport_with_force( page, server ): await page.setContent( """<style> @keyframes move { from { left: -300px; } to { left: 0; } } button { position: absolute; left: -300...
async def test_fail_when_element_is_animating_from_outside_the_viewport_with_force( page, server ):
await page.setContent( """<style> @keyframes move { from { left: -300px; } to { left: 0; } } button { position: absolute; left: -300px; top: 0; bottom: 0 width: 200px; } button.animate...
") promise = asyncio.create_task(handle.click()) await asyncio.sleep(0) # execute scheduled tasks, but don't await them await handle.evaluate("button => button.className = 'animated'") await promise assert await page.evaluate("window.clicked") async def test_fail_when_element_is_animating_from_outs...
79
79
264
24
55
arjun27/playwright-python
tests/async/test_click.py
Python
test_fail_when_element_is_animating_from_outside_the_viewport_with_force
test_fail_when_element_is_animating_from_outside_the_viewport_with_force
878
913
878
880
d10a4db87ea28bad13b137729573978d4facf439
bigcode/the-stack
train
2797ad07e9e6375eb10c9dee
train
function
async def test_click_with_disabled_javascript(browser, server): context = await browser.newContext(javaScriptEnabled=False) page = await context.newPage() await page.goto(server.PREFIX + "/wrappedlink.html") await asyncio.gather(page.click("a"), page.waitForNavigation()) assert page.url == server.PR...
async def test_click_with_disabled_javascript(browser, server):
context = await browser.newContext(javaScriptEnabled=False) page = await context.newPage() await page.goto(server.PREFIX + "/wrappedlink.html") await asyncio.gather(page.click("a"), page.waitForNavigation()) assert page.url == server.PREFIX + "/wrappedlink.html#clicked" await context.close()
(server.PREFIX + "/input/button.html") await page.click("button") await page.goto(server.CROSS_PROCESS_PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("() => result") == "Clicked" async def test_click_with_disabled_javascript(browser, server):
64
64
81
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_with_disabled_javascript
test_click_with_disabled_javascript
97
103
97
97
aed16acfe28f3fdf3f4dbd70ce16e9d8a8742d98
bigcode/the-stack
train
dc63a20e61f3362a68b922ba
train
function
async def test_retry_when_element_detaches_after_animation(page, server): await page.goto(server.PREFIX + "/input/animating-button.html") await page.evaluate("addButton()") clicked = [] async def click(): await page.click("button") clicked.append(True) promise = asyncio.create_task...
async def test_retry_when_element_detaches_after_animation(page, server):
await page.goto(server.PREFIX + "/input/animating-button.html") await page.evaluate("addButton()") clicked = [] async def click(): await page.click("button") clicked.append(True) promise = asyncio.create_task(click()) await asyncio.sleep(0) # execute scheduled tasks, but don't...
= None try: error = await promise except Error as e: error = e assert await page.evaluate("window.clicked") is None assert "Element is not attached to the DOM" in error.message async def test_retry_when_element_detaches_after_animation(page, server):
64
64
202
14
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_retry_when_element_detaches_after_animation
test_retry_when_element_detaches_after_animation
820
844
820
820
636d78f42ffbaeea9fd8b1bed2b6cd37ecd23c06
bigcode/the-stack
train
bf579df229ada974aab2d151
train
function
async def test_wait_for_input_to_be_enabled(page, server): await page.setContent( '<input onclick="javascript:window.__CLICKED=true;" disabled>' ) done = [] async def click(): await page.click("input") done.append(True) click_promise = asyncio.create_task(click()) await...
async def test_wait_for_input_to_be_enabled(page, server):
await page.setContent( '<input onclick="javascript:window.__CLICKED=true;" disabled>' ) done = [] async def click(): await page.click("input") done.append(True) click_promise = asyncio.create_task(click()) await give_it_a_chance_to_click(page) assert await page.eval...
TimeoutError as e: error = e assert await page.evaluate("window.__CLICKED") is None assert "Timeout 3000ms exceeded" in error.message assert "element is disabled - waiting" in error.message async def test_wait_for_input_to_be_enabled(page, server):
64
64
130
13
50
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_input_to_be_enabled
test_wait_for_input_to_be_enabled
656
672
656
656
899aea443f869ccdb185cd661db3196b1d6eebee
bigcode/the-stack
train
3d94d9b3aad9eaac46f58b18
train
function
async def test_retry_when_element_is_animating_from_outside_the_viewport(page, server): await page.setContent( """<style> @keyframes move { from { left: -300px; } to { left: 0; } } button { position: absolute left: -300px to...
async def test_retry_when_element_is_animating_from_outside_the_viewport(page, server):
await page.setContent( """<style> @keyframes move { from { left: -300px; } to { left: 0; } } button { position: absolute left: -300px top: 0 bottom: 0 width: 200px } button.animated { ...
") assert clicked == [] assert await page.evaluate("window.clicked") is None await page.evaluate("stopButton(false)") await promise assert clicked == [True] assert await page.evaluate("window.clicked") async def test_retry_when_element_is_animating_from_outside_the_viewport(page, server):
66
66
221
19
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_retry_when_element_is_animating_from_outside_the_viewport
test_retry_when_element_is_animating_from_outside_the_viewport
847
875
847
847
e1ae9b9ac603d7b27312f1b44252832e321c5438
bigcode/the-stack
train
4d66b4a64c6d1b419c24a9a9
train
function
async def test_check_the_box_outside_label(page): await page.setContent( '<label for="checkbox">Text</label><div><input id="checkbox" type="checkbox"></input></div>' ) await page.check("label") assert await page.evaluate("checkbox.checked")
async def test_check_the_box_outside_label(page):
await page.setContent( '<label for="checkbox">Text</label><div><input id="checkbox" type="checkbox"></input></div>' ) await page.check("label") assert await page.evaluate("checkbox.checked")
def test_check_the_box_by_label(page): await page.setContent( '<label for="checkbox"><input id="checkbox" type="checkbox"></input></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked") async def test_check_the_box_outside_label(page):
64
64
61
11
53
arjun27/playwright-python
tests/async/test_click.py
Python
test_check_the_box_outside_label
test_check_the_box_outside_label
997
1,002
997
997
91e179d6d632e12ecf4074ece23f274823bc1d26
bigcode/the-stack
train
a0c8c452754517c1e88d5974
train
function
async def test_check_the_box_by_label(page): await page.setContent( '<label for="checkbox"><input id="checkbox" type="checkbox"></input></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked")
async def test_check_the_box_by_label(page):
await page.setContent( '<label for="checkbox"><input id="checkbox" type="checkbox"></input></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked")
.checked") is False async def test_not_uncheck_the_unchecked_box(page): await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False async def test_check_the_box_by_label(page):
64
64
54
10
53
arjun27/playwright-python
tests/async/test_click.py
Python
test_check_the_box_by_label
test_check_the_box_by_label
989
994
989
989
71c026fa6961f46cfaeb9b4bf0fb7e4f4b096a9f
bigcode/the-stack
train
6ac012e22a081a8e8cbace53
train
function
async def test_not_hang_with_touch_enabled_viewports(playwright, server, browser): iphone_6 = playwright.devices["iPhone 6"] context = await browser.newContext( viewport=iphone_6["viewport"], hasTouch=iphone_6["hasTouch"] ) page = await context.newPage() await page.mouse.down() await pag...
async def test_not_hang_with_touch_enabled_viewports(playwright, server, browser):
iphone_6 = playwright.devices["iPhone 6"] context = await browser.newContext( viewport=iphone_6["viewport"], hasTouch=iphone_6["hasTouch"] ) page = await context.newPage() await page.mouse.down() await page.mouse.move(100, 10) await page.mouse.up() await context.close()
page.evaluate("result.events") == [ "click", "input", "change", ] await page.click('label[for="agree"]') assert await page.evaluate("result.check") is False async def test_not_hang_with_touch_enabled_viewports(playwright, server, browser):
64
64
96
18
45
arjun27/playwright-python
tests/async/test_click.py
Python
test_not_hang_with_touch_enabled_viewports
test_not_hang_with_touch_enabled_viewports
300
309
300
300
07c2b864d5025c3ecf36de38e6b93de36f6f0286
bigcode/the-stack
train
253415c030a2785c9a6a7fc7
train
function
async def test_not_check_the_checked_box(page): await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.check("input") assert await page.evaluate("checkbox.checked")
async def test_not_check_the_checked_box(page):
await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.check("input") assert await page.evaluate("checkbox.checked")
dialog = await dialog_promise await dialog.dismiss() async def test_check_the_box(page): await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.check("input") assert await page.evaluate("checkbox.checked") async def test_not_check_the_checked_box(page):
64
64
45
10
54
arjun27/playwright-python
tests/async/test_click.py
Python
test_not_check_the_checked_box
test_not_check_the_checked_box
971
974
971
971
b71398407755687240079aec53932359a0653898
bigcode/the-stack
train
c3ff7812c8c494df568ec01e
train
function
async def test_click_an_offscreen_element_when_scroll_behavior_is_smooth(page): await page.setContent( """ <div style="border: 1px solid black; height: 500px; overflow: auto; width: 500px; scroll-behavior: smooth"> <button style="margin-top: 2000px" onClick="window.clicked = true">hi</bu...
async def test_click_an_offscreen_element_when_scroll_behavior_is_smooth(page):
await page.setContent( """ <div style="border: 1px solid black; height: 500px; overflow: auto; width: 500px; scroll-behavior: smooth"> <button style="margin-top: 2000px" onClick="window.clicked = true">hi</button> </div> """ ) await page.click("button") assert...
Key") is False await page.click("button") assert await page.evaluate("shiftKey") await page.keyboard.up("Shift") await page.click("button") assert await page.evaluate("shiftKey") is False async def test_click_an_offscreen_element_when_scroll_behavior_is_smooth(page):
64
64
109
16
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_an_offscreen_element_when_scroll_behavior_is_smooth
test_click_an_offscreen_element_when_scroll_behavior_is_smooth
776
785
776
776
a4dc115b278b082e635e048be63f05eb1aefbbf9
bigcode/the-stack
train
212c83cd1b23df9d7e03ab75
train
function
async def test_click_a_rotated_button(page, server): await page.goto(server.PREFIX + "/input/rotatedButton.html") await page.click("button") assert await page.evaluate("result") == "Clicked"
async def test_click_a_rotated_button(page, server):
await page.goto(server.PREFIX + "/input/rotatedButton.html") await page.click("button") assert await page.evaluate("result") == "Clicked"
long text that will go offscreen'; button.style.position = 'absolute'; button.style.left = '368px'; }""" ) await page.click("button") assert await page.evaluate("() => window.result") == "Clicked" async def test_click_a_rotated_button(page, server):
64
64
47
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_a_rotated_button
test_click_a_rotated_button
356
359
356
356
a6604bed9522e11a28264a3acc2bdc354a226fc4
bigcode/the-stack
train
2678e10c49732988f834cdd4
train
function
async def test_click_svg(page, server): await page.setContent( """ <svg height="100" width="100"> <circle onclick="javascript:window.__CLICKED=42" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /> </svg> """ ) await page.click("circle") asse...
async def test_click_svg(page, server):
await page.setContent( """ <svg height="100" width="100"> <circle onclick="javascript:window.__CLICKED=42" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /> </svg> """ ) await page.click("circle") assert await page.evaluate("window.__CLICKED...
requestAnimationFrame(() => requestAnimationFrame(f)))" ) async def test_click_the_button(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("result") == "Clicked" async def test_click_svg(page, server):
64
64
98
9
55
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_svg
test_click_svg
35
44
35
35
1366e8fded315c2fbe686f4bd8865ed9d8af7815
bigcode/the-stack
train
08cdb9a17b477129a69b1b05
train
function
async def test_not_retarget_when_element_is_recycled_on_hover(page, server): await page.goto(server.PREFIX + "/react.html") await page.evaluate( """() => { function shuffle() { renderComponent(e('div', {}, [e(MyButton, { name: 'button2' }), e(MyButton, { name: 'button1' })] )...
async def test_not_retarget_when_element_is_recycled_on_hover(page, server):
await page.goto(server.PREFIX + "/react.html") await page.evaluate( """() => { function shuffle() { renderComponent(e('div', {}, [e(MyButton, { name: 'button2' }), e(MyButton, { name: 'button1' })] )); } renderComponent(e('div', {}, [e(MyButton, { name...
name: 'button2' })] )); }""" ) await page.click("text=button1") assert await page.evaluate("window.button1") assert await page.evaluate("window.button2") is None async def test_not_retarget_when_element_is_recycled_on_hover(page, server):
64
64
158
17
46
arjun27/playwright-python
tests/async/test_click.py
Python
test_not_retarget_when_element_is_recycled_on_hover
test_not_retarget_when_element_is_recycled_on_hover
928
941
928
928
f94d3c7ccadee87d776ed6d89cca1bb7977b9ce9
bigcode/the-stack
train
0f5bc28ac3d7320dc0bdcfaf
train
function
async def test_fail_when_element_detaches_after_animation(page, server): await page.goto(server.PREFIX + "/input/animating-button.html") await page.evaluate("addButton()") handle = await page.querySelector("button") promise = asyncio.create_task(handle.click()) await asyncio.sleep(0) # execute sche...
async def test_fail_when_element_detaches_after_animation(page, server):
await page.goto(server.PREFIX + "/input/animating-button.html") await page.evaluate("addButton()") handle = await page.querySelector("button") promise = asyncio.create_task(handle.click()) await asyncio.sleep(0) # execute scheduled tasks, but don't await them await page.evaluate("stopButton(tru...
None try: await handle.click(force=True) except Error as e: error = e assert await page.evaluate("window.clicked") is None assert "Element is not attached to the DOM" in error.message async def test_fail_when_element_detaches_after_animation(page, server):
64
64
137
14
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_fail_when_element_detaches_after_animation
test_fail_when_element_detaches_after_animation
804
817
804
804
be2d1baad3e08f8783d59b5aaf4098adf9336e83
bigcode/the-stack
train
7b6c5ef7eaf2d34e8ee9428f
train
function
async def test_uncheck_the_box(page): await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False
async def test_uncheck_the_box(page):
await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False
") assert await page.evaluate("checkbox.checked") async def test_not_check_the_checked_box(page): await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.check("input") assert await page.evaluate("checkbox.checked") async def test_uncheck_the_box(page):
64
64
48
9
55
arjun27/playwright-python
tests/async/test_click.py
Python
test_uncheck_the_box
test_uncheck_the_box
977
980
977
977
9c0d462bcb1d5cce3f72e00a3785c7828b8d79cf
bigcode/the-stack
train
ad650cbcde3651e83fcd60b2
train
function
async def test_click_a_button_in_scrolling_container_with_offset( page, server, is_webkit ): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { container = document.createElement('div'); container.style.overflow =...
async def test_click_a_button_in_scrolling_container_with_offset( page, server, is_webkit ):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { container = document.createElement('div'); container.style.overflow = 'auto'; container.style.width = '200px'; container.style.height = '200px...
() => offsetX") == 1900 + 8 if is_webkit else 1900 assert await page.evaluate("() => offsetY") == 1910 + 8 if is_webkit else 1910 async def test_click_a_button_in_scrolling_container_with_offset( page, server, is_webkit ):
71
71
237
23
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_a_button_in_scrolling_container_with_offset
test_click_a_button_in_scrolling_container_with_offset
436
459
436
438
de093d2b53506c5020d8a9a7902ddd5a792bb6f3
bigcode/the-stack
train
81969488f543b036b500dd95
train
function
async def test_wait_for_select_to_be_enabled(page, server): await page.setContent( '<select onclick="javascript:window.__CLICKED=true;" disabled><option selected>Hello</option></select>' ) done = [] async def click(): await page.click("select") done.append(True) click_promi...
async def test_wait_for_select_to_be_enabled(page, server):
await page.setContent( '<select onclick="javascript:window.__CLICKED=true;" disabled><option selected>Hello</option></select>' ) done = [] async def click(): await page.click("select") done.append(True) click_promise = asyncio.create_task(click()) await give_it_a_chance...
assert await page.evaluate("window.__CLICKED") is None assert done == [] await page.evaluate("document.querySelector('input').removeAttribute('disabled')") await click_promise assert await page.evaluate("window.__CLICKED") async def test_wait_for_select_to_be_enabled(page, server):
64
64
138
13
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_select_to_be_enabled
test_wait_for_select_to_be_enabled
675
691
675
675
9488066720a3b97fdc9a85a87520c5f378de19cd
bigcode/the-stack
train
4e077a4740f9a2abbfb1f6d7
train
function
async def test_climb_up_to_role_button(page, server): await page.setContent( '<div role=button onclick="javascript:window.__CLICKED=true;"><div style="pointer-events:none"><span><div>Click target</div></span></div>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLI...
async def test_climb_up_to_role_button(page, server):
await page.setContent( '<div role=button onclick="javascript:window.__CLICKED=true;"><div style="pointer-events:none"><span><div>Click target</div></span></div>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED")
( '<button onclick="javascript:window.__CLICKED=true;"><label style="pointer-events:none">Click target</label></button>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED") async def test_climb_up_to_role_button(page, server):
64
64
78
13
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_climb_up_to_role_button
test_climb_up_to_role_button
710
715
710
710
9bed80adc1578c86ad5ec71237a51b8a349c2400
bigcode/the-stack
train
bfc834a72627cec4a7ec445f
train
function
async def test_check_the_box_inside_label_without_id(page): await page.setContent( '<label>Text<span><input id="checkbox" type="checkbox"></input></span></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked")
async def test_check_the_box_inside_label_without_id(page):
await page.setContent( '<label>Text<span><input id="checkbox" type="checkbox"></input></span></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked")
(page): await page.setContent( '<label for="checkbox">Text</label><div><input id="checkbox" type="checkbox"></input></div>' ) await page.check("label") assert await page.evaluate("checkbox.checked") async def test_check_the_box_inside_label_without_id(page):
64
64
58
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_check_the_box_inside_label_without_id
test_check_the_box_inside_label_without_id
1,005
1,010
1,005
1,005
3271126235041603c50666039c7874c89ab7ab39
bigcode/the-stack
train
ec17b38716c7c06b2ab4df38
train
function
async def test_report_nice_error_when_element_is_detached_and_force_clicked( page, server ): await page.goto(server.PREFIX + "/input/animating-button.html") await page.evaluate("addButton()") handle = await page.querySelector("button") await page.evaluate("stopButton(true)") error = None try...
async def test_report_nice_error_when_element_is_detached_and_force_clicked( page, server ):
await page.goto(server.PREFIX + "/input/animating-button.html") await page.evaluate("addButton()") handle = await page.querySelector("button") await page.evaluate("stopButton(true)") error = None try: await handle.click(force=True) except Error as e: error = e assert awai...
: 2000px" onClick="window.clicked = true">hi</button> </div> """ ) await page.click("button") assert await page.evaluate("window.clicked") async def test_report_nice_error_when_element_is_detached_and_force_clicked( page, server ):
64
64
119
22
42
arjun27/playwright-python
tests/async/test_click.py
Python
test_report_nice_error_when_element_is_detached_and_force_clicked
test_report_nice_error_when_element_is_detached_and_force_clicked
788
801
788
790
8c282b85e9679279a331cb74dfe5500b20edfcd0
bigcode/the-stack
train
9a4c79b627aaf7b750728e55
train
function
async def test_click_a_very_large_button_with_offset(page, server, is_webkit): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "button => button.style.borderWidth = '8px'") await page.evalOnSelector( "button", "button => button.style.height = button.style.wi...
async def test_click_a_very_large_button_with_offset(page, server, is_webkit):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "button => button.style.borderWidth = '8px'") await page.evalOnSelector( "button", "button => button.style.height = button.style.width = '2000px'" ) await page.click("button", position={"x": 1900, "y": ...
X") == 12 * 2 + 20 if is_webkit else 20 assert await page.evaluate("offsetY") == 12 * 2 + 10 if is_webkit else 10 async def test_click_a_very_large_button_with_offset(page, server, is_webkit):
64
64
185
19
44
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_a_very_large_button_with_offset
test_click_a_very_large_button_with_offset
423
433
423
423
d0a668b50dc909cfa40c4c4dc214a92a44c188e5
bigcode/the-stack
train
662b9432596f234f80f66302
train
function
async def test_click_the_button_after_navigation(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button") await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("() => result") == "Clicked"
async def test_click_the_button_after_navigation(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.click("button") await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("() => result") == "Clicked"
context = await browser.newContext() page = await context.newPage() try: await asyncio.gather( page.close(), page.mouse.click(1, 2), ) except Error: pass await context.close() async def test_click_the_button_after_navigation(page, server):
64
64
66
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_after_navigation
test_click_the_button_after_navigation
81
86
81
81
5f700c1d933672fff1cf10f6e092364d83e06431
bigcode/the-stack
train
35613656ae058463c317a1ae
train
function
async def test_click_disabled_div(page, server): await page.setContent( '<div onclick="javascript:window.__CLICKED=true;" disabled>Click target</div>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED")
async def test_click_disabled_div(page, server):
await page.setContent( '<div onclick="javascript:window.__CLICKED=true;" disabled>Click target</div>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED")
(page) assert await page.evaluate("window.__CLICKED") is None assert done == [] await page.evaluate("document.querySelector('select').removeAttribute('disabled')") await click_promise assert await page.evaluate("window.__CLICKED") async def test_click_disabled_div(page, server):
64
64
59
10
54
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_disabled_div
test_click_disabled_div
694
699
694
694
cef68178e6800222c5a16b9b01c586b6b727b6af
bigcode/the-stack
train
a4d778a8467e3e492ed0b39d
train
function
async def test_double_click_the_button(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evaluate( """() => { window.double = false; button = document.querySelector('button'); button.addEventListener('dblclick', event => window.double = t...
async def test_double_click_the_button(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evaluate( """() => { window.double = false; button = document.querySelector('button'); button.addEventListener('dblclick', event => window.double = true); }""" ) await page.dblclick("but...
document.querySelector('#button-5').textContent") == "clicked" ) await page.click("#button-80") assert ( await page.evaluate("document.querySelector('#button-80').textContent") == "clicked" ) async def test_double_click_the_button(page, server):
64
64
99
11
53
arjun27/playwright-python
tests/async/test_click.py
Python
test_double_click_the_button
test_double_click_the_button
326
338
326
326
4993cb618e5ae8528a9d8e4337f7a43b70cffdd3
bigcode/the-stack
train
3fe7501a9afc4a5748e6fed9
train
function
async def test_click_the_button_after_a_cross_origin_navigation_(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button") await page.goto(server.CROSS_PROCESS_PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("() => result") =...
async def test_click_the_button_after_a_cross_origin_navigation_(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.click("button") await page.goto(server.CROSS_PROCESS_PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("() => result") == "Clicked"
REFIX + "/input/button.html") await page.click("button") await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("() => result") == "Clicked" async def test_click_the_button_after_a_cross_origin_navigation_(page, server):
64
64
72
16
48
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_after_a_cross_origin_navigation_
test_click_the_button_after_a_cross_origin_navigation_
89
94
89
89
66739c6b75783594d47ac30ee11d3ce365ecc27a
bigcode/the-stack
train
84100c0cdd5beaf708b83f22
train
function
async def test_check_the_box_by_aria_role(page): await page.setContent( """<div role='checkbox' id='checkbox'>CHECKBOX</div> <script> checkbox.addEventListener('click', () => checkbox.setAttribute('aria-checked', 'true')) </script>""" ) await page.check("div") assert ...
async def test_check_the_box_by_aria_role(page):
await page.setContent( """<div role='checkbox' id='checkbox'>CHECKBOX</div> <script> checkbox.addEventListener('click', () => checkbox.setAttribute('aria-checked', 'true')) </script>""" ) await page.check("div") assert await page.evaluate("checkbox.getAttribute('aria-...
='radio'>one</input> <input id='two' type='radio'>two</input> <input type='radio'>three</input>""" ) await page.check("#two") assert await page.evaluate("two.checked") async def test_check_the_box_by_aria_role(page):
64
64
88
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_check_the_box_by_aria_role
test_check_the_box_by_aria_role
1,024
1,032
1,024
1,024
caee1bd5fdc0222ef0124108540322db4a724560
bigcode/the-stack
train
8402fd4222e118b32798d250
train
function
async def test_wait_for_BUTTON_to_be_clickable_when_it_has_pointer_events_none( page, server ): await page.setContent( '<button onclick="javascript:window.__CLICKED=true;" style="pointer-events:none"><span>Click target</span></button>' ) done = [] async def click(): await page.click...
async def test_wait_for_BUTTON_to_be_clickable_when_it_has_pointer_events_none( page, server ):
await page.setContent( '<button onclick="javascript:window.__CLICKED=true;" style="pointer-events:none"><span>Click target</span></button>' ) done = [] async def click(): await page.click("text=Click target") done.append(True) click_promise = asyncio.create_task(click()) ...
="pointer-events:none"><span><div>Click target</div></span></div>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED") async def test_wait_for_BUTTON_to_be_clickable_when_it_has_pointer_events_none( page, server ):
64
64
163
23
41
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_BUTTON_to_be_clickable_when_it_has_pointer_events_none
test_wait_for_BUTTON_to_be_clickable_when_it_has_pointer_events_none
718
738
718
720
a2750523b3c7031c7e5c5233179f1fc3adf24d1f
bigcode/the-stack
train
7e601f1d7cbeb38a2b5d6d95
train
function
async def test_click_when_one_of_inline_box_children_is_outside_of_viewport( page, server ): await page.setContent( """ <style> i { position: absolute top: -1000px } </style> <span onclick='javascript:window.CLICKED = 42;'><i>woof</i><b>dog...
async def test_click_when_one_of_inline_box_children_is_outside_of_viewport( page, server ):
await page.setContent( """ <style> i { position: absolute top: -1000px } </style> <span onclick='javascript:window.CLICKED = 42;'><i>woof</i><b>doggo</b></span> """ ) await page.click("span") assert await page.evaluate("() =...
"/wrappedlink.html") await asyncio.gather(page.click("a"), page.waitForNavigation()) assert page.url == server.PREFIX + "/wrappedlink.html#clicked" await context.close() async def test_click_when_one_of_inline_box_children_is_outside_of_viewport( page, server ):
64
64
117
23
41
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_when_one_of_inline_box_children_is_outside_of_viewport
test_click_when_one_of_inline_box_children_is_outside_of_viewport
106
121
106
108
8ebf9314dc2ebe597dd0fcce1b8d74147f5fd8c2
bigcode/the-stack
train
1b95d0e168f741a783ec4ef5
train
function
async def test_timeout_waiting_for_stable_position(page, server): await page.goto(server.PREFIX + "/input/button.html") button = await page.querySelector("button") await button.evaluate( """button => { button.style.transition = 'margin 5s linear 0s' button.style.marginLeft = ...
async def test_timeout_waiting_for_stable_position(page, server):
await page.goto(server.PREFIX + "/input/button.html") button = await page.querySelector("button") await button.evaluate( """button => { button.style.transition = 'margin 5s linear 0s' button.style.marginLeft = '200px' }""" ) error = None try: awai...
""", ) await page.click("button") assert await page.evaluate("window.result") == "Clicked" assert await page.evaluate("pageX") == 300 assert await page.evaluate("pageY") == 10 async def test_timeout_waiting_for_stable_position(page, server):
64
64
151
14
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_timeout_waiting_for_stable_position
test_timeout_waiting_for_stable_position
516
533
516
516
57fa4bbde7764bbbedd3f5fabb73d8b1263b7f91
bigcode/the-stack
train
65b27dfaa2b524b1d4f967ea
train
function
async def test_click_the_button_if_window_node_is_removed(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evaluate("() => delete window.Node") await page.click("button") assert await page.evaluate("() => result") == "Clicked"
async def test_click_the_button_if_window_node_is_removed(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evaluate("() => delete window.Node") await page.click("button") assert await page.evaluate("() => result") == "Clicked"
" r="40" stroke="black" stroke-width="3" fill="red" /> </svg> """ ) await page.click("circle") assert await page.evaluate("window.__CLICKED") == 42 async def test_click_the_button_if_window_node_is_removed(page, server):
64
64
60
15
48
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_if_window_node_is_removed
test_click_the_button_if_window_node_is_removed
47
51
47
47
dabae13faa86234af1d0cbbe74b09ca121d4f9a2
bigcode/the-stack
train
1c9a1c03ae6dfed887754c66
train
function
async def test_not_uncheck_the_unchecked_box(page): await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False
async def test_not_uncheck_the_unchecked_box(page):
await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False
("checkbox.checked") async def test_uncheck_the_box(page): await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False async def test_not_uncheck_the_unchecked_box(page):
64
64
49
12
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_not_uncheck_the_unchecked_box
test_not_uncheck_the_unchecked_box
983
986
983
983
9a402897ff4869811c3a41d8992ede034f6f4038
bigcode/the-stack
train
456dbc9a01e46194f754c22e
train
function
async def test_click_wrapped_links(page, server): await page.goto(server.PREFIX + "/wrappedlink.html") await page.click("a") assert await page.evaluate("window.__clicked")
async def test_click_wrapped_links(page, server):
await page.goto(server.PREFIX + "/wrappedlink.html") await page.click("a") assert await page.evaluate("window.__clicked")
_to_click(page) assert done == [] await page.evalOnSelector("button", "b => b.parentElement.style.display = 'block'") await clicked assert done == [True] assert await page.evaluate("result") == "Clicked" async def test_click_wrapped_links(page, server):
64
64
41
11
53
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_wrapped_links
test_click_wrapped_links
261
264
261
261
d76c373e9c2758bb3558dde22fc11cd7b6a951ad
bigcode/the-stack
train
62ac8d95e630c8185d6aaa6e
train
function
async def test_scroll_and_click_the_button(page, server): await page.goto(server.PREFIX + "/input/scrollable.html") await page.click("#button-5") assert ( await page.evaluate("document.querySelector('#button-5').textContent") == "clicked" ) await page.click("#button-80") assert (...
async def test_scroll_and_click_the_button(page, server):
await page.goto(server.PREFIX + "/input/scrollable.html") await page.click("#button-5") assert ( await page.evaluate("document.querySelector('#button-5').textContent") == "clicked" ) await page.click("#button-80") assert ( await page.evaluate("document.querySelector('#but...
6["viewport"], hasTouch=iphone_6["hasTouch"] ) page = await context.newPage() await page.mouse.down() await page.mouse.move(100, 10) await page.mouse.up() await context.close() async def test_scroll_and_click_the_button(page, server):
64
64
97
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_scroll_and_click_the_button
test_scroll_and_click_the_button
312
323
312
312
f4bfe8c6ec43751a4887762f96dc9f0e8d513229
bigcode/the-stack
train
bad8574d05d09ca1dfb6912b
train
function
async def test_wait_for_LABEL_to_be_clickable_when_it_has_pointer_events_none( page, server ): await page.setContent( '<label onclick="javascript:window.__CLICKED=true;" style="pointer-events:none"><span>Click target</span></label>' ) click_promise = asyncio.create_task(page.click("text=Click ta...
async def test_wait_for_LABEL_to_be_clickable_when_it_has_pointer_events_none( page, server ):
await page.setContent( '<label onclick="javascript:window.__CLICKED=true;" style="pointer-events:none"><span>Click target</span></label>' ) click_promise = asyncio.create_task(page.click("text=Click target")) # Do a few roundtrips to the page. for _ in range(5): assert await page.ev...
[] await page.evaluate( "document.querySelector('button').style.removeProperty('pointer-events')" ) await click_promise assert await page.evaluate("window.__CLICKED") async def test_wait_for_LABEL_to_be_clickable_when_it_has_pointer_events_none( page, server ):
64
64
164
23
41
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_LABEL_to_be_clickable_when_it_has_pointer_events_none
test_wait_for_LABEL_to_be_clickable_when_it_has_pointer_events_none
741
756
741
743
143a1c324e2d713872150db7da8b4c7aff0fff14
bigcode/the-stack
train
8f5e3f85fb84f8e14fd90769
train
function
async def test_click_on_a_span_with_an_inline_element_inside(page, server): await page.setContent( """ <style> span::before { content: 'q' } </style> <span onclick='javascript:window.CLICKED=42'></span> """ ) await page.click("span") as...
async def test_click_on_a_span_with_an_inline_element_inside(page, server):
await page.setContent( """ <style> span::before { content: 'q' } </style> <span onclick='javascript:window.CLICKED=42'></span> """ ) await page.click("span") assert await page.evaluate("window.CLICKED") == 42
, server): await page.goto(server.PREFIX + "/input/button.html") await page.evaluate("() => delete window.Node") await page.click("button") assert await page.evaluate("() => result") == "Clicked" async def test_click_on_a_span_with_an_inline_element_inside(page, server):
64
64
87
16
48
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_on_a_span_with_an_inline_element_inside
test_click_on_a_span_with_an_inline_element_inside
54
66
54
54
11f827edd33025a94ce5ad782a6a30691a30c907
bigcode/the-stack
train
bac3353afc19d64f5ecd5d48
train
function
async def test_wait_for_button_to_be_enabled(page, server): await page.setContent( '<button onclick="javascript:window.__CLICKED=true;" disabled><span>Click target</span></button>' ) done = list() async def click(): await page.click("text=Click target") done.append(True) cl...
async def test_wait_for_button_to_be_enabled(page, server):
await page.setContent( '<button onclick="javascript:window.__CLICKED=true;" disabled><span>Click target</span></button>' ) done = list() async def click(): await page.click("text=Click target") done.append(True) click_promise = asyncio.create_task(click()) await give_it...
blocker.style.left = '0' blocker.style.top = '0' document.body.appendChild(blocker) }""" ) await button.click(force=True) assert await page.evaluate("window.result") == "Was not clicked" async def test_wait_for_button_to_be_enabled(page, server):
64
64
145
13
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_button_to_be_enabled
test_wait_for_button_to_be_enabled
623
639
623
623
1ed6b4d3b976f9ca8cb1735f65c99d8663275b6d
bigcode/the-stack
train
0abbef7fc1fb9167de08005d
train
function
async def test_click_on_checkbox_label_and_toggle(page, server): await page.goto(server.PREFIX + "/input/checkbox.html") assert await page.evaluate("result.check") is None await page.click('label[for="agree"]') assert await page.evaluate("result.check") assert await page.evaluate("result.events") ==...
async def test_click_on_checkbox_label_and_toggle(page, server):
await page.goto(server.PREFIX + "/input/checkbox.html") assert await page.evaluate("result.check") is None await page.click('label[for="agree"]') assert await page.evaluate("result.check") assert await page.evaluate("result.events") == [ "click", "input", "change", ] ...
"mouseenter", "mousemove", "mousedown", "mouseup", "click", "input", "change", ] await page.click("input#agree") assert await page.evaluate("result.check") is False async def test_click_on_checkbox_label_and_toggle(page, server):
64
64
109
13
50
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_on_checkbox_label_and_toggle
test_click_on_checkbox_label_and_toggle
286
297
286
286
0d1704baa041186fcb80b024f1d06267035130f0
bigcode/the-stack
train
1dac72a53d72191a4e01b620
train
function
async def test_timeout_when_click_opens_alert(page, server): dialog_promise = asyncio.create_task(page.waitForEvent("dialog")) await asyncio.sleep(0) # execute scheduled tasks, but don't await them await page.setContent('<div onclick="window.alert(123)">Click me</div>') error = None try: aw...
async def test_timeout_when_click_opens_alert(page, server):
dialog_promise = asyncio.create_task(page.waitForEvent("dialog")) await asyncio.sleep(0) # execute scheduled tasks, but don't await them await page.setContent('<div onclick="window.alert(123)">Click me</div>') error = None try: await page.click("div", timeout=3000) except TimeoutError a...
_is_corrupted(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evaluate("window.innerWidth = 0") await page.click("button") assert await page.evaluate("result") == "Clicked" async def test_timeout_when_click_opens_alert(page, server):
64
64
124
13
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_timeout_when_click_opens_alert
test_timeout_when_click_opens_alert
951
962
951
951
a368c2011f753c0ad824536c6d0eb50e08acba2d
bigcode/the-stack
train
818edaaa441a80c97e3ae9cf
train
function
async def test_wait_for_becoming_hit_target(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { button.style.borderWidth = '0'; button.style.width = '200px'; button.style.height = '20px'; ...
async def test_wait_for_becoming_hit_target(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { button.style.borderWidth = '0'; button.style.width = '200px'; button.style.height = '20px'; document.body.style.margin = '0'; docu...
' }""" ) error = None try: await button.click(timeout=5000) except Error as e: error = e assert "Timeout 5000ms exceeded." in error.message assert "waiting for element to be visible, enabled and not moving" in error.message assert "element is moving - waiting" in err...
93
93
312
13
79
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_becoming_hit_target
test_wait_for_becoming_hit_target
536
574
536
536
9c89f4e8d7ebb41f7a2e8653a8101d7e7b6b7dfa
bigcode/the-stack
train
159b3bf91c1ed757db088911
train
function
async def test_click_a_partially_obscured_button(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evaluate( """() => { button = document.querySelector('button'); button.textContent = 'Some really long text that will go offscreen'; button...
async def test_click_a_partially_obscured_button(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evaluate( """() => { button = document.querySelector('button'); button.textContent = 'Some really long text that will go offscreen'; button.style.position = 'absolute'; button.style.left = '3...
button.addEventListener('dblclick', event => window.double = true); }""" ) await page.dblclick("button") assert await page.evaluate("double") assert await page.evaluate("result") == "Clicked" async def test_click_a_partially_obscured_button(page, server):
64
64
107
15
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_a_partially_obscured_button
test_click_a_partially_obscured_button
341
353
341
341
7d4a6c5ef9e2d5d278a419e7d23aed6407c6d54c
bigcode/the-stack
train
e6cfd956f3b736492ba6bf79
train
function
async def test_climb_dom_for_inner_label_with_pointer_events_none(page, server): await page.setContent( '<button onclick="javascript:window.__CLICKED=true;"><label style="pointer-events:none">Click target</label></button>' ) await page.click("text=Click target") assert await page.evaluate("windo...
async def test_climb_dom_for_inner_label_with_pointer_events_none(page, server):
await page.setContent( '<button onclick="javascript:window.__CLICKED=true;"><label style="pointer-events:none">Click target</label></button>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED")
page.setContent( '<div onclick="javascript:window.__CLICKED=true;" disabled>Click target</div>' ) await page.click("text=Click target") assert await page.evaluate("window.__CLICKED") async def test_climb_dom_for_inner_label_with_pointer_events_none(page, server):
64
64
73
17
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_climb_dom_for_inner_label_with_pointer_events_none
test_climb_dom_for_inner_label_with_pointer_events_none
702
707
702
702
466ef1ee3eadb989e04a415ba722627acea2e0ba
bigcode/the-stack
train
21686598815e816c19890799
train
function
async def test_click_on_checkbox_input_and_toggle(page, server): await page.goto(server.PREFIX + "/input/checkbox.html") assert await page.evaluate("() => result.check") is None await page.click("input#agree") assert await page.evaluate("result.check") assert await page.evaluate("result.events") == ...
async def test_click_on_checkbox_input_and_toggle(page, server):
await page.goto(server.PREFIX + "/input/checkbox.html") assert await page.evaluate("() => result.check") is None await page.click("input#agree") assert await page.evaluate("result.check") assert await page.evaluate("result.events") == [ "mouseover", "mouseenter", "mousemove",...
await page.evaluate("result") == "Clicked" async def test_click_wrapped_links(page, server): await page.goto(server.PREFIX + "/wrappedlink.html") await page.click("a") assert await page.evaluate("window.__clicked") async def test_click_on_checkbox_input_and_toggle(page, server):
64
64
125
13
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_on_checkbox_input_and_toggle
test_click_on_checkbox_input_and_toggle
267
283
267
267
f0610dd1e202622429616d2a8661ec7f95bfa8ee
bigcode/the-stack
train
44d687b5d60e6ade55213ab7
train
function
async def give_it_a_chance_to_click(page): for _ in range(5): await page.evaluate( "() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)))" )
async def give_it_a_chance_to_click(page):
for _ in range(5): await page.evaluate( "() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)))" )
an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import asyncio import pytest from playwright import Error, TimeoutError async def give_it_a_chance_to_click(page):
64
64
44
11
52
arjun27/playwright-python
tests/async/test_click.py
Python
give_it_a_chance_to_click
give_it_a_chance_to_click
22
26
22
22
f4b92d7207c3bc7b4fba720b1e9da0d12f1a7e70
bigcode/the-stack
train
7f74c66aae97c7c689144470
train
function
async def test_click_links_which_cause_navigation(page, server): await page.setContent(f'<a href="{server.EMPTY_PAGE}">empty.html</a>') # This await should not hang. await page.click("a")
async def test_click_links_which_cause_navigation(page, server):
await page.setContent(f'<a href="{server.EMPTY_PAGE}">empty.html</a>') # This await should not hang. await page.click("a")
.PREFIX + "/input/scrollable.html") await page.click("#button-8", button="right") assert ( await page.evaluate("document.querySelector('#button-8').textContent") == "context menu" ) async def test_click_links_which_cause_navigation(page, server):
64
64
49
14
50
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_links_which_cause_navigation
test_click_links_which_cause_navigation
371
374
371
371
ac66ee7954349195768bf8f32d7a03770d29013c
bigcode/the-stack
train
d341054e8e39b67ca64746c8
train
function
async def test_click_the_button(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("result") == "Clicked"
async def test_click_the_button(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("result") == "Clicked"
pytest from playwright import Error, TimeoutError async def give_it_a_chance_to_click(page): for _ in range(5): await page.evaluate( "() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)))" ) async def test_click_the_button(page, server):
64
64
42
10
54
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button
test_click_the_button
29
32
29
29
da14afe60937f480ac233b2c5a47ac5c778220d1
bigcode/the-stack
train
5e89560d0bc13ff6d03ee60b
train
function
@pytest.mark.skip_browser("firefox") async def test_click_the_button_with_offset_with_page_scale( browser, server, is_chromium, is_webkit ): context = await browser.newContext( viewport={"width": 400, "height": 400}, isMobile=True ) page = await context.newPage() await page.goto(server.PREFI...
@pytest.mark.skip_browser("firefox") async def test_click_the_button_with_offset_with_page_scale( browser, server, is_chromium, is_webkit ):
context = await browser.newContext( viewport={"width": 400, "height": 400}, isMobile=True ) page = await context.newPage() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { button.style.borderWidth = '8px' do...
page.evaluate("offsetX") == 1900 + 8 if is_webkit else 1900 assert await page.evaluate("offsetY") == 1910 + 8 if is_webkit else 1910 @pytest.mark.skip_browser("firefox") async def test_click_the_button_with_offset_with_page_scale( browser, server, is_chromium, is_webkit ):
82
82
275
35
46
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_with_offset_with_page_scale
test_click_the_button_with_offset_with_page_scale
462
490
462
465
1965eb0e179c7808de868cc2a52196efa0bc6dac
bigcode/the-stack
train
ff748385117ede748b37c778
train
function
async def test_wait_for_stable_position(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { button.style.transition = 'margin 500ms linear 0s'; button.style.marginLeft = '200px'; button.style...
async def test_wait_for_stable_position(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector( "button", """button => { button.style.transition = 'margin 500ms linear 0s'; button.style.marginLeft = '200px'; button.style.borderWidth = '0'; button.style.width = '2...
-> css conversion. expected = {"x": 27, "y": 18} assert await page.evaluate("pageX") == expected["x"] assert await page.evaluate("pageY") == expected["y"] await context.close() async def test_wait_for_stable_position(page, server):
64
64
184
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_stable_position
test_wait_for_stable_position
493
513
493
493
dbcacd6650a82e663d2bc63ad178e9183eee3877
bigcode/the-stack
train
881596cfbb45a2a99675c31e
train
function
async def test_wait_for_visibility_hidden_to_be_gone(page, server): done = list() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.visibility = 'hidden'") async def click(): await page.click("button", timeout=0) done.append(True) ...
async def test_wait_for_visibility_hidden_to_be_gone(page, server):
done = list() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.visibility = 'hidden'") async def click(): await page.click("button", timeout=0) done.append(True) clicked = asyncio.create_task(click()) await give_it_a_chance...
clicked" assert done == [] await page.evalOnSelector("button", "b => b.style.display = 'block'") await clicked assert done == [True] assert await page.evaluate("result") == "Clicked" async def test_wait_for_visibility_hidden_to_be_gone(page, server):
64
64
154
15
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_visibility_hidden_to_be_gone
test_wait_for_visibility_hidden_to_be_gone
200
216
200
200
4f75b6a456eca72985d672ee0b6b00a04d8c3657
bigcode/the-stack
train
a41f189a020079bad436107f
train
function
async def test_check_the_box(page): await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.check("input") assert await page.evaluate("checkbox.checked")
async def test_check_the_box(page):
await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.check("input") assert await page.evaluate("checkbox.checked")
None try: await page.click("div", timeout=3000) except TimeoutError as e: error = e assert "Timeout 3000ms exceeded" in error.message dialog = await dialog_promise await dialog.dismiss() async def test_check_the_box(page):
64
64
41
8
56
arjun27/playwright-python
tests/async/test_click.py
Python
test_check_the_box
test_check_the_box
965
968
965
965
7aff231548f9cf4f7642b1f3e519502d6a885fb8
bigcode/the-stack
train
52eaf36a97612696c1bed306
train
function
async def test_update_modifiers_correctly(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button", modifiers=["Shift"]) assert await page.evaluate("shiftKey") await page.click("button", modifiers=[]) assert await page.evaluate("shiftKey") is False await pa...
async def test_update_modifiers_correctly(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.click("button", modifiers=["Shift"]) assert await page.evaluate("shiftKey") await page.click("button", modifiers=[]) assert await page.evaluate("shiftKey") is False await page.keyboard.down("Shift") await page.click("button", ...
remove 'pointer-events: none' css from button. await page.evaluate( "document.querySelector('label').style.removeProperty('pointer-events')" ) await click_promise assert await page.evaluate("window.__CLICKED") async def test_update_modifiers_correctly(page, server):
64
64
140
12
52
arjun27/playwright-python
tests/async/test_click.py
Python
test_update_modifiers_correctly
test_update_modifiers_correctly
759
773
759
759
06acd865d8a34151a8d0c339f4afcc4677ccaba2
bigcode/the-stack
train
ba8a6460981d93cc554fe5c3
train
function
async def test_waitFor_visible_when_parent_is_hidden(page, server): done = list() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.parentElement.style.display = 'none'") async def click(): await page.click("button", timeout=0) done.append...
async def test_waitFor_visible_when_parent_is_hidden(page, server):
done = list() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.parentElement.style.display = 'none'") async def click(): await page.click("button", timeout=0) done.append(True) clicked = asyncio.create_task(click()) await give_it...
= e assert "Timeout 5000ms exceeded" in error.message assert "waiting for element to be visible, enabled and not moving" in error.message assert "element is not visible - waiting" in error.message async def test_waitFor_visible_when_parent_is_hidden(page, server):
64
64
143
14
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_waitFor_visible_when_parent_is_hidden
test_waitFor_visible_when_parent_is_hidden
243
258
243
243
cedfdc9fdbf703011734f2b31f951533ee8cc71c
bigcode/the-stack
train
89f418199ebfd06884eb0394
train
function
async def test_wait_with_force(page, server): error = None await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.display = 'none'") try: await page.click("button", force=True) except Error as e: error = e assert "Element is not vi...
async def test_wait_with_force(page, server):
error = None await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.display = 'none'") try: await page.click("button", force=True) except Error as e: error = e assert "Element is not visible" in error.message assert await page....
button #10 clicked", ] async def test_waitFor_visible_when_already_visible(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("result") == "Clicked" async def test_wait_with_force(page, server):
64
64
97
10
54
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_with_force
test_wait_with_force
169
178
169
169
7444f5e417e6fbf151b0d449bc8d0c4abb5d6312
bigcode/the-stack
train
d69d8782ce2c554e1af92289
train
function
async def test_waitFor_visible_when_already_visible(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("result") == "Clicked"
async def test_waitFor_visible_when_already_visible(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.click("button") assert await page.evaluate("result") == "Clicked"
button #4 clicked", "button #5 clicked", "button #6 clicked", "button #7 clicked", "button #8 clicked", "button #9 clicked", "button #10 clicked", ] async def test_waitFor_visible_when_already_visible(page, server):
63
64
46
14
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_waitFor_visible_when_already_visible
test_waitFor_visible_when_already_visible
163
166
163
163
60889401eb48a1805f4ba6ef861e81ea2551aba2
bigcode/the-stack
train
8fbdc58a6bae830492813c36
train
function
async def test_wait_for_display_none_to_be_gone(page, server): done = list() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.display = 'none'") async def click(): await page.click("button", timeout=0) done.append(True) clicked...
async def test_wait_for_display_none_to_be_gone(page, server):
done = list() await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.display = 'none'") async def click(): await page.click("button", timeout=0) done.append(True) clicked = asyncio.create_task(click()) await give_it_a_chance_to_c...
try: await page.click("button", force=True) except Error as e: error = e assert "Element is not visible" in error.message assert await page.evaluate("result") == "Was not clicked" async def test_wait_for_display_none_to_be_gone(page, server):
64
64
154
15
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_wait_for_display_none_to_be_gone
test_wait_for_display_none_to_be_gone
181
197
181
181
87d2c9a441062cedbacbdb8c6fbf5e19aea8904a
bigcode/the-stack
train
3124de53c813e2e8952c558d
train
function
async def test_timeout_waiting_for_display_none_to_be_gone(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.display = 'none'") try: await page.click("button", timeout=5000) except Error as e: error = e assert "Time...
async def test_timeout_waiting_for_display_none_to_be_gone(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.display = 'none'") try: await page.click("button", timeout=5000) except Error as e: error = e assert "Timeout 5000ms exceeded" in error.message assert "waiting for element to b...
assert done == [] await page.evalOnSelector("button", "b => b.style.visibility = 'visible'") await clicked assert done == [True] assert await page.evaluate("result") == "Clicked" async def test_timeout_waiting_for_display_none_to_be_gone(page, server):
64
64
122
17
47
arjun27/playwright-python
tests/async/test_click.py
Python
test_timeout_waiting_for_display_none_to_be_gone
test_timeout_waiting_for_display_none_to_be_gone
219
228
219
219
c3362a0cc0d0328614df26479da895479cc75bf2
bigcode/the-stack
train
f6502f1f3860aae298bd1d07
train
function
async def test_timeout_waiting_for_button_to_be_enabled(page, server): await page.setContent( '<button onclick="javascript:window.__CLICKED=true;" disabled><span>Click target</span></button>' ) error = None try: await page.click("text=Click target", timeout=3000) except TimeoutError ...
async def test_timeout_waiting_for_button_to_be_enabled(page, server):
await page.setContent( '<button onclick="javascript:window.__CLICKED=true;" disabled><span>Click target</span></button>' ) error = None try: await page.click("text=Click target", timeout=3000) except TimeoutError as e: error = e assert await page.evaluate("window.__CLICKE...
("() => window.__CLICKED") is None assert done == [] await page.evaluate("document.querySelector('button').removeAttribute('disabled')") await click_promise assert await page.evaluate("window.__CLICKED") async def test_timeout_waiting_for_button_to_be_enabled(page, server):
64
64
123
15
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_timeout_waiting_for_button_to_be_enabled
test_timeout_waiting_for_button_to_be_enabled
642
653
642
642
30c248abd624a1bf6c2c8ac10c01e48b5caad4cd
bigcode/the-stack
train
888074831dd8e8ce5d2b36be
train
function
async def test_timeout_waiting_for_hit_target(page, server): await page.goto(server.PREFIX + "/input/button.html") button = await page.querySelector("button") await page.evaluate( """() => { document.body.style.position = 'relative' blocker = document.createElement('div') blocker.i...
async def test_timeout_waiting_for_hit_target(page, server):
await page.goto(server.PREFIX + "/input/button.html") button = await page.querySelector("button") await page.evaluate( """() => { document.body.style.position = 'relative' blocker = document.createElement('div') blocker.id = 'blocker'; blocker.style.position = 'absolute' ...
page.evalOnSelector(".flyover", "flyOver => flyOver.style.left = '200px'") await click_promise assert clicked == [False, True] assert await page.evaluate("() => window.result") == "Clicked" async def test_timeout_waiting_for_hit_target(page, server):
64
64
202
13
51
arjun27/playwright-python
tests/async/test_click.py
Python
test_timeout_waiting_for_hit_target
test_timeout_waiting_for_hit_target
577
600
577
577
d04951f557a3d4529ef9ef5e41cc5f8ce78d83b5
bigcode/the-stack
train
daca716fcbdd0cdea5eb8d5a
train
function
async def test_click_the_button_inside_an_iframe(page, server, utils): await page.goto(server.EMPTY_PAGE) await page.setContent('<div style="width:100px;height:100px">spacer</div>') await utils.attach_frame(page, "button-test", server.PREFIX + "/input/button.html") frame = page.frames[1] button = aw...
async def test_click_the_button_inside_an_iframe(page, server, utils):
await page.goto(server.EMPTY_PAGE) await page.setContent('<div style="width:100px;height:100px">spacer</div>') await utils.attach_frame(page, "button-test", server.PREFIX + "/input/button.html") frame = page.frames[1] button = await frame.querySelector("button") await button.click() assert a...
def test_click_links_which_cause_navigation(page, server): await page.setContent(f'<a href="{server.EMPTY_PAGE}">empty.html</a>') # This await should not hang. await page.click("a") async def test_click_the_button_inside_an_iframe(page, server, utils):
64
64
103
16
48
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_the_button_inside_an_iframe
test_click_the_button_inside_an_iframe
377
384
377
377
f792bbaa597ce39f7c7707720f2f746f90e3b5eb
bigcode/the-stack
train
bf6e541ac8eca6ebd087fbba
train
function
async def test_fire_contextmenu_event_on_right_click(page, server): await page.goto(server.PREFIX + "/input/scrollable.html") await page.click("#button-8", button="right") assert ( await page.evaluate("document.querySelector('#button-8').textContent") == "context menu" )
async def test_fire_contextmenu_event_on_right_click(page, server):
await page.goto(server.PREFIX + "/input/scrollable.html") await page.click("#button-8", button="right") assert ( await page.evaluate("document.querySelector('#button-8').textContent") == "context menu" )
"Clicked" async def test_click_a_rotated_button(page, server): await page.goto(server.PREFIX + "/input/rotatedButton.html") await page.click("button") assert await page.evaluate("result") == "Clicked" async def test_fire_contextmenu_event_on_right_click(page, server):
64
64
69
14
50
arjun27/playwright-python
tests/async/test_click.py
Python
test_fire_contextmenu_event_on_right_click
test_fire_contextmenu_event_on_right_click
362
368
362
362
15b79500968ae473e5ed413fd825a0fdc23d1776
bigcode/the-stack
train
481f5075f2deae4f8c869605
train
function
async def test_click_not_throw_when_page_closes(browser, server): context = await browser.newContext() page = await context.newPage() try: await asyncio.gather( page.close(), page.mouse.click(1, 2), ) except Error: pass await context.close()
async def test_click_not_throw_when_page_closes(browser, server):
context = await browser.newContext() page = await context.newPage() try: await asyncio.gather( page.close(), page.mouse.click(1, 2), ) except Error: pass await context.close()
q' } </style> <span onclick='javascript:window.CLICKED=42'></span> """ ) await page.click("span") assert await page.evaluate("window.CLICKED") == 42 async def test_click_not_throw_when_page_closes(browser, server):
64
64
66
14
49
arjun27/playwright-python
tests/async/test_click.py
Python
test_click_not_throw_when_page_closes
test_click_not_throw_when_page_closes
69
78
69
69
1bd7915abfb55809d60b6b2106797bd727673a88
bigcode/the-stack
train
6f9116ab4a94a033b22b25ae
train
function
async def test_check_radio(page): await page.setContent( """ <input type='radio'>one</input> <input id='two' type='radio'>two</input> <input type='radio'>three</input>""" ) await page.check("#two") assert await page.evaluate("two.checked")
async def test_check_radio(page):
await page.setContent( """ <input type='radio'>one</input> <input id='two' type='radio'>two</input> <input type='radio'>three</input>""" ) await page.check("#two") assert await page.evaluate("two.checked")
def test_check_the_box_inside_label_without_id(page): await page.setContent( '<label>Text<span><input id="checkbox" type="checkbox"></input></span></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked") async def test_check_radio(page):
64
64
71
7
57
arjun27/playwright-python
tests/async/test_click.py
Python
test_check_radio
test_check_radio
1,013
1,021
1,013
1,013
c863a5f2c6edba7ed0f28504fe40b1b009d07cfe
bigcode/the-stack
train
51f511cba9ed90826e8f7d3a
train
function
async def test_timeout_waiting_for_visbility_hidden_to_be_gone(page, server): await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.visibility = 'hidden'") try: await page.click("button", timeout=5000) except Error as e: error = e ass...
async def test_timeout_waiting_for_visbility_hidden_to_be_gone(page, server):
await page.goto(server.PREFIX + "/input/button.html") await page.evalOnSelector("button", "b => b.style.visibility = 'hidden'") try: await page.click("button", timeout=5000) except Error as e: error = e assert "Timeout 5000ms exceeded" in error.message assert "waiting for element...
"Timeout 5000ms exceeded" in error.message assert "waiting for element to be visible, enabled and not moving" in error.message assert "element is not visible - waiting" in error.message async def test_timeout_waiting_for_visbility_hidden_to_be_gone(page, server):
64
64
124
19
44
arjun27/playwright-python
tests/async/test_click.py
Python
test_timeout_waiting_for_visbility_hidden_to_be_gone
test_timeout_waiting_for_visbility_hidden_to_be_gone
231
240
231
231
4329a20d5fdba28c12cd9e96f9852030f1f8046b
bigcode/the-stack
train
70bef3021aeb775fef8b7d01
train
function
async def test_fail_when_obscured_and_not_waiting_for_hit_target(page, server): await page.goto(server.PREFIX + "/input/button.html") button = await page.querySelector("button") await page.evaluate( """() => { document.body.style.position = 'relative' blocker = document.creat...
async def test_fail_when_obscured_and_not_waiting_for_hit_target(page, server):
await page.goto(server.PREFIX + "/input/button.html") button = await page.querySelector("button") await page.evaluate( """() => { document.body.style.position = 'relative' blocker = document.createElement('div') blocker.style.position = 'absolute' bloc...
assert "Timeout 5000ms exceeded." in error.message assert '<div id="blocker"></div> intercepts pointer events' in error.message assert "retrying click action" in error.message async def test_fail_when_obscured_and_not_waiting_for_hit_target(page, server):
64
64
147
19
44
arjun27/playwright-python
tests/async/test_click.py
Python
test_fail_when_obscured_and_not_waiting_for_hit_target
test_fail_when_obscured_and_not_waiting_for_hit_target
603
620
603
603
ab0a31bf2c9087543cea7d24fb809d8e1aca7857
bigcode/the-stack
train
ea64f1cb1308c1941688e90d
train
class
class InterfaceSphere(vtk.vtkSphereSource): def __init__(self, index, color=(0.5, 0.5, 0.5), fmt=None): self.index = index # df index if fmt is None: self.color = color else: self.color = C_LOT[fmt]
class InterfaceSphere(vtk.vtkSphereSource):
def __init__(self, index, color=(0.5, 0.5, 0.5), fmt=None): self.index = index # df index if fmt is None: self.color = color else: self.color = C_LOT[fmt]
c_names=color_names, c_subname="400"): c_lot = {} for i, fmt in enumerate(geo_data.formations): c_lot[fmt] = cd_rgb[c_names[i]][c_subname] return c_lot class InterfaceSphere(vtk.vtkSphereSource):
64
64
73
10
53
nre-aachen/gempy
gempy/visualization_vtk.py
Python
InterfaceSphere
InterfaceSphere
18
24
18
18
9fb5666b9153053d6c488dd884a12a116c6df3a5
bigcode/the-stack
train
87113f7df03903cff3d95f4a
train
function
def _get_transform(startPoint, endPoint, f): # Compute a basis normalized_x = [0 for i in range(3)] normalized_y = [0 for i in range(3)] normalized_z = [0 for i in range(3)] # The X axis is a vector from start to end math = vtk.vtkMath() math.Subtract(endPoint, startPoint, normalized_x) ...
def _get_transform(startPoint, endPoint, f): # Compute a basis
normalized_x = [0 for i in range(3)] normalized_y = [0 for i in range(3)] normalized_z = [0 for i in range(3)] # The X axis is a vector from start to end math = vtk.vtkMath() math.Subtract(endPoint, startPoint, normalized_x) length = math.Norm(normalized_x) math.Normalize(normalized_x) ...
0.5, 0.5), surface_alpha=1): self.color = color self.surface_alpha = surface_alpha class ColoredSurfaceActor(vtk.vtkActor): def __init__(self, color=(0.5, 0.5, 0.5), surface_alpha=1): self.color = color self.surface_alpha = surface_alpha def _get_transform(startPoint, endPoint, f)...
99
99
332
18
80
nre-aachen/gempy
gempy/visualization_vtk.py
Python
_get_transform
_get_transform
349
386
349
350
758635015a97d8168cb088925c734ed044971adb
bigcode/the-stack
train
a9d431370cb464c24b4b691f
train
function
def _create_arrow_transformers(arrows, geo_data, f2): "Creates list of arrow transformation objects." # grab start and end points for foliation arrows arrows_sp = [] arrows_ep = [] f = 0.75 for arrow in arrows: _sp = (geo_data.foliations.ix[arrow.index]["X"] - geo_data.foliations.ix[arro...
def _create_arrow_transformers(arrows, geo_data, f2):
"Creates list of arrow transformation objects." # grab start and end points for foliation arrows arrows_sp = [] arrows_ep = [] f = 0.75 for arrow in arrows: _sp = (geo_data.foliations.ix[arrow.index]["X"] - geo_data.foliations.ix[arrow.index]["G_x"] / f, geo_data.foliation...
.Identity() for i in range(3): matrix.SetElement(i, 0, normalized_x[i]) matrix.SetElement(i, 1, normalized_y[i]) matrix.SetElement(i, 2, normalized_z[i]) # Apply the transforms transform = vtk.vtkTransform() transform.Translate(startPoint) transform.Concatenate(matrix) t...
110
110
368
15
94
nre-aachen/gempy
gempy/visualization_vtk.py
Python
_create_arrow_transformers
_create_arrow_transformers
389
414
389
389
4326e6ac701b09dc99e7c64a1ebd05ca9f603a65
bigcode/the-stack
train
a527701aa43143fde532a6fd
train
function
def _create_foliation_arrows(geo_data): "Creates FoliationArrow (vtkArrowSource) for all foliation positions in dataframe." arrows = [] for index, row in geo_data.foliations.iterrows(): arrows.append(FoliationArrow(index, fmt=geo_data.interfaces.iloc[index]["formation"])) return arrows
def _create_foliation_arrows(geo_data):
"Creates FoliationArrow (vtkArrowSource) for all foliation positions in dataframe." arrows = [] for index, row in geo_data.foliations.iterrows(): arrows.append(FoliationArrow(index, fmt=geo_data.interfaces.iloc[index]["formation"])) return arrows
formation"])) spheres[-1].SetCenter(geo_data.interfaces.ix[index]["X"], geo_data.interfaces.ix[index]["Y"], geo_data.interfaces.ix[index]["Z"]) spheres[-1].SetRadius(r) return spheres def _create_foliation_arrows(geo_data):
64
64
73
12
51
nre-aachen/gempy
gempy/visualization_vtk.py
Python
_create_foliation_arrows
_create_foliation_arrows
308
313
308
308
ae1882da46547a4c2dbe1fca9fdb8a73beb0a67e
bigcode/the-stack
train
8d5892854f8b740faf75c68d
train
class
class ColoredSurfaceActor(vtk.vtkActor): def __init__(self, color=(0.5, 0.5, 0.5), surface_alpha=1): self.color = color self.surface_alpha = surface_alpha
class ColoredSurfaceActor(vtk.vtkActor):
def __init__(self, color=(0.5, 0.5, 0.5), surface_alpha=1): self.color = color self.surface_alpha = surface_alpha
class CustomPolyData(vtk.vtkPolyData): def __init__(self, color=(0.5, 0.5, 0.5), surface_alpha=1): self.color = color self.surface_alpha = surface_alpha class ColoredSurfaceActor(vtk.vtkActor):
64
64
52
10
53
nre-aachen/gempy
gempy/visualization_vtk.py
Python
ColoredSurfaceActor
ColoredSurfaceActor
343
346
343
343
92ab0f9b57ba4dceb8228430c5207ac24e9ed15b
bigcode/the-stack
train
d62b2818af5f76303fcf55c7
train
function
def _create_cameras(_e, verbose=0): _e_dx = _e[1] - _e[0] _e_dy = _e[3] - _e[2] _e_dz = _e[5] - _e[4] _e_d_avrg = (_e_dx + _e_dy + _e_dz) / 3 _e_max = np.argmax(_e) model_cam = vtk.vtkCamera() model_cam.SetPosition(_e[_e_max] * 5, _e[_e_max] * 5, _e[_e_max] * 5) model_cam.SetFocalPoint(...
def _create_cameras(_e, verbose=0):
_e_dx = _e[1] - _e[0] _e_dy = _e[3] - _e[2] _e_dz = _e[5] - _e[4] _e_d_avrg = (_e_dx + _e_dy + _e_dz) / 3 _e_max = np.argmax(_e) model_cam = vtk.vtkCamera() model_cam.SetPosition(_e[_e_max] * 5, _e[_e_max] * 5, _e[_e_max] * 5) model_cam.SetFocalPoint(np.min(_e[0:2]) + _e_dx / 2, ...
(axes_actor) if interf_bool: for a in interf_actors: r.AddActor(a) if fol_bool: for a in arrow_actors: r.AddActor(a) if pot_field is not None: for a in surface_actors: r.AddActor(a) # reset cameras for a...
230
230
769
12
217
nre-aachen/gempy
gempy/visualization_vtk.py
Python
_create_cameras
_create_cameras
234
293
234
234
ab90b36c43135bc0353460373ad3ee230d3039c0
bigcode/the-stack
train
8cb630dd7cb2f41aa3e1fa9c
train
function
def _create_mappers_actors(sources): "Creates mappers and connected actors for all given sources." mappers = [] actors = [] for s in sources: mappers.append(vtk.vtkPolyDataMapper()) if type(s) == CustomPolyData: mappers[-1].SetInputData(s) actors.append(ColoredSur...
def _create_mappers_actors(sources):
"Creates mappers and connected actors for all given sources." mappers = [] actors = [] for s in sources: mappers.append(vtk.vtkPolyDataMapper()) if type(s) == CustomPolyData: mappers[-1].SetInputData(s) actors.append(ColoredSurfaceActor(color=s.color)) ...
(vtkArrowSource) for all foliation positions in dataframe." arrows = [] for index, row in geo_data.foliations.iterrows(): arrows.append(FoliationArrow(index, fmt=geo_data.interfaces.iloc[index]["formation"])) return arrows def _create_mappers_actors(sources):
64
64
215
10
53
nre-aachen/gempy
gempy/visualization_vtk.py
Python
_create_mappers_actors
_create_mappers_actors
316
334
316
316
ad2bd66f08d1508045676d065aa1eb79ca4dc4c1
bigcode/the-stack
train
5704b117ce1be61ea76d5be9
train
function
def color_lot_create(geo_data, cd_rgb=color_dict_rgb, c_names=color_names, c_subname="400"): c_lot = {} for i, fmt in enumerate(geo_data.formations): c_lot[fmt] = cd_rgb[c_names[i]][c_subname] return c_lot
def color_lot_create(geo_data, cd_rgb=color_dict_rgb, c_names=color_names, c_subname="400"):
c_lot = {} for i, fmt in enumerate(geo_data.formations): c_lot[fmt] = cd_rgb[c_names[i]][c_subname] return c_lot
for sphenix to find the packages sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) import numpy as np from gempy.colors import * def color_lot_create(geo_data, cd_rgb=color_dict_rgb, c_names=color_names, c_subname="400"):
64
64
69
26
38
nre-aachen/gempy
gempy/visualization_vtk.py
Python
color_lot_create
color_lot_create
11
15
11
11
f9f2ab3e83eb74994751f246eff98fc67322e4f4
bigcode/the-stack
train
e47f5fe44bd750e35869fb45
train
class
class ColoredActor(vtk.vtkActor): def __init__(self, index, color=(0.5, 0.5, 0.5)): self.index = index self.color = color
class ColoredActor(vtk.vtkActor):
def __init__(self, index, color=(0.5, 0.5, 0.5)): self.index = index self.color = color
, color=(0.5, 0.5, 0.5), fmt=None): self.index = index # df index if fmt is None: self.color = color else: self.color = C_LOT[fmt] class ColoredActor(vtk.vtkActor):
64
64
46
9
55
nre-aachen/gempy
gempy/visualization_vtk.py
Python
ColoredActor
ColoredActor
36
39
36
36
53ba759718bd0c2fcc36a5d751156a9cd9c489d9
bigcode/the-stack
train