uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
a32d8abb1119868ce2952f1e
train
function
def _getch_windows(): while not msvcrt.kbhit(): time.sleep(0.01) return msvcrt.getch()
def _getch_windows():
while not msvcrt.kbhit(): time.sleep(0.01) return msvcrt.getch()
no == 9: # [Errno 9] Bad file descriptor pass elif e.args and e.args[0] == errno.EINTR: pass else: raise finally: if lock.locked(): lock.release() def _getch_windows():
64
64
32
6
58
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_getch_windows
_getch_windows
727
730
727
727
18783ce2df79c20eb5b699e5b443991ced6c584e
bigcode/the-stack
train
4ce6e08576211efc605bad08
train
function
def create_container(cmd, resource_group_name, name=None, image=None, location=None, cpu=1, memory=1.5, restart_policy='Always', ports=None, ...
def create_container(cmd, resource_group_name, name=None, image=None, location=None, cpu=1, memory=1.5, restart_policy='Always', ports=None, ...
"""Create a container group. """ if file: return _create_update_from_file(cmd.cli_ctx, resource_group_name, name, location, file, no_wait) if not name: raise CLIError("error: the --name/-n argument is required unless specified with a passed in file.") if not image: raise CLIErr...
def create_container(cmd, resource_group_name, name=None, image=None, location=None, cpu=1, memory=1.5, restart_policy='Always', ports=None, ...
255
256
1,283
255
0
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
create_container
create_container
70
230
70
111
776e55b67cf62d2bfc13f1b317fae50ab4a87f33
bigcode/the-stack
train
fd8fd0e6bc7692402b3f2372
train
function
def _is_container_terminated(client, resource_group_name, name, container_name): """Check if a container should be considered terminated. """ container_group, container = _find_container(client, resource_group_name, name, container_name) # If a container group is terminated, assume the container is also te...
def _is_container_terminated(client, resource_group_name, name, container_name):
"""Check if a container should be considered terminated. """ container_group, container = _find_container(client, resource_group_name, name, container_name) # If a container group is terminated, assume the container is also terminated. if container_group.instance_view and container_group.instance_view....
if container_state == 'Running': print('\nStart streaming logs:') break time.sleep(2) _stream_logs(container_client, resource_group_name, name, container_name, container_group.restart_policy) def _is_container_terminated(client, resource_group_name, name, container_name):...
64
64
186
17
47
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_is_container_terminated
_is_container_terminated
829
847
829
829
f19ce049afc12cf3e73367afeecf366d234e7b68
bigcode/the-stack
train
8422ab29e5b17289b8486264
train
function
def _create_update_from_file(cli_ctx, resource_group_name, name, location, file, no_wait): resource_client = cf_resource(cli_ctx) container_group_client = cf_container_groups(cli_ctx) cg_defintion = None try: with open(file, 'r') as f: cg_defintion = yaml.safe_load(f) except OSE...
def _create_update_from_file(cli_ctx, resource_group_name, name, location, file, no_wait):
resource_client = cf_resource(cli_ctx) container_group_client = cf_container_groups(cli_ctx) cg_defintion = None try: with open(file, 'r') as f: cg_defintion = yaml.safe_load(f) except OSError: # FileNotFoundError introduced in Python 3 raise CLIError("No such file or d...
_keys_client.get_shared_keys( parse_resource_id(workspace.id)['resource_group'], workspace.name) log_analytics = LogAnalytics( workspace_id=workspace.customer_id, workspace_key=keys.primary_shared_key) diagnostics = ContainerGroupDiagnostics( log...
112
112
374
22
89
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_update_from_file
_create_update_from_file
376
416
376
376
dd76dab7079c1d8f951d6573e07737d2d28c3ecf
bigcode/the-stack
train
9121e0466a8f74189f80d29b
train
function
def _get_diagnostics_from_workspace(cli_ctx, log_analytics_workspace): from msrestazure.tools import parse_resource_id log_analytics_workspace_client = cf_log_analytics_workspace(cli_ctx) log_analytics_workspace_shared_keys_client = cf_log_analytics_workspace_shared_keys(cli_ctx) for workspace in log_a...
def _get_diagnostics_from_workspace(cli_ctx, log_analytics_workspace):
from msrestazure.tools import parse_resource_id log_analytics_workspace_client = cf_log_analytics_workspace(cli_ctx) log_analytics_workspace_shared_keys_client = cf_log_analytics_workspace_shared_keys(cli_ctx) for workspace in log_analytics_workspace_client.list(): if log_analytics_workspace in...
network profile "%s" in resource group "%s"', default_network_profile_name, resource_group_name) network_profile = ncf.network_profiles.create_or_update(resource_group_name, default_network_profile_name, network_profile) return network_profile.id def _get_diagnostics_from_workspace(cli_ctx, log_analytics_work...
64
64
173
15
48
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_get_diagnostics_from_workspace
_get_diagnostics_from_workspace
354
372
354
354
4591ec1f73df92c4d246f7dd972c5c4d5e159f16
bigcode/the-stack
train
b393f30d98898ef3c14909f0
train
function
def _create_azure_file_volume(azure_file_volume_share_name, azure_file_volume_account_name, azure_file_volume_account_key): """Create Azure File volume. """ azure_file_volume = None if azure_file_volume_share_name: if not azure_file_volume_account_name: raise CLIError('Please specify --a...
def _create_azure_file_volume(azure_file_volume_share_name, azure_file_volume_account_name, azure_file_volume_account_key):
"""Create Azure File volume. """ azure_file_volume = None if azure_file_volume_share_name: if not azure_file_volume_account_name: raise CLIError('Please specify --azure-file-volume-account-name in order to use Azure File volume.') if not azure_file_volume_account_key: ...
_username, password=registry_password)] else: raise CLIError('Failed to parse login server from image name; please explicitly specify --registry-server.') return image_registry_credentials def _create_azure_file_volume(azure_file...
64
64
201
26
37
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_azure_file_volume
_create_azure_file_volume
471
487
471
471
e5794104d164b5a56cbdb37b1b23b6f75bd2c05d
bigcode/the-stack
train
62a8fdb579fbfd958b333051
train
function
def _create_gitrepo_volume_mount(gitrepo_volume, gitrepo_mount_path): """Create Git Repo volume mount. """ if gitrepo_mount_path: if not gitrepo_volume: raise CLIError('Please specify --gitrepo-url (--gitrepo-dir --gitrepo-revision) ' 'to enable Git Repo volume mou...
def _create_gitrepo_volume_mount(gitrepo_volume, gitrepo_mount_path):
"""Create Git Repo volume mount. """ if gitrepo_mount_path: if not gitrepo_volume: raise CLIError('Please specify --gitrepo-url (--gitrepo-dir --gitrepo-revision) ' 'to enable Git Repo volume mount.') return VolumeMount(name=GITREPO_VOLUME_NAME, mount_path=...
: raise CLIError('Please specify --secrets --secrets-mount-path ' 'to enable secrets volume mount.') return VolumeMount(name=SECRETS_VOLUME_NAME, mount_path=secrets_mount_path) def _create_gitrepo_volume_mount(gitrepo_volume, gitrepo_mount_path):
64
64
93
18
46
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_gitrepo_volume_mount
_create_gitrepo_volume_mount
521
527
521
521
6c9c32f90486e1038b14eeca5d2a285ddce3725b
bigcode/the-stack
train
e00798bc1adec099624d6a57
train
function
def _create_azure_file_volume_mount(azure_file_volume, azure_file_volume_mount_path): """Create Azure File volume mount. """ if azure_file_volume_mount_path: if not azure_file_volume: raise CLIError('Please specify --azure-file-volume-share-name --azure-file-volume-account-name --azure-file-...
def _create_azure_file_volume_mount(azure_file_volume, azure_file_volume_mount_path):
"""Create Azure File volume mount. """ if azure_file_volume_mount_path: if not azure_file_volume: raise CLIError('Please specify --azure-file-volume-share-name --azure-file-volume-account-name --azure-file-volume-account-key ' 'to enable Azure File volume mount.') ...
repo_dir, revision=gitrepo_revision) return Volume(name=GITREPO_VOLUME_NAME, git_repo=gitrepo_volume) if gitrepo_url else None # pylint: disable=inconsistent-return-statements def _create_azure_file_volume_mount(azure_file_volume, azure_file_volume_mount_path):
64
64
99
19
44
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_azure_file_volume_mount
_create_azure_file_volume_mount
503
509
503
503
ff4814d82faae27065026d7d25e5301811f3f2df
bigcode/the-stack
train
2f37f92537607540df4c4d84
train
function
def attach_to_container(cmd, resource_group_name, name, container_name=None): """Attach to a container. """ container_client = cf_container(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) container_group = container_group_client.get(resource_group_name, name) # If container n...
def attach_to_container(cmd, resource_group_name, name, container_name=None):
"""Attach to a container. """ container_client = cf_container(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) container_group = container_group_client.get(resource_group_name, name) # If container name is not present, use the first container. if container_name is None: ...
_windows(): while not msvcrt.kbhit(): time.sleep(0.01) return msvcrt.getch() def _getch_linux(): ch = sys.stdin.read(1) return ch.encode() def attach_to_container(cmd, resource_group_name, name, container_name=None):
64
64
167
16
48
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
attach_to_container
attach_to_container
738
753
738
738
4ea56e662715aef3a718cf389f03a18b0cab8c13
bigcode/the-stack
train
eba6591472d0d3b43629d304
train
function
def _build_identities_info(identities): identities = identities or [] identity_type = ResourceIdentityType.none if not identities or MSI_LOCAL_ID in identities: identity_type = ResourceIdentityType.system_assigned external_identities = [x for x in identities if x != MSI_LOCAL_ID] if external...
def _build_identities_info(identities):
identities = identities or [] identity_type = ResourceIdentityType.none if not identities or MSI_LOCAL_ID in identities: identity_type = ResourceIdentityType.system_assigned external_identities = [x for x in identities if x != MSI_LOCAL_ID] if external_identities and identity_type == Resourc...
identity_scope: from azure.cli.core.commands.arm import assign_identity cg = container_group_client.get(resource_group_name, name) assign_identity(cmd.cli_ctx, lambda: cg, lambda cg: cg, identity_role, identity_scope) return lro def _build_identities_info(identities):
64
64
152
10
53
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_build_identities_info
_build_identities_info
233
246
233
233
87f633a50154a879c9d7e8381cf4bc8d9d2306cf
bigcode/the-stack
train
bff4bf20ca6a97af8a77972f
train
function
def _create_gitrepo_volume(gitrepo_url, gitrepo_dir, gitrepo_revision): """Create Git Repo volume. """ gitrepo_volume = GitRepoVolume(repository=gitrepo_url, directory=gitrepo_dir, revision=gitrepo_revision) return Volume(name=GITREPO_VOLUME_NAME, git_repo=gitrepo_volume) if gitrepo_url else None
def _create_gitrepo_volume(gitrepo_url, gitrepo_dir, gitrepo_revision):
"""Create Git Repo volume. """ gitrepo_volume = GitRepoVolume(repository=gitrepo_url, directory=gitrepo_dir, revision=gitrepo_revision) return Volume(name=GITREPO_VOLUME_NAME, git_repo=gitrepo_volume) if gitrepo_url else None
if azure_file_volume else None def _create_secrets_volume(secrets): """Create secrets volume. """ return Volume(name=SECRETS_VOLUME_NAME, secret=secrets) if secrets else None def _create_gitrepo_volume(gitrepo_url, gitrepo_dir, gitrepo_revision):
64
64
80
20
43
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_gitrepo_volume
_create_gitrepo_volume
495
499
495
495
56ed9810696d3068319539ecc69d9c33f63c4c0d
bigcode/the-stack
train
72286d3c9a6e4537b25621b5
train
function
def _find_container(client, resource_group_name, name, container_name): """Find a container in a container group. """ container_group = client.get(resource_group_name, name) containers = [c for c in container_group.containers if c.name == container_name] if len(containers) != 1: raise CLIError(...
def _find_container(client, resource_group_name, name, container_name):
"""Find a container in a container group. """ container_group = client.get(resource_group_name, name) containers = [c for c in container_group.containers if c.name == container_name] if len(containers) != 1: raise CLIError("Found 0 or more than 1 container with name '{}'".format(container_name)...
return False # Only assume the container is terminated if its state is Terminated. if container.instance_view and container.instance_view.current_state and container.instance_view.current_state.state == 'Terminated': return True return False def _find_container(client, resource_group_name, name, ...
64
64
98
15
48
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_find_container
_find_container
850
858
850
850
196e98afb72700a0236ec9e8b7187ab1dbf2e594
bigcode/the-stack
train
75f847855a2216093cf18af6
train
function
def container_export(cmd, resource_group_name, name, file): resource_client = cf_resource(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) resource = resource_client.resources.get(resource_group_name, "Microsoft.ContainerInstance", ...
def container_export(cmd, resource_group_name, name, file):
resource_client = cf_resource(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) resource = resource_client.resources.get(resource_group_name, "Microsoft.ContainerInstance", '', ...
container_client.list_logs(resource_group_name, name, container_name) print(log.content) else: _start_streaming( terminate_condition=_is_container_terminated, terminate_condition_args=(container_group_client, resource_group_name, name, container_name), shupdown_g...
105
105
351
13
92
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
container_export
container_export
564
603
564
564
893780d789393206347065f937a4462164381294
bigcode/the-stack
train
81e7ee613b6c90465c528ca4
train
function
def _create_image_registry_credentials(registry_login_server, registry_username, registry_password, image): """Create image registry credentials. """ image_registry_credentials = None if registry_login_server: if not registry_username: raise CLIError('Please specify --registry-username i...
def _create_image_registry_credentials(registry_login_server, registry_username, registry_password, image):
"""Create image registry credentials. """ image_registry_credentials = None if registry_login_server: if not registry_username: raise CLIError('Please specify --registry-username in order to use custom image registry.') if not registry_password: try: r...
_create_or_update, resource_group_name, "Microsoft.ContainerInstance", '', "containerGroups", name, api_version, cg_defintion) # pylint: disable=inconsistent...
116
116
388
19
97
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_image_registry_credentials
_create_image_registry_credentials
427
468
427
427
05e4c764c602cab8d278f527ff4ee612c5d8be04
bigcode/the-stack
train
3c72a8c02d5a8561498de82f
train
function
def _capture_stdin(getch_func, buff, lock): # this method will fill up the buffer from one thread (using the lock) while True: try: x = getch_func() lock.acquire() buff.extend(x) lock.release() finally: if lock.locked(): ...
def _capture_stdin(getch_func, buff, lock): # this method will fill up the buffer from one thread (using the lock)
while True: try: x = getch_func() lock.acquire() buff.extend(x) lock.release() finally: if lock.locked(): lock.release()
def _on_ws_msg(ws, msg): if isinstance(msg, str): msg = msg.encode() sys.stdout.buffer.write(msg) sys.stdout.flush() def _capture_stdin(getch_func, buff, lock): # this method will fill up the buffer from one thread (using the lock)
64
64
70
30
34
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_capture_stdin
_capture_stdin
688
698
688
689
e5c595cd08623ad1760f6791bb59f37765d88d28
bigcode/the-stack
train
19199a568016b4eac5c5f1ec
train
function
def delete_container(client, resource_group_name, name, **kwargs): """Delete a container group. """ return client.delete(resource_group_name, name)
def delete_container(client, resource_group_name, name, **kwargs):
"""Delete a container group. """ return client.delete(resource_group_name, name)
is None: return client.list() return client.list_by_resource_group(resource_group_name) def get_container(client, resource_group_name, name): """Show details of a container group. """ return client.get(resource_group_name, name) def delete_container(client, resource_group_name, name, **kwargs):
64
64
32
14
50
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
delete_container
delete_container
64
66
64
64
335c1babbfec81050a46bc3f338a93ba3ad4c6fc
bigcode/the-stack
train
86197085bbeea53a928b956c
train
function
def _flush_stdin(ws, buff, lock): # this method will flush the buffer out to the websocket (using the lock) while True: time.sleep(0.01) try: if len(buff) == 0: continue lock.acquire() x = bytes(buff) buff.clear() lock.r...
def _flush_stdin(ws, buff, lock): # this method will flush the buffer out to the websocket (using the lock)
while True: time.sleep(0.01) try: if len(buff) == 0: continue lock.acquire() x = bytes(buff) buff.clear() lock.release() ws.send(x, opcode=0x2) # OPCODE_BINARY = 0x2 except (OSError, IOError, websocket.W...
try: x = getch_func() lock.acquire() buff.extend(x) lock.release() finally: if lock.locked(): lock.release() def _flush_stdin(ws, buff, lock): # this method will flush the buffer out to the websocket (using the lock)
64
64
190
28
36
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_flush_stdin
_flush_stdin
701
724
701
702
79cd3f2071b12de41494a60295dafefa303f6e08
bigcode/the-stack
train
5a222bc31ffaba1bb7d824f5
train
function
def _getch_linux(): ch = sys.stdin.read(1) return ch.encode()
def _getch_linux():
ch = sys.stdin.read(1) return ch.encode()
.EINTR: pass else: raise finally: if lock.locked(): lock.release() def _getch_windows(): while not msvcrt.kbhit(): time.sleep(0.01) return msvcrt.getch() def _getch_linux():
64
64
20
6
58
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_getch_linux
_getch_linux
733
735
733
733
1088a25ffba813c2867cecf82df57bb8d605f74d
bigcode/the-stack
train
467b8c25c0a237ee573c6f8f
train
function
def _gen_guid(): import uuid return uuid.uuid4()
def _gen_guid():
import uuid return uuid.uuid4()
_group, containers[0] def _move_console_cursor_up(lines): """Move console cursor up. """ if lines > 0: # Use stdout.write to support Python 2 sys.stdout.write('\033[{}A\033[K\033[J'.format(lines)) def _gen_guid():
64
64
15
5
59
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_gen_guid
_gen_guid
868
870
868
868
03f8eb8c28cdd12a58ef28e032ed7a53717bc5d9
bigcode/the-stack
train
df309b1796ba94fb2f91b86d
train
function
def container_exec(cmd, resource_group_name, name, exec_command, container_name=None): """Start exec for a container. """ container_client = cf_container(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) container_group = container_group_client.get(resource_group_name, name) i...
def container_exec(cmd, resource_group_name, name, exec_command, container_name=None):
"""Start exec for a container. """ container_client = cf_container(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) container_group = container_group_client.get(resource_group_name, name) if container_name or container_name is None and len(container_group.containers) == 1: ...
properties'].pop('instanceView', None) # Add the api version resource['apiVersion'] = container_group_client.api_version with open(file, 'w+') as f: yaml.safe_dump(resource, f, default_flow_style=False) def container_exec(cmd, resource_group_name, name, exec_command, container_name=None):
71
71
239
18
53
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
container_exec
container_exec
606
629
606
606
f3e26cc59d00485a8b00d2513c189a7235f5a164
bigcode/the-stack
train
49a72f456f475845b69c885e
train
function
def list_containers(client, resource_group_name=None): """List all container groups in a resource group. """ if resource_group_name is None: return client.list() return client.list_by_resource_group(resource_group_name)
def list_containers(client, resource_group_name=None):
"""List all container groups in a resource group. """ if resource_group_name is None: return client.list() return client.list_by_resource_group(resource_group_name)
'.' ACR_SERVER_DELIMITER = '.azurecr.io' AZURE_FILE_VOLUME_NAME = 'azurefile' SECRETS_VOLUME_NAME = 'secrets' GITREPO_VOLUME_NAME = 'gitrepo' MSI_LOCAL_ID = '[system]' def list_containers(client, resource_group_name=None):
63
64
47
11
52
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
list_containers
list_containers
52
56
52
52
bc3fc42b4255d7777648d5e37da6eb9f5d136914
bigcode/the-stack
train
a2a7bcf4d53e2fd85f7f9ba8
train
function
def _start_exec_pipe_linux(web_socket_uri, password): stdin_fd = sys.stdin.fileno() old_tty = termios.tcgetattr(stdin_fd) old_winch_handler = signal.getsignal(signal.SIGWINCH) tty.setraw(stdin_fd) tty.setcbreak(stdin_fd) buff = bytearray() lock = threading.Lock() def _on_ws_open_linux(w...
def _start_exec_pipe_linux(web_socket_uri, password):
stdin_fd = sys.stdin.fileno() old_tty = termios.tcgetattr(stdin_fd) old_winch_handler = signal.getsignal(signal.SIGWINCH) tty.setraw(stdin_fd) tty.setcbreak(stdin_fd) buff = bytearray() lock = threading.Lock() def _on_ws_open_linux(ws): ws.send(password) readKeyboard = t...
.is_alive(): try: time.sleep(0.01) except KeyboardInterrupt: try: ws.send(b'\x03') # CTRL-C character (ETX character) finally: pass colorama.reinit() def _start_exec_pipe_linux(web_socket_uri, password):
64
64
215
12
52
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_start_exec_pipe_linux
_start_exec_pipe_linux
660
678
660
660
ea94faae465aa189ef5c81d804cfe3f2020477c2
bigcode/the-stack
train
9be6cfe019d44ba05e8f3e56
train
function
def container_logs(cmd, resource_group_name, name, container_name=None, follow=False): """Tail a container instance log. """ container_client = cf_container(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) container_group = container_group_client.get(resource_group_name, name) ...
def container_logs(cmd, resource_group_name, name, container_name=None, follow=False):
"""Tail a container instance log. """ container_client = cf_container(cmd.cli_ctx) container_group_client = cf_container_groups(cmd.cli_ctx) container_group = container_group_client.get(resource_group_name, name) # If container name is not present, use the first container. if container_name is ...
) if network_profile: return IpAddress(ports=[Port(protocol=protocol, port=p) for p in ports], type=ContainerGroupIpAddressType.private) # pylint: disable=inconsistent-return-statements def container_logs(cmd, resource_group_name, name, container_name=None, follow=False):
64
64
197
18
45
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
container_logs
container_logs
542
561
542
542
9d3ce32a3b4a7b1e90be54e5c63c49abd5ba61e4
bigcode/the-stack
train
d79c5831f007a4ca6d27e9d9
train
function
def _start_exec_pipe_windows(web_socket_uri, password): import colorama colorama.deinit() enable_vt_mode() buff = bytearray() lock = threading.Lock() def _on_ws_open_windows(ws): ws.send(password) readKeyboard = threading.Thread(target=_capture_stdin, args=[_getch_windows, buff,...
def _start_exec_pipe_windows(web_socket_uri, password):
import colorama colorama.deinit() enable_vt_mode() buff = bytearray() lock = threading.Lock() def _on_ws_open_windows(ws): ws.send(password) readKeyboard = threading.Thread(target=_capture_stdin, args=[_getch_windows, buff, lock], daemon=True) readKeyboard.start() ...
: _start_exec_pipe_windows(execContainerResponse.web_socket_uri, execContainerResponse.password) else: _start_exec_pipe_linux(execContainerResponse.web_socket_uri, execContainerResponse.password) else: raise CLIError('--container-name required when container group has more t...
72
73
246
12
60
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_start_exec_pipe_windows
_start_exec_pipe_windows
632
657
632
632
b54ae98a534e7e97c756861f6a9375db00c715bb
bigcode/the-stack
train
989f9838777d3e0595e5d203
train
function
def _create_ip_address(ip_address, ports, protocol, dns_name_label, network_profile): """Create IP address. """ if (ip_address and ip_address.lower() == 'public') or dns_name_label: return IpAddress(ports=[Port(protocol=protocol, port=p) for p in ports], dns_name_label=dns_name_...
def _create_ip_address(ip_address, ports, protocol, dns_name_label, network_profile):
"""Create IP address. """ if (ip_address and ip_address.lower() == 'public') or dns_name_label: return IpAddress(ports=[Port(protocol=protocol, port=p) for p in ports], dns_name_label=dns_name_label, type=ContainerGroupIpAddressType.public) if network_profile: return...
repo-revision) ' 'to enable Git Repo volume mount.') return VolumeMount(name=GITREPO_VOLUME_NAME, mount_path=gitrepo_mount_path) # pylint: disable=inconsistent-return-statements def _create_ip_address(ip_address, ports, protocol, dns_name_label, network_profile):
64
64
118
19
44
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_create_ip_address
_create_ip_address
531
538
531
531
0a1bdc49c2e64b3f7230391300dbb622fded84cf
bigcode/the-stack
train
b0a9bb027785e1ae20500858
train
function
def _stream_logs(client, resource_group_name, name, container_name, restart_policy): """Stream logs for a container. """ lastOutputLines = 0 while True: log = client.list_logs(resource_group_name, name, container_name) lines = log.content.split('\n') currentOutputLines = len(lines) ...
def _stream_logs(client, resource_group_name, name, container_name, restart_policy):
"""Stream logs for a container. """ lastOutputLines = 0 while True: log = client.list_logs(resource_group_name, name, container_name) lines = log.content.split('\n') currentOutputLines = len(lines) # Should only happen when the container restarts. if currentOutputLin...
True t.start() while not terminate_condition(*terminate_condition_args) and t.is_alive(): time.sleep(10) time.sleep(shupdown_grace_period) finally: colorama.deinit() def _stream_logs(client, resource_group_name, name, container_name, restart_policy):
64
64
172
18
46
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_stream_logs
_stream_logs
775
792
775
775
3abd171dec4008edcb4b3220da365d21f8e26d65
bigcode/the-stack
train
685799e420d75f03cc62ba53
train
function
def _on_ws_msg(ws, msg): if isinstance(msg, str): msg = msg.encode() sys.stdout.buffer.write(msg) sys.stdout.flush()
def _on_ws_msg(ws, msg):
if isinstance(msg, str): msg = msg.encode() sys.stdout.buffer.write(msg) sys.stdout.flush()
on_open=_on_ws_open_linux, on_message=_on_ws_msg) ws.run_forever() termios.tcsetattr(stdin_fd, termios.TCSADRAIN, old_tty) signal.signal(signal.SIGWINCH, old_winch_handler) def _on_ws_msg(ws, msg):
64
64
34
9
55
guilhem/azure-cli
src/azure-cli/azure/cli/command_modules/container/custom.py
Python
_on_ws_msg
_on_ws_msg
681
685
681
681
9a8665ad947e7a4995bf120eb6a462865f9b1d23
bigcode/the-stack
train
e559b88e7b4a291e886308bd
train
function
def anharmonic_zpve(zpve): """ write the anharmonic ZPVE (hartree) to a string (hartree) """ anh_zpve_str = _float(zpve) return anh_zpve_str
def anharmonic_zpve(zpve):
""" write the anharmonic ZPVE (hartree) to a string (hartree) """ anh_zpve_str = _float(zpve) return anh_zpve_str
) return _frequencies(freqs) def projected_frequencies(freq): """ write projected frequencies (cm^-1) to a string (cm^-1) """ assert list(freq) == sorted(freq) return _frequencies(freq) def anharmonic_zpve(zpve):
64
64
55
11
53
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
anharmonic_zpve
anharmonic_zpve
111
115
111
111
f9258fae96e5d2bf3417ceb746d3631663821ee2
bigcode/the-stack
train
9c1e21f540fd2fe3cf6c20b2
train
function
def gradient_array(ndarray): """ transform numpy array into python list """ out = ndarray if isinstance(out, numpy.ndarray): out = ndarray.tolist() return out
def gradient_array(ndarray):
""" transform numpy array into python list """ out = ndarray if isinstance(out, numpy.ndarray): out = ndarray.tolist() return out
to a string """ tra_str = automol.graph.trans.string(tra) return tra_str def transformation_old(tra): """ write a chemical transformation to a string """ tra_str = automol.graph.trans.string(tra) return tra_str def gradient_array(ndarray):
64
64
40
6
57
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
gradient_array
gradient_array
234
240
234
234
7711caf882cfd0350dcdeae52a36ef46362371a0
bigcode/the-stack
train
cb3a095793bf89f3e5172c62
train
function
def transformation_old(tra): """ write a chemical transformation to a string """ tra_str = automol.graph.trans.string(tra) return tra_str
def transformation_old(tra):
""" write a chemical transformation to a string """ tra_str = automol.graph.trans.string(tra) return tra_str
molecular graph to a string """ gra_str = automol.graph.string(gra) return gra_str def transformation(tra): """ write a chemical transformation to a string """ tra_str = automol.graph.trans.string(tra) return tra_str def transformation_old(tra):
64
64
35
6
57
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
transformation_old
transformation_old
227
231
227
227
239b992f6e71ef26f96e4c79cab333ad0547ecb3
bigcode/the-stack
train
074e46488d8aaa223ca6d657
train
function
def hessian(hess): """ write a hessian (hartree bohr^-2) to a string (hartree bohr^-2) """ hess = numpy.array(hess) assert hess.ndim == 2 assert hess.shape[0] % 3 == 0 and hess.shape[0] == hess.shape[1] hess_str_io = _StringIO() numpy.savetxt(hess_str_io, hess) hess_str = hess_str_io.ge...
def hessian(hess):
""" write a hessian (hartree bohr^-2) to a string (hartree bohr^-2) """ hess = numpy.array(hess) assert hess.ndim == 2 assert hess.shape[0] % 3 == 0 and hess.shape[0] == hess.shape[1] hess_str_io = _StringIO() numpy.savetxt(hess_str_io, hess) hess_str = hess_str_io.getvalue() hess_s...
grad.ndim == 2 and grad.shape[1] == 3 grad_str_io = _StringIO() numpy.savetxt(grad_str_io, grad) grad_str = grad_str_io.getvalue() grad_str_io.close() return grad_str def hessian(hess):
64
64
128
6
57
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
hessian
hessian
76
87
76
76
728d906609b48f0026e3adfc3c3dcd29ba7201af
bigcode/the-stack
train
bc6c586f6d1c217d56897835
train
function
def transformation(tra): """ write a chemical transformation to a string """ tra_str = automol.graph.trans.string(tra) return tra_str
def transformation(tra):
""" write a chemical transformation to a string """ tra_str = automol.graph.trans.string(tra) return tra_str
_str_io, polar) polar_str = polar_str_io.getvalue() polar_str_io.close() return polar_str def graph(gra): """ write a molecular graph to a string """ gra_str = automol.graph.string(gra) return gra_str def transformation(tra):
64
64
34
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
transformation
transformation
220
224
220
220
02bf136f6d4ff26ce31a729aa127ad1ed57280d5
bigcode/the-stack
train
ae7671b3eda840c393c7fa5d
train
function
def internal_symmetry_factor(isf): """ write an internal symmetry factor to a string """ isf_str = _float(isf) return isf_str
def internal_symmetry_factor(isf):
""" write an internal symmetry factor to a string """ isf_str = _float(isf) return isf_str
to a string (angstrom) """ sig_str = _float(sig) return sig_str def external_symmetry_factor(esf): """ write an external symmetry factor to a string """ esf_str = _float(esf) return esf_str def internal_symmetry_factor(isf):
64
64
37
8
55
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
internal_symmetry_factor
internal_symmetry_factor
178
182
178
178
b4b56d5bb06a0134a5d73e3d86db84556298401b
bigcode/the-stack
train
73030d3509427f6600607fb0
train
function
def vibro_rot_alpha_matrix(vibro_rot_mat): """ write vibro-rot alph matrix (cm^-1) to a string (cm^-1) """ vibro_rot_mat = numpy.array(vibro_rot_mat) assert vibro_rot_mat.ndim == 2 mat_str_io = _StringIO() numpy.savetxt(mat_str_io, vibro_rot_mat) mat_str = mat_str_io.getvalue() mat_str_...
def vibro_rot_alpha_matrix(vibro_rot_mat):
""" write vibro-rot alph matrix (cm^-1) to a string (cm^-1) """ vibro_rot_mat = numpy.array(vibro_rot_mat) assert vibro_rot_mat.ndim == 2 mat_str_io = _StringIO() numpy.savetxt(mat_str_io, vibro_rot_mat) mat_str = mat_str_io.getvalue() mat_str_io.close() return mat_str
mat.shape[0] == mat.shape[1] mat_str_io = _StringIO() numpy.savetxt(mat_str_io, mat) mat_str = mat_str_io.getvalue() mat_str_io.close() return mat_str def vibro_rot_alpha_matrix(vibro_rot_mat):
64
64
106
12
51
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
vibro_rot_alpha_matrix
vibro_rot_alpha_matrix
133
143
133
133
7852d9091793d86f53d37f4fef0712449642974b
bigcode/the-stack
train
96d396c8dcf345d12a5e1ffa
train
function
def vmatrix(vma): """ write a variable zmatrix (bohr/radian) to a string (angstroms/degree) """ assert automol.vmatrix.is_valid(vma) vma_str = automol.vmatrix.string(vma) return vma_str
def vmatrix(vma):
""" write a variable zmatrix (bohr/radian) to a string (angstroms/degree) """ assert automol.vmatrix.is_valid(vma) vma_str = automol.vmatrix.string(vma) return vma_str
zmatrix(zma): """ write a zmatrix (bohr/radian) to a string (angstroms/degree) """ assert automol.zmatrix.is_valid(zma) zma_str = automol.zmatrix.string(zma) return zma_str def vmatrix(vma):
64
64
60
6
57
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
vmatrix
vmatrix
55
60
55
55
d24b8c73f3bbf79f08963640d9ae447b3c68d2fa
bigcode/the-stack
train
7329f7bad61fed255d7c9412
train
function
def quartic_centrifugal_dist_consts(qcd_consts): """ write the quartic centrifugal distortion constant labels and values (cm^-1) to a string (cm^-1) """ qcd_consts_str = '' for const in qcd_consts: qcd_consts_str += "{0:<6s}{1:>16.12f}\n".format( const[0], const[1]) retur...
def quartic_centrifugal_dist_consts(qcd_consts):
""" write the quartic centrifugal distortion constant labels and values (cm^-1) to a string (cm^-1) """ qcd_consts_str = '' for const in qcd_consts: qcd_consts_str += "{0:<6s}{1:>16.12f}\n".format( const[0], const[1]) return qcd_consts_str
_mat.ndim == 2 mat_str_io = _StringIO() numpy.savetxt(mat_str_io, vibro_rot_mat) mat_str = mat_str_io.getvalue() mat_str_io.close() return mat_str def quartic_centrifugal_dist_consts(qcd_consts):
64
64
97
13
50
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
quartic_centrifugal_dist_consts
quartic_centrifugal_dist_consts
146
154
146
146
2dcd0e487d9ac6f5429be59b7194d093a6122626
bigcode/the-stack
train
4b339cbcd1d584eda9227457
train
function
def anharmonic_frequencies(freqs): """ write anharmonic frequencies (cm^-1) to a string (cm^-1) """ assert list(freqs) == sorted(freqs) return _frequencies(freqs)
def anharmonic_frequencies(freqs):
""" write anharmonic frequencies (cm^-1) to a string (cm^-1) """ assert list(freqs) == sorted(freqs) return _frequencies(freqs)
.close() return hess_str def harmonic_frequencies(freqs): """ write harmonic frequencies (cm^-1) to a string (cm^-1) """ assert list(freqs) == sorted(freqs) return _frequencies(freqs) def anharmonic_frequencies(freqs):
64
64
51
9
55
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
anharmonic_frequencies
anharmonic_frequencies
97
101
97
97
8155f9d938cb6f81d269a8e285a884fd5b955683
bigcode/the-stack
train
89b67226218148b030861080
train
function
def _float(val): assert isinstance(val, _Real) val_str = str(val) return val_str
def _float(val):
assert isinstance(val, _Real) val_str = str(val) return val_str
""" tra_str = automol.graph.trans.string(tra) return tra_str def gradient_array(ndarray): """ transform numpy array into python list """ out = ndarray if isinstance(out, numpy.ndarray): out = ndarray.tolist() return out def _float(val):
64
64
25
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
_float
_float
243
246
243
243
00ea6154b134f9ba405a88a4e927bf3fb1c1250b
bigcode/the-stack
train
74ac07c5bb7a664d2600e173
train
function
def harmonic_frequencies(freqs): """ write harmonic frequencies (cm^-1) to a string (cm^-1) """ assert list(freqs) == sorted(freqs) return _frequencies(freqs)
def harmonic_frequencies(freqs):
""" write harmonic frequencies (cm^-1) to a string (cm^-1) """ assert list(freqs) == sorted(freqs) return _frequencies(freqs)
0] == hess.shape[1] hess_str_io = _StringIO() numpy.savetxt(hess_str_io, hess) hess_str = hess_str_io.getvalue() hess_str_io.close() return hess_str def harmonic_frequencies(freqs):
64
64
47
7
56
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
harmonic_frequencies
harmonic_frequencies
90
94
90
90
bb5bbb11528fba22ac7eeac8955e14cb2a6ab1c2
bigcode/the-stack
train
239200ff6bd3de802e33c1aa
train
function
def lennard_jones_epsilon(eps): """ write a lennard-jones epsilon (waveunmbers) to a string (wavenumbers) """ eps_str = _float(eps) return eps_str
def lennard_jones_epsilon(eps):
""" write a lennard-jones epsilon (waveunmbers) to a string (wavenumbers) """ eps_str = _float(eps) return eps_str
qcd_consts_str = '' for const in qcd_consts: qcd_consts_str += "{0:<6s}{1:>16.12f}\n".format( const[0], const[1]) return qcd_consts_str def lennard_jones_epsilon(eps):
64
64
49
10
53
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
lennard_jones_epsilon
lennard_jones_epsilon
157
161
157
157
741a03d70f36f7f79298db7a50ed53f6fcaf92a5
bigcode/the-stack
train
2e88fa5df74a4cec641dbc66
train
function
def graph(gra): """ write a molecular graph to a string """ gra_str = automol.graph.string(gra) return gra_str
def graph(gra):
""" write a molecular graph to a string """ gra_str = automol.graph.string(gra) return gra_str
assert polar.shape[0] == polar.shape[1] == 3 polar_str_io = _StringIO() numpy.savetxt(polar_str_io, polar) polar_str = polar_str_io.getvalue() polar_str_io.close() return polar_str def graph(gra):
64
64
33
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
graph
graph
213
217
213
213
36082253dfccfc7001c99c516a6a0e61c4ced53e
bigcode/the-stack
train
ed676ef3a6369af52839b623
train
function
def trajectory(traj): """ write a series of geometries (bohr) to a string (angstrom) (trajectory is given by a sequence of comment-line, geometry pairs) """ comments, geo_lst = zip(*traj) assert all(isinstance(comment, str) and len(comment.splitlines()) == 1 for comment in comments) ...
def trajectory(traj):
""" write a series of geometries (bohr) to a string (angstrom) (trajectory is given by a sequence of comment-line, geometry pairs) """ comments, geo_lst = zip(*traj) assert all(isinstance(comment, str) and len(comment.splitlines()) == 1 for comment in comments) assert all(map(aut...
_float(ene) return ene_str def geometry(geo): """ write a geometry (bohr) to a string (angstrom) """ assert automol.geom.is_valid(geo) xyz_str = automol.geom.xyz_string(geo) return xyz_str def trajectory(traj):
64
64
118
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
trajectory
trajectory
33
44
33
33
28055a7b689a1833ae5aa82001d20df3cbc3735e
bigcode/the-stack
train
dcefb2ab9264b908f1793e05
train
function
def projected_frequencies(freq): """ write projected frequencies (cm^-1) to a string (cm^-1) """ assert list(freq) == sorted(freq) return _frequencies(freq)
def projected_frequencies(freq):
""" write projected frequencies (cm^-1) to a string (cm^-1) """ assert list(freq) == sorted(freq) return _frequencies(freq)
_frequencies(freqs) def anharmonic_frequencies(freqs): """ write anharmonic frequencies (cm^-1) to a string (cm^-1) """ assert list(freqs) == sorted(freqs) return _frequencies(freqs) def projected_frequencies(freq):
64
64
43
6
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
projected_frequencies
projected_frequencies
104
108
104
104
e911dfe3ef0f221f3939004798849a4c02ade02c
bigcode/the-stack
train
7cd7f31ef19b3f1b29581fa7
train
function
def anharmonicity_matrix(xmat): """ write anharmonicity matrix (cm^-1) to a string (cm^-1) """ mat = numpy.array(xmat) assert mat.ndim == 2 or mat.ndim == 0 if mat.ndim == 2: assert mat.shape[0] == mat.shape[1] mat_str_io = _StringIO() numpy.savetxt(mat_str_io, mat) mat_str = ma...
def anharmonicity_matrix(xmat):
""" write anharmonicity matrix (cm^-1) to a string (cm^-1) """ mat = numpy.array(xmat) assert mat.ndim == 2 or mat.ndim == 0 if mat.ndim == 2: assert mat.shape[0] == mat.shape[1] mat_str_io = _StringIO() numpy.savetxt(mat_str_io, mat) mat_str = mat_str_io.getvalue() mat_str_...
def anharmonic_zpve(zpve): """ write the anharmonic ZPVE (hartree) to a string (hartree) """ anh_zpve_str = _float(zpve) return anh_zpve_str def anharmonicity_matrix(xmat):
64
64
119
9
54
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
anharmonicity_matrix
anharmonicity_matrix
118
130
118
118
c0929d8bc8a3f12458321f8dc847db0f1ea8b28c
bigcode/the-stack
train
235f9cc86730394b7fa54abe
train
function
def external_symmetry_factor(esf): """ write an external symmetry factor to a string """ esf_str = _float(esf) return esf_str
def external_symmetry_factor(esf):
""" write an external symmetry factor to a string """ esf_str = _float(esf) return esf_str
""" eps_str = _float(eps) return eps_str def lennard_jones_sigma(sig): """ write a lennard-jones sigma (angstrom) to a string (angstrom) """ sig_str = _float(sig) return sig_str def external_symmetry_factor(esf):
64
64
35
8
55
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
external_symmetry_factor
external_symmetry_factor
171
175
171
171
aef6f6195bf020c9bfe7fece8a454723f8382852
bigcode/the-stack
train
0fe1d01d5b3af9e118f147ea
train
function
def _frequencies(freq): freq = numpy.array(freq) assert freq.ndim == 1 freq_str = "" for val in freq: freq_str += "{:>8.1f}\n".format(val) return freq_str
def _frequencies(freq):
freq = numpy.array(freq) assert freq.ndim == 1 freq_str = "" for val in freq: freq_str += "{:>8.1f}\n".format(val) return freq_str
transform numpy array into python list """ out = ndarray if isinstance(out, numpy.ndarray): out = ndarray.tolist() return out def _float(val): assert isinstance(val, _Real) val_str = str(val) return val_str def _frequencies(freq):
64
64
56
7
56
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
_frequencies
_frequencies
249
255
249
249
47ea16c8dcfc0d971934dbc21c3777f8fc998353
bigcode/the-stack
train
aa95503b2390f72c25ebb01e
train
function
def polarizability(polar): """ write a polarizability tensor to a string """ polar = numpy.array(polar) assert polar.ndim == 2 assert polar.shape[0] == polar.shape[1] == 3 polar_str_io = _StringIO() numpy.savetxt(polar_str_io, polar) polar_str = polar_str_io.getvalue() polar_str_io....
def polarizability(polar):
""" write a polarizability tensor to a string """ polar = numpy.array(polar) assert polar.ndim == 2 assert polar.shape[0] == polar.shape[1] == 3 polar_str_io = _StringIO() numpy.savetxt(polar_str_io, polar) polar_str = polar_str_io.getvalue() polar_str_io.close() return polar_st...
dip_mom_str_io = _StringIO() numpy.savetxt(dip_mom_str_io, dip_mom) dip_mom_str = dip_mom_str_io.getvalue() dip_mom_str_io.close() return dip_mom_str def polarizability(polar):
64
64
97
7
56
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
polarizability
polarizability
199
210
199
199
11219e9ba49c080541e82ce4fcc7bdd79d13be18
bigcode/the-stack
train
0bab29397dc027a8a5cfdd1f
train
function
def geometry(geo): """ write a geometry (bohr) to a string (angstrom) """ assert automol.geom.is_valid(geo) xyz_str = automol.geom.xyz_string(geo) return xyz_str
def geometry(geo):
""" write a geometry (bohr) to a string (angstrom) """ assert automol.geom.is_valid(geo) xyz_str = automol.geom.xyz_string(geo) return xyz_str
autofile.info.Info) inf_str = autofile.info.string(inf_obj) return inf_str def energy(ene): """ write an energy (hartree) to a string (hartree) """ ene_str = _float(ene) return ene_str def geometry(geo):
64
64
49
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
geometry
geometry
25
30
25
25
3c58fe43a830536a7cc67e8af8afdfc59d41cc8d
bigcode/the-stack
train
53540b140b135981a8341949
train
function
def gradient(grad): """ write a gradient (hartree bohr^-1) to a string (hartree bohr^-1) """ grad = numpy.array(grad) assert grad.ndim == 2 and grad.shape[1] == 3 grad_str_io = _StringIO() numpy.savetxt(grad_str_io, grad) grad_str = grad_str_io.getvalue() grad_str_io.close() return ...
def gradient(grad):
""" write a gradient (hartree bohr^-1) to a string (hartree bohr^-1) """ grad = numpy.array(grad) assert grad.ndim == 2 and grad.shape[1] == 3 grad_str_io = _StringIO() numpy.savetxt(grad_str_io, grad) grad_str = grad_str_io.getvalue() grad_str_io.close() return grad_str
vmatrix(vma): """ write a variable zmatrix (bohr/radian) to a string (angstroms/degree) """ assert automol.vmatrix.is_valid(vma) vma_str = automol.vmatrix.string(vma) return vma_str def gradient(grad):
64
64
99
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
gradient
gradient
63
73
63
63
467bc72714b589ccc0861a19980ff3ae486fa5ca
bigcode/the-stack
train
3b2e8e2e7aaad9121ff79b1b
train
function
def zmatrix(zma): """ write a zmatrix (bohr/radian) to a string (angstroms/degree) """ assert automol.zmatrix.is_valid(zma) zma_str = automol.zmatrix.string(zma) return zma_str
def zmatrix(zma):
""" write a zmatrix (bohr/radian) to a string (angstroms/degree) """ assert automol.zmatrix.is_valid(zma) zma_str = automol.zmatrix.string(zma) return zma_str
len(comment.splitlines()) == 1 for comment in comments) assert all(map(automol.geom.is_valid, geo_lst)) xyz_traj_str = automol.geom.xyz_trajectory_string(geo_lst, comments=comments) return xyz_traj_str def zmatrix(zma):
64
64
59
6
57
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
zmatrix
zmatrix
47
52
47
47
0dd9c5c9e55bbe4eb367f167e6338579d60ccbdf
bigcode/the-stack
train
e3eafc9153c5c76f5e4f837d
train
function
def lennard_jones_sigma(sig): """ write a lennard-jones sigma (angstrom) to a string (angstrom) """ sig_str = _float(sig) return sig_str
def lennard_jones_sigma(sig):
""" write a lennard-jones sigma (angstrom) to a string (angstrom) """ sig_str = _float(sig) return sig_str
return qcd_consts_str def lennard_jones_epsilon(eps): """ write a lennard-jones epsilon (waveunmbers) to a string (wavenumbers) """ eps_str = _float(eps) return eps_str def lennard_jones_sigma(sig):
64
64
41
8
55
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
lennard_jones_sigma
lennard_jones_sigma
164
168
164
164
dc53155ac042b0dfa328ad05722c74517fe3b89b
bigcode/the-stack
train
bb8ef8fd48e9e0d22f136fc3
train
function
def energy(ene): """ write an energy (hartree) to a string (hartree) """ ene_str = _float(ene) return ene_str
def energy(ene):
""" write an energy (hartree) to a string (hartree) """ ene_str = _float(ene) return ene_str
automol import autofile.info def information(inf_obj): """ write information (any dict/list combination) to a string """ assert isinstance(inf_obj, autofile.info.Info) inf_str = autofile.info.string(inf_obj) return inf_str def energy(ene):
64
64
37
5
58
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
energy
energy
18
22
18
18
42b0bba82ed173cc317996bb7285bc964ff8a810
bigcode/the-stack
train
85cb7349c54db2ab518c0673
train
function
def dipole_moment(dip_mom): """ write a dipole moment vector to a string """ dip_mom = numpy.array(dip_mom) assert dip_mom.ndim == 1 assert dip_mom.shape[0] == 3 dip_mom_str_io = _StringIO() numpy.savetxt(dip_mom_str_io, dip_mom) dip_mom_str = dip_mom_str_io.getvalue() dip_mom_str_i...
def dipole_moment(dip_mom):
""" write a dipole moment vector to a string """ dip_mom = numpy.array(dip_mom) assert dip_mom.ndim == 1 assert dip_mom.shape[0] == 3 dip_mom_str_io = _StringIO() numpy.savetxt(dip_mom_str_io, dip_mom) dip_mom_str = dip_mom_str_io.getvalue() dip_mom_str_io.close() return dip_mom...
""" esf_str = _float(esf) return esf_str def internal_symmetry_factor(isf): """ write an internal symmetry factor to a string """ isf_str = _float(isf) return isf_str def dipole_moment(dip_mom):
64
64
116
10
53
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
dipole_moment
dipole_moment
185
196
185
185
e68ab636f3865febd9bf994022c1cbd83b07e8e7
bigcode/the-stack
train
bb7489e784831df2555f51b5
train
function
def information(inf_obj): """ write information (any dict/list combination) to a string """ assert isinstance(inf_obj, autofile.info.Info) inf_str = autofile.info.string(inf_obj) return inf_str
def information(inf_obj):
""" write information (any dict/list combination) to a string """ assert isinstance(inf_obj, autofile.info.Info) inf_str = autofile.info.string(inf_obj) return inf_str
""" string writers """ from io import StringIO as _StringIO from numbers import Real as _Real import numpy import automol import autofile.info def information(inf_obj):
41
64
51
6
34
kevinmooreiii/autofile
autofile/data_types/swrite.py
Python
information
information
10
15
10
10
49e435c503f337194f3f948d9b92a1408f4b0cc4
bigcode/the-stack
train
f4d409ab532e5ee12a3bf4a8
train
function
def hamming_weigth(n: int) -> int: """ 一个数n和它-1做与运算,就相当于干掉了最右边的1. """ bits = 0 while n: bits += 1 n = (n-1) & n return bits
def hamming_weigth(n: int) -> int:
""" 一个数n和它-1做与运算,就相当于干掉了最右边的1. """ bits = 0 while n: bits += 1 n = (n-1) & n return bits
""" 二进制中1的个数 >>> hamming_weigth(11) 3 >>> all(bin(n).count('1')==hamming_weigth(n) for n in range(30)) True """ def hamming_weigth(n: int) -> int:
64
64
71
12
52
ck76/awesome-cs
Algorithm/coding_interviews/Python/sword-for-offer/15_count_one_in_bits.py
Python
hamming_weigth
hamming_weigth
16
24
16
16
c805e2807245232a290c89bd24c9c048432d4b48
bigcode/the-stack
train
da97ecdc12c5e1a855580828
train
function
@when('I delete the contact from the list') def delete_contact(app, random_contact): app.contact.delete_contact_by_id(random_contact.id)
@when('I delete the contact from the list') def delete_contact(app, random_contact):
app.contact.delete_contact_by_id(random_contact.id)
(Contact(firstname="New contact")) return db.get_contact_list() @given('a random contact from the list') def random_contact(non_empty_contact_list): return random.choice(non_empty_contact_list) # Delete contact @when('I delete the contact from the list') def delete_contact(app, random_contact):
64
64
30
19
44
elaginm/python_training
bdd/contact_steps.py
Python
delete_contact
delete_contact
47
49
47
48
f13264e2a631c7103cbb93ee2ac026f9e1fe1d51
bigcode/the-stack
train
86ebb1efd74da6cc721708c9
train
function
@then('the new contact list is equal to the old list without the deleted contact') def verify_contact_deleted(db, non_empty_contact_list, random_contact, app, check_ui): old_contacts = non_empty_contact_list new_contacts = db.get_contact_list() assert len(old_contacts) - 1 == len(new_contacts) old_conta...
@then('the new contact list is equal to the old list without the deleted contact') def verify_contact_deleted(db, non_empty_contact_list, random_contact, app, check_ui):
old_contacts = non_empty_contact_list new_contacts = db.get_contact_list() assert len(old_contacts) - 1 == len(new_contacts) old_contacts.remove(random_contact) assert old_contacts == new_contacts if check_ui: assert sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_c...
I delete the contact from the list') def delete_contact(app, random_contact): app.contact.delete_contact_by_id(random_contact.id) @then('the new contact list is equal to the old list without the deleted contact') def verify_contact_deleted(db, non_empty_contact_list, random_contact, app, check_ui):
64
64
117
37
27
elaginm/python_training
bdd/contact_steps.py
Python
verify_contact_deleted
verify_contact_deleted
52
60
52
53
cc9c37cca2d885d481447ed558f8de998cd1bfdd
bigcode/the-stack
train
d96123e7995c9c8b01228015
train
function
@given('a contact with <lastname>, <firstname>, <address>, <homephone>, <mobilephone>, <workphone>, ' '<secondaryphone>, <email>, <email2> and <email3>') def new_contact(lastname, firstname, address, homephone, mobilephone, workphone, secondaryphone, email, email2, email3): return Contact(lastname=lastname, ...
@given('a contact with <lastname>, <firstname>, <address>, <homephone>, <mobilephone>, <workphone>, ' '<secondaryphone>, <email>, <email2> and <email3>') def new_contact(lastname, firstname, address, homephone, mobilephone, workphone, secondaryphone, email, email2, email3):
return Contact(lastname=lastname, firstname=firstname, address=address, homephone=homephone, mobilephone=mobilephone, workphone=workphone, secondaryphone=secondaryphone, email=email, email2=email2, email3=email3)
@given('a contact with <lastname>, <firstname>, <address>, <homephone>, <mobilephone>, <workphone>, ' '<secondaryphone>, <email>, <email2> and <email3>') def new_contact(lastname, firstname, address, homephone, mobilephone, workphone, secondaryphone, email, email2, email3):
75
64
130
75
0
elaginm/python_training
bdd/contact_steps.py
Python
new_contact
new_contact
12
17
12
14
57d82fe1d72fc255704fe15c5d1491d404fc2234
bigcode/the-stack
train
7e83b8df21d675c304400563
train
function
@given('a random contact from the list') def index_random_contact(non_empty_contact_list): index_random_contact = random.randrange(len(non_empty_contact_list)) return index_random_contact
@given('a random contact from the list') def index_random_contact(non_empty_contact_list):
index_random_contact = random.randrange(len(non_empty_contact_list)) return index_random_contact
assert old_contacts == new_contacts if check_ui: assert sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contact_list(), key=Contact.id_or_max) # Modify contact @given('a random contact from the list') def index_random_contact(non_empty_contact_list):
64
64
38
19
44
elaginm/python_training
bdd/contact_steps.py
Python
index_random_contact
index_random_contact
64
67
64
65
8d17891c1dfc56213d43d04d84d72c6fb24ea445
bigcode/the-stack
train
324b9d1f27be70c8f5917ad1
train
function
@given('a non-empty contact list') def non_empty_contact_list(db, app): if len(db.get_contact_list()) == 0: app.contact.create(Contact(firstname="New contact")) return db.get_contact_list()
@given('a non-empty contact list') def non_empty_contact_list(db, app):
if len(db.get_contact_list()) == 0: app.contact.create(Contact(firstname="New contact")) return db.get_contact_list()
) == sorted(new_contacts, key=Contact.id_or_max) if check_ui: assert sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contact_list(), key=Contact.id_or_max) @given('a non-empty contact list') def non_empty_contact_list(db, app):
64
64
48
18
46
elaginm/python_training
bdd/contact_steps.py
Python
non_empty_contact_list
non_empty_contact_list
35
39
35
36
f4a6020b9683d6ee44cbb1c696b21d86d2ea430c
bigcode/the-stack
train
f23363d904e35871679aa52f
train
function
@given('a contact with <lastname>, <firstname>, <address>, <homephone>, <mobilephone>, <workphone>, ' '<secondaryphone>, <email>, <email2> and <email3>') def contact_modify(lastname, firstname, address, homephone, mobilephone, workphone, secondaryphone, email, email2, email3): return Contact(lastname=lastnam...
@given('a contact with <lastname>, <firstname>, <address>, <homephone>, <mobilephone>, <workphone>, ' '<secondaryphone>, <email>, <email2> and <email3>') def contact_modify(lastname, firstname, address, homephone, mobilephone, workphone, secondaryphone, email, email2, email3):
return Contact(lastname=lastname, firstname=firstname, address=address, homephone=homephone, mobilephone=mobilephone, workphone=workphone, secondaryphone=secondaryphone, email=email, email2=email2, email3=email3)
@given('a contact with <lastname>, <firstname>, <address>, <homephone>, <mobilephone>, <workphone>, ' '<secondaryphone>, <email>, <email2> and <email3>') def contact_modify(lastname, firstname, address, homephone, mobilephone, workphone, secondaryphone, email, email2, email3):
75
64
130
75
0
elaginm/python_training
bdd/contact_steps.py
Python
contact_modify
contact_modify
69
74
69
71
21d84523b9b2a80ee5b16cbc0e3ce9f50efbaea7
bigcode/the-stack
train
e85e9109e63238fd5efd6bd9
train
function
@then('the new contact list is equal to the old list with the modified contact') def verify_contact_modified(app, db, non_empty_contact_list, index_random_contact, contact_modify, check_ui): old_contacts = non_empty_contact_list new_contacts = db.get_contact_list() assert len(old_contacts) == len(new_contac...
@then('the new contact list is equal to the old list with the modified contact') def verify_contact_modified(app, db, non_empty_contact_list, index_random_contact, contact_modify, check_ui):
old_contacts = non_empty_contact_list new_contacts = db.get_contact_list() assert len(old_contacts) == len(new_contacts) old_contacts[index_random_contact] = contact_modify assert sorted(old_contacts, key=Contact.id_or_max) == sorted(new_contacts, key=Contact.id_or_max) if check_ui: asse...
_empty_contact_list[index_random_contact].id app.contact.edit_contact_by_id(contact_modify.id, contact_modify) @then('the new contact list is equal to the old list with the modified contact') def verify_contact_modified(app, db, non_empty_contact_list, index_random_contact, contact_modify, check_ui):
64
64
139
41
23
elaginm/python_training
bdd/contact_steps.py
Python
verify_contact_modified
verify_contact_modified
81
89
81
82
1ffa6a0b927f640304b30035f1c172a2ce9d5d32
bigcode/the-stack
train
0fa9d31c514597ac05438568
train
function
@when('I modify the contact in the list') def modify_contact(app, non_empty_contact_list, index_random_contact, contact_modify): contact_modify.id = non_empty_contact_list[index_random_contact].id app.contact.edit_contact_by_id(contact_modify.id, contact_modify)
@when('I modify the contact in the list') def modify_contact(app, non_empty_contact_list, index_random_contact, contact_modify):
contact_modify.id = non_empty_contact_list[index_random_contact].id app.contact.edit_contact_by_id(contact_modify.id, contact_modify)
=homephone, mobilephone=mobilephone, workphone=workphone, secondaryphone=secondaryphone, email=email, email2=email2, email3=email3) @when('I modify the contact in the list') def modify_contact(app, non_empty_contact_list, index_random_contact, contact_modify):
64
64
57
28
36
elaginm/python_training
bdd/contact_steps.py
Python
modify_contact
modify_contact
76
79
76
77
d4595fd0c1ff91489ef2814b364e514424be5972
bigcode/the-stack
train
ae03db64b20d334c5235fb33
train
function
@then('the new contact list is equal to the old list with the added contact') def verify_contact_added(db, contact_list, new_contact, app, check_ui): old_contacts = contact_list new_contacts = db.get_contact_list() old_contacts.append(new_contact) assert sorted(old_contacts, key=Contact.id_or_max) == so...
@then('the new contact list is equal to the old list with the added contact') def verify_contact_added(db, contact_list, new_contact, app, check_ui):
old_contacts = contact_list new_contacts = db.get_contact_list() old_contacts.append(new_contact) assert sorted(old_contacts, key=Contact.id_or_max) == sorted(new_contacts, key=Contact.id_or_max) if check_ui: assert sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contac...
contact @when('I add the contact to the list') def add_new_contact(app, new_contact): app.contact.create(new_contact) @then('the new contact list is equal to the old list with the added contact') def verify_contact_added(db, contact_list, new_contact, app, check_ui):
64
64
116
35
29
elaginm/python_training
bdd/contact_steps.py
Python
verify_contact_added
verify_contact_added
25
32
25
26
211b8c13573cef36d9c9c5ba888809dddd48b636
bigcode/the-stack
train
89827ad6d1e6ccbf48a2775f
train
function
@given('a contact list') def contact_list(db): return db.get_contact_list()
@given('a contact list') def contact_list(db):
return db.get_contact_list()
# -*- coding: utf-8 -*- from pytest_bdd import given, when, then from model.contact import Contact import random import pytest @given('a contact list') def contact_list(db):
43
64
19
12
30
elaginm/python_training
bdd/contact_steps.py
Python
contact_list
contact_list
8
10
8
9
a935be0a27645170ad199af11f68b383319a2b62
bigcode/the-stack
train
ff30014780dd3354b6f76e20
train
function
@given('a random contact from the list') def random_contact(non_empty_contact_list): return random.choice(non_empty_contact_list)
@given('a random contact from the list') def random_contact(non_empty_contact_list):
return random.choice(non_empty_contact_list)
('a non-empty contact list') def non_empty_contact_list(db, app): if len(db.get_contact_list()) == 0: app.contact.create(Contact(firstname="New contact")) return db.get_contact_list() @given('a random contact from the list') def random_contact(non_empty_contact_list):
64
64
27
18
46
elaginm/python_training
bdd/contact_steps.py
Python
random_contact
random_contact
41
43
41
42
b03080c3e307af868ea2e540e73129551343adde
bigcode/the-stack
train
aa271800a2ff1c57e6bd0664
train
function
@when('I add the contact to the list') def add_new_contact(app, new_contact): app.contact.create(new_contact)
@when('I add the contact to the list') def add_new_contact(app, new_contact):
app.contact.create(new_contact)
, homephone=homephone, mobilephone=mobilephone, workphone=workphone, secondaryphone=secondaryphone, email=email, email2=email2, email3=email3) # Add contact @when('I add the contact to the list') def add_new_contact(app, new_contact):
64
64
27
20
43
elaginm/python_training
bdd/contact_steps.py
Python
add_new_contact
add_new_contact
21
23
21
22
037a4ad289c45a758f4b0031b8e7152e98e37e41
bigcode/the-stack
train
b05cd3d973184937bb2ceda3
train
class
@admin.register(Category) class CategoryAdmin(admin.ModelAdmin): pass
@admin.register(Category) class CategoryAdmin(admin.ModelAdmin):
pass
from django.contrib import admin from ..models import Category __all__ = [ 'CategoryAdmin', ] @admin.register(Category) class CategoryAdmin(admin.ModelAdmin):
35
64
15
12
23
mandarhan/mandarhan
app/rooms/admin/category.py
Python
CategoryAdmin
CategoryAdmin
9
11
9
10
e61a69cf2ceea01ea30f79264401dca2a27b047c
bigcode/the-stack
train
3150bd77cb29e475608c7262
train
class
class LSFSVM(): def __init__(self, C=3, kernel_dict={'type': 'LINEAR'}, \ fuzzyvalue={'type':'Cen','function':'Lin'}, databalance='origine',r_max = 1, r_min = 1): self.C = C self.kernel_dict = kernel_dict self.fuzzyvalue = fuzzyvalue self.r_max = r_max ...
class LSFSVM():
def __init__(self, C=3, kernel_dict={'type': 'LINEAR'}, \ fuzzyvalue={'type':'Cen','function':'Lin'}, databalance='origine',r_max = 1, r_min = 1): self.C = C self.kernel_dict = kernel_dict self.fuzzyvalue = fuzzyvalue self.r_max = r_max self.r_min = r_min ...
actuale hyper-plane 'type': 'Hyp' 'function' : 'Lin' / 'Exp' r_max : radio between 0 and 1 r_min : radio between 0 and 1 for balancing data usually for the majority class r = len(y_minority)/len(y_majority) and for the minority class r = 1 Methods _mvalue(...
255
256
2,685
6
249
ishidaira233/TX-Credit-Assessement
LSFSVM/LS_FSVM.py
Python
LSFSVM
LSFSVM
64
361
64
65
035ce8fbeebd6b28e1267366bd051bded9942b8b
bigcode/the-stack
train
89f4a7f9f7b2307ec60c6a1a
train
class
class MerkleBlockTest(BitcoinNickelTestFramework): def set_test_params(self): self.num_nodes = 4 self.setup_clean_chain = True # Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing self.extra_args = [[], [], [], ["-txindex"]] def skip_test_if_missing_module(self): ...
class MerkleBlockTest(BitcoinNickelTestFramework):
def set_test_params(self): self.num_nodes = 4 self.setup_clean_chain = True # Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing self.extra_args = [[], [], [], ["-txindex"]] def skip_test_if_missing_module(self): self.skip_if_no_wallet() def setup_network(...
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test gettxoutproof and verifytxoutproof RPCs.""" from test_framework.messages import CMerkleBlock, Fro...
121
256
1,349
12
108
bitcoinNickel/bitcoinnickel
test/functional/rpc_txoutproof.py
Python
MerkleBlockTest
MerkleBlockTest
11
102
11
11
c9ac0d43d24163c8ce229a67d59493e91747d194
bigcode/the-stack
train
1dc7327e08138f41c5df173b
train
class
class Bot: __url: str = 'https://api.telegram.org/bot' def __init__(self, token: str) -> None: self.__token: typing.Union[str, None] = token self.__check_token() @property def token(self) -> typing.Union[str, None]: return self.__token def __check_token(self) -> None:...
class Bot:
__url: str = 'https://api.telegram.org/bot' def __init__(self, token: str) -> None: self.__token: typing.Union[str, None] = token self.__check_token() @property def token(self) -> typing.Union[str, None]: return self.__token def __check_token(self) -> None: res...
import logging import typing import requests from core.api_commands import ALL_COMMANDS from core.exceptions import ( HTTPConnectionError, APIConnectionError, IdentityError, InvalidCommand, ) logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class Bot:
59
88
296
3
56
minsk-python-dojo/misk-python-bot
core/bot.py
Python
Bot
Bot
19
56
19
20
02bdc359a0c0639efdc30532e73605a170c3ddf5
bigcode/the-stack
train
bd0d81cc7dbf9b53b88941dd
train
class
class timeAndRefrac(): timeStepInterval = 0.001 time = 0.0000 - timeStepInterval refractoryPointCounter = 0.0 refractoryPointSwitch = False neuronIndexCounter = 0.0 neuronIndexSwitch = False lastSpikeInterval = -0.001#0.0 spikeMiliseconds = 100 spikeIntervalUnformatted = spikeMiliseconds * .001 beginRefrac...
class timeAndRefrac():
timeStepInterval = 0.001 time = 0.0000 - timeStepInterval refractoryPointCounter = 0.0 refractoryPointSwitch = False neuronIndexCounter = 0.0 neuronIndexSwitch = False lastSpikeInterval = -0.001#0.0 spikeMiliseconds = 100 spikeIntervalUnformatted = spikeMiliseconds * .001 beginRefrac = [0*mV]*dictionaryLongi...
ms#20*ms#3000*ms testingRunTime = 10*ms+(10*ms*totalTestingTime)*10 # For testing runs. The * 10 is for the 10x scaling factor # 11*ms#790*ms# class timeAndRefrac():
64
64
206
7
57
Jbwasse2/snn-rl
furtherFormulas/architecture_further_formulas.py
Python
timeAndRefrac
timeAndRefrac
97
115
97
97
b0878f6acaed2b01339455a38befe79ec24a77da
bigcode/the-stack
train
d7da7c1c57acd9e8ededff9b
train
class
class latInhibSettings(): voltageForInhibition = 0.0*mV inhibitionReduction = 1.0 def __init__(self): initalize = True
class latInhibSettings():
voltageForInhibition = 0.0*mV inhibitionReduction = 1.0 def __init__(self): initalize = True
Results = 0 falseNegativeSpikeResults = 0 firedSpikes = np.array([np.array([None])]*(totalTestingTime+3)); assignedSpikeWindows = np.array([None]*dictionaryLongitude) def __init__(self): initalize = True class latInhibSettings():
64
64
41
6
57
Jbwasse2/snn-rl
furtherFormulas/architecture_further_formulas.py
Python
latInhibSettings
latInhibSettings
127
131
127
127
a89e138b05c23984589cefa66e619f3921518a14
bigcode/the-stack
train
0d6cb8a3602c8a41ddb81745
train
class
class testRun(): truePositiveSpikeResults = 0 falsePositiveSpikeResults = 0 trueNegativeSpikeResults = 0 falseNegativeSpikeResults = 0 firedSpikes = np.array([np.array([None])]*(totalTestingTime+3)); assignedSpikeWindows = np.array([None]*dictionaryLongitude) def __init__(self): initalize = True
class testRun():
truePositiveSpikeResults = 0 falsePositiveSpikeResults = 0 trueNegativeSpikeResults = 0 falseNegativeSpikeResults = 0 firedSpikes = np.array([np.array([None])]*(totalTestingTime+3)); assignedSpikeWindows = np.array([None]*dictionaryLongitude) def __init__(self): initalize = True
dictionaryLongitude absRefracTimeActivated = [False]*dictionaryLongitude relRefracTimeDuration = 0.03#.1#.01 absRefracTimeDuration = 0.02#.02#.002 def __init__(self): initalize = True class testRun():
64
64
81
4
59
Jbwasse2/snn-rl
furtherFormulas/architecture_further_formulas.py
Python
testRun
testRun
117
125
117
117
525a765bf851045c97ef65e22ce220cc2b939947
bigcode/the-stack
train
29615fe0a2882b919eb812c3
train
class
class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right
class TreeNode:
def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right
Example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its depth = 3. ''' # Definition for a binary tree node. class TreeNode:
64
64
39
4
60
coderMaruf/leetcode-1
Recursion_Part_I/Complexity Analysis/Maximum Depth of Binary Tree/by_dfs.py
Python
TreeNode
TreeNode
25
29
25
25
f4cae1903f6ca58676b99dd066098002b526a6e2
bigcode/the-stack
train
17cfec787be43abd7cba3fe9
train
function
def test_bench(): root = TreeNode( 3 ) root.left = TreeNode( 9 ) root.right = TreeNode( 20 ) root.right.left = TreeNode( 15 ) root.right.right = TreeNode( 7 ) # expected output: ''' 3 ''' print( Solution().maxDepth( root ) )
def test_bench():
root = TreeNode( 3 ) root.left = TreeNode( 9 ) root.right = TreeNode( 20 ) root.right.left = TreeNode( 15 ) root.right.right = TreeNode( 7 ) # expected output: ''' 3 ''' print( Solution().maxDepth( root ) )
## Time Complexity: O( n ) # # The overhead in time is the cost of DFS traversal, which is of O( n ) ## Space Complexity: O( n ) # # The overhead in space is the storage for recursion call stack, which is of O( n ) def test_bench():
63
64
80
5
58
coderMaruf/leetcode-1
Recursion_Part_I/Complexity Analysis/Maximum Depth of Binary Tree/by_dfs.py
Python
test_bench
test_bench
63
78
63
64
cccc4472beb7b4ce16f5c858c27693f38e5f762c
bigcode/the-stack
train
5845225981055663b8d4a6e0
train
class
class Solution: def maxDepth(self, root: TreeNode) -> int: if not root: # Empty tree or empty leaf node return 0 else: # Choose the local longest path in DFS left = self.maxDepth( root.left ) right = self.maxD...
class Solution:
def maxDepth(self, root: TreeNode) -> int: if not root: # Empty tree or empty leaf node return 0 else: # Choose the local longest path in DFS left = self.maxDepth( root.left ) right = self.maxDepth( root.right...
15 7 return its depth = 3. ''' # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution:
64
64
81
3
60
coderMaruf/leetcode-1
Recursion_Part_I/Complexity Analysis/Maximum Depth of Binary Tree/by_dfs.py
Python
Solution
Solution
33
46
33
33
0edd637a004132f849cddb968b6e790ca46cd089
bigcode/the-stack
train
404606645e98a1d71f53b372
train
class
class RNN_Encoder(nn.Module): """A custom RNN encoder network that uses - an embedding matrix to encode input, - a stack of LSTM layers to drive the network, and - variational dropouts in the embedding and LSTM layers The architecture for this network was inspired by the work done i...
class RNN_Encoder(nn.Module):
"""A custom RNN encoder network that uses - an embedding matrix to encode input, - a stack of LSTM layers to drive the network, and - variational dropouts in the embedding and LSTM layers The architecture for this network was inspired by the work done in "Regularizing and Op...
_enabled from .rnn_reg import LockedDropout, WeightDrop, EmbeddingDropout from .torch_imports import * IS_TORCH_04 = LooseVersion(torch.__version__) >= LooseVersion('0.4') def seq2seq_reg(output, xtra, loss, alpha=0, beta=0): hs, dropped_hs = xtra if alpha: # Activation Regularization loss = loss + ...
256
256
1,001
8
248
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
RNN_Encoder
RNN_Encoder
26
116
26
26
52aeb5b7f4ec77d8426036b0040453d37b0d9844
bigcode/the-stack
train
a0d006e56e6a62f2303e9eaf
train
function
def repackage_var(h): """Wraps h in new Variables, to detach them from their history.""" if IS_TORCH_04: return h.detach() if type(h) == torch.Tensor else tuple(repackage_var(v) for v in h) else: return Variable(h.data) if type(h) == Variable else tuple(repackage_var(v) for v in h)
def repackage_var(h):
"""Wraps h in new Variables, to detach them from their history.""" if IS_TORCH_04: return h.detach() if type(h) == torch.Tensor else tuple(repackage_var(v) for v in h) else: return Variable(h.data) if type(h) == Variable else tuple(repackage_var(v) for v in h)
if beta: # Temporal Activation Regularization (slowness) h = hs[-1] if len(h) > 1: loss = loss + sum(beta * (h[1:] - h[:-1]).pow(2).mean()) return loss def repackage_var(h):
64
64
82
6
57
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
repackage_var
repackage_var
18
23
18
18
08ee038c140b1c73a4c800f63d4fe0f9fef17c40
bigcode/the-stack
train
ab546e7b633ecd161b4db502
train
class
class PoolingLinearClassifier(nn.Module): def __init__(self, layers, drops): super().__init__() self.layers = nn.ModuleList([ LinearBlock(layers[i], layers[i + 1], drops[i]) for i in range(len(layers) - 1)]) def pool(self, x, bs, is_max): f = F.adaptive_max_pool1d if is_max ...
class PoolingLinearClassifier(nn.Module):
def __init__(self, layers, drops): super().__init__() self.layers = nn.ModuleList([ LinearBlock(layers[i], layers[i + 1], drops[i]) for i in range(len(layers) - 1)]) def pool(self, x, bs, is_max): f = F.adaptive_max_pool1d if is_max else F.adaptive_avg_pool1d return ...
, nf, drop): super().__init__() self.lin = nn.Linear(ni, nf) self.drop = nn.Dropout(drop) self.bn = nn.BatchNorm1d(ni) def forward(self, x): return self.lin(self.drop(self.bn(x))) class PoolingLinearClassifier(nn.Module):
66
67
226
8
58
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
PoolingLinearClassifier
PoolingLinearClassifier
168
188
168
168
143d8c0c7fe517d46622b1c7c4372cdae28143f8
bigcode/the-stack
train
7907c3a13b7f52ab0cc5c24e
train
function
def seq2seq_reg(output, xtra, loss, alpha=0, beta=0): hs, dropped_hs = xtra if alpha: # Activation Regularization loss = loss + sum(alpha * dropped_hs[-1].pow(2).mean()) if beta: # Temporal Activation Regularization (slowness) h = hs[-1] if len(h) > 1: loss = loss + sum(beta * (h[1...
def seq2seq_reg(output, xtra, loss, alpha=0, beta=0):
hs, dropped_hs = xtra if alpha: # Activation Regularization loss = loss + sum(alpha * dropped_hs[-1].pow(2).mean()) if beta: # Temporal Activation Regularization (slowness) h = hs[-1] if len(h) > 1: loss = loss + sum(beta * (h[1:] - h[:-1]).pow(2).mean()) return loss
rnn_reg import LockedDropout, WeightDrop, EmbeddingDropout from .torch_imports import * IS_TORCH_04 = LooseVersion(torch.__version__) >= LooseVersion('0.4') def seq2seq_reg(output, xtra, loss, alpha=0, beta=0):
64
64
118
20
44
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
seq2seq_reg
seq2seq_reg
8
15
8
8
beb51657031e6df2a5de5cafb596165dd5894664
bigcode/the-stack
train
521e3187021286cd21318666
train
class
class MultiBatchRNN(RNN_Encoder): def __init__(self, bptt, max_seq, *args, **kwargs): self.max_seq, self.bptt = max_seq, bptt super().__init__(*args, **kwargs) def concat(self, arrs): return [torch.cat([l[si] for l in arrs]) for si in range(len(arrs[0]))] def forward(self, input): ...
class MultiBatchRNN(RNN_Encoder):
def __init__(self, bptt, max_seq, *args, **kwargs): self.max_seq, self.bptt = max_seq, bptt super().__init__(*args, **kwargs) def concat(self, arrs): return [torch.cat([l[si] for l in arrs]) for si in range(len(arrs[0]))] def forward(self, input): sl, bs = input.size() ...
self.bs, nh).zero_(), volatile=not self.training) def reset(self): self.weights = next(self.parameters()).data self.hidden = [(self.one_hidden(l), self.one_hidden(l)) for l in range(self.nlayers)] class MultiBatchRNN(RNN_Encoder):
63
64
202
10
53
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
MultiBatchRNN
MultiBatchRNN
119
137
119
119
56378a12b41976d29ca32fe276349278e55599de
bigcode/the-stack
train
c63a11c06165c741a5a9c9b0
train
class
class LinearBlock(nn.Module): def __init__(self, ni, nf, drop): super().__init__() self.lin = nn.Linear(ni, nf) self.drop = nn.Dropout(drop) self.bn = nn.BatchNorm1d(ni) def forward(self, x): return self.lin(self.drop(self.bn(x)))
class LinearBlock(nn.Module):
def __init__(self, ni, nf, drop): super().__init__() self.lin = nn.Linear(ni, nf) self.drop = nn.Dropout(drop) self.bn = nn.BatchNorm1d(ni) def forward(self, x): return self.lin(self.drop(self.bn(x)))
outputs = input output = self.dropout(outputs[-1]) decoded = self.decoder(output.view(output.size(0) * output.size(1), output.size(2))) result = decoded.view(-1, decoded.size(1)) return result, raw_outputs, outputs class LinearBlock(nn.Module):
64
64
72
6
57
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
LinearBlock
LinearBlock
158
165
158
158
c1ea2a414426d6bb1e540e02cd6e6675b3005e15
bigcode/the-stack
train
50d8cb36e1f741fc95e20313
train
class
class LinearDecoder(nn.Module): initrange = 0.1 def __init__(self, n_out, nhid, dropout, tie_encoder=None): super().__init__() self.decoder = nn.Linear(nhid, n_out, bias=False) self.decoder.weight.data.uniform_(-self.initrange, self.initrange) self.dropout = LockedDropout(dropou...
class LinearDecoder(nn.Module):
initrange = 0.1 def __init__(self, n_out, nhid, dropout, tie_encoder=None): super().__init__() self.decoder = nn.Linear(nhid, n_out, bias=False) self.decoder.weight.data.uniform_(-self.initrange, self.initrange) self.dropout = LockedDropout(dropout) if tie_encoder: self....
.bptt): r, o = super().forward(input[i: min(i + self.bptt, sl)]) if i > (sl - self.max_seq): raw_outputs.append(r) outputs.append(o) return self.concat(raw_outputs), self.concat(outputs) class LinearDecoder(nn.Module):
64
64
164
6
58
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
LinearDecoder
LinearDecoder
140
155
140
140
d5163246c00d9ff3458975345a520805eb4b77bc
bigcode/the-stack
train
eccada4eb712cfc24f28f60c
train
function
def get_rnn_classifer(bptt, max_seq, n_class, n_tok, emb_sz, n_hid, n_layers, pad_token, layers, drops, bidir=False, dropouth=0.3, dropouti=0.5, dropoute=0.1, wdrop=0.5): rnn_enc = MultiBatchRNN(bptt, max_seq, n_tok, emb_sz, n_hid, n_layers, pad_token=pad_token, ...
def get_rnn_classifer(bptt, max_seq, n_class, n_tok, emb_sz, n_hid, n_layers, pad_token, layers, drops, bidir=False, dropouth=0.3, dropouti=0.5, dropoute=0.1, wdrop=0.5):
rnn_enc = MultiBatchRNN(bptt, max_seq, n_tok, emb_sz, n_hid, n_layers, pad_token=pad_token, bidir=bidir, dropouth=dropouth, dropouti=dropouti, dropoute=dropoute, wdrop=wdrop) return SequentialRNN(rnn_enc, PoolingLinearClassifier(layers, drops))
def get_rnn_classifer(bptt, max_seq, n_class, n_tok, emb_sz, n_hid, n_layers, pad_token, layers, drops, bidir=False, dropouth=0.3, dropouti=0.5, dropoute=0.1, wdrop=0.5):
70
64
154
70
0
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
get_rnn_classifer
get_rnn_classifer
234
240
234
236
800fc95ec3896ad38fc1ca2608ff0f662681da22
bigcode/the-stack
train
5f2a3c8795201a512df690e5
train
function
def get_language_model(n_tok, emb_sz, nhid, nlayers, pad_token, dropout=0.4, dropouth=0.3, dropouti=0.5, dropoute=0.1, wdrop=0.5, tie_weights=True): """Returns a SequentialRNN model. A RNN_Encoder layer is instantiated using the parameters provided. This is fo...
def get_language_model(n_tok, emb_sz, nhid, nlayers, pad_token, dropout=0.4, dropouth=0.3, dropouti=0.5, dropoute=0.1, wdrop=0.5, tie_weights=True):
"""Returns a SequentialRNN model. A RNN_Encoder layer is instantiated using the parameters provided. This is followed by the creation of a LinearDecoder layer. Also by default (i.e. tie_weights = True), the embedding matrix used in the RNN_Encoder is used to instantiate the weights for the Linea...
= torch.cat([output[-1], mxpool, avgpool], 1) for l in self.layers: l_x = l(x) x = F.relu(l_x) return l_x, raw_outputs, outputs class SequentialRNN(nn.Sequential): def reset(self): for c in self.children(): if hasattr(c, 'reset'): c.reset() def get_lang...
138
138
461
59
79
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
get_language_model
get_language_model
197
231
197
199
3f1cb9056b74ab9ddd56a8a8f14db6f5822826ab
bigcode/the-stack
train
8090d3c36ff0ba041cce213d
train
class
class SequentialRNN(nn.Sequential): def reset(self): for c in self.children(): if hasattr(c, 'reset'): c.reset()
class SequentialRNN(nn.Sequential):
def reset(self): for c in self.children(): if hasattr(c, 'reset'): c.reset()
(output, bs, True) x = torch.cat([output[-1], mxpool, avgpool], 1) for l in self.layers: l_x = l(x) x = F.relu(l_x) return l_x, raw_outputs, outputs class SequentialRNN(nn.Sequential):
64
64
30
7
56
chnsh/deep-semantic-code-search
code_summarization_transfer_learning/fastai/courses/dl1/fastai/lm_rnn.py
Python
SequentialRNN
SequentialRNN
191
194
191
191
19da79e3bdcb9f64cc25b36270ee3674845459c6
bigcode/the-stack
train
554f698306d26683d9c228b6
train
function
@windows_ci @pytest.mark.integration def test_check_windows_defaults(aggregator, dd_run_check, init_config, instance_sql2017_defaults): check = SQLServer(CHECK_NAME, init_config, [instance_sql2017_defaults]) dd_run_check(check) aggregator.assert_metric_has_tag('sqlserver.db.commit_table_entries', 'db:maste...
@windows_ci @pytest.mark.integration def test_check_windows_defaults(aggregator, dd_run_check, init_config, instance_sql2017_defaults):
check = SQLServer(CHECK_NAME, init_config, [instance_sql2017_defaults]) dd_run_check(check) aggregator.assert_metric_has_tag('sqlserver.db.commit_table_entries', 'db:master') for mname in EXPECTED_DEFAULT_METRICS + CUSTOM_METRICS: aggregator.assert_metric(mname) aggregator.assert_service_...
=custom_tags + ['query:custom']) aggregator.assert_metric('sqlserver.num', value=value, tags=custom_tags + ['query:another_custom_one']) @windows_ci @pytest.mark.integration def test_check_windows_defaults(aggregator, dd_run_check, init_config, instance_sql2017_defaults):
63
64
123
30
33
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_check_windows_defaults
test_check_windows_defaults
277
289
277
279
713e0f300090d792d1aa3b40748629f6e70e7677
bigcode/the-stack
train
604de40c1c6283b6bf973cd6
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_stored_procedure_proc_if(aggregator, dd_run_check, init_config, instance_docker): instance_fail = deepcopy(instance_docker) proc = 'pyStoredProc' proc_only_fail = "select cntr_type from sys.dm_os_performance_c...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_stored_procedure_proc_if(aggregator, dd_run_check, init_config, instance_docker):
instance_fail = deepcopy(instance_docker) proc = 'pyStoredProc' proc_only_fail = "select cntr_type from sys.dm_os_performance_counters where counter_name in ('FOO');" sp_tags = "foo:bar,baz:qux" instance_fail['proc_only_if'] = proc_only_fail instance_fail['stored_procedure'] = proc load_st...
count=1) aggregator.assert_metric('sql.sp.testb', tags=expected_tags, count=2) @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_stored_procedure_proc_if(aggregator, dd_run_check, init_config, instance_docker):
64
64
194
41
23
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_check_stored_procedure_proc_if
test_check_stored_procedure_proc_if
134
152
134
137
d7c0e282c17b7123288bc960535d6cdb4549a89b
bigcode/the-stack
train
0777281debe3fcfc56eecaaf
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_invalid_password(aggregator, dd_run_check, init_config, instance_docker): instance_docker['password'] = 'FOO' sqlserver_check = SQLServer(CHECK_NAME, init_config, [instance_docker]) with pytest.raises(SQLCo...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_invalid_password(aggregator, dd_run_check, init_config, instance_docker):
instance_docker['password'] = 'FOO' sqlserver_check = SQLServer(CHECK_NAME, init_config, [instance_docker]) with pytest.raises(SQLConnectionError): sqlserver_check.initialize_connection() sqlserver_check.check(instance_docker) aggregator.assert_service_check( 'sqlserver.can_con...
import not_windows_ci, windows_ci try: import pyodbc except ImportError: pyodbc = None @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_invalid_password(aggregator, dd_run_check, init_config, instance_docker):
64
64
137
37
26
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_check_invalid_password
test_check_invalid_password
20
36
20
24
b394673bb2f84a330d24102426f99249eafc6c47
bigcode/the-stack
train
d67fffd6a2576c19862ce01e
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def load_stored_procedure(instance, proc_name, sp_tags): # Make DB connection conn_str = 'DRIVER={};Server={};Database=master;UID={};PWD={};'.format( instance['driver'], instance['host'], instance['username'], instance['...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def load_stored_procedure(instance, proc_name, sp_tags): # Make DB connection
conn_str = 'DRIVER={};Server={};Database=master;UID={};PWD={};'.format( instance['driver'], instance['host'], instance['username'], instance['password'] ) conn = pyodbc.connect(conn_str, timeout=30) # Create cursor associated with connection cursor = conn.cursor() # Stored Procedure Dr...
'db:master', 'optional:tag1'], ) @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_docker(aggregator, dd_run_check, init_config, instance_docker): sqlserver_check = SQLServer(CHECK_NAME, init_config, [instance_docker]) dd_run_check(sqlserver_check) exp...
154
154
515
37
117
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
load_stored_procedure
load_stored_procedure
49
111
49
53
8d50d9220905a82d904b7c08e198fd3cdd0764f4
bigcode/the-stack
train
6ed30d782bf37abd253f3b45
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_metrics_object_name(aggregator, dd_run_check, init_config_object_name, instance_docker): sqlserver_check = SQLServer(CHECK_NAME, init_config_object_name, [instance_docker]) dd_run_check(sqlserver_check) agg...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_metrics_object_name(aggregator, dd_run_check, init_config_object_name, instance_docker):
sqlserver_check = SQLServer(CHECK_NAME, init_config_object_name, [instance_docker]) dd_run_check(sqlserver_check) aggregator.assert_metric('sqlserver.cache.hit_ratio', tags=['optional:tag1', 'optional_tag:tag1'], count=1) aggregator.assert_metric('sqlserver.active_requests', tags=['optional:tag1', 'opt...
will never fail and assert that the metrics remain unchanged assert len(aggregator._metrics) == 0 @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_metrics_object_name(aggregator, dd_run_check, init_config_object_name, instance_docker):
64
64
126
40
23
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_custom_metrics_object_name
test_custom_metrics_object_name
155
164
155
159
1b0348f19c09b27eab362c0d24b0aa0724e827a5
bigcode/the-stack
train
30ab445f0a54a60c85fa48ba
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_autodiscovery_perf_counters(aggregator, dd_run_check, instance_autodiscovery): instance_autodiscovery['autodiscovery_include'] = ['master', 'msdb'] check = SQLServer(CHECK_NAME, {}, [instance_autodiscovery]) dd_run_...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_autodiscovery_perf_counters(aggregator, dd_run_check, instance_autodiscovery):
instance_autodiscovery['autodiscovery_include'] = ['master', 'msdb'] check = SQLServer(CHECK_NAME, {}, [instance_autodiscovery]) dd_run_check(check) expected_metrics = [ 'sqlserver.database.backup_restore_throughput', 'sqlserver.database.log_bytes_flushed', 'sqlserver.database.l...
) aggregator.assert_metric('sqlserver.database.files.state', tags=master_tags) aggregator.assert_metric('sqlserver.database.files.state', tags=msdb_tags) @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_autodiscovery_perf_counters(aggregator, dd_run_check, instance_au...
72
72
242
38
34
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_autodiscovery_perf_counters
test_autodiscovery_perf_counters
223
252
223
226
4c3e7577c33576041a7b556303caeb96c0b65290
bigcode/the-stack
train
44f43afa60c50e6c169ed7c4
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_docker(aggregator, dd_run_check, init_config, instance_docker): sqlserver_check = SQLServer(CHECK_NAME, init_config, [instance_docker]) dd_run_check(sqlserver_check) expected_tags = instance_docker.get('tags',...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_docker(aggregator, dd_run_check, init_config, instance_docker):
sqlserver_check = SQLServer(CHECK_NAME, init_config, [instance_docker]) dd_run_check(sqlserver_check) expected_tags = instance_docker.get('tags', []) + ['host:{}'.format(instance_docker.get('host')), 'db:master'] assert_metrics(aggregator, expected_tags)
_check.CRITICAL, tags=['host:localhost,1433', 'db:master', 'optional:tag1'], ) @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_docker(aggregator, dd_run_check, init_config, instance_docker):
64
64
104
37
27
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_check_docker
test_check_docker
39
46
39
42
be1fbcfa85597288ce1fa9b7563f9cc6147fbc2b
bigcode/the-stack
train
3d2bd4942cc265bcc9d9643e
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_metrics_alt_tables(aggregator, dd_run_check, init_config_alt_tables, instance_docker): instance = deepcopy(instance_docker) instance['include_task_scheduler_metrics'] = False sqlserver_check = SQLServer(CHEC...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_metrics_alt_tables(aggregator, dd_run_check, init_config_alt_tables, instance_docker):
instance = deepcopy(instance_docker) instance['include_task_scheduler_metrics'] = False sqlserver_check = SQLServer(CHECK_NAME, init_config_alt_tables, [instance]) dd_run_check(sqlserver_check) aggregator.assert_metric('sqlserver.LCK_M_S.max_wait_time_ms', tags=['optional:tag1'], count=1) aggr...
tag1', 'optional_tag:tag1'], count=1) aggregator.assert_metric('sqlserver.active_requests', tags=['optional:tag1', 'optional_tag:tag1'], count=1) @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_metrics_alt_tables(aggregator, dd_run_check, init_config_alt_tables, i...
82
82
275
40
42
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_custom_metrics_alt_tables
test_custom_metrics_alt_tables
167
190
167
170
8b9ac6f3f0dc025a68771708045e1ff20039afce
bigcode/the-stack
train
10e810f3811db89b322f20e7
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_autodiscovery_database_metrics(aggregator, dd_run_check, instance_autodiscovery): instance_autodiscovery['autodiscovery_include'] = ['master', 'msdb'] check = SQLServer(CHECK_NAME, {}, [instance_autodiscovery]) dd_r...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_autodiscovery_database_metrics(aggregator, dd_run_check, instance_autodiscovery):
instance_autodiscovery['autodiscovery_include'] = ['master', 'msdb'] check = SQLServer(CHECK_NAME, {}, [instance_autodiscovery]) dd_run_check(check) master_tags = [ 'database:master', 'database_files_state_desc:ONLINE', 'file_id:1', 'file_location:/var/opt/mssql/data/mas...
to be processed dd_run_check(sqlserver_check) aggregator.assert_metric('sqlserver.io_file_stats.num_of_reads') aggregator.assert_metric('sqlserver.io_file_stats.num_of_writes') @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_autodiscovery_database_metrics(aggre...
78
78
262
37
41
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_autodiscovery_database_metrics
test_autodiscovery_database_metrics
193
220
193
196
f4d5cf9bf768934f5fcd51c10a7668c5cff9c4db
bigcode/the-stack
train
28ba7cd8455cf32c4e278166
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_queries(aggregator, dd_run_check, instance_docker): instance = copy(instance_docker) querya = copy(CUSTOM_QUERY_A) queryb = copy(CUSTOM_QUERY_B) instance['custom_queries'] = [querya, queryb] check = ...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_queries(aggregator, dd_run_check, instance_docker):
instance = copy(instance_docker) querya = copy(CUSTOM_QUERY_A) queryb = copy(CUSTOM_QUERY_B) instance['custom_queries'] = [querya, queryb] check = SQLServer(CHECK_NAME, {}, [instance]) dd_run_check(check) tags = list(instance['tags']) for tag in ('a', 'b', 'c'): value = ord(tag...
_metric(metric, tags=master_tags) aggregator.assert_metric(metric, tags=msdb_tags) aggregator.assert_metric(metric, tags=base_tags) @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_custom_queries(aggregator, dd_run_check, instance_docker):
64
64
185
33
31
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_custom_queries
test_custom_queries
255
274
255
258
8accb853806eac6ff3779d60388327fa63fee8f8
bigcode/the-stack
train
4b2fba9145a415789c138bfb
train
function
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_stored_procedure(aggregator, dd_run_check, init_config, instance_docker): instance_pass = deepcopy(instance_docker) proc = 'pyStoredProc' sp_tags = "foo:bar,baz:qux" instance_pass['stored_procedure'] = pr...
@not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_stored_procedure(aggregator, dd_run_check, init_config, instance_docker):
instance_pass = deepcopy(instance_docker) proc = 'pyStoredProc' sp_tags = "foo:bar,baz:qux" instance_pass['stored_procedure'] = proc load_stored_procedure(instance_pass, proc, sp_tags) sqlserver_check = SQLServer(CHECK_NAME, init_config, [instance_pass]) dd_run_check(sqlserver_check) ...
rows = cursor.fetchall() # else: # rows = None cursor.commit() cursor.close() @not_windows_ci @pytest.mark.integration @pytest.mark.usefixtures('dd_environment') def test_check_stored_procedure(aggregator, dd_run_check, init_config, instance_docker):
64
64
179
39
25
vbarbaresi/integrations-core
sqlserver/tests/test_integration.py
Python
test_check_stored_procedure
test_check_stored_procedure
114
131
114
117
a3acc042977ee5514b8e840044af61dd58a63a93
bigcode/the-stack
train
e16ca098f22a7d9afca0834b
train
function
def runsubprocess(args,stderrpath=None, stdoutpath=None, writefile=None,shell=False,verbose=True): import subprocess,sys #os try: import thread except: import _thread """takes a subprocess argument list and runs Popen/communicate(); by default, both output and error are printed to screen...
def runsubprocess(args,stderrpath=None, stdoutpath=None, writefile=None,shell=False,verbose=True):
import subprocess,sys #os try: import thread except: import _thread """takes a subprocess argument list and runs Popen/communicate(); by default, both output and error are printed to screen; stderrpath and stdoutpath for saving output can be optionally set; a redirect can be optionally s...
#Python modules def runsubprocess(args,stderrpath=None, stdoutpath=None, writefile=None,shell=False,verbose=True):
28
256
931
24
3
AlexOrlek/metamorth
pythonmods.py
Python
runsubprocess
runsubprocess
3
112
3
3
72156438efde7c3de21889be6aee9cc35142f7c9
bigcode/the-stack
train
3a92a28a8ace16677873c7bb
train
function
def runblastn(query, database, blastoutput, evalue=str(10), outfmt='custom qcov', task='blastn', num_threads=str(1), max_target_seqs=str(500), max_hsps=False, perc_identity=False, qcov_hsp_perc=False, culling_limit=False, word_size=False): #default evalue is 10; default wordsize is 11 for blastn - just use -tasks param...
def runblastn(query, database, blastoutput, evalue=str(10), outfmt='custom qcov', task='blastn', num_threads=str(1), max_target_seqs=str(500), max_hsps=False, perc_identity=False, qcov_hsp_perc=False, culling_limit=False, word_size=False): #default evalue is 10; default wordsize is 11 for blastn - just use -tasks param...
import subprocess evalue=str(evalue) if outfmt=='custom qcov': outfmt='6 qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore qcovs qcovhsp qlen slen' cmdArgs=['blastn', '-query', query, '-db', database, '-out', blastoutput, '-evalue', evalue, '-outfmt', outfmt, '...
def runblastn(query, database, blastoutput, evalue=str(10), outfmt='custom qcov', task='blastn', num_threads=str(1), max_target_seqs=str(500), max_hsps=False, perc_identity=False, qcov_hsp_perc=False, culling_limit=False, word_size=False): #default evalue is 10; default wordsize is 11 for blastn - just use -tasks param...
143
115
385
143
0
AlexOrlek/metamorth
pythonmods.py
Python
runblastn
runblastn
127
143
127
127
6494bcb75e4b682e4bb5a86db814021d41fc371e
bigcode/the-stack
train