max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
tests/user_test.py | jjinno/pygerduty | 144 | 12766171 | from __future__ import absolute_import
import httpretty
import pygerduty
import pygerduty.v2
###################
# Version 1 Tests #
###################
@httpretty.activate
def test_get_user_v1():
body = open('tests/fixtures/user_v1.json').read()
httpretty.register_uri(
httpretty.GET, "https://contos... |
server_python/config.py | dkvirus/py-novel | 145 | 12766193 | # config.py
# encoding:utf-8
DEBUG = True
JSON_AS_ASCII = False
|
spacy-annotator/displacy/server.py | aniruddha-adhikary/spacy-dev-resources | 132 | 12766203 | #!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import print_function
import falcon
import spacy
import json
import sys
from spacy.pipeline import EntityRecognizer
import spacy.util
from spacy.tagger import Tagger
from .parse import Entities, TrainEntities
from falcon_cors import CORS
... |
mmpose/core/optimizer/registry.py | chaowentao/mmpose | 367 | 12766204 | from mmcv.utils import Registry
OPTIMIZERS = Registry('optimizers')
|
devil/devil/android/tools/system_app_test.py | Martijnve23/catapult | 1,894 | 12766248 | <reponame>Martijnve23/catapult<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import unittest
if __name__ == '__main__':
sys.path.append(
... |
sleap/nn/data/training.py | hectorcarrion/sleap | 156 | 12766250 | <reponame>hectorcarrion/sleap
"""Transformers and utilities for training-related operations."""
import numpy as np
import tensorflow as tf
import sleap
from sleap.nn.data.providers import LabelsReader
from sleap.nn.data.utils import expand_to_rank, ensure_list
import attr
from typing import List, Text, Optional, Any, ... |
paas-ce/paas/esb/components/bk/apis/cc/add_app.py | renmcc/bk-PaaS | 767 | 12766268 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
quora/wsgi.py | alexricheburton/gittest | 116 | 12766296 | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quora.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
from whitenoise.django import DjangoWhiteNoise
application = Cling(get_wsgi_application())
application = DjangoWhiteNoise(application)
|
example/ner/utils.py | tipevo/webstruct | 210 | 12766301 | <reponame>tipevo/webstruct
# -*- coding: utf-8 -*-
from functools import partial
from tqdm import tqdm
pages_progress = partial(tqdm, unit=' pages', smoothing=False, leave=True)
|
theme/management/commands/reset_quota.py | hydroshare/hydroshare | 178 | 12766318 | <reponame>hydroshare/hydroshare
from django.core.management.base import BaseCommand
from django_irods.storage import IrodsStorage
from django.conf import settings
class Command(BaseCommand):
help = "Reset quota by forcing quota iRODS microservices to recalculate quota for all users."
def handle(self, *args, ... |
readthedocs/rtd_tests/tests/test_version_config.py | mforbes/readthedocs.org | 4,054 | 12766331 | <gh_stars>1000+
from django.test import TestCase
from django_dynamic_fixture import get
from readthedocs.builds.models import Build, Version
from readthedocs.projects.models import Project
class VersionConfigTests(TestCase):
def setUp(self):
self.project = get(Project)
self.version = get(Version... |
AET/imagenet/config/ImageNet_Unsupervised.py | pjwu1997/teil_project | 114 | 12766347 | <reponame>pjwu1997/teil_project<filename>AET/imagenet/config/ImageNet_Unsupervised.py
batch_size = 192*4
config = {}
# set the parameters related to the training and testing set
data_train_opt = {}
data_train_opt['batch_size'] = batch_size
data_train_opt['unsupervised'] = True
data_train_opt['epoch_size'] = None
da... |
models/fpn_global_local_fmreg_ensemble.py | yinchimaoliang/GLNet | 119 | 12766349 | from .resnet import resnet50
import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
class fpn_module_global(nn.Module):
def __init__(self, numClass):
super(fpn_module_global, self).__init__()
self._up_kwargs = {'mode': 'bilinear'}
# Top layer
self.top... |
src/opnsense/scripts/filter/pftop.py | onedr0p/core | 2,109 | 12766350 | <filename>src/opnsense/scripts/filter/pftop.py
#!/usr/local/bin/python3
"""
Copyright (c) 2021 <NAME> <<EMAIL>>
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... |
evaluate.py | wmylxmj/Anime-Super-Resolution | 120 | 12766362 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 30 21:24:36 2019
@author: wmy
"""
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from PIL import Image
from keras import backend as K
from keras.losses import mean_absolute_error, mean_squared_error
from keras.models import load_m... |
Gelatin/compiler/Context.py | Etherbay/Gelatin | 107 | 12766363 | <filename>Gelatin/compiler/Context.py
# Copyright (c) 2010-2017 <NAME>
#
# 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 the rights
# to use,... |
src/python/pants/backend/terraform/lint/tffmt/tffmt.py | yoav-orca/pants | 1,806 | 12766378 | <filename>src/python/pants/backend/terraform/lint/tffmt/tffmt.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import textwrap
from pants.backend.terraform.lint.fmt import TerraformFmtRequest
from pants.backend.terrafor... |
third_party/weston/generate_configs.py | zealoussnow/chromium | 14,668 | 12766394 | <gh_stars>1000+
#!/usr/bin/env python
#
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates config files for building Weston."""
from __future__ import print_function
import os
import re
import shu... |
language/serene/claim_tfds.py | Xtuden-com/language | 1,199 | 12766416 | <gh_stars>1000+
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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
#
# Unl... |
kaldi/steps/dict/apply_lexicon_edits.py | ishine/asv-subtools | 370 | 12766417 | #!/usr/bin/env python
# Copyright 2016 <NAME>
# Apache 2.0.
from __future__ import print_function
import argparse
import sys
def GetArgs():
parser = argparse.ArgumentParser(description = "Apply an lexicon edits file (output from subtools/kaldi/steps/dict/select_prons_bayesian.py)to an input lexicon"
... |
B03898_02_Codes/B03898_02_02.py | prakharShuklaOfficial/Mastering-Python-for-Finance-source-codes | 446 | 12766424 | <reponame>prakharShuklaOfficial/Mastering-Python-for-Finance-source-codes<filename>B03898_02_Codes/B03898_02_02.py
"""
README
======
This is a Python code.
======
"""
""" Least squares regression with statsmodels """
import numpy as np
import statsmodels.api as sm
# Generate some sample data
num_periods = 9
all_value... |
scripts/python/s2-c2-extract-schema.py | ashutoshsingh0223/freebase-triples | 177 | 12766471 | <filename>scripts/python/s2-c2-extract-schema.py
#!/usr/bin/env python
"""
Run with:
$ python this-script.py [path_to_input_file]
"""
import argparse
import datetime
import subprocess
import time
# Globals
# Note: path to the query file has been hardcoded here
# queries.txt file has a schema of [slice_title],... |
tools/graph_bag/scripts/test_rmse_utilities.py | limenutt/astrobee | 629 | 12766482 | <gh_stars>100-1000
#!/usr/bin/python
#
# Copyright (c) 2017, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# All rights reserved.
#
# The Astrobee platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this ... |
source_code/1-1-urllib.py | VickyMin1994/easy-scraping-tutorial | 708 | 12766510 | from urllib.request import urlopen
# if has Chinese, apply decode()
html = urlopen("https://mofanpy.com/static/scraping/basic-structure.html").read().decode('utf-8')
print(html)
import re
res = re.findall(r"<title>(.+?)</title>", html)
print("\nPage title is: ", res[0])
# Page title is: Scraping tutorial 1 | 莫烦Pyth... |
tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py | awslabs/aws-lambda-builders | 180 | 12766541 | <filename>tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py<gh_stars>100-1000
import os
import shutil
import tempfile
from unittest import TestCase
from aws_lambda_builders.builder import LambdaBuilder
from aws_lambda_builders.exceptions import WorkflowFailedError
from aws_lambda_builders.w... |
elegantrl/envs/starcraft/smac_maps.py | tnerush71/ElegantRL | 759 | 12766557 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from pysc2.maps import lib
from smac.env.starcraft2.maps import smac_maps
map_param_registry = {
"1o_10b_vs_1r": {
"n_agents": 11,
"n_enemies": 1,
"limit": 50,
"a_race": "Z"... |
tests/cyclic/bar.py | topwebmaster/factory_boy | 1,932 | 12766570 | # Copyright: See the LICENSE file.
"""Helper to test circular factory dependencies."""
import factory
class Bar:
def __init__(self, foo, y):
self.foo = foo
self.y = y
class BarFactory(factory.Factory):
class Meta:
model = Bar
y = 13
foo = factory.SubFactory('cyclic.foo.Foo... |
examples/plot_sine_wave_2d.py | ktanishqk/py-earth | 360 | 12766597 | """
==================================
Plotting two simple sine functions
==================================
A simple example plotting a fit of two sine functions.
"""
import numpy
import matplotlib.pyplot as plt
from pyearth import Earth
# Create some fake data
numpy.random.seed(2)
m = 10000
n = 10
X = 80 * numpy.r... |
setup.py | walles/px | 149 | 12766599 | #!/usr/bin/env python
import os
import re
import shutil
import filecmp
import tempfile
import subprocess
from setuptools import setup
VERSIONFILE = "px/version.py"
git_version = (
subprocess.check_output(["git", "describe", "--dirty"]).decode("utf-8").strip()
)
with tempfile.NamedTemporaryFile(suffix=".py", del... |
zproc/context.py | pycampers/zproc | 106 | 12766600 | import atexit
import multiprocessing
import pprint
import signal
import time
from contextlib import suppress
from typing import Callable, Union, Any, List, Mapping, Sequence, Tuple, cast
from . import util
from .consts import DEFAULT_NAMESPACE
from .process import Process
from .server import tools
from .state.state im... |
demos/graphql/graph/chat/db_utils.py | hzlmn/aiohttp-demos | 649 | 12766605 | <gh_stars>100-1000
from aiopg.sa import SAConnection as SAConn
from aiopg.sa.result import RowProxy
from graph.types import RowsProxy
from graph.constants import OBJECT_NOT_FOUND_ERROR
from graph.chat.tables import (
rooms,
messages,
)
__all__ = [
'select_rooms',
'select_messages_by_room_id',
'se... |
dltools/hooks.py | geodekid/frnn | 299 | 12766622 | """Defines hooks that can run during training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import lasagne
import numpy as np
from sklearn import metrics
class LoggingHook(object):
"""This hook writes information to a log file."""
def __ini... |
sahara-10.0.0/sahara/plugins/edp.py | scottwedge/OpenStack-Stein | 161 | 12766624 | <gh_stars>100-1000
# Copyright (c) 2018 Red Hat, 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 o... |
examples/tensorboard/projector_demo.py | dwolfschlaeger/guildai | 694 | 12766648 | # 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... |
alipay/aop/api/domain/AlipayFincoreComplianceCrossborderMerchantBatchqueryModel.py | antopen/alipay-sdk-python-all | 213 | 12766670 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.BaseCrossborderMerchantInfo import BaseCrossborderMerchantInfo
class AlipayFincoreComplianceCrossborderMerchantBatchqueryModel(object):
... |
plato/datasources/femnist.py | cuiboyuan/plato | 135 | 12766697 | <reponame>cuiboyuan/plato
"""
The Federated EMNIST dataset.
The Federated EMNIST dataset originates from the EMNIST dataset, which contains
817851 images, each of which is a 28x28 greyscale image in 1 out of 62 classes.
The difference between the Federated EMNIST dataset and its original counterpart
is that this datas... |
mmtbx/kinemage/__init__.py | dperl-sol/cctbx_project | 155 | 12766711 | <filename>mmtbx/kinemage/__init__.py
from __future__ import absolute_import, division, print_function
def kin_vec(start_key, start_xyz, end_key, end_xyz, width=None):
start_altloc = start_key[0:1]
if start_altloc == ' ':
start_altloc_txt = ""
else:
start_altloc_txt = " '%s'" % start_altloc.lower()
end_... |
tests/tests_preprocessing/test_datetime_transformer.py | stjordanis/mljar-supervised | 1,882 | 12766723 | <filename>tests/tests_preprocessing/test_datetime_transformer.py
import unittest
import tempfile
import json
import numpy as np
import pandas as pd
from supervised.preprocessing.datetime_transformer import DateTimeTransformer
class DateTimeTransformerTest(unittest.TestCase):
def test_transformer(self):
... |
supersqlite/idxchk.py | plasticity-admin/supersqlite | 687 | 12766731 | #!/usr/bin/python
'''idxchk.py - pretty print indexes used in a query
Ported to Python by <NAME> (<EMAIL>).
Requires pysqlite2, sqlite3 (comes with Python 2.5+) or apsw.
Version 1.01 2008-03-07 Fix to list index method name thanks to <NAME>.
Added sqlite3 support.
Version 1.0 2006-07-18 In... |
somaticseq/utilities/attach_pileupVAF.py | bioinform/somaticseq | 159 | 12766737 | <filename>somaticseq/utilities/attach_pileupVAF.py
#!/usr/bin/env python3
# Supports Insertion/Deletion as well as SNVs
# Last updated: 8/29/2015
import math, argparse, sys, os, gzip
import re
import somaticseq.genomicFileHandler.genomic_file_handlers as genome
import somaticseq.genomicFileHandler.pileup_reader as pil... |
zinnia/urls/comments.py | Boondockers-Welcome/django-blog-zinnia | 1,522 | 12766743 | """Urls for the Zinnia comments"""
from django.conf.urls import url
from zinnia.urls import _
from zinnia.views.comments import CommentSuccess
urlpatterns = [
url(_(r'^success/$'),
CommentSuccess.as_view(),
name='comment_success'),
]
|
lib/python/treadmill/tests/keytabs_test.py | krcooke/treadmill | 133 | 12766775 | """Unit test for keytabs
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import shutil
import tempfile
import unittest
import mock
from treadmill import keytabs
class KeytabsTest(unittest.T... |
tests/flatpages_tests/urls.py | ni-ning/django | 61,676 | 12766781 | <gh_stars>1000+
from django.contrib.flatpages.sitemaps import FlatPageSitemap
from django.contrib.sitemaps import views
from django.urls import include, path
urlpatterns = [
path(
'flatpages/sitemap.xml', views.sitemap,
{'sitemaps': {'flatpages': FlatPageSitemap}},
name='django.contrib.site... |
examples/plugin_example/plugin.py | pfnet/pysen | 423 | 12766818 | import dataclasses
import pathlib
import subprocess
from typing import DefaultDict, List, Sequence
import dacite
from pysen.command import CommandBase
from pysen.component import ComponentBase, RunOptions
from pysen.path import change_dir
from pysen.plugin import PluginBase
from pysen.pyproject_model import Config, P... |
xc/common/libraries/generate_verilog.py | bl0x/symbiflow-arch-defs | 183 | 12766855 | """Transforms the XML module definitions parsed from the PDF into a verilog representation"""
from lxml import etree
from datetime import datetime
def format_port(name, width, type, **kwargs):
wstr = '' if int(width) == 1 else '[%s:0]\t' % width
return '\t%s\t%s%s;\n' % (type, wstr, name)
def format_attrib(... |
dataloader.py | husnejahan/DeepAR-Pytorch | 213 | 12766862 | <gh_stars>100-1000
from __future__ import division
import numpy as np
import torch
import os
import logging
from torch.utils.data import DataLoader, Dataset, Sampler
logger = logging.getLogger('DeepAR.Data')
class TrainDataset(Dataset):
def __init__(self, data_path, data_name, num_class):
self.data = np.l... |
functions/process_data.py | donglinwu6066/SDEdit | 330 | 12766898 | import torch
import os
def download_process_data(path="colab_demo"):
os.makedirs(path, exist_ok=True)
print("Downloading data")
torch.hub.download_url_to_file('https://image-editing-test-12345.s3-us-west-2.amazonaws.com/colab_examples/lsun_bedroom1.pth', os.path.join(path, 'lsun_bedroom1.pth'))
torch.... |
src/frequent_phrase_mining/frequent_pattern_mining.py | paperplanet/SegPhrase | 275 | 12766901 | from sets import Set
def frequentPatternMining(tokens, patternOutputFilename, threshold):
dict = {}
tokensNumber = len(tokens)
for i in xrange(tokensNumber):
token = tokens[i]
if token == '$':
continue
if token in dict:
dict[token].append(i)
else:
... |
web/server/codechecker_server/migrations/report/versions/f8291ab1d6be_fix_setting_analysis_info_id_seq.py | ryankurte/codechecker | 1,601 | 12766905 | <filename>web/server/codechecker_server/migrations/report/versions/f8291ab1d6be_fix_setting_analysis_info_id_seq.py<gh_stars>1000+
"""Fix setting analysis_info_id_seq
Revision ID: f8291ab1d6be
Revises: <PASSWORD>
Create Date: 2021-07-15 16:49:05.354455
"""
# revision identifiers, used by Alembic.
revision = 'f8291ab... |
test/test_path.py | afermanian/signatory | 156 | 12766915 | <gh_stars>100-1000
# Copyright 2019 <NAME>. 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... |
CommandRecognition/model.py | c-z-h123/https-github.com-Ryuk17-SpeechAlgorithms | 338 | 12766923 | <reponame>c-z-h123/https-github.com-Ryuk17-SpeechAlgorithms<filename>CommandRecognition/model.py
"""
@FileName: model.py
@Description: Implement model
@Author: Ryuk
@CreateDate: 2020/05/12
@LastEditTime: 2020/05/12
@LastEditors: Please set LastEditors
@Version: v0.1
"""
import torch
import torch.nn as nn
i... |
depth_upsampling/losses/gradient_loss.py | Levintsky/ARKitScenes | 237 | 12766951 | import torch
import dataset_keys
def div_by_mask_sum(loss: torch.Tensor, mask_sum: torch.Tensor):
return loss / torch.max(mask_sum, torch.ones_like(mask_sum))
class SafeTorchLog(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
"""
In the forward pass we receive a Tensor... |
tests/roots/test-epub-anchor-id/conf.py | samdoran/sphinx | 4,973 | 12766984 | <filename>tests/roots/test-epub-anchor-id/conf.py
def setup(app):
app.add_crossref_type(directivename="setting", rolename="setting")
|
dataset/waveform_dataset.py | wimmerb/Wave-U-Net-for-Speech-Enhancement | 166 | 12766989 | import os
import librosa
from torch.utils import data
from util.utils import sample_fixed_length_data_aligned
class Dataset(data.Dataset):
def __init__(self,
dataset,
limit=None,
offset=0,
sample_length=16384,
mod... |
paddlespeech/t2s/audio/codec.py | jerryuhoo/PaddleSpeech | 1,379 | 12767017 | <filename>paddlespeech/t2s/audio/codec.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... |
components/mpas-seaice/testing_and_setup/testcases/square/1D_velocity_hex/plot_method_comparison.py | Fa-Li/E3SM | 235 | 12767027 | <reponame>Fa-Li/E3SM
from netCDF4 import Dataset
import numpy as np
import matplotlib.pyplot as plt
import math
fig, axes = plt.subplots()
subcycleNumber = 7680
operatorMethods = ["wachspress","pwl","weak"]
for operatorMethod in operatorMethods:
# data in
filenameIn = "./output_hex_%s_%i/output.2000.nc" %(... |
doorman/models.py | ESGuardian/doorman-docker | 614 | 12767062 | # -*- coding: utf-8 -*-
import datetime as dt
import string
import uuid
from flask_login import UserMixin
from doorman.database import (
Column,
Table,
ForeignKey,
Index,
Model,
SurrogatePK,
db,
reference_col,
relationship,
ARRAY,
JSONB,
INET,
declared_attr,
)
from ... |
direction_net/pano_utils/transformation.py | DionysisChristopoulos/google-research | 23,901 | 12767093 | <filename>direction_net/pano_utils/transformation.py
# coding=utf-8
# Copyright 2021 The Google Research 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... |
docs/examples/led_board_2.py | NotBobTheBuilder/gpiozero | 743 | 12767106 | from gpiozero import LEDBoard
from signal import pause
leds = LEDBoard(5, 6, 13, 19, 26, pwm=True)
leds.value = (0.2, 0.4, 0.6, 0.8, 1.0)
pause()
|
site/flask/lib/python2.7/site-packages/openid/consumer/__init__.py | theholyhades1/tartanHacks2015 | 5,079 | 12767158 | <reponame>theholyhades1/tartanHacks2015<filename>site/flask/lib/python2.7/site-packages/openid/consumer/__init__.py<gh_stars>1000+
"""
This package contains the portions of the library used only when
implementing an OpenID consumer.
"""
__all__ = ['consumer', 'discover']
|
utils/test_analysis.py | ShenLeixian/data2vis | 103 | 12767209 | import os
import json
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
# t_stat, p_val = stats.ttest_ind(sample1, sample2, equal_var=False)
test_result_dir = "utils/testresults"
all_results = {}
aggregate_terms = [
"count", "valid", "missing", "distinct", "sum", "mean", "average",
... |
safekit/models/tiered_lm.py | duebukua/safekit | 117 | 12767213 | <filename>safekit/models/tiered_lm.py<gh_stars>100-1000
#!/usr/bin/env python
"""
This is a two tiered language model for anomaly detection, where the second tier LSTM (log line level)
takes the concatenation of the average sentence vector and final hidden state
from the lower tier (token level) LSTM as input, creatin... |
app/grandchallenge/reader_studies/templatetags/get_ground_truth.py | njmhendrix/grand-challenge.org | 101 | 12767218 | <filename>app/grandchallenge/reader_studies/templatetags/get_ground_truth.py
from django import template
register = template.Library()
@register.simple_tag
def get_ground_truth(obj, image, question):
"""
Get the ground truth value for the image/question combination in reader
study obj.
"""
ground... |
inference/modulated_detection.py | kylevedder/mvits_for_class_agnostic_od | 114 | 12767231 | import numpy as np
import torch
from PIL import Image
import torchvision.transforms as T
from infer import Inference
from utils.nms import nms
torch.set_grad_enabled(False)
def class_agnostic_nms(boxes, scores, iou=0.5):
if len(boxes) > 1:
boxes, scores = nms(np.array(boxes), np.array(scores), iou)
... |
Calibration/EcalAlCaRecoProducers/python/alcastreamEcalEtaCalib_cff.py | ckamtsikis/cmssw | 852 | 12767235 | import FWCore.ParameterSet.Config as cms
import HLTrigger.HLTfilters.hltHighLevel_cfi
ecaletaCalibHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
# HLTPaths = ['AlCa_EcalEta'],
eventSetupPathsKey='EcalCalEtaCalib',
throw = False
)
|
format.py | my-personal-forks/dart-sublime-bundle | 182 | 12767244 | <gh_stars>100-1000
# Copyright (c) 2014, <NAME>. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
from subprocess import PIPE
from subprocess import Popen
import sublime
import sublime_plugin
from Dart... |
InvenTree/part/migrations/0011_part_revision.py | ArakniD/InvenTree | 656 | 12767274 | # Generated by Django 2.2.2 on 2019-06-20 11:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0010_auto_20190620_2135'),
]
operations = [
migrations.AddField(
model_name='part',
name='revision',
... |
mtgjson5/classes/mtgjson_deck_header.py | 0az/mtgjson | 512 | 12767309 | <gh_stars>100-1000
"""
MTGJSON Singular Deck Header Object
"""
from typing import Any, Dict
from ..classes.mtgjson_deck import MtgjsonDeckObject
from ..utils import to_camel_case
class MtgjsonDeckHeaderObject:
"""
MTGJSON Singular Deck Header Object
"""
code: str
file_name: str
name: str
... |
exercises/bob/example.py | kishankj/python | 1,177 | 12767326 | <gh_stars>1000+
def response(hey_bob):
hey_bob = hey_bob.strip()
if _is_silence(hey_bob):
return 'Fine. Be that way!'
if _is_shouting(hey_bob):
if _is_question(hey_bob):
return "Calm down, I know what I'm doing!"
else:
return 'Whoa, chill out!'
elif _is_q... |
chaos_genius/alerts/utils.py | rsohlot/chaos_genius | 320 | 12767375 | """Common utilities for alerts and alert digests."""
import os
from math import floor, log10
from typing import List, Optional, Union
from jinja2 import Environment, FileSystemLoader, select_autoescape
from chaos_genius.alerts.email import send_static_alert_email
from chaos_genius.core.utils.round import round_numbe... |
recipes/Python/576957_Asynchronous_subprocess_using/recipe-576957.py | tdiprima/code | 2,023 | 12767393 | <gh_stars>1000+
#!/usr/bin/env python
"""asyncsubproc.py: Asynchronous subprocess communication using asyncore.
The `AsyncPopen` class wraps the I/O pipes from `Popen` in asynchronous
dispatchers, providing asynchronous communication with the subprocess using
`asyncore.loop()` to read and write in parallel with other... |
rnns/gru.py | anoidgit/zero | 111 | 12767423 | # coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from func import linear
from rnns import cell as cell
class gru(cell.Cell):
"""The Gated Recurrent Unit."""
def __init__(self, d, ln=False, scope='gru'):
... |
docs_Ismail_Geles/benchmark/utils/format.py | isgeles/SMARTS | 554 | 12767458 | # MIT License
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 th... |
mmskeleton/deprecated/datasets/recognition.py | fserracant/mmskeleton | 1,347 | 12767463 | import os
import numpy as np
import json
import torch
from .utils import skeleton
class SkeletonDataset(torch.utils.data.Dataset):
""" Feeder for skeleton-based action recognition
Arguments:
data_path: the path to data folder
random_choose: If true, randomly choose a portion of the input seque... |
rastervision_pytorch_learner/rastervision/pytorch_learner/learner_pipeline.py | theoway/raster-vision | 1,577 | 12767466 | from rastervision.pipeline.pipeline import Pipeline
from rastervision.pytorch_learner import LearnerConfig
class LearnerPipeline(Pipeline):
"""Simple Pipeline that is a wrapper around Learner.main()
This supports the ability to use the pytorch_learner package to train models using
the RV pipeline package... |
python/fate_arch/common/__init__.py | QuantumA/FATE | 715 | 12767470 | <filename>python/fate_arch/common/__init__.py
from fate_arch.common._types import FederatedMode, FederatedCommunicationType, EngineType, CoordinationProxyService, \
CoordinationCommunicationProtocol
from fate_arch.common._types import BaseType, Party, DTable
|
us/tests/test_us.py | Juh10/python-us | 346 | 12767473 | <reponame>Juh10/python-us<filename>us/tests/test_us.py
from itertools import chain
import jellyfish # type: ignore
import pytest # type: ignore
import pytz
import us
# attribute
def test_attribute():
for state in us.STATES_AND_TERRITORIES:
assert state == getattr(us.states, state.abbr)
def test_va... |
ciphey/basemods/Decoders/base64_url.py | AlexandruValeanu/Ciphey | 9,908 | 12767490 | import base64
from typing import Dict, Optional
from ciphey.iface import Config, Decoder, ParamSpec, T, U, registry
@registry.register
class Base64_url(Decoder[str]):
def decode(self, ctext: T) -> Optional[U]:
"""
Performs Base64 URL decoding
"""
ctext_padding = ctext + "=" * (4 -... |
bayesiancoresets/coreset/__init__.py | trevorcampbell/hilbert-coresets | 118 | 12767529 | from .hilbert import HilbertCoreset
from .sampling import UniformSamplingCoreset
from .sparsevi import SparseVICoreset
from .bpsvi import BatchPSVICoreset
|
tests/conftest.py | amagge/flair | 3,957 | 12767539 | import pytest
from pathlib import Path
@pytest.fixture(scope="module")
def resources_path():
return Path(__file__).parent / "resources"
@pytest.fixture(scope="module")
def tasks_base_path(resources_path):
return resources_path / "tasks"
@pytest.fixture(scope="module")
def results_base_path(resources_path)... |
torchcde/__init__.py | jb-c/torchcde | 247 | 12767550 | <reponame>jb-c/torchcde
from .interpolation_base import InterpolationBase
from .interpolation_cubic import natural_cubic_spline_coeffs, natural_cubic_coeffs, CubicSpline
from .interpolation_linear import linear_interpolation_coeffs, LinearInterpolation
from .interpolation_hermite_cubic_bdiff import hermite_cubic_coeffi... |
dtech_instagram/InstagramAPI/src/http/Response/LoginResponse.py | hideki-saito/InstagramAPP_Flask | 126 | 12767567 | <gh_stars>100-1000
from .Response import Response
class LoginResponse(Response):
def __init__(self, response):
self.username = None
self.has_anonymous_profile_picture = None
self.profile_pic_url = None
self.profile_pic_id = None
self.full_name = None
self.pk = None... |
pypykatz/commons/winapi/constants.py | wisdark/pypykatz | 1,861 | 12767608 | #!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
PROCESS_QUERY_INFORMATION = 0x0400
PROCESS_VM_READ = 0x0010
PROCESS_VM_WRITE = 0x0020
PROCESS_VM_OPERATION = 0x0008
PROCESS_CREATE_THREAD = 0x0002
# Standard access rights
DELETE = 0x00010000
READ_CONTROL = 0x00020... |
tensorflow_graphics/projects/cvxnet/train.py | Liang813/graphics | 2,759 | 12767670 | # Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
scripts/isqrt.py | Marlon-Lazo-Coronado/tiny-bignum-c | 331 | 12767678 | <reponame>Marlon-Lazo-Coronado/tiny-bignum-c
#isqrt.py
import math
def isqrt(n):
if n == 0: return 0
high = n
low = 0
calcMid = lambda: (high - low) / 2 + low + 1
mid = calcMid()
while high > low:
sq = mid**2
if sq > n:
high = mid - 1
else:
low = mid
mid = calcMid()
return low
if __name__ == "__... |
utils/wfuzzbasicauthbrute/wfuzz/plugins/scripts/robots.py | ismailbozkurt/kubebot | 171 | 12767703 | <reponame>ismailbozkurt/kubebot
import re
from urlparse import urlparse, urljoin
from framework.plugins.api import DiscoveryPlugin
from framework.plugins.api import url_filename
from externals.moduleman.plugin import moduleman_plugin
@moduleman_plugin
class robots(DiscoveryPlugin):
name = "robots"
descriptio... |
ps2000Examples/streaming_mode/streaming_mode_gathering.py | LauritzRaisch/picosdk-python-wrappers | 114 | 12767754 | from time import time_ns
from ctypes import POINTER, c_int16, c_uint32
import matplotlib.pyplot as plt
import numpy as np
from picosdk.ps2000 import ps2000
from picosdk.functions import assert_pico2000_ok
from picosdk.ctypes_wrapper import C_CALLBACK_FUNCTION_FACTORY
from enum import IntEnum
class Channel(IntEnum)... |
tests/test_history.py | l1kw1d/stashboard | 761 | 12767755 | <filename>tests/test_history.py
from datetime import datetime
from datetime import date
from datetime import timedelta
from base import TestbedTest
from models import Event
from models import Service
from models import Status
class HistoryTest(TestbedTest):
def setUp(self):
super(HistoryTest, self).setUp(... |
src/detext/layers/multi_layer_perceptron.py | StarWang/detext | 1,229 | 12767777 | <gh_stars>1000+
from typing import List
import tensorflow as tf
class MultiLayerPerceptron(tf.keras.layers.Layer):
""" A multi layer perceptron """
def __init__(self, num_hidden: List[int], activations: List, prefix: str = ''):
""" Initializes the layer
:param num_hidden: list of hidden lay... |
python3/pracmln/utils/latexmath2png.py | seba90/pracmln | 123 | 12767802 | #!/usr/bin/python2.5
# Until Python 2.6
from dnutils import logs
from pracmln.utils import locs
"""
Converts LaTeX math to png images.
Run latexmath2png.py --help for usage instructions.
"""
"""
Author:
<NAME> <<EMAIL>>
URL: http://www.kamilkisiel.net
Revision History:
2007/04/20 - Initial version
T... |
lib/python2.7/site-packages/samba/tests/common.py | abankalarm/pth-toolkit | 480 | 12767846 | <filename>lib/python2.7/site-packages/samba/tests/common.py
# Unix SMB/CIFS implementation. Tests for common.py routines
# Copyright (C) <NAME> 2011
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundat... |
zoomus/components/live_stream.py | seantibor/zoomus | 178 | 12767860 | from __future__ import absolute_import
from zoomus import util
from zoomus.components import base
class LiveStreamComponentV2(base.BaseComponent):
def update(self, **kwargs):
"""
Use this API to update the meeting's stream information.
Expects:
- meeting_id: int
- stream_u... |
tests/test_contrib_debug_toolbar_flask.py | proofit404/userstories | 187 | 12767866 | <gh_stars>100-1000
import pytest
@pytest.mark.xfail
def test_contrib_is_available():
from stories.contrib.debug_toolbars.flask import StoriesPanel # noqa: F401
|
titus/test/producer/testCart.py | jmilleralpine/hadrian | 127 | 12767871 | #!/usr/bin/env python
# Copyright (C) 2014 Open Data ("Open Data" refers to
# one or more of the following companies: Open Data Partners LLC,
# Open Data Research LLC, or Open Data Capital LLC.)
#
# This file is part of Hadrian.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... |
lightreid/models/backbones/__init__.py | nataliamiccini/light-reid | 296 | 12767883 | <gh_stars>100-1000
from .resnet import resnet18, resnet34, resnet50, resnet101, resnet152
from .resnet import resnet18ibna, resnet34ibna, resnet50ibna, resnet101ibna, resnet152ibna
from .transformers import *
__cnnbackbone_factory = {
# resnet series
'resnet18': resnet18,
'resnet34': resnet34,
'resnet5... |
lib/blackboxprotobuf/lib/protofile.py | nccgroup/blackboxprotobuf | 261 | 12767899 | """
Python methods for importing and exporting '.proto' files from the BBP type
definition format.
"""
# TODO get custom exceptions for these methods
import io
import re
import logging
from blackboxprotobuf.lib.exceptions import TypedefException
import blackboxprotobuf.lib.api
PROTO_FILE_TYPE_MAP = {
"uint": "ui... |
src/genie/libs/parser/nxos/tests/ShowSpanningTreeDetail/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 12767934 | <filename>src/genie/libs/parser/nxos/tests/ShowSpanningTreeDetail/cli/equal/golden_output_1_expected.py
expected_output = {
'mstp': {
'mst_instances': {
0: {
'mst_id': 0,
'bridge_priority': 32768,
'bridge_sysid': 0,
'bridge_addres... |
hyperglass/cache/base.py | blkmajik/hyperglass | 298 | 12767935 | <reponame>blkmajik/hyperglass<gh_stars>100-1000
"""Base Redis cache handler."""
# Standard Library
import re
import json
from typing import Any, Optional
# Third Party
from pydantic import SecretStr
class BaseCache:
"""Redis cache handler."""
def __init__(
self,
db: int,
host: str =... |
saleor/account/migrations/0059_merge_20220221_1025.py | victor-abz/saleor | 1,392 | 12767937 | <filename>saleor/account/migrations/0059_merge_20220221_1025.py
# Generated by Django 3.2.12 on 2022-02-21 10:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("account", "0057_clear_user_addresses"),
("account", "0058_update_user_search_document"),
... |
sematch/classify.py | dhimmel/sematch | 397 | 12767949 | <gh_stars>100-1000
from gsitk.datasets.datasets import DatasetManager
from nltk.corpus import opinion_lexicon
from collections import Counter
def prepare_lexicon(process=True, dim=250, save=False):
if process:
dm = DatasetManager()
data = dm.prepare_datasets()
nega = set(opinion_lexicon.ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.