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 os import random import argparse from datetime import datetime import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms import torchvision.utils as torchvision_utils import torchvision.datasets as datasets import torchvision.models as models import torch.mu...
import os import random import argparse from datetime import datetime import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms import torchvision.utils as torchvision_utils import torchvision.datasets as datasets import torchvision.models as models import torch.mu...
en
000921926_ml-research-NeSyXIL_train_resnet34_xil_ffbd5b80eab8.py
unknown
6,708
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ---------------------------------------------...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ---------------------------------------------...
en
003258924_Tencent-bk-base_rabbitmq_util_d209ead4f3a0.py
unknown
1,023
from flask_restx import Resource from sqlalchemy import func from CTFd.api.v1.statistics import statistics_namespace from CTFd.models import Users from CTFd.utils.decorators import admins_only @statistics_namespace.route("/users") class UserStatistics(Resource): @admins_only def get(self): registered...
from flask_restx import Resource from sqlalchemy import func from CTFd.api.v1.statistics import statistics_namespace from CTFd.models import Users from CTFd.utils.decorators import admins_only @statistics_namespace.route("/users") class UserStatistics(Resource): @admins_only def get(self): registered...
en
004745530_CTFd-CTFd_users_060fc9edcdce.py
unknown
284
import cython @cython.cclass class Parrot: @cython.cfunc def describe(self) -> cython.void: print("This parrot is resting.") @cython.cclass class Norwegian(Parrot): @cython.cfunc def describe(self) -> cython.void: Parrot.describe(self) print("Lovely plumage!") cython.declare...
import cython @cython.cclass class Parrot: @cython.cfunc def describe(self) -> cython.void: print("This parrot is resting.") @cython.cclass class Norwegian(Parrot): @cython.cfunc def describe(self) -> cython.void: Parrot.describe(self) print("Lovely plumage!") cython.declare...
en
004563057_cython-cython_pets_1e70906da01e.py
unknown
147
from dna_features_viewer import BiopythonTranslator class CommonBlocksRecordTranslator(BiopythonTranslator): ignored_features_types = ("diff_equal",) default_box_color = None def compute_feature_color(self, f): if f.qualifiers.get("is_block", False): return BiopythonTranslator.comput...
from dna_features_viewer import BiopythonTranslator class CommonBlocksRecordTranslator(BiopythonTranslator): ignored_features_types = ("diff_equal",) default_box_color = None def compute_feature_color(self, f): if f.qualifiers.get("is_block", False): return BiopythonTranslator.comput...
en
004883274_Edinburgh-Genome-Foundry-Geneblocks_CommonBlocksRecordTranslator_d0c4753c21be.py
unknown
189
from pathlib import Path from typing import Any, Dict, Optional import numpy as np import torch import torch as th from .custom_layers import EqualizedConv2d from .modules import ( ConDisFinalBlock, DisFinalBlock, DisGeneralConvBlock, GenGeneralConvBlock, GenInitialBlock, ) from torch import Tenso...
from pathlib import Path from typing import Any, Dict, Optional import numpy as np import torch import torch as th from .custom_layers import EqualizedConv2d from .modules import ( ConDisFinalBlock, DisFinalBlock, DisGeneralConvBlock, GenGeneralConvBlock, GenInitialBlock, ) from torch import Tenso...
en
004511525_akanimax-pro_gan_pytorch_networks_c229acc45cc5.py
unknown
2,436
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import re from textwrap import dedent try: from html import escape as html_escape except ImportError: from cgi import escape as html_escape from boltons.tableutils import Table from boltons.urlutils import find_all_links from werkzeug....
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import re from textwrap import dedent try: from html import escape as html_escape except ImportError: from cgi import escape as html_escape from boltons.tableutils import Table from boltons.urlutils import find_all_links from werkzeug....
en
004143114_mahmoud-clastic_tabular_dc720c46034f.py
unknown
1,528
''' Description: Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. Note: This question is the same as 1081: https://leetcode.com/problems/smallest-subsequence-of-distinct-char...
''' Description: Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. Note: This question is the same as 1081: https://leetcode.com/problems/smallest-subsequence-of-distinct-char...
en
002590347_brianchiang-tw-leetcode_by_stack_78830de913e2.py
unknown
692
import os import pickle import pySDC.helpers.plot_helper as plt_helper def plot_convergence(): # pragma: no cover ''' Loads pickled error data for multiple preconditioners and collocation node counts and plots it with respect to the max. iteration count The y axis is logarithmically scaled. The x axis i...
import os import pickle import pySDC.helpers.plot_helper as plt_helper def plot_convergence(): # pragma: no cover ''' Loads pickled error data for multiple preconditioners and collocation node counts and plots it with respect to the max. iteration count The y axis is logarithmically scaled. The x axis i...
en
003796484_Parallel-in-Time-pySDC_semilogy_plot_6440577082f9.py
unknown
795
import argparse import nltk import random import numpy as np parser = argparse.ArgumentParser(description='Evaluate latent space quality based on (1) AvgLen; (2) UnigramKL; (3) Entropy') parser.add_argument('-ref', '--reference_path', help='Path to reference/corpus sentences (1 per line)', required=True) parser.add_ar...
import argparse import nltk import random import numpy as np parser = argparse.ArgumentParser(description='Evaluate latent space quality based on (1) AvgLen; (2) UnigramKL; (3) Entropy') parser.add_argument('-ref', '--reference_path', help='Path to reference/corpus sentences (1 per line)', required=True) parser.add_ar...
en
005420947_HareeshBahuleyan-probabilistic_nlg_evaluate_latent_space_129a75d8d2d4.py
unknown
1,033
"""Helper cli to encode urls.""" import typing import click from tentaclio import urls SCOPES = ["https://www.googleapis.com/auth/drive"] # Register CLI commands @click.group() def main(): """Run tentaclio helper commands.""" ... @main.group() def url(): """Run url related helpers.""" ... @url...
"""Helper cli to encode urls.""" import typing import click from tentaclio import urls SCOPES = ["https://www.googleapis.com/auth/drive"] # Register CLI commands @click.group() def main(): """Run tentaclio helper commands.""" ... @main.group() def url(): """Run url related helpers.""" ... @url...
en
001446835_octoenergy-tentaclio_main_66dfdeacf7c4.py
unknown
451
import sys import os import pprint import math import re c=0 r=0 def getCAndR(candidateSentence,referenceSentences): global c global r referenceCount=[] referenceLength=[] candidateSentence = list(candidateSentence) referenceSentences = list(referenceSentences) c+=len(candidateSentence) ...
import sys import os import pprint import math import re c=0 r=0 def getCAndR(candidateSentence,referenceSentences): global c global r referenceCount=[] referenceLength=[] candidateSentence = list(candidateSentence) referenceSentences = list(referenceSentences) c+=len(candidateSentence) ...
en
002996718_PlusLabNLP-story-gen-BART_bleu_c799a100d218.py
unknown
3,249
import os from pathlib import Path from typing import List, Optional, Tuple, Union import torch from torch.utils.data import Dataset from torchaudio.datasets.utils import _load_waveform _SAMPLE_RATE = 16000 _SPEAKERS = [ "Aditi", "Amy", "Brian", "Emma", "Geraint", "Ivy", "Joanna", "Jo...
import os from pathlib import Path from typing import List, Optional, Tuple, Union import torch from torch.utils.data import Dataset from torchaudio.datasets.utils import _load_waveform _SAMPLE_RATE = 16000 _SPEAKERS = [ "Aditi", "Amy", "Brian", "Emma", "Geraint", "Ivy", "Joanna", "Jo...
en
005607061_pytorch-audio_snips_59a614927185.py
unknown
1,452
'''Tools for multivariate analysis Author : Josef Perktold License : BSD-3 TODO: - names of functions, currently just "working titles" ''' import numpy as np from statsmodels.tools.tools import Bunch def partial_project(endog, exog): '''helper function to get linear projection or partialling out of vari...
'''Tools for multivariate analysis Author : Josef Perktold License : BSD-3 TODO: - names of functions, currently just "working titles" ''' import numpy as np from statsmodels.tools.tools import Bunch def partial_project(endog, exog): '''helper function to get linear projection or partialling out of vari...
en
005358188_statsmodels-statsmodels_multivariate_tools_1979066449bc.py
unknown
2,118
import uuid from .entity import EntityType, Entity from calm.dsl.log import get_logging_handle from .validator import PropertyValidator from calm.dsl.constants import ENTITY LOG = get_logging_handle(__name__) # AHV Account class VmwareAccountType(EntityType): __schema_name__ = "VmwareAccount" __openapi_ty...
import uuid from .entity import EntityType, Entity from calm.dsl.log import get_logging_handle from .validator import PropertyValidator from calm.dsl.constants import ENTITY LOG = get_logging_handle(__name__) # AHV Account class VmwareAccountType(EntityType): __schema_name__ = "VmwareAccount" __openapi_ty...
en
001040397_nutanix-calm-dsl_vmware_account_a79f96be12a0.py
unknown
611
# coding: utf-8 import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class CreateTestCaseRequestBody: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is at...
# coding: utf-8 import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class CreateTestCaseRequestBody: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is at...
en
001146416_huaweicloud-huaweicloud-sdk-python-v3_create_test_case_request_body_4c2f15036b07.py
unknown
1,985
# -*- test-case-name: vumi.transports.httprpc.tests.test_httprpc -*- import json from twisted.cred.portal import Portal from twisted.internet.defer import inlineCallbacks, succeed from twisted.internet import reactor from twisted.internet.task import LoopingCall from twisted.web import http from twisted.web.guard imp...
# -*- test-case-name: vumi.transports.httprpc.tests.test_httprpc -*- import json from twisted.cred.portal import Portal from twisted.internet.defer import inlineCallbacks, succeed from twisted.internet import reactor from twisted.internet.task import LoopingCall from twisted.web import http from twisted.web.guard imp...
en
001452602_praekeltfoundation-vumi_httprpc_117d6e6451e7.py
unknown
4,234
# 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 use ...
# 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 use ...
en
001563835_apache-libcloud_digitalocean_949fe276280e.py
unknown
2,809
from ..exc import * from . import util from .. import constants import abc import re import six from six.moves.urllib_parse import urljoin class BasecampObject(object): def __init__(self, json_dict, endpoint): """ A Basecamp object retrieved from the API. The fields are stored in a special `_value...
from ..exc import * from . import util from .. import constants import abc import re import six from six.moves.urllib_parse import urljoin class BasecampObject(object): def __init__(self, json_dict, endpoint): """ A Basecamp object retrieved from the API. The fields are stored in a special `_value...
en
003321949_phistrom-basecampy3_base_c7d48742b37e.py
unknown
2,717
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries # # SPDX-License-Identifier: MIT import time import board import usb_cdc import adafruit_scd4x from adafruit_bme280 import basic as adafruit_bme280 import neopixel #--| User Config |----------------------------------- DATA_FORMAT = "JSON" # data ...
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries # # SPDX-License-Identifier: MIT import time import board import usb_cdc import adafruit_scd4x from adafruit_bme280 import basic as adafruit_bme280 import neopixel #--| User Config |----------------------------------- DATA_FORMAT = "JSON" # data ...
en
004875606_adafruit-Adafruit_Learning_System_Guides_enviromon_3243f1cd69c6.py
unknown
812
"""Util functions for integration""" import asyncio import logging _LOGGER: logging.Logger = logging.getLogger(__package__) def get_child_value(data, path, default_value=None): """Extract values from mutli level dictionaries based on path""" value = data for key in path.split("."): try: ...
"""Util functions for integration""" import asyncio import logging _LOGGER: logging.Logger = logging.getLogger(__package__) def get_child_value(data, path, default_value=None): """Extract values from mutli level dictionaries based on path""" value = data for key in path.split("."): try: ...
en
005517982_bacco007-HomeAssistantConfig_util_c6ffd5d7e5af.py
unknown
495
"""Zurich Instruments Toolkit (zhinst-toolkit) Command Table Module. This module provides a :class:`CommandTable` class to create and modify ZI device command tables. """ import copy import json import typing as t import jsonref import jsonschema from zhinst.toolkit.exceptions import ValidationError # JSON Schema ...
"""Zurich Instruments Toolkit (zhinst-toolkit) Command Table Module. This module provides a :class:`CommandTable` class to create and modify ZI device command tables. """ import copy import json import typing as t import jsonref import jsonschema from zhinst.toolkit.exceptions import ValidationError # JSON Schema ...
en
002605308_zhinst-zhinst-toolkit_command_table_2901b58c991f.py
unknown
4,100
"""Command models to stop heating a Thermocycler's block.""" from __future__ import annotations from typing import Optional, TYPE_CHECKING from typing_extensions import Literal, Type from pydantic import BaseModel, Field from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate if TYPE_CHECKING: ...
"""Command models to stop heating a Thermocycler's block.""" from __future__ import annotations from typing import Optional, TYPE_CHECKING from typing_extensions import Literal, Type from pydantic import BaseModel, Field from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate if TYPE_CHECKING: ...
en
001003007_Opentrons-opentrons_deactivate_block_ffbc06822d22.py
unknown
630
#!/usr/bin/python #-*- coding: utf-8 -*- ''' http://segmentfault.com/q/1010000000174213 Python验证用户输入IP的合法性,有什么好方法吗? 如:<input type="text" name="ip" id="ip" /> 在text里表单输入的字符串 ''' ########################################################################### # 1. 通过正则表达式判断 import re def ipFormatChk(ip_str): pattern ...
#!/usr/bin/python #-*- coding: utf-8 -*- ''' http://segmentfault.com/q/1010000000174213 Python验证用户输入IP的合法性,有什么好方法吗? 如:<input type="text" name="ip" id="ip" /> 在text里表单输入的字符串 ''' ########################################################################### # 1. 通过正则表达式判断 import re def ipFormatChk(ip_str): pattern ...
en
003931349_gistable-gistable_snippet_d6f65d1a0e2c.py
unknown
483
""" ============================================================ Figure and Color Control using Check boxes and Radio Buttons ============================================================ This example shows how to use the CheckBox UI API. We will demonstrate how to create a cube, sphere, cone and arrow and control its ...
""" ============================================================ Figure and Color Control using Check boxes and Radio Buttons ============================================================ This example shows how to use the CheckBox UI API. We will demonstrate how to create a cube, sphere, cone and arrow and control its ...
en
003041583_fury-gl-fury_viz_check_boxes_8b4f9af55f53.py
unknown
1,361
import flatbuffers import multiprocessing import queue from threading import Thread from rlbot.messages.flat import QuickChat from rlbot.messages.flat import QuickChatSelection from rlbot.utils.logging_utils import get_logger from rlbot.utils.structures.utils import create_enum_object """ Look for quick chats from ...
import flatbuffers import multiprocessing import queue from threading import Thread from rlbot.messages.flat import QuickChat from rlbot.messages.flat import QuickChatSelection from rlbot.utils.logging_utils import get_logger from rlbot.utils.structures.utils import create_enum_object """ Look for quick chats from ...
en
004904442_RLBot-RLBot_quick_chats_6ec5ee34fb6e.py
unknown
518
"""This module define the label entity.""" # Copyright (C) 2021-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import datetime import os from enum import Enum, auto from typing import Optional from otx.api.entities.color import Color from otx.api.entities.id import ID from otx.api.utils.time_utils im...
"""This module define the label entity.""" # Copyright (C) 2021-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import datetime import os from enum import Enum, auto from typing import Optional from otx.api.entities.color import Color from otx.api.entities.id import ID from otx.api.utils.time_utils im...
en
004853696_openvinotoolkit-training_extensions_label_857593cb5d6f.py
unknown
1,884
import os import sys import time import logging import numpy as np import random import json import torch import torch.distributed as dist from torch.utils.data import DataLoader, Dataset from torch.utils.data.sampler import RandomSampler, SequentialSampler from torch.utils.data.distributed import DistributedSampler fr...
import os import sys import time import logging import numpy as np import random import json import torch import torch.distributed as dist from torch.utils.data import DataLoader, Dataset from torch.utils.data.sampler import RandomSampler, SequentialSampler from torch.utils.data.distributed import DistributedSampler fr...
en
001719006_microsoft-DeepSpeedExamples_deepspeed_train_0e63d175a90b.py
unknown
6,295
import re # noqa: D100 from datetime import datetime, timedelta, timezone from typing import Union from slack_bolt.context.async_context import AsyncBoltContext from modules.models.slack_models.action_models import SlackActionRequestBody from modules.models.slack_models.command_models import SlackCommandRequestBody ...
import re # noqa: D100 from datetime import datetime, timedelta, timezone from typing import Union from slack_bolt.context.async_context import AsyncBoltContext from modules.models.slack_models.action_models import SlackActionRequestBody from modules.models.slack_models.command_models import SlackCommandRequestBody ...
en
005160118_OperationCode-operationcode-pybot_greeting_handler_bd4ab7f8447d.py
unknown
1,270
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
en
004366608_genforce-genforce_persistence_c5cc81a82366.py
unknown
2,507
import math import paddle import paddle.nn as nn import paddle.nn.functional as F from paddleclas.ppcls.arch.backbone.model_zoo.vision_transformer import VisionTransformer class Slice(nn.Layer): def __init__(self, start_index=1): super(Slice, self).__init__() self.start_index = start_index ...
import math import paddle import paddle.nn as nn import paddle.nn.functional as F from paddleclas.ppcls.arch.backbone.model_zoo.vision_transformer import VisionTransformer class Slice(nn.Layer): def __init__(self, start_index=1): super(Slice, self).__init__() self.start_index = start_index ...
en
001242161_PaddlePaddle-PaddleHub_vit_553f11ce5993.py
unknown
2,355
# 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 # distributed under t...
# 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 # distributed under t...
en
000003571_openstack-keystoneauth_base_d7179096b2c2.py
unknown
1,544
# stores the class containing more detailed informaiton about transmission in spatial models import numpy as np import pandas as pd from matplotlib import pyplot as plt import Eir.exceptions as e """ """ class Simul_Details(): """ This class returns details about the simulation from the spatial model object. ...
# stores the class containing more detailed informaiton about transmission in spatial models import numpy as np import pandas as pd from matplotlib import pyplot as plt import Eir.exceptions as e """ """ class Simul_Details(): """ This class returns details about the simulation from the spatial model object. ...
en
004920820_mjacob1002-Eir_simul_details_1e94fc9d8bae.py
unknown
3,372
# vim: sw=4:ts=4:et:cc=120 import io import json import logging import os.path import shutil import tempfile import time from subprocess import Popen, PIPE from urllib.parse import urlparse import ace_api import saq from saq.analysis import Analysis, RootAnalysis, _JSONEncoder from saq.cloudphish import * from saq.c...
# vim: sw=4:ts=4:et:cc=120 import io import json import logging import os.path import shutil import tempfile import time from subprocess import Popen, PIPE from urllib.parse import urlparse import ace_api import saq from saq.analysis import Analysis, RootAnalysis, _JSONEncoder from saq.cloudphish import * from saq.c...
en
001607370_IntegralDefense-ACE_cloudphish_7cb7377d91e8.py
unknown
5,877
import geoacumen_city import maxminddb from flask import current_app IP_ADDR_LOOKUP = maxminddb.open_database( current_app.config.get("GEOIP_DATABASE_PATH", geoacumen_city.db_path) ) def lookup_ip_address(addr): try: response = IP_ADDR_LOOKUP.get(addr) return response["country"]["iso_code"] ...
import geoacumen_city import maxminddb from flask import current_app IP_ADDR_LOOKUP = maxminddb.open_database( current_app.config.get("GEOIP_DATABASE_PATH", geoacumen_city.db_path) ) def lookup_ip_address(addr): try: response = IP_ADDR_LOOKUP.get(addr) return response["country"]["iso_code"] ...
en
003717420_CTFd-CTFd_geoip_98752bd634b8.py
unknown
191
# Copyright 2014-2018 ARM Limited # # 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 w...
# Copyright 2014-2018 ARM Limited # # 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 w...
en
002270453_ARM-software-lisa_cpufreq_670fadd8c509.py
unknown
7,030
"""Development dependencies setup script.""" import argparse import pathlib import subprocess import sys import tarfile import requests submodules = [ "cobmo", ] # Get repository base path. base_path = pathlib.Path(__file__).parent.absolute() # Get command line arguments. parser = argparse.ArgumentParser(descr...
"""Development dependencies setup script.""" import argparse import pathlib import subprocess import sys import tarfile import requests submodules = [ "cobmo", ] # Get repository base path. base_path = pathlib.Path(__file__).parent.absolute() # Get command line arguments. parser = argparse.ArgumentParser(descr...
en
005272634_mesmo-dev-mesmo_development_setup_020eb0c02b46.py
unknown
980
""" create association between reads and bubbles. """ # Dependencies to be installed: pysam, pyfaidx,xopen,pyvcf,protobuf import pyfaidx from xopen import xopen import stream import logging from . import vg_pb2 from collections import Counter import sys from collections import defaultdict from .core import ReadSet, R...
""" create association between reads and bubbles. """ # Dependencies to be installed: pysam, pyfaidx,xopen,pyvcf,protobuf import pyfaidx from xopen import xopen import stream import logging from . import vg_pb2 from collections import Counter import sys from collections import defaultdict from .core import ReadSet, R...
en
002265033_shilpagarg-WHdenovo_phaseg_e63acfb1ccc5.py
unknown
9,908
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # # Code generated by aaz-dev-tools # --------------------------------...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # # Code generated by aaz-dev-tools # --------------------------------...
en
004402765_Azure-azure-cli_update_751a7c81fdbf.py
unknown
6,116
__author__ = 'robert' import logging import os # For path names working under Windows and Linux from main import add_parameters, add_exploration, run_neuron, neuron_postproc from pypet import Environment def mypipeline(traj): """A pipeline function that defines the entire experiment :param traj: C...
__author__ = 'robert' import logging import os # For path names working under Windows and Linux from main import add_parameters, add_exploration, run_neuron, neuron_postproc from pypet import Environment def mypipeline(traj): """A pipeline function that defines the entire experiment :param traj: C...
en
002320486_SmokinCaterpillar-pypet_pipeline_ecba4a5b95fc.py
unknown
371
""" This module contains all function from Chapter 3 of Python for Marketing Research and Analytics """ def iqr(x): """Return the interquartile range of the input numpy array arguments: x: numpy array of numeric type returns: the interquartile range of x""" return x.quantile(0.75) - x.quantile(0.2...
""" This module contains all function from Chapter 3 of Python for Marketing Research and Analytics """ def iqr(x): """Return the interquartile range of the input numpy array arguments: x: numpy array of numeric type returns: the interquartile range of x""" return x.quantile(0.75) - x.quantile(0.2...
en
002849036_python-marketing-research-python-marketing-research-1ed_chapter3_ba64052759b5.py
unknown
98
# -*- coding: UTF-8 -*- from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import login_required from django.shortcuts import render from django.template import RequestContext from django.http import HttpResponse from django.contrib import auth from controller.core.public...
# -*- coding: UTF-8 -*- from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import login_required from django.shortcuts import render from django.template import RequestContext from django.http import HttpResponse from django.contrib import auth from controller.core.public...
en
001290262_hanson007-FirstBlood_views_07d0f59f1747.py
unknown
345
# pylint: disable=no-name-in-module import re from zlib import crc32 class _NameMangler: _regex = re.compile(r"([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))") def words(self, name): """ Split a string into words. Should correctly handle splitting: camelCase PascalCase k...
# pylint: disable=no-name-in-module import re from zlib import crc32 class _NameMangler: _regex = re.compile(r"([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))") def words(self, name): """ Split a string into words. Should correctly handle splitting: camelCase PascalCase k...
en
002461376_irgeek-StrEnum_name_mangler_a35d4ce7e6d4.py
unknown
1,017
# ---------------------------------------------------------------------------- # This software is in the public domain, furnished "as is", without technical # support, and with no warranty, express or implied, as to its usefulness for # any purpose. # # StormSurgeThreat # # Author: Tom LeFebvre/Pablo Santos # April 20,...
# ---------------------------------------------------------------------------- # This software is in the public domain, furnished "as is", without technical # support, and with no warranty, express or implied, as to its usefulness for # any purpose. # # StormSurgeThreat # # Author: Tom LeFebvre/Pablo Santos # April 20,...
en
005100342_Unidata-awips2_TCStormSurgeThreat_d7e7689a6bf5.py
unknown
10,748
# Copyright (c) 2020, Huawei Technologies.All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law...
# Copyright (c) 2020, Huawei Technologies.All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law...
en
002432338_Ascend-ModelZoo-PyTorch_crossentropy_7aa3cbfa36f7.py
unknown
713
""" An interface the clients should implement. This class is primarily a helper for the library and user code should not use it directly. """ import time from typing import ( Any, Optional, TYPE_CHECKING, ) import requests import bioblend # The following import must be preserved for compatibility becau...
""" An interface the clients should implement. This class is primarily a helper for the library and user code should not use it directly. """ import time from typing import ( Any, Optional, TYPE_CHECKING, ) import requests import bioblend # The following import must be preserved for compatibility becau...
en
003150253_galaxyproject-bioblend_client_10a3b7bbc99d.py
unknown
2,315
# -*- coding: utf-8 -*- """ Copyright (c) 2017 beyond-blockchain.org. 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 l...
# -*- coding: utf-8 -*- """ Copyright (c) 2017 beyond-blockchain.org. 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 l...
en
000351812_beyond-blockchain-bbc1_key_exchange_manager_5364895499ba.py
unknown
2,655
from os.path import exists, join from pythonforandroid.recipe import BootstrapNDKRecipe from pythonforandroid.toolchain import current_directory, shprint import sh class LibSDL2Recipe(BootstrapNDKRecipe): version = "2.26.1" url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL2-{ve...
from os.path import exists, join from pythonforandroid.recipe import BootstrapNDKRecipe from pythonforandroid.toolchain import current_directory, shprint import sh class LibSDL2Recipe(BootstrapNDKRecipe): version = "2.26.1" url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL2-{ve...
en
003561361_kivy-python-for-android_init_e4f9713d99df.py
unknown
518
"""Provide the basic bit-vector types. .. autosummary:: :nosignatures: Term Constant Variable bitvectify """ import math from sympy.core import basic class Term(basic.Basic): """Represent bit-vector terms. Bit-vector terms are constants, variables and operations applied to terms. B...
"""Provide the basic bit-vector types. .. autosummary:: :nosignatures: Term Constant Variable bitvectify """ import math from sympy.core import basic class Term(basic.Basic): """Represent bit-vector terms. Bit-vector terms are constants, variables and operations applied to terms. B...
en
002671173_ranea-CASCADA_core_17a35f1a9f89.py
unknown
5,319
""" FilterSets allow clients to specify querystrings that will determine the data that is retrieved in GET requests. By default, Django Rest Framework uses the 'django-filter' package as its backend. Django-filter also has a section in its documentation specifically regarding DRF integration. https://django-filter.rea...
""" FilterSets allow clients to specify querystrings that will determine the data that is retrieved in GET requests. By default, Django Rest Framework uses the 'django-filter' package as its backend. Django-filter also has a section in its documentation specifically regarding DRF integration. https://django-filter.rea...
en
003100901_evennia-evennia_filters_116c240558bd.py
unknown
1,207
import tensorflow as tf from nalp.corpus import TextCorpus from nalp.datasets import LanguageModelingDataset from nalp.encoders import IntegerEncoder from nalp.models.generators import LSTMGenerator from opytimizer import Opytimizer from opytimizer.core import Function from opytimizer.optimizers.swarm import PSO from ...
import tensorflow as tf from nalp.corpus import TextCorpus from nalp.datasets import LanguageModelingDataset from nalp.encoders import IntegerEncoder from nalp.models.generators import LSTMGenerator from opytimizer import Opytimizer from opytimizer.core import Function from opytimizer.optimizers.swarm import PSO from ...
en
005436914_gugarosa-opytimizer_lstm_5b4a39ce762a.py
unknown
654
# -*- coding: utf-8 -*- ''' Backports changes from PR to release branch. Requires multiple separate runs as part of the implementation. First run should do the following: 1. Merge release branch with a first parent of merge-commit of PR (using 'ours' strategy). (branch: backport/{branch}/{pr}) 2. Create temporary bra...
# -*- coding: utf-8 -*- ''' Backports changes from PR to release branch. Requires multiple separate runs as part of the implementation. First run should do the following: 1. Merge release branch with a first parent of merge-commit of PR (using 'ours' strategy). (branch: backport/{branch}/{pr}) 2. Create temporary bra...
en
004337671_alldatacenter-alldata_cherrypick_8a657beddf72.py
unknown
2,782
#!/usr/bin/env python """Doxygen XML to SWIG docstring converter for ITK classes. Usage: itk_doxy2swig.py [input directory name] [output swing interface file name] """ import sys import os import glob from doxy2swig import * from io import StringIO class itkDoxy2SWIG(Doxy2SWIG): def __init__(self, src, cpp_...
#!/usr/bin/env python """Doxygen XML to SWIG docstring converter for ITK classes. Usage: itk_doxy2swig.py [input directory name] [output swing interface file name] """ import sys import os import glob from doxy2swig import * from io import StringIO class itkDoxy2SWIG(Doxy2SWIG): def __init__(self, src, cpp_...
en
003656223_InsightSoftwareConsortium-ITK_itk_doxy2swig_b4aa941401d2.py
unknown
1,413
""" Copyright 2016 ElasticBox 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 agreed to in ...
""" Copyright 2016 ElasticBox 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 agreed to in ...
en
000753787_ElasticBox-elastickube_init_e562986f2a16.py
unknown
1,862
from time import time import pandas as pd from sklearn.model_selection import train_test_split import numpy as np import argparse import pdb from sklearn.metrics import f1_score, roc_auc_score, accuracy_score import glob from sklearn.linear_model import LogisticRegression from util import ManDist, generate_confidence_i...
from time import time import pandas as pd from sklearn.model_selection import train_test_split import numpy as np import argparse import pdb from sklearn.metrics import f1_score, roc_auc_score, accuracy_score import glob from sklearn.linear_model import LogisticRegression from util import ManDist, generate_confidence_i...
en
005138011_malllabiisc-DiPS_train_LR_34fa3dc6c9a8.py
unknown
1,950
# coding: utf-8 import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class TaskParam: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
# coding: utf-8 import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class TaskParam: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
en
001461711_huaweicloud-huaweicloud-sdk-python-v3_task_param_765310dbf486.py
unknown
1,474
import datetime import os from typing import Dict, List, Optional from urllib.parse import urlencode import shortuuid from django.conf import settings from django.core.files.base import ContentFile from django.db import models from django.db.models import Q from django.db.models.signals import post_save from django.ht...
import datetime import os from typing import Dict, List, Optional from urllib.parse import urlencode import shortuuid from django.conf import settings from django.core.files.base import ContentFile from django.db import models from django.db.models import Q from django.db.models.signals import post_save from django.ht...
en
000071059_stencila-hub_projects_aa792a1bf2ae.py
unknown
6,353
#!/usr/bin/env python3 # This file is covered by the LICENSE file in the root of this project. import imp import torch import torch.nn as nn import torch.nn.functional as F from model.tasks.semantic.postproc.CRF import CRF import __init__ as booger class Segmentator(nn.Module): def __init__(self, ...
#!/usr/bin/env python3 # This file is covered by the LICENSE file in the root of this project. import imp import torch import torch.nn as nn import torch.nn.functional as F from model.tasks.semantic.postproc.CRF import CRF import __init__ as booger class Segmentator(nn.Module): def __init__(self, ...
en
000500389_VirtualRoyalty-PointCloudSegmentation_segmentator_9991f02a6444.py
unknown
1,915
""" Convert between any two formats using pandoc, and related filters """ import os from pandocfilters import Image, applyJSONFilters # type:ignore from nbconvert.utils.base import NbConvertBase from nbconvert.utils.pandoc import pandoc def convert_pandoc(source, from_format, to_format, extra_args=None): """Co...
""" Convert between any two formats using pandoc, and related filters """ import os from pandocfilters import Image, applyJSONFilters # type:ignore from nbconvert.utils.base import NbConvertBase from nbconvert.utils.pandoc import pandoc def convert_pandoc(source, from_format, to_format, extra_args=None): """Co...
en
003531764_jupyter-nbconvert_pandoc_37f6b7c6a53c.py
unknown
725
import numpy as np from ray.rllib.utils.framework import try_import_torch torch, nn = try_import_torch() class VDNMixer(nn.Module): def __init__(self): super(VDNMixer, self).__init__() def forward(self, agent_qs, batch): return torch.sum(agent_qs, dim=2, keepdim=True) class QMixer(nn.Modu...
import numpy as np from ray.rllib.utils.framework import try_import_torch torch, nn = try_import_torch() class VDNMixer(nn.Module): def __init__(self): super(VDNMixer, self).__init__() def forward(self, agent_qs, batch): return torch.sum(agent_qs, dim=2, keepdim=True) class QMixer(nn.Modu...
en
000518485_ray-project-ray_mixers_fa6878e75ae0.py
unknown
722
"""Add has function and dependent pgcrpyto Revision ID: 5552dfae2cb0 Revises: c225ea8fbf5e Create Date: 2019-09-14 06:19:36.520447 """ # revision identifiers, used by Alembic. revision = '5552dfae2cb0' down_revision = 'c225ea8fbf5e' branch_labels = None depends_on = None from alembic import op import sqlalchemy as ...
"""Add has function and dependent pgcrpyto Revision ID: 5552dfae2cb0 Revises: c225ea8fbf5e Create Date: 2019-09-14 06:19:36.520447 """ # revision identifiers, used by Alembic. revision = '5552dfae2cb0' down_revision = 'c225ea8fbf5e' branch_labels = None depends_on = None from alembic import op import sqlalchemy as ...
en
005175053_fake-name-ReadableWebProxy_2019-09-14_5552dfae2cb0_add_hash_function_and_dependent_pgcrpyto_929597bb3fb9.py
unknown
483
import os #Functions for manipulating datetime objects #CCYY-MM-DDThh:mm:ssZ def parseDateClass(s): year, month, day = s.split("-") day, tail = day[:2], day[2:] hour, minute, second = tail[1:].split(":") second = second[:2] year, month, day = int(year), int(month), int(day) hour, minute, secon...
import os #Functions for manipulating datetime objects #CCYY-MM-DDThh:mm:ssZ def parseDateClass(s): year, month, day = s.split("-") day, tail = day[:2], day[2:] hour, minute, second = tail[1:].split(":") second = second[:2] year, month, day = int(year), int(month), int(day) hour, minute, secon...
en
003106367_kuri65536-python-for-android_dateFuncs_12b8870cd0d0.py
unknown
737
# -*- coding: utf-8 -*- from dataclasses import dataclass from typing import Optional from typing import Sequence from typing import Union import matplotlib as mpl from pkg_resources import resource_filename Numbers = Union[int, float] @dataclass class Theme: name: str = "light" path: Optional[str] = None ...
# -*- coding: utf-8 -*- from dataclasses import dataclass from typing import Optional from typing import Sequence from typing import Union import matplotlib as mpl from pkg_resources import resource_filename Numbers = Union[int, float] @dataclass class Theme: name: str = "light" path: Optional[str] = None ...
en
004815430_GoLP-IST-nata_elements_f896fde2527d.py
unknown
841
# mypy: ignore-errors from typing import Any, List, Dict, Union import os import os.path as osp from pathlib import Path import json import numpy as np from gluonts.dataset.common import ListDataset from gluonts.model.predictor import Predictor from gluonts.dataset.field_names import FieldName from utils import get_...
# mypy: ignore-errors from typing import Any, List, Dict, Union import os import os.path as osp from pathlib import Path import json import numpy as np from gluonts.dataset.common import ListDataset from gluonts.model.predictor import Predictor from gluonts.dataset.field_names import FieldName from utils import get_...
en
003497884_aws-amazon-sagemaker-examples_inference_ace256f29733.py
unknown
496
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. from mixbox import entities from mixbox import fields import cybox.bindings.account_object as account_binding from cybox.common import ObjectProperties, String, DateTime from cybox.common.vocabs import VocabField ...
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. from mixbox import entities from mixbox import fields import cybox.bindings.account_object as account_binding from cybox.common import ObjectProperties, String, DateTime from cybox.common.vocabs import VocabField ...
en
001473484_CybOXProject-python-cybox_account_object_7455fe162a3f.py
unknown
583
"""Certbot compatibility test interfaces""" from abc import ABCMeta from abc import abstractmethod import argparse from typing import cast from typing import Set from certbot import interfaces from certbot.configuration import NamespaceConfig class PluginProxy(interfaces.Plugin, metaclass=ABCMeta): """Wraps a Ce...
"""Certbot compatibility test interfaces""" from abc import ABCMeta from abc import abstractmethod import argparse from typing import cast from typing import Set from certbot import interfaces from certbot.configuration import NamespaceConfig class PluginProxy(interfaces.Plugin, metaclass=ABCMeta): """Wraps a Ce...
en
004371143_certbot-certbot_interfaces_f91ef7a7fff6.py
unknown
507
"""Provides RogueEnv, a gym environment which wraps rogue_gym_core::Runtime""" from enum import Enum, Flag import gym from gym import spaces import json import numpy as np from numpy import ndarray from typing import Dict, List, NamedTuple, Optional, Tuple, Union from rogue_gym_python import _rogue_gym as rogue_gym_inn...
"""Provides RogueEnv, a gym environment which wraps rogue_gym_core::Runtime""" from enum import Enum, Flag import gym from gym import spaces import json import numpy as np from numpy import ndarray from typing import Dict, List, NamedTuple, Optional, Tuple, Union from rogue_gym_python import _rogue_gym as rogue_gym_inn...
en
000640744_kngwyu-rogue-gym_rogue_env_4d4850274360.py
unknown
2,557
class DecayStrategy: def __init__(self, total_epoch: int, enable: bool = True) -> None: self.total_epoch = total_epoch self.enable = enable def __call__(self, epoch: int): decay = 1.0 if self.enable: decay = 1.0 - epoch / self.total_epoch if decay < 0: ...
class DecayStrategy: def __init__(self, total_epoch: int, enable: bool = True) -> None: self.total_epoch = total_epoch self.enable = enable def __call__(self, epoch: int): decay = 1.0 if self.enable: decay = 1.0 - epoch / self.total_epoch if decay < 0: ...
en
004589106_zju-vipa-KamalEngine_decay_strategy_bd883ce8d875.py
unknown
108
#! /usr/bin/env python3 # # Copyright (c) 2017-23 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 # import argparse import traceback import tcfl.tc def _healthcheck(target, cli_args): if cli_args.interfaces == []: # no interface list give; scan the list of interfaces the # target expos...
#! /usr/bin/env python3 # # Copyright (c) 2017-23 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 # import argparse import traceback import tcfl.tc def _healthcheck(target, cli_args): if cli_args.interfaces == []: # no interface list give; scan the list of interfaces the # target expos...
en
001586944_intel-tcf_healthcheck_fdb7333375cf.py
unknown
755
import os import tarfile import urllib DETECTION_MODELS_URL = 'http://download.tensorflow.org/models/object_detection/' def extract_tf_frozen_graph(model_name, extracted_model_path): # define model archive name tf_model_tar = model_name + '.tar.gz' # define link to retrieve model archive model_link =...
import os import tarfile import urllib DETECTION_MODELS_URL = 'http://download.tensorflow.org/models/object_detection/' def extract_tf_frozen_graph(model_name, extracted_model_path): # define model archive name tf_model_tar = model_name + '.tar.gz' # define link to retrieve model archive model_link =...
en
002889626_opencv-opencv_py_to_py_ssd_mobilenet_e4988fbcf3dc.py
unknown
474
""" A fully functional VTK widget for tkinter that uses vtkGenericRenderWindowInteractor. The widget is called vtkTkRenderWindowInteractor. The initialization part of this code is similar to that of the vtkTkRenderWidget. Created by Prabhu Ramachandran, April 2002 """ from __future__ import absolute_import import...
""" A fully functional VTK widget for tkinter that uses vtkGenericRenderWindowInteractor. The widget is called vtkTkRenderWindowInteractor. The initialization part of this code is similar to that of the vtkTkRenderWidget. Created by Prabhu Ramachandran, April 2002 """ from __future__ import absolute_import import...
en
000733658_Kitware-VTK_vtkTkRenderWindowInteractor_4d24b64fb6f2.py
unknown
4,837
import tensorrt as trt import numpy as np import torch from torch2trt.torch2trt import tensorrt_converter, get_arg, torch_dim_resolve_negative, add_missing_trt_tensors, torch_dim_to_trt_axes from torch2trt.module_test import add_module_test @tensorrt_converter('torch.Tensor.unsqueeze') @tensorrt_converter('torch.unsq...
import tensorrt as trt import numpy as np import torch from torch2trt.torch2trt import tensorrt_converter, get_arg, torch_dim_resolve_negative, add_missing_trt_tensors, torch_dim_to_trt_axes from torch2trt.module_test import add_module_test @tensorrt_converter('torch.Tensor.unsqueeze') @tensorrt_converter('torch.unsq...
en
005661785_NVIDIA-AI-IOT-torch2trt_unsqueeze_6ff38a3bddd6.py
unknown
640
#!/usr/bin/env python3 import inspect from migen import * MIGEN_SIGNALS = ("reset", "ce") def get_ultimate_caller_modulename(): """ Helper to find the ultimate caller's module name (extra level further up stack than case where test directly inherits from BaseUsbTestCase). """ caller = inspect.s...
#!/usr/bin/env python3 import inspect from migen import * MIGEN_SIGNALS = ("reset", "ce") def get_ultimate_caller_modulename(): """ Helper to find the ultimate caller's module name (extra level further up stack than case where test directly inherits from BaseUsbTestCase). """ caller = inspect.s...
en
002346476_im-tomu-valentyusb_tester_0485db4988a8.py
unknown
1,188
# Copyright (c) 2016, Vladimir Feinberg # Licensed under the BSD 3-clause license (see LICENSE) # This file was modified from the GPy project. Its file header is replicated # below. Its LICENSE.txt is replicated in the LICENSE file for this directory. # Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licens...
# Copyright (c) 2016, Vladimir Feinberg # Licensed under the BSD 3-clause license (see LICENSE) # This file was modified from the GPy project. Its file header is replicated # below. Its LICENSE.txt is replicated in the LICENSE file for this directory. # Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licens...
en
002682595_vlad17-runlmc_normalizer_3ba4c58b368a.py
unknown
408
import operator from abc import ABCMeta, abstractmethod from functools import wraps from flask import request from flask._compat import with_metaclass from .allows import _call_requirement from .overrides import current_overrides __all__ = ( "Requirement", "ConditionalRequirement", "wants_request", "...
import operator from abc import ABCMeta, abstractmethod from functools import wraps from flask import request from flask._compat import with_metaclass from .allows import _call_requirement from .overrides import current_overrides __all__ = ( "Requirement", "ConditionalRequirement", "wants_request", "...
en
004597430_justanr-flask-allows_requirements_84326225056c.py
unknown
1,606
"""Module containing step_env. step_env is the recommended way to run a step on an environment. If you need custom steps, use this as an example. Copyright 2023 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...
"""Module containing step_env. step_env is the recommended way to run a step on an environment. If you need custom steps, use this as an example. Copyright 2023 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...
en
002434066_google-research-self-organising-systems_step_maker_9a0eab2e60e9.py
unknown
1,972
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # # SPDX-License-Identifier: MIT """ Circuit Playground Bluefruit NeoPixel Light Meter. Shine a light on the front of the Circuit Playground Bluefruit to see the number of NeoPixels lit up increase. Cover the front of the CPB to see the number decre...
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # # SPDX-License-Identifier: MIT """ Circuit Playground Bluefruit NeoPixel Light Meter. Shine a light on the front of the Circuit Playground Bluefruit to see the number of NeoPixels lit up increase. Cover the front of the CPB to see the number decre...
en
005346255_adafruit-Adafruit_Learning_System_Guides_code_f8d3a81b4596.py
unknown
420
import os import logging import time import re from typing import Iterable, List import duo_client import azure.functions as func from .sentinel_connector import AzureSentinelConnector from .state_manager import StateManager logging.getLogger('azure.core.pipeline.policies.http_logging_policy').setLevel(logging.ERROR...
import os import logging import time import re from typing import Iterable, List import duo_client import azure.functions as func from .sentinel_connector import AzureSentinelConnector from .state_manager import StateManager logging.getLogger('azure.core.pipeline.policies.http_logging_policy').setLevel(logging.ERROR...
en
003215773_Azure-Azure-Sentinel_main_e3ba2d4fd71b.py
unknown
4,636
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import annotations from typing import TYPE_CHECKING, Container from refinery.units import Arg, Unit from refinery.lib.executable import Executable, ET, CompartmentNotFound from refinery.lib.structures import MemoryFile from refinery.lib.tools import NoLogg...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import annotations from typing import TYPE_CHECKING, Container from refinery.units import Arg, Unit from refinery.lib.executable import Executable, ET, CompartmentNotFound from refinery.lib.structures import MemoryFile from refinery.lib.tools import NoLogg...
en
003024955_binref-refinery_vmemref_550705a5c7a3.py
unknown
1,087
import logging from fastapi import status from httpx import AsyncClient, Response, Timeout from ..modules.dynamic_sidecar.api_client._base import ( BaseThinClient, expect_status, retry_on_errors, ) logger = logging.getLogger(__name__) class ThinDV2LocalhostClient(BaseThinClient): BASE_ADDRESS: str ...
import logging from fastapi import status from httpx import AsyncClient, Response, Timeout from ..modules.dynamic_sidecar.api_client._base import ( BaseThinClient, expect_status, retry_on_errors, ) logger = logging.getLogger(__name__) class ThinDV2LocalhostClient(BaseThinClient): BASE_ADDRESS: str ...
en
005476551_ITISFoundation-osparc-simcore_client_1618c0bfbad2.py
unknown
634
#!/usr/bin/env python # coding: utf-8 import mutagen.smf from music_tag.file import AudioFile # smf: standard midi file class SmfFile(AudioFile): tag_format = "SMF" mutagen_kls = mutagen.smf.SMF def __init__(self, filename, **kwargs): raise NotImplementedError("SMF format not implemented")
#!/usr/bin/env python # coding: utf-8 import mutagen.smf from music_tag.file import AudioFile # smf: standard midi file class SmfFile(AudioFile): tag_format = "SMF" mutagen_kls = mutagen.smf.SMF def __init__(self, filename, **kwargs): raise NotImplementedError("SMF format not implemented")
en
004405043_KristoforMaynard-music-tag_smf_189a2eb16df4.py
unknown
102
#!/usr/bin/env python """GRR Colab magics module. The module contains implementation of **magic** commands that use GRR API. """ import shlex from typing import Text from IPython.core import magic_arguments import pandas as pd from grr_colab import magics_impl _PATH_TYPE_CHOICES = [ magics_impl.OS, magics_impl...
#!/usr/bin/env python """GRR Colab magics module. The module contains implementation of **magic** commands that use GRR API. """ import shlex from typing import Text from IPython.core import magic_arguments import pandas as pd from grr_colab import magics_impl _PATH_TYPE_CHOICES = [ magics_impl.OS, magics_impl...
en
001820827_google-grr_magics_5d08f827b736.py
unknown
5,025
# Copyright 2020 The Google Earth Engine Community 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...
# Copyright 2020 The Google Earth Engine Community 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...
en
005087883_google-earthengine-community_gedi_rasterize_l2a_c216eb3b92e1.py
unknown
2,336
# -*- coding: utf-8 -*- from six import text_type, binary_type from prettytable import PrettyTable from os import path from contextlib import closing from xml.dom import minidom from six import text_type from hashlib import md5, sha1 from tqdm import tqdm import time import requests import logging import sys import os ...
# -*- coding: utf-8 -*- from six import text_type, binary_type from prettytable import PrettyTable from os import path from contextlib import closing from xml.dom import minidom from six import text_type from hashlib import md5, sha1 from tqdm import tqdm import time import requests import logging import sys import os ...
en
005199947_tencentyun-coscmd_cos_comm_25b96b346696.py
unknown
2,182
""" Setup file See https://packaging.python.org/tutorials/distributing-packages/ But basically: python3 setup.py sdist (that makes a new tgz in ./dist) gpg -u 5A2A5B10 --detach-sign -a dist/connectrum-XXX.tar.gz twine upload dist/connectrum-XXX.* git tag vXXXX -a "New release" git push --tags ...
""" Setup file See https://packaging.python.org/tutorials/distributing-packages/ But basically: python3 setup.py sdist (that makes a new tgz in ./dist) gpg -u 5A2A5B10 --detach-sign -a dist/connectrum-XXX.tar.gz twine upload dist/connectrum-XXX.* git tag vXXXX -a "New release" git push --tags ...
en
004582763_coinkite-connectrum_setup_95f4ddb2fb7a.py
unknown
584
#!/usr/bin/env python # coding: utf-8 import io import os import shutil import sys setting = sys.argv[1] data_dir = sys.argv[2] output_dir = 'l2m' SEP = '[sep]' ALIGN = '[align]' beam = 5 input_lyric_file = f'{data_dir}/para/valid.lyric' generate_melody_file = '../result/%s'%setting generated_file = True get_last =...
#!/usr/bin/env python # coding: utf-8 import io import os import shutil import sys setting = sys.argv[1] data_dir = sys.argv[2] output_dir = 'l2m' SEP = '[sep]' ALIGN = '[align]' beam = 5 input_lyric_file = f'{data_dir}/para/valid.lyric' generate_melody_file = '../result/%s'%setting generated_file = True get_last =...
en
002573478_microsoft-muzic_1_Gen_L2M_943b691cf117.py
unknown
1,752
# Copyright 2018 The TensorFlow Probability 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 law o...
# Copyright 2018 The TensorFlow Probability 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 law o...
en
002740145_tensorflow-probability_finite_discrete_5798d9a4000f.py
unknown
4,184
import os import glob import sys import numpy as np import aletheialib.utils import aletheialib.attacks from aletheialib.utils import download_octave_code from imageio import imread from multiprocessing import Pool as ThreadPool from multiprocessing import cpu_count from PIL import Image import aletheialib.octave_...
import os import glob import sys import numpy as np import aletheialib.utils import aletheialib.attacks from aletheialib.utils import download_octave_code from imageio import imread from multiprocessing import Pool as ThreadPool from multiprocessing import cpu_count from PIL import Image import aletheialib.octave_...
en
001072561_daniellerch-aletheia_structural_f8b80e895813.py
unknown
3,686
import itertools from operator import itemgetter from typing import Any, Callable, Collection, Dict, Iterable, List, Mapping, Optional, Set, Tuple from django.core.exceptions import ValidationError from django.db import connection from django.db.models import QuerySet from django.utils.translation import gettext as _ ...
import itertools from operator import itemgetter from typing import Any, Callable, Collection, Dict, Iterable, List, Mapping, Optional, Set, Tuple from django.core.exceptions import ValidationError from django.db import connection from django.db.models import QuerySet from django.utils.translation import gettext as _ ...
en
004381240_zulip-zulip_subscription_info_e42f50344e42.py
unknown
6,025
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ パラメータ計算する。 """ import os import numpy as np import lut class CalcParameters: def __init__(self, base_param): self.img_width = base_param['img_width'] self.img_height = base_param['img_height'] self.patch_size = base_param['patch_size'] ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ パラメータ計算する。 """ import os import numpy as np import lut class CalcParameters: def __init__(self, base_param): self.img_width = base_param['img_width'] self.img_height = base_param['img_height'] self.patch_size = base_param['patch_size'] ...
en
003058841_toru-ver4-sample_code_CalcParameters_65b70efcad35.py
unknown
685
from django import forms from .models import LeafPack, LeafPackType, Macroinvertebrate, LeafPackBug, LeafPackSensitivityGroup from dataloaderinterface.models import SiteRegistration from django.core.exceptions import ObjectDoesNotExist class MDLCheckboxSelectMultiple(forms.CheckboxSelectMultiple): template_name =...
from django import forms from .models import LeafPack, LeafPackType, Macroinvertebrate, LeafPackBug, LeafPackSensitivityGroup from dataloaderinterface.models import SiteRegistration from django.core.exceptions import ObjectDoesNotExist class MDLCheckboxSelectMultiple(forms.CheckboxSelectMultiple): template_name =...
en
001772219_ODM2-ODM2DataSharingPortal_forms_d412ad5c9c9f.py
unknown
3,112
from guillotina import configure from typing import Any from typing import Dict app_settings: Dict[str, Any] = {} def includeme(root, settings): configure.scan("guillotina.contrib.dyncontent.vocabularies") configure.scan("guillotina.contrib.dyncontent.subscriber")
from guillotina import configure from typing import Any from typing import Dict app_settings: Dict[str, Any] = {} def includeme(root, settings): configure.scan("guillotina.contrib.dyncontent.vocabularies") configure.scan("guillotina.contrib.dyncontent.subscriber")
en
005595395_plone-guillotina_init_504bdea43194.py
unknown
84
import re import sys import time import typing from seleniumwire.thirdparty.mitmproxy import exceptions from seleniumwire.thirdparty.mitmproxy.net.http import (headers, request, response, url) def get_header_tokens(headers, key): """ Retrieve all to...
import re import sys import time import typing from seleniumwire.thirdparty.mitmproxy import exceptions from seleniumwire.thirdparty.mitmproxy.net.http import (headers, request, response, url) def get_header_tokens(headers, key): """ Retrieve all to...
en
003404175_wkeeling-selenium-wire_read_86d486a952ec.py
unknown
3,373
# © Copyright Databand.ai, an IBM Company 2022 import inspect import re from typing import Callable, Dict, Iterable, Optional TYPE_HINT_RE = re.compile(r"#type:\((.*)\)->(.+)") class InvalidTypeHint(Exception): pass # re: Tuple[ Type1, Type2] _TUPLE_TYPE_RE = re.compile(r"^Tuple\[(.+)]$") def get_Tuple_...
# © Copyright Databand.ai, an IBM Company 2022 import inspect import re from typing import Callable, Dict, Iterable, Optional TYPE_HINT_RE = re.compile(r"#type:\((.*)\)->(.+)") class InvalidTypeHint(Exception): pass # re: Tuple[ Type1, Type2] _TUPLE_TYPE_RE = re.compile(r"^Tuple\[(.+)]$") def get_Tuple_...
en
000137650_databand-ai-dbnd_doc_annotations_857449a34832.py
unknown
1,170
# coding: utf8 from __future__ import unicode_literals import plac import shutil from pathlib import Path from ._messages import Messages from ..compat import path2str, json_dumps from ..util import prints from .. import util from .. import about @plac.annotations( input_dir=("directory with model data", "posit...
# coding: utf8 from __future__ import unicode_literals import plac import shutil from pathlib import Path from ._messages import Messages from ..compat import path2str, json_dumps from ..util import prints from .. import util from .. import about @plac.annotations( input_dir=("directory with model data", "posit...
en
002608368_ryfeus-lambda-packs_package_8c5869571af8.py
unknown
2,024
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class EnterpriseAuthApplyDTO(object): def __init__(self): self._apply_time = None self._audit_status = None self._auth_apply_id = None self._enterprise_code = None ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class EnterpriseAuthApplyDTO(object): def __init__(self): self._apply_time = None self._audit_status = None self._auth_apply_id = None self._enterprise_code = None ...
en
001629230_alipay-alipay-sdk-python-all_EnterpriseAuthApplyDTO_7c1ac51822fc.py
unknown
1,654
import random from primesieve import * # Purpose: # extended_euclid(num1, num2) follows the Extented Euclidean Algorithm to return # the coefficients and the Greatest Common Divisor of num1 and num2 of the linear # diophantine equation where integer multiples of num1 and num2 sum to give their GCD # Contract: Int In...
import random from primesieve import * # Purpose: # extended_euclid(num1, num2) follows the Extented Euclidean Algorithm to return # the coefficients and the Greatest Common Divisor of num1 and num2 of the linear # diophantine equation where integer multiples of num1 and num2 sum to give their GCD # Contract: Int In...
en
004100954_ridwanmsharif-prsa_euclid_3a36532cf3b2.py
unknown
404
import logging import sys def init_logging(path): logger = logging.getLogger('model_logger') for hdlr in logger.handlers: logger.removeHandler(hdlr) hdlr = logging.FileHandler(path) formatter = logging.Formatter('%(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) ch = loggin...
import logging import sys def init_logging(path): logger = logging.getLogger('model_logger') for hdlr in logger.handlers: logger.removeHandler(hdlr) hdlr = logging.FileHandler(path) formatter = logging.Formatter('%(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) ch = loggin...
en
004136753_larsmaaloee-BIVA_logger_416a51a8ac62.py
unknown
141
import contextlib import json import pathlib import socket import time import types from typing import Awaitable, Callable, Optional, TypeVar from pytest_mock_resources.hooks import get_pytest_flag, use_multiprocess_safe_mode try: import responses as _responses responses: Optional[types.ModuleType] = _respon...
import contextlib import json import pathlib import socket import time import types from typing import Awaitable, Callable, Optional, TypeVar from pytest_mock_resources.hooks import get_pytest_flag, use_multiprocess_safe_mode try: import responses as _responses responses: Optional[types.ModuleType] = _respon...
en
002628759_schireson-pytest-mock-resources_base_1e7c7dd1c85b.py
unknown
1,773
#!/usr/bin/python ######################################################################## # Copyright (c) 2017 # Daniel Plohmann <daniel.plohmann<at>mailbox<dot>org> # All rights reserved. ######################################################################## # # This file is part of apiscout # # apiscout is free ...
#!/usr/bin/python ######################################################################## # Copyright (c) 2017 # Daniel Plohmann <daniel.plohmann<at>mailbox<dot>org> # All rights reserved. ######################################################################## # # This file is part of apiscout # # apiscout is free ...
en
002165737_danielplohmann-apiscout_scout_932275b01cc7.py
unknown
1,788