body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def teams_get_workgroups_v2(self, **kwargs):
'Get all available Workgroups # noqa: E501\n\n Operation to get IDs and names for all available Workgroups. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n... | -4,514,242,222,972,709,000 | Get all available Workgroups # noqa: E501
Operation to get IDs and names for all available Workgroups. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.teams_get_workgroups_v2(async_req=True)
>>> result = thread.ge... | pycherwell/api/teams_api.py | teams_get_workgroups_v2 | greenpau/pycherwell | python | def teams_get_workgroups_v2(self, **kwargs):
'Get all available Workgroups # noqa: E501\n\n Operation to get IDs and names for all available Workgroups. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n... |
def teams_get_workgroups_v2_with_http_info(self, **kwargs):
'Get all available Workgroups # noqa: E501\n\n Operation to get IDs and names for all available Workgroups. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass a... | 695,146,712,052,608,400 | Get all available Workgroups # noqa: E501
Operation to get IDs and names for all available Workgroups. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.teams_get_workgroups_v2_with_http_info(async_req=True)
>>> res... | pycherwell/api/teams_api.py | teams_get_workgroups_v2_with_http_info | greenpau/pycherwell | python | def teams_get_workgroups_v2_with_http_info(self, **kwargs):
'Get all available Workgroups # noqa: E501\n\n Operation to get IDs and names for all available Workgroups. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass a... |
def teams_remove_customer_from_workgroup_v1(self, workgroupid, customerrecordid, **kwargs):
'Remove a customer from a Workgroup # noqa: E501\n\n Operation to remove a Customer from a Workgroup. To remove, specify the Workgroup ID and the Customer Record ID. # noqa: E501\n This method makes a synchr... | -605,956,643,830,825,500 | Remove a customer from a Workgroup # noqa: E501
Operation to remove a Customer from a Workgroup. To remove, specify the Workgroup ID and the Customer Record ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.tea... | pycherwell/api/teams_api.py | teams_remove_customer_from_workgroup_v1 | greenpau/pycherwell | python | def teams_remove_customer_from_workgroup_v1(self, workgroupid, customerrecordid, **kwargs):
'Remove a customer from a Workgroup # noqa: E501\n\n Operation to remove a Customer from a Workgroup. To remove, specify the Workgroup ID and the Customer Record ID. # noqa: E501\n This method makes a synchr... |
def teams_remove_customer_from_workgroup_v1_with_http_info(self, workgroupid, customerrecordid, **kwargs):
'Remove a customer from a Workgroup # noqa: E501\n\n Operation to remove a Customer from a Workgroup. To remove, specify the Workgroup ID and the Customer Record ID. # noqa: E501\n This method... | 2,223,508,028,111,744,300 | Remove a customer from a Workgroup # noqa: E501
Operation to remove a Customer from a Workgroup. To remove, specify the Workgroup ID and the Customer Record ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.tea... | pycherwell/api/teams_api.py | teams_remove_customer_from_workgroup_v1_with_http_info | greenpau/pycherwell | python | def teams_remove_customer_from_workgroup_v1_with_http_info(self, workgroupid, customerrecordid, **kwargs):
'Remove a customer from a Workgroup # noqa: E501\n\n Operation to remove a Customer from a Workgroup. To remove, specify the Workgroup ID and the Customer Record ID. # noqa: E501\n This method... |
def teams_remove_user_from_team_v1(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, use "Get all ava... | 8,563,310,307,737,447,000 | Operation to remove a User from a Team. # noqa: E501
Operation to remove a User from a Team. To get the User's record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team's internal ID, use "Get all available Teams." # noqa: E501
This method makes a synchronous HTTP request by default. To mak... | pycherwell/api/teams_api.py | teams_remove_user_from_team_v1 | greenpau/pycherwell | python | def teams_remove_user_from_team_v1(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, use "Get all ava... |
def teams_remove_user_from_team_v1_with_http_info(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, u... | -6,288,197,175,699,464,000 | Operation to remove a User from a Team. # noqa: E501
Operation to remove a User from a Team. To get the User's record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team's internal ID, use "Get all available Teams." # noqa: E501
This method makes a synchronous HTTP request by default. To mak... | pycherwell/api/teams_api.py | teams_remove_user_from_team_v1_with_http_info | greenpau/pycherwell | python | def teams_remove_user_from_team_v1_with_http_info(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, u... |
def teams_remove_user_from_team_v2(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, use "Get all ava... | 3,164,772,470,016,654,000 | Operation to remove a User from a Team. # noqa: E501
Operation to remove a User from a Team. To get the User's record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team's internal ID, use "Get all available Teams." # noqa: E501
This method makes a synchronous HTTP request by default. To mak... | pycherwell/api/teams_api.py | teams_remove_user_from_team_v2 | greenpau/pycherwell | python | def teams_remove_user_from_team_v2(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, use "Get all ava... |
def teams_remove_user_from_team_v2_with_http_info(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, u... | -5,760,425,905,116,669,000 | Operation to remove a User from a Team. # noqa: E501
Operation to remove a User from a Team. To get the User's record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team's internal ID, use "Get all available Teams." # noqa: E501
This method makes a synchronous HTTP request by default. To mak... | pycherwell/api/teams_api.py | teams_remove_user_from_team_v2_with_http_info | greenpau/pycherwell | python | def teams_remove_user_from_team_v2_with_http_info(self, team_id, userrecordid, **kwargs):
'Operation to remove a User from a Team. # noqa: E501\n\n Operation to remove a User from a Team. To get the User\'s record ID, use "Get a User by login ID" or "Get a User by public ID." To get a Team\'s internal ID, u... |
def teams_save_team_member_v1(self, save_team_member_request, **kwargs):
"Add or Update a team member # noqa: E501\n\n Operation to add or update a Team Member. To add or update, specify User ID, Team ID, and if Team Manager. Optionally, set the Team as the User's default Team. # noqa: E501\n This... | -4,464,309,968,757,101,000 | Add or Update a team member # noqa: E501
Operation to add or update a Team Member. To add or update, specify User ID, Team ID, and if Team Manager. Optionally, set the Team as the User's default Team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please... | pycherwell/api/teams_api.py | teams_save_team_member_v1 | greenpau/pycherwell | python | def teams_save_team_member_v1(self, save_team_member_request, **kwargs):
"Add or Update a team member # noqa: E501\n\n Operation to add or update a Team Member. To add or update, specify User ID, Team ID, and if Team Manager. Optionally, set the Team as the User's default Team. # noqa: E501\n This... |
def teams_save_team_member_v1_with_http_info(self, save_team_member_request, **kwargs):
"Add or Update a team member # noqa: E501\n\n Operation to add or update a Team Member. To add or update, specify User ID, Team ID, and if Team Manager. Optionally, set the Team as the User's default Team. # noqa: E50... | -5,117,426,151,271,859,000 | Add or Update a team member # noqa: E501
Operation to add or update a Team Member. To add or update, specify User ID, Team ID, and if Team Manager. Optionally, set the Team as the User's default Team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please... | pycherwell/api/teams_api.py | teams_save_team_member_v1_with_http_info | greenpau/pycherwell | python | def teams_save_team_member_v1_with_http_info(self, save_team_member_request, **kwargs):
"Add or Update a team member # noqa: E501\n\n Operation to add or update a Team Member. To add or update, specify User ID, Team ID, and if Team Manager. Optionally, set the Team as the User's default Team. # noqa: E50... |
def teams_save_team_v1(self, team_save_request, **kwargs):
'Create or update a team # noqa: E501\n\n Operation to create or update a Team or Workgroup. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n... | -772,596,025,537,764,400 | Create or update a team # noqa: E501
Operation to create or update a Team or Workgroup. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.teams_save_team_v1(team_save_request, async_req=True)
>>> result = thread.ge... | pycherwell/api/teams_api.py | teams_save_team_v1 | greenpau/pycherwell | python | def teams_save_team_v1(self, team_save_request, **kwargs):
'Create or update a team # noqa: E501\n\n Operation to create or update a Team or Workgroup. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n... |
def teams_save_team_v1_with_http_info(self, team_save_request, **kwargs):
'Create or update a team # noqa: E501\n\n Operation to create or update a Team or Workgroup. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass a... | -6,858,725,893,052,250,000 | Create or update a team # noqa: E501
Operation to create or update a Team or Workgroup. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.teams_save_team_v1_with_http_info(team_save_request, async_req=True)
>>> res... | pycherwell/api/teams_api.py | teams_save_team_v1_with_http_info | greenpau/pycherwell | python | def teams_save_team_v1_with_http_info(self, team_save_request, **kwargs):
'Create or update a team # noqa: E501\n\n Operation to create or update a Team or Workgroup. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass a... |
def teams_save_workgroup_member_v1(self, save_workgroup_member_request, **kwargs):
'Save the membership status of a Workgroup member. # noqa: E501\n\n Operation to add or update a Workgroup Member. To add or update, specify Customer Record ID, Workgroup ID, and if Workgroup Manager. # noqa: E501\n ... | -662,188,750,291,340,700 | Save the membership status of a Workgroup member. # noqa: E501
Operation to add or update a Workgroup Member. To add or update, specify Customer Record ID, Workgroup ID, and if Workgroup Manager. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass ... | pycherwell/api/teams_api.py | teams_save_workgroup_member_v1 | greenpau/pycherwell | python | def teams_save_workgroup_member_v1(self, save_workgroup_member_request, **kwargs):
'Save the membership status of a Workgroup member. # noqa: E501\n\n Operation to add or update a Workgroup Member. To add or update, specify Customer Record ID, Workgroup ID, and if Workgroup Manager. # noqa: E501\n ... |
def teams_save_workgroup_member_v1_with_http_info(self, save_workgroup_member_request, **kwargs):
'Save the membership status of a Workgroup member. # noqa: E501\n\n Operation to add or update a Workgroup Member. To add or update, specify Customer Record ID, Workgroup ID, and if Workgroup Manager. # noqa:... | -1,649,651,297,112,204,000 | Save the membership status of a Workgroup member. # noqa: E501
Operation to add or update a Workgroup Member. To add or update, specify Customer Record ID, Workgroup ID, and if Workgroup Manager. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass ... | pycherwell/api/teams_api.py | teams_save_workgroup_member_v1_with_http_info | greenpau/pycherwell | python | def teams_save_workgroup_member_v1_with_http_info(self, save_workgroup_member_request, **kwargs):
'Save the membership status of a Workgroup member. # noqa: E501\n\n Operation to add or update a Workgroup Member. To add or update, specify Customer Record ID, Workgroup ID, and if Workgroup Manager. # noqa:... |
def start_node(self, i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None, stderr=None):
'Start a bitcoind and return RPC connection to it'
if (extra_args is None):
extra_args = []
if (binary is None):
binary = os.getenv('BITCOIND', 'bitcoind')
node = TestNode(i, dirname... | 6,190,739,323,630,635,000 | Start a bitcoind and return RPC connection to it | test/functional/test_framework/test_framework.py | start_node | Ilikenumber0/CoinKhongCoGiaTri | python | def start_node(self, i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None, stderr=None):
if (extra_args is None):
extra_args = []
if (binary is None):
binary = os.getenv('BITCOIND', 'bitcoind')
node = TestNode(i, dirname, extra_args, rpchost, timewait, binary, stderr, s... |
def start_nodes(self, num_nodes, dirname, extra_args=None, rpchost=None, timewait=None, binary=None):
'Start multiple bitcoinds, return RPC connections to them'
if (extra_args is None):
extra_args = ([[]] * num_nodes)
if (binary is None):
binary = ([None] * num_nodes)
assert_equal(len(ex... | -8,064,546,972,420,278,000 | Start multiple bitcoinds, return RPC connections to them | test/functional/test_framework/test_framework.py | start_nodes | Ilikenumber0/CoinKhongCoGiaTri | python | def start_nodes(self, num_nodes, dirname, extra_args=None, rpchost=None, timewait=None, binary=None):
if (extra_args is None):
extra_args = ([[]] * num_nodes)
if (binary is None):
binary = ([None] * num_nodes)
assert_equal(len(extra_args), num_nodes)
assert_equal(len(binary), num_no... |
def stop_node(self, i):
'Stop a bitcoind test node'
self.nodes[i].stop_node()
while (not self.nodes[i].is_node_stopped()):
time.sleep(0.1) | 220,452,968,083,122,850 | Stop a bitcoind test node | test/functional/test_framework/test_framework.py | stop_node | Ilikenumber0/CoinKhongCoGiaTri | python | def stop_node(self, i):
self.nodes[i].stop_node()
while (not self.nodes[i].is_node_stopped()):
time.sleep(0.1) |
def stop_nodes(self):
'Stop multiple bitcoind test nodes'
for node in self.nodes:
node.stop_node()
for node in self.nodes:
while (not node.is_node_stopped()):
time.sleep(0.1) | 1,708,372,296,490,657,800 | Stop multiple bitcoind test nodes | test/functional/test_framework/test_framework.py | stop_nodes | Ilikenumber0/CoinKhongCoGiaTri | python | def stop_nodes(self):
for node in self.nodes:
node.stop_node()
for node in self.nodes:
while (not node.is_node_stopped()):
time.sleep(0.1) |
def split_network(self):
'\n Split the network of four nodes into nodes 0/1 and 2/3.\n '
disconnect_nodes(self.nodes[1], 2)
disconnect_nodes(self.nodes[2], 1)
self.sync_all([self.nodes[:2], self.nodes[2:]]) | -8,998,982,825,230,729,000 | Split the network of four nodes into nodes 0/1 and 2/3. | test/functional/test_framework/test_framework.py | split_network | Ilikenumber0/CoinKhongCoGiaTri | python | def split_network(self):
'\n \n '
disconnect_nodes(self.nodes[1], 2)
disconnect_nodes(self.nodes[2], 1)
self.sync_all([self.nodes[:2], self.nodes[2:]]) |
def join_network(self):
'\n Join the (previously split) network halves together.\n '
connect_nodes_bi(self.nodes, 1, 2)
self.sync_all() | 3,019,492,878,792,302,600 | Join the (previously split) network halves together. | test/functional/test_framework/test_framework.py | join_network | Ilikenumber0/CoinKhongCoGiaTri | python | def join_network(self):
'\n \n '
connect_nodes_bi(self.nodes, 1, 2)
self.sync_all() |
def enable_mocktime(self):
'Enable mocktime for the script.\n\n mocktime may be needed for scripts that use the cached version of the\n blockchain. If the cached version of the blockchain is used without\n mocktime then the mempools will not sync due to IBD.\n\n For backwared compatibil... | 2,907,712,534,402,688,500 | Enable mocktime for the script.
mocktime may be needed for scripts that use the cached version of the
blockchain. If the cached version of the blockchain is used without
mocktime then the mempools will not sync due to IBD.
For backwared compatibility of the python scripts with previous
versions of the cache, this he... | test/functional/test_framework/test_framework.py | enable_mocktime | Ilikenumber0/CoinKhongCoGiaTri | python | def enable_mocktime(self):
'Enable mocktime for the script.\n\n mocktime may be needed for scripts that use the cached version of the\n blockchain. If the cached version of the blockchain is used without\n mocktime then the mempools will not sync due to IBD.\n\n For backwared compatibil... |
def _initialize_chain(self, test_dir, num_nodes, cachedir):
'Initialize a pre-mined blockchain for use by the test.\n\n Create a cache of a 200-block-long chain (with wallet) for MAX_NODES\n Afterward, create num_nodes copies from the cache.'
assert (num_nodes <= MAX_NODES)
create_cache = Fals... | -5,239,564,696,218,285,000 | Initialize a pre-mined blockchain for use by the test.
Create a cache of a 200-block-long chain (with wallet) for MAX_NODES
Afterward, create num_nodes copies from the cache. | test/functional/test_framework/test_framework.py | _initialize_chain | Ilikenumber0/CoinKhongCoGiaTri | python | def _initialize_chain(self, test_dir, num_nodes, cachedir):
'Initialize a pre-mined blockchain for use by the test.\n\n Create a cache of a 200-block-long chain (with wallet) for MAX_NODES\n Afterward, create num_nodes copies from the cache.'
assert (num_nodes <= MAX_NODES)
create_cache = Fals... |
def _initialize_chain_clean(self, test_dir, num_nodes):
'Initialize empty blockchain for use by the test.\n\n Create an empty blockchain and num_nodes wallets.\n Useful if a test case wants complete control over initialization.'
for i in range(num_nodes):
initialize_datadir(test_dir, i) | 2,168,712,097,468,151,000 | Initialize empty blockchain for use by the test.
Create an empty blockchain and num_nodes wallets.
Useful if a test case wants complete control over initialization. | test/functional/test_framework/test_framework.py | _initialize_chain_clean | Ilikenumber0/CoinKhongCoGiaTri | python | def _initialize_chain_clean(self, test_dir, num_nodes):
'Initialize empty blockchain for use by the test.\n\n Create an empty blockchain and num_nodes wallets.\n Useful if a test case wants complete control over initialization.'
for i in range(num_nodes):
initialize_datadir(test_dir, i) |
def main():
'Main program execution.'
(n, h1, h2, h3) = generate_ammonia_sites()
nList = [[1, 2, 3], [0], [0], [0]]
return ([n, h1, h2, h3], nList) | 1,557,158,784,874,016,500 | Main program execution. | kappa/lattice/ammonia.py | main | ajkerr0/kappa | python | def main():
(n, h1, h2, h3) = generate_ammonia_sites()
nList = [[1, 2, 3], [0], [0], [0]]
return ([n, h1, h2, h3], nList) |
def generate_ammonia_sites():
'Generate the locations for the atoms in the ammonia molecule'
(x, y) = (np.array([1.0, 0.0, 0.0]), np.array([0.0, 1.0, 0.0]))
a = 1.4
n = np.array([0.0, 0.0, 0.0])
h1 = (n + (a * y))
h2 = ((n - ((a * y) / 2.0)) + ((a * x) * (np.sqrt(3) / 2)))
h3 = (h2 - ((a * x... | 1,256,717,689,122,766,000 | Generate the locations for the atoms in the ammonia molecule | kappa/lattice/ammonia.py | generate_ammonia_sites | ajkerr0/kappa | python | def generate_ammonia_sites():
(x, y) = (np.array([1.0, 0.0, 0.0]), np.array([0.0, 1.0, 0.0]))
a = 1.4
n = np.array([0.0, 0.0, 0.0])
h1 = (n + (a * y))
h2 = ((n - ((a * y) / 2.0)) + ((a * x) * (np.sqrt(3) / 2)))
h3 = (h2 - ((a * x) * np.sqrt(3)))
return (n, h1, h2, h3) |
def __init__(self, pubs_file_path='pubs.txt', pubs_info_file_path='pubs_info.txt'):
'Takes an EndNote library exported a TXT file (`pubs_file_path`), and an optional TAB-delimited info file path with DOI identifiers (`pubs_info_file_path`), and generates some Markdown formatted output.\n\n ... | -8,329,738,461,641,885,000 | Takes an EndNote library exported a TXT file (`pubs_file_path`), and an optional TAB-delimited info file path with DOI identifiers (`pubs_info_file_path`), and generates some Markdown formatted output.
Here is an info line from the EndNote:
Winterberg, K. M., and Reznikoff, W. S. (2007). "Scr... | pubs.py | __init__ | Ibrahimmohamed33/web | python | def __init__(self, pubs_file_path='pubs.txt', pubs_info_file_path='pubs_info.txt'):
'Takes an EndNote library exported a TXT file (`pubs_file_path`), and an optional TAB-delimited info file path with DOI identifiers (`pubs_info_file_path`), and generates some Markdown formatted output.\n\n ... |
def get_markdown_text_for_pub(self, pub):
"Gets a dictionary `pub`, returns a markdown formatted text.\n\n An example pub:\n\n {'authors': 'McLellan, S. L., and Eren, A. M.',\n 'doi': '10.1016/j.tim.2014.08.002',\n 'issue': '22(12), 697-706',\n ... | -6,421,781,647,857,561,000 | Gets a dictionary `pub`, returns a markdown formatted text.
An example pub:
{'authors': 'McLellan, S. L., and Eren, A. M.',
'doi': '10.1016/j.tim.2014.08.002',
'issue': '22(12), 697-706',
'title': 'Discovering new indicators of fecal pollution.',
'journal': 'Trends Microbiol',
'year... | pubs.py | get_markdown_text_for_pub | Ibrahimmohamed33/web | python | def get_markdown_text_for_pub(self, pub):
"Gets a dictionary `pub`, returns a markdown formatted text.\n\n An example pub:\n\n {'authors': 'McLellan, S. L., and Eren, A. M.',\n 'doi': '10.1016/j.tim.2014.08.002',\n 'issue': '22(12), 697-706',\n ... |
@classmethod
def register_class_to_dict(cls, clazz, converter, serpent_too=True):
'Registers a custom function that returns a dict representation of objects of the given class.\n The function is called with a single parameter; the object to be converted to a dict.'
cls.__custom_class_to_dict_registry[cla... | 1,846,850,711,715,845,400 | Registers a custom function that returns a dict representation of objects of the given class.
The function is called with a single parameter; the object to be converted to a dict. | Pyro5/serializers.py | register_class_to_dict | gst/Pyro5 | python | @classmethod
def register_class_to_dict(cls, clazz, converter, serpent_too=True):
'Registers a custom function that returns a dict representation of objects of the given class.\n The function is called with a single parameter; the object to be converted to a dict.'
cls.__custom_class_to_dict_registry[cla... |
@classmethod
def unregister_class_to_dict(cls, clazz):
'Removes the to-dict conversion function registered for the given class. Objects of the class\n will be serialized by the default mechanism again.'
if (clazz in cls.__custom_class_to_dict_registry):
del cls.__custom_class_to_dict_registry[cla... | 5,616,744,704,108,632,000 | Removes the to-dict conversion function registered for the given class. Objects of the class
will be serialized by the default mechanism again. | Pyro5/serializers.py | unregister_class_to_dict | gst/Pyro5 | python | @classmethod
def unregister_class_to_dict(cls, clazz):
'Removes the to-dict conversion function registered for the given class. Objects of the class\n will be serialized by the default mechanism again.'
if (clazz in cls.__custom_class_to_dict_registry):
del cls.__custom_class_to_dict_registry[cla... |
@classmethod
def register_dict_to_class(cls, classname, converter):
'\n Registers a custom converter function that creates objects from a dict with the given classname tag in it.\n The function is called with two parameters: the classname and the dictionary to convert to an instance of the class.\n ... | -4,186,548,957,584,928,000 | Registers a custom converter function that creates objects from a dict with the given classname tag in it.
The function is called with two parameters: the classname and the dictionary to convert to an instance of the class. | Pyro5/serializers.py | register_dict_to_class | gst/Pyro5 | python | @classmethod
def register_dict_to_class(cls, classname, converter):
'\n Registers a custom converter function that creates objects from a dict with the given classname tag in it.\n The function is called with two parameters: the classname and the dictionary to convert to an instance of the class.\n ... |
@classmethod
def unregister_dict_to_class(cls, classname):
'\n Removes the converter registered for the given classname. Dicts with that classname tag\n will be deserialized by the default mechanism again.\n '
if (classname in cls.__custom_dict_to_class_registry):
del cls.__custom_d... | 8,739,360,008,819,532,000 | Removes the converter registered for the given classname. Dicts with that classname tag
will be deserialized by the default mechanism again. | Pyro5/serializers.py | unregister_dict_to_class | gst/Pyro5 | python | @classmethod
def unregister_dict_to_class(cls, classname):
'\n Removes the converter registered for the given classname. Dicts with that classname tag\n will be deserialized by the default mechanism again.\n '
if (classname in cls.__custom_dict_to_class_registry):
del cls.__custom_d... |
@classmethod
def class_to_dict(cls, obj):
'\n Convert a non-serializable object to a dict. Partly borrowed from serpent.\n '
for clazz in cls.__custom_class_to_dict_registry:
if isinstance(obj, clazz):
return cls.__custom_class_to_dict_registry[clazz](obj)
if (type(obj) in ... | 4,357,961,985,474,876,000 | Convert a non-serializable object to a dict. Partly borrowed from serpent. | Pyro5/serializers.py | class_to_dict | gst/Pyro5 | python | @classmethod
def class_to_dict(cls, obj):
'\n \n '
for clazz in cls.__custom_class_to_dict_registry:
if isinstance(obj, clazz):
return cls.__custom_class_to_dict_registry[clazz](obj)
if (type(obj) in (set, dict, tuple, list)):
raise ValueError((("can't serialize typ... |
@classmethod
def dict_to_class(cls, data):
'\n Recreate an object out of a dict containing the class name and the attributes.\n Only a fixed set of classes are recognized.\n '
from . import core, client, server
classname = data.get('__class__', '<unknown>')
if isinstance(classname, ... | -3,179,829,849,173,357,600 | Recreate an object out of a dict containing the class name and the attributes.
Only a fixed set of classes are recognized. | Pyro5/serializers.py | dict_to_class | gst/Pyro5 | python | @classmethod
def dict_to_class(cls, data):
'\n Recreate an object out of a dict containing the class name and the attributes.\n Only a fixed set of classes are recognized.\n '
from . import core, client, server
classname = data.get('__class__', '<unknown>')
if isinstance(classname, ... |
def __eq__(self, other):
'this equality method is only to support the unit tests of this class'
return (isinstance(other, SerializerBase) and (vars(self) == vars(other))) | -3,430,843,197,592,776,700 | this equality method is only to support the unit tests of this class | Pyro5/serializers.py | __eq__ | gst/Pyro5 | python | def __eq__(self, other):
return (isinstance(other, SerializerBase) and (vars(self) == vars(other))) |
@staticmethod
def get_classes_from_module(module: ModuleType) -> Dict[(str, Type[Any])]:
'\n Find classes inside a python module file.\n '
try:
return {name: cls for (name, cls) in module.__dict__.items() if isinstance(cls, type)}
except AttributeError:
log.warning('Could not f... | -4,971,437,206,064,173,000 | Find classes inside a python module file. | restapi/utilities/meta.py | get_classes_from_module | rapydo/http-api | python | @staticmethod
def get_classes_from_module(module: ModuleType) -> Dict[(str, Type[Any])]:
'\n \n '
try:
return {name: cls for (name, cls) in module.__dict__.items() if isinstance(cls, type)}
except AttributeError:
log.warning('Could not find any class in module {}', module)
... |
@staticmethod
def get_new_classes_from_module(module: ModuleType) -> Dict[(str, Type[Any])]:
'\n Skip classes not originated inside the module.\n '
classes = {}
for (name, value) in Meta.get_classes_from_module(module).items():
if (module.__name__ in value.__module__):
clas... | 182,685,707,624,112,300 | Skip classes not originated inside the module. | restapi/utilities/meta.py | get_new_classes_from_module | rapydo/http-api | python | @staticmethod
def get_new_classes_from_module(module: ModuleType) -> Dict[(str, Type[Any])]:
'\n \n '
classes = {}
for (name, value) in Meta.get_classes_from_module(module).items():
if (module.__name__ in value.__module__):
classes[name] = value
return classes |
@staticmethod
def get_module_from_string(modulestring: str, exit_on_fail: bool=False) -> Optional[ModuleType]:
'\n Getting a module import\n when your module is stored as a string in a variable\n '
try:
return import_module(modulestring)
except ModuleNotFoundError as e:
... | 7,899,737,331,426,552,000 | Getting a module import
when your module is stored as a string in a variable | restapi/utilities/meta.py | get_module_from_string | rapydo/http-api | python | @staticmethod
def get_module_from_string(modulestring: str, exit_on_fail: bool=False) -> Optional[ModuleType]:
'\n Getting a module import\n when your module is stored as a string in a variable\n '
try:
return import_module(modulestring)
except ModuleNotFoundError as e:
... |
@staticmethod
def get_self_reference_from_args(*args: Any) -> Optional[Any]:
"\n Useful in decorators:\n being able to call the internal method by getting\n the 'self' reference from the decorated method\n (when it's there)\n "
if (len(args) > 0):
candidate_as_self = a... | 5,626,463,926,865,336,000 | Useful in decorators:
being able to call the internal method by getting
the 'self' reference from the decorated method
(when it's there) | restapi/utilities/meta.py | get_self_reference_from_args | rapydo/http-api | python | @staticmethod
def get_self_reference_from_args(*args: Any) -> Optional[Any]:
"\n Useful in decorators:\n being able to call the internal method by getting\n the 'self' reference from the decorated method\n (when it's there)\n "
if (len(args) > 0):
candidate_as_self = a... |
@staticmethod
def get_celery_tasks(package_name: str) -> List[Callable[(..., Any)]]:
'\n Extract all celery tasks from a module.\n Celery tasks are functions decorated by @CeleryExt.celery_app.task(...)\n This decorator transform the function into a class child of\n celery.local.PromiseP... | -1,080,608,678,264,604,900 | Extract all celery tasks from a module.
Celery tasks are functions decorated by @CeleryExt.celery_app.task(...)
This decorator transform the function into a class child of
celery.local.PromiseProxy | restapi/utilities/meta.py | get_celery_tasks | rapydo/http-api | python | @staticmethod
def get_celery_tasks(package_name: str) -> List[Callable[(..., Any)]]:
'\n Extract all celery tasks from a module.\n Celery tasks are functions decorated by @CeleryExt.celery_app.task(...)\n This decorator transform the function into a class child of\n celery.local.PromiseP... |
def __init__(self):
'\n\t\tCreates the himesis graph representing the AToM3 model HUnitR06_IsolatedLHS\n\t\t'
self.is_compiled = True
super(HUnitR06_IsolatedLHS, self).__init__(name='HUnitR06_IsolatedLHS', num_nodes=0, edges=[])
self.add_edges([])
self['mm__'] = ['MT_pre__FamiliesToPersonsMM', 'MoTi... | -398,784,226,369,132,100 | Creates the himesis graph representing the AToM3 model HUnitR06_IsolatedLHS | GM2AUTOSAR_MM/Properties/unit_contracts/HUnitR06_IsolatedLHS.py | __init__ | levilucio/SyVOLT | python | def __init__(self):
'\n\t\t\n\t\t'
self.is_compiled = True
super(HUnitR06_IsolatedLHS, self).__init__(name='HUnitR06_IsolatedLHS', num_nodes=0, edges=[])
self.add_edges([])
self['mm__'] = ['MT_pre__FamiliesToPersonsMM', 'MoTifRule']
self['MT_constraint__'] = 'return True'
self['name'] =
... |
def set_trace(self, frame=None, as_breakpoint=None, paused=True):
"Start debugging from `frame`.\n\n If frame is not specified, debugging starts from caller's frame.\n\n Unlike Bdb.set_trace(), this does not call self.reset(), which causes\n the debugger to enter bdb source code. This also impl... | 560,936,211,875,106,400 | Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
Unlike Bdb.set_trace(), this does not call self.reset(), which causes
the debugger to enter bdb source code. This also implements treating
set_trace() calls as breakpoints in the PuDB UI.
If as_breakpoint=True (the default... | pudb/debugger.py | set_trace | chrisamow/pudb | python | def set_trace(self, frame=None, as_breakpoint=None, paused=True):
"Start debugging from `frame`.\n\n If frame is not specified, debugging starts from caller's frame.\n\n Unlike Bdb.set_trace(), this does not call self.reset(), which causes\n the debugger to enter bdb source code. This also impl... |
def user_call(self, frame, argument_list):
'This method is called when there is the remote possibility\n that we ever need to stop in this function.'
if self._wait_for_mainpyfile:
return
if self.stop_here(frame):
self.interaction(frame) | -5,955,718,721,955,943,000 | This method is called when there is the remote possibility
that we ever need to stop in this function. | pudb/debugger.py | user_call | chrisamow/pudb | python | def user_call(self, frame, argument_list):
'This method is called when there is the remote possibility\n that we ever need to stop in this function.'
if self._wait_for_mainpyfile:
return
if self.stop_here(frame):
self.interaction(frame) |
def user_line(self, frame):
'This function is called when we stop or break at this line.'
if ('__exc_tuple__' in frame.f_locals):
del frame.f_locals['__exc_tuple__']
if self._wait_for_mainpyfile:
if ((self.mainpyfile != self.canonic(frame.f_code.co_filename)) or (frame.f_lineno <= 0)):
... | -4,471,584,001,692,289,500 | This function is called when we stop or break at this line. | pudb/debugger.py | user_line | chrisamow/pudb | python | def user_line(self, frame):
if ('__exc_tuple__' in frame.f_locals):
del frame.f_locals['__exc_tuple__']
if self._wait_for_mainpyfile:
if ((self.mainpyfile != self.canonic(frame.f_code.co_filename)) or (frame.f_lineno <= 0)):
return
self._wait_for_mainpyfile = False
... |
def user_return(self, frame, return_value):
'This function is called when a return trap is set here.'
if (frame.f_code.co_name != '<module>'):
frame.f_locals['__return__'] = return_value
if self._wait_for_mainpyfile:
if ((self.mainpyfile != self.canonic(frame.f_code.co_filename)) or (frame.f... | 105,449,302,553,384,080 | This function is called when a return trap is set here. | pudb/debugger.py | user_return | chrisamow/pudb | python | def user_return(self, frame, return_value):
if (frame.f_code.co_name != '<module>'):
frame.f_locals['__return__'] = return_value
if self._wait_for_mainpyfile:
if ((self.mainpyfile != self.canonic(frame.f_code.co_filename)) or (frame.f_lineno <= 0)):
return
self._wait_for... |
def user_exception(self, frame, exc_tuple):
'This function is called if an exception occurs,\n but only if we are to stop at or just below this level.'
frame.f_locals['__exc_tuple__'] = exc_tuple
if (not self._wait_for_mainpyfile):
self.interaction(frame, exc_tuple) | 6,194,993,105,355,423,000 | This function is called if an exception occurs,
but only if we are to stop at or just below this level. | pudb/debugger.py | user_exception | chrisamow/pudb | python | def user_exception(self, frame, exc_tuple):
'This function is called if an exception occurs,\n but only if we are to stop at or just below this level.'
frame.f_locals['__exc_tuple__'] = exc_tuple
if (not self._wait_for_mainpyfile):
self.interaction(frame, exc_tuple) |
def signal_init(self):
'Initialize signal handler, ignoring errors silently.'
try:
super().signal_init()
except ValueError:
pass | 6,588,031,780,759,060,000 | Initialize signal handler, ignoring errors silently. | pudb/debugger.py | signal_init | chrisamow/pudb | python | def signal_init(self):
try:
super().signal_init()
except ValueError:
pass |
def signal_restore(self):
'Restore default signal handler, ignoring errors silently.'
try:
super().signal_restore()
except ValueError:
pass | 5,837,801,262,573,254,000 | Restore default signal handler, ignoring errors silently. | pudb/debugger.py | signal_restore | chrisamow/pudb | python | def signal_restore(self):
try:
super().signal_restore()
except ValueError:
pass |
def show_line(self, line, source_code_provider=None):
'Updates the UI so that a certain line is currently in view.'
changed_file = False
if (source_code_provider is not None):
changed_file = (self.source_code_provider != source_code_provider)
self.set_source_code_provider(source_code_provide... | -1,229,994,139,835,825,000 | Updates the UI so that a certain line is currently in view. | pudb/debugger.py | show_line | chrisamow/pudb | python | def show_line(self, line, source_code_provider=None):
changed_file = False
if (source_code_provider is not None):
changed_file = (self.source_code_provider != source_code_provider)
self.set_source_code_provider(source_code_provider)
line -= 1
if ((line >= 0) and (line < len(self.sou... |
def set_current_line(self, line, source_code_provider):
'Updates the UI to show the line currently being executed.'
if (self.current_line is not None):
self.current_line.set_current(False)
self.show_line(line, source_code_provider)
line -= 1
if ((line >= 0) and (line < len(self.source))):
... | -738,099,850,055,954,800 | Updates the UI to show the line currently being executed. | pudb/debugger.py | set_current_line | chrisamow/pudb | python | def set_current_line(self, line, source_code_provider):
if (self.current_line is not None):
self.current_line.set_current(False)
self.show_line(line, source_code_provider)
line -= 1
if ((line >= 0) and (line < len(self.source))):
self.current_line = self.source[line]
self.cu... |
@support.cpython_only
def test_peephole_opt_unreachable_code_array_access_in_bounds(self):
'Regression test for issue35193 when run under clang msan.'
def unused_code_at_end():
return 3
raise RuntimeError('unreachable')
self.assertEqual('RETURN_VALUE', list(dis.get_instructions(unused_code_... | -550,594,875,470,589,800 | Regression test for issue35193 when run under clang msan. | examples/wagipython/wagi-python/opt/wasi-python/lib/python3.11/test/test_compile.py | test_peephole_opt_unreachable_code_array_access_in_bounds | ScriptBox99/wagi-dotnet | python | @support.cpython_only
def test_peephole_opt_unreachable_code_array_access_in_bounds(self):
def unused_code_at_end():
return 3
raise RuntimeError('unreachable')
self.assertEqual('RETURN_VALUE', list(dis.get_instructions(unused_code_at_end))[(- 1)].opname) |
def f1():
'docstring'
return 42 | 2,956,622,419,990,045,700 | docstring | examples/wagipython/wagi-python/opt/wasi-python/lib/python3.11/test/test_compile.py | f1 | ScriptBox99/wagi-dotnet | python | def f1():
return 42 |
def no_code1():
'doc string' | -978,215,992,770,197,000 | doc string | examples/wagipython/wagi-python/opt/wasi-python/lib/python3.11/test/test_compile.py | no_code1 | ScriptBox99/wagi-dotnet | python | def no_code1():
|
@pytest.fixture(scope='session', autouse=True)
def mock_get_event_queryset_no_job_created():
"\n SQLite friendly since partitions aren't supported. Do not add the faked job_created field to the filter. If we do, it will result in an sql query for the\n job_created field. That field does not actually exist in ... | 6,119,196,560,993,237,000 | SQLite friendly since partitions aren't supported. Do not add the faked job_created field to the filter. If we do, it will result in an sql query for the
job_created field. That field does not actually exist in a non-partition scenario. | awx/main/tests/conftest.py | mock_get_event_queryset_no_job_created | AdamVB/awx | python | @pytest.fixture(scope='session', autouse=True)
def mock_get_event_queryset_no_job_created():
"\n SQLite friendly since partitions aren't supported. Do not add the faked job_created field to the filter. If we do, it will result in an sql query for the\n job_created field. That field does not actually exist in ... |
def rf(persisted):
'Returns job with linked JT survey with password survey questions'
objects = job_template_factory('jt', organization='org1', survey=[{'variable': 'submitter_email', 'type': 'text', 'default': 'example@example.com'}, {'variable': 'secret_key', 'default': '6kQngg3h8lgiSTvIEb21', 'type': 'passwo... | 7,814,057,701,853,962,000 | Returns job with linked JT survey with password survey questions | awx/main/tests/conftest.py | rf | AdamVB/awx | python | def rf(persisted):
objects = job_template_factory('jt', organization='org1', survey=[{'variable': 'submitter_email', 'type': 'text', 'default': 'example@example.com'}, {'variable': 'secret_key', 'default': '6kQngg3h8lgiSTvIEb21', 'type': 'password'}, {'variable': 'SSN', 'type': 'password'}], persisted=persiste... |
def stack_seeds(n_row: int, n_col: int, seeds_row: Optional[Union[(np.ndarray, dict)]], seeds_col: Optional[Union[(np.ndarray, dict)]]=None, default_value: float=(- 1)) -> np.ndarray:
'Process seeds for rows and columns and stack the results into a single vector.'
if ((seeds_row is None) and (seeds_col is None)... | -9,066,853,132,596,986,000 | Process seeds for rows and columns and stack the results into a single vector. | sknetwork/utils/seeds.py | stack_seeds | JulienSim001/scikit-network | python | def stack_seeds(n_row: int, n_col: int, seeds_row: Optional[Union[(np.ndarray, dict)]], seeds_col: Optional[Union[(np.ndarray, dict)]]=None, default_value: float=(- 1)) -> np.ndarray:
if ((seeds_row is None) and (seeds_col is None)):
seeds_row = np.ones(n_row)
seeds_col = (default_value * np.on... |
def seeds2probs(n: int, seeds: Union[(dict, np.ndarray)]=None) -> np.ndarray:
'Transform seeds into probability vector.\n\n Parameters\n ----------\n n : int\n Total number of samples.\n seeds :\n If ``None``, the uniform distribution is used.\n Otherwise, a non-negative, non-zero v... | 2,715,893,919,102,163,500 | Transform seeds into probability vector.
Parameters
----------
n : int
Total number of samples.
seeds :
If ``None``, the uniform distribution is used.
Otherwise, a non-negative, non-zero vector or a dictionary must be provided.
Returns
-------
probs: np.ndarray
A probability vector. | sknetwork/utils/seeds.py | seeds2probs | JulienSim001/scikit-network | python | def seeds2probs(n: int, seeds: Union[(dict, np.ndarray)]=None) -> np.ndarray:
'Transform seeds into probability vector.\n\n Parameters\n ----------\n n : int\n Total number of samples.\n seeds :\n If ``None``, the uniform distribution is used.\n Otherwise, a non-negative, non-zero v... |
@intrinsic
def viewer(tyctx, val, viewty):
" Bitcast a scalar 'val' to the given type 'viewty'. "
bits = val.bitwidth
if isinstance(viewty.dtype, types.Integer):
bitcastty = ir.IntType(bits)
elif isinstance(viewty.dtype, types.Float):
bitcastty = (ir.FloatType() if (bits == 32) else ir.D... | 8,181,720,399,996,662,000 | Bitcast a scalar 'val' to the given type 'viewty'. | numba/unsafe/numbers.py | viewer | Hardcode84/numba | python | @intrinsic
def viewer(tyctx, val, viewty):
" "
bits = val.bitwidth
if isinstance(viewty.dtype, types.Integer):
bitcastty = ir.IntType(bits)
elif isinstance(viewty.dtype, types.Float):
bitcastty = (ir.FloatType() if (bits == 32) else ir.DoubleType())
else:
assert 0, 'unreacha... |
@intrinsic
def trailing_zeros(typeingctx, src):
'Counts trailing zeros in the binary representation of an integer.'
if (not isinstance(src, types.Integer)):
raise TypeError("trailing_zeros is only defined for integers, but passed value was '{}'.".format(src))
def codegen(context, builder, signature... | -2,407,326,293,384,501,000 | Counts trailing zeros in the binary representation of an integer. | numba/unsafe/numbers.py | trailing_zeros | Hardcode84/numba | python | @intrinsic
def trailing_zeros(typeingctx, src):
if (not isinstance(src, types.Integer)):
raise TypeError("trailing_zeros is only defined for integers, but passed value was '{}'.".format(src))
def codegen(context, builder, signature, args):
[src] = args
return builder.cttz(src, ir.C... |
@intrinsic
def leading_zeros(typeingctx, src):
'Counts leading zeros in the binary representation of an integer.'
if (not isinstance(src, types.Integer)):
raise TypeError("leading_zeros is only defined for integers, but passed value was '{}'.".format(src))
def codegen(context, builder, signature, a... | 6,071,251,006,695,300,000 | Counts leading zeros in the binary representation of an integer. | numba/unsafe/numbers.py | leading_zeros | Hardcode84/numba | python | @intrinsic
def leading_zeros(typeingctx, src):
if (not isinstance(src, types.Integer)):
raise TypeError("leading_zeros is only defined for integers, but passed value was '{}'.".format(src))
def codegen(context, builder, signature, args):
[src] = args
return builder.ctlz(src, ir.Con... |
def bcp(sql_item: str, direction: str, flat_file: str, creds, sql_type: str='table', schema: str='dbo', format_file_path: str=None, batch_size: int=None, col_delimiter: str=None, row_terminator: str=None, bcp_path: Union[(str, Path)]=None, error_file_path: str=None):
'\n See https://docs.microsoft.com/en-us/sql/... | 7,696,618,202,439,960,000 | See https://docs.microsoft.com/en-us/sql/tools/bcp-utility | bcpandas/utils.py | bcp | alon-r/bcpandas | python | def bcp(sql_item: str, direction: str, flat_file: str, creds, sql_type: str='table', schema: str='dbo', format_file_path: str=None, batch_size: int=None, col_delimiter: str=None, row_terminator: str=None, bcp_path: Union[(str, Path)]=None, error_file_path: str=None):
'\n \n '
combos = {TABLE: [IN, OUT], Q... |
def get_temp_file() -> str:
'\n Returns full path to a temporary file without creating it.\n '
tmp_dir = tempfile.gettempdir()
file_path = os.path.join(tmp_dir, ''.join(random.choices((string.ascii_letters + string.digits), k=21)))
return file_path | 8,124,292,536,605,525,000 | Returns full path to a temporary file without creating it. | bcpandas/utils.py | get_temp_file | alon-r/bcpandas | python | def get_temp_file() -> str:
'\n \n '
tmp_dir = tempfile.gettempdir()
file_path = os.path.join(tmp_dir, .join(random.choices((string.ascii_letters + string.digits), k=21)))
return file_path |
def _escape(input_string: str) -> str:
'\n Adopted from https://github.com/titan550/bcpy/blob/master/bcpy/format_file_builder.py#L25\n '
return input_string.replace('"', '\\"').replace("'", "\\'").replace('\r', '\\r').replace('\n', '\\n') | 5,986,205,927,583,255,000 | Adopted from https://github.com/titan550/bcpy/blob/master/bcpy/format_file_builder.py#L25 | bcpandas/utils.py | _escape | alon-r/bcpandas | python | def _escape(input_string: str) -> str:
'\n \n '
return input_string.replace('"', '\\"').replace("'", "\\'").replace('\r', '\\r').replace('\n', '\\n') |
def build_format_file(df: pd.DataFrame, delimiter: str, db_cols_order: Optional[Dict[(str, int)]]=None) -> str:
"\n Creates the non-xml SQL format file. Puts 4 spaces between each section.\n See https://docs.microsoft.com/en-us/sql/relational-databases/import-export/non-xml-format-files-sql-server\n for th... | 1,567,611,070,143,142,100 | Creates the non-xml SQL format file. Puts 4 spaces between each section.
See https://docs.microsoft.com/en-us/sql/relational-databases/import-export/non-xml-format-files-sql-server
for the specification of the file.
# TODO add params/options to control:
# - the char type (not just SQLCHAR),
Parameters
----------
df... | bcpandas/utils.py | build_format_file | alon-r/bcpandas | python | def build_format_file(df: pd.DataFrame, delimiter: str, db_cols_order: Optional[Dict[(str, int)]]=None) -> str:
"\n Creates the non-xml SQL format file. Puts 4 spaces between each section.\n See https://docs.microsoft.com/en-us/sql/relational-databases/import-export/non-xml-format-files-sql-server\n for th... |
def quote_this(this: str, skip: bool=False) -> str:
"\n OS-safe way to quote a string.\n\n Returns the string with quotes around it.\n On Windows ~~it's double quotes~~ we skip quoting, \n on Linux it's single quotes.\n "
if isinstance(this, str):
if IS_WIN32:
return this
... | 694,796,248,036,194,300 | OS-safe way to quote a string.
Returns the string with quotes around it.
On Windows ~~it's double quotes~~ we skip quoting,
on Linux it's single quotes. | bcpandas/utils.py | quote_this | alon-r/bcpandas | python | def quote_this(this: str, skip: bool=False) -> str:
"\n OS-safe way to quote a string.\n\n Returns the string with quotes around it.\n On Windows ~~it's double quotes~~ we skip quoting, \n on Linux it's single quotes.\n "
if isinstance(this, str):
if IS_WIN32:
return this
... |
def run_cmd(cmd: List[str]) -> int:
'\n Runs the given command. \n \n Prints STDOUT in real time, prints STDERR when command is complete, \n and logs both STDOUT and STDERR.\n\n Paramters\n ---------\n cmd : list of str\n The command to run, to be submitted to `subprocess.Popen()`\n\n ... | -6,838,483,858,176,108,000 | Runs the given command.
Prints STDOUT in real time, prints STDERR when command is complete,
and logs both STDOUT and STDERR.
Paramters
---------
cmd : list of str
The command to run, to be submitted to `subprocess.Popen()`
Returns
-------
The exit code of the command | bcpandas/utils.py | run_cmd | alon-r/bcpandas | python | def run_cmd(cmd: List[str]) -> int:
'\n Runs the given command. \n \n Prints STDOUT in real time, prints STDERR when command is complete, \n and logs both STDOUT and STDERR.\n\n Paramters\n ---------\n cmd : list of str\n The command to run, to be submitted to `subprocess.Popen()`\n\n ... |
def get_E_Elc_microwave_d_t(P_Elc_microwave_cook_rtd, t_microwave_cook_d_t):
'時刻別消費電力量を計算する\n \n Parameters\n ----------\n P_Elc_microwave_cook_rtd : float\n 調理時の定格待機電力, W\n \n t_microwave_cook_d_t : ndarray(N-dimensional array)\n 1年間の全時間の調理時間を格納したND配列, h\n d日t時の調理時間が年開始時か... | 824,538,783,144,946,400 | 時刻別消費電力量を計算する
Parameters
----------
P_Elc_microwave_cook_rtd : float
調理時の定格待機電力, W
t_microwave_cook_d_t : ndarray(N-dimensional array)
1年間の全時間の調理時間を格納したND配列, h
d日t時の調理時間が年開始時から8760個連続して格納されている
Returns
----------
E_Elc_microwave_d_t : ndarray(N-dimensional array)
1年間の全時間の消費電力量を格納したND配列, Wh
... | src/pyhees/section10_j1_f.py | get_E_Elc_microwave_d_t | jjj-design/pyhees | python | def get_E_Elc_microwave_d_t(P_Elc_microwave_cook_rtd, t_microwave_cook_d_t):
'時刻別消費電力量を計算する\n \n Parameters\n ----------\n P_Elc_microwave_cook_rtd : float\n 調理時の定格待機電力, W\n \n t_microwave_cook_d_t : ndarray(N-dimensional array)\n 1年間の全時間の調理時間を格納したND配列, h\n d日t時の調理時間が年開始時か... |
def get_P_Elc_microwave_cook(P_Elc_microwave_rtd):
'調理時の消費電力を計算する\n \n Parameters\n ----------\n P_Elc_microwave_cook_rtd : float\n 調理時の定格待機電力, W\n \n Returns\n ----------\n P_Elc_microwave_cook : float\n 調理時の消費電力, W\n '
P_Elc_microwave_cook = (0.9373 * P_Elc_microwa... | 8,751,485,143,819,558,000 | 調理時の消費電力を計算する
Parameters
----------
P_Elc_microwave_cook_rtd : float
調理時の定格待機電力, W
Returns
----------
P_Elc_microwave_cook : float
調理時の消費電力, W | src/pyhees/section10_j1_f.py | get_P_Elc_microwave_cook | jjj-design/pyhees | python | def get_P_Elc_microwave_cook(P_Elc_microwave_rtd):
'調理時の消費電力を計算する\n \n Parameters\n ----------\n P_Elc_microwave_cook_rtd : float\n 調理時の定格待機電力, W\n \n Returns\n ----------\n P_Elc_microwave_cook : float\n 調理時の消費電力, W\n '
P_Elc_microwave_cook = (0.9373 * P_Elc_microwa... |
def test_hmac(self):
'\n From http://en.wikipedia.org/wiki/Hash-based_message_authentication_code\n\n HMAC_SHA1("key", "The quick brown fox jumps over the lazy dog")\n = 0xde7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9\n '
message = 'The quick brown fox jumps over the lazy dog'
key ... | 8,884,918,142,030,208,000 | From http://en.wikipedia.org/wiki/Hash-based_message_authentication_code
HMAC_SHA1("key", "The quick brown fox jumps over the lazy dog")
= 0xde7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 | test/test_client.py | test_hmac | Harkishen-Singh/google-maps-services-python | python | def test_hmac(self):
'\n From http://en.wikipedia.org/wiki/Hash-based_message_authentication_code\n\n HMAC_SHA1("key", "The quick brown fox jumps over the lazy dog")\n = 0xde7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9\n '
message = 'The quick brown fox jumps over the lazy dog'
key ... |
def __init__(self):
'Constructeur du paramètre.'
Parametre.__init__(self, 'creer', 'create')
self.schema = '<cle>'
self.aide_courte = 'crée un banc de poisson'
self.aide_longue = 'Cette commande permet de créer un nouveau banc de poisson. Vous devez préciser en argument la clé identifiant le banc.' | 6,566,749,253,367,863,000 | Constructeur du paramètre. | src/secondaires/peche/commandes/banc/creer.py | __init__ | vincent-lg/tsunami | python | def __init__(self):
Parametre.__init__(self, 'creer', 'create')
self.schema = '<cle>'
self.aide_courte = 'crée un banc de poisson'
self.aide_longue = 'Cette commande permet de créer un nouveau banc de poisson. Vous devez préciser en argument la clé identifiant le banc.' |
def interpreter(self, personnage, dic_masques):
"Méthode d'interprétation de commande"
cle = dic_masques['cle'].cle
if (cle in importeur.peche.bancs):
(personnage << '|err|Ce banc existe déjà.|ff|')
return
banc = importeur.peche.creer_banc(cle)
editeur = importeur.interpreteur.constr... | -7,734,939,328,273,605,000 | Méthode d'interprétation de commande | src/secondaires/peche/commandes/banc/creer.py | interpreter | vincent-lg/tsunami | python | def interpreter(self, personnage, dic_masques):
cle = dic_masques['cle'].cle
if (cle in importeur.peche.bancs):
(personnage << '|err|Ce banc existe déjà.|ff|')
return
banc = importeur.peche.creer_banc(cle)
editeur = importeur.interpreteur.construire_editeur('schooledit', personnage,... |
def main():
'Run administrative tasks.'
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'potato.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError("Couldn't import Django. Are you sure it's installed and available on ... | 181,689,278,771,491,780 | Run administrative tasks. | manage.py | main | aidswidjaja/PotatoBoard | python | def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'potato.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError("Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment... |
@pytest.mark.xfail(reason='OGR silently fails to convert strings')
def test_write_mismatch(self):
'TOFIX: OGR silently fails to convert strings'
schema = {'geometry': 'Point', 'properties': {'label': 'str', 'num': 'int'}}
with fiona.open(os.path.join(self.tempdir, 'test-write-fail.shp'), 'w', driver='ESRI S... | -2,003,226,171,940,806,400 | TOFIX: OGR silently fails to convert strings | tests/test_unicode.py | test_write_mismatch | Juanlu001/Fiona | python | @pytest.mark.xfail(reason='OGR silently fails to convert strings')
def test_write_mismatch(self):
schema = {'geometry': 'Point', 'properties': {'label': 'str', 'num': 'int'}}
with fiona.open(os.path.join(self.tempdir, 'test-write-fail.shp'), 'w', driver='ESRI Shapefile', schema=schema, encoding='latin1') a... |
def test_write_gb18030(self):
'Can write a simplified Chinese shapefile'
schema = {'geometry': 'Point', 'properties': {'label': 'str', 'num': 'int'}}
with fiona.open(os.path.join(self.tempdir, 'test-write-gb18030.shp'), 'w', driver='ESRI Shapefile', schema=schema, encoding='gb18030') as c:
c.writere... | -5,254,057,672,360,205,000 | Can write a simplified Chinese shapefile | tests/test_unicode.py | test_write_gb18030 | Juanlu001/Fiona | python | def test_write_gb18030(self):
schema = {'geometry': 'Point', 'properties': {'label': 'str', 'num': 'int'}}
with fiona.open(os.path.join(self.tempdir, 'test-write-gb18030.shp'), 'w', driver='ESRI Shapefile', schema=schema, encoding='gb18030') as c:
c.writerecords([{'type': 'Feature', 'geometry': {'t... |
def __init__(self):
'\n Use __init__ to define parameter network needs\n '
self.shared_param_list = ['offset_p2', 'offset_p3', 'offset_p4', 'offset_p5', 'rpn_conv', 'rpn_cls_score', 'rpn_bbox_pred']
self.shared_param_dict = {}
for name in self.shared_param_list:
self.shared_param_d... | 1,378,601,055,576,555,500 | Use __init__ to define parameter network needs | fpn/symbols/resnet_v1_101_fpn_dcn_rcnn.py | __init__ | chi3x10/RepMet | python | def __init__(self):
'\n \n '
self.shared_param_list = ['offset_p2', 'offset_p3', 'offset_p4', 'offset_p5', 'rpn_conv', 'rpn_cls_score', 'rpn_bbox_pred']
self.shared_param_dict = {}
for name in self.shared_param_list:
self.shared_param_dict[(name + '_weight')] = mx.sym.Variable((nam... |
def sort_human(l):
'Sort a list of strings by numerical.'
def convert(text):
return (float(text) if text.isdigit() else text)
def alphanum(key):
return [convert(c) for c in re.split('([-+]?[0-9]*\\.?[0-9]*)', key)]
l.sort(key=alphanum)
return l | -7,997,151,349,529,988,000 | Sort a list of strings by numerical. | results_processing/ABC/csv_processing.py | sort_human | multimodalspectroscopy/hypothermia-bayescmd | python | def sort_human(l):
def convert(text):
return (float(text) if text.isdigit() else text)
def alphanum(key):
return [convert(c) for c in re.split('([-+]?[0-9]*\\.?[0-9]*)', key)]
l.sort(key=alphanum)
return l |
def data_merge_by_batch(parent_directory, verbose=True):
'Merge a set of parameters.csv files into one.\n\n This is intended for use with batch processes from Legion, with each batch\n being 1000 runs longand numbered with integer values.\n\n Parameters\n ----------\n parent_directory : :obj:`list` o... | -9,222,835,480,730,805,000 | Merge a set of parameters.csv files into one.
This is intended for use with batch processes from Legion, with each batch
being 1000 runs longand numbered with integer values.
Parameters
----------
parent_directory : :obj:`list` of :obj:`str`
Parent directory to a set of directories each containing model runs and
... | results_processing/ABC/csv_processing.py | data_merge_by_batch | multimodalspectroscopy/hypothermia-bayescmd | python | def data_merge_by_batch(parent_directory, verbose=True):
'Merge a set of parameters.csv files into one.\n\n This is intended for use with batch processes from Legion, with each batch\n being 1000 runs longand numbered with integer values.\n\n Parameters\n ----------\n parent_directory : :obj:`list` o... |
def valid(args, model, writer, test_loader, global_step):
'\n :param args: 参数Config\n :param model: 需验证模型\n :param writer: TB写入\n :param test_loader: 测试数据集\n :param global_step: 全局step\n :return:\n '
eval_losses = AverageMeter()
model.eval()
(all_preds, all_label) = ([], [])
... | 180,415,128,705,602,140 | :param args: 参数Config
:param model: 需验证模型
:param writer: TB写入
:param test_loader: 测试数据集
:param global_step: 全局step
:return: | VIT/Train.py | valid | HzcIrving/DLRL-PlayGround | python | def valid(args, model, writer, test_loader, global_step):
'\n :param args: 参数Config\n :param model: 需验证模型\n :param writer: TB写入\n :param test_loader: 测试数据集\n :param global_step: 全局step\n :return:\n '
eval_losses = AverageMeter()
model.eval()
(all_preds, all_label) = ([], [])
... |
def train(args=VITConfig()):
'\n :param args:\n - log_dir\n '
pretrained_model_config = CONFIGS[args.model_type]
num_classes = (10 if (args.dataset == 'cifar10') else 100)
model = VITransModel(pretrained_model_config, args.img_size, zero_head=True, num_classes=num_classes)
model.load_from(... | 128,077,709,540,103,760 | :param args:
- log_dir | VIT/Train.py | train | HzcIrving/DLRL-PlayGround | python | def train(args=VITConfig()):
'\n :param args:\n - log_dir\n '
pretrained_model_config = CONFIGS[args.model_type]
num_classes = (10 if (args.dataset == 'cifar10') else 100)
model = VITransModel(pretrained_model_config, args.img_size, zero_head=True, num_classes=num_classes)
model.load_from(... |
@pytest.fixture(scope='module')
def tf_support():
'Boolean fixture for TensorFlow support'
try:
import tensorflow as tf
tf_support = True
except ImportError as e:
tf_support = False
return tf_support | 361,981,713,551,426,300 | Boolean fixture for TensorFlow support | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | tf_support | MattePalte/Bugs-Quantum-Computing-Platforms | python | @pytest.fixture(scope='module')
def tf_support():
try:
import tensorflow as tf
tf_support = True
except ImportError as e:
tf_support = False
return tf_support |
def test_qnode_fails_on_wrong_return_type(self, qubit_device_2_wires):
'The qfunc must return only Expectations'
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
return (qml.expval(qml.PauliZ(0)), 0.3)
with pytest.raises(QuantumFunctionError, match='must ... | -151,206,726,214,130,500 | The qfunc must return only Expectations | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_wrong_return_type | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_wrong_return_type(self, qubit_device_2_wires):
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
return (qml.expval(qml.PauliZ(0)), 0.3)
with pytest.raises(QuantumFunctionError, match='must return either'):
qf(Variable(0.5)... |
def test_qnode_fails_on_expval_not_returned(self, qubit_device_2_wires):
'All expectation values in the qfunc must be returned'
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
ex = qml.expval(qml.PauliZ(1))
return qml.expval(qml.PauliZ(0))
with p... | -7,956,166,682,982,606,000 | All expectation values in the qfunc must be returned | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_expval_not_returned | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_expval_not_returned(self, qubit_device_2_wires):
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
ex = qml.expval(qml.PauliZ(1))
return qml.expval(qml.PauliZ(0))
with pytest.raises(QuantumFunctionError, match='All measured... |
def test_qnode_fails_on_wrong_expval_order(self, qubit_device_2_wires):
'Expvals must be returned in the order they were created in'
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
ex = qml.expval(qml.PauliZ(1))
return (qml.expval(qml.PauliZ(0)), ex)... | -5,130,039,859,913,704,000 | Expvals must be returned in the order they were created in | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_wrong_expval_order | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_wrong_expval_order(self, qubit_device_2_wires):
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
ex = qml.expval(qml.PauliZ(1))
return (qml.expval(qml.PauliZ(0)), ex)
with pytest.raises(QuantumFunctionError, match='All mea... |
def test_qnode_fails_on_gates_after_measurements(self, qubit_device_2_wires):
'Gates have to precede measurements'
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
ev = qml.expval(qml.PauliZ(1))
qml.RY(0.5, wires=[0])
return ev
with pytest... | -8,088,013,940,943,135,000 | Gates have to precede measurements | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_gates_after_measurements | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_gates_after_measurements(self, qubit_device_2_wires):
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
ev = qml.expval(qml.PauliZ(1))
qml.RY(0.5, wires=[0])
return ev
with pytest.raises(QuantumFunctionError, match=... |
def test_qnode_fails_on_multiple_measurements_of_same_wire(self, qubit_device_2_wires):
'A wire can only be measured once'
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ... | 3,540,677,449,148,389,000 | A wire can only be measured once | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_multiple_measurements_of_same_wire | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_multiple_measurements_of_same_wire(self, qubit_device_2_wires):
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)), qml.expval(qml.PauliX(0)))
... |
def test_qnode_fails_on_qfunc_with_too_many_wires(self, qubit_device_2_wires):
'The device must have sufficient wires for the qfunc'
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 2])
return qml.expval(qml.PauliZ(0))
with pyte... | -9,174,797,300,855,287,000 | The device must have sufficient wires for the qfunc | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_qfunc_with_too_many_wires | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_qfunc_with_too_many_wires(self, qubit_device_2_wires):
@qml.qnode(qubit_device_2_wires, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 2])
return qml.expval(qml.PauliZ(0))
with pytest.raises(QuantumFunctionError, match='applied to inv... |
def test_qnode_fails_on_combination_of_cv_and_qbit_ops(self, qubit_device_1_wire):
'CV and discrete operations must not be mixed'
@qml.qnode(qubit_device_1_wire, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
qml.Displacement(0.5, 0, wires=[0])
return qml.expval(qml.PauliZ(0))
... | -4,822,898,876,985,808,000 | CV and discrete operations must not be mixed | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_on_combination_of_cv_and_qbit_ops | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_on_combination_of_cv_and_qbit_ops(self, qubit_device_1_wire):
@qml.qnode(qubit_device_1_wire, interface='tf')
def qf(x):
qml.RX(x, wires=[0])
qml.Displacement(0.5, 0, wires=[0])
return qml.expval(qml.PauliZ(0))
with pytest.raises(QuantumFunctionError, match... |
def test_qnode_fails_for_cv_ops_on_qubit_device(self, qubit_device_1_wire):
'A qubit device cannot execute CV operations'
@qml.qnode(qubit_device_1_wire, interface='tf')
def qf(x):
qml.Displacement(0.5, 0, wires=[0])
return qml.expval(qml.X(0))
with pytest.raises(DeviceError, match='Gat... | -2,523,454,052,245,777,400 | A qubit device cannot execute CV operations | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_for_cv_ops_on_qubit_device | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_for_cv_ops_on_qubit_device(self, qubit_device_1_wire):
@qml.qnode(qubit_device_1_wire, interface='tf')
def qf(x):
qml.Displacement(0.5, 0, wires=[0])
return qml.expval(qml.X(0))
with pytest.raises(DeviceError, match='Gate [a-zA-Z]+ not supported on device'):
... |
def test_qnode_fails_for_cv_observables_on_qubit_device(self, qubit_device_1_wire):
'A qubit device cannot measure CV observables'
@qml.qnode(qubit_device_1_wire, interface='tf')
def qf(x):
return qml.expval(qml.X(0))
with pytest.raises(DeviceError, match='Observable [a-zA-Z]+ not supported on ... | 1,553,786,248,707,053,000 | A qubit device cannot measure CV observables | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fails_for_cv_observables_on_qubit_device | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fails_for_cv_observables_on_qubit_device(self, qubit_device_1_wire):
@qml.qnode(qubit_device_1_wire, interface='tf')
def qf(x):
return qml.expval(qml.X(0))
with pytest.raises(DeviceError, match='Observable [a-zA-Z]+ not supported on device'):
qf(Variable(0.5)) |
def test_qnode_fanout(self, qubit_device_1_wire, tol):
'Tests that qnodes can compute the correct function when the same parameter is used in multiple gates.'
@qml.qnode(qubit_device_1_wire, interface='tf')
def circuit(reused_param, other_param):
qml.RX(reused_param, wires=[0])
qml.RZ(other... | -814,788,456,880,821,200 | Tests that qnodes can compute the correct function when the same parameter is used in multiple gates. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_fanout | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_fanout(self, qubit_device_1_wire, tol):
@qml.qnode(qubit_device_1_wire, interface='tf')
def circuit(reused_param, other_param):
qml.RX(reused_param, wires=[0])
qml.RZ(other_param, wires=[0])
qml.RX(reused_param, wires=[0])
return qml.expval(qml.PauliZ(0))
... |
def test_qnode_array_parameters_scalar_return(self, qubit_device_1_wire, tol):
'Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow.\n Test case for a circuit that returns a scalar.'
@qml.qnode(qubit_device_1_wire, interface='tf')
def circuit(dummy1... | 6,721,836,414,371,300,000 | Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow.
Test case for a circuit that returns a scalar. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_array_parameters_scalar_return | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_array_parameters_scalar_return(self, qubit_device_1_wire, tol):
'Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow.\n Test case for a circuit that returns a scalar.'
@qml.qnode(qubit_device_1_wire, interface='tf')
def circuit(dummy1... |
def test_qnode_array_parameters_1_vector_return(self, qubit_device_1_wire, tol):
'Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow\n Test case for a circuit that returns a 1-vector.'
@qml.qnode(qubit_device_1_wire, interface='tf')
def circuit(dum... | 1,966,179,864,155,857,400 | Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow
Test case for a circuit that returns a 1-vector. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_array_parameters_1_vector_return | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_array_parameters_1_vector_return(self, qubit_device_1_wire, tol):
'Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow\n Test case for a circuit that returns a 1-vector.'
@qml.qnode(qubit_device_1_wire, interface='tf')
def circuit(dum... |
def test_qnode_array_parameters_2_vector_return(self, qubit_device_2_wires, tol):
'Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow\n Test case for a circuit that returns a 2-vector.'
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(d... | 1,552,991,200,751,960,000 | Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow
Test case for a circuit that returns a 2-vector. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_qnode_array_parameters_2_vector_return | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_qnode_array_parameters_2_vector_return(self, qubit_device_2_wires, tol):
'Test that QNode can take arrays as input arguments, and that they interact properly with TensorFlow\n Test case for a circuit that returns a 2-vector.'
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(d... |
def test_array_parameters_evaluate(self, qubit_device_2_wires, tol):
'Test that array parameters gives same result as positional arguments.'
(a, b, c) = (tf.constant(0.5), tf.constant(0.54), tf.constant(0.3))
def ansatz(x, y, z):
qml.QubitStateVector((np.array([1, 0, 1, 1]) / np.sqrt(3)), wires=[0,... | -4,144,648,632,722,298,400 | Test that array parameters gives same result as positional arguments. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_array_parameters_evaluate | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_array_parameters_evaluate(self, qubit_device_2_wires, tol):
(a, b, c) = (tf.constant(0.5), tf.constant(0.54), tf.constant(0.3))
def ansatz(x, y, z):
qml.QubitStateVector((np.array([1, 0, 1, 1]) / np.sqrt(3)), wires=[0, 1])
qml.Rot(x, y, z, wires=0)
qml.CNOT(wires=[0, 1])
... |
def test_multiple_expectation_different_wires(self, qubit_device_2_wires, tol):
'Tests that qnodes return multiple expectation values.'
(a, b, c) = (Variable(0.5), Variable(0.54), Variable(0.3))
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(x, y, z):
qml.RX(x, wires=[0])
... | 7,911,533,964,854,274,000 | Tests that qnodes return multiple expectation values. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_multiple_expectation_different_wires | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_multiple_expectation_different_wires(self, qubit_device_2_wires, tol):
(a, b, c) = (Variable(0.5), Variable(0.54), Variable(0.3))
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(x, y, z):
qml.RX(x, wires=[0])
qml.RZ(y, wires=[0])
qml.CNOT(wires=[0, 1])
... |
def test_multiple_keywordargs_used(self, qubit_device_2_wires, tol):
'Tests that qnodes use multiple keyword arguments.'
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(w, x=None, y=None):
qml.RX(x, wires=[0])
qml.RX(y, wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.... | -2,299,123,470,347,842,000 | Tests that qnodes use multiple keyword arguments. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_multiple_keywordargs_used | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_multiple_keywordargs_used(self, qubit_device_2_wires, tol):
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(w, x=None, y=None):
qml.RX(x, wires=[0])
qml.RX(y, wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)))
c = circuit(tf.constant(... |
def test_multidimensional_keywordargs_used(self, qubit_device_2_wires, tol):
'Tests that qnodes use multi-dimensional keyword arguments.'
def circuit(w, x=None):
qml.RX(x[0], wires=[0])
qml.RX(x[1], wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)))
circuit = q... | -4,651,934,759,475,773,000 | Tests that qnodes use multi-dimensional keyword arguments. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_multidimensional_keywordargs_used | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_multidimensional_keywordargs_used(self, qubit_device_2_wires, tol):
def circuit(w, x=None):
qml.RX(x[0], wires=[0])
qml.RX(x[1], wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)))
circuit = qml.QNode(circuit, qubit_device_2_wires).to_tf()
c = circ... |
def test_keywordargs_for_wires(self, qubit_device_2_wires, tol):
'Tests that wires can be passed as keyword arguments.'
default_q = 0
def circuit(x, q=default_q):
qml.RY(x, wires=0)
return qml.expval(qml.PauliZ(q))
circuit = qml.QNode(circuit, qubit_device_2_wires).to_tf()
c = circu... | 8,595,178,969,222,835,000 | Tests that wires can be passed as keyword arguments. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_keywordargs_for_wires | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_keywordargs_for_wires(self, qubit_device_2_wires, tol):
default_q = 0
def circuit(x, q=default_q):
qml.RY(x, wires=0)
return qml.expval(qml.PauliZ(q))
circuit = qml.QNode(circuit, qubit_device_2_wires).to_tf()
c = circuit(tf.constant(np.pi), q=1)
assert np.allclose(c, ... |
def test_keywordargs_used(self, qubit_device_1_wire, tol):
'Tests that qnodes use keyword arguments.'
def circuit(w, x=None):
qml.RX(x, wires=[0])
return qml.expval(qml.PauliZ(0))
circuit = qml.QNode(circuit, qubit_device_1_wire).to_tf()
c = circuit(tf.constant(1.0), x=np.pi)
assert... | 6,138,958,088,680,453,000 | Tests that qnodes use keyword arguments. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_keywordargs_used | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_keywordargs_used(self, qubit_device_1_wire, tol):
def circuit(w, x=None):
qml.RX(x, wires=[0])
return qml.expval(qml.PauliZ(0))
circuit = qml.QNode(circuit, qubit_device_1_wire).to_tf()
c = circuit(tf.constant(1.0), x=np.pi)
assert np.allclose(c.numpy(), (- 1.0), atol=tol,... |
def test_mixture_numpy_tensors(self, qubit_device_2_wires, tol):
'Tests that qnodes work with python types and tensors.'
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(w, x, y):
qml.RX(x, wires=[0])
qml.RX(y, wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml... | 6,131,238,922,305,531,000 | Tests that qnodes work with python types and tensors. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_mixture_numpy_tensors | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_mixture_numpy_tensors(self, qubit_device_2_wires, tol):
@qml.qnode(qubit_device_2_wires, interface='tf')
def circuit(w, x, y):
qml.RX(x, wires=[0])
qml.RX(y, wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)))
c = circuit(tf.constant(1.0), np.pi, n... |
def test_keywordarg_updated_in_multiple_calls(self, qubit_device_2_wires):
'Tests that qnodes update keyword arguments in consecutive calls.'
def circuit(w, x=None):
qml.RX(w, wires=[0])
qml.RX(x, wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)))
circuit = qml... | 195,756,045,234,336,300 | Tests that qnodes update keyword arguments in consecutive calls. | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | test_keywordarg_updated_in_multiple_calls | MattePalte/Bugs-Quantum-Computing-Platforms | python | def test_keywordarg_updated_in_multiple_calls(self, qubit_device_2_wires):
def circuit(w, x=None):
qml.RX(w, wires=[0])
qml.RX(x, wires=[1])
return (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)))
circuit = qml.QNode(circuit, qubit_device_2_wires).to_tf()
c1 = circuit(tf.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.