max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
src/utils/__init__.py | showthesunli/liuli | 139 | 3358292 | <gh_stars>100-1000
#!/usr/bin/env python
"""
Created by howie.hu at 2021/4/7.
Description:通用函数
Changelog: all notable changes to this file will be documented
"""
from .log import LOGGER
from .tools import (
get_ip,
is_contain_text,
load_text_to_list,
md5_encryption,
ts_to_str_date,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
keras_cv_attention_models/resnet_family/__init__.py | leondgarse/Keras_attention_models | 140 | 3358300 | from keras_cv_attention_models.resnet_family.resnext import ResNeXt, ResNeXt50, ResNeXt101, ResNeXt50D, ResNeXt101W
from keras_cv_attention_models.resnet_family.resnet_quad import ResNetQ, ResNet51Q, ResNet61Q
from keras_cv_attention_models.resnet_family.resnet_deep import ResNetD, ResNet50D, ResNet101D, ResNet152D, Re... | 0 | 0 | 0 | 0 | 0 | 0 |
fbpic/particles/elementary_process/cuda_numba_utils.py | wilds9/fbpic | 131 | 3358303 | <filename>fbpic/particles/elementary_process/cuda_numba_utils.py
# Copyright 2017, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines a number of methods that are useful for elementary processes
(e.g. ionization... | 0 | 0 | 0 | 0 | 0 | 0 |
test/transforms/test_remove_isolated_nodes.py | NucciTheBoss/pytorch_geometric | 2,350 | 3358316 | <reponame>NucciTheBoss/pytorch_geometric
import torch
from torch_geometric.data import Data, HeteroData
from torch_geometric.transforms import RemoveIsolatedNodes
def test_remove_isolated_nodes():
assert str(RemoveIsolatedNodes()) == 'RemoveIsolatedNodes()'
data = Data()
data.x = torch.arange(3)
dat... | 0 | 0 | 0 | 0 | 0 | 0 |
aspect_based_sentiment_analysis/data_types.py | SurajDonthi/Aspect-Based-Sentiment-Analysis | 351 | 3358323 | <reponame>SurajDonthi/Aspect-Based-Sentiment-Analysis
from enum import IntEnum
from dataclasses import asdict, dataclass
from typing import Dict
from typing import Iterable
from typing import List
from typing import Tuple
import tensorflow as tf
class Sentiment(IntEnum):
""" We use the three basic polarities to
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 10/ch10_r03.py | PacktPublishing/Modern-Python-Cookbook | 107 | 3358324 | """Python Cookbook
Chapter 10, recipe 3.
"""
from math import sqrt
def correlation(data) -> object:
sumxy = sum(i['x']*i['y'] for i in data)
sumx = sum(i['x'] for i in data)
sumy = sum(i['y'] for i in data)
sumx2 = sum(i['x']**2 for i in data)
sumy2 = sum(i['y']**2 for i in data)
n = sum(1 ... | 0 | 2 | 0 | 0 | 2 | 0 |
mltest/test_mltest.py | Thenerdstation/mltest | 381 | 3358325 | import pytest
import tensorflow as tf
import numpy as np
from . import mltest
slim = tf.contrib.slim
def _mlp_broken_builder(x) -> object:
return slim.stack(x, slim.fully_connected, [10, 1])
def _mlp_correct_builder(x) -> object:
net = slim.stack(x, slim.fully_connected, [10, 10])
return slim.fully_con... | 0 | 2 | 0 | 0 | 2 | 0 |
integration_tests/web/test_issue_714.py | priya1puresoftware/python-slack-sdk | 2,486 | 3358354 | <filename>integration_tests/web/test_issue_714.py
import asyncio
import os
import unittest
from urllib.error import URLError
from aiohttp import ClientConnectorError
from integration_tests.env_variable_names import SLACK_SDK_TEST_BOT_TOKEN
from integration_tests.helpers import async_test
from slack_sdk.web import Web... | 0 | 0 | 0 | 0 | 0 | 0 |
custom_components/samsungtv_custom/samsungctl_080b/wake_on_lan.py | AdamOttvar/ha-samsungtv-custom | 117 | 3358359 | <reponame>AdamOttvar/ha-samsungtv-custom<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import print_function
import ctypes
import socket
import struct
import sys
import platform
import logging
try:
# noinspection PyUnboundLocalVariable,PyUnresolvedReferences
ModuleNotFoundError = ModuleNotFoundErr... | 0 | 0 | 0 | 0 | 0 | 0 |
env/lib/python3.6/site-packages/numpy/lib/mixins.py | anthowen/duplify | 145 | 3358367 | <gh_stars>100-1000
"""Mixin classes for custom array types that don't inherit from ndarray."""
from __future__ import division, absolute_import, print_function
import sys
from numpy.core import umath as um
# Nothing should be exposed in the top-level NumPy module.
__all__ = []
def _disables_array_ufunc(obj):
"... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/awscli/customizations/history/filters.py | iilness2/bash-lambda-layer-custom | 399 | 3358374 | <reponame>iilness2/bash-lambda-layer-custom
import re
class RegexFilter(object):
def __init__(self, pattern, replacement):
self._pattern = pattern
self._replacement = replacement
self._regex = None
def filter_text(self, text):
regex = self._get_regex()
filtered_text = ... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/576479_Identifying_network_name_CIDR/recipe-576479.py | tdiprima/code | 2,023 | 3358413 | # David.Clark (a) CIBER-research.eu 2012-12-20
# CIBER Research Ltd.
# version 10 hybrid for both clarity and optimisation, + bug fix.
# this code is online at
# http://code.activestate.com/recipes/576479/
from __future__ import annotations
""" Create a digital trie of ipranges(CIDR); for a given ip
determine ... | 2 | 5 | 0 | 2 | 9 | 0 |
alipay/aop/api/response/AlipayOpenSpOperationApplyResponse.py | antopen/alipay-sdk-python-all | 213 | 3358429 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.RecommendAccountDTO import RecommendAccountDTO
from alipay.aop.api.domain.RecommendAccountDTO import RecommendAccountDTO
class AlipayOpenSpOperationApplyResponse(Alip... | 0 | 3 | 0 | 3 | 6 | 0 |
src/vaping/config/schema.py | bile0026/vaping | 372 | 3358456 | from __future__ import annotations
import confu.exceptions
import confu.generator
import confu.schema
class MixedDict(confu.schema.Dict):
"""
Extended confu.schema.Dict object that prevents
validation of its interior objects.
Use for dictionaries that do not need validation or
will get validated o... | 6 | 3 | 0 | 0 | 9 | 0 |
longae/train_reconstruction.py | Gomesdrg/graph-representation-learning | 251 | 3358462 | #!/usr/bin/env python2.7
"""
This script trains a model based on the symmetrical autoencoder
architecture with parameter sharing. The model performs reconstruction
using only latent features learned from local graph topology.
Usage: python train_reconstruction.py <dataset_str> <gpu_id>
"""
import sys
if len(sys.argv)... | 0 | 0 | 0 | 0 | 0 | 0 |
clifford/test/test_function_cache.py | eric-wieser/clifford | 642 | 3358466 | import numpy as np
from clifford._numba_utils import generated_jit
import pytest
@generated_jit(cache=True)
def foo(x) -> object:
from clifford.g3 import e3
def impl(x) -> object:
return (x * e3).value
return impl
# Make the test fail on a failed cache warning
@pytest.mark.filterwarnings("error... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/SampleApps/python/django-app/boards/views.py | samruddhikhandale/Oryx | 403 | 3358467 | <reponame>samruddhikhandale/Oryx<filename>tests/SampleApps/python/django-app/boards/views.py<gh_stars>100-1000
from django.http import HttpResponse
from datetime import datetime
def home(request):
return HttpResponse('Hello, World! from Boards app' + str(datetime.now())) | 0 | 0 | 0 | 0 | 0 | 0 |
network/model_zoo.py | nagonch/DS-Net | 188 | 3358477 | # -*- coding:utf-8 -*-
# author: <NAME>
# @file: model_zoo.py
# @time: 2020/09/26 17:05
from __future__ import annotations
from .modules import BEV_Unet
from .modules import PointNet
from .modules import spconv_unet
from .modules import pytorch_meanshift
from .loss import instance_losses
from .loss import lovasz_losse... | 20 | 11 | 0 | 2 | 33 | 0 |
mindsdb/integrations/mssql/mssql.py | mindsdb/main | 261 | 3358485 | <filename>mindsdb/integrations/mssql/mssql.py
import pytds
class MSSQLConnectionChecker:
def __init__(self, **kwargs):
self.host = kwargs.get('host')
self.port = kwargs.get('port')
self.user = kwargs.get('user')
self.password = kwargs.get('password')
def _get_connnection(self)... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_gpipe.py | junjunjunk/torchgpipe | 532 | 3358515 | from __future__ import annotations
from collections import OrderedDict
from copy import deepcopy
import time
import pytest
import torch
from torch import nn
from torchgpipe import GPipe
from torchgpipe.gpipe import verify_module
def test_parameters():
model = nn.Sequential(nn.Linear(1, 1))
gpipe = GPipe(mod... | 1 | 17 | 0 | 0 | 18 | 0 |
binding.gyp | RichardLitt/node-toobusy | 542 | 3358517 | {
'targets': [
{
'target_name': 'toobusy',
'include_dirs': [
],
'sources': [
'toobusy.cc',
]
}
]
}
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/layouts/grid/lv_example_grid_5.py | nickzhuang0613/lvgl | 5,238 | 3358542 | <gh_stars>1000+
def row_gap_anim(obj, v):
obj.set_style_pad_row(v, 0)
def column_gap_anim(obj, v):
obj.set_style_pad_column(v, 0)
#
# Demonstrate column and row gap
#
# 60x60 cells
col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST]
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST]
# Create a container with grid
cont... | 0 | 0 | 0 | 0 | 0 | 0 |
supplychainpy/reporting/config/settings.py | luisccalves/supplychainpy | 231 | 3358544 | <gh_stars>100-1000
# Copyright (c) 2015-2016, The Authors and Contributors
# <see AUTHORS file>
# 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 th... | 0 | 0 | 0 | 0 | 0 | 0 |
test/modules/tls/htdocs/b.mod-tls.test/resp-jitter.py | tititiou36/httpd | 2,529 | 3358577 | <reponame>tititiou36/httpd
#!/usr/bin/env python3
import random
import sys
import time
from datetime import timedelta
random.seed()
to_write = total_len = random.randint(1, 10*1024*1024)
sys.stdout.write("Content-Type: application/octet-stream\n")
sys.stdout.write(f"Content-Length: {total_len}\n")
sys.stdout.write("\... | 0 | 0 | 0 | 0 | 0 | 0 |
veles/tests/mastodon_sample.py | AkshayJainG/veles | 1,007 | 3358586 | <reponame>AkshayJainG/veles
# -*- coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Oct 1, 2014
████████████... | 0 | 0 | 0 | 0 | 0 | 0 |
pymongo/pyopenssl_context.py | naomielst/mongo-python-driver | 2,593 | 3358602 | # Copyright 2019-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 10 | 16 | 1 | 3 | 30 | 0 |
vaeseq/examples/text/dataset.py | totucuong/vae-seq | 161 | 3358604 | <gh_stars>100-1000
# Copyright 2018 Google, Inc.,
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 0 | 0 | 0 | 0 | 0 | 0 |
pyBN/inference/marginal_exact/__init__.py | seuzmj/pyBN | 126 | 3358620 | from pyBN.inference.marginal_exact.exact_bp import *
from pyBN.inference.marginal_exact.ve_marginal import * | 0 | 0 | 0 | 0 | 0 | 0 |
ml-with-sklearn/AdaBoost/AdaBoost.py | datawhalechina/machine-learning-toy-code | 141 | 3358636 | from sklearn.ensemble import AdaBoostClassifier
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn import metrics
iris = datasets.load_iris()
X = iris.data
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
print("X_train:",len(X_train... | 0 | 0 | 0 | 0 | 0 | 0 |
beta_rec/utils/monitor.py | mengzaiqiao/TVBR | 126 | 3358646 | from __future__ import annotations
import os
import time
from threading import Thread
import cpuinfo
import GPUtil
import psutil
from tensorboardX import SummaryWriter
class Monitor(Thread):
"""Monitor Class."""
def __init__(self, log_dir, delay: int=1, gpu_id: int=0, verbose: bool=False):
"""Initia... | 5 | 1 | 0 | 8 | 14 | 0 |
bin/test_file.py | rodrigomelo9/uvm-python | 140 | 3358662 | <filename>bin/test_file.py
# File header
# Header row2
import_var = "ABC"
# Also move this as a comment
# for 'comment_this_func.
#
# With extra empty line
def comment_this_func(aaa):
return aaa * 2
## Move this as class comment docstring
## Add this to class
class ABC():
def do_not_comment_this(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
PythonScripting/CSVFiles/examples3_csvmodule.py | Neo-sunny/pythonProgs | 622 | 3358668 | <reponame>Neo-sunny/pythonProgs<gh_stars>100-1000
"""
Using the csv module.
"""
import csv
def parse(csvfilename):
"""
Reads CSV file named csvfilename, parses
it's content and returns the data within
the file as a list of lists.
"""
table = []
with open(csvfilename, "r") as csvfile:
... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/src/site/sphinx/extensions/contentui/__init__.py | krmartin/sparkling-water | 990 | 3358680 | # The code for this extension is based on https://github.com/ulrobix/sphinxcontrib-contentui
| 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/data/mrcrilly/awx.py | mjuenema/python-terrascript | 507 | 3358682 | <filename>terrascript/data/mrcrilly/awx.py
# terrascript/data/mrcrilly/awx.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:12:44 UTC)
import terrascript
class awx_credential(terrascript.Data):
pass
class awx_credential_azure_key_vault(terrascript.Data):
pass
class awx_credentials(terrasc... | 0 | 0 | 0 | 0 | 0 | 0 |
mudpi/sensors/mcp3xxx/soil_sensor.py | icyspace/mudpi-core | 163 | 3358688 | from __future__ import annotations
import sys
from adafruit_mcp3xxx.analog_in import AnalogIn
from logger.Logger import Logger, LOG_LEVEL
from sensors.mcp3xxx.sensor import Sensor
# Tested using Sun3Drucker Model SX239
# Wet Water = 287
# Dry Air = 584
AirBounds = 43700
WaterBounds = 13000
intervals = int((AirBou... | 3 | 2 | 0 | 0 | 5 | 0 |
gen2-play-encoded-stream/main.py | joey1442/depthai-experiments | 381 | 3358698 | #!/usr/bin/env python3
import depthai as dai
import subprocess as sp
from os import name as osName
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and output
camRgb = pipeline.createColorCamera()
videoEnc = pipeline.createVideoEncoder()
xout = pipeline.createXLinkOut()
xout.setStreamName("h264")
# Pro... | 0 | 0 | 0 | 0 | 0 | 0 |
core/polyaxon/polyflow/schedules/__init__.py | admariner/polyaxon | 3,200 | 3358725 | <filename>core/polyaxon/polyflow/schedules/__init__.py<gh_stars>1000+
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tagging/train.py | grahamwhiteuk/neutralizing-bias | 169 | 3358746 | # -*- coding: utf-8 -*-
"""
train bert
python tagging/train.py --train ../../data/v6/corpus.wordbiased.tag.train --test ../../data/v6/corpus.wordbiased.tag.test --working_dir TEST --train_batch_size 3 --test_batch_size 10 --hidden_size 32 --debug_skip
"""
from pytorch_pretrained_bert.tokenization import BertTokenize... | 0 | 0 | 0 | 0 | 0 | 0 |
mac/pyobjc-framework-Quartz/PyObjCTest/test_PDFAnnotationLine.py | albertz/music-player | 132 | 3358755 |
from PyObjCTools.TestSupport import *
from Quartz.PDFKit import *
class TestPDFAnnotationLine (TestCase):
def testConstants(self):
self.assertEqual(kPDFLineStyleNone, 0)
self.assertEqual(kPDFLineStyleSquare, 1)
self.assertEqual(kPDFLineStyleCircle, 2)
self.assertEqual(kPDFLineStyle... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | amosbastian/python-fpl | 217 | 3358759 | <reponame>amosbastian/python-fpl<gh_stars>100-1000
import aiohttp
import pytest
import os
from fpl import FPL
from fpl.models import Fixture, H2HLeague, User, ClassicLeague, Team, Gameweek
from tests.test_classic_league import classic_league_data
from tests.test_fixture import fixture_data
from tests.test_h2h_league i... | 0 | 0 | 0 | 0 | 0 | 0 |
src/encoded/tests/test_schema_annotation.py | procha2/encoded | 102 | 3358761 | import pytest
def test_annotation_with_subtype(
testapp,
submitter_testapp,
annotation_dhs,
annotation_ccre_2,
annotation_dataset
):
testapp.patch_json(
annotation_dhs['@id'],
{'annotation_subtype': 'all'},
status=200)
# annotation_subtype can only be submitted with... | 0 | 0 | 0 | 0 | 0 | 0 |
davarocr/davarocr/davar_rcg/core/converter/builder.py | icedream2/DAVAR-Lab-OCR | 387 | 3358772 | """
##################################################################################################
# Copyright Info : Copyright (c) <NAME> @ Hikvision Research Institute. All rights reserved.
# Filename : builder.py
# Abstract :
# Current Version: 1.0.0
# Date : 2020-05-31
#######... | 0 | 1 | 0 | 0 | 1 | 0 |
pororo/tasks/constituency_parsing.py | jayten42/pororo | 1,137 | 3358787 | <reponame>jayten42/pororo
"""Constituency Parsing related modeling class"""
import re
from typing import List, Optional, Tuple
from lxml import etree
from pororo.tasks.utils.base import PororoFactoryBase, PororoTaskBase
from pororo.tasks.utils.download_utils import download_or_load
class PororoConstFactory(PororoF... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/guide/tutorial/chatbot/bot.py | teaglebuilt/bocadillo | 434 | 3358789 | <gh_stars>100-1000
# chatbot/bot.py
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
diego = ChatBot("Diego")
trainer = ChatterBotCorpusTrainer(diego)
trainer.train(
"chatterbot.corpus.english.greetings",
"chatterbot.corpus.english.conversations",
)
| 0 | 0 | 0 | 0 | 0 | 0 |
asteroid/models/demask.py | ldelebec/asteroid | 722 | 3358805 | from torch import nn
from .base_models import BaseEncoderMaskerDecoder
from asteroid_filterbanks import make_enc_dec
from asteroid_filterbanks.transforms import mag, magreim
from ..masknn import norms, activations
from ..utils.torch_utils import pad_x_to_y
import warnings
class DeMask(BaseEncoderMaskerDecoder):
"... | 17 | 6 | 0 | 0 | 23 | 0 |
quarkchain/evm/bloom.py | anshulkusa/pyquarkchain | 237 | 3358813 | from quarkchain.utils import sha3_256
from quarkchain.evm import utils
"""
Blooms are the 3-point, 2048-bit (11-bits/point) Bloom filter of each
component (except data) of each log entry of each transaction.
We set the bits of a 2048-bit value whose indices are given by
the low order 11-bits
of the first three double... | 7 | 9 | 0 | 0 | 16 | 0 |
python/ray/workflow/examples/comparisons/google_cloud_workflows/sub_workflows_workflow.py | linyiyue/ray | 21,382 | 3358834 | from ray import workflow
@workflow.step
def hello(name: str) -> str:
return format_name.step(name)
@workflow.step
def format_name(name: str) -> str:
return "hello, {}".format(name)
@workflow.step
def report(msg: str) -> None:
print(msg)
if __name__ == "__main__":
workflow.init()
r1 = hello.s... | 3 | 3 | 0 | 0 | 6 | 0 |
new_venv/Lib/site-packages/cardio/core/__init__.py | Shlyankin/cardio | 250 | 3358841 | """ Core CardIO objects """
from .ecg_batch import EcgBatch, add_actions
from .ecg_dataset import EcgDataset
from . import kernels
| 0 | 0 | 0 | 0 | 0 | 0 |
sponsor/admin.py | crydotsnake/djangogirls | 446 | 3358854 | from __future__ import annotations
from django.contrib import admin
from core.models import EventPageContent
from .models import Sponsor, Donor
class SponsorInline(admin.TabularInline):
model = EventPageContent.sponsors.through
extra: int = 1
verbose_name_plural: str = 'Sponsors'
class SponsorAdmin(adm... | 1 | 2 | 5 | 0 | 8 | 0 |
core/python/kungfu/yijinjing/log.py | yunnant/kungfu | 2,209 | 3358888 | import logging
import os, sys, platform
import pyyjj
from kungfu.yijinjing.time import *
LOG_MSG_FORMAT = '[%(nanotime)s] [%(loglevel)s] [%(process)6d/%(tid)-6d] [%(pathname)s:%(lineno)d#%(funcName)s] %(message)s'
LOG_FILE_DATEEXT_FORMAT = '%Y-%m-%d'
LOG_LEVELS = {
'trace': logging.DEBUG,
'debug': logging.DEB... | 0 | 4 | 24 | 0 | 28 | 0 |
softdelete/forms.py | RedMoon32/django-softdelete | 242 | 3358892 | from django.forms import *
from softdelete.models import *
import logging
class ChangeSetForm(ModelForm):
class Meta:
model = ChangeSet
exclude: tuple[str, str] = ('content_type', 'object_id',)
| 0 | 0 | 1 | 0 | 1 | 0 |
pyscf/ao2mo/test/test_incore.py | QuESt-Calculator/pyscf | 501 | 3358893 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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/license... | 0 | 0 | 0 | 0 | 0 | 0 |
Source/mtm/config/Config.py | fairhopeweb/Projeny | 752 | 3358912 | <filename>Source/mtm/config/Config.py
import yaml
import mtm.util.Util as Util
from mtm.util.Assert import *
import mtm.ioc.Container as Container
from mtm.ioc.Inject import Inject
from mtm.ioc.Inject import InjectOptional
import mtm.ioc.IocAssertions as Assertions
from collections import OrderedDict
class Config:... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/grappler/hierarchical_controller.py | abhaikollara/tensorflow | 848 | 3358931 | <reponame>abhaikollara/tensorflow<filename>tensorflow/python/grappler/hierarchical_controller.py
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
cinder/tests/unit/api/contrib/test_hosts.py | helenwalsh/cinder | 571 | 3358932 | # Copyright (c) 2011 OpenStack Foundation
# 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 ... | 1 | 1 | 4 | 0 | 6 | 0 |
internals/inspector.py | brandon-leapyear/SublimeHaskell | 452 | 3358936 | <reponame>brandon-leapyear/SublimeHaskell
import os.path
import sublime
import SublimeHaskell.internals.atomics as Atomics
import SublimeHaskell.internals.logging as Logging
import SublimeHaskell.internals.settings as Settings
import SublimeHaskell.sublime_haskell_common as Common
# Show scan progress in status ba... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/galaxy/util/web_compat.py | rikeshi/galaxy | 1,085 | 3358951 | <reponame>rikeshi/galaxy<filename>lib/galaxy/util/web_compat.py
"""Work around for gross circular dependency between galaxy.util and galaxy.web_stack.
Provide a function that will delay to forking in a uwsgi environment but run immediately
otherwise.
"""
try:
from galaxy.web_stack import register_postfork_function... | 0 | 0 | 0 | 0 | 0 | 0 |
LDA scikit-learn/load20newsgroups.py | awesome-archive/Machine-Learning-with-Python | 942 | 3359001 | from sklearn.datasets import fetch_20newsgroups
dataset = fetch_20newsgroups(shuffle=True, random_state=1, remove=('headers', 'footers', 'quotes'))
documents = dataset.data
| 0 | 0 | 0 | 0 | 0 | 0 |
src/gam/gapi/directory/roles.py | GAM-team/GAM | 102 | 3359008 | <reponame>GAM-team/GAM
import sys
from gam.var import (
GC_Values,
GC_CUSTOMER_ID,
GM_Globals,
GM_MAP_ROLE_ID_TO_NAME,
GM_MAP_ROLE_NAME_TO_ID,
UID_PATTERN
)
import gam
from gam import controlflow
from gam import display
from gam import gapi
from gam.gapi import d... | 0 | 0 | 0 | 0 | 0 | 0 |
netbox/netbox/graphql/fields.py | TheFlyingCorpse/netbox | 4,994 | 3359015 | from functools import partial
import graphene
from graphene_django import DjangoListField
from .utils import get_graphene_type
__all__ = (
'ObjectField',
'ObjectListField',
)
class ObjectField(graphene.Field):
"""
Retrieve a single object, identified by its numeric ID.
"""
def __init__(self... | 0 | 3 | 0 | 0 | 3 | 0 |
tensor2tensor/envs/time_step_test.py | jaseweir/tensor2tensor | 12,921 | 3359035 | # coding=utf-8
# Copyright 2021 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/audio/tts/deepvoice3_ljspeech/module.py | chunzhang-hub/PaddleHub | 8,360 | 3359073 | <filename>modules/audio/tts/deepvoice3_ljspeech/module.py
# coding:utf-8
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/countries/test_germany.py | m-ganko/python-holidays | 654 | 3359081 | # -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <<EMAIL>> (c) ... | 0 | 0 | 0 | 0 | 0 | 0 |
fastparquet/thrift_structures.py | javabrett/fastparquet | 1,738 | 3359101 | <filename>fastparquet/thrift_structures.py<gh_stars>1000+
import io
import sys
import types
from thrift.protocol.TCompactProtocol import TCompactProtocolAccelerated as TCompactProtocol
from thrift.protocol.TProtocol import TProtocolException
from .parquet_thrift.parquet import ttypes as parquet_thrift
from .util impor... | 0 | 0 | 0 | 0 | 0 | 0 |
blueoil/tfds_pre_processor.py | msakai/blueoil | 248 | 3359123 | <reponame>msakai/blueoil<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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 Licen... | 0 | 0 | 0 | 0 | 0 | 0 |
djangoerp/notifications/tests/test_managers.py | xarala221/django-erp | 345 | 3359129 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PART... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_tenants/test_utils.py | jadsonbr/django-tenant-users | 165 | 3359130 | <reponame>jadsonbr/django-tenant-users<gh_stars>100-1000
import pytest
from tenant_users import compat
from tenant_users.tenants import utils
from tenant_users.tenants.models import ExistsError
@pytest.mark.django_db()
def test_get_current_tenant(public_tenant, test_tenants):
"""Tests utils.get_current_tenant() ... | 0 | 0 | 0 | 0 | 0 | 0 |
chaospy/expansion/gegenbauer.py | utsekaj42/chaospy | 333 | 3359132 | import numpy
import chaospy
def gegenbauer(
order,
alpha,
lower=-1,
upper: int=1,
physicist: bool=False,
normed: bool=False,
retall: bool=False,
) -> object:
"""
Gegenbauer polynomials.
Args:
order (int):
The polynomial order.
... | 4 | 1 | 0 | 0 | 5 | 0 |
homeassistant/components/lutron_caseta/models.py | mib1185/core | 30,023 | 3359141 | """The lutron_caseta integration models."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from pylutron_caseta.smartbridge import Smartbridge
from homeassistant.helpers.device_registry import DeviceEntry
@dataclass
class LutronCasetaData:
"""Data for the lutron_cas... | 0 | 0 | 3 | 0 | 3 | 0 |
probtorch/objectives/importance.py | alicanb/probtorch | 876 | 3359143 | from __future__ import annotations
from numbers import Number
from probtorch.util import log_mean_exp
def elbo(q, p, sample_dim: object | None=None, batch_dim: object | None=None, alpha: float=0.1,
size_average: bool=True, reduce: bool=True) -> object:
r"""Calculates an importance weighted Monte Carlo es... | 5 | 1 | 0 | 0 | 6 | 0 |
tests/test_Tag.py | maalbano/TemPy | 154 | 3359179 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
"""
import unittest
from tempy.tags import Div, P, Br
from tempy.elements import Tag
from tempy.content import Content
from tempy.exceptions import TagError, WrongContentError, WrongArgsError
class TestTag(unittest.TestCase):
def test_recu... | 0 | 0 | 0 | 0 | 0 | 0 |
mediaMicroservices/test/testTextService.py | rodrigo-bruno/DeathStarBench | 364 | 3359184 | import sys
sys.path.append('../gen-py')
from media_service import TextService
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
import random
import string
def main():
# Make socket
socket = TSocket.TSocket("ath... | 0 | 0 | 0 | 0 | 0 | 0 |
beembase/objects.py | abitmore/beem | 118 | 3359190 | <reponame>abitmore/beem<gh_stars>100-1000
# -*- coding: utf-8 -*-
import json
from math import floor
import decimal
from beemgraphenebase.py23 import py23_bytes, bytes_types, integer_types, string_types, text_type
from collections import OrderedDict
from beemgraphenebase.types import (
Uint8, Int16, Uint16, Uint32,... | 0 | 0 | 0 | 0 | 0 | 0 |
PythonProjects/ImageManipulation/SnapImage.py | vygasuresh/img | 263 | 3359198 | <reponame>vygasuresh/img
__author__ = 'Charlie'
#An attempt at image security where screenshots will not be able to capture imagepyth
import cv2
import numpy as np
import argparse, sys, inspect, os
import time
cmd_subfolder = os.path.realpath(
os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.curr... | 0 | 0 | 0 | 0 | 0 | 0 |
auxiliary/utils.py | IMAGINE-Paris/AtlasNetV2 | 121 | 3359222 | <filename>auxiliary/utils.py<gh_stars>100-1000
from __future__ import print_function
import numpy as np
import pickle
import visdom
import torch
import sys
import os
import random
class COLORS:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
E... | 0 | 0 | 0 | 0 | 0 | 0 |
antipatterns/python-examples/reraise_exceptions_good.py | Zorono/professional-programming | 15,845 | 3359264 | from collections import namedtuple
Bread = namedtuple("Bread", "color")
class ToastException(Exception):
pass
def toast(bread):
try:
put_in_toaster(bread)
except:
print("Got exception while trying to toast")
raise
def put_in_toaster(bread):
brad.color = "light_brown" # No... | 0 | 0 | 0 | 0 | 0 | 0 |
bfxapi/models/transfer.py | uggel/bitfinex-api-py | 162 | 3359272 | """
Module used to describe a transfer object
"""
class TransferModel:
"""
Enum used to index the location of each value in a raw array
"""
MTS: int = 0
W_FROM: int = 1
W_TO: int = 2
C_FROM: int = 4
C_TO: int = 5
AMOUNT: int = 7
class Transfer:
"""
MTS int Millisecond Time ... | 0 | 2 | 6 | 0 | 8 | 0 |
vyper/semantics/types/user/enum.py | ethereum/vyper | 1,471 | 3359288 | from typing import Dict, List
from vyper import ast as vy_ast
from vyper.abi_types import ABI_GIntM
from vyper.exceptions import (
EnumDeclarationException,
StructureException,
UnimplementedException,
UnknownAttribute,
)
from vyper.semantics.namespace import validate_identifier
from vyper.semantics.typ... | 18 | 13 | 1 | 0 | 32 | 0 |
dbaas/account/forms/user.py | didindinn/database-as-a-service | 303 | 3359289 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django import forms
LOG = logging.getLogger(__name__)
class CustomUserChangeForm(UserChan... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_flow.py | zuarbase/server-client-python | 470 | 3359298 | import unittest
import os
import requests_mock
import xml.etree.ElementTree as ET
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
from tableauserverclient.server.endpoint.exceptions import InternalServerError
from tableauserverclient.server.request_factory import Reque... | 0 | 0 | 0 | 0 | 0 | 0 |
pyamg/strength.py | TareqZaman/pyamg | 371 | 3359306 | from __future__ import annotations
"""Strength of Connection functions.
Requirements for the strength matrix C are:
1) Nonzero diagonal whenever A has a nonzero diagonal
2) Non-negative entries (float or bool) in [0,1]
3) Large entries denoting stronger connections
4) C denotes nodal connections, i.e.,... | 28 | 12 | 0 | 0 | 40 | 0 |
wbb/modules/create.py | DopeBotz/WilliamButcherBot-1 | 175 | 3359327 | <filename>wbb/modules/create.py<gh_stars>100-1000
"""
MIT License
Copyright (c) 2021 TheHamkerCat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation... | 0 | 0 | 0 | 0 | 0 | 0 |
lenstronomy/Plots/chain_plot.py | lucateo/lenstronomy | 107 | 3359330 | <filename>lenstronomy/Plots/chain_plot.py<gh_stars>100-1000
import copy
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
from lenstronomy.Util.package_util import exporter
export, __all__ = exporter()
@export
def plot_chain_list(chain_list, index=0, num_ave... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/SceneInfo.py | Anning01/alipay-sdk-python-all | 213 | 3359353 | <reponame>Anning01/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class SceneInfo(object):
def __init__(self):
self._cert_no = None
self._company_id = None
self._company_name = None
self._employ... | 0 | 0 | 0 | 0 | 0 | 0 |
ecosystem_tools/mindconverter/mindconverter/graph_based_converter/constant.py | mindspore-ai/mindinsight | 216 | 3359355 | # Copyright 2020-2021 Huawei Technologies Co., Ltd.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 ... | 0 | 1 | 111 | 0 | 112 | 0 |
api/integrations/slack/serializers.py | SolidStateGroup/Bullet-Train-API | 126 | 3359362 | from django.core.exceptions import ObjectDoesNotExist
from rest_framework import serializers
from integrations.slack.models import SlackConfiguration, SlackEnvironment
from .exceptions import SlackChannelJoinError
from .slack import SlackWrapper
class SlackEnvironmentSerializer(serializers.ModelSerializer):
cla... | 0 | 1 | 1 | 0 | 2 | 0 |
src/python/passeio_do_cavalo.py | danilolmoura/Algoritmos-e-Estruturas-de-Dados | 653 | 3359381 | <gh_stars>100-1000
""" Implementação do algoritmo passeio do cavalo """
def aceitavel(x, y):
"""
Aceitavel se estiver dentro do tabuleiro e a casa ainda nao tiver sido
visitada
Retorna True ou False
"""
if (
x >= 0
and x <= num - 1
and y >= 0
and y <= num - 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/agent/k8s-rest-agent/src/api/utils/jwt.py | tianxuanhong/cello | 865 | 3359401 | from __future__ import annotations
import logging
from django.contrib.auth import get_user_model
from rest_framework import serializers
User = get_user_model()
LOG = logging.getLogger(__name__)
class UserSerializer(serializers.ModelSerializer):
id = serializers.CharField(source="username")
class Meta:
... | 2 | 2 | 2 | 0 | 6 | 0 |
04_CNN_advances/cnn_mnist_simple.py | jastarex/DL_Notes | 203 | 3359421 |
# coding: utf-8
# # 卷积神经网络示例与各层可视化
# In[1]:
import os
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
get_ipython().magic(u'matplotlib inline')
print ("当前TensorFlow版本为 [%s]" % (tf.__version__))
print ("所有包载入完毕")
# ## 载入 MNIST
#... | 0 | 1 | 0 | 0 | 1 | 0 |
cloudmarker/alerts/slackalert.py | dkuspawono/cloudmarker | 208 | 3359428 | <reponame>dkuspawono/cloudmarker<gh_stars>100-1000
"""Alerter to send Slack messages for identified anomalies."""
import json
import logging
import slackclient
_log = logging.getLogger(__name__)
class SlackAlert:
"""Alert plugin to send Slack alerts."""
def __init__(self, bot_user_token, to, text,
... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/modules/misc/test_zlib.py | aisk/ironpython3 | 1,872 | 3359431 | <reponame>aisk/ironpython3
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
#
# Copyright (c) <NAME>.
#
import os
import unittest
import zlib
from iptest import... | 0 | 0 | 0 | 0 | 0 | 0 |
preprocessor/preprocessor.py | ishine/Comprehensive-Transformer-TTS | 147 | 3359471 | from __future__ import annotations
import os
import re
import random
import json
import copy
import tgt
import librosa
import numpy as np
import pyworld as pw
from scipy.stats import betabinom
from sklearn.preprocessing import StandardScaler
from tqdm import tqdm
from pathlib import Path
from g2p_en import G2p
import... | 4 | 16 | 0 | 1 | 21 | 0 |
model/third_party/HMNet/DataLoader/infinibatch/test/test_doctests.py | NickSchoelkopf/SummerTime | 178 | 3359472 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
This file causes the doctests to be included as part of unit tests.
To make sure the doctests of a specific module are included,
please replicate the `addTests` call for the iterators module below.
"""
import doctest
import infinibatch.iter... | 0 | 1 | 0 | 0 | 1 | 0 |
src/test/unit/mock/mocker.py | YangHao666666/hawq | 450 | 3359497 | #!/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
# "... | 0 | 0 | 0 | 0 | 0 | 0 |
aiida/cmdline/utils/ascii_vis.py | azadoks/aiida-core | 180 | 3359528 | <reponame>azadoks/aiida-core<gh_stars>100-1000
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
imodels/experimental/bartpy/initializers/sklearntreeinitializer.py | csinva/interpretability-implementations-demos | 102 | 3359586 | <reponame>csinva/interpretability-implementations-demos
from typing import Tuple, List
from operator import gt, le
import numpy as np
from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor
from imodels.tree.figs import FIGSRegressor, Node, FIGSRegressorCV
from sklearn.exceptions import NotFitted... | 0 | 0 | 0 | 0 | 0 | 0 |
client/verta/verta/environment/__init__.py | vishalbelsare/modeldb | 835 | 3359591 | # -*- coding: utf-8 -*-
"""Utilities for environment versioning."""
from verta._internal_utils import documentation
from ._environment import _Environment
from ._docker import Docker
from ._python import Python
documentation.reassign_module(
[Python],
module_name=__name__,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
kmip/tests/unit/pie/objects/test_managed_object.py | ondrap/PyKMIP | 179 | 3359623 | <reponame>ondrap/PyKMIP
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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.a... | 0 | 0 | 0 | 0 | 0 | 0 |
official/recommendation/stat_utils.py | akshit-protonn/models | 82,518 | 3359633 | <gh_stars>1000+
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | 0 | 0 | 0 | 0 | 0 | 0 |
not_used.py | clegoues/tranX | 421 | 3359658 | # def self_training(args):
# """Perform self-training
#
# First load decoding results on disjoint data
# also load pre-trained model and perform supervised
# training on both existing training data and the
# decoded results
# """
#
# print('load pre-trained model from [%s]' % args.load_model... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.