code stringlengths 72 8.78M | code_en stringlengths 72 8.78M | language stringclasses 1
value | file_path stringlengths 36 164 | license stringclasses 1
value | token_count int64 26 8.41M |
|---|---|---|---|---|---|
import json
import time
import numpy as np
from collections import OrderedDict
from typing import List, Optional, Union
from pyqtgraph import DateAxisItem, ErrorBarItem, ViewBox
from pydm.widgets.channel import PyDMChannel
from pydm.widgets.timeplot import TimePlotCurveItem
from pydm.widgets import PyDMTimePlot
from qt... | import json
import time
import numpy as np
from collections import OrderedDict
from typing import List, Optional, Union
from pyqtgraph import DateAxisItem, ErrorBarItem, ViewBox
from pydm.widgets.channel import PyDMChannel
from pydm.widgets.timeplot import TimePlotCurveItem
from pydm.widgets import PyDMTimePlot
from qt... | en | 003294633_slaclab-pydm_archiver_time_plot_5be7100b9cc5.py | unknown | 4,991 |
#!/usr/bin/python
from hdbcli import dbapi
import simplejson as json
import traceback
from decimal import *
host='localhost'
port=30115
username='SYSTEM'
password='password'
PLUGIN_VERSION = "1"
HEARTBEAT=True
metric_units={
"Index Server Memory Pool Used Size":"GB",
"Index Server Memory Pool Heap Used Size... | #!/usr/bin/python
from hdbcli import dbapi
import simplejson as json
import traceback
from decimal import *
host='localhost'
port=30115
username='SYSTEM'
password='password'
PLUGIN_VERSION = "1"
HEARTBEAT=True
metric_units={
"Index Server Memory Pool Used Size":"GB",
"Index Server Memory Pool Heap Used Size... | en | 000180218_site24x7-plugins_sap_hana_database_25dfb8a3df30.py | unknown | 2,800 |
#
# Copyright (c) 2019-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | #
# Copyright (c) 2019-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | en | 000306939_openvinotoolkit-model_server_face_detection_3ca7f8a79fb5.py | unknown | 2,024 |
# Copyright (c) OpenMMLab. All rights reserved.
import datetime
import os
import platform
import warnings
import cv2
import torch.multiprocessing as mp
from mmengine import DefaultScope
def setup_multi_processes(cfg):
"""Setup multi-processing environment variables."""
# set multi-process start method as `fo... | # Copyright (c) OpenMMLab. All rights reserved.
import datetime
import os
import platform
import warnings
import cv2
import torch.multiprocessing as mp
from mmengine import DefaultScope
def setup_multi_processes(cfg):
"""Setup multi-processing environment variables."""
# set multi-process start method as `fo... | en | 002392813_open-mmlab-mmpose_setup_env_58bec6eca089.py | unknown | 1,165 |
#
# This file is part of Sequana software
#
# Copyright (c) 2016-2022 - Sequana Development Team
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# website: https://github.com/sequana/sequana
# documentation: http://sequana.r... | #
# This file is part of Sequana software
#
# Copyright (c) 2016-2022 - Sequana Development Team
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# website: https://github.com/sequana/sequana
# documentation: http://sequana.r... | en | 001177166_sequana-sequana_compare_abababe9dec5.py | unknown | 6,726 |
import logging
from typing import Dict
from typing import List
import boto3
import neo4j
from .util import get_botocore_config
from cartography.util import aws_handle_regions
from cartography.util import run_cleanup_job
from cartography.util import timeit
logger = logging.getLogger(__name__)
@timeit
@aws_handle_re... | import logging
from typing import Dict
from typing import List
import boto3
import neo4j
from .util import get_botocore_config
from cartography.util import aws_handle_regions
from cartography.util import run_cleanup_job
from cartography.util import timeit
logger = logging.getLogger(__name__)
@timeit
@aws_handle_re... | en | 002374487_lyft-cartography_launch_templates_517a8835dc41.py | unknown | 1,435 |
class TextXLSError(Exception):
"""Indicates a generic textX-LS-core error."""
pass
class GenerateExtensionError(TextXLSError):
"""Indicates an error while generating an extension."""
def __init__(self, target, cmd_args):
super().__init__(
"Failed to generate the extension for '{}... | class TextXLSError(Exception):
"""Indicates a generic textX-LS-core error."""
pass
class GenerateExtensionError(TextXLSError):
"""Indicates an error while generating an extension."""
def __init__(self, target, cmd_args):
super().__init__(
"Failed to generate the extension for '{}... | en | 001745681_textX-textX-LS_exceptions_beed1291bb76.py | unknown | 591 |
###########################################################################
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | ###########################################################################
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | en | 003392113_google-starthinker_bigquery_run_query_example_7ea86b9a96d6.py | unknown | 794 |
import os
import numpy as np
from keras import metrics
from keras import regularizers
from keras import backend as K
from keras.models import Model
from keras.layers import Input, Dense, Concatenate
from keras.callbacks import CSVLogger, ModelCheckpoint
from keras.utils import plot_model
from src.model.autoencoder impo... | import os
import numpy as np
from keras import metrics
from keras import regularizers
from keras import backend as K
from keras.models import Model
from keras.layers import Input, Dense, Concatenate
from keras.callbacks import CSVLogger, ModelCheckpoint
from keras.utils import plot_model
from src.model.autoencoder impo... | en | 001983245_ZihengZZH-bipolar-disorder_autoencoder_bimodal_904402b6c334.py | unknown | 2,433 |
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | en | 000916323_tensorflow-tfx_notebook_formatters_test_7cf60a3887f2.py | unknown | 557 |
# Picoweb web pico-framework for MicroPython
# Copyright (c) 2014-2018 Paul Sokolovsky
# SPDX-License-Identifier: MIT
import sys
import gc
import micropython
import utime
import uio
import ure as re
import uerrno
import uasyncio as asyncio
import pkg_resources
from .utils import parse_qs
def get_mime_type(fname):
... | # Picoweb web pico-framework for MicroPython
# Copyright (c) 2014-2018 Paul Sokolovsky
# SPDX-License-Identifier: MIT
import sys
import gc
import micropython
import utime
import uio
import ure as re
import uerrno
import uasyncio as asyncio
import pkg_resources
from .utils import parse_qs
def get_mime_type(fname):
... | en | 004340023_peterhinch-micropython-samples_init_21ec5d5041c6.py | unknown | 2,757 |
import random
def merge(a, b):
res = []
i = j = 0
while j < len(a) and i < len(b):
if a[j] < b[i]:
res.append(a[j])
j += 1
else:
res.append(b[i])
i += 1
if j == len(a):
for i in b[i:]:
res.append(i)
else:
... | import random
def merge(a, b):
res = []
i = j = 0
while j < len(a) and i < len(b):
if a[j] < b[i]:
res.append(a[j])
j += 1
else:
res.append(b[i])
i += 1
if j == len(a):
for i in b[i:]:
res.append(i)
else:
... | en | 004742219_Wycers-Codelib_nlogn_54efbc83b4ff.py | unknown | 278 |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | en | 004925851_PaddlePaddle-PaddleSeg_danet_750298d33a8f.py | unknown | 2,386 |
# Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Sequence, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import Scale
from mmengine import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.dense_heads import CenterNetUpdateH... | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Sequence, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import Scale
from mmengine import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.dense_heads import CenterNetUpdateH... | en | 002608652_alldatacenter-alldata_centernet_rpn_head_7ce057acd40d.py | unknown | 2,276 |
from django.contrib import admin
from .models import Profile
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
class ProfileInline(admin.StackedInline):
model = Profile
can_delete = False
verbose_name_plural = 'Profile'
fk_name = 'user'
class CustomUserAdmi... | from django.contrib import admin
from .models import Profile
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
class ProfileInline(admin.StackedInline):
model = Profile
can_delete = False
verbose_name_plural = 'Profile'
fk_name = 'user'
class CustomUserAdmi... | en | 002878685_ialbert-biostar-central_admin_ae39fcd530b4.py | unknown | 356 |
# Copyright (C) 2018 British Broadcasting Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | # Copyright (C) 2018 British Broadcasting Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | en | 000070574_AMWA-TV-nmos-testing_IS0403Test_1440fc1f1632.py | unknown | 1,413 |
"""Kaleidescape Media Player."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from kaleidescape import const as kaleidescape_const
from homeassistant.components.media_player import (
MediaPlayerEntity,
MediaPlayerEntityFeature,
MediaPlayerState,
)
from homeassistant.... | """Kaleidescape Media Player."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from kaleidescape import const as kaleidescape_const
from homeassistant.components.media_player import (
MediaPlayerEntity,
MediaPlayerEntityFeature,
MediaPlayerState,
)
from homeassistant.... | en | 001356588_home-assistant-core_media_player_77faacb22d7a.py | unknown | 1,280 |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | en | 003101463_pytorch-opacus_grad_sample_module_d25c9bc0a568.py | unknown | 4,872 |
# -*- encoding: utf-8 -*-
"""
Shows how to append email to folder
"""
import imapy
from email.mime.text import MIMEText
def get_text_email(sender, recepient, subject, text):
"""returns email object"""
msg = MIMEText(text, "plain", "utf-8")
msg['Subject'] = subject
msg['From'] = sender
msg['To'] =... | # -*- encoding: utf-8 -*-
"""
Shows how to append email to folder
"""
import imapy
from email.mime.text import MIMEText
def get_text_email(sender, recepient, subject, text):
"""returns email object"""
msg = MIMEText(text, "plain", "utf-8")
msg['Subject'] = subject
msg['From'] = sender
msg['To'] =... | en | 001832013_vladimarius-imapy_append_email_aee242d08a9c.py | unknown | 258 |
#!/usr/bin/env python
from __future__ import print_function
from builtins import input
from builtins import str
from builtins import range
import sys
import pmagpy.pmag as pmag
def main():
"""
Welcome to the thellier-thellier experiment automatic chart maker.
Please select desired step interval and uppe... | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
from builtins import str
from builtins import range
import sys
import pmagpy.pmag as pmag
def main():
"""
Welcome to the thellier-thellier experiment automatic chart maker.
Please select desired step interval and uppe... | en | 003772823_PmagPy-PmagPy_chartmaker_c07f11cea2dd.py | unknown | 335 |
"""
Responds to general conversation questions
Usage Examples:
- "What's up?"
- "Tell me a joke"
"""
import random
import re
from athena.classes.module import Module
from athena.classes.task import ActiveTask
""" Place the most specific regex keys first """
RESPONSES = {
r'.*\b(joke(s)?|... | """
Responds to general conversation questions
Usage Examples:
- "What's up?"
- "Tell me a joke"
"""
import random
import re
from athena.classes.module import Module
from athena.classes.task import ActiveTask
""" Place the most specific regex keys first """
RESPONSES = {
r'.*\b(joke(s)?|... | en | 002858501_rcbyron-hey-athena-client_conversation_0fe5fd69349f.py | unknown | 928 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | en | 005101352_google-audio-to-tactile_plot_3cf30818e5d4.py | unknown | 2,710 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by imoyao at 2019/7/18 10:00
import hashlib
from flask import current_app, g
from sqlalchemy import or_
from itsdangerous import (TimedJSONWebSignatureSerializer
as Serializer, BadSignature, SignatureExpired)
from flask_httpauth import HT... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by imoyao at 2019/7/18 10:00
import hashlib
from flask import current_app, g
from sqlalchemy import or_
from itsdangerous import (TimedJSONWebSignatureSerializer
as Serializer, BadSignature, SignatureExpired)
from flask_httpauth import HT... | en | 001678196_imoyao-idealyard_authctrl_c3fb07194c4b.py | unknown | 2,505 |
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... | ################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... | en | 001888685_ContinualAI-avalanche_topk_acc_1be2e9fd3ff4.py | unknown | 3,785 |
from __future__ import division
from collections import defaultdict
from chainercv.evaluations import calc_detection_voc_ap
import numpy as np
import six
from chainer_mask_rcnn.utils.geometry import get_mask_overlap
def mask_iou(mask_a, mask_b):
if mask_a.shape[1:] != mask_b.shape[1:]:
raise ValueError... | from __future__ import division
from collections import defaultdict
from chainercv.evaluations import calc_detection_voc_ap
import numpy as np
import six
from chainer_mask_rcnn.utils.geometry import get_mask_overlap
def mask_iou(mask_a, mask_b):
if mask_a.shape[1:] != mask_b.shape[1:]:
raise ValueError... | en | 002570521_start-jsk-jsk_apc_eval_instance_segmentation_voc_58aa01e5f706.py | unknown | 2,810 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | en | 002194039_pulumi-pulumi-alicloud_get_products_580f2aa34c26.py | unknown | 1,798 |
class SentinelCommands:
def sentinel(self, *args): ...
def sentinel_get_master_addr_by_name(self, service_name): ...
def sentinel_master(self, service_name): ...
def sentinel_masters(self): ...
def sentinel_monitor(self, name, ip, port, quorum): ...
def sentinel_remove(self, name): ...
def s... | class SentinelCommands:
def sentinel(self, *args): ...
def sentinel_get_master_addr_by_name(self, service_name): ...
def sentinel_master(self, service_name): ...
def sentinel_masters(self): ...
def sentinel_monitor(self, name, ip, port, quorum): ...
def sentinel_remove(self, name): ...
def s... | en | 001997397_JetBrains-intellij-community_sentinel_be963352f69f.py | unknown | 229 |
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets, status
from rest_framework.decorators import action
from rest_framework.exceptions import NotFound
from rest_framework.filters import SearchFilter
from rest_framework.response import Response
from taxonomy.models import ... | from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets, status
from rest_framework.decorators import action
from rest_framework.exceptions import NotFound
from rest_framework.filters import SearchFilter
from rest_framework.response import Response
from taxonomy.models import ... | en | 002798893_voorloopnul-pipetaxon_api_e7cd9d7ed0e2.py | unknown | 690 |
from fairseq.models.transformer_lm import TransformerLanguageModel, TransformerLanguageModelConfig, \
DEFAULT_MAX_TARGET_POSITIONS, transformer_lm_gpt, base_lm_architecture
from fairseq import options
from fairseq.modules import AdaptiveInput, CharacterTokenEmbedder
from fairseq.models import register_model, regist... | from fairseq.models.transformer_lm import TransformerLanguageModel, TransformerLanguageModelConfig, \
DEFAULT_MAX_TARGET_POSITIONS, transformer_lm_gpt, base_lm_architecture
from fairseq import options
from fairseq.modules import AdaptiveInput, CharacterTokenEmbedder
from fairseq.models import register_model, regist... | en | 001963590_microsoft-muzic_transformer_lm_d17fc6e8a03a.py | unknown | 1,360 |
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import google.protobuf.timestamp_pb2
import typing
import typing_exten... | """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import google.protobuf.timestamp_pb2
import typing
import typing_exten... | en | 005031852_eclipse-kuksa.val_types_pb2_346c3add89ed.py | unknown | 5,373 |
#!/usr/bin/env python3
"""
Sends a PWM via UAVCAN
"""
import argparse
import uavcan
import os
DSDL_DIR = os.path.join(os.path.dirname(__file__), "../uavcan_data_types/cvra")
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"port",
help="SocketCAN i... | #!/usr/bin/env python3
"""
Sends a PWM via UAVCAN
"""
import argparse
import uavcan
import os
DSDL_DIR = os.path.join(os.path.dirname(__file__), "../uavcan_data_types/cvra")
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"port",
help="SocketCAN i... | en | 001435532_cvra-robot-software_set_servo_596edc508a13.py | unknown | 670 |
# Copyright 2023 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2023 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | en | 003525199_canonical-charmcraft_init_59318c12aca5.py | unknown | 333 |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | en | 002854131_Ascend-ModelZoo-PyTorch_prof_64f00aaf52ba.py | unknown | 1,339 |
#!/usr/bin/env python3
from pysdd.sdd import SddManager, Vtree
def main():
# set up vtree and manager
var_count = 4
var_order = [2,1,4,3]
vtree_type = "balanced"
vtree = Vtree(var_count, var_order, vtree_type)
manager = SddManager.from_vtree(vtree)
# construct a formula (A^B)v(B^C)v(C^D)... | #!/usr/bin/env python3
from pysdd.sdd import SddManager, Vtree
def main():
# set up vtree and manager
var_count = 4
var_order = [2,1,4,3]
vtree_type = "balanced"
vtree = Vtree(var_count, var_order, vtree_type)
manager = SddManager.from_vtree(vtree)
# construct a formula (A^B)v(B^C)v(C^D)... | en | 003595661_wannesm-PySDD_test-1_e6dc43377230.py | unknown | 290 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | en | 004827577_GoogleCloudPlatform-python-docs-samples_snippets_test_0ad7ae2f944d.py | unknown | 2,444 |
import struct
from armulator.armv6.memory_types import MEMORY_TYPE_DICT
LENGTH_FORMATS = {
1: 'B',
2: '<H',
4: '<I',
8: '<Q',
}
def to_int(bytes_: bytes, length: int) -> int:
return struct.unpack(LENGTH_FORMATS[length], bytes_)[0]
def from_int(int_: int, length: int) -> bytes:
return struc... | import struct
from armulator.armv6.memory_types import MEMORY_TYPE_DICT
LENGTH_FORMATS = {
1: 'B',
2: '<H',
4: '<I',
8: '<Q',
}
def to_int(bytes_: bytes, length: int) -> int:
return struct.unpack(LENGTH_FORMATS[length], bytes_)[0]
def from_int(int_: int, length: int) -> bytes:
return struc... | en | 001323873_matan1008-armulator_memory_controller_hub_c0a379dbac44.py | unknown | 748 |
import asyncio
import copy
import math
import typing
from decimal import Decimal
from enum import Enum
from typing import Any, Dict, NamedTuple, Optional, Tuple
from async_timeout import timeout
from hummingbot.core.data_type.common import OrderType, PositionAction, TradeType
from hummingbot.core.data_type.limit_orde... | import asyncio
import copy
import math
import typing
from decimal import Decimal
from enum import Enum
from typing import Any, Dict, NamedTuple, Optional, Tuple
from async_timeout import timeout
from hummingbot.core.data_type.common import OrderType, PositionAction, TradeType
from hummingbot.core.data_type.limit_orde... | en | 000880773_CoinAlpha-hummingbot_in_flight_order_793726d24e4f.py | unknown | 4,009 |
import tkinter as tk
RELIEFS = [tk.SUNKEN, tk.RAISED, tk.GROOVE, tk.RIDGE, tk.FLAT]
class ButtonsApp(tk.Tk):
def __init__(self):
super().__init__()
self.img = tk.PhotoImage(file="python.gif")
self.btn = tk.Button(self, text="Button with image",
image=self.img, ... | import tkinter as tk
RELIEFS = [tk.SUNKEN, tk.RAISED, tk.GROOVE, tk.RIDGE, tk.FLAT]
class ButtonsApp(tk.Tk):
def __init__(self):
super().__init__()
self.img = tk.PhotoImage(file="python.gif")
self.btn = tk.Button(self, text="Button with image",
image=self.img, ... | en | 000739694_PacktPublishing-Tkinter-GUI-Application-Development-Cookbook_chapter1_02_c01734bc9a7f.py | unknown | 272 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
from os import path
from setuptools import setup
def read(fname):
with open(fname, "r") as fhandle:
return fhandle.read()
local_path = os.path.dirname(__file__)
# Fix for tox which manipulates execution pathing
if not local_path:
lo... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
from os import path
from setuptools import setup
def read(fname):
with open(fname, "r") as fhandle:
return fhandle.read()
local_path = os.path.dirname(__file__)
# Fix for tox which manipulates execution pathing
if not local_path:
lo... | en | 000508426_nteract-scrapbook_setup_0ed0939ec100.py | unknown | 859 |
from mock import patch
@patch('path.to.module.S3Library')
def test_stores_data_in_s3(S3Library):
my_method(data)
assert S3Library.upload_file.called_once_with(data)
@patch('path.to.module.S3Library')
def test_data_contains_some_value(S3Library):
S3Library.get_file.return_value = _stub_data()
xml_file ... | from mock import patch
@patch('path.to.module.S3Library')
def test_stores_data_in_s3(S3Library):
my_method(data)
assert S3Library.upload_file.called_once_with(data)
@patch('path.to.module.S3Library')
def test_data_contains_some_value(S3Library):
S3Library.get_file.return_value = _stub_data()
xml_file ... | en | 002163836_gistable-gistable_snippet_4de35cf91bbe.py | unknown | 172 |
# SPDX-License-Identifier: MIT
import struct
from m1n1.hw.dart import DART
from m1n1.hw.ane import ANERegs, ANEDARTRegs, ANETaskManager
class ANE:
PAGE_SIZE = 0x4000
TILE_SIZE = 0x4000
def __init__(self, u):
self.u = u
self.p = u.proxy
self.name = "ane"
self.p.pmgr_adt_clocks_enable(f'/arm-io/{self.na... | # SPDX-License-Identifier: MIT
import struct
from m1n1.hw.dart import DART
from m1n1.hw.ane import ANERegs, ANEDARTRegs, ANETaskManager
class ANE:
PAGE_SIZE = 0x4000
TILE_SIZE = 0x4000
def __init__(self, u):
self.u = u
self.p = u.proxy
self.name = "ane"
self.p.pmgr_adt_clocks_enable(f'/arm-io/{self.na... | en | 001735016_AsahiLinux-m1n1_ane_4c1f02a55162.py | unknown | 2,842 |
"""
A list of helper functions that cleanup the processing in IntrinsicResolver and IntrinsicSymbolTable
"""
from samcli.lib.intrinsic_resolver.invalid_intrinsic_exception import InvalidIntrinsicException
def verify_intrinsic_type_bool(argument, property_type="", message="", position_in_list=""):
verify_intrinsic... | """
A list of helper functions that cleanup the processing in IntrinsicResolver and IntrinsicSymbolTable
"""
from samcli.lib.intrinsic_resolver.invalid_intrinsic_exception import InvalidIntrinsicException
def verify_intrinsic_type_bool(argument, property_type="", message="", position_in_list=""):
verify_intrinsic... | en | 003383743_aws-aws-sam-cli_invalid_intrinsic_validation_b5116312540b.py | unknown | 791 |
""" Utility for printing route mapping from VPR route output to xc7 db. """
import argparse
import lib.rr_graph_xml.graph2 as xml_graph2
from lib.rr_graph_xml.utils import read_xml_file
from fasm2bels.net_map import create_net_list
import json
import sqlite3
def main():
parser = argparse.ArgumentParser(descriptio... | """ Utility for printing route mapping from VPR route output to xc7 db. """
import argparse
import lib.rr_graph_xml.graph2 as xml_graph2
from lib.rr_graph_xml.utils import read_xml_file
from fasm2bels.net_map import create_net_list
import json
import sqlite3
def main():
parser = argparse.ArgumentParser(descriptio... | en | 000879311_f4pga-f4pga-arch-defs_prjxray_print_net_map_5e5c58e6460e.py | unknown | 329 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | en | 001682358_pulumi-pulumi-alicloud_get_gateway_block_volumes_592720c8e018.py | unknown | 2,306 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | en | 003943944_pulumi-pulumi-alicloud_outputs_0cdf6172e833.py | unknown | 7,466 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | en | 001550203_apache-kudu_postflight_f63c2b7d358f.py | unknown | 907 |
import asyncio
import kopf
import kubernetes_asyncio
import logging
from agnosticvrepo import AgnosticVRepo
from agnosticvcomponent import AgnosticVComponent
from babylon import Babylon
from configure_kopf_logging import configure_kopf_logging
from infinite_relative_backoff import InfiniteRelativeBackoff
@kopf.on.sta... | import asyncio
import kopf
import kubernetes_asyncio
import logging
from agnosticvrepo import AgnosticVRepo
from agnosticvcomponent import AgnosticVComponent
from babylon import Babylon
from configure_kopf_logging import configure_kopf_logging
from infinite_relative_backoff import InfiniteRelativeBackoff
@kopf.on.sta... | en | 002447824_redhat-cop-babylon_operator_3abc78262029.py | unknown | 1,223 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2022 The Regents of the University of California
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2022 The Regents of the University of California
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
... | en | 001208133_NHERI-SimCenter-BRAILS_RoofTypeClassifier_a233f7805687.py | unknown | 987 |
from typing import Optional
from ..basesortingextractorinterface import BaseSortingExtractorInterface
from ....utils import FolderPathType
class PhySortingInterface(BaseSortingExtractorInterface):
"""Primary data interface class for converting Phy data. Uses
:py:class:`~spikeinterface.extractors.PhySortingEx... | from typing import Optional
from ..basesortingextractorinterface import BaseSortingExtractorInterface
from ....utils import FolderPathType
class PhySortingInterface(BaseSortingExtractorInterface):
"""Primary data interface class for converting Phy data. Uses
:py:class:`~spikeinterface.extractors.PhySortingEx... | en | 003387198_catalystneuro-neuroconv_phydatainterface_49919e3b36e7.py | unknown | 252 |
"""Read and write Jupyter notebooks as text files"""
from .formats import NOTEBOOK_EXTENSIONS, get_format_implementation, guess_format
from .jupytext import read, reads, write, writes
from .reraise import reraise
from .version import __version__
try:
from .contentsmanager import build_jupytext_contents_manager_cl... | """Read and write Jupyter notebooks as text files"""
from .formats import NOTEBOOK_EXTENSIONS, get_format_implementation, guess_format
from .jupytext import read, reads, write, writes
from .reraise import reraise
from .version import __version__
try:
from .contentsmanager import build_jupytext_contents_manager_cl... | en | 002248759_mwouts-jupytext_init_c514d3e2c630.py | unknown | 1,112 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | en | 005546275_amzn-MXFusion_util_66dfba63038e.py | unknown | 1,118 |
import base64
import os
import random
import re
import string
import time
import xml.sax.saxutils
import requests.exceptions as req_exc
from libs import jenkinslib, quik
from .BasePlugin import BasePlugin, HijackStdOut
class NonCriticalException(Exception):
pass
def xmlescape(data):
return xml.sax.saxuti... | import base64
import os
import random
import re
import string
import time
import xml.sax.saxutils
import requests.exceptions as req_exc
from libs import jenkinslib, quik
from .BasePlugin import BasePlugin, HijackStdOut
class NonCriticalException(Exception):
pass
def xmlescape(data):
return xml.sax.saxuti... | en | 003686489_Accenture-jenkins-attack-framework_plugin_DumpCredsViaJob_0909e3ea5412.py | unknown | 3,983 |
# -*- coding: utf-8 -*-
"""Provides strategy supply source object."""
from __future__ import absolute_import
from ..entity import Entity
class StrategySupplySource(Entity):
"""StrategySupplySource object, for strategies targeting not-all-exchanges."""
collection = 'strategy_supply_sources'
resource = 'st... | # -*- coding: utf-8 -*-
"""Provides strategy supply source object."""
from __future__ import absolute_import
from ..entity import Entity
class StrategySupplySource(Entity):
"""StrategySupplySource object, for strategies targeting not-all-exchanges."""
collection = 'strategy_supply_sources'
resource = 'st... | en | 005502271_MediaMath-t1-python_strategysupplysource_e1029563a3d2.py | unknown | 199 |
"""
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
"""
import collections.abc
import datetime
import gc
import logging
import salt.loader.context
import salt.transport.frame
import salt.utils.immutabletypes as immu... | """
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
"""
import collections.abc
import datetime
import gc
import logging
import salt.loader.context
import salt.transport.frame
import salt.utils.immutabletypes as immu... | en | 000672054_saltstack-salt_payload_8db99fab2625.py | unknown | 3,816 |
import collections.abc
import json
import logging
import logging.config
from enum import IntEnum
import os
import tempfile
import time
import types
from typing import Any, Union, cast
import rich
from rich.console import Console
try:
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
except Imp... | import collections.abc
import json
import logging
import logging.config
from enum import IntEnum
import os
import tempfile
import time
import types
from typing import Any, Union, cast
import rich
from rich.console import Console
try:
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
except Imp... | en | 003118139_onecommons-unfurl_logs_f8ecd1c9e7d5.py | unknown | 2,811 |
"""Interpolate gap between two functions"""
# https://www.youtube.com/watch?v=vD5g8aVscUI
import numpy as np
from vedo.pyplot import plot
from vedo import settings
settings.remember_last_figure_format = True # useful for pf += plot(...)
x1 = np.linspace(-2,2, num=100)
x = np.linspace(-2,2, num=100)
x2 = np.linspace(... | """Interpolate gap between two functions"""
# https://www.youtube.com/watch?v=vD5g8aVscUI
import numpy as np
from vedo.pyplot import plot
from vedo import settings
settings.remember_last_figure_format = True # useful for pf += plot(...)
x1 = np.linspace(-2,2, num=100)
x = np.linspace(-2,2, num=100)
x2 = np.linspace(... | en | 004426425_marcomusy-vedo_fill_gap_cebd60b09110.py | unknown | 404 |
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class UserError(Exception):
"""
This class is for "expected" errors, which should fail this invocation of the
tool, contain an error message suitable for printing to the us... | # Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class UserError(Exception):
"""
This class is for "expected" errors, which should fail this invocation of the
tool, contain an error message suitable for printing to the us... | en | 005018986_chromium-chromium_errors_3562297961ee.py | unknown | 167 |
"""
This module contains routines for loading MAVEN data.
"""
from .maven_load import load_data
import pyspedas.maven.spdf as spdf_load
def maven_load(filenames=None,
instruments=None,
level='l2',
type=None,
insitu=True,
iuvs=False,
... | """
This module contains routines for loading MAVEN data.
"""
from .maven_load import load_data
import pyspedas.maven.spdf as spdf_load
def maven_load(filenames=None,
instruments=None,
level='l2',
type=None,
insitu=True,
iuvs=False,
... | en | 001301191_spedas-pyspedas_init_73425448006e.py | unknown | 3,643 |
from typing import AnyStr, List
from pyre_extensions import safe_json
from backend.common.datafeed_parsers.exceptions import ParserInputException
from backend.common.models.alliance import EventAlliance
from backend.common.models.keys import TeamKey
from backend.common.models.team import Team
class JSONAllianceSele... | from typing import AnyStr, List
from pyre_extensions import safe_json
from backend.common.datafeed_parsers.exceptions import ParserInputException
from backend.common.models.alliance import EventAlliance
from backend.common.models.keys import TeamKey
from backend.common.models.team import Team
class JSONAllianceSele... | en | 002645860_the-blue-alliance-the-blue-alliance_json_alliance_selections_parser_ae2119c5b483.py | unknown | 386 |
"""Python interfaces to DGL farthest point sampler."""
import numpy as np
from .. import backend as F, ndarray as nd
from .._ffi.base import DGLError
from .._ffi.function import _init_api
def _farthest_point_sampler(
data, batch_size, sample_points, dist, start_idx, result
):
r"""Farthest Point Sampler
... | """Python interfaces to DGL farthest point sampler."""
import numpy as np
from .. import backend as F, ndarray as nd
from .._ffi.base import DGLError
from .._ffi.function import _init_api
def _farthest_point_sampler(
data, batch_size, sample_points, dist, start_idx, result
):
r"""Farthest Point Sampler
... | en | 000531358_dmlc-dgl_capi_4f3183648a4c.py | unknown | 1,202 |
"""Helpers to check and fix issues with free space."""
import logging
from ...backups.const import BackupType
from ...coresys import CoreSys
from ..const import MINIMUM_FULL_BACKUPS, ContextType, IssueType, SuggestionType
from .base import FixupBase
_LOGGER: logging.Logger = logging.getLogger(__name__)
def setup(co... | """Helpers to check and fix issues with free space."""
import logging
from ...backups.const import BackupType
from ...coresys import CoreSys
from ..const import MINIMUM_FULL_BACKUPS, ContextType, IssueType, SuggestionType
from .base import FixupBase
_LOGGER: logging.Logger = logging.getLogger(__name__)
def setup(co... | en | 005241472_home-assistant-supervisor_system_clear_full_backup_818975bb957f.py | unknown | 420 |
from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, Float
from sixteen.models import BaseData
class BaseDate(object):
create_at = Column(DateTime, nullable=False, default=datetime.utcnow)
update_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datet... | from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, Float
from sixteen.models import BaseData
class BaseDate(object):
create_at = Column(DateTime, nullable=False, default=datetime.utcnow)
update_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datet... | en | 001276059_menhuan-notes_Tables_e6e012a1eb6a.py | unknown | 340 |
"""
Code to support database helper scripts (create_toolshed_db.py, migrate_toolshed_db.py, etc...).
"""
import argparse
import logging
import os
import sys
import alembic.config
from galaxy.model.migrations import (
GXY,
TSI,
)
from galaxy.model.migrations.scripts import get_configuration
from galaxy.util.pa... | """
Code to support database helper scripts (create_toolshed_db.py, migrate_toolshed_db.py, etc...).
"""
import argparse
import logging
import os
import sys
import alembic.config
from galaxy.model.migrations import (
GXY,
TSI,
)
from galaxy.model.migrations.scripts import get_configuration
from galaxy.util.pa... | en | 005216615_galaxyproject-galaxy_scripts_dd54b521b03e.py | unknown | 1,983 |
import os
import json
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def locate_package_json():
"""
Find and return the location of package.json.
"""
directory = settings.SYSTEMJS_PACKAGE_JSON_DIR
if not directory:
raise ImproperlyConfigured(
... | import os
import json
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def locate_package_json():
"""
Find and return the location of package.json.
"""
directory = settings.SYSTEMJS_PACKAGE_JSON_DIR
if not directory:
raise ImproperlyConfigured(
... | en | 004740717_sergei-maertens-django-systemjs_jspm_67b0ac54af9d.py | unknown | 549 |
import demistomock as demisto
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
def _get_incident():
return demisto.incidents()[0]
def iot_resolve_vuln():
incident = _get_incident()
zb_ticketid = ""
vulnerability_name = ""
for label in incident['labels']:
if labe... | import demistomock as demisto
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
def _get_incident():
return demisto.incidents()[0]
def iot_resolve_vuln():
incident = _get_incident()
zb_ticketid = ""
vulnerability_name = ""
for label in incident['labels']:
if labe... | en | 002954690_demisto-content_iot_vuln_post_processing_de305dd061da.py | unknown | 358 |
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distri... | # ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distri... | en | 002636360_spiraloid-Spiraloid-Toolkit-for-Blender_brush_quickset_9d4bf8d33dc5.py | unknown | 6,695 |
# ---------------------------------------------------------------------
# Local Authentication backend
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NO... | # ---------------------------------------------------------------------
# Local Authentication backend
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NO... | en | 001238365_nocproject-noc_local_cce74898f894.py | unknown | 307 |
import re
import tkinter as tk
class App(tk.Tk):
def __init__(self):
super().__init__()
self.pattern = re.compile("^\w{0,10}$")
self.label = tk.Label(self, text="Enter your username")
vcmd = (self.register(self.validate_username), "%i", "%P")
self.entry = tk.Entry(self, vali... | import re
import tkinter as tk
class App(tk.Tk):
def __init__(self):
super().__init__()
self.pattern = re.compile("^\w{0,10}$")
self.label = tk.Label(self, text="Enter your username")
vcmd = (self.register(self.validate_username), "%i", "%P")
self.entry = tk.Entry(self, vali... | en | 005500491_PacktPublishing-Tkinter-GUI-Application-Development-Cookbook_chapter1_05_d7a85b02bc53.py | unknown | 243 |
"""
data_collection.py
===================
Description:
Author:
Usage:
"""
from .preprocess import save_data_frame
import os
import pickle
import pandas as pd
from .training import linear_array_from_image_file, image_data
def pickle_load(pickled_file):
"""
This function...
:param pickled_file:
:re... | """
data_collection.py
===================
Description:
Author:
Usage:
"""
from .preprocess import save_data_frame
import os
import pickle
import pandas as pd
from .training import linear_array_from_image_file, image_data
def pickle_load(pickled_file):
"""
This function...
:param pickled_file:
:re... | en | 003878826_BRAINSia-BRAINSTools_data_collection_95f4bbea4af1.py | unknown | 681 |
from __future__ import annotations
from typing import TYPE_CHECKING
from grouper.constants import USER_ADMIN, USER_DISABLE
from grouper.email_util import cancel_async_emails
from grouper.fe.alerts import Alert
from grouper.fe.util import GrouperHandler
from grouper.models.audit_log import AuditLog
from grouper.models... | from __future__ import annotations
from typing import TYPE_CHECKING
from grouper.constants import USER_ADMIN, USER_DISABLE
from grouper.email_util import cancel_async_emails
from grouper.fe.alerts import Alert
from grouper.fe.util import GrouperHandler
from grouper.models.audit_log import AuditLog
from grouper.models... | en | 002413284_dropbox-merou_user_disable_91367e3940c3.py | unknown | 717 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import bounding_box
from compas.geometry import bounding_box_xy
def mesh_bounding_box(mesh):
"""Compute the (axis aligned) bounding box of a mesh.
Parameters
----------
m... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import bounding_box
from compas.geometry import bounding_box_xy
def mesh_bounding_box(mesh):
"""Compute the (axis aligned) bounding box of a mesh.
Parameters
----------
m... | en | 003551520_compas-dev-compas_bbox_2e153876bb71.py | unknown | 740 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Unit tests for the ninja.py file. """
import unittest
import sys
import gyp.NinjaWriter
class TestPrefixesAndSuffixes(unittest.TestC... | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Unit tests for the ninja.py file. """
import unittest
import sys
import gyp.NinjaWriter
class TestPrefixesAndSuffixes(unittest.TestC... | en | 000427422_arangodb-arangodb_NinjaWriter_test_fe76eff43128.py | unknown | 628 |
"""
modules/xrenner_preprocess.py
Prepare parser output for entity and coreference resolution
Author: Amir Zeldes
"""
from .xrenner_marker import lookup_has_entity
def add_negated_parents(conll_tokens, offset):
"""
Sets the neg_parent property on tokens whose head dominates a negation
:param conll_tokens: token... | """
modules/xrenner_preprocess.py
Prepare parser output for entity and coreference resolution
Author: Amir Zeldes
"""
from .xrenner_marker import lookup_has_entity
def add_negated_parents(conll_tokens, offset):
"""
Sets the neg_parent property on tokens whose head dominates a negation
:param conll_tokens: token... | en | 001433136_amir-zeldes-HebPipe_xrenner_preprocess_fa148c60f0d8.py | unknown | 1,925 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import torch
__all__ = [
"StatisticsSubscriber",
"GlobalSubscr... | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import torch
__all__ = [
"StatisticsSubscriber",
"GlobalSubscr... | en | 004236737_microsoft-onnxruntime_init_0436b096571c.py | unknown | 306 |
"""Japanese vowels dataset."""
# Author: Nathan Trouvain at 07/05/2022 <nathan.trouvain@inria.fr>
# Licence: MIT License
# Copyright: Xavier Hinaut (2018) <xavier.hinaut@inria.fr>
import io
import zipfile
from urllib.request import urlopen
import numpy as np
from .. import logger
from ._utils import _get_data_folder
... | """Japanese vowels dataset."""
# Author: Nathan Trouvain at 07/05/2022 <nathan.trouvain@inria.fr>
# Licence: MIT License
# Copyright: Xavier Hinaut (2018) <xavier.hinaut@inria.fr>
import io
import zipfile
from urllib.request import urlopen
import numpy as np
from .. import logger
from ._utils import _get_data_folder
... | en | 000319641_reservoirpy-reservoirpy_japanese_vowels_4bb80fc336a0.py | unknown | 1,602 |
from typing import List
from typing import Dict
from botocore.paginate import Paginator
class DescribeEnvironmentMemberships(Paginator):
def paginate(self, userArn: str = None, environmentId: str = None, permissions: List = None, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that... | from typing import List
from typing import Dict
from botocore.paginate import Paginator
class DescribeEnvironmentMemberships(Paginator):
def paginate(self, userArn: str = None, environmentId: str = None, permissions: List = None, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that... | en | 005219412_alliefitter-boto3_type_annotations_paginator_a58994e6e997.py | unknown | 1,403 |
"""Base class for all parsers."""
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Callable, Iterator, List, Optional, TextIO, Tuple
@dataclass
class ColumnReference:
"""A way of indexing a column."""
index: Optional[int] = None
"""Number of the column (zero-b... | """Base class for all parsers."""
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Callable, Iterator, List, Optional, TextIO, Tuple
@dataclass
class ColumnReference:
"""A way of indexing a column."""
index: Optional[int] = None
"""Number of the column (zero-b... | en | 003170846_INCATools-ontology-access-kit_parser_base_c655f384f297.py | unknown | 369 |
# Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend # noqa
from typing import List, Tuple
import torch
import torch.nn.functional as F
from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
from torch import Tensor
f... | # Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend # noqa
from typing import List, Tuple
import torch
import torch.nn.functional as F
from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
from torch import Tensor
f... | en | 003442473_alldatacenter-alldata_point_rend_roi_head_4ba67dcb54e1.py | unknown | 3,007 |
from typing import Any, Optional, Dict
from fastapi import Query
from maggma.api.query_operator import QueryOperator
from maggma.api.utils import STORE_PARAMS
class RedoxPotentialQuery(QueryOperator):
"""
Method to generate a query on redox potentials.
"""
def query(
self,
min_reducti... | from typing import Any, Optional, Dict
from fastapi import Query
from maggma.api.query_operator import QueryOperator
from maggma.api.utils import STORE_PARAMS
class RedoxPotentialQuery(QueryOperator):
"""
Method to generate a query on redox potentials.
"""
def query(
self,
min_reducti... | en | 000544504_materialsproject-emmet_query_operators_64714cda8eee.py | unknown | 420 |
import pathlib
import cv2
import numpy as np
import kornia.utils
import torch.utils.data
import torchvision.transforms.functional
from PIL import Image
class JointTrainData(torch.utils.data.Dataset):
"""
Load dataset with infrared folder path and visible folder path
"""
def __init__(self, ir_folder:... | import pathlib
import cv2
import numpy as np
import kornia.utils
import torch.utils.data
import torchvision.transforms.functional
from PIL import Image
class JointTrainData(torch.utils.data.Dataset):
"""
Load dataset with infrared folder path and visible folder path
"""
def __init__(self, ir_folder:... | en | 003893033_Linfeng-Tang-VIF-Benchmark_joint_data_5b2565e59738.py | unknown | 1,717 |
# ----------------------------------------------------------------------
# drop activator
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
f... | # ----------------------------------------------------------------------
# drop activator
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
f... | en | 002773573_nocproject-noc_0106_drop_activator_f7a5a28ec514.py | unknown | 169 |
#!/usr/bin/env python
from sqlalchemy import Column, Float, Index, Integer, Text
from . import HummingbotBase
class RangePositionCollectedFees(HummingbotBase):
"""
Table schema used when LP feesmare claimed.
"""
__tablename__ = "RangePositionCollectedFees"
__table_args__ = (Index("rpf_id_index",
... | #!/usr/bin/env python
from sqlalchemy import Column, Float, Index, Integer, Text
from . import HummingbotBase
class RangePositionCollectedFees(HummingbotBase):
"""
Table schema used when LP feesmare claimed.
"""
__tablename__ = "RangePositionCollectedFees"
__table_args__ = (Index("rpf_id_index",
... | en | 004893903_CoinAlpha-hummingbot_range_position_collected_fees_2bc3e16af209.py | unknown | 365 |
#vtkOpsClass.py
#Description: HEAT module to create vtk objects (.vtk,.vtp, etc.)
#Engineer: T Looby
#Date: 20221108
import vtk
from vtk.util.numpy_support import vtk_to_numpy as vtk2np
import sys
import numpy as np
import logging
log = logging.getLogger(__name__)
class VTKops:
def __init__(self):... | #vtkOpsClass.py
#Description: HEAT module to create vtk objects (.vtk,.vtp, etc.)
#Engineer: T Looby
#Date: 20221108
import vtk
from vtk.util.numpy_support import vtk_to_numpy as vtk2np
import sys
import numpy as np
import logging
log = logging.getLogger(__name__)
class VTKops:
def __init__(self):... | en | 001232477_plasmapotential-HEAT_vtkOpsClass_510a371c2ec7.py | unknown | 1,937 |
#
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
#
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | en | 000429143_Xilinx-Vitis-AI_quant_config_imp_dfd0a8efde73.py | unknown | 4,715 |
def data_ref_type_str(dref_enum):
"""
Translate an ``enum DataRefTypes`` value into a string representation.
"""
if dref_enum == 0x9000:
return "unknown"
elif dref_enum == 0x9001:
return "integer"
elif dref_enum == 0x9002:
return "fp"
elif dref_enum == 0x9003:
... | def data_ref_type_str(dref_enum):
"""
Translate an ``enum DataRefTypes`` value into a string representation.
"""
if dref_enum == 0x9000:
return "unknown"
elif dref_enum == 0x9001:
return "integer"
elif dref_enum == 0x9002:
return "fp"
elif dref_enum == 0x9003:
... | en | 000266051_angr-pyvex_data_ref_adf81469e0a6.py | unknown | 565 |
import requests as req
from lxml import html
import unicodedata
import re
import numpy as np
import six
from pyqchem.structure import atom_data
from copy import deepcopy
def _txt_to_basis_dict(basis_txt):
"""
read basis in gaussian/qchem format
:param basis_txt: string containing the basis set in gaussia... | import requests as req
from lxml import html
import unicodedata
import re
import numpy as np
import six
from pyqchem.structure import atom_data
from copy import deepcopy
def _txt_to_basis_dict(basis_txt):
"""
read basis in gaussian/qchem format
:param basis_txt: string containing the basis set in gaussia... | en | 000810600_abelcarreras-PyQchem_basis_565c6cf42dd6.py | unknown | 3,192 |
t = ["m3m2"]
__all__ = ["m3m1"]
__all__.extend(t)
def m3m1():
pass
def m3m2():
pass
def m3m3():
pass | t = ["m3m2"]
__all__ = ["m3m1"]
__all__.extend(t)
def m3m1():
pass
def m3m2():
pass
def m3m3():
pass | en | 001342627_JetBrains-intellij-community_m3_6f351a7a33e6.py | unknown | 62 |
"""Uses Ray's RLlib to view trained agents playing Pistonball.
Author: Rohan (https://github.com/Rohan138)
"""
import argparse
import os
import ray
import supersuit as ss
from PIL import Image
from ray.rllib.algorithms.ppo import PPO
from ray.rllib.env.wrappers.pettingzoo_env import PettingZooEnv
from ray.rllib.mode... | """Uses Ray's RLlib to view trained agents playing Pistonball.
Author: Rohan (https://github.com/Rohan138)
"""
import argparse
import os
import ray
import supersuit as ss
from PIL import Image
from ray.rllib.algorithms.ppo import PPO
from ray.rllib.env.wrappers.pettingzoo_env import PettingZooEnv
from ray.rllib.mode... | en | 001977521_Farama-Foundation-PettingZoo_render_rllib_pistonball_b8ab7daa5d40.py | unknown | 865 |
#
# Copyright (c) 2017 cTuning foundation.
# See CK COPYRIGHT.txt for copyright details.
#
# SPDX-License-Identifier: BSD-3-Clause.
# See CK LICENSE.txt for licensing details.
#
# Convert raw output of an armcl to the CK format.
#
# Developer(s):
# - Anton Lokhmotov, dividiti, 2017
# - Grigori Fursin, cTuning found... | #
# Copyright (c) 2017 cTuning foundation.
# See CK COPYRIGHT.txt for copyright details.
#
# SPDX-License-Identifier: BSD-3-Clause.
# See CK LICENSE.txt for licensing details.
#
# Convert raw output of an armcl to the CK format.
#
# Developer(s):
# - Anton Lokhmotov, dividiti, 2017
# - Grigori Fursin, cTuning found... | en | 000201917_ctuning-ck-math_process_4158827daa14.py | unknown | 459 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# pylint: disable=unused-argument
from marshmallow import fields
from marshmallow.decorators import post_load
from azure.ai.ml.constants.... | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# pylint: disable=unused-argument
from marshmallow import fields
from marshmallow.decorators import post_load
from azure.ai.ml.constants.... | en | 004741211_Azure-azure-sdk-for-python_synapsespark_compute_3521a63538ff.py | unknown | 455 |
from lxml import etree
from jinja2 import Environment, FileSystemLoader
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
import time
def fetch_object(url):
"""
Fetch single BrAPI object by path
"""
print(' GET ' + url)
session = requests.Session()
... | from lxml import etree
from jinja2 import Environment, FileSystemLoader
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
import time
def fetch_object(url):
"""
Fetch single BrAPI object by path
"""
print(' GET ' + url)
session = requests.Session()
... | en | 000025914_usegalaxy-eu-ena-upload-cli_xml_converter_fc5ed73339be.py | unknown | 799 |
import pytest
from asdf import util
from asdf._types import CustomType
from asdf.exceptions import AsdfDeprecationWarning
from ._helpers import get_test_data_path
with pytest.warns(AsdfDeprecationWarning, match=".*subclasses the deprecated CustomType.*"):
class CustomTestType(CustomType):
"""This class ... | import pytest
from asdf import util
from asdf._types import CustomType
from asdf.exceptions import AsdfDeprecationWarning
from ._helpers import get_test_data_path
with pytest.warns(AsdfDeprecationWarning, match=".*subclasses the deprecated CustomType.*"):
class CustomTestType(CustomType):
"""This class ... | en | 002271171_asdf-format-asdf_objects_13a66dd3e9d3.py | unknown | 363 |
#!/usr/bin/env python
# Standard Python libraries.
import argparse
# Third party Python libraries.
# Custom Python libraries.
# BASH command to generate nmap_top_ports_PROTOCOL.txt files.
r"""
egrep /tcp /usr/share/nmap/nmap-services | sort -r -k3 | sed 's/[\t ]/,/g' \
| cut -d "," -f 2 | cut -f 1 -d "/" > nm... | #!/usr/bin/env python
# Standard Python libraries.
import argparse
# Third party Python libraries.
# Custom Python libraries.
# BASH command to generate nmap_top_ports_PROTOCOL.txt files.
r"""
egrep /tcp /usr/share/nmap/nmap-services | sort -r -k3 | sed 's/[\t ]/,/g' \
| cut -d "," -f 2 | cut -f 1 -d "/" > nm... | en | 002707457_opsdisk-scantron_nmap_port_range_carver_e3847c9f9999.py | unknown | 941 |
import os
from torch.optim import Adam
import rainy
from rainy.envs import ClassicControl, MultiProcEnv
@rainy.main(rainy.agents.A2CAgent, script_path=os.path.realpath(__file__))
def main(
envname: str = "CartPole-v0", rnn: bool = False, use_gae: bool = False
) -> rainy.Config:
c = rainy.Config()
c.set_... | import os
from torch.optim import Adam
import rainy
from rainy.envs import ClassicControl, MultiProcEnv
@rainy.main(rainy.agents.A2CAgent, script_path=os.path.realpath(__file__))
def main(
envname: str = "CartPole-v0", rnn: bool = False, use_gae: bool = False
) -> rainy.Config:
c = rainy.Config()
c.set_... | en | 005227040_kngwyu-Rainy_a2c_cartpole_2e88c2f0e47f.py | unknown | 346 |
# Copyright 2020 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright 2020 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | en | 003347790_GoogleCloudPlatform-PerfKitBenchmarker_ibmcloud_network_8000c64cb521.py | unknown | 3,590 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'NotificationChannelInsightSeverity',
'NotificationChannelNotificationMessageType',
'ResourceCollectionT... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'NotificationChannelInsightSeverity',
'NotificationChannelNotificationMessageType',
'ResourceCollectionT... | en | 003694041_pulumi-pulumi-aws-native_enums_ab110576967b.py | unknown | 304 |
"""File to modify the playlists."""
from playx.logger import Logger
from playx.stringutils import remove_duplicates
# Setup logger
logger = Logger("PlaylistBase")
class SongMetadataBase:
"""
Base class to store song metadata.
"""
def __init__(self, title=None, url=None, query=None):
self.... | """File to modify the playlists."""
from playx.logger import Logger
from playx.stringutils import remove_duplicates
# Setup logger
logger = Logger("PlaylistBase")
class SongMetadataBase:
"""
Base class to store song metadata.
"""
def __init__(self, title=None, url=None, query=None):
self.... | en | 000112993_NISH1001-playx_playlistbase_e5805b7f38d7.py | unknown | 734 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = 'liao gao xiang'
class Fib(object):
""""""
def __init__(self, n):
self.pre = 0
self.cur = 1
self.n = n
def __iter__(self):
return self
def __next__(self):
if self.n < 0:
self.pre, self.cu... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = 'liao gao xiang'
class Fib(object):
""""""
def __init__(self, n):
self.pre = 0
self.cur = 1
self.n = n
def __iter__(self):
return self
def __next__(self):
if self.n < 0:
self.pre, self.cu... | en | 000831697_liaogx-python3-cookbook_9.7_49848c61c486.py | unknown | 160 |
#!/usr/bin/env python3
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | #!/usr/bin/env python3
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | en | 001514970_GoogleCloudPlatform-marketplace-k8s-app-tools_print_published_version_93fc65cb92a9.py | unknown | 498 |
# Copyright (c) 2016-2019 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2016-2019 Ashley Whetter <ashley@awhetter.co.uk>
# Copyright (c) 2016 Yuri Bochkarev <baltazar.bz@gmail.com>
# Copyright (c) 2016 Glenn Matthews <glenn@e-dad.net>
# Copyright (c) 2016 Moises Lopez <moylop260@vauxoo.com>
# Copyright (c) 2017 ... | # Copyright (c) 2016-2019 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2016-2019 Ashley Whetter <ashley@awhetter.co.uk>
# Copyright (c) 2016 Yuri Bochkarev <baltazar.bz@gmail.com>
# Copyright (c) 2016 Glenn Matthews <glenn@e-dad.net>
# Copyright (c) 2016 Moises Lopez <moylop260@vauxoo.com>
# Copyright (c) 2017 ... | en | 004421969_pran01-AlgoVision_check_docs_utils_def5e596739f.py | unknown | 6,990 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.