Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
select_with_join_union_subquery_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to select from a view with a stored query that includes `UNION ALL`, `JOIN` and two subqueries if and only if the user has SELECT privilege on all the tables and the view, either directly or through a role.
Check that user is able to select from a view with a stored query that includes `UNION ALL`, `JOIN` and two subqueries if and only if the user has SELECT privilege on all the tables and the view, either directly or through a role.
def select_with_join_union_subquery_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to select from a view with a stored query that includes `UNION ALL`, `JOIN` and two subqueries if and only if the user has SELECT privilege on all the tables and the view, either directly or t...
[ "def", "select_with_join_union_subquery_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ...
[ 1101, 0 ]
[ 1118, 135 ]
python
en
['en', 'en', 'en']
True
select_with_join_union_subquery
(self, grant_target_name, user_name, node=None)
Grant SELECT on the view and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
Grant SELECT on the view and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
def select_with_join_union_subquery(self, grant_target_name, user_name, node=None): """Grant SELECT on the view and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them. """ view_name = f"view_{getuid()}" table0_name = f"table0_{getuid(...
[ "def", "select_with_join_union_subquery", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "...
[ 1121, 0 ]
[ 1159, 62 ]
python
en
['en', 'en', 'en']
True
select_with_nested_views_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to select from a view with a stored query that includes other views if and only if the user has SELECT privilege on all of the views and the source tables for those views, either directly or through a role.
Check that user is able to select from a view with a stored query that includes other views if and only if the user has SELECT privilege on all of the views and the source tables for those views, either directly or through a role.
def select_with_nested_views_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to select from a view with a stored query that includes other views if and only if the user has SELECT privilege on all of the views and the source tables for those views, either directly or through ...
[ "def", "select_with_nested_views_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", ...
[ 1162, 0 ]
[ 1179, 128 ]
python
en
['en', 'en', 'en']
True
select_with_nested_views
(self, grant_target_name, user_name, node=None)
Grant SELECT on views and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
Grant SELECT on views and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
def select_with_nested_views(self, grant_target_name, user_name, node=None): """Grant SELECT on views and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them. """ view0_name = f"view0_{getuid()}" view1_name = f"view1_{getuid()}" vi...
[ "def", "select_with_nested_views", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view0_name", "=", "f\"view0_{getuid()}\"", "view1_name", "=", "f\"view1_{getuid()}\"", "view2_name", "=", "f\"view2_{getuid()}\"", "view3_nam...
[ 1182, 0 ]
[ 1231, 67 ]
python
en
['en', 'en', 'en']
True
select_with_privilege_granted_directly_or_via_role_without_target_table_privilege
(self, node=None)
Check that user is able to select from a materialized view without target table SELECT privilege.
Check that user is able to select from a materialized view without target table SELECT privilege.
def select_with_privilege_granted_directly_or_via_role_without_target_table_privilege(self, node=None): """Check that user is able to select from a materialized view without target table SELECT privilege. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: nod...
[ "def", "select_with_privilege_granted_directly_or_via_role_without_target_table_privilege", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", ...
[ 1234, 0 ]
[ 1250, 141 ]
python
en
['en', 'en', 'en']
True
select_without_target_table_privilege
(self, grant_target_name, user_name, node=None)
GRANT the user SELECT privilege on the view and check the user is able to successfully SELECT from the view without target table privilege.
GRANT the user SELECT privilege on the view and check the user is able to successfully SELECT from the view without target table privilege.
def select_without_target_table_privilege(self, grant_target_name, user_name, node=None): """GRANT the user SELECT privilege on the view and check the user is able to successfully SELECT from the view without target table privilege. """ view_name = f"view_{getuid()}" table_name = f"table_{getuid()}" ...
[ "def", "select_without_target_table_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node"...
[ 1253, 0 ]
[ 1270, 58 ]
python
en
['en', 'en', 'en']
True
select_from_tables
(self, node=None)
Testing RBAC functionality of SELECT for tables related to materialized views - target tables, source tables.
Testing RBAC functionality of SELECT for tables related to materialized views - target tables, source tables.
def select_from_tables(self, node=None): """Testing RBAC functionality of SELECT for tables related to materialized views - target tables, source tables. """ Scenario(run=select_from_implicit_target_table_privilege_granted_directly_or_via_role, setup=instrument_clickhouse_server_log) Scenario(run=select...
[ "def", "select_from_tables", "(", "self", ",", "node", "=", "None", ")", ":", "Scenario", "(", "run", "=", "select_from_implicit_target_table_privilege_granted_directly_or_via_role", ",", "setup", "=", "instrument_clickhouse_server_log", ")", "Scenario", "(", "run", "="...
[ 1274, 0 ]
[ 1279, 121 ]
python
en
['en', 'en', 'en']
True
select_from_implicit_target_table_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to SELECT from the implicit target table created from a materialized view if they have SELECT privilege on that table.
Check that user is able to SELECT from the implicit target table created from a materialized view if they have SELECT privilege on that table.
def select_from_implicit_target_table_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to SELECT from the implicit target table created from a materialized view if they have SELECT privilege on that table. """ user_name = f"user_{getuid()}" role_name = f"role_{getu...
[ "def", "select_from_implicit_target_table_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ...
[ 1285, 0 ]
[ 1302, 137 ]
python
en
['en', 'en', 'en']
True
select_from_implicit_target_table
(self, grant_target_name, user_name, node=None)
Grant SELECT on the implicit target table and check the user is able to SELECT only if they have SELECT privilege on the table.
Grant SELECT on the implicit target table and check the user is able to SELECT only if they have SELECT privilege on the table.
def select_from_implicit_target_table(self, grant_target_name, user_name, node=None): """Grant SELECT on the implicit target table and check the user is able to SELECT only if they have SELECT privilege on the table. """ view_name = f"view_{getuid()}" implicit_table_name = f"\\\".inner.{view_name}\\\"" ...
[ "def", "select_from_implicit_target_table", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "implicit_table_name", "=", "f\"\\\\\\\".inner.{view_name}\\\\\\\"\"", "exitcode", ",", "mess...
[ 1305, 0 ]
[ 1335, 58 ]
python
en
['en', 'en', 'en']
True
select_from_explicit_target_table_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to SELECT from the explicit target table created from a materialized view if they have SELECT privilege on that table.
Check that user is able to SELECT from the explicit target table created from a materialized view if they have SELECT privilege on that table.
def select_from_explicit_target_table_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to SELECT from the explicit target table created from a materialized view if they have SELECT privilege on that table. """ user_name = f"user_{getuid()}" role_name = f"role_{getu...
[ "def", "select_from_explicit_target_table_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ...
[ 1341, 0 ]
[ 1358, 137 ]
python
en
['en', 'en', 'en']
True
select_from_explicit_target_table
(self, grant_target_name, user_name, node=None)
Grant SELECT on the explicit target table and check the user is able to SELECT only if they have SELECT privilege on the table.
Grant SELECT on the explicit target table and check the user is able to SELECT only if they have SELECT privilege on the table.
def select_from_explicit_target_table(self, grant_target_name, user_name, node=None): """Grant SELECT on the explicit target table and check the user is able to SELECT only if they have SELECT privilege on the table. """ view_name = f"view_{getuid()}" table_name = f"table_{getuid()}" exitcode, messa...
[ "def", "select_from_explicit_target_table", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ...
[ 1361, 0 ]
[ 1392, 62 ]
python
en
['en', 'en', 'en']
True
select_from_source_table_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to SELECT from the source table of a materialized view if they have SELECT privilege on that table.
Check that user is able to SELECT from the source table of a materialized view if they have SELECT privilege on that table.
def select_from_source_table_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to SELECT from the source table of a materialized view if they have SELECT privilege on that table. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None:...
[ "def", "select_from_source_table_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", ...
[ 1398, 0 ]
[ 1415, 128 ]
python
en
['en', 'en', 'en']
True
select_from_source_table
(self, grant_target_name, user_name, node=None)
Grant SELECT on the source table and check the user is able to SELECT only if they have SELECT privilege on the table.
Grant SELECT on the source table and check the user is able to SELECT only if they have SELECT privilege on the table.
def select_from_source_table(self, grant_target_name, user_name, node=None): """Grant SELECT on the source table and check the user is able to SELECT only if they have SELECT privilege on the table. """ view_name = f"view_{getuid()}" table_name = f"table_{getuid()}" exitcode, message = errors.not_en...
[ "def", "select_from_source_table", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "n...
[ 1418, 0 ]
[ 1449, 62 ]
python
en
['en', 'en', 'en']
True
drop
(self, node=None)
Test the RBAC functionality of the `DROP VIEW` command.
Test the RBAC functionality of the `DROP VIEW` command.
def drop(self, node=None): """Test the RBAC functionality of the `DROP VIEW` command. """ Scenario(run=drop_with_privilege_granted_directly_or_via_role, setup=instrument_clickhouse_server_log) Scenario(run=drop_with_revoked_privilege_revoked_directly_or_from_role, setup=instrument_clickhouse_server_log)
[ "def", "drop", "(", "self", ",", "node", "=", "None", ")", ":", "Scenario", "(", "run", "=", "drop_with_privilege_granted_directly_or_via_role", ",", "setup", "=", "instrument_clickhouse_server_log", ")", "Scenario", "(", "run", "=", "drop_with_revoked_privilege_revok...
[ 1455, 0 ]
[ 1459, 115 ]
python
en
['en', 'en', 'en']
True
drop_with_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to drop view with DROP VIEW privilege if the user has privilege directly or through a role.
Check that user is able to drop view with DROP VIEW privilege if the user has privilege directly or through a role.
def drop_with_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to drop view with DROP VIEW privilege if the user has privilege directly or through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.contex...
[ "def", "drop_with_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", "....
[ 1462, 0 ]
[ 1478, 107 ]
python
en
['en', 'en', 'en']
True
drop_with_privilege
(self, grant_target_name, user_name, node=None)
Grant DROP VIEW privilege and check the user is able to successfully drop a view.
Grant DROP VIEW privilege and check the user is able to successfully drop a view.
def drop_with_privilege(self, grant_target_name, user_name, node=None): """Grant DROP VIEW privilege and check the user is able to successfully drop a view. """ view_name = f"view_{getuid()}" exitcode, message = errors.table_does_not_exist(name=f"default.{view_name}") if node is None: node ...
[ "def", "drop_with_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "table_does_not_exist", "(", "name", "=", "f\"def...
[ 1481, 0 ]
[ 1505, 58 ]
python
en
['en', 'en', 'en']
True
drop_with_revoked_privilege_revoked_directly_or_from_role
(self, node=None)
Check that user is unable to drop view with DROP VIEW privilege revoked directly or from a role.
Check that user is unable to drop view with DROP VIEW privilege revoked directly or from a role.
def drop_with_revoked_privilege_revoked_directly_or_from_role(self, node=None): """Check that user is unable to drop view with DROP VIEW privilege revoked directly or from a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node ...
[ "def", "drop_with_revoked_privilege_revoked_directly_or_from_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "conte...
[ 1508, 0 ]
[ 1524, 104 ]
python
en
['en', 'en', 'en']
True
drop_with_revoked_privilege
(self, grant_target_name, user_name, node=None)
Revoke DROP VIEW privilege and check the user is unable to DROP a view.
Revoke DROP VIEW privilege and check the user is unable to DROP a view.
def drop_with_revoked_privilege(self, grant_target_name, user_name, node=None): """Revoke DROP VIEW privilege and check the user is unable to DROP a view. """ view_name = f"view_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") if node is None: node = self.co...
[ "def", "drop_with_revoked_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", ...
[ 1527, 0 ]
[ 1552, 58 ]
python
en
['en', 'en', 'en']
True
modify_query
(self, node=None)
Test the RBAC functionality of the `MODIFY QUERY` command.
Test the RBAC functionality of the `MODIFY QUERY` command.
def modify_query(self, node=None): """Test the RBAC functionality of the `MODIFY QUERY` command. """ if node is None: node = self.context.node with allow_experimental_alter_materialized_view_structure(node): Scenario(run=modify_query_with_privilege_granted_directly_or_via_role, setup=in...
[ "def", "modify_query", "(", "self", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "allow_experimental_alter_materialized_view_structure", "(", "node", ")", ":", "Scenario", "(",...
[ 1558, 0 ]
[ 1573, 131 ]
python
en
['en', 'en', 'en']
True
modify_query_with_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to modify view with MODIFY QUERY if the user has privilege directly or through a role.
Check that user is able to modify view with MODIFY QUERY if the user has privilege directly or through a role.
def modify_query_with_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to modify view with MODIFY QUERY if the user has privilege directly or through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.con...
[ "def", "modify_query_with_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "contex...
[ 1576, 0 ]
[ 1592, 115 ]
python
en
['en', 'en', 'en']
True
modify_query_with_privilege
(self, grant_target_name, user_name, node=None)
Grant MODIFY QUERY and check that user is able to execute it.
Grant MODIFY QUERY and check that user is able to execute it.
def modify_query_with_privilege(self, grant_target_name, user_name, node=None): """Grant MODIFY QUERY and check that user is able to execute it. """ view_name = f"view_{getuid()}" if node is None: node = self.context.node try: with Given("I have a view"): node.query(f"DR...
[ "def", "modify_query_with_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "t...
[ 1595, 0 ]
[ 1615, 58 ]
python
en
['en', 'en', 'en']
True
modify_query_with_privilege_revoked_directly_or_from_role
(self, node=None)
Check that user is unable to modify the view query with MODIFY QUERY if the privilege has been revoked, directly or from a role.
Check that user is unable to modify the view query with MODIFY QUERY if the privilege has been revoked, directly or from a role.
def modify_query_with_privilege_revoked_directly_or_from_role(self, node=None): """Check that user is unable to modify the view query with MODIFY QUERY if the privilege has been revoked, directly or from a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: ...
[ "def", "modify_query_with_privilege_revoked_directly_or_from_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "conte...
[ 1618, 0 ]
[ 1634, 112 ]
python
en
['en', 'en', 'en']
True
modify_query_with_revoked_privilege
(self, grant_target_name, user_name, node=None)
Revoke MODIFY QUERY and check that user is unable to modify the view query.
Revoke MODIFY QUERY and check that user is unable to modify the view query.
def modify_query_with_revoked_privilege(self, grant_target_name, user_name, node=None): """Revoke MODIFY QUERY and check that user is unable to modify the view query. """ view_name = f"view_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") if node is None: no...
[ "def", "modify_query_with_revoked_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name",...
[ 1637, 0 ]
[ 1661, 58 ]
python
en
['en', 'en', 'en']
True
modify_query_without_source_table_privilege
(self, node=None)
Check that user is unable to modify the view query to have a source table in the stored query without SELECT privilege for the new source table.
Check that user is unable to modify the view query to have a source table in the stored query without SELECT privilege for the new source table.
def modify_query_without_source_table_privilege(self, node=None): """Check that user is unable to modify the view query to have a source table in the stored query without SELECT privilege for the new source table. """ user_name = f"user_{getuid()}" view_name = f"view_{getuid()}" table_name = f"t...
[ "def", "modify_query_without_source_table_privilege", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "view_name", "=", "f\"view_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "error...
[ 1664, 0 ]
[ 1690, 66 ]
python
en
['en', 'en', 'en']
True
modify_query_with_source_table_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to modify the view query to have a source table in the stored query, if and only if the user has SELECT privilege for the view and the source table, either directly or from a role.
Check that user is able to modify the view query to have a source table in the stored query, if and only if the user has SELECT privilege for the view and the source table, either directly or from a role.
def modify_query_with_source_table_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to modify the view query to have a source table in the stored query, if and only if the user has SELECT privilege for the view and the source table, either directly or from a role. """ ...
[ "def", "modify_query_with_source_table_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", "...
[ 1693, 0 ]
[ 1710, 134 ]
python
en
['en', 'en', 'en']
True
modify_query_with_source_table_privilege
(self, user_name, grant_target_name, node=None)
Grant MODIFY QUERY privilege on view and SELECT privilege on the new source table and check the user is able to modify the view query.
Grant MODIFY QUERY privilege on view and SELECT privilege on the new source table and check the user is able to modify the view query.
def modify_query_with_source_table_privilege(self, user_name, grant_target_name, node=None): """Grant MODIFY QUERY privilege on view and SELECT privilege on the new source table and check the user is able to modify the view query. """ view_name = f"view_{getuid()}" table_name = f"table_{getuid()}" ...
[ "def", "modify_query_with_source_table_privilege", "(", "self", ",", "user_name", ",", "grant_target_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "no...
[ 1713, 0 ]
[ 1737, 62 ]
python
en
['en', 'en', 'en']
True
modify_query_with_subquery_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to modify the view query to use a query with two subqueries if and only if the user has MODIFY QUERY privilege for that view and SELECT for all the tables, either directly or through a role.
Check that user is able to modify the view query to use a query with two subqueries if and only if the user has MODIFY QUERY privilege for that view and SELECT for all the tables, either directly or through a role.
def modify_query_with_subquery_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to modify the view query to use a query with two subqueries if and only if the user has MODIFY QUERY privilege for that view and SELECT for all the tables, either directly or through a role. ""...
[ "def", "modify_query_with_subquery_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", ...
[ 1740, 0 ]
[ 1757, 130 ]
python
en
['en', 'en', 'en']
True
modify_query_with_subquery
(self, user_name, grant_target_name, node=None)
Grant MODIFY QUERY on the view and SELECT on tables included in the MODIFY QUERY statement and check the user is able to modify the view query if and only if they have SELECT privilege on all of the tables.
Grant MODIFY QUERY on the view and SELECT on tables included in the MODIFY QUERY statement and check the user is able to modify the view query if and only if they have SELECT privilege on all of the tables.
def modify_query_with_subquery(self, user_name, grant_target_name, node=None): """Grant MODIFY QUERY on the view and SELECT on tables included in the MODIFY QUERY statement and check the user is able to modify the view query if and only if they have SELECT privilege on all of the tables. """ view_name =...
[ "def", "modify_query_with_subquery", "(", "self", ",", "user_name", ",", "grant_target_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "table...
[ 1760, 0 ]
[ 1798, 62 ]
python
en
['en', 'en', 'en']
True
modify_query_with_join_query_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to modify the view query to use a query that includes a `JOIN` statement if and only if the user has SELECT privilege on all the tables and MODIFY QUERY privilege on the view, either directly or through a role.
Check that user is able to modify the view query to use a query that includes a `JOIN` statement if and only if the user has SELECT privilege on all the tables and MODIFY QUERY privilege on the view, either directly or through a role.
def modify_query_with_join_query_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to modify the view query to use a query that includes a `JOIN` statement if and only if the user has SELECT privilege on all the tables and MODIFY QUERY privilege on the view, either directly or ...
[ "def", "modify_query_with_join_query_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", "."...
[ 1801, 0 ]
[ 1818, 126 ]
python
en
['en', 'en', 'en']
True
modify_query_with_join_query
(self, user_name, grant_target_name, node=None)
Grant MODIFY QUERY on the view and SELECT on the tables in the modified query and check the user is able to modify the view query to use a `JOIN` statement if and only if they have SELECT privilege on all of them.
Grant MODIFY QUERY on the view and SELECT on the tables in the modified query and check the user is able to modify the view query to use a `JOIN` statement if and only if they have SELECT privilege on all of them.
def modify_query_with_join_query(self, user_name, grant_target_name, node=None): """Grant MODIFY QUERY on the view and SELECT on the tables in the modified query and check the user is able to modify the view query to use a `JOIN` statement if and only if they have SELECT privilege on all of them. """ vi...
[ "def", "modify_query_with_join_query", "(", "self", ",", "user_name", ",", "grant_target_name", ",", "node", "=", "None", ")", ":", "view_name", "=", "f\"view_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "exi...
[ 1821, 0 ]
[ 1857, 62 ]
python
en
['en', 'en', 'en']
True
modify_query_with_union_query_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to modify the view query to include a `UNION ALL` statement if and only if the user has SELECT privilege on all the tables and MODIFY QUERY on the view, either directly or through a role.
Check that user is able to modify the view query to include a `UNION ALL` statement if and only if the user has SELECT privilege on all the tables and MODIFY QUERY on the view, either directly or through a role.
def modify_query_with_union_query_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to modify the view query to include a `UNION ALL` statement if and only if the user has SELECT privilege on all the tables and MODIFY QUERY on the view, either directly or through a role. ""...
[ "def", "modify_query_with_union_query_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", "....
[ 1860, 0 ]
[ 1877, 127 ]
python
en
['en', 'en', 'en']
True
privilege_granted_directly_or_via_role
(self, node=None)
Check that user is only able to execute DROP DATABASE when they have required privilege, either directly or via role.
Check that user is only able to execute DROP DATABASE when they have required privilege, either directly or via role.
def privilege_granted_directly_or_via_role(self, node=None): """Check that user is only able to execute DROP DATABASE when they have required privilege, either directly or via role. """ role_name = f"role_{getuid()}" user_name = f"user_{getuid()}" if node is None: node = self.context.node ...
[ "def", "privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "role_name", "=", "f\"role_{getuid()}\"", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node...
[ 5, 0 ]
[ 27, 92 ]
python
en
['en', 'en', 'en']
True
privilege_check
(grant_target_name, user_name, node=None)
Run scenarios to check the user's access with different privileges.
Run scenarios to check the user's access with different privileges.
def privilege_check(grant_target_name, user_name, node=None): """Run scenarios to check the user's access with different privileges. """ exitcode, message = errors.not_enough_privileges(name=f"{user_name}") with Scenario("user without privilege"): db_name = f"db_{getuid()}" try: ...
[ "def", "privilege_check", "(", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "f\"{user_name}\"", ")", "with", "Scenario", "(", "\"user without...
[ 29, 0 ]
[ 128, 64 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of DROP DATABASE.
Check the RBAC functionality of DROP DATABASE.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of DROP DATABASE. """ self.context.node = self.context.cluster.node(node) if parallel is not None: self.context.parallel = parallel if stress is not None: self.context.stress = stress ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 137, 0 ]
[ 148, 48 ]
python
en
['en', 'en', 'en']
True
software_reset
(i2c=None, **kwargs)
Sends a software reset (SWRST) command to all servo drivers on the bus.
Sends a software reset (SWRST) command to all servo drivers on the bus.
def software_reset(i2c=None, **kwargs): """Sends a software reset (SWRST) command to all servo drivers on the bus.""" # Setup I2C interface for device 0x00 to talk to all of them. if i2c is None: import Adafruit_GPIO.I2C as I2C i2c = I2C self._device = i2c.get_i2c_device(0x00, **kwargs) ...
[ "def", "software_reset", "(", "i2c", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Setup I2C interface for device 0x00 to talk to all of them.", "if", "i2c", "is", "None", ":", "import", "Adafruit_GPIO", ".", "I2C", "as", "I2C", "i2c", "=", "I2C", "self", ...
[ 54, 0 ]
[ 61, 32 ]
python
en
['en', 'en', 'en']
True
PCA9685.__init__
(self, address=PCA9685_ADDRESS, i2c=None, **kwargs)
Initialize the PCA9685.
Initialize the PCA9685.
def __init__(self, address=PCA9685_ADDRESS, i2c=None, **kwargs): """Initialize the PCA9685.""" # Setup I2C interface for the device. if i2c is None: import I2C as I2C i2c = I2C self._device = i2c.get_i2c_device(address, **kwargs) self.set_all_pwm(0, 0) ...
[ "def", "__init__", "(", "self", ",", "address", "=", "PCA9685_ADDRESS", ",", "i2c", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Setup I2C interface for the device.", "if", "i2c", "is", "None", ":", "import", "I2C", "as", "I2C", "i2c", "=", "I2C", ...
[ 67, 4 ]
[ 81, 25 ]
python
en
['en', 'en', 'en']
True
PCA9685.set_pwm_freq
(self, freq_hz)
Set the PWM frequency to the provided value in hertz.
Set the PWM frequency to the provided value in hertz.
def set_pwm_freq(self, freq_hz): """Set the PWM frequency to the provided value in hertz.""" prescaleval = 25000000.0 # 25MHz prescaleval /= 4096.0 # 12-bit prescaleval /= float(freq_hz) prescaleval -= 1.0 logger.debug('Setting PWM frequency to {0} Hz'.format(fre...
[ "def", "set_pwm_freq", "(", "self", ",", "freq_hz", ")", ":", "prescaleval", "=", "25000000.0", "# 25MHz", "prescaleval", "/=", "4096.0", "# 12-bit", "prescaleval", "/=", "float", "(", "freq_hz", ")", "prescaleval", "-=", "1.0", "logger", ".", "debug", "(", ...
[ 83, 4 ]
[ 99, 50 ]
python
en
['en', 'en', 'en']
True
PCA9685.set_pwm
(self, channel, on, off)
Sets a single PWM channel.
Sets a single PWM channel.
def set_pwm(self, channel, on, off): """Sets a single PWM channel.""" self._device.write8(LED0_ON_L+4*channel, on & 0xFF) self._device.write8(LED0_ON_H+4*channel, on >> 8) self._device.write8(LED0_OFF_L+4*channel, off & 0xFF) self._device.write8(LED0_OFF_H+4*channel, off >> 8)
[ "def", "set_pwm", "(", "self", ",", "channel", ",", "on", ",", "off", ")", ":", "self", ".", "_device", ".", "write8", "(", "LED0_ON_L", "+", "4", "*", "channel", ",", "on", "&", "0xFF", ")", "self", ".", "_device", ".", "write8", "(", "LED0_ON_H",...
[ 101, 4 ]
[ 106, 59 ]
python
en
['en', 'en', 'en']
True
PCA9685.set_all_pwm
(self, on, off)
Sets all PWM channels.
Sets all PWM channels.
def set_all_pwm(self, on, off): """Sets all PWM channels.""" self._device.write8(ALL_LED_ON_L, on & 0xFF) self._device.write8(ALL_LED_ON_H, on >> 8) self._device.write8(ALL_LED_OFF_L, off & 0xFF) self._device.write8(ALL_LED_OFF_H, off >> 8)
[ "def", "set_all_pwm", "(", "self", ",", "on", ",", "off", ")", ":", "self", ".", "_device", ".", "write8", "(", "ALL_LED_ON_L", ",", "on", "&", "0xFF", ")", "self", ".", "_device", ".", "write8", "(", "ALL_LED_ON_H", ",", "on", ">>", "8", ")", "sel...
[ 108, 4 ]
[ 113, 52 ]
python
en
['en', 'en', 'en']
True
import_path
(fullpath)
Import a file with full path specification. Allows one to import from any directory, something __import__ does not do. Args: fullpath: Path and filename of import. Returns: An imported module.
Import a file with full path specification. Allows one to import from any directory, something __import__ does not do.
def import_path(fullpath): """Import a file with full path specification. Allows one to import from any directory, something __import__ does not do. Args: fullpath: Path and filename of import. Returns: An imported module. """ path, filename = os.path.split(fullpath) filename, ext = os.path...
[ "def", "import_path", "(", "fullpath", ")", ":", "path", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "fullpath", ")", "filename", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "sys", ".", "path", ".", "a...
[ 55, 0 ]
[ 71, 15 ]
python
en
['en', 'en', 'en']
True
Gen_uncompressed.format_js
(self, code)
Format JS in a way that python's format method can work with to not consider brace-wrapped sections to be format replacements while still replacing known keys.
Format JS in a way that python's format method can work with to not consider brace-wrapped sections to be format replacements while still replacing known keys.
def format_js(self, code): """Format JS in a way that python's format method can work with to not consider brace-wrapped sections to be format replacements while still replacing known keys. """ key_whitelist = self.closure_env.keys() keys_pipe_separated = reduce(lambda accum, key: accum + "|" ...
[ "def", "format_js", "(", "self", ",", "code", ")", ":", "key_whitelist", "=", "self", ".", "closure_env", ".", "keys", "(", ")", "keys_pipe_separated", "=", "reduce", "(", "lambda", "accum", ",", "key", ":", "accum", "+", "\"|\"", "+", "key", ",", "key...
[ 188, 2 ]
[ 211, 97 ]
python
en
['en', 'en', 'en']
True
is_good_response
(resp)
Returns True if the response seems to be HTML, False otherwise.
Returns True if the response seems to be HTML, False otherwise.
def is_good_response(resp): """ Returns True if the response seems to be HTML, False otherwise. """ content_type = resp.headers['Content-Type'].lower() return (resp.status_code == 200 and content_type is not None and content_type.find('html') > -1)
[ "def", "is_good_response", "(", "resp", ")", ":", "content_type", "=", "resp", ".", "headers", "[", "'Content-Type'", "]", ".", "lower", "(", ")", "return", "(", "resp", ".", "status_code", "==", "200", "and", "content_type", "is", "not", "None", "and", ...
[ 42, 0 ]
[ 49, 47 ]
python
en
['en', 'error', 'th']
False
privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM MOVES` commands if and only if the privilege has been granted directly.
Check that a user is able to execute `SYSTEM MOVES` commands if and only if the privilege has been granted directly.
def privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM MOVES` commands if and only if the privilege has been granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): ...
[ "def", "privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\"{user_...
[ 8, 0 ]
[ 23, 80 ]
python
en
['en', 'en', 'en']
True
privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM MOVES` commands if and only if the privilege has been granted via role.
Check that a user is able to execute `SYSTEM MOVES` commands if and only if the privilege has been granted via role.
def privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM MOVES` commands if and only if the privilege has been granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with...
[ "def", "privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with"...
[ 26, 0 ]
[ 45, 80 ]
python
en
['en', 'en', 'en']
True
check_privilege
(self, privilege, on, grant_target_name, user_name, table_name, node=None)
Run checks for commands that require SYSTEM MOVES privilege.
Run checks for commands that require SYSTEM MOVES privilege.
def check_privilege(self, privilege, on, grant_target_name, user_name, table_name, node=None): """Run checks for commands that require SYSTEM MOVES privilege. """ if node is None: node = self.context.node Suite(test=start_moves)(privilege=privilege, on=on, grant_target_name=grant_target_name, ...
[ "def", "check_privilege", "(", "self", ",", "privilege", ",", "on", ",", "grant_target_name", ",", "user_name", ",", "table_name", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "S...
[ 57, 0 ]
[ 65, 135 ]
python
en
['en', 'en', 'en']
True
start_moves
(self, privilege, on, grant_target_name, user_name, table_name, node=None)
Check that user is only able to execute `SYSTEM START MOVES` when they have privilege.
Check that user is only able to execute `SYSTEM START MOVES` when they have privilege.
def start_moves(self, privilege, on, grant_target_name, user_name, table_name, node=None): """Check that user is only able to execute `SYSTEM START MOVES` when they have privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node ...
[ "def", "start_moves", "(", "self", ",", "privilege", ",", "on", ",", "grant_target_name", ",", "user_name", ",", "table_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "u...
[ 68, 0 ]
[ 110, 55 ]
python
en
['en', 'en', 'en']
True
stop_moves
(self, privilege, on, grant_target_name, user_name, table_name, node=None)
Check that user is only able to execute `SYSTEM STOP MOVES` when they have privilege.
Check that user is only able to execute `SYSTEM STOP MOVES` when they have privilege.
def stop_moves(self, privilege, on, grant_target_name, user_name, table_name, node=None): """Check that user is only able to execute `SYSTEM STOP MOVES` when they have privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node ...
[ "def", "stop_moves", "(", "self", ",", "privilege", ",", "on", ",", "grant_target_name", ",", "user_name", ",", "table_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "us...
[ 113, 0 ]
[ 155, 55 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of SYSTEM MOVES.
Check the RBAC functionality of SYSTEM MOVES.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of SYSTEM MOVES. """ self.context.node = self.context.cluster.node(node) Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_lo...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "privileges_granted_directly", ",", ...
[ 164, 0 ]
[ 170, 82 ]
python
en
['en', 'en', 'en']
True
open_log
(fname)
Log interaction to a file. This function must be invoked immediately after init().
Log interaction to a file. This function must be invoked immediately after init().
def open_log(fname): """Log interaction to a file. This function must be invoked immediately after init(). """ Z3_open_log(fname)
[ "def", "open_log", "(", "fname", ")", ":", "Z3_open_log", "(", "fname", ")" ]
[ 104, 0 ]
[ 106, 22 ]
python
en
['en', 'en', 'en']
True
append_log
(s)
Append user-defined string to interaction log.
Append user-defined string to interaction log.
def append_log(s): """Append user-defined string to interaction log. """ Z3_append_log(s)
[ "def", "append_log", "(", "s", ")", ":", "Z3_append_log", "(", "s", ")" ]
[ 108, 0 ]
[ 110, 20 ]
python
en
['en', 'en', 'en']
True
to_symbol
(s, ctx=None)
Convert an integer or string into a Z3 symbol.
Convert an integer or string into a Z3 symbol.
def to_symbol(s, ctx=None): """Convert an integer or string into a Z3 symbol.""" if _is_int(s): return Z3_mk_int_symbol(_get_ctx(ctx).ref(), s) else: return Z3_mk_string_symbol(_get_ctx(ctx).ref(), s)
[ "def", "to_symbol", "(", "s", ",", "ctx", "=", "None", ")", ":", "if", "_is_int", "(", "s", ")", ":", "return", "Z3_mk_int_symbol", "(", "_get_ctx", "(", "ctx", ")", ".", "ref", "(", ")", ",", "s", ")", "else", ":", "return", "Z3_mk_string_symbol", ...
[ 112, 0 ]
[ 117, 58 ]
python
en
['en', 'gl', 'en']
True
_symbol2py
(ctx, s)
Convert a Z3 symbol back into a Python object.
Convert a Z3 symbol back into a Python object.
def _symbol2py(ctx, s): """Convert a Z3 symbol back into a Python object. """ if Z3_get_symbol_kind(ctx.ref(), s) == Z3_INT_SYMBOL: return "k!%s" % Z3_get_symbol_int(ctx.ref(), s) else: return Z3_get_symbol_string(ctx.ref(), s)
[ "def", "_symbol2py", "(", "ctx", ",", "s", ")", ":", "if", "Z3_get_symbol_kind", "(", "ctx", ".", "ref", "(", ")", ",", "s", ")", "==", "Z3_INT_SYMBOL", ":", "return", "\"k!%s\"", "%", "Z3_get_symbol_int", "(", "ctx", ".", "ref", "(", ")", ",", "s", ...
[ 119, 0 ]
[ 124, 49 ]
python
en
['en', 'cs', 'en']
True
main_ctx
()
Return a reference to the global Z3 context. >>> x = Real('x') >>> x.ctx == main_ctx() True >>> c = Context() >>> c == main_ctx() False >>> x2 = Real('x', c) >>> x2.ctx == c True >>> eq(x, x2) False
Return a reference to the global Z3 context.
def main_ctx(): """Return a reference to the global Z3 context. >>> x = Real('x') >>> x.ctx == main_ctx() True >>> c = Context() >>> c == main_ctx() False >>> x2 = Real('x', c) >>> x2.ctx == c True >>> eq(x, x2) False """ global _main_ctx if _main_ctx is None...
[ "def", "main_ctx", "(", ")", ":", "global", "_main_ctx", "if", "_main_ctx", "is", "None", ":", "_main_ctx", "=", "Context", "(", ")", "return", "_main_ctx" ]
[ 214, 0 ]
[ 232, 20 ]
python
en
['en', 'en', 'en']
True
set_param
(*args, **kws)
Set Z3 global (or module) parameters. >>> set_param(precision=10)
Set Z3 global (or module) parameters.
def set_param(*args, **kws): """Set Z3 global (or module) parameters. >>> set_param(precision=10) """ if z3_debug(): _z3_assert(len(args) % 2 == 0, "Argument list must have an even number of elements.") new_kws = {} for k in kws: v = kws[k] if not set_pp_option(k, v): ...
[ "def", "set_param", "(", "*", "args", ",", "*", "*", "kws", ")", ":", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "len", "(", "args", ")", "%", "2", "==", "0", ",", "\"Argument list must have an even number of elements.\"", ")", "new_kws", "=", "...
[ 243, 0 ]
[ 264, 23 ]
python
en
['en', 'af', 'en']
True
reset_params
()
Reset all global (or module) parameters.
Reset all global (or module) parameters.
def reset_params(): """Reset all global (or module) parameters. """ Z3_global_param_reset_all()
[ "def", "reset_params", "(", ")", ":", "Z3_global_param_reset_all", "(", ")" ]
[ 266, 0 ]
[ 269, 31 ]
python
en
['en', 'id', 'en']
True
set_option
(*args, **kws)
Alias for 'set_param' for backward compatibility.
Alias for 'set_param' for backward compatibility.
def set_option(*args, **kws): """Alias for 'set_param' for backward compatibility. """ return set_param(*args, **kws)
[ "def", "set_option", "(", "*", "args", ",", "*", "*", "kws", ")", ":", "return", "set_param", "(", "*", "args", ",", "*", "*", "kws", ")" ]
[ 271, 0 ]
[ 274, 34 ]
python
en
['en', 'pt', 'en']
True
get_param
(name)
Return the value of a Z3 global (or module) parameter >>> get_param('nlsat.reorder') 'true'
Return the value of a Z3 global (or module) parameter
def get_param(name): """Return the value of a Z3 global (or module) parameter >>> get_param('nlsat.reorder') 'true' """ ptr = (ctypes.c_char_p * 1)() if Z3_global_param_get(str(name), ptr): r = z3core._to_pystr(ptr[0]) return r raise Z3Exception("failed to retrieve value for...
[ "def", "get_param", "(", "name", ")", ":", "ptr", "=", "(", "ctypes", ".", "c_char_p", "*", "1", ")", "(", ")", "if", "Z3_global_param_get", "(", "str", "(", "name", ")", ",", "ptr", ")", ":", "r", "=", "z3core", ".", "_to_pystr", "(", "ptr", "["...
[ 276, 0 ]
[ 286, 65 ]
python
en
['en', 'en', 'en']
True
is_ast
(a)
Return `True` if `a` is an AST node. >>> is_ast(10) False >>> is_ast(IntVal(10)) True >>> is_ast(Int('x')) True >>> is_ast(BoolSort()) True >>> is_ast(Function('f', IntSort(), IntSort())) True >>> is_ast("x") False >>> is_ast(Solver()) False
Return `True` if `a` is an AST node.
def is_ast(a): """Return `True` if `a` is an AST node. >>> is_ast(10) False >>> is_ast(IntVal(10)) True >>> is_ast(Int('x')) True >>> is_ast(BoolSort()) True >>> is_ast(Function('f', IntSort(), IntSort())) True >>> is_ast("x") False >>> is_ast(Solver()) False...
[ "def", "is_ast", "(", "a", ")", ":", "return", "isinstance", "(", "a", ",", "AstRef", ")" ]
[ 415, 0 ]
[ 433, 32 ]
python
en
['en', 'lb', 'en']
True
eq
(a, b)
Return `True` if `a` and `b` are structurally identical AST nodes. >>> x = Int('x') >>> y = Int('y') >>> eq(x, y) False >>> eq(x + 1, x + 1) True >>> eq(x + 1, 1 + x) False >>> eq(simplify(x + 1), simplify(1 + x)) True
Return `True` if `a` and `b` are structurally identical AST nodes.
def eq(a, b): """Return `True` if `a` and `b` are structurally identical AST nodes. >>> x = Int('x') >>> y = Int('y') >>> eq(x, y) False >>> eq(x + 1, x + 1) True >>> eq(x + 1, 1 + x) False >>> eq(simplify(x + 1), simplify(1 + x)) True """ if z3_debug(): _z3_...
[ "def", "eq", "(", "a", ",", "b", ")", ":", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "is_ast", "(", "a", ")", "and", "is_ast", "(", "b", ")", ",", "\"Z3 ASTs expected\"", ")", "return", "a", ".", "eq", "(", "b", ")" ]
[ 435, 0 ]
[ 451, 18 ]
python
en
['en', 'en', 'en']
True
is_sort
(s)
Return `True` if `s` is a Z3 sort. >>> is_sort(IntSort()) True >>> is_sort(Int('x')) False >>> is_expr(Int('x')) True
Return `True` if `s` is a Z3 sort.
def is_sort(s): """Return `True` if `s` is a Z3 sort. >>> is_sort(IntSort()) True >>> is_sort(Int('x')) False >>> is_expr(Int('x')) True """ return isinstance(s, SortRef)
[ "def", "is_sort", "(", "s", ")", ":", "return", "isinstance", "(", "s", ",", "SortRef", ")" ]
[ 599, 0 ]
[ 609, 33 ]
python
en
['en', 'fy', 'en']
True
DeclareSort
(name, ctx=None)
Create a new uninterpreted sort named `name`. If `ctx=None`, then the new sort is declared in the global Z3Py context. >>> A = DeclareSort('A') >>> a = Const('a', A) >>> b = Const('b', A) >>> a.sort() == A True >>> b.sort() == A True >>> a == b a == b
Create a new uninterpreted sort named `name`.
def DeclareSort(name, ctx=None): """Create a new uninterpreted sort named `name`. If `ctx=None`, then the new sort is declared in the global Z3Py context. >>> A = DeclareSort('A') >>> a = Const('a', A) >>> b = Const('b', A) >>> a.sort() == A True >>> b.sort() == A True >>> a ==...
[ "def", "DeclareSort", "(", "name", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "ctx", ")", "return", "SortRef", "(", "Z3_mk_uninterpreted_sort", "(", "ctx", ".", "ref", "(", ")", ",", "to_symbol", "(", "name", ",", "ctx", ")", ")"...
[ 640, 0 ]
[ 656, 82 ]
python
en
['en', 'ig', 'en']
True
is_func_decl
(a)
Return `True` if `a` is a Z3 function declaration. >>> f = Function('f', IntSort(), IntSort()) >>> is_func_decl(f) True >>> x = Real('x') >>> is_func_decl(x) False
Return `True` if `a` is a Z3 function declaration.
def is_func_decl(a): """Return `True` if `a` is a Z3 function declaration. >>> f = Function('f', IntSort(), IntSort()) >>> is_func_decl(f) True >>> x = Real('x') >>> is_func_decl(x) False """ return isinstance(a, FuncDeclRef)
[ "def", "is_func_decl", "(", "a", ")", ":", "return", "isinstance", "(", "a", ",", "FuncDeclRef", ")" ]
[ 790, 0 ]
[ 800, 37 ]
python
en
['en', 'fy', 'en']
True
Function
(name, *sig)
Create a new Z3 uninterpreted function with the given sorts. >>> f = Function('f', IntSort(), IntSort()) >>> f(f(0)) f(f(0))
Create a new Z3 uninterpreted function with the given sorts.
def Function(name, *sig): """Create a new Z3 uninterpreted function with the given sorts. >>> f = Function('f', IntSort(), IntSort()) >>> f(f(0)) f(f(0)) """ sig = _get_args(sig) if z3_debug(): _z3_assert(len(sig) > 0, "At least two arguments expected") arity = len(sig) - 1 ...
[ "def", "Function", "(", "name", ",", "*", "sig", ")", ":", "sig", "=", "_get_args", "(", "sig", ")", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "len", "(", "sig", ")", ">", "0", ",", "\"At least two arguments expected\"", ")", "arity", "=", ...
[ 802, 0 ]
[ 822, 98 ]
python
en
['en', 'en', 'en']
True
FreshFunction
(*sig)
Create a new fresh Z3 uninterpreted function with the given sorts.
Create a new fresh Z3 uninterpreted function with the given sorts.
def FreshFunction(*sig): """Create a new fresh Z3 uninterpreted function with the given sorts. """ sig = _get_args(sig) if z3_debug(): _z3_assert(len(sig) > 0, "At least two arguments expected") arity = len(sig) - 1 rng = sig[arity] if z3_debug(): _z3_assert(is_sort(rng), "Z3...
[ "def", "FreshFunction", "(", "*", "sig", ")", ":", "sig", "=", "_get_args", "(", "sig", ")", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "len", "(", "sig", ")", ">", "0", ",", "\"At least two arguments expected\"", ")", "arity", "=", "len", "("...
[ 824, 0 ]
[ 840, 87 ]
python
en
['en', 'en', 'en']
True
RecFunction
(name, *sig)
Create a new Z3 recursive with the given sorts.
Create a new Z3 recursive with the given sorts.
def RecFunction(name, *sig): """Create a new Z3 recursive with the given sorts.""" sig = _get_args(sig) if z3_debug(): _z3_assert(len(sig) > 0, "At least two arguments expected") arity = len(sig) - 1 rng = sig[arity] if z3_debug(): _z3_assert(is_sort(rng), "Z3 sort expected") ...
[ "def", "RecFunction", "(", "name", ",", "*", "sig", ")", ":", "sig", "=", "_get_args", "(", "sig", ")", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "len", "(", "sig", ")", ">", "0", ",", "\"At least two arguments expected\"", ")", "arity", "=",...
[ 846, 0 ]
[ 861, 102 ]
python
en
['en', 'en', 'en']
True
RecAddDefinition
(f, args, body)
Set the body of a recursive function. Recursive definitions can be simplified if they are applied to ground arguments. >>> ctx = Context() >>> fac = RecFunction('fac', IntSort(ctx), IntSort(ctx)) >>> n = Int('n', ctx) >>> RecAddDefinition(fac, n, If(n == 0, 1, n*fac(n-1))) >>> s...
Set the body of a recursive function. Recursive definitions can be simplified if they are applied to ground arguments. >>> ctx = Context() >>> fac = RecFunction('fac', IntSort(ctx), IntSort(ctx)) >>> n = Int('n', ctx) >>> RecAddDefinition(fac, n, If(n == 0, 1, n*fac(n-1))) >>> s...
def RecAddDefinition(f, args, body): """Set the body of a recursive function. Recursive definitions can be simplified if they are applied to ground arguments. >>> ctx = Context() >>> fac = RecFunction('fac', IntSort(ctx), IntSort(ctx)) >>> n = Int('n', ctx) >>> RecAddDefinition(...
[ "def", "RecAddDefinition", "(", "f", ",", "args", ",", "body", ")", ":", "if", "is_app", "(", "args", ")", ":", "args", "=", "[", "args", "]", "ctx", "=", "body", ".", "ctx", "args", "=", "_get_args", "(", "args", ")", "n", "=", "len", "(", "ar...
[ 863, 0 ]
[ 888, 56 ]
python
en
['en', 'en', 'en']
True
is_expr
(a)
Return `True` if `a` is a Z3 expression. >>> a = Int('a') >>> is_expr(a) True >>> is_expr(a + 1) True >>> is_expr(IntSort()) False >>> is_expr(1) False >>> is_expr(IntVal(1)) True >>> x = Int('x') >>> is_expr(ForAll(x, x >= 0)) True >>> is_expr(FPVal(1.0)) ...
Return `True` if `a` is a Z3 expression.
def is_expr(a): """Return `True` if `a` is a Z3 expression. >>> a = Int('a') >>> is_expr(a) True >>> is_expr(a + 1) True >>> is_expr(IntSort()) False >>> is_expr(1) False >>> is_expr(IntVal(1)) True >>> x = Int('x') >>> is_expr(ForAll(x, x >= 0)) True >>>...
[ "def", "is_expr", "(", "a", ")", ":", "return", "isinstance", "(", "a", ",", "ExprRef", ")" ]
[ 1142, 0 ]
[ 1162, 33 ]
python
en
['en', 'en', 'en']
True
is_app
(a)
Return `True` if `a` is a Z3 function application. Note that, constants are function applications with 0 arguments. >>> a = Int('a') >>> is_app(a) True >>> is_app(a + 1) True >>> is_app(IntSort()) False >>> is_app(1) False >>> is_app(IntVal(1)) True >>> x = Int('x')...
Return `True` if `a` is a Z3 function application.
def is_app(a): """Return `True` if `a` is a Z3 function application. Note that, constants are function applications with 0 arguments. >>> a = Int('a') >>> is_app(a) True >>> is_app(a + 1) True >>> is_app(IntSort()) False >>> is_app(1) False >>> is_app(IntVal(1)) Tru...
[ "def", "is_app", "(", "a", ")", ":", "if", "not", "isinstance", "(", "a", ",", "ExprRef", ")", ":", "return", "False", "k", "=", "_ast_kind", "(", "a", ".", "ctx", ",", "a", ")", "return", "k", "==", "Z3_NUMERAL_AST", "or", "k", "==", "Z3_APP_AST" ...
[ 1164, 0 ]
[ 1187, 49 ]
python
en
['en', 'en', 'en']
True
is_const
(a)
Return `True` if `a` is Z3 constant/variable expression. >>> a = Int('a') >>> is_const(a) True >>> is_const(a + 1) False >>> is_const(1) False >>> is_const(IntVal(1)) True >>> x = Int('x') >>> is_const(ForAll(x, x >= 0)) False
Return `True` if `a` is Z3 constant/variable expression.
def is_const(a): """Return `True` if `a` is Z3 constant/variable expression. >>> a = Int('a') >>> is_const(a) True >>> is_const(a + 1) False >>> is_const(1) False >>> is_const(IntVal(1)) True >>> x = Int('x') >>> is_const(ForAll(x, x >= 0)) False """ return i...
[ "def", "is_const", "(", "a", ")", ":", "return", "is_app", "(", "a", ")", "and", "a", ".", "num_args", "(", ")", "==", "0" ]
[ 1189, 0 ]
[ 1205, 42 ]
python
en
['en', 'en', 'en']
True
is_var
(a)
Return `True` if `a` is variable. Z3 uses de-Bruijn indices for representing bound variables in quantifiers. >>> x = Int('x') >>> is_var(x) False >>> is_const(x) True >>> f = Function('f', IntSort(), IntSort()) >>> # Z3 replaces x with bound variables when ForAll is executed. >...
Return `True` if `a` is variable.
def is_var(a): """Return `True` if `a` is variable. Z3 uses de-Bruijn indices for representing bound variables in quantifiers. >>> x = Int('x') >>> is_var(x) False >>> is_const(x) True >>> f = Function('f', IntSort(), IntSort()) >>> # Z3 replaces x with bound variables when For...
[ "def", "is_var", "(", "a", ")", ":", "return", "is_expr", "(", "a", ")", "and", "_ast_kind", "(", "a", ".", "ctx", ",", "a", ")", "==", "Z3_VAR_AST" ]
[ 1207, 0 ]
[ 1229, 59 ]
python
en
['en', 'en', 'en']
True
get_var_index
(a)
Return the de-Bruijn index of the Z3 bounded variable `a`. >>> x = Int('x') >>> y = Int('y') >>> is_var(x) False >>> is_const(x) True >>> f = Function('f', IntSort(), IntSort(), IntSort()) >>> # Z3 replaces x and y with bound variables when ForAll is executed. >>> q = ForAll([x, y],...
Return the de-Bruijn index of the Z3 bounded variable `a`.
def get_var_index(a): """Return the de-Bruijn index of the Z3 bounded variable `a`. >>> x = Int('x') >>> y = Int('y') >>> is_var(x) False >>> is_const(x) True >>> f = Function('f', IntSort(), IntSort(), IntSort()) >>> # Z3 replaces x and y with bound variables when ForAll is execute...
[ "def", "get_var_index", "(", "a", ")", ":", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "is_var", "(", "a", ")", ",", "\"Z3 bound variable expected\"", ")", "return", "int", "(", "Z3_get_index_value", "(", "a", ".", "ctx", ".", "ref", "(", ")", ...
[ 1231, 0 ]
[ 1261, 59 ]
python
en
['en', 'en', 'nl']
True
is_app_of
(a, k)
Return `True` if `a` is an application of the given kind `k`. >>> x = Int('x') >>> n = x + 1 >>> is_app_of(n, Z3_OP_ADD) True >>> is_app_of(n, Z3_OP_MUL) False
Return `True` if `a` is an application of the given kind `k`.
def is_app_of(a, k): """Return `True` if `a` is an application of the given kind `k`. >>> x = Int('x') >>> n = x + 1 >>> is_app_of(n, Z3_OP_ADD) True >>> is_app_of(n, Z3_OP_MUL) False """ return is_app(a) and a.decl().kind() == k
[ "def", "is_app_of", "(", "a", ",", "k", ")", ":", "return", "is_app", "(", "a", ")", "and", "a", ".", "decl", "(", ")", ".", "kind", "(", ")", "==", "k" ]
[ 1263, 0 ]
[ 1273, 45 ]
python
en
['en', 'en', 'en']
True
If
(a, b, c, ctx=None)
Create a Z3 if-then-else expression. >>> x = Int('x') >>> y = Int('y') >>> max = If(x > y, x, y) >>> max If(x > y, x, y) >>> simplify(max) If(x <= y, y, x)
Create a Z3 if-then-else expression.
def If(a, b, c, ctx=None): """Create a Z3 if-then-else expression. >>> x = Int('x') >>> y = Int('y') >>> max = If(x > y, x, y) >>> max If(x > y, x, y) >>> simplify(max) If(x <= y, y, x) """ if isinstance(a, Probe) or isinstance(b, Tactic) or isinstance(c, Tactic): return...
[ "def", "If", "(", "a", ",", "b", ",", "c", ",", "ctx", "=", "None", ")", ":", "if", "isinstance", "(", "a", ",", "Probe", ")", "or", "isinstance", "(", "b", ",", "Tactic", ")", "or", "isinstance", "(", "c", ",", "Tactic", ")", ":", "return", ...
[ 1275, 0 ]
[ 1295, 90 ]
python
en
['en', 'en', 'en']
True
Distinct
(*args)
Create a Z3 distinct expression. >>> x = Int('x') >>> y = Int('y') >>> Distinct(x, y) x != y >>> z = Int('z') >>> Distinct(x, y, z) Distinct(x, y, z) >>> simplify(Distinct(x, y, z)) Distinct(x, y, z) >>> simplify(Distinct(x, y, z), blast_distinct=True) And(Not(x == y), Not(x...
Create a Z3 distinct expression.
def Distinct(*args): """Create a Z3 distinct expression. >>> x = Int('x') >>> y = Int('y') >>> Distinct(x, y) x != y >>> z = Int('z') >>> Distinct(x, y, z) Distinct(x, y, z) >>> simplify(Distinct(x, y, z)) Distinct(x, y, z) >>> simplify(Distinct(x, y, z), blast_distinct=True...
[ "def", "Distinct", "(", "*", "args", ")", ":", "args", "=", "_get_args", "(", "args", ")", "ctx", "=", "_ctx_from_ast_arg_list", "(", "args", ")", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "ctx", "is", "not", "None", ",", "\"At least one of the...
[ 1297, 0 ]
[ 1318, 61 ]
python
en
['en', 'co', 'en']
True
Const
(name, sort)
Create a constant of the given sort. >>> Const('x', IntSort()) x
Create a constant of the given sort.
def Const(name, sort): """Create a constant of the given sort. >>> Const('x', IntSort()) x """ if z3_debug(): _z3_assert(isinstance(sort, SortRef), "Z3 sort expected") ctx = sort.ctx return _to_expr_ref(Z3_mk_const(ctx.ref(), to_symbol(name, ctx), sort.ast), ctx)
[ "def", "Const", "(", "name", ",", "sort", ")", ":", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "isinstance", "(", "sort", ",", "SortRef", ")", ",", "\"Z3 sort expected\"", ")", "ctx", "=", "sort", ".", "ctx", "return", "_to_expr_ref", "(", "Z3...
[ 1328, 0 ]
[ 1337, 84 ]
python
en
['en', 'en', 'en']
True
Consts
(names, sort)
Create several constants of the given sort. `names` is a string containing the names of all constants to be created. Blank spaces separate the names of different constants. >>> x, y, z = Consts('x y z', IntSort()) >>> x + y + z x + y + z
Create several constants of the given sort.
def Consts(names, sort): """Create several constants of the given sort. `names` is a string containing the names of all constants to be created. Blank spaces separate the names of different constants. >>> x, y, z = Consts('x y z', IntSort()) >>> x + y + z x + y + z """ if isinstance(na...
[ "def", "Consts", "(", "names", ",", "sort", ")", ":", "if", "isinstance", "(", "names", ",", "str", ")", ":", "names", "=", "names", ".", "split", "(", "\" \"", ")", "return", "[", "Const", "(", "name", ",", "sort", ")", "for", "name", "in", "nam...
[ 1339, 0 ]
[ 1351, 48 ]
python
en
['en', 'en', 'en']
True
FreshConst
(sort, prefix='c')
Create a fresh constant of a specified sort
Create a fresh constant of a specified sort
def FreshConst(sort, prefix='c'): """Create a fresh constant of a specified sort""" ctx = _get_ctx(sort.ctx) return _to_expr_ref(Z3_mk_fresh_const(ctx.ref(), prefix, sort.ast), ctx)
[ "def", "FreshConst", "(", "sort", ",", "prefix", "=", "'c'", ")", ":", "ctx", "=", "_get_ctx", "(", "sort", ".", "ctx", ")", "return", "_to_expr_ref", "(", "Z3_mk_fresh_const", "(", "ctx", ".", "ref", "(", ")", ",", "prefix", ",", "sort", ".", "ast",...
[ 1353, 0 ]
[ 1356, 76 ]
python
en
['en', 'en', 'en']
True
Var
(idx, s)
Create a Z3 free variable. Free variables are used to create quantified formulas. >>> Var(0, IntSort()) Var(0) >>> eq(Var(0, IntSort()), Var(0, BoolSort())) False
Create a Z3 free variable. Free variables are used to create quantified formulas.
def Var(idx, s): """Create a Z3 free variable. Free variables are used to create quantified formulas. >>> Var(0, IntSort()) Var(0) >>> eq(Var(0, IntSort()), Var(0, BoolSort())) False """ if z3_debug(): _z3_assert(is_sort(s), "Z3 sort expected") return _to_expr_ref(Z3_mk_bound(s....
[ "def", "Var", "(", "idx", ",", "s", ")", ":", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "is_sort", "(", "s", ")", ",", "\"Z3 sort expected\"", ")", "return", "_to_expr_ref", "(", "Z3_mk_bound", "(", "s", ".", "ctx_ref", "(", ")", ",", "idx"...
[ 1358, 0 ]
[ 1368, 68 ]
python
en
['en', 'en', 'en']
True
RealVar
(idx, ctx=None)
Create a real free variable. Free variables are used to create quantified formulas. They are also used to create polynomials. >>> RealVar(0) Var(0)
Create a real free variable. Free variables are used to create quantified formulas. They are also used to create polynomials.
def RealVar(idx, ctx=None): """ Create a real free variable. Free variables are used to create quantified formulas. They are also used to create polynomials. >>> RealVar(0) Var(0) """ return Var(idx, RealSort(ctx))
[ "def", "RealVar", "(", "idx", ",", "ctx", "=", "None", ")", ":", "return", "Var", "(", "idx", ",", "RealSort", "(", "ctx", ")", ")" ]
[ 1370, 0 ]
[ 1378, 34 ]
python
en
['en', 'error', 'th']
False
RealVarVector
(n, ctx=None)
Create a list of Real free variables. The variables have ids: 0, 1, ..., n-1 >>> x0, x1, x2, x3 = RealVarVector(4) >>> x2 Var(2)
Create a list of Real free variables. The variables have ids: 0, 1, ..., n-1
def RealVarVector(n, ctx=None): """ Create a list of Real free variables. The variables have ids: 0, 1, ..., n-1 >>> x0, x1, x2, x3 = RealVarVector(4) >>> x2 Var(2) """ return [ RealVar(i, ctx) for i in range(n) ]
[ "def", "RealVarVector", "(", "n", ",", "ctx", "=", "None", ")", ":", "return", "[", "RealVar", "(", "i", ",", "ctx", ")", "for", "i", "in", "range", "(", "n", ")", "]" ]
[ 1380, 0 ]
[ 1389, 48 ]
python
en
['en', 'error', 'th']
False
is_bool
(a)
Return `True` if `a` is a Z3 Boolean expression. >>> p = Bool('p') >>> is_bool(p) True >>> q = Bool('q') >>> is_bool(And(p, q)) True >>> x = Real('x') >>> is_bool(x) False >>> is_bool(x == 0) True
Return `True` if `a` is a Z3 Boolean expression.
def is_bool(a): """Return `True` if `a` is a Z3 Boolean expression. >>> p = Bool('p') >>> is_bool(p) True >>> q = Bool('q') >>> is_bool(And(p, q)) True >>> x = Real('x') >>> is_bool(x) False >>> is_bool(x == 0) True """ return isinstance(a, BoolRef)
[ "def", "is_bool", "(", "a", ")", ":", "return", "isinstance", "(", "a", ",", "BoolRef", ")" ]
[ 1449, 0 ]
[ 1464, 33 ]
python
en
['en', 'en', 'en']
True
is_true
(a)
Return `True` if `a` is the Z3 true expression. >>> p = Bool('p') >>> is_true(p) False >>> is_true(simplify(p == p)) True >>> x = Real('x') >>> is_true(x == 0) False >>> # True is a Python Boolean expression >>> is_true(True) False
Return `True` if `a` is the Z3 true expression.
def is_true(a): """Return `True` if `a` is the Z3 true expression. >>> p = Bool('p') >>> is_true(p) False >>> is_true(simplify(p == p)) True >>> x = Real('x') >>> is_true(x == 0) False >>> # True is a Python Boolean expression >>> is_true(True) False """ return i...
[ "def", "is_true", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_TRUE", ")" ]
[ 1466, 0 ]
[ 1481, 35 ]
python
en
['en', 'en', 'en']
True
is_false
(a)
Return `True` if `a` is the Z3 false expression. >>> p = Bool('p') >>> is_false(p) False >>> is_false(False) False >>> is_false(BoolVal(False)) True
Return `True` if `a` is the Z3 false expression.
def is_false(a): """Return `True` if `a` is the Z3 false expression. >>> p = Bool('p') >>> is_false(p) False >>> is_false(False) False >>> is_false(BoolVal(False)) True """ return is_app_of(a, Z3_OP_FALSE)
[ "def", "is_false", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_FALSE", ")" ]
[ 1483, 0 ]
[ 1494, 36 ]
python
en
['en', 'en', 'en']
True
is_and
(a)
Return `True` if `a` is a Z3 and expression. >>> p, q = Bools('p q') >>> is_and(And(p, q)) True >>> is_and(Or(p, q)) False
Return `True` if `a` is a Z3 and expression.
def is_and(a): """Return `True` if `a` is a Z3 and expression. >>> p, q = Bools('p q') >>> is_and(And(p, q)) True >>> is_and(Or(p, q)) False """ return is_app_of(a, Z3_OP_AND)
[ "def", "is_and", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_AND", ")" ]
[ 1496, 0 ]
[ 1505, 34 ]
python
en
['en', 'en', 'en']
True
is_or
(a)
Return `True` if `a` is a Z3 or expression. >>> p, q = Bools('p q') >>> is_or(Or(p, q)) True >>> is_or(And(p, q)) False
Return `True` if `a` is a Z3 or expression.
def is_or(a): """Return `True` if `a` is a Z3 or expression. >>> p, q = Bools('p q') >>> is_or(Or(p, q)) True >>> is_or(And(p, q)) False """ return is_app_of(a, Z3_OP_OR)
[ "def", "is_or", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_OR", ")" ]
[ 1507, 0 ]
[ 1516, 33 ]
python
en
['en', 'en', 'en']
True
is_implies
(a)
Return `True` if `a` is a Z3 implication expression. >>> p, q = Bools('p q') >>> is_implies(Implies(p, q)) True >>> is_implies(And(p, q)) False
Return `True` if `a` is a Z3 implication expression.
def is_implies(a): """Return `True` if `a` is a Z3 implication expression. >>> p, q = Bools('p q') >>> is_implies(Implies(p, q)) True >>> is_implies(And(p, q)) False """ return is_app_of(a, Z3_OP_IMPLIES)
[ "def", "is_implies", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_IMPLIES", ")" ]
[ 1518, 0 ]
[ 1527, 38 ]
python
en
['en', 'en', 'en']
True
is_not
(a)
Return `True` if `a` is a Z3 not expression. >>> p = Bool('p') >>> is_not(p) False >>> is_not(Not(p)) True
Return `True` if `a` is a Z3 not expression.
def is_not(a): """Return `True` if `a` is a Z3 not expression. >>> p = Bool('p') >>> is_not(p) False >>> is_not(Not(p)) True """ return is_app_of(a, Z3_OP_NOT)
[ "def", "is_not", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_NOT", ")" ]
[ 1529, 0 ]
[ 1538, 34 ]
python
en
['en', 'en', 'en']
True
is_eq
(a)
Return `True` if `a` is a Z3 equality expression. >>> x, y = Ints('x y') >>> is_eq(x == y) True
Return `True` if `a` is a Z3 equality expression.
def is_eq(a): """Return `True` if `a` is a Z3 equality expression. >>> x, y = Ints('x y') >>> is_eq(x == y) True """ return is_app_of(a, Z3_OP_EQ)
[ "def", "is_eq", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_EQ", ")" ]
[ 1540, 0 ]
[ 1547, 33 ]
python
en
['en', 'en', 'en']
True
is_distinct
(a)
Return `True` if `a` is a Z3 distinct expression. >>> x, y, z = Ints('x y z') >>> is_distinct(x == y) False >>> is_distinct(Distinct(x, y, z)) True
Return `True` if `a` is a Z3 distinct expression.
def is_distinct(a): """Return `True` if `a` is a Z3 distinct expression. >>> x, y, z = Ints('x y z') >>> is_distinct(x == y) False >>> is_distinct(Distinct(x, y, z)) True """ return is_app_of(a, Z3_OP_DISTINCT)
[ "def", "is_distinct", "(", "a", ")", ":", "return", "is_app_of", "(", "a", ",", "Z3_OP_DISTINCT", ")" ]
[ 1549, 0 ]
[ 1558, 39 ]
python
en
['en', 'cy', 'en']
True
BoolSort
(ctx=None)
Return the Boolean Z3 sort. If `ctx=None`, then the global context is used. >>> BoolSort() Bool >>> p = Const('p', BoolSort()) >>> is_bool(p) True >>> r = Function('r', IntSort(), IntSort(), BoolSort()) >>> r(0, 1) r(0, 1) >>> is_bool(r(0, 1)) True
Return the Boolean Z3 sort. If `ctx=None`, then the global context is used.
def BoolSort(ctx=None): """Return the Boolean Z3 sort. If `ctx=None`, then the global context is used. >>> BoolSort() Bool >>> p = Const('p', BoolSort()) >>> is_bool(p) True >>> r = Function('r', IntSort(), IntSort(), BoolSort()) >>> r(0, 1) r(0, 1) >>> is_bool(r(0, 1)) True...
[ "def", "BoolSort", "(", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "ctx", ")", "return", "BoolSortRef", "(", "Z3_mk_bool_sort", "(", "ctx", ".", "ref", "(", ")", ")", ",", "ctx", ")" ]
[ 1560, 0 ]
[ 1575, 55 ]
python
en
['en', 'en', 'en']
True
BoolVal
(val, ctx=None)
Return the Boolean value `True` or `False`. If `ctx=None`, then the global context is used. >>> BoolVal(True) True >>> is_true(BoolVal(True)) True >>> is_true(True) False >>> is_false(BoolVal(False)) True
Return the Boolean value `True` or `False`. If `ctx=None`, then the global context is used.
def BoolVal(val, ctx=None): """Return the Boolean value `True` or `False`. If `ctx=None`, then the global context is used. >>> BoolVal(True) True >>> is_true(BoolVal(True)) True >>> is_true(True) False >>> is_false(BoolVal(False)) True """ ctx = _get_ctx(ctx) if val == F...
[ "def", "BoolVal", "(", "val", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "ctx", ")", "if", "val", "==", "False", ":", "return", "BoolRef", "(", "Z3_mk_false", "(", "ctx", ".", "ref", "(", ")", ")", ",", "ctx", ")", "else", ...
[ 1577, 0 ]
[ 1593, 50 ]
python
en
['en', 'en', 'en']
True
Bool
(name, ctx=None)
Return a Boolean constant named `name`. If `ctx=None`, then the global context is used. >>> p = Bool('p') >>> q = Bool('q') >>> And(p, q) And(p, q)
Return a Boolean constant named `name`. If `ctx=None`, then the global context is used.
def Bool(name, ctx=None): """Return a Boolean constant named `name`. If `ctx=None`, then the global context is used. >>> p = Bool('p') >>> q = Bool('q') >>> And(p, q) And(p, q) """ ctx = _get_ctx(ctx) return BoolRef(Z3_mk_const(ctx.ref(), to_symbol(name, ctx), BoolSort(ctx).ast), ctx)
[ "def", "Bool", "(", "name", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "ctx", ")", "return", "BoolRef", "(", "Z3_mk_const", "(", "ctx", ".", "ref", "(", ")", ",", "to_symbol", "(", "name", ",", "ctx", ")", ",", "BoolSort", "(...
[ 1595, 0 ]
[ 1604, 88 ]
python
en
['en', 'en', 'en']
True
Bools
(names, ctx=None)
Return a tuple of Boolean constants. `names` is a single string containing all names separated by blank spaces. If `ctx=None`, then the global context is used. >>> p, q, r = Bools('p q r') >>> And(p, Or(q, r)) And(p, Or(q, r))
Return a tuple of Boolean constants.
def Bools(names, ctx=None): """Return a tuple of Boolean constants. `names` is a single string containing all names separated by blank spaces. If `ctx=None`, then the global context is used. >>> p, q, r = Bools('p q r') >>> And(p, Or(q, r)) And(p, Or(q, r)) """ ctx = _get_ctx(ctx) ...
[ "def", "Bools", "(", "names", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "ctx", ")", "if", "isinstance", "(", "names", ",", "str", ")", ":", "names", "=", "names", ".", "split", "(", "\" \"", ")", "return", "[", "Bool", "(", ...
[ 1606, 0 ]
[ 1619, 46 ]
python
en
['en', 'en', 'en']
True
BoolVector
(prefix, sz, ctx=None)
Return a list of Boolean constants of size `sz`. The constants are named using the given prefix. If `ctx=None`, then the global context is used. >>> P = BoolVector('p', 3) >>> P [p__0, p__1, p__2] >>> And(P) And(p__0, p__1, p__2)
Return a list of Boolean constants of size `sz`.
def BoolVector(prefix, sz, ctx=None): """Return a list of Boolean constants of size `sz`. The constants are named using the given prefix. If `ctx=None`, then the global context is used. >>> P = BoolVector('p', 3) >>> P [p__0, p__1, p__2] >>> And(P) And(p__0, p__1, p__2) """ ret...
[ "def", "BoolVector", "(", "prefix", ",", "sz", ",", "ctx", "=", "None", ")", ":", "return", "[", "Bool", "(", "'%s__%s'", "%", "(", "prefix", ",", "i", ")", ")", "for", "i", "in", "range", "(", "sz", ")", "]" ]
[ 1621, 0 ]
[ 1633, 62 ]
python
en
['en', 'en', 'en']
True
FreshBool
(prefix='b', ctx=None)
Return a fresh Boolean constant in the given context using the given prefix. If `ctx=None`, then the global context is used. >>> b1 = FreshBool() >>> b2 = FreshBool() >>> eq(b1, b2) False
Return a fresh Boolean constant in the given context using the given prefix.
def FreshBool(prefix='b', ctx=None): """Return a fresh Boolean constant in the given context using the given prefix. If `ctx=None`, then the global context is used. >>> b1 = FreshBool() >>> b2 = FreshBool() >>> eq(b1, b2) False """ ctx = _get_ctx(ctx) return BoolRef(Z3_mk_fresh_con...
[ "def", "FreshBool", "(", "prefix", "=", "'b'", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "ctx", ")", "return", "BoolRef", "(", "Z3_mk_fresh_const", "(", "ctx", ".", "ref", "(", ")", ",", "prefix", ",", "BoolSort", "(", "ctx", ...
[ 1635, 0 ]
[ 1646, 80 ]
python
en
['en', 'en', 'en']
True
Implies
(a, b, ctx=None)
Create a Z3 implies expression. >>> p, q = Bools('p q') >>> Implies(p, q) Implies(p, q)
Create a Z3 implies expression.
def Implies(a, b, ctx=None): """Create a Z3 implies expression. >>> p, q = Bools('p q') >>> Implies(p, q) Implies(p, q) """ ctx = _get_ctx(_ctx_from_ast_arg_list([a, b], ctx)) s = BoolSort(ctx) a = s.cast(a) b = s.cast(b) return BoolRef(Z3_mk_implies(ctx.ref(), a.as_ast(), b.as_...
[ "def", "Implies", "(", "a", ",", "b", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "_ctx_from_ast_arg_list", "(", "[", "a", ",", "b", "]", ",", "ctx", ")", ")", "s", "=", "BoolSort", "(", "ctx", ")", "a", "=", "s", ".", "ca...
[ 1648, 0 ]
[ 1659, 73 ]
python
en
['es', 'en', 'en']
True
Xor
(a, b, ctx=None)
Create a Z3 Xor expression. >>> p, q = Bools('p q') >>> Xor(p, q) Xor(p, q) >>> simplify(Xor(p, q)) Not(p) == q
Create a Z3 Xor expression.
def Xor(a, b, ctx=None): """Create a Z3 Xor expression. >>> p, q = Bools('p q') >>> Xor(p, q) Xor(p, q) >>> simplify(Xor(p, q)) Not(p) == q """ ctx = _get_ctx(_ctx_from_ast_arg_list([a, b], ctx)) s = BoolSort(ctx) a = s.cast(a) b = s.cast(b) return BoolRef(Z3_mk_xor(ctx....
[ "def", "Xor", "(", "a", ",", "b", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "_ctx_from_ast_arg_list", "(", "[", "a", ",", "b", "]", ",", "ctx", ")", ")", "s", "=", "BoolSort", "(", "ctx", ")", "a", "=", "s", ".", "cast",...
[ 1661, 0 ]
[ 1674, 69 ]
python
en
['en', 'gl', 'en']
True
Not
(a, ctx=None)
Create a Z3 not expression or probe. >>> p = Bool('p') >>> Not(Not(p)) Not(Not(p)) >>> simplify(Not(Not(p))) p
Create a Z3 not expression or probe.
def Not(a, ctx=None): """Create a Z3 not expression or probe. >>> p = Bool('p') >>> Not(Not(p)) Not(Not(p)) >>> simplify(Not(Not(p))) p """ ctx = _get_ctx(_ctx_from_ast_arg_list([a], ctx)) if is_probe(a): # Not is also used to build probes return Probe(Z3_probe_not(c...
[ "def", "Not", "(", "a", ",", "ctx", "=", "None", ")", ":", "ctx", "=", "_get_ctx", "(", "_ctx_from_ast_arg_list", "(", "[", "a", "]", ",", "ctx", ")", ")", "if", "is_probe", "(", "a", ")", ":", "# Not is also used to build probes", "return", "Probe", "...
[ 1676, 0 ]
[ 1692, 61 ]
python
en
['en', 'en', 'en']
True
_has_probe
(args)
Return `True` if one of the elements of the given collection is a Z3 probe.
Return `True` if one of the elements of the given collection is a Z3 probe.
def _has_probe(args): """Return `True` if one of the elements of the given collection is a Z3 probe.""" for arg in args: if is_probe(arg): return True return False
[ "def", "_has_probe", "(", "args", ")", ":", "for", "arg", "in", "args", ":", "if", "is_probe", "(", "arg", ")", ":", "return", "True", "return", "False" ]
[ 1700, 0 ]
[ 1705, 16 ]
python
en
['en', 'en', 'en']
True
And
(*args)
Create a Z3 and-expression or and-probe. >>> p, q, r = Bools('p q r') >>> And(p, q, r) And(p, q, r) >>> P = BoolVector('p', 5) >>> And(P) And(p__0, p__1, p__2, p__3, p__4)
Create a Z3 and-expression or and-probe.
def And(*args): """Create a Z3 and-expression or and-probe. >>> p, q, r = Bools('p q r') >>> And(p, q, r) And(p, q, r) >>> P = BoolVector('p', 5) >>> And(P) And(p__0, p__1, p__2, p__3, p__4) """ last_arg = None if len(args) > 0: last_arg = args[len(args)-1] if isinst...
[ "def", "And", "(", "*", "args", ")", ":", "last_arg", "=", "None", "if", "len", "(", "args", ")", ">", "0", ":", "last_arg", "=", "args", "[", "len", "(", "args", ")", "-", "1", "]", "if", "isinstance", "(", "last_arg", ",", "Context", ")", ":"...
[ 1707, 0 ]
[ 1737, 60 ]
python
en
['en', 'en', 'en']
True