function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def prepare_request(next_link=None):
if not next_link: | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def extract_data(pipeline_response):
deserialized = self._deserialize("BackupPoliciesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _create_initial(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
body: "_models.BackupPolicy",
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_create(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
body: "_models.BackupPolicy",
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
deserialized = self._deserialize('BackupPolicy', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _update_initial(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
body: "_models.BackupPolicyPatch",
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_update(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
body: "_models.BackupPolicyPatch",
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
deserialized = self._deserialize('BackupPolicy', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _delete_initial(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_delete(
self,
resource_group_name: str,
account_name: str,
backup_policy_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def logic(actions):
key = actions['key']
if key == "a":
#Here is our one line of text, it will speak when we press a
spk(my_name)
elif key == "s":
#Here is our number, it will speak when we press s
spk(my_age)
elif key == "d":
#Here is our multiline text example. It will speak when we press d
spk(my_son... | frastlin/PyAudioGame | [
5,
4,
5,
2,
1420973210
] |
def get_performance_dashboard():
# All statistics are as of last night this matches the existing performance platform
# and avoids the need to query notifications.
if request.args:
# Is it ok to reuse this? - should probably create a new one
validate(request.args, performance_dashboard_reque... | alphagov/notifications-api | [
56,
23,
56,
6,
1447855037
] |
def transform_into_notification_by_type_json(total_notifications):
j = []
for x in total_notifications:
j.append({"date": x.bst_date, "emails": x.emails, "sms": x.sms, "letters": x.letters})
return j | alphagov/notifications-api | [
56,
23,
56,
6,
1447855037
] |
def test_unknown_command(self):
"""Should fail if the command is not recognized."""
r = support.run_command('alias fake')
self.assertTrue(r.failed, 'should have failed')
self.assertEqual(r.errors[0].code, 'UNKNOWN_COMMAND') | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_add(self):
"""..."""
p = self.get_temp_path('aliaser')
r = support.run_command('alias add test "{}" --temporary'.format(p))
self.assertFalse(r.failed, 'should not have failed') | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_empty(self):
"""..."""
r = support.run_command('alias add')
self.assertTrue(r.failed, 'should have failed')
self.assertEqual(r.errors[0].code, 'MISSING_ARG') | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_autocomplete_alias(self):
"""..."""
result = support.autocomplete('alias add fake-alias-not-real')
self.assertEqual(len(result), 0) | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test1():
SINK(SOURCE) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def source():
return SOURCE | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test3():
t = source()
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test5():
t = source()
sink(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test7(cond):
if cond:
t = SOURCE
else:
t = "Safe"
if cond:
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def sink2(arg):
sink(arg) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test8(cond):
t = source2()
sink2(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test9(cond):
if cond:
t = "Safe"
else:
t = SOURCE
sink3(cond, t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def hub(arg):
return arg | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test12():
t = "safe"
t = hub(t)
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test13():
t = module.dangerous
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test15():
t = module.safe2
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test20(cond):
if cond:
t = CUSTOM_SOURCE
else:
t = SOURCE
if cond:
CUSTOM_SINK(t)
else:
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test22(cond):
if cond:
t = CUSTOM_SOURCE
else:
t = SOURCE
t = TAINT_FROM_ARG(t)
if cond:
CUSTOM_SINK(t)
else:
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test23():
with SOURCE as t:
SINK(t) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test_update_extend(x, y):
l = [SOURCE]
d = {"key" : SOURCE}
x.extend(l)
y.update(d)
SINK(x[0])
SINK(y["key"])
l2 = list(l)
d2 = dict(d) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test_diff_for_humans():
with pendulum.test(pendulum.datetime(2016, 8, 29)):
diff_for_humans() | sdispater/pendulum | [
5366,
323,
5366,
238,
1467070673
] |
def setUp(self):
filepath = os.path.join(PymatgenTest.TEST_FILES_DIR, "POSCAR")
p = Poscar.from_file(filepath)
self.cssr = Cssr(p.structure) | materialsproject/pymatgen | [
1063,
732,
1063,
235,
1319343039
] |
def test_from_file(self):
filename = os.path.join(PymatgenTest.TEST_FILES_DIR, "Si.cssr")
cssr = Cssr.from_file(filename)
self.assertIsInstance(cssr.structure, Structure) | materialsproject/pymatgen | [
1063,
732,
1063,
235,
1319343039
] |
def _user_module_changed(self, name, old, new):
if self.shell is not None:
self.shell.user_module = new | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def _user_ns_changed(self, name, old, new):
if self.shell is not None:
self.shell.user_ns = new
self.shell.init_user_ns() | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def __init__(self, **kwargs):
super(IPythonKernel, self).__init__(**kwargs)
# Initialize the InteractiveShell subclass
self.shell = self.shell_class.instance(parent=self,
profile_dir=self.profile_dir,
... | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def banner(self):
return self.shell.banner | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def set_parent(self, ident, parent):
"""Overridden from parent to tell the display hook and output streams
about the parent message.
"""
super(IPythonKernel, self).set_parent(ident, parent)
self.shell.set_parent(parent) | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def _restore_input(self):
"""Restore raw_input, getpass"""
if PY3:
builtin_mod.input = self._sys_raw_input
else:
builtin_mod.raw_input = self._sys_raw_input
builtin_mod.input = self._sys_eval_input
getpass.getpass = self._save_getpass | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def execution_count(self):
return self.shell.execution_count | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def execution_count(self, value):
# Ignore the incrememnting done by KernelBase, in favour of our shell's
# execution counter.
pass | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def do_complete(self, code, cursor_pos):
# FIXME: IPython completers currently assume single line,
# but completion messages give multi-line context
# For now, extract line from cell, based on cursor_pos:
if cursor_pos is None:
cursor_pos = len(code)
line, offset = li... | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def do_history(self, hist_access_type, output, raw, session=None, start=None,
stop=None, n=None, pattern=None, unique=False):
if hist_access_type == 'tail':
hist = self.shell.history_manager.get_tail(n, raw=raw, output=output,
... | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def do_is_complete(self, code):
status, indent_spaces = self.shell.input_transformer_manager.check_complete(
code)
r = {'status': status}
if status == 'incomplete':
r['indent'] = ' ' * indent_spaces
return r | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def do_clear(self):
self.shell.reset(False)
return dict(status='ok') | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def __init__(self, Asset=None, status=None, *args, **kw_args):
"""Initialises a new 'ErpInventory' instance.
@param Asset:
@param status:
"""
self._Asset = None
self.Asset = Asset
self.status = status
super(ErpInventory, self).__init__(*args, **kw_args) | rwl/PyCIM | [
68,
33,
68,
7,
1238978196
] |
def getAsset(self): | rwl/PyCIM | [
68,
33,
68,
7,
1238978196
] |
def setAsset(self, value):
if self._Asset is not None:
self._Asset._ErpInventory = None
self._Asset = value
if self._Asset is not None:
self._Asset.ErpInventory = None
self._Asset._ErpInventory = self | rwl/PyCIM | [
68,
33,
68,
7,
1238978196
] |
def __init__(self, x):
self.val = x
self.left = None
self.right = None | jiadaizhao/LeetCode | [
39,
21,
39,
2,
1502171846
] |
def sumEvenGrandparent(self, root: TreeNode) -> int:
total = 0
def dfs(root, p, gp):
if root is None:
return
nonlocal total
if gp and (gp.val & 1) == 0:
total += root.val
dfs(root.left, root, p)
dfs(root.right, r... | jiadaizhao/LeetCode | [
39,
21,
39,
2,
1502171846
] |
def __init__(self):
"""
The constructor ...
:return:
"""
# Call the constructor of the base class
super(MemoryPlotter, self).__init__()
# -- Attributes --
# A data structure to store the memory (de)allocation information
self.allocation = None | Stargrazer82301/CAAPR | [
8,
2,
8,
1,
1453231962
] |
def default_input():
"""
This function ...
:return:
"""
return "memory.dat" | Stargrazer82301/CAAPR | [
8,
2,
8,
1,
1453231962
] |
def prepare_data(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Preparing the input data into plottable format...")
# Get the number of processes
ranks = np.unique(self.table["Process rank"])
assert len(ranks) == max(rank... | Stargrazer82301/CAAPR | [
8,
2,
8,
1,
1453231962
] |
def plot(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Making the plots...")
# Make a plot of the memory usage as a function of time
self.plot_memory()
# Make a plot of the memory (de)allocation information, if present
... | Stargrazer82301/CAAPR | [
8,
2,
8,
1,
1453231962
] |
def plot_memory(self):
"""
This function ...
:return:
"""
# Determine the path to the plot file
plot_path = fs.join(self.output_path, "memory.pdf")
# Initialize figure
plt.figure()
plt.clf()
# Loop over the different processes
f... | Stargrazer82301/CAAPR | [
8,
2,
8,
1,
1453231962
] |
def plot_allocation(self):
"""
This function ...
:return:
"""
# Determine the path to the plot file
plot_path = fs.join(self.output_path, "allocation.pdf")
# Initialize figure
plt.figure()
plt.clf()
# Plot the memory usage of the root p... | Stargrazer82301/CAAPR | [
8,
2,
8,
1,
1453231962
] |
def build_get_request(
location: str,
publisher_name: str,
offer: str,
skus: str,
version: str,
subscription_id: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def build_list_request(
location: str,
publisher_name: str,
offer: str,
skus: str,
subscription_id: str,
*,
expand: Optional[str] = None,
top: Optional[int] = None,
orderby: Optional[str] = None,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def build_list_offers_request(
location: str,
publisher_name: str,
subscription_id: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def build_list_publishers_request(
location: str,
subscription_id: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def build_list_skus_request(
location: str,
publisher_name: str,
offer: str,
subscription_id: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get(
self,
location: str,
publisher_name: str,
offer: str,
skus: str,
version: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
location: str,
publisher_name: str,
offer: str,
skus: str,
expand: Optional[str] = None,
top: Optional[int] = None,
orderby: Optional[str] = None,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list_offers(
self,
location: str,
publisher_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list_publishers(
self,
location: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list_skus(
self,
location: str,
publisher_name: str,
offer: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self, plotly_name="color", parent_name="histogram2dcontour.textfont", **kwargs | plotly/plotly.py | [
13052,
2308,
13052,
1319,
1385013188
] |
def __init__(
self,
*,
container_host_resource_id: Optional[str] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
sku: "Sku",
target_container_host_resource_id: str,
target_container_host_credentials_base64: str,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
orchestrator_specific_connection_details: Optional["OrchestratorSpecificConnectionDetails"] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
connection_details_list: Optional[List["ControllerConnectionDetails"]] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
value: Optional[List["Controller"]] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
target_container_host_credentials_base64: Optional[str] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
error: Optional["ErrorDetails"] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
kube_config: Optional[str] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
target_container_host_resource_id: str,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
name: Optional[str] = None,
display: Optional["ResourceProviderOperationDisplay"] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
provider: Optional[str] = None,
resource: Optional[str] = None,
operation: Optional[str] = None,
description: Optional[str] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
value: Optional[List["ResourceProviderOperationDefinition"]] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self,
*,
name: Union[str, "SkuName"],
tier: Optional[Union[str, "SkuTier"]] = None,
**kwargs | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(
self, plotly_name="nticks", parent_name="layout.ternary.baxis", **kwargs | plotly/plotly.py | [
13052,
2308,
13052,
1319,
1385013188
] |
def setUp(self):
self.user = User.objects.create(username='test', email='test@localhost', password='test')
self.user2 = User.objects.create(username='test2', email='test2@localhost', password='test')
self.user3 = User.objects.create(username='test3', email='test3@localhost', password='test')
... | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_storyteller_can_provide_card(self):
story_play = Play(game_round=self.current, player=self.game.storyteller)
story_play.provide_card(self.game.storyteller._pick_card(), 'story')
self.assertEqual(self.current.plays.count(), 1) | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_players_can_provide_card_after_storyteller(self):
Play.play_for_round(self.current, self.game.storyteller, self.game.storyteller._pick_card(), 'story')
Play.play_for_round(self.current, self.player2, self.player2._pick_card())
self.assertEqual(self.current.plays.count(), 2) | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_players_can_choose_played_card(self):
story_card = self.game.storyteller._pick_card()
story_play = Play.play_for_round(self.current, self.game.storyteller, story_card, 'story')
play2 = Play.play_for_round(self.current, self.player2, self.player2._pick_card())
play3 = Play.play_... | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_players_can_not_choose_own_card(self):
story_card = self.game.storyteller._pick_card()
story_play = Play.play_for_round(self.current, self.game.storyteller, story_card, 'story')
card2 = self.player2._pick_card()
play2 = Play.play_for_round(self.current, self.player2, card2)
... | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def setUp(self):
self.user = User.objects.create(username='test', email='test@localhost', password='test')
self.user2 = User.objects.create(username='test2', email='test2@localhost', password='test')
self.user3 = User.objects.create(username='test3', email='test3@localhost', password='test')
... | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_round_is_new_when_only_storyteller_has_played(self):
story_card = self.game.storyteller._pick_card()
Play.play_for_round(self.current, self.game.storyteller, story_card, 'story')
self.assertEqual(self.current.status, RoundStatus.NEW) | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_round_is_voting_when_all_players_have_provided_a_card(self):
Play.play_for_round(self.current, self.game.storyteller, self.game.storyteller._pick_card(), 'story')
players = self.game.players.all().exclude(id=self.game.storyteller.id)
for player in players:
Play.play_for_roun... | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
def test_round_is_complete_when_all_players_have_voted(self):
story_card = self.current.turn._pick_card()
Play.play_for_round(self.current, self.game.storyteller, story_card, 'story')
players = self.game.players.all().exclude(id=self.game.storyteller.id)
for player in players:
... | jminuscula/dixit-online | [
70,
19,
70,
23,
1465385513
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.