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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from collections import OrderedDict
from ipywidgets import Widget, Tab
class ExtendedTab(Tab):
"""
A Tab subclass that allows to add/access/select/replace/remove children by name.
There can be only one tab for any given name.
Example:
import time
t = Extend... | # -*- coding: utf-8 -*-
from collections import OrderedDict
from ipywidgets import Widget, Tab
class ExtendedTab(Tab):
"""
A Tab subclass that allows to add/access/select/replace/remove children by name.
There can be only one tab for any given name.
Example:
import time
t = Extend... | en | 002440303_deeplook-ipyrest_extendedtab_093e2be98d4c.py | unknown | 717 |
# ------------------------------------------------------------------------------------------------
# Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
# -------------------------------------------------------------------------... | # ------------------------------------------------------------------------------------------------
# Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
# -------------------------------------------------------------------------... | en | 005599174_eslambakr-HRS_benchmark_ms_deform_attn_e958c034cd2c.py | unknown | 2,162 |
"""
Notice : 神兽保佑 ,测试一次通过
//
// ┏┛ ┻━━━━━┛ ┻┓
// ┃ ┃
// ┃ ━ ┃
// ┃ ┳┛ ┗┳ ┃
// ┃ ┃
// ┃ ┻ ┃
// ┃ ┃
// ┗━┓ ┏━━━┛
// ┃ ┃ Author: somewheve
// ┃ ┃ Datetime: 2019/7/3 下午8:46 ---> 无知即是罪恶
// ┃ ┗━━━━━━━━━┓
// ┃ ... | """
Notice : 神兽保佑 ,测试一次通过
//
// ┏┛ ┻━━━━━┛ ┻┓
// ┃ ┃
// ┃ ━ ┃
// ┃ ┳┛ ┗┳ ┃
// ┃ ┃
// ┃ ┻ ┃
// ┃ ┃
// ┗━┓ ┏━━━┛
// ┃ ┃ Author: somewheve
// ┃ ┃ Datetime: 2019/7/3 下午8:46 ---> 无知即是罪恶
// ┃ ┗━━━━━━━━━┓
// ┃ ... | en | 004828635_ctpbee-ctpbee_local_position_cba89669d079.py | unknown | 6,624 |
"""
Reddit comments
---------------
A collection of up to ~1.5 billion Reddit comments posted from
October 2007 through May 2015.
Records include the following key fields (plus a few others):
- ``body``: Full text of the comment.
- ``created_utc``: Date on which the comment was posted.
- ``subreddit``: S... | """
Reddit comments
---------------
A collection of up to ~1.5 billion Reddit comments posted from
October 2007 through May 2015.
Records include the following key fields (plus a few others):
- ``body``: Full text of the comment.
- ``created_utc``: Date on which the comment was posted.
- ``subreddit``: S... | en | 005639457_chartbeat-labs-textacy_reddit_comments_dd41d70f3bec.py | unknown | 4,005 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from django.http import HttpRequest
def source() -> str:
request = HttpRequest()
return request.GET["bad"]
def sink(argument: st... | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from django.http import HttpRequest
def source() -> str:
request = HttpRequest()
return request.GET["bad"]
def sink(argument: st... | en | 005513877_facebook-pyre-check_taint_9fd251ea2de2.py | unknown | 98 |
"""Spatial Dissimilarity Index."""
__author__ = "Renan X. Cortes <renanc@ucr.edu>, Sergio J. Rey <sergio.rey@ucr.edu> and Elijah Knaap <elijah.knaap@ucr.edu>"
import libpysal
import numpy as np
from libpysal.weights import Queen
from .._base import SingleGroupIndex, SpatialExplicitIndex
from .dissim import _dissim
... | """Spatial Dissimilarity Index."""
__author__ = "Renan X. Cortes <renanc@ucr.edu>, Sergio J. Rey <sergio.rey@ucr.edu> and Elijah Knaap <elijah.knaap@ucr.edu>"
import libpysal
import numpy as np
from libpysal.weights import Queen
from .._base import SingleGroupIndex, SpatialExplicitIndex
from .dissim import _dissim
... | en | 005596770_pysal-segregation_spatial_dissim_c7cbba1b3cc7.py | unknown | 1,408 |
# 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 | 003296220_mindspore-ai-models_pointTransfomrer_4aa2cdd24484.py | unknown | 3,593 |
"""
Conduct searches against all registry context.
"""
import math
from operator import itemgetter
from flask import abort
from stringscore import liquidmetal
from text_unidecode import unidecode
import features
from app import app, authentication, avatar
from auth import scopes
from auth.auth_context import get_aut... | """
Conduct searches against all registry context.
"""
import math
from operator import itemgetter
from flask import abort
from stringscore import liquidmetal
from text_unidecode import unidecode
import features
from app import app, authentication, avatar
from auth import scopes
from auth.auth_context import get_aut... | en | 002995759_quay-quay_search_1eeecbd30b46.py | unknown | 4,126 |
from pygments.lexer import RegexLexer, words, include
from pygments.token import *
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, Number, Operator, Generic, Text
from sphinxcontrib.domaintools import custom_domain
import re
__all__ = ['MinilangLexer']
class Minilang... | from pygments.lexer import RegexLexer, words, include
from pygments.token import *
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, Number, Operator, Generic, Text
from sphinxcontrib.domaintools import custom_domain
import re
__all__ = ['MinilangLexer']
class Minilang... | en | 003598869_wrapl-minilang_minilang_5aa1f4fdd5b5.py | unknown | 1,326 |
import os
import numpy as np
import yaml
import re
from edflow.data.dataset_mixin import DatasetMixin
from edflow.util import retrieve, get_obj_from_str, pp2mkdtable, pop_keypath
from edflow.util import walk, set_value, edprint
from edflow.data.believers.meta_loaders import DEFAULT_LOADERS
try:
from IPython impor... | import os
import numpy as np
import yaml
import re
from edflow.data.dataset_mixin import DatasetMixin
from edflow.util import retrieve, get_obj_from_str, pp2mkdtable, pop_keypath
from edflow.util import walk, set_value, edprint
from edflow.data.believers.meta_loaders import DEFAULT_LOADERS
try:
from IPython impor... | en | 000899950_pesser-edflow_meta_09fbed6837d7.py | unknown | 2,808 |
import logging
import os
from restic_compose_backup import utils
logger = logging.getLogger(__name__)
def run(image: str = None, command: str = None, volumes: dict = None,
environment: dict = None, labels: dict = None, source_container_id: str = None):
logger.info("Starting backup container")
client... | import logging
import os
from restic_compose_backup import utils
logger = logging.getLogger(__name__)
def run(image: str = None, command: str = None, volumes: dict = None,
environment: dict = None, labels: dict = None, source_container_id: str = None):
logger.info("Starting backup container")
client... | en | 005414885_ZettaIO-restic-compose-backup_backup_runner_9c6cd421a308.py | unknown | 517 |
import collections.abc
import contextlib
import inspect
import itertools
import re
from ._utils import (
IDENTITY,
NO_DEFAULT,
LazyList,
int_or_none,
is_iterable_like,
try_call,
variadic,
)
def traverse_obj(
obj, *paths, default=NO_DEFAULT, expected_type=None, get_all=True,
... | import collections.abc
import contextlib
import inspect
import itertools
import re
from ._utils import (
IDENTITY,
NO_DEFAULT,
LazyList,
int_or_none,
is_iterable_like,
try_call,
variadic,
)
def traverse_obj(
obj, *paths, default=NO_DEFAULT, expected_type=None, get_all=True,
... | en | 004069090_yt-dlp-yt-dlp_traversal_3b4688afdacf.py | unknown | 2,692 |
"""
"""
from pycsp3 import *
height, width = data.height, data.width
bugs, lengths = data.bugs, data.bugTypeLengths
nBugs, nTypes = len(bugs), len(lengths)
groups = [[i for i in range(nBugs) if data.bugs[i].type == k] for k in range(nTypes)] # groups[k] is the group of bugs of type k
# x[i][j] is the index of a bug ... | """
"""
from pycsp3 import *
height, width = data.height, data.width
bugs, lengths = data.bugs, data.bugTypeLengths
nBugs, nTypes = len(bugs), len(lengths)
groups = [[i for i in range(nBugs) if data.bugs[i].type == k] for k in range(nTypes)] # groups[k] is the group of bugs of type k
# x[i][j] is the index of a bug ... | en | 004399936_xcsp3team-pycsp3_Bugs_461bc58dcd52.py | unknown | 765 |
import yaml
import os.path as osp
import os
from eiseg import pjpath
def parse_configs(path):
if not path or not osp.exists(path):
return
with open(path, "r", encoding="utf-8") as f:
return yaml.load(f.read(), Loader=yaml.FullLoader)
def save_configs(path=None, config=None, actions=None):
... | import yaml
import os.path as osp
import os
from eiseg import pjpath
def parse_configs(path):
if not path or not osp.exists(path):
return
with open(path, "r", encoding="utf-8") as f:
return yaml.load(f.read(), Loader=yaml.FullLoader)
def save_configs(path=None, config=None, actions=None):
... | en | 005630950_PaddlePaddle-PaddleSeg_config_c888a9e02b0b.py | unknown | 423 |
# Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is
# licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | # Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is
# licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | en | 002475720_gardener-cc-utils_elasticsearch_766a465953da.py | unknown | 1,835 |
import numpy as np
import torch
from torch.cuda.amp import autocast
from torchvision.utils import make_grid
from base import BaseTrainer
from utils import MetricTracker, inf_loop
class Trainer(BaseTrainer):
"""
Trainer class
"""
def __init__(
self,
model,
criterion,
m... | import numpy as np
import torch
from torch.cuda.amp import autocast
from torchvision.utils import make_grid
from base import BaseTrainer
from utils import MetricTracker, inf_loop
class Trainer(BaseTrainer):
"""
Trainer class
"""
def __init__(
self,
model,
criterion,
m... | en | 001343048_tae898-age-gender_trainer_029d78047e7d.py | unknown | 1,340 |
from setuptools import setup
from setuptools.command.build_py import build_py
import subprocess
import warnings
import pathlib
LONG_DESCRIPTION = (
"Serves up pandas dataframes via the Django REST Framework for client-side"
"(i.e. d3.js) visualizations"
)
class BuildJS(build_py):
def run(self):
... | from setuptools import setup
from setuptools.command.build_py import build_py
import subprocess
import warnings
import pathlib
LONG_DESCRIPTION = (
"Serves up pandas dataframes via the Django REST Framework for client-side"
"(i.e. d3.js) visualizations"
)
class BuildJS(build_py):
def run(self):
... | en | 005185494_wq-django-rest-pandas_setup_39004b360fc8.py | unknown | 860 |
# Copyright 2018 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 2018 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 | 003910524_tensorflow-tensorflow_ragged_util_test_ab4a10fa09e7.py | unknown | 2,956 |
"""Component providing support for RainMachine programs and zones."""
from __future__ import annotations
import asyncio
from collections.abc import Awaitable, Callable, Coroutine
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Concatenate, ParamSpec, TypeVar
from regenmaschine.... | """Component providing support for RainMachine programs and zones."""
from __future__ import annotations
import asyncio
from collections.abc import Awaitable, Callable, Coroutine
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Concatenate, ParamSpec, TypeVar
from regenmaschine.... | en | 001529098_home-assistant-core_switch_5992f3d3c231.py | unknown | 5,417 |
import numpy as np
from typing import Sequence
def compose_matrices_instrinsic(elemental_rotations: Sequence[np.ndarray]):
"""
Compose three sets of elemental rotation matrices intrinsically.
Intrinsic rotations correspond to sequential rotations of a coordinate system which is
mobile, moving with th... | import numpy as np
from typing import Sequence
def compose_matrices_instrinsic(elemental_rotations: Sequence[np.ndarray]):
"""
Compose three sets of elemental rotation matrices intrinsically.
Intrinsic rotations correspond to sequential rotations of a coordinate system which is
mobile, moving with th... | en | 005500065_alisterburt-eulerangles_rotation_matrix_composition_d670ea79289e.py | unknown | 684 |
import logging
import numpy as np
from abcpy.probabilisticmodels import ProbabilisticModel, InputConnector
logging.basicConfig(level=logging.WARNING)
def setup_backend():
global backend
from abcpy.backends import BackendMPI as Backend
backend = Backend(process_per_model=2)
class NestedBivariateGauss... | import logging
import numpy as np
from abcpy.probabilisticmodels import ProbabilisticModel, InputConnector
logging.basicConfig(level=logging.WARNING)
def setup_backend():
global backend
from abcpy.backends import BackendMPI as Backend
backend = Backend(process_per_model=2)
class NestedBivariateGauss... | en | 001607468_eth-cscs-abcpy_mpi_model_inferences_f229d08acd70.py | unknown | 4,051 |
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import typing as t
import click
class OctaviaCommand(click.Command):
def make_context(
self, info_name: t.Optional[str], args: t.List[str], parent: t.Optional[click.Context] = None, **extra: t.Any
) -> click.Context:
"""Wrap parent... | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import typing as t
import click
class OctaviaCommand(click.Command):
def make_context(
self, info_name: t.Optional[str], args: t.List[str], parent: t.Optional[click.Context] = None, **extra: t.Any
) -> click.Context:
"""Wrap parent... | en | 003902661_alldatacenter-alldata_base_commands_48585ecd1e38.py | unknown | 540 |
#!/usr/bin/env python3
import cv2
import depthai as dai
from collections import deque
class FeatureTrackerDrawer:
lineColor = (200, 0, 200)
pointColor = (0, 0, 255)
circleRadius = 2
maxTrackedFeaturesPathLength = 30
# for how many frames the feature is tracked
trackedFeaturesPathLength = 10
... | #!/usr/bin/env python3
import cv2
import depthai as dai
from collections import deque
class FeatureTrackerDrawer:
lineColor = (200, 0, 200)
pointColor = (0, 0, 255)
circleRadius = 2
maxTrackedFeaturesPathLength = 30
# for how many frames the feature is tracked
trackedFeaturesPathLength = 10
... | en | 004583396_luxonis-depthai-python_feature_tracker_color_f1d0d3f0065b.py | unknown | 1,570 |
import os, sys, token, tokenize
def do_file(fname):
source = open(fname)
mod = open(fname + ".tmp", "w")
prev_toktype = token.INDENT
first_line = None
last_lineno = -1
last_col = 0
tokgen = tokenize.generate_tokens(source.readline)
for toktype, ttext, (slineno, scol), (elineno, ecol), lt... | import os, sys, token, tokenize
def do_file(fname):
source = open(fname)
mod = open(fname + ".tmp", "w")
prev_toktype = token.INDENT
first_line = None
last_lineno = -1
last_col = 0
tokgen = tokenize.generate_tokens(source.readline)
for toktype, ttext, (slineno, scol), (elineno, ecol), lt... | en | 001498725_alibaba-MNN_rm_comments_afe99575c433.py | unknown | 468 |
#!/usr/bin/env python
'''
Integral transformation to compute 2-electron integrals for no-pair
Dirac-Coulomb Hamiltonian. The molecular orbitals are based on RKB basis.
'''
import h5py
from pyscf import gto
from pyscf import scf
from pyscf import lib
from pyscf.ao2mo import r_outcore
mol = gto.M(
atom = '''
O... | #!/usr/bin/env python
'''
Integral transformation to compute 2-electron integrals for no-pair
Dirac-Coulomb Hamiltonian. The molecular orbitals are based on RKB basis.
'''
import h5py
from pyscf import gto
from pyscf import scf
from pyscf import lib
from pyscf.ao2mo import r_outcore
mol = gto.M(
atom = '''
O... | en | 004209247_sunqm-pyscf_22-rkb_no_pair_ints_92847bd60a49.py | unknown | 839 |
import argparse
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
import torchvision
import torchvision.transforms as T
from torchvision.datasets import ImageFolder
"""
Example PyTorch script for finetuning a ResNet model on your own data.
For this example... | import argparse
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
import torchvision
import torchvision.transforms as T
from torchvision.datasets import ImageFolder
"""
Example PyTorch script for finetuning a ResNet model on your own data.
For this example... | en | 003841763_dockerizeme-dockerizeme_snippet_a7c9e1678177.py | unknown | 2,965 |
# coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** 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 _utilities
from . imp... | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** 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 _utilities
from . imp... | en | 000684590_pulumi-pulumi-azure-native_blob_service_properties_28f4b598b5f4.py | unknown | 6,922 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.images.models
class Migration(migrations.Migration):
dependencies = [
('core', '0023_alter_homepage_featured_section_integer_block'),
]
operations = [
migrations.AddFi... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.images.models
class Migration(migrations.Migration):
dependencies = [
('core', '0023_alter_homepage_featured_section_integer_block'),
]
operations = [
migrations.AddFi... | en | 001812884_PARINetwork-pari_0024_language_field_for_guidelines_page_e2e7235f47e3.py | unknown | 265 |
# https://agustinus.kristia.de/techblog/2017/12/23/annealed-importance-sampling/
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
def f_0(x):
"""
Target distribution: \propto N(-5, 2)
"""
return np.exp(-(x+5)**2/2/2)
def f_j(x, beta):
"""
Intermediate distribution: ... | # https://agustinus.kristia.de/techblog/2017/12/23/annealed-importance-sampling/
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
def f_0(x):
"""
Target distribution: \propto N(-5, 2)
"""
return np.exp(-(x+5)**2/2/2)
def f_j(x, beta):
"""
Intermediate distribution: ... | en | 000270452_probml-pyprobml_ais_demo_a87f22adc667.py | unknown | 609 |
# Copyright 2017 Vector Creations Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2017 Vector Creations Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | en | 000271416_matrix-org-synapse_user_dir_f21d59633567.py | unknown | 774 |
"""
Duplex audio:
record from a source, play back on another output.
"""
import miniaudio
from time import sleep
backends = []
def choose_devices():
devices = miniaudio.Devices(backends=backends)
print("Available capture devices:")
captures = devices.get_captures()
for d in enumerate(captures, 1):
... | """
Duplex audio:
record from a source, play back on another output.
"""
import miniaudio
from time import sleep
backends = []
def choose_devices():
devices = miniaudio.Devices(backends=backends)
print("Available capture devices:")
captures = devices.get_captures()
for d in enumerate(captures, 1):
... | en | 002636671_irmen-pyminiaudio_duplex_5e6cb55e2006.py | unknown | 433 |
"""
Module provide lists of sql keywords that should trigger or skip
checks for tables an columns
"""
# these keywords are followed by columns reference
from enum import Enum
KEYWORDS_BEFORE_COLUMNS = {
"SELECT",
"WHERE",
"ORDERBY",
"GROUPBY",
"ON",
"SET",
"USING",
}
# normalized list of ... | """
Module provide lists of sql keywords that should trigger or skip
checks for tables an columns
"""
# these keywords are followed by columns reference
from enum import Enum
KEYWORDS_BEFORE_COLUMNS = {
"SELECT",
"WHERE",
"ORDERBY",
"GROUPBY",
"ON",
"SET",
"USING",
}
# normalized list of ... | en | 003221104_macbre-sql-metadata_keywords_lists_3ee96d892bc1.py | unknown | 890 |
from ctypes import CDLL, sizeof, memset, c_uint32, create_string_buffer
MAXPATHLEN = 1024
PROC_PIDPATHINFO_MAXSIZE = MAXPATHLEN*4
PROC_ALL_PIDS = 1
libc = CDLL('libc.dylib')
def get_pids():
number_of_pids = libc.proc_listpids(PROC_ALL_PIDS, 0, None, 0)
pid_list = (c_uint32 * (number_of_pids * 2))()
return... | from ctypes import CDLL, sizeof, memset, c_uint32, create_string_buffer
MAXPATHLEN = 1024
PROC_PIDPATHINFO_MAXSIZE = MAXPATHLEN*4
PROC_ALL_PIDS = 1
libc = CDLL('libc.dylib')
def get_pids():
number_of_pids = libc.proc_listpids(PROC_ALL_PIDS, 0, None, 0)
pid_list = (c_uint32 * (number_of_pids * 2))()
return... | en | 005218206_gistable-gistable_snippet_d9210319a2e6.py | unknown | 355 |
"""
Geosoft voxel (voxset) handling.
:Classes:
============ ==========================================================================
:class:`Vox` Geosoft voxel (voxset), subclass of `geosoft.gxpy.spatialdata.SpatialData`
============ ======================================================================... | """
Geosoft voxel (voxset) handling.
:Classes:
============ ==========================================================================
:class:`Vox` Geosoft voxel (voxset), subclass of `geosoft.gxpy.spatialdata.SpatialData`
============ ======================================================================... | en | 000360761_GeosoftInc-gxpy_vox_c5943579cebc.py | unknown | 10,196 |
import uuid
from typing import List
import boto3
from sebs.cache import Cache
from ..faas.storage import PersistentStorage
class S3(PersistentStorage):
@staticmethod
def typename() -> str:
return "AWS.S3"
@staticmethod
def deployment_name():
return "aws"
@property
def repla... | import uuid
from typing import List
import boto3
from sebs.cache import Cache
from ..faas.storage import PersistentStorage
class S3(PersistentStorage):
@staticmethod
def typename() -> str:
return "AWS.S3"
@staticmethod
def deployment_name():
return "aws"
@property
def repla... | en | 000868301_spcl-serverless-benchmarks_s3_c746a33aa054.py | unknown | 1,302 |
#
# Copyright (c) 2021 Project CHIP 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 or agreed to i... | #
# Copyright (c) 2021 Project CHIP 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 or agreed to i... | en | 000656074_project-chip-connectedhomeip_subprocess_1cd61dd0a06c.py | unknown | 281 |
from functools import partial
import logging
import gymnasium as gym
from typing import Dict, Tuple, List, Type, Union, Optional, Any
from ray.rllib.algorithms.ddpg.utils import make_ddpg_models, validate_spaces
from ray.rllib.algorithms.dqn.dqn_tf_policy import (
postprocess_nstep_and_prio,
PRIO_WEIGHTS,
)
fr... | from functools import partial
import logging
import gymnasium as gym
from typing import Dict, Tuple, List, Type, Union, Optional, Any
from ray.rllib.algorithms.ddpg.utils import make_ddpg_models, validate_spaces
from ray.rllib.algorithms.dqn.dqn_tf_policy import (
postprocess_nstep_and_prio,
PRIO_WEIGHTS,
)
fr... | en | 002169622_ray-project-ray_ddpg_tf_policy_ec01aa48ce45.py | unknown | 4,737 |
# ---------------------------------------------------------------------
# HP.Comware.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2022 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python m... | # ---------------------------------------------------------------------
# HP.Comware.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2022 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python m... | en | 001050841_nocproject-noc_get_version_b0711e516ae9.py | unknown | 778 |
import tensorflow as tf
import numpy as np
from task_module import pretrain, classifier, pretrain_albert
import tensorflow as tf
try:
from distributed_single_sentence_classification.model_interface import model_zoo
except:
from distributed_single_sentence_classification.model_interface import model_zoo
import tens... | import tensorflow as tf
import numpy as np
from task_module import pretrain, classifier, pretrain_albert
import tensorflow as tf
try:
from distributed_single_sentence_classification.model_interface import model_zoo
except:
from distributed_single_sentence_classification.model_interface import model_zoo
import tens... | en | 003597455_yyht-BERT_student_model_pretrain_fn_a3a92626e883.py | unknown | 2,376 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from typing import Dict, List, Optional
import urllib3
from urllib.parse import urlparse
urllib3.disable_warnings()
class Client(BaseClient):
def build_iterator(self) -> List:
result = []
res = self._htt... | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from typing import Dict, List, Optional
import urllib3
from urllib.parse import urlparse
urllib3.disable_warnings()
class Client(BaseClient):
def build_iterator(self) -> List:
result = []
res = self._htt... | en | 003594490_demisto-content_OracleCloudInfrastructureFeed_e2a133237c67.py | unknown | 1,512 |
import sys
import logging
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = ("Invalidates portions of the queryset cache based on the app names"
" or models provided as arguments to the command. If no arguments "
... | import sys
import logging
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = ("Invalidates portions of the queryset cache based on the app names"
" or models provided as arguments to the command. If no arguments "
... | en | 004754214_dockerizeme-dockerizeme_snippet_60fc04e0b580.py | unknown | 965 |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/RiskAssessment
Release: STU3
Version: 3.0.2
Revision: 11917
Last updated: 2019-10-24T11:53:00+11:00
"""
import typing
from pydantic import Field, root_validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.e... | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/RiskAssessment
Release: STU3
Version: 3.0.2
Revision: 11917
Last updated: 2019-10-24T11:53:00+11:00
"""
import typing
from pydantic import Field, root_validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.e... | en | 005408930_nazrulworld-fhir.resources_riskassessment_57dcaec2102f.py | unknown | 5,215 |
"""Functions ported from Nipype 1, after removing parts that were related to py2."""
import os
import re
import logging
from pathlib import Path
import typing as ty
from copy import copy
import subprocess as sp
from contextlib import contextmanager
import attr
from fileformats.core import FileSet
logger = logging.ge... | """Functions ported from Nipype 1, after removing parts that were related to py2."""
import os
import re
import logging
from pathlib import Path
import typing as ty
from copy import copy
import subprocess as sp
from contextlib import contextmanager
import attr
from fileformats.core import FileSet
logger = logging.ge... | en | 000317542_nipype-pydra_helpers_file_3da4a1a0a11f.py | unknown | 4,802 |
# -*- coding: utf-8 -*-
# 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # -*- coding: utf-8 -*-
# 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | en | 003546531_googleapis-google-cloud-python_ssh_key_7f10be0ee745.py | unknown | 1,156 |
"""Convert to and from an OpenMM Topology or System object."""
import unyt as u
from gmso.utils.io import has_openmm, has_openmm_unit, import_
if has_openmm & has_openmm_unit:
openmm_unit = import_("openmm.unit")
from openmm import *
from openmm.app import *
def to_openmm(topology, openmm_object="topolo... | """Convert to and from an OpenMM Topology or System object."""
import unyt as u
from gmso.utils.io import has_openmm, has_openmm_unit, import_
if has_openmm & has_openmm_unit:
openmm_unit = import_("openmm.unit")
from openmm import *
from openmm.app import *
def to_openmm(topology, openmm_object="topolo... | en | 004900124_mosdef-hub-gmso_convert_openmm_5f567671584d.py | unknown | 1,705 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'StudioAuthMode',
'StudioSessionMappingIdentityType',
]
class StudioAuthMode(str, Enum):
"""
Speci... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'StudioAuthMode',
'StudioSessionMappingIdentityType',
]
class StudioAuthMode(str, Enum):
"""
Speci... | en | 004978825_pulumi-pulumi-aws-native_enums_d379dacffecd.py | unknown | 194 |
#!/usr/bin/env python3
"""
generate udf document from native source
"""
# -*- coding: utf-8 -*-
#
# 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... | #!/usr/bin/env python3
"""
generate udf document from native source
"""
# -*- coding: utf-8 -*-
#
# 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 | 000840407_4paradigm-OpenMLDB_export_udf_doc_9146127ff3cd.py | unknown | 2,132 |
# Copyright 2020 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 2020 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 | 000317145_tensorflow-tensorflow_script_ops_test_a148cf455ca4.py | unknown | 2,053 |
#!/bin/env python3
import discord
from discord.ext import commands
# This bit allows to more easily unban members via ID or name#discrim
# Taken mostly from R. Danny
# https://github.com/Rapptz/RoboDanny/blob/rewrite/cogs/mod.py#L83-L94
class BannedMember(commands.Converter):
async def convert(self, ctx, arg):
... | #!/bin/env python3
import discord
from discord.ext import commands
# This bit allows to more easily unban members via ID or name#discrim
# Taken mostly from R. Danny
# https://github.com/Rapptz/RoboDanny/blob/rewrite/cogs/mod.py#L83-L94
class BannedMember(commands.Converter):
async def convert(self, ctx, arg):
... | en | 001351781_PrestigeDox-Tanjo_mod_0a62b1c12a1e.py | unknown | 1,594 |
class Solution:
def onesMinusZeros(self, grid: List[List[int]]) -> List[List[int]]:
m = len(grid)
n = len(grid[0])
ans = [[0] * n for _ in range(m)]
onesRow = [row.count(1) for row in grid]
onesCol = [col.count(1) for col in zip(*grid)]
for i in range(m):
for j in range(n):
ans[... | class Solution:
def onesMinusZeros(self, grid: List[List[int]]) -> List[List[int]]:
m = len(grid)
n = len(grid[0])
ans = [[0] * n for _ in range(m)]
onesRow = [row.count(1) for row in grid]
onesCol = [col.count(1) for col in zip(*grid)]
for i in range(m):
for j in range(n):
ans[... | en | 004523476_walkccc-LeetCode_2482_04776d25cbde.py | unknown | 163 |
# PyVision License
#
# Copyright (c) 2006-2008 David S. Bolme
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, thi... | # PyVision License
#
# Copyright (c) 2006-2008 David S. Bolme
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, thi... | en | 000702790_bolme-pyvision_face_84c7f14a1e57.py | unknown | 2,327 |
import logging
try:
from collections.abc import Callable
except ImportError:
from collections import Callable
import six
from ..trans_comp import REGEX
from .transform_base import transform_base
from ..etl_util import process_event, bind_event_fn, u
logger = logging.getLogger(__name__)
__all__ = ['transform'... | import logging
try:
from collections.abc import Callable
except ImportError:
from collections import Callable
import six
from ..trans_comp import REGEX
from .transform_base import transform_base
from ..etl_util import process_event, bind_event_fn, u
logger = logging.getLogger(__name__)
__all__ = ['transform'... | en | 003168555_aliyun-aliyun-log-python-sdk_transform_list_7965be402d46.py | unknown | 574 |
from .tool.func import *
def main_sys_restart():
with get_db_connect() as conn:
if admin_check() != 1:
return re_error('/error/3')
if flask.request.method == 'POST':
admin_check(None, 'restart')
print('----')
print('Restart')
python_ver... | from .tool.func import *
def main_sys_restart():
with get_db_connect() as conn:
if admin_check() != 1:
return re_error('/error/3')
if flask.request.method == 'POST':
admin_check(None, 'restart')
print('----')
print('Restart')
python_ver... | en | 005295259_openNAMU-openNAMU_main_sys_restart_3bcb80b90f31.py | unknown | 407 |
from argparse import ArgumentParser
from socket import socket, AF_INET, SOCK_STREAM
from signal import signal, SIGINT
from struct import pack
from sys import exit
rates = {20000:0, 50000:1, 100000:2, 250000:3, 500000:4, 1250000:5, 2500000:6}
parser = ArgumentParser()
parser.add_argument('--addr', help = 'IP address ... | from argparse import ArgumentParser
from socket import socket, AF_INET, SOCK_STREAM
from signal import signal, SIGINT
from struct import pack
from sys import exit
rates = {20000:0, 50000:1, 100000:2, 250000:3, 500000:4, 1250000:5, 2500000:6}
parser = ArgumentParser()
parser.add_argument('--addr', help = 'IP address ... | en | 002943722_pavel-demin-red-pitaya-notes_playback_08add222aab1.py | unknown | 830 |
# coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class RestChairTokenReqBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attrib... | # coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class RestChairTokenReqBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attrib... | en | 004575243_huaweicloud-huaweicloud-sdk-python-v3_rest_chair_token_req_body_b2c1c9046d9b.py | unknown | 1,133 |
"""
Module: libfmp.c2.c2_interference
Author: Meinard Müller
License: The MIT license, https://opensource.org/licenses/MIT
This file is part of the FMP Notebooks (https://www.audiolabs-erlangen.de/FMP)
"""
import numpy as np
from matplotlib import pyplot as plt
def plot_interference(x1, x2, t, figsize=(8, 2), xlim=N... | """
Module: libfmp.c2.c2_interference
Author: Meinard Müller
License: The MIT license, https://opensource.org/licenses/MIT
This file is part of the FMP Notebooks (https://www.audiolabs-erlangen.de/FMP)
"""
import numpy as np
from matplotlib import pyplot as plt
def plot_interference(x1, x2, t, figsize=(8, 2), xlim=N... | en | 004173491_meinardmueller-libfmp_c2_interference_fe48f72b2cab.py | unknown | 751 |
from typing import Iterable, TypeVar, Mapping, Union
StrOrIter = TypeVar('StrOrIter', bound=Union[str, Mapping, list])
def pascalize(str_or_iter: StrOrIter) -> StrOrIter: ...
def camelize(str_or_iter: StrOrIter) -> StrOrIter: ...
def kebabize(str_or_iter: StrOrIter) -> StrOrIter: ...
def decamelize(str_or_iter: Str... | from typing import Iterable, TypeVar, Mapping, Union
StrOrIter = TypeVar('StrOrIter', bound=Union[str, Mapping, list])
def pascalize(str_or_iter: StrOrIter) -> StrOrIter: ...
def camelize(str_or_iter: StrOrIter) -> StrOrIter: ...
def kebabize(str_or_iter: StrOrIter) -> StrOrIter: ...
def decamelize(str_or_iter: Str... | en | 000731793_nficano-humps_main_ebedbb637d1f.py | unknown | 259 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | en | 004205077_tensorflow-privacy_train_932d133d2e94.py | unknown | 4,141 |
"""
Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where 0 <= i < j < n, such that nums[i] == nums[j] and (i * j) is divisible by k.
Example 1:
Input: nums = [3,1,2,2,2,1,3], k = 2
Output: 4
Explanation:
There are 4 pairs that meet all the requirements:
- nums[0... | """
Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where 0 <= i < j < n, such that nums[i] == nums[j] and (i * j) is divisible by k.
Example 1:
Input: nums = [3,1,2,2,2,1,3], k = 2
Output: 4
Explanation:
There are 4 pairs that meet all the requirements:
- nums[0... | en | 005022511_franklingu-leetcode-solutions_Solution_fb64ed66d3da.py | unknown | 421 |
"""Runs a test suite against Sublime Text.
Usage:
1. cd path/to/PACKAGE
2. python path/to/run_tests.py PACKAGE
"""
from __future__ import print_function
import json
import optparse
import os
import re
import shutil
import subprocess
import sys
import time
import threading
# todo: allow different sublime versions
P... | """Runs a test suite against Sublime Text.
Usage:
1. cd path/to/PACKAGE
2. python path/to/run_tests.py PACKAGE
"""
from __future__ import print_function
import json
import optparse
import os
import re
import shutil
import subprocess
import sys
import time
import threading
# todo: allow different sublime versions
P... | en | 001382094_SublimeText-UnitTesting_run_tests_b87d595c9353.py | unknown | 2,354 |
# coding=utf-8
# Copyright 2017 Foursquare Labs Inc. All Rights Reserved.
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.goal.goal import Goal
from pants.goal.task_registrar import TaskRegistrar as task
f... | # coding=utf-8
# Copyright 2017 Foursquare Labs Inc. All Rights Reserved.
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.goal.goal import Goal
from pants.goal.task_registrar import TaskRegistrar as task
f... | en | 000986877_foursquare-fsqio_register_3416a9372063.py | unknown | 387 |
#! /usr/bin/python
#***********************************************************
#* Software License Agreement (BSD License)
#*
#* Copyright (c) 2009, Willow Garage, Inc.
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the ... | #! /usr/bin/python
#***********************************************************
#* Software License Agreement (BSD License)
#*
#* Copyright (c) 2009, Willow Garage, Inc.
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the ... | en | 001147434_ros2-geometry2_buffer_client_31b1eb0f9bb5.py | unknown | 2,960 |
"""Library to handle connection with Switchbot."""
from __future__ import annotations
import logging
from typing import Any
from .device import REQ_HEADER, SwitchbotDevice, update_after_operation
# Curtain keys
CURTAIN_COMMAND = "4501"
OPEN_KEYS = [
f"{REQ_HEADER}{CURTAIN_COMMAND}010100",
f"{REQ_HEADER}{CURT... | """Library to handle connection with Switchbot."""
from __future__ import annotations
import logging
from typing import Any
from .device import REQ_HEADER, SwitchbotDevice, update_after_operation
# Curtain keys
CURTAIN_COMMAND = "4501"
OPEN_KEYS = [
f"{REQ_HEADER}{CURTAIN_COMMAND}010100",
f"{REQ_HEADER}{CURT... | en | 004285132_Danielhiversen-pySwitchbot_curtain_868ba4a792ea.py | unknown | 2,390 |
import re
from scrapy import Request
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class SpPresidentePrudenteSpider(BaseGazetteSpider):
TERRITORY_ID = "3541406"
GAZETTE_URL = "https://www.gdoe.com.br/presidenteprudente/1"
allowed_domains = ["gdoe.com.br"]
name ... | import re
from scrapy import Request
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class SpPresidentePrudenteSpider(BaseGazetteSpider):
TERRITORY_ID = "3541406"
GAZETTE_URL = "https://www.gdoe.com.br/presidenteprudente/1"
allowed_domains = ["gdoe.com.br"]
name ... | en | 002923950_okfn-brasil-querido-diario_sp_presidente_prudente_3ab80c859825.py | unknown | 452 |
# encoding=utf8
import logging
import numpy as np
from niapy.algorithms.algorithm import Algorithm
logging.basicConfig()
logger = logging.getLogger("niapy.algorithms.basic")
logger.setLevel("INFO")
__all__ = ["HarmonySearch", "HarmonySearchV1"]
class HarmonySearch(Algorithm):
r"""Implementation of Harmony Sea... | # encoding=utf8
import logging
import numpy as np
from niapy.algorithms.algorithm import Algorithm
logging.basicConfig()
logger = logging.getLogger("niapy.algorithms.basic")
logger.setLevel("INFO")
__all__ = ["HarmonySearch", "HarmonySearchV1"]
class HarmonySearch(Algorithm):
r"""Implementation of Harmony Sea... | en | 004210163_NiaOrg-NiaPy_hs_446930584ae0.py | unknown | 2,269 |
"""
****************
BN Parameter
Distance Metrics
****************
Code for computing the Parametric distance
between 2+ Bayesian Networks using various
metrics. Parametric distance only involves a
comparison of the conditional probability values.
For structural distance metrics, see "structure_distance.py"
Since ... | """
****************
BN Parameter
Distance Metrics
****************
Code for computing the Parametric distance
between 2+ Bayesian Networks using various
metrics. Parametric distance only involves a
comparison of the conditional probability values.
For structural distance metrics, see "structure_distance.py"
Since ... | en | 001806255_ncullen93-pyBN_parameter_distance_0b0c6a46ac67.py | unknown | 1,234 |
import _plotly_utils.basevalidators
class HoveronValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="hoveron", parent_name="parcats", **kwargs):
super(HoveronValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | import _plotly_utils.basevalidators
class HoveronValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="hoveron", parent_name="parcats", **kwargs):
super(HoveronValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | en | 001147066_plotly-plotly.py_hoveron_66424795dc0d.py | unknown | 138 |
import sys
def main():
import argparse
import redis
import time
import random
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from scutils.redis_queue import RedisPriorityQueue
from scutils.redis_throttled_queue import RedisThro... | import sys
def main():
import argparse
import redis
import time
import random
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from scutils.redis_queue import RedisPriorityQueue
from scutils.redis_throttled_queue import RedisThro... | en | 001642554_istresearch-scrapy-cluster_example_rtq_163109264a41.py | unknown | 780 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | en | 003637496_google-oss-fuzz_get_coverage_eba7fac0a004.py | unknown | 2,113 |
# coding=utf-8
from src.testcase.GN_Y201H.WidgetOperation import *
class GNY201HTimerFunc1(WidgetOperation):
@case_run(False)
def run(self):
self.case_module = u"定时功能(#240)" # 用例所属模块
self.case_title = u'延时定时的定时数量检查' # 用例名称
self.zentao_id = "2023" # 禅道ID
# 用例动作
def case(self... | # coding=utf-8
from src.testcase.GN_Y201H.WidgetOperation import *
class GNY201HTimerFunc1(WidgetOperation):
@case_run(False)
def run(self):
self.case_module = u"定时功能(#240)" # 用例所属模块
self.case_title = u'延时定时的定时数量检查' # 用例名称
self.zentao_id = "2023" # 禅道ID
# 用例动作
def case(self... | en | 001395136_maiyajj-AutoTest_script-Appium_Connect_GN_Y201H_TIMER_FUNC_001_b2fc89f753a5.py | unknown | 333 |
def _complain_ifclosed(closed):
if closed:
raise ValueError("I/O operation on closed file")
class GeneratorFile(object):
"""
File-like object which wraps a Python generator to produce the file contents.
Modeled on StringIO and comments on the file-like interface copied from there.
"""
... | def _complain_ifclosed(closed):
if closed:
raise ValueError("I/O operation on closed file")
class GeneratorFile(object):
"""
File-like object which wraps a Python generator to produce the file contents.
Modeled on StringIO and comments on the file-like interface copied from there.
"""
... | en | 001681542_quay-quay_generatorfile_56f3764b25d5.py | unknown | 690 |
"""
Revision ID: 0311_add_inbound_sms_history
Revises: 0310_returned_letters_table
Create Date: 2019-12-20 15:38:53.358509
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0311_add_inbound_sms_history"
down_revision = "0310_returned_letters_table"
def upgrad... | """
Revision ID: 0311_add_inbound_sms_history
Revises: 0310_returned_letters_table
Create Date: 2019-12-20 15:38:53.358509
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0311_add_inbound_sms_history"
down_revision = "0310_returned_letters_table"
def upgrad... | en | 001596832_alphagov-notifications-api_0311_add_inbound_sms_history_3b7af07ca313.py | unknown | 441 |
from yaglm.config.penalty_utils import build_penalty_tree, extract_penalties,\
extract_flavors_and_pens, get_parent_key, get_enet_sum_name
from yaglm.config.base_penalty import ElasticNetConfig, WithFlavorPenSeqConfig
from yaglm.opt.from_config.penalty import get_outer_nonconvex_func
from yaglm.opt.from_config.tra... | from yaglm.config.penalty_utils import build_penalty_tree, extract_penalties,\
extract_flavors_and_pens, get_parent_key, get_enet_sum_name
from yaglm.config.base_penalty import ElasticNetConfig, WithFlavorPenSeqConfig
from yaglm.opt.from_config.penalty import get_outer_nonconvex_func
from yaglm.opt.from_config.tra... | en | 004016647_yaglm-yaglm_lla_0a26b1db4b54.py | unknown | 2,324 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# 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/L... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# 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/L... | en | 004624480_bufferx-twork_setup_54b861ed98f8.py | unknown | 874 |
# ===============================================================================
# Copyright 2011 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 2011 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 | 004884921_NMGRL-pychron_ftp_transfer_7eb5fa6cdd1a.py | unknown | 716 |
import uproot
import hist
def save_histograms(hist_dict, fileset, filename, channel_names, rebin=True):
nominal_samples = [sample for sample in fileset.keys() if "nominal" in sample]
# add minimal event count to all bins to avoid crashes when processing a small number of samples
for channel in channel_nam... | import uproot
import hist
def save_histograms(hist_dict, fileset, filename, channel_names, rebin=True):
nominal_samples = [sample for sample in fileset.keys() if "nominal" in sample]
# add minimal event count to all bins to avoid crashes when processing a small number of samples
for channel in channel_nam... | en | 001892326_iris-hep-analysis-grand-challenge_file_output_cfccbc9c7d79.py | unknown | 602 |
"""
Directive Syntax
~~~~~~~~~~~~~~~~~
This syntax is inspired by reStructuredText. The syntax is very powerful,
that you can define a lot of custom features by your own.
The syntax looks like::
.. directive-name:: directive value
:option-key: option value
:option-ke... | """
Directive Syntax
~~~~~~~~~~~~~~~~~
This syntax is inspired by reStructuredText. The syntax is very powerful,
that you can define a lot of custom features by your own.
The syntax looks like::
.. directive-name:: directive value
:option-key: option value
:option-ke... | en | 003206217_glotzerlab-signac-flow_base_96703df584fa.py | unknown | 842 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | en | 003671361_google-objax_maml_02e203194fb9.py | unknown | 1,601 |
from decimal import Decimal
from io import BytesIO
import os
import sqlite3
from typing import List, Callable, Dict
from functools import partial
import numpy as np
import matplotlib.pyplot as plt
from . import settings
from . import aws
# Paths to directories for different file types
__ROOT__ = os.path.abspath(os.... | from decimal import Decimal
from io import BytesIO
import os
import sqlite3
from typing import List, Callable, Dict
from functools import partial
import numpy as np
import matplotlib.pyplot as plt
from . import settings
from . import aws
# Paths to directories for different file types
__ROOT__ = os.path.abspath(os.... | en | 005299237_pmelchior-scarlet_api_d2651f06cb44.py | unknown | 2,473 |
from functools import partial
from typing import Callable, Iterable
import numpy as np
import pandas as pd
from nninst import mode
from nninst.backend.tensorflow.attack.common import alexnet_imagenet_example
from nninst.backend.tensorflow.attack.foolbox_attack import foolbox_get_l2_distance
from nninst.backend.tensor... | from functools import partial
from typing import Callable, Iterable
import numpy as np
import pandas as pd
from nninst import mode
from nninst.backend.tensorflow.attack.common import alexnet_imagenet_example
from nninst.backend.tensorflow.attack.foolbox_attack import foolbox_get_l2_distance
from nninst.backend.tensor... | en | 005646257_Ptolemy-DL-Ptolemy_generate_distance_f898ddf5647e.py | unknown | 1,870 |
from .._tier0 import Image
from .._tier0 import plugin_function
@plugin_function(categories=['label measurement', 'combine', 'map', 'label comparison', 'in assistant'])
def label_nonzero_pixel_count_ratio_map(label_map1: Image, label_map2: Image, overlap_count_map_destination: Image = None) -> Image:
"""
Take... | from .._tier0 import Image
from .._tier0 import plugin_function
@plugin_function(categories=['label measurement', 'combine', 'map', 'label comparison', 'in assistant'])
def label_nonzero_pixel_count_ratio_map(label_map1: Image, label_map2: Image, overlap_count_map_destination: Image = None) -> Image:
"""
Take... | en | 001413180_clEsperanto-pyclesperanto_prototype_label_nonzero_pixel_count_ratio_map_28a41fd27922.py | unknown | 376 |
"""
Provide some tools to manipulate CogAlg frames and for debugging.
"""
import pickle
from collections import defaultdict
from itertools import chain, tee
import cv2
import numpy as np
import matplotlib.pyplot as plt
# -----------------------------------------------------------------------------
# miscs
def try_ex... | """
Provide some tools to manipulate CogAlg frames and for debugging.
"""
import pickle
from collections import defaultdict
from itertools import chain, tee
import cv2
import numpy as np
import matplotlib.pyplot as plt
# -----------------------------------------------------------------------------
# miscs
def try_ex... | en | 005024200_boris-kz-CogAlg_utils_74c3cb9206fc.py | unknown | 2,656 |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations
from typing import Union
from datadog_api_client.mo... | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations
from typing import Union
from datadog_api_client.mo... | en | 003677130_DataDog-datadog-api-client-python_downtime_schedule_one_time_create_update_request_74ad835d0574.py | unknown | 494 |
# -*- coding:utf-8 -*-
import argparse
import os
import random
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
from net import weights_init, Generator, Discri... | # -*- coding:utf-8 -*-
import argparse
import os
import random
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
from net import weights_init, Generator, Discri... | en | 003516678_miyamotok0105-pytorch_handbook_train_cgan_299a0d6d2684.py | unknown | 2,885 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | en | 000752696_PaddlePaddle-Paddle_pyCov_multithreading_18719bbe21d6.py | unknown | 685 |
# coding: utf-8
import os
import os.path
import json
from copy import deepcopy
from supervisely import logger
from supervisely.io import fs as sly_fs
from supervisely.nn.config import update_recursively
from supervisely.nn.dataset import samples_by_tags
from supervisely.nn.hosted import class_indexing
from supervisel... | # coding: utf-8
import os
import os.path
import json
from copy import deepcopy
from supervisely import logger
from supervisely.io import fs as sly_fs
from supervisely.nn.config import update_recursively
from supervisely.nn.dataset import samples_by_tags
from supervisely.nn.hosted import class_indexing
from supervisel... | en | 001173064_supervisely-supervisely_trainer_ff49731b9a5b.py | unknown | 2,160 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... | en | 001113088_alldatacenter-alldata_service_object_stores_606c91b81b6d.py | unknown | 2,158 |
# Copyright 2018 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 2018 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 | 003648808_finnickniu-tensorflow_object_detection_tflite_rnn_decoder_70efe18a203f.py | unknown | 3,220 |
def largest(min_factor, max_factor):
"""Given a range of numbers, find the largest palindromes which
are products of two numbers within that range.
:param min_factor: int with a default value of 0
:param max_factor: int
:return: tuple of (palindrome, iterable).
Iterable should conta... | def largest(min_factor, max_factor):
"""Given a range of numbers, find the largest palindromes which
are products of two numbers within that range.
:param min_factor: int with a default value of 0
:param max_factor: int
:return: tuple of (palindrome, iterable).
Iterable should conta... | en | 003584376_exercism-python_palindrome_products_2c5c9671348b.py | unknown | 209 |
"""
Official description from the "about" page of the Mozilla CommonVoice project
(source link: https://commonvoice.mozilla.org/en/about)
Why Common Voice?
Mozilla Common Voice is an initiative to help teach machines how real people speak.
This project is an effort to bridge the digital speech divide. Voice recognitio... | """
Official description from the "about" page of the Mozilla CommonVoice project
(source link: https://commonvoice.mozilla.org/en/about)
Why Common Voice?
Mozilla Common Voice is an initiative to help teach machines how real people speak.
This project is an effort to bridge the digital speech divide. Voice recognitio... | en | 003054612_lhotse-speech-lhotse_commonvoice_a4da0315d068.py | unknown | 3,658 |
"""
Class for interfacing with the Primesense Carmine RGBD sensor
Author: Jeff Mahler
"""
import logging
import numpy as np
from autolab_core import CameraIntrinsics, ColorImage, DepthImage, Image
from autolab_core.constants import MM_TO_METERS
from primesense import openni2
from .camera_sensor import CameraSensor
... | """
Class for interfacing with the Primesense Carmine RGBD sensor
Author: Jeff Mahler
"""
import logging
import numpy as np
from autolab_core import CameraIntrinsics, ColorImage, DepthImage, Image
from autolab_core.constants import MM_TO_METERS
from primesense import openni2
from .camera_sensor import CameraSensor
... | en | 004151821_BerkeleyAutomation-perception_primesense_sensor_6b971e7045a8.py | unknown | 2,892 |
# coding: utf-8
# Python 3 Standard Library
import argparse
import collections
import copy
import json
import os.path
import pathlib
import shutil
import sys
import time
import tempfile
# Third-Party Libraries
import plumbum
# Pandoc
import pandoc.about
from . import utils
# Filesystem Helper
# --------------------... | # coding: utf-8
# Python 3 Standard Library
import argparse
import collections
import copy
import json
import os.path
import pathlib
import shutil
import sys
import time
import tempfile
# Third-Party Libraries
import plumbum
# Pandoc
import pandoc.about
from . import utils
# Filesystem Helper
# --------------------... | en | 000256287_boisgera-pandoc_init_18683f3edd1e.py | unknown | 7,497 |
#!/usr/bin/env python
import argparse
import os
import sys
try:
import lz4tools
except ImportError:
import __init__ as lz4tools
def compFile():
return lz4tools.compressFileDefault(res.input, outname=res.output)
def compDir():
return lz4tools.compressTarDefault(res.input, outname=res.output)
def ... | #!/usr/bin/env python
import argparse
import os
import sys
try:
import lz4tools
except ImportError:
import __init__ as lz4tools
def compFile():
return lz4tools.compressFileDefault(res.input, outname=res.output)
def compDir():
return lz4tools.compressTarDefault(res.input, outname=res.output)
def ... | en | 004465921_darkdragn-lz4tools_main_e3ae69389d3d.py | unknown | 936 |
class Trendable(object):
"""Represents a trending object on Tinycards."""
def __init__(self, id_, type_, data):
"""Initialize a new instance of the Trendable class.
Args:
id_: ID of the entity.
type_: The entity type (Can be DECK, DECK_GROUP or USER).
data: ... | class Trendable(object):
"""Represents a trending object on Tinycards."""
def __init__(self, id_, type_, data):
"""Initialize a new instance of the Trendable class.
Args:
id_: ID of the entity.
type_: The entity type (Can be DECK, DECK_GROUP or USER).
data: ... | en | 004381676_floscha-tinycards-python-api_trendable_51812a2d5e83.py | unknown | 118 |
import os
def run(driver, args):
time_dict = args[0]
sec_count = int(time_dict["daysdelta"]) * 24 * 3600 + int(time_dict["hour"]) * 3600 + int(
time_dict["minute"]) * 60 + int(time_dict["second"])
time_word = ""
if int(time_dict["hour"]) != 0:
time_word += "{}小时".format(time_dict["hour... | import os
def run(driver, args):
time_dict = args[0]
sec_count = int(time_dict["daysdelta"]) * 24 * 3600 + int(time_dict["hour"]) * 3600 + int(
time_dict["minute"]) * 60 + int(time_dict["second"])
time_word = ""
if int(time_dict["hour"]) != 0:
time_word += "{}小时".format(time_dict["hour... | en | 000463186_edisonwong520-jarvis_timer_b1818c7a3c21.py | unknown | 436 |
from __future__ import absolute_import
from ..errs import ValidationError, SchemaError
import functools
import six
class Array(list):
""" for array type, or parameter when allowMultiple=True
"""
def __init__(self):
""" v: list or string_types
"""
super(Array, self).__init__()
... | from __future__ import absolute_import
from ..errs import ValidationError, SchemaError
import functools
import six
class Array(list):
""" for array type, or parameter when allowMultiple=True
"""
def __init__(self):
""" v: list or string_types
"""
super(Array, self).__init__()
... | en | 004493847_pyopenapi-pyswagger_array_f9523fde00e0.py | unknown | 792 |
"""
IBM Natural Language Understanding client.
"""
import json
from typing import Union, Optional, List
import logging
from ibm_watson import NaturalLanguageUnderstandingV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_watson.natural_language_understanding_v1 import Features, CategoriesOptions... | """
IBM Natural Language Understanding client.
"""
import json
from typing import Union, Optional, List
import logging
from ibm_watson import NaturalLanguageUnderstandingV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_watson.natural_language_understanding_v1 import Features, CategoriesOptions... | en | 002817873_GateNLP-python-gatenlp_ibmnlu_3a905d35a848.py | unknown | 2,687 |
"""Fast DMD support."""
from mpf.platforms.interfaces.dmd_platform import DmdPlatformInterface
class FASTDMD(DmdPlatformInterface):
"""Object for a FAST DMD."""
def __init__(self, machine, sender):
"""Initialise DMD."""
self.machine = machine
self.send = sender
# Clear the D... | """Fast DMD support."""
from mpf.platforms.interfaces.dmd_platform import DmdPlatformInterface
class FASTDMD(DmdPlatformInterface):
"""Object for a FAST DMD."""
def __init__(self, machine, sender):
"""Initialise DMD."""
self.machine = machine
self.send = sender
# Clear the D... | en | 001215724_missionpinball-mpf_fast_dmd_0c34db6c1f90.py | unknown | 181 |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
from abc import ABC, abstractmethod
from sklearn.base import BaseEstimator
class HubnessReduction(BaseEstimator, ABC):
""" Base class for hubness reduction in a sparse neighbors graph. """
@abstractmethod
def __init__(self, **kwargs):
... | # -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
from abc import ABC, abstractmethod
from sklearn.base import BaseEstimator
class HubnessReduction(BaseEstimator, ABC):
""" Base class for hubness reduction in a sparse neighbors graph. """
@abstractmethod
def __init__(self, **kwargs):
... | en | 005484911_VarIr-scikit-hubness_base_1e290fa225ab.py | unknown | 158 |
import sys; sys.dont_write_bytecode = True
import hdf5_to_dict as io
import numpy as np
import h5py
import glob
def copy_header(src,dest):
variables = ['B_unit','L_unit','M_unit',
'T_unit','U_unit',
'RHO_unit','TEMP_unit',
'dumptrace_id','nstep','t']
for v in ... | import sys; sys.dont_write_bytecode = True
import hdf5_to_dict as io
import numpy as np
import h5py
import glob
def copy_header(src,dest):
variables = ['B_unit','L_unit','M_unit',
'T_unit','U_unit',
'RHO_unit','TEMP_unit',
'dumptrace_id','nstep','t']
for v in ... | en | 001890586_lanl-nubhlight_get_prune_tracers_cbdea5cb180c.py | unknown | 394 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.