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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def __init_... | #!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def __init_... | en | 004968041_thezakman-CTF-Heaven_takeover_aee3deea39f6.py | unknown | 285 |
# -*- coding: utf-8 -*-
from plivo.utils.validators import *
from ..base import ListResponseObject, PlivoResource, PlivoResourceInterface
from ..exceptions import *
from ..utils import *
class Message(PlivoResource):
_name = 'Message'
_identifier_string = 'message_uuid'
def get(self):
return sel... | # -*- coding: utf-8 -*-
from plivo.utils.validators import *
from ..base import ListResponseObject, PlivoResource, PlivoResourceInterface
from ..exceptions import *
from ..utils import *
class Message(PlivoResource):
_name = 'Message'
_identifier_string = 'message_uuid'
def get(self):
return sel... | en | 004749375_plivo-plivo-python_messages_6ba903f32289.py | unknown | 1,626 |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... | en | 002247805_TencentBlueKing-bk-nodeman_meta_cdb7c5172227.py | unknown | 503 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from fairseq.data import (
data_utils,
Dictionary,
IdDataset,
OffsetTokensDatase... | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from fairseq.data import (
data_utils,
Dictionary,
IdDataset,
OffsetTokensDatase... | en | 003849552_CUMLSec-stateformer_data_structure_mf_4ec6f2b1a997.py | unknown | 2,034 |
"""Views for the node settings page."""
# -*- coding: utf-8 -*-
from dateutil.parser import parse as dateparse
from rest_framework import status as http_status
import logging
from flask import request, make_response
from framework.exceptions import HTTPError
from addons.base import generic_views
from addons.github.a... | """Views for the node settings page."""
# -*- coding: utf-8 -*-
from dateutil.parser import parse as dateparse
from rest_framework import status as http_status
import logging
from flask import request, make_response
from framework.exceptions import HTTPError
from addons.base import generic_views
from addons.github.a... | en | 004909327_CenterForOpenScience-osf.io_views_454c39bd829d.py | unknown | 2,586 |
class BoundaryConditions(Element,IDisposable):
""" An object that represents a force applied across an area. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def GetBoundaryConditionsType(self):
"""
GetBoundaryConditionsType(self: BoundaryConditions) -> BoundaryConditionsType
Retu... | class BoundaryConditions(Element,IDisposable):
""" An object that represents a force applied across an area. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def GetBoundaryConditionsType(self):
"""
GetBoundaryConditionsType(self: BoundaryConditions) -> BoundaryConditionsType
Retu... | en | 002212163_gtalarico-ironpython-stubs_BoundaryConditions_9df67dab3a44.py | unknown | 927 |
import torch
from kge import Config, Dataset
from kge.model.kge_model import KgeEmbedder, KgeModel, RelationalScorer
class RescalScorer(RelationalScorer):
r"""Implementation of the RESCAL KGE scorer."""
def __init__(self, config: Config, dataset: Dataset, configuration_key=None):
super().__init__(c... |
import torch
from kge import Config, Dataset
from kge.model.kge_model import KgeEmbedder, KgeModel, RelationalScorer
class RescalScorer(RelationalScorer):
r"""Implementation of the RESCAL KGE scorer."""
def __init__(self, config: Config, dataset: Dataset, configuration_key=None):
super().__init__(c... | en | 003164361_uma-pi1-kge_rescal_5e314b017aae.py | unknown | 909 |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import yaml
from betterboto import client as betterboto_client
from servicecatalog_factory import constants, environmental_variables
import functools
import logging
logger = logging.getLogger(__... | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import yaml
from betterboto import client as betterboto_client
from servicecatalog_factory import constants, environmental_variables
import functools
import logging
logger = logging.getLogger(__... | en | 000242112_awslabs-aws-service-catalog-factory_config_67c4c6804b3f.py | unknown | 1,108 |
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction, DEFAULT_DB_ALIAS
from django.db.models import signals
from api_indy.indy.credential import CredentialManager
from api_v2.models.Address import Address
from api_v2.models.Attribute import Attribute
from api_v2.models.C... | from django.core.management.base import BaseCommand, CommandError
from django.db import transaction, DEFAULT_DB_ALIAS
from django.db.models import signals
from api_indy.indy.credential import CredentialManager
from api_v2.models.Address import Address
from api_v2.models.Attribute import Attribute
from api_v2.models.C... | en | 001176468_bcgov-TheOrgBook_reprocess_credentials_65b1e716018f.py | unknown | 381 |
# /*
# * Copyright 2010-2017 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://aws.amazon.com/apache2.0
# *
# * or i... | # /*
# * Copyright 2010-2017 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://aws.amazon.com/apache2.0
# *
# * or i... | en | 000140525_aws-aws-iot-device-sdk-python_clients_59b94461d988.py | unknown | 3,133 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Title '''
__author__ = 'Hiroshi Kajino <KAJINO@jp.ibm.com>'
__copyright__ = 'Copyright IBM Corp. 2020, 2021'
from abc import abstractmethod
from typing import List
from numpy.random import default_rng
from torch import nn
import matplotlib.pyplot as plt
import numpy a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Title '''
__author__ = 'Hiroshi Kajino <KAJINO@jp.ibm.com>'
__copyright__ = 'Copyright IBM Corp. 2020, 2021'
from abc import abstractmethod
from typing import List
from numpy.random import default_rng
from torch import nn
import matplotlib.pyplot as plt
import numpy a... | en | 001136978_ibm-research-tokyo-diffsnn_base_3bac3581ec67.py | unknown | 2,893 |
# (C) Copyright IBM Corp. 2019, 2020, 2021, 2022.
# 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 app... | # (C) Copyright IBM Corp. 2019, 2020, 2021, 2022.
# 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 app... | en | 003540599_IBM-simulai_builtin_pytorch_8ac16ebbdae0.py | unknown | 2,090 |
#!/usr/bin/python3
async_mode = 'threading'
import time
from flask import Flask, render_template, abort
import socketio
from sys import stdin, stdout, stderr
import json
import time
from netaddr import IPNetwork, IPAddress
sio = socketio.Server(logger=False, async_mode=async_mode)
app = Flask(__name__)
app.wsgi_app ... | #!/usr/bin/python3
async_mode = 'threading'
import time
from flask import Flask, render_template, abort
import socketio
from sys import stdin, stdout, stderr
import json
import time
from netaddr import IPNetwork, IPAddress
sio = socketio.Server(logger=False, async_mode=async_mode)
app = Flask(__name__)
app.wsgi_app ... | en | 003820252_opennetworkinglab-onos_server_0aa129d79202.py | unknown | 694 |
import logging
import time
import traceback
import typing
import skein
from tf_yarn.topologies import ContainerKey
_logger = logging.getLogger(__name__)
def wait(client: skein.ApplicationClient, key: str) -> str:
"""
Wait for a key
"""
_logger.info("Waiting for " + key)
return client.kv.wait(ke... | import logging
import time
import traceback
import typing
import skein
from tf_yarn.topologies import ContainerKey
_logger = logging.getLogger(__name__)
def wait(client: skein.ApplicationClient, key: str) -> str:
"""
Wait for a key
"""
_logger.info("Waiting for " + key)
return client.kv.wait(ke... | en | 004873421_criteo-tf-yarn_event_68ef228705cf.py | unknown | 788 |
import os
import numpy as np
import extract_feats.opensmile as of
import extract_feats.librosa as lf
import models
import utils
def predict(config, audio_path: str, model) -> None:
"""
预测音频情感
Args:
config: 配置项
audio_path (str): 要预测的音频路径
model: 加载的模型
"""
# utils.play_audio(... | import os
import numpy as np
import extract_feats.opensmile as of
import extract_feats.librosa as lf
import models
import utils
def predict(config, audio_path: str, model) -> None:
"""
预测音频情感
Args:
config: 配置项
audio_path (str): 要预测的音频路径
model: 加载的模型
"""
# utils.play_audio(... | en | 002918945_Renovamen-Speech-Emotion-Recognition_predict_17e0405a8096.py | unknown | 382 |
from tableau_api_lib.api_endpoints import BaseEndpoint
class SubscriptionsEndpoint(BaseEndpoint):
def __init__(self,
ts_connection,
create_subscription=False,
query_subscriptions=False,
query_subscription=False,
update_subscripti... | from tableau_api_lib.api_endpoints import BaseEndpoint
class SubscriptionsEndpoint(BaseEndpoint):
def __init__(self,
ts_connection,
create_subscription=False,
query_subscriptions=False,
query_subscription=False,
update_subscripti... | en | 005518585_divinorum-webb-tableau-api-lib_subscriptions_endpoint_bd5d704096ad.py | unknown | 767 |
#! /usr/bin/env python
"""Module for the post-processing LOCI algorithm."""
__author__ = "Thomas Bédrine"
__all__ = ["LOCIBuilder", "PPLOCI"]
from typing import Optional
from dataclasses import dataclass
import numpy as np
from dataclass_builder import dataclass_builder
from .dataset import Dataset
from .postproc ... | #! /usr/bin/env python
"""Module for the post-processing LOCI algorithm."""
__author__ = "Thomas Bédrine"
__all__ = ["LOCIBuilder", "PPLOCI"]
from typing import Optional
from dataclasses import dataclass
import numpy as np
from dataclass_builder import dataclass_builder
from .dataset import Dataset
from .postproc ... | en | 001324478_vortex-exoplanet-VIP_pploci_87df7c0c5f59.py | unknown | 732 |
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.ext... | from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.ext... | en | 000923648_BingAds-BingAds-Python-SDK_bulk_ad_customizer_attribute_entity_base_9388ed841d53.py | unknown | 1,194 |
# Copyright 2021 The TensorFlow 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 applica... | # Copyright 2021 The TensorFlow 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 applica... | en | 005080757_tensorflow-lingvo_utils_test_a671ddc390cb.py | unknown | 982 |
"""
import liberator
import utool as ut
lib = liberator.Liberator()
lib.add_dynamic(ut.grab_zipped_url)
lib.close(['utool'])
print(lib.current_sourcecode())
"""
import ubelt as ub
from os.path import (
exists, join, realpath, split, basename, splitext, normpath, expanduser)
import tarfile
import zipfile
from os.pat... | """
import liberator
import utool as ut
lib = liberator.Liberator()
lib.add_dynamic(ut.grab_zipped_url)
lib.close(['utool'])
print(lib.current_sourcecode())
"""
import ubelt as ub
from os.path import (
exists, join, realpath, split, basename, splitext, normpath, expanduser)
import tarfile
import zipfile
from os.pat... | en | 003838019_Erotemic-ibeis_util_grabdata_c85321a8866b.py | unknown | 2,412 |
from aiohttp import hdrs, web
from datetime import timedelta, datetime
import logging
import pytz
from homeassistant.components.http import HomeAssistantView
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import (
CONF_API_KEY,
CONF_URL,
CONF_PORT,
GrocyEntityType... | from aiohttp import hdrs, web
from datetime import timedelta, datetime
import logging
import pytz
from homeassistant.components.http import HomeAssistantView
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import (
CONF_API_KEY,
CONF_URL,
CONF_PORT,
GrocyEntityType... | en | 002051645_macbury-SmartHouse_grocy_data_a895a143ad98.py | unknown | 2,302 |
import logging
from typing import Any, ClassVar, Optional
import reversion
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models.query import QuerySet
from django.forms.models import BaseModelForm
from django.h... | import logging
from typing import Any, ClassVar, Optional
import reversion
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models.query import QuerySet
from django.forms.models import BaseModelForm
from django.h... | en | 002110585_vEnhance-otis-web_views_0340a504d327.py | unknown | 2,836 |
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Database(_OCI):
_type = "database"
_icon_dir = "resources/oci/database"
class AutonomousWhite(_Database):
_icon = "autonomous-white.png"
class Autonomous(_Database):
_icon = "autonomous.png"
class Big... | # This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Database(_OCI):
_type = "database"
_icon_dir = "resources/oci/database"
class AutonomousWhite(_Database):
_icon = "autonomous-white.png"
class Autonomous(_Database):
_icon = "autonomous.png"
class Big... | en | 004074066_mingrammer-diagrams_database_0ec0da0cb78a.py | unknown | 459 |
# 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 agreed to... | # 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 agreed to... | en | 003444827_Ascend-ModelZoo-PyTorch_trainer_a14ba081180a.py | unknown | 1,929 |
import torch
from torch import nn
from byteir_backend import byteir_compile_fx
class MLP(nn.Module):
def __init__(self):
super().__init__()
self.linear1 = nn.Linear(10, 20)
self.linear2 = nn.Linear(20, 20)
self.linear3 = nn.Linear(20, 10)
def forward(self, x):
x = self.... | import torch
from torch import nn
from byteir_backend import byteir_compile_fx
class MLP(nn.Module):
def __init__(self):
super().__init__()
self.linear1 = nn.Linear(10, 20)
self.linear2 = nn.Linear(20, 20)
self.linear3 = nn.Linear(20, 10)
def forward(self, x):
x = self.... | en | 001926467_bytedance-byteir_mlp_aa16279cb511.py | unknown | 403 |
# This is the python code for calculating iou between pred_box and gt_box
# author:Forest 2019.7.19
import numpy as np
def get_iou(pred_box, gt_box):
"""
pred_box : the coordinate for predict bounding box
gt_box : the coordinate for ground truth bounding box
return : the iou score
the left-d... | # This is the python code for calculating iou between pred_box and gt_box
# author:Forest 2019.7.19
import numpy as np
def get_iou(pred_box, gt_box):
"""
pred_box : the coordinate for predict bounding box
gt_box : the coordinate for ground truth bounding box
return : the iou score
the left-d... | en | 002214681_JialeCao001-PSTR_iou_utils_d4ba63ab0a94.py | unknown | 1,569 |
import time,os,re
def profiler(method):
def wrapper_method(*arg, **kw):
t = time.time()
ret = method(*arg, **kw)
print('Method ' + method.__name__ +' took : ' + "{:2.5f}".format(time.time()-t) + ' sec')
return ret
return wrapper_method
target_color = 'shiny gold'
bags = {}
ba... | import time,os,re
def profiler(method):
def wrapper_method(*arg, **kw):
t = time.time()
ret = method(*arg, **kw)
print('Method ' + method.__name__ +' took : ' + "{:2.5f}".format(time.time()-t) + ' sec')
return ret
return wrapper_method
target_color = 'shiny gold'
bags = {}
ba... | en | 003574425_Fadi88-AoC_code_bb543eb58552.py | unknown | 515 |
from django.contrib import admin
from catalog.models import CatalogItem, ItemCategory, Donor, Supplier, \
DonorCode, Transporter
class CatalogItemAdmin(admin.ModelAdmin):
list_display = ['item_code', 'description', 'price_usd', 'price_local',
'item_category', 'donor', 'supplier', 'weight'... | from django.contrib import admin
from catalog.models import CatalogItem, ItemCategory, Donor, Supplier, \
DonorCode, Transporter
class CatalogItemAdmin(admin.ModelAdmin):
list_display = ['item_code', 'description', 'price_usd', 'price_local',
'item_category', 'donor', 'supplier', 'weight'... | en | 002960680_theirc-CTS_admin_18cff7fab9ad.py | unknown | 215 |
# Copyright 2022 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 agreed to... | # Copyright 2022 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 agreed to... | en | 000726397_mindspore-ai-models_resnet50v1_8c5bcb263f7d.py | unknown | 2,858 |
# Copyright 1999-2021 Alibaba Group Holding 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 a... | # Copyright 1999-2021 Alibaba Group Holding 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 a... | en | 005546460_mars-project-mars_chunks_d31bc5b9e549.py | unknown | 604 |
# -*- coding: utf-8 -*-
"""Implementation of structured model (SE)."""
from typing import Any, ClassVar, Mapping, Optional
from class_resolver import Hint
from torch.nn import functional
from ..nbase import ERModel
from ...constants import DEFAULT_EMBEDDING_HPO_EMBEDDING_DIM_RANGE
from ...nn.init import xavier_unif... | # -*- coding: utf-8 -*-
"""Implementation of structured model (SE)."""
from typing import Any, ClassVar, Mapping, Optional
from class_resolver import Hint
from torch.nn import functional
from ..nbase import ERModel
from ...constants import DEFAULT_EMBEDDING_HPO_EMBEDDING_DIM_RANGE
from ...nn.init import xavier_unif... | en | 004216122_pykeen-pykeen_structured_embedding_d6603c14757b.py | unknown | 1,012 |
# -*- coding: utf-8 -*-
"""
Created on Sat May 2 15:40:44 2015
@author: poldrack
"""
from __future__ import absolute_import
import os,glob
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
import numpy
def dequote_string(l):
if l.find('"')<0:
return l
in_quotes=False
... | # -*- coding: utf-8 -*-
"""
Created on Sat May 2 15:40:44 2015
@author: poldrack
"""
from __future__ import absolute_import
import os,glob
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
import numpy
def dequote_string(l):
if l.find('"')<0:
return l
in_quotes=False
... | en | 003616360_poldrack-myconnectome_load_dataframe_5c5e755edadc.py | unknown | 953 |
"""
Exception classes that may be raised from the Wayback package.
"""
class WaybackException(Exception):
"Base exception class for all Wayback-specific errors."
class UnexpectedResponseFormat(WaybackException):
"""
Raised when data returned by the Wayback Machine is formatted in an
unexpected or un... | """
Exception classes that may be raised from the Wayback package.
"""
class WaybackException(Exception):
"Base exception class for all Wayback-specific errors."
class UnexpectedResponseFormat(WaybackException):
"""
Raised when data returned by the Wayback Machine is formatted in an
unexpected or un... | en | 002193173_edgi-govdata-archiving-wayback_exceptions_e0c5d3cc7785.py | unknown | 987 |
#!/usr/bin/env python
# Copyright 2017 Calico 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 ... | #!/usr/bin/env python
# Copyright 2017 Calico 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 ... | en | 003063558_calico-basenji_basenji_sat_h5_965ce0abe50f.py | unknown | 6,961 |
from __future__ import annotations
import functools
import logging
from dataclasses import dataclass, field
from typing import Callable, List, Optional, Type, TypeVar, Union, get_type_hints
from typing_extensions import Concatenate, ParamSpec
from chia.protocols.protocol_message_types import ProtocolMessageTypes
fro... | from __future__ import annotations
import functools
import logging
from dataclasses import dataclass, field
from typing import Callable, List, Optional, Type, TypeVar, Union, get_type_hints
from typing_extensions import Concatenate, ParamSpec
from chia.protocols.protocol_message_types import ProtocolMessageTypes
fro... | en | 005093637_Chia-Network-chia-blockchain_api_decorators_f2470a98fd7c.py | unknown | 849 |
from ._bigwig import lib, ffi
from collections import namedtuple
import array
Interval = namedtuple('Interval', ['chrom', 'start', 'end', 'value'])
class BigWig(object):
"""
>>> b = BigWig("libBigWig/test/test.bw")
>>> b
BigWig('libBigWig/test/test.bw')
>>> for interval in b("1", 0, 99):
... ... | from ._bigwig import lib, ffi
from collections import namedtuple
import array
Interval = namedtuple('Interval', ['chrom', 'start', 'end', 'value'])
class BigWig(object):
"""
>>> b = BigWig("libBigWig/test/test.bw")
>>> b
BigWig('libBigWig/test/test.bw')
>>> for interval in b("1", 0, 99):
... ... | en | 000550331_brentp-bw-python_bw_e47ff8e3bca9.py | unknown | 1,182 |
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | en | 004934992_quarkfin-qf-lib_ib_contract_72704fcda833.py | unknown | 1,985 |
import os
import glob
import io
import pickle
import torchtext.datasets.imdb as imdb
import torchtext.data as data
from vel.api import TextData
class IMDBCached(imdb.IMDB):
""" Cached version of the IMDB dataset (to save time on tokenization) """
def __init__(self, path, text_field, label_field, **kwargs)... | import os
import glob
import io
import pickle
import torchtext.datasets.imdb as imdb
import torchtext.data as data
from vel.api import TextData
class IMDBCached(imdb.IMDB):
""" Cached version of the IMDB dataset (to save time on tokenization) """
def __init__(self, path, text_field, label_field, **kwargs)... | en | 002109010_MillionIntegrals-vel_imdb_c56822b25e43.py | unknown | 669 |
# Copyright (c) 2023 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 agreed to in writ... | # Copyright (c) 2023 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 agreed to in writ... | en | 001688885_openvinotoolkit-nncf_operations_8a47ecb13e95.py | unknown | 9,879 |
# -*- coding: utf-8 -*-
"""
webapp2_extras.security
=======================
Security related helpers such as secure password hashing tools and a
random token generator.
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
:co... | # -*- coding: utf-8 -*-
"""
webapp2_extras.security
=======================
Security related helpers such as secure password hashing tools and a
random token generator.
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
:co... | en | 005262762_iridium-browser-iridium-browser_security_2f935def9e49.py | unknown | 1,949 |
import os
import numpy as np
import pandas as pd
import pyspark.sql.functions as F
import requests
from pyspark.sql import SparkSession
from pyspark.sql.functions import (
col,
collect_list,
expr,
from_json,
from_utc_timestamp,
regexp_replace,
sort_array,
struct,
udf,
window,
)
... | import os
import numpy as np
import pandas as pd
import pyspark.sql.functions as F
import requests
from pyspark.sql import SparkSession
from pyspark.sql.functions import (
col,
collect_list,
expr,
from_json,
from_utc_timestamp,
regexp_replace,
sort_array,
struct,
udf,
window,
)
... | en | 001519990_AI4EPS-QuakeFlow_spark_streaming_2b928dbb0762.py | unknown | 1,904 |
__author__ = "kiriharu, https://github.com/kiriharu/telegram-redirect"
__copyright__ = "Copyright (C) 2019 kiriharu"
__license__ = "MIT License"
__version__ = "1.0"
from peewee import *
db = SqliteDatabase('adverstiment.sqlite')
class Adverstiment(Model):
link = TextField()
picture = TextField()
show = ... | __author__ = "kiriharu, https://github.com/kiriharu/telegram-redirect"
__copyright__ = "Copyright (C) 2019 kiriharu"
__license__ = "MIT License"
__version__ = "1.0"
from peewee import *
db = SqliteDatabase('adverstiment.sqlite')
class Adverstiment(Model):
link = TextField()
picture = TextField()
show = ... | en | 005216949_kiriharu-telegram-redirect_models_baa90d50d6f9.py | unknown | 384 |
#!/usr/bin/env python
from json import dumps
from circuits import Component, handler
from circuits.web import Controller, Logger, Server
class JSONSerializer(Component):
channel = "web"
# 1 higher than the default response handler
@handler("response", priority=1.0)
def serialize_response_body(self,... | #!/usr/bin/env python
from json import dumps
from circuits import Component, handler
from circuits.web import Controller, Logger, Server
class JSONSerializer(Component):
channel = "web"
# 1 higher than the default response handler
@handler("response", priority=1.0)
def serialize_response_body(self,... | en | 004373885_circuits-circuits_jsonserializer_f2de4ac17832.py | unknown | 185 |
"""Some functions for working with contingency tables (i.e. cross tabulations).
"""
from __future__ import division, print_function, absolute_import
from functools import reduce
import numpy as np
from .stats import power_divergence
__all__ = ['margins', 'expected_freq', 'chi2_contingency']
def margins(a):
"... | """Some functions for working with contingency tables (i.e. cross tabulations).
"""
from __future__ import division, print_function, absolute_import
from functools import reduce
import numpy as np
from .stats import power_divergence
__all__ = ['margins', 'expected_freq', 'chi2_contingency']
def margins(a):
"... | en | 000489041_catboost-catboost_contingency_06ceb9d34646.py | unknown | 2,982 |
# -*- coding: utf-8 -*-
"""
General description
-------------------
Example that illustrates how to model startup and shutdown costs attributed
to a binary flow.
Code
----
Download source code: :download:`startup_shutdown.py </../examples/start_and_shutdown_costs/startup_shutdown.py>`
.. dropdown:: Click to display ... | # -*- coding: utf-8 -*-
"""
General description
-------------------
Example that illustrates how to model startup and shutdown costs attributed
to a binary flow.
Code
----
Download source code: :download:`startup_shutdown.py </../examples/start_and_shutdown_costs/startup_shutdown.py>`
.. dropdown:: Click to display ... | en | 005443656_oemof-oemof-solph_startup_shutdown_ade74f475278.py | unknown | 1,149 |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Rackspace US, Inc.
#
# 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 ... | # -*- coding: utf-8 -*-
#
# Copyright 2016 Rackspace US, Inc.
#
# 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 ... | en | 001232450_rackerlabs-ebs_snapper_snapshot_ed23909c95cd.py | unknown | 2,270 |
import os
import logging
import pandas as pd
from pathlib import Path
from cropcore.model_data_access import (
insert_model_run,
insert_model_product,
insert_model_predictions,
get_sqlalchemy_session,
)
# relative or non-relative imports, depending on where we run from :-/
if os.getcwd() == os.path.di... | import os
import logging
import pandas as pd
from pathlib import Path
from cropcore.model_data_access import (
insert_model_run,
insert_model_product,
insert_model_predictions,
get_sqlalchemy_session,
)
# relative or non-relative imports, depending on where we run from :-/
if os.getcwd() == os.path.di... | en | 003705376_alan-turing-institute-CROP_pipelineV1_1_4c0310527a30.py | unknown | 2,202 |
class Partial(object):
def __init__(self, *args, **kwargs):
self._pypher = None
self._built = False
def safely_stringify_for_pudb(self):
return None
def _get_pypher(self):
if not self._pypher:
from .builder import Pypher
self._pypher = Pypher()
... |
class Partial(object):
def __init__(self, *args, **kwargs):
self._pypher = None
self._built = False
def safely_stringify_for_pudb(self):
return None
def _get_pypher(self):
if not self._pypher:
from .builder import Pypher
self._pypher = Pypher()
... | en | 002300915_emehrkay-Pypher_partial_3a5a0ca3e919.py | unknown | 1,611 |
from abc import ABCMeta, abstractmethod
from functools import partial, wraps
from prometheus_client import CollectorRegistry, Counter, Gauge, push_to_gateway
from six import add_metaclass
from util.abchelpers import nooper
@add_metaclass(ABCMeta)
class ProgressReporter(object):
"""
Implements an interface f... | from abc import ABCMeta, abstractmethod
from functools import partial, wraps
from prometheus_client import CollectorRegistry, Counter, Gauge, push_to_gateway
from six import add_metaclass
from util.abchelpers import nooper
@add_metaclass(ABCMeta)
class ProgressReporter(object):
"""
Implements an interface f... | en | 003648373_quay-quay_progress_d36cb29947ee.py | unknown | 861 |
r"""
EASE
################################################
Reference:
Harald Steck. "Embarrassingly Shallow Autoencoders for Sparse Data" in WWW 2019.
"""
import torch
import numpy as np
import scipy.sparse as sp
from recbole.utils import InputType, ModelType
from recbole.model.abstract_recommender import General... | r"""
EASE
################################################
Reference:
Harald Steck. "Embarrassingly Shallow Autoencoders for Sparse Data" in WWW 2019.
"""
import torch
import numpy as np
import scipy.sparse as sp
from recbole.utils import InputType, ModelType
from recbole.model.abstract_recommender import General... | en | 002379857_RUCAIBox-RecBole_ease_d43bf38c2e9f.py | unknown | 765 |
"""
Copyright (c) 2018-2023 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 agreed to in wri... | """
Copyright (c) 2018-2023 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 agreed to in wri... | en | 001055701_openvinotoolkit-open_model_zoo_dlsdk_launcher_config_1348f7f04d63.py | unknown | 4,055 |
#-------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: Fabian Schindler <fabian.schindler@eox.at>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2011 EOX IT Services GmbH
#
# Permission... | #-------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: Fabian Schindler <fabian.schindler@eox.at>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2011 EOX IT Services GmbH
#
# Permission... | en | 000343101_EOxServer-eoxserver_coverage_bands_layer_factory_7e28adbce6fe.py | unknown | 1,146 |
#!/usr/bin/env python
"""
Camera control specialized for an Andor ECCMD camera.
Hazen 04/17
"""
import copy
import os
from PyQt5 import QtCore
import storm_control.sc_hardware.andor.andorcontroller as andor
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_library.parameters as pa... | #!/usr/bin/env python
"""
Camera control specialized for an Andor ECCMD camera.
Hazen 04/17
"""
import copy
import os
from PyQt5 import QtCore
import storm_control.sc_hardware.andor.andorcontroller as andor
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_library.parameters as pa... | en | 002619814_ZhuangLab-storm-control_andorCameraControl_810589ef8e98.py | unknown | 4,873 |
# -*- coding: utf-8 -*-
import os
from urllib.parse import urlparse
from oauthlib.oauth2 import BackendApplicationClient, TokenExpiredError
from requests_oauthlib import OAuth2Session
# Allow non-ssl communication
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
HOUSTON_TOKEN_API = '%s/api/v1/auth/tokens'
HOUSTON_CL... | # -*- coding: utf-8 -*-
import os
from urllib.parse import urlparse
from oauthlib.oauth2 import BackendApplicationClient, TokenExpiredError
from requests_oauthlib import OAuth2Session
# Allow non-ssl communication
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
HOUSTON_TOKEN_API = '%s/api/v1/auth/tokens'
HOUSTON_CL... | en | 002953589_WildMeOrg-wildbook-ia_utils_f7eafc7f55e7.py | unknown | 650 |
# Copyright 2022 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 2022 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 | 001745249_Ascend-ModelZoo-PyTorch_FLAVR_pth2onnx_84fcbca90ea9.py | unknown | 982 |
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from os import path
def _add_ui_webui_resources_mappings(path_mappings, root_gen_dir):
# Calculate mappings for ui/webui/resources/ sub-folders that have a dedicated
# ts_li... | # Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from os import path
def _add_ui_webui_resources_mappings(path_mappings, root_gen_dir):
# Calculate mappings for ui/webui/resources/ sub-folders that have a dedicated
# ts_li... | en | 002091167_chromium-chromium_path_mappings_a5121b3e50d2.py | unknown | 1,060 |
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class Temperature:
"""
System temperature sensor wrapper.
"""
id: str = field(
metadata={
'metadata': {
'description': 'Unique ID for the sensor',
'example': 'acpi_1',
... | from dataclasses import dataclass, field
from typing import Optional
@dataclass
class Temperature:
"""
System temperature sensor wrapper.
"""
id: str = field(
metadata={
'metadata': {
'description': 'Unique ID for the sensor',
'example': 'acpi_1',
... | en | 003395826_BlackLight-platypush_model_c89e57221659.py | unknown | 291 |
"""Pavilion uses several LALR parsers to interpret the value strings in test
configs.
For most of these values the Pavilion StringParser is applied.
1. Pavilion unique escapes are handled (like ``\\{``).
2. Expressions (text in ``{{<expr>}}`` blocks) are pulled out and parsed
and resolved by the Expression Parser.... | """Pavilion uses several LALR parsers to interpret the value strings in test
configs.
For most of these values the Pavilion StringParser is applied.
1. Pavilion unique escapes are handled (like ``\\{``).
2. Expressions (text in ``{{<expr>}}`` blocks) are pulled out and parsed
and resolved by the Expression Parser.... | en | 005427072_hpc-pavilion2_init_91875eaa6b60.py | unknown | 3,055 |
import cudf
import dask_cudf
import pyarrow as pa
from typing import Type
from cuxfilter.dashboard import DashBoard
from cuxfilter.layouts import single_feature
from cuxfilter.themes import default
from cuxfilter.assets import notebook_assets
def read_arrow(source):
# print('reading arrow file as arrow table fro... | import cudf
import dask_cudf
import pyarrow as pa
from typing import Type
from cuxfilter.dashboard import DashBoard
from cuxfilter.layouts import single_feature
from cuxfilter.themes import default
from cuxfilter.assets import notebook_assets
def read_arrow(source):
# print('reading arrow file as arrow table fro... | en | 000638899_rapidsai-cuxfilter_dataframe_df1a93cd7d41.py | unknown | 1,912 |
"""
Python 异常学习
"""
try:
print(1/1)
except ZeroDivisionError :
print(1/3)
else:
print(1/2)
try:
print("连接数据库")
raise IOError("数据库连接异常")
except IOError as e:
print(e)
finally:
print("关闭数据库连接")
try:
print(1/0)
except Exception as e :
print("Exception 异常",e)
except ZeroDivisionError... | """
Python 异常学习
"""
try:
print(1/1)
except ZeroDivisionError :
print(1/3)
else:
print(1/2)
try:
print("连接数据库")
raise IOError("数据库连接异常")
except IOError as e:
print(e)
finally:
print("关闭数据库连接")
try:
print(1/0)
except Exception as e :
print("Exception 异常",e)
except ZeroDivisionError... | en | 001120995_menhuan-notes_try_except_init_cbe7f61d64e2.py | unknown | 216 |
"""Provides statistical tests usable on groups of traces sample-wise (Welch's and Student's t-test, ...)."""
from typing import Sequence, Optional, Tuple
import numpy as np
from public import public
from scipy.stats import ttest_ind, ks_2samp, t
from .trace import Trace, CombinedTrace
from .combine import average_and... | """Provides statistical tests usable on groups of traces sample-wise (Welch's and Student's t-test, ...)."""
from typing import Sequence, Optional, Tuple
import numpy as np
from public import public
from scipy.stats import ttest_ind, ks_2samp, t
from .trace import Trace, CombinedTrace
from .combine import average_and... | en | 003265348_J08nY-pyecsca_test_9a5006ad779d.py | unknown | 1,347 |
from enum import Enum
import pandas as pd
from pandas.io.json import json_normalize
from pydantic import Field, HttpUrl, SecretStr
from toucan_connectors.common import nosql_apply_parameters_to_query
from toucan_connectors.toucan_connector import ToucanConnector, ToucanDataSource
from .client import Client
from .dat... | from enum import Enum
import pandas as pd
from pandas.io.json import json_normalize
from pydantic import Field, HttpUrl, SecretStr
from toucan_connectors.common import nosql_apply_parameters_to_query
from toucan_connectors.toucan_connector import ToucanConnector, ToucanDataSource
from .client import Client
from .dat... | en | 003368770_ToucanToco-toucan-connectors_micro_strategy_connector_ac8257f37cb0.py | unknown | 1,333 |
"""Contains the base class for dataset fixes."""
from __future__ import annotations
import importlib
import inspect
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
from iris.cube import Cube, CubeList
from ..table import CMOR_TABLES
if TYPE_CHECKING:
from ...config impor... | """Contains the base class for dataset fixes."""
from __future__ import annotations
import importlib
import inspect
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
from iris.cube import Cube, CubeList
from ..table import CMOR_TABLES
if TYPE_CHECKING:
from ...config impor... | en | 000740074_ESMValGroup-ESMValCore_fix_d6a13d3d9da5.py | unknown | 2,020 |
import pytest
from . import Extract
def test_missing_source_type():
extract = Extract()
with pytest.raises(AssertionError) as excinfo:
extract.do({})
assert "source must have a type" in str(excinfo.value)
def test_unknown_source_type():
extract = Extract()
with pytest.raises(ValueError)... | import pytest
from . import Extract
def test_missing_source_type():
extract = Extract()
with pytest.raises(AssertionError) as excinfo:
extract.do({})
assert "source must have a type" in str(excinfo.value)
def test_unknown_source_type():
extract = Extract()
with pytest.raises(ValueError)... | en | 005321356_stencila-hub_init__test_94956942c8da.py | unknown | 290 |
from pyperf._cli import display_title, format_result_value
from pyperf._utils import is_significant, geometric_mean
def is_significant_benchs(bench1, bench2):
values1 = bench1.get_values()
values2 = bench2.get_values()
if len(values1) == 1 and len(values2) == 1:
# FIXME: is it ok to consider that... | from pyperf._cli import display_title, format_result_value
from pyperf._utils import is_significant, geometric_mean
def is_significant_benchs(bench1, bench2):
values1 = bench1.get_values()
values2 = bench2.get_values()
if len(values1) == 1 and len(values2) == 1:
# FIXME: is it ok to consider that... | en | 004141921_psf-pyperf_compare_047db933720f.py | unknown | 4,497 |
import numpy as np
import pandas as pd
import cv2
from scipy import ndimage
#Run inference (using OpenCV's dnn module) on images using your model trained
#in AIDeveloper.
#Script contains functions:
#- to pre-preprocess images according to the input criteria of a loaded model
#- forward images through a model and ge... | import numpy as np
import pandas as pd
import cv2
from scipy import ndimage
#Run inference (using OpenCV's dnn module) on images using your model trained
#in AIDeveloper.
#Script contains functions:
#- to pre-preprocess images according to the input criteria of a loaded model
#- forward images through a model and ge... | en | 000709874_maikherbig-AIDeveloper_aid_cv2_dnn_f5a8fc1ad627.py | unknown | 8,422 |
"""Sublime commands for configuring Cargo execution.
See `cargo_settings` for more details on how settings work.
"""
import getpass
import os
import re
import sublime
import sublime_plugin
from .cargo_settings import CargoSettings, CARGO_COMMANDS
from .util import index_with, get_cargo_metadata
from . import rust_pro... | """Sublime commands for configuring Cargo execution.
See `cargo_settings` for more details on how settings work.
"""
import getpass
import os
import re
import sublime
import sublime_plugin
from .cargo_settings import CargoSettings, CARGO_COMMANDS
from .util import index_with, get_cargo_metadata
from . import rust_pro... | en | 001094527_rust-lang-rust-enhanced_cargo_config_d825695ea445.py | unknown | 9,030 |
# Copyright 2011 Google Inc. 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 2011 Google Inc. 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 | 004986313_google-capirca_naming_96352babbefe.py | unknown | 6,180 |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# 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 la... | # coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# 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 la... | en | 004894143_tensorflow-agents_lstm_encoding_network_9b743651ef97.py | unknown | 2,760 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2023, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2023, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | en | 001245514_bokeh-bokeh_util_e716407843d0.py | unknown | 1,269 |
import logging
from aiohttp import web
from aiohttp.web_exceptions import HTTPForbidden, HTTPInternalServerError
from aiohttp_jinja2 import render_template
from aiohttp_session import session_middleware as session_middleware_, get_session
from aiohttp_session.redis_storage import RedisStorage
log = logging.getLogger(... | import logging
from aiohttp import web
from aiohttp.web_exceptions import HTTPForbidden, HTTPInternalServerError
from aiohttp_jinja2 import render_template
from aiohttp_session import session_middleware as session_middleware_, get_session
from aiohttp_session.redis_storage import RedisStorage
log = logging.getLogger(... | en | 003258058_anxolerd-dvpwa_middlewares_08a532997ce2.py | unknown | 615 |
from logging import getLogger
from dateutil.parser import parse
from django.utils.translation import ugettext_noop as _
from django.utils.six import iteritems
from api.api_views import APIView
from api.views import exception_handler
from api.utils.views import call_api_view
from api.utils.request import set_request_me... | from logging import getLogger
from dateutil.parser import parse
from django.utils.translation import ugettext_noop as _
from django.utils.six import iteritems
from api.api_views import APIView
from api.views import exception_handler
from api.utils.views import call_api_view
from api.utils.request import set_request_me... | en | 002432596_erigones-esdc-ce_api_views_044dcb2e6249.py | unknown | 2,573 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""blast.py
Module that interacts with BLAST+ for diagnostic primer prediction.
The module provides functions that generate BLASTN command lines,
tuned for screening primer sequences. This module does NOT run the
commands - that is handled by one of the schedulers (multi... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""blast.py
Module that interacts with BLAST+ for diagnostic primer prediction.
The module provides functions that generate BLASTN command lines,
tuned for screening primer sequences. This module does NOT run the
commands - that is handled by one of the schedulers (multi... | en | 000577712_widdowquinn-find_differential_primers_blast_1c10c6efbd71.py | unknown | 2,175 |
"""PKONE servo implementation."""
from collections import namedtuple
from mpf.platforms.interfaces.servo_platform_interface import ServoPlatformInterface
MYPY = False
if MYPY: # pragma: no cover
from mpf.platforms.pkone.pkone import PKONEHardwarePlatform # pylint: disable-msg=cyclic-import,unused-import
PKONES... | """PKONE servo implementation."""
from collections import namedtuple
from mpf.platforms.interfaces.servo_platform_interface import ServoPlatformInterface
MYPY = False
if MYPY: # pragma: no cover
from mpf.platforms.pkone.pkone import PKONEHardwarePlatform # pylint: disable-msg=cyclic-import,unused-import
PKONES... | en | 000748449_missionpinball-mpf_pkone_servo_852778d35fca.py | unknown | 397 |
"""A script for cloning the FERC Form 1 database into SQLite.
This script generates a SQLite database that is a clone/mirror of the original
FERC Form1 database. We use this cloned database as the starting point for the
main PUDL ETL process. The underlying work in the script is being done in
:mod:`pudl.extract.ferc1`... | """A script for cloning the FERC Form 1 database into SQLite.
This script generates a SQLite database that is a clone/mirror of the original
FERC Form1 database. We use this cloned database as the starting point for the
main PUDL ETL process. The underlying work in the script is being done in
:mod:`pudl.extract.ferc1`... | en | 003423962_catalyst-cooperative-pudl_cli_a7a209a7cd21.py | unknown | 1,777 |
# Copyright 2014 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 2014 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 | 001729611_GoogleCloudPlatform-PerfKitBenchmarker_silo_47cfbfb8251e.py | unknown | 760 |
# ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | # ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | en | 002375381_NMGRL-pychron_map_editor_e808feda5f52.py | unknown | 1,589 |
# 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
# "License"); you may not u... | # 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
# "License"); you may not u... | en | 004234936_tqchen-tvm_relax_integration_fd27734c8837.py | unknown | 3,133 |
from rest_framework import serializers
from keywords.models import SynonymList
class SynonymListSerializer(serializers.ModelSerializer):
"""
Pourquoi renommer 'name' en 'text' ? Pour l'autocomplete avec select2.
"""
id = serializers.CharField(source="id_slug")
text = serializers.CharField(source... | from rest_framework import serializers
from keywords.models import SynonymList
class SynonymListSerializer(serializers.ModelSerializer):
"""
Pourquoi renommer 'name' en 'text' ? Pour l'autocomplete avec select2.
"""
id = serializers.CharField(source="id_slug")
text = serializers.CharField(source... | en | 002941553_MTES-MCT-aides-territoires_serializers_545c48b9cf87.py | unknown | 220 |
from decimal import Decimal
import json
import uuid
from urllib2 import urlopen
from urlparse import urljoin
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest
from django.shortcuts import get_object_or_404, re... | from decimal import Decimal
import json
import uuid
from urllib2 import urlopen
from urlparse import urljoin
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest
from django.shortcuts import get_object_or_404, re... | en | 004877868_LibraryOfCongress-viewshare_views_4f53b3e96458.py | unknown | 1,915 |
# -*- coding: utf-8 -*-
# EFILTER Forensic Query Language
#
# Copyright 2015 Google Inc. 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/li... | # -*- coding: utf-8 -*-
# EFILTER Forensic Query Language
#
# Copyright 2015 Google Inc. 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/li... | en | 004409429_google-dotty_structured_45d7babcb985.py | unknown | 683 |
# 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! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _ut... | # 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! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _ut... | en | 000264734_pulumi-pulumi-aws-native_get_event_bus_policy_9026391f1841.py | unknown | 1,025 |
"""
Copyright 2016 Deepgram
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, software
distri... | """
Copyright 2016 Deepgram
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, software
distri... | en | 002524811_deepgram-kur_cifar_0a2feb0f7287.py | unknown | 1,290 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | # Copyright © 2019 Province of British Columbia
#
# 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 agr... | en | 003217477_bcgov-queue-management_init_dda5282f6026.py | unknown | 266 |
#!/usr/bin/env python3
#____________________________________________________________
#
# createPayload
#
# A very simple way to create condition DB payloads
#
# Francisco Yumiceva
# yumiceva@fnal.gov
#
# Fermilab, 2009
#
#____________________________________________________________
"""
createPayload.py
A very ... | #!/usr/bin/env python3
#____________________________________________________________
#
# createPayload
#
# A very simple way to create condition DB payloads
#
# Francisco Yumiceva
# yumiceva@fnal.gov
#
# Fermilab, 2009
#
#____________________________________________________________
"""
createPayload.py
A very ... | en | 000840536_cms-sw-cmssw_createPayload_acd1c280cad1.py | unknown | 4,822 |
from bitmovin.resources.models import AbstractModel
class ContentProtection(AbstractModel):
def __init__(self, encoding_id, muxing_id, drm_id, id_=None, custom_data=None):
super().__init__(id_=id_, custom_data=custom_data)
self.encodingId = encoding_id
self.muxingId = muxing_id
se... | from bitmovin.resources.models import AbstractModel
class ContentProtection(AbstractModel):
def __init__(self, encoding_id, muxing_id, drm_id, id_=None, custom_data=None):
super().__init__(id_=id_, custom_data=custom_data)
self.encodingId = encoding_id
self.muxingId = muxing_id
se... | en | 005638181_bitmovin-bitmovin-python_content_protection_b1400fa84fe0.py | unknown | 264 |
"""
Vectorized implementation of rANS based on https://arxiv.org/abs/1402.3392
"""
from warnings import warn
import numpy as np
rng = np.random.default_rng(0)
rans_l = 1 << 31 # the lower bound of the normalisation interval
atleast_1d = lambda x: np.atleast_1d(x).astype('uint64')
def base_message(shape, randomize=... | """
Vectorized implementation of rANS based on https://arxiv.org/abs/1402.3392
"""
from warnings import warn
import numpy as np
rng = np.random.default_rng(0)
rans_l = 1 << 31 # the lower bound of the normalisation interval
atleast_1d = lambda x: np.atleast_1d(x).astype('uint64')
def base_message(shape, randomize=... | en | 002600558_j-towns-craystack_rans_9d6d83ce92c8.py | unknown | 1,972 |
import numpy as np
from .base import BaseWidget, to_attr
from .utils import get_unit_colors
from .traces import TracesWidget
from ..core import ChannelSparsity
from ..core.template_tools import get_template_extremum_channel
from ..core.waveform_extractor import WaveformExtractor
from ..core.baserecording import BaseRe... | import numpy as np
from .base import BaseWidget, to_attr
from .utils import get_unit_colors
from .traces import TracesWidget
from ..core import ChannelSparsity
from ..core.template_tools import get_template_extremum_channel
from ..core.waveform_extractor import WaveformExtractor
from ..core.baserecording import BaseRe... | en | 004285373_SpikeInterface-spikeinterface_spikes_on_traces_905bf6fd4e47.py | unknown | 3,126 |
"""Various utility functions."""
from collections import namedtuple, Counter
from os.path import commonprefix
__unittest = True
_MAX_LENGTH = 80
_PLACEHOLDER_LEN = 12
_MIN_BEGIN_LEN = 5
_MIN_END_LEN = 5
_MIN_COMMON_LEN = 5
_MIN_DIFF_LEN = _MAX_LENGTH - \
(_MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_COMMO... | """Various utility functions."""
from collections import namedtuple, Counter
from os.path import commonprefix
__unittest = True
_MAX_LENGTH = 80
_PLACEHOLDER_LEN = 12
_MIN_BEGIN_LEN = 5
_MIN_END_LEN = 5
_MIN_COMMON_LEN = 5
_MIN_DIFF_LEN = _MAX_LENGTH - \
(_MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_COMMO... | en | 004194992_RustPython-RustPython_util_fdcc640c3505.py | unknown | 1,628 |
from typing import Any
from . import interfaces
from .base import (
PASSIVE_NO_RESULT as PASSIVE_NO_RESULT,
SQL_OK as SQL_OK,
NEVER_SET as NEVER_SET,
ATTR_WAS_SET as ATTR_WAS_SET,
NO_VALUE as NO_VALUE,
PASSIVE_NO_INITIALIZE as PASSIVE_NO_INITIALIZE,
INIT_OK as INIT_OK,
PASSIVE_OFF as PAS... | from typing import Any
from . import interfaces
from .base import (
PASSIVE_NO_RESULT as PASSIVE_NO_RESULT,
SQL_OK as SQL_OK,
NEVER_SET as NEVER_SET,
ATTR_WAS_SET as ATTR_WAS_SET,
NO_VALUE as NO_VALUE,
PASSIVE_NO_INITIALIZE as PASSIVE_NO_INITIALIZE,
INIT_OK as INIT_OK,
PASSIVE_OFF as PAS... | en | 005511952_dropbox-sqlalchemy-stubs_state_5fab627b303e.py | unknown | 673 |
# coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# 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... | # coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# 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... | en | 002739381_yyht-BERT_dopamine_connector_e38c1f18c045.py | unknown | 8,597 |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... | # ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... | en | 005167191_NMGRL-pychron_xy_inspector_e4fd200ef5dc.py | unknown | 1,513 |
"""Support for HERE travel time sensors."""
from __future__ import annotations
from collections.abc import Mapping
from datetime import timedelta
from typing import Any
from homeassistant.components.sensor import (
RestoreSensor,
SensorDeviceClass,
SensorEntityDescription,
SensorStateClass,
)
from hom... | """Support for HERE travel time sensors."""
from __future__ import annotations
from collections.abc import Mapping
from datetime import timedelta
from typing import Any
from homeassistant.components.sensor import (
RestoreSensor,
SensorDeviceClass,
SensorEntityDescription,
SensorStateClass,
)
from hom... | en | 004121329_home-assistant-core_sensor_e9c6501c5932.py | unknown | 1,967 |
#coding=utf-8
import math
from manimlib.constants import *
from manimlib.animation.creation import ShowCreation
from manimlib.animation.fading import FadeOut
from manimlib.animation.transform import ApplyMethod, ReplacementTransform, Restore
from manimlib.mobject.types.vectorized_mobject import VMobject, VGroup
from m... | #coding=utf-8
import math
from manimlib.constants import *
from manimlib.animation.creation import ShowCreation
from manimlib.animation.fading import FadeOut
from manimlib.animation.transform import ApplyMethod, ReplacementTransform, Restore
from manimlib.mobject.types.vectorized_mobject import VMobject, VGroup
from m... | en | 005453738_Solara570-demo-solara_ford_circles_d8c31a593759.py | unknown | 2,904 |
"""
Base Authenticator
~~~~~~~~~~~~~~~~~~
Base class for authenticators.
:copyright: Copyright 2018 PlanGrid, Inc., see AUTHORS.
:license: MIT, see LICENSE for details.
"""
class Authenticator:
"""
Abstract authenticator class. Custom authentication methods should
extend this class.
... | """
Base Authenticator
~~~~~~~~~~~~~~~~~~
Base class for authenticators.
:copyright: Copyright 2018 PlanGrid, Inc., see AUTHORS.
:license: MIT, see LICENSE for details.
"""
class Authenticator:
"""
Abstract authenticator class. Custom authentication methods should
extend this class.
... | en | 005351232_plangrid-flask-rebar_base_9ae8d8a37120.py | unknown | 188 |
import os
import sys
import argparse
import json
import base64
from collections import OrderedDict
from ldap3.utils import dn as dnutils
from setup_app.pylib.ldif4.ldif import LDIFWriter, LDIFParser
b64_encoded_field_descriptor = '@base64encodedfield-'
parser = argparse.ArgumentParser()
parser.add_argument("--infile... | import os
import sys
import argparse
import json
import base64
from collections import OrderedDict
from ldap3.utils import dn as dnutils
from setup_app.pylib.ldif4.ldif import LDIFWriter, LDIFParser
b64_encoded_field_descriptor = '@base64encodedfield-'
parser = argparse.ArgumentParser()
parser.add_argument("--infile... | en | 002254129_JanssenProject-jans_convert_lif_7b5582bdbe18.py | unknown | 1,679 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class GroupFundsImcomeDetails(object):
def __init__(self):
self._amount = None
self._fund_distributions = None
self._payer_id = None
@property
def amount(self):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class GroupFundsImcomeDetails(object):
def __init__(self):
self._amount = None
self._fund_distributions = None
self._payer_id = None
@property
def amount(self):
... | en | 001357702_alipay-alipay-sdk-python-all_GroupFundsImcomeDetails_9613d9fba604.py | unknown | 564 |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Meta
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import List as ListType
from pydantic import Field
from . import fhirtypes
from .element import Element
class Meta(Element):
"""Metadata about a resource.
The meta... | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Meta
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import List as ListType
from pydantic import Field
from . import fhirtypes
from .element import Element
class Meta(Element):
"""Metadata about a resource.
The meta... | en | 005167803_nazrulworld-fhir.resources_meta_7a5abb990bf8.py | unknown | 451 |
from abc import ABC
from typing import Any
from typing import Optional
from amp.models import model
class Encoder(model.Model, ABC):
""" Encoder part of VAE """
def output_tensor(self, input_: Optional[Any] = None):
raise NotImplementedError
def __call__(self, input_: Optional[Any] = None):
... | from abc import ABC
from typing import Any
from typing import Optional
from amp.models import model
class Encoder(model.Model, ABC):
""" Encoder part of VAE """
def output_tensor(self, input_: Optional[Any] = None):
raise NotImplementedError
def __call__(self, input_: Optional[Any] = None):
... | en | 004194782_szczurek-lab-hydramp_encoder_6f10b5116df1.py | unknown | 114 |
import random
import fire
from typing import List
from itertools import chain
from datasets import load_dataset
from src.eval_rsg import (
RWSD_PROMPT,
TERRA_PROMPT,
MUSERC_SINGLE_PROMPT,
PARUS_CAUSE_PROMPT,
PARUS_EFFECT_PROMPT,
RCB_PROMPT,
RUCOS_PROMPT,
RUCOS_MASK,
rucos_clean_tex... | import random
import fire
from typing import List
from itertools import chain
from datasets import load_dataset
from src.eval_rsg import (
RWSD_PROMPT,
TERRA_PROMPT,
MUSERC_SINGLE_PROMPT,
PARUS_CAUSE_PROMPT,
PARUS_EFFECT_PROMPT,
RCB_PROMPT,
RUCOS_PROMPT,
RUCOS_MASK,
rucos_clean_tex... | en | 005137166_IlyaGusev-rulm_convert_rsg_e9ebaede2b09.py | unknown | 2,526 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.