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 |
|---|---|---|---|---|
module_utils/oracle/oci_wait_utils.py | slmjy/oci-ansible-modules | 106 | 89145 | <filename>module_utils/oracle/oci_wait_utils.py
# Copyright (c) 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0... |
examples/project_path.py | qualichat/questionary | 851 | 89148 | import questionary
if __name__ == "__main__":
path = questionary.path("Path to the projects version file").ask()
if path:
print(f"Found version file at {path} 🦄")
else:
print("No version file it is then!")
|
pandashells/bin/p_cdf.py | timgates42/pandashells | 878 | 89163 | <filename>pandashells/bin/p_cdf.py
#! /usr/bin/env python
# standard library imports
import argparse
import textwrap
import warnings
import sys # NOQA need this for mock testig
from pandashells.lib import module_checker_lib
# import required dependencies
module_checker_lib.check_for_modules([
'pandas',
'n... |
tempest/tests/lib/services/volume/v3/test_quotas_client.py | rishabh20111990/tempest | 254 | 89179 | <reponame>rishabh20111990/tempest
# Copyright 2016 NEC Corporation. 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
#
... |
intro/language/demo.py | junghun73/Learning | 419 | 89212 | "A demo module."
def print_b():
"Prints b."
print 'b'
def print_a():
"Prints a."
print 'a'
c = 2
d = 2
|
src/pandas_profiling/report/presentation/flavours/widget/variable.py | abhicantdraw/pandas-profiling | 8,107 | 89251 | from ipywidgets import widgets
from pandas_profiling.report.presentation.core import Variable
class WidgetVariable(Variable):
def render(self) -> widgets.VBox:
items = [self.content["top"].render()]
if self.content["bottom"] is not None:
items.append(self.content["bottom"].render())
... |
Contents/Code/support/scheduler.py | jippo015/Sub-Zero.bundle | 1,553 | 89261 | # coding=utf-8
import datetime
import logging
import traceback
from config import config
def parse_frequency(s):
if s == "never" or s is None:
return None, None
kind, num, unit = s.split()
return int(num), unit
class DefaultScheduler(object):
queue_thread = None
scheduler_thread = None
... |
tests/test_pdp_isolate.py | antwhite/PDPbox | 675 | 89277 | import pytest
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from pandas.testing import assert_frame_equal
import pandas as pd
import matplotlib
from pdpbox.pdp import pdp_isolate, pdp_plot
class TestPDPIsolateBinary(object):
def test_pdp_isolate_binary_feature(
... |
brainiak/matnormal/mnrsa.py | osaaso3/brainiak | 235 | 89302 | <reponame>osaaso3/brainiak
import tensorflow as tf
from sklearn.base import BaseEstimator
from sklearn.linear_model import LinearRegression
from .covs import CovIdentity
from brainiak.utils.utils import cov2corr
import numpy as np
from brainiak.matnormal.matnormal_likelihoods import matnorm_logp_marginal_row
from brain... |
python/fate_arch/federation/pulsar/__init__.py | hubert-he/FATE | 3,787 | 89306 | <reponame>hubert-he/FATE
from fate_arch.federation.pulsar._federation import Federation, MQ, PulsarManager
__all__ = ['Federation', 'MQ', 'PulsarManager']
|
guillotina/json/serialize_content.py | rboixaderg/guillotina | 173 | 89310 | <filename>guillotina/json/serialize_content.py
# -*- coding: utf-8 -*-
from guillotina import app_settings
from guillotina import configure
from guillotina.component import ComponentLookupError
from guillotina.component import get_multi_adapter
from guillotina.component import query_utility
from guillotina.content impo... |
configs/__init__.py | mutalisk999/bibi | 1,037 | 89323 | <filename>configs/__init__.py
# -*- coding: utf-8 -*-
from .config import BaseConfig, DevConfig, TestConfig, get_config
|
rasa/nlu/featurizers/sparse_featurizer/sparse_featurizer.py | fintzd/rasa | 9,701 | 89326 | from abc import ABC
import scipy.sparse
from rasa.nlu.featurizers.featurizer import Featurizer
class SparseFeaturizer(Featurizer[scipy.sparse.spmatrix], ABC):
"""Base class for all sparse featurizers."""
pass
|
vit/formatter/status_long.py | kinifwyne/vit | 179 | 89345 | <reponame>kinifwyne/vit<gh_stars>100-1000
from vit.formatter.status import Status
class StatusLong(Status):
pass
|
nntts/utils/plotting.py | entn-at/efficient_tts | 111 | 89396 | <gh_stars>100-1000
import matplotlib
matplotlib.use("Agg")
import matplotlib.pylab as plt
import os
import logging
def plots(imvs, alphas, mel_preds, mel_gts, step, out_dir, num_plots=4):
output_dir = f"{out_dir}/images/"
os.makedirs(output_dir, exist_ok=True)
imvs = imvs.detach().cpu().numpy()
alpha... |
unsupervisedRR/models/model.py | Sebastian-Jung/unsupervisedRR | 105 | 89426 | <gh_stars>100-1000
import torch
from torch import nn as nn
from ..utils.transformations import transform_points_Rt
from .alignment import align
from .backbones import ResNetDecoder, ResNetEncoder
from .correspondence import get_correspondences
from .model_util import get_grid, grid_to_pointcloud, points_to_ndc
from .r... |
image_classification/token_labeling/tlt/models/lvvit.py | AK391/UniFormer | 367 | 89498 | <reponame>AK391/UniFormer<filename>image_classification/token_labeling/tlt/models/lvvit.py
import torch
import torch.nn as nn
from timm.models.helpers import load_pretrained
from timm.models.registry import register_model
from timm.models.layers import trunc_normal_
from timm.models.resnet import resnet26d, resnet50d,... |
portia_server/portia_dashboard/views.py | rmdes/portia-dashboard | 223 | 89538 | from django.conf import settings
from portia_api.jsonapi import JSONResponse
from portia_api.jsonapi.renderers import JSONRenderer
from .models import (Job, Log, Schedule,JobItem)
import time, datetime
import requests
from storage import (get_storage_class,create_project_storage)
from portia_orm.models import Projec... |
pyrgg/test.py | sepandhaghighi/pyggen | 164 | 89552 | <filename>pyrgg/test.py
# -*- coding: utf-8 -*-
"""Test file."""
"""
>>> from pyrgg import *
>>> import pyrgg.params
>>> import random
>>> import os
>>> import json
>>> import yaml
>>> import pickle
>>> pyrgg.params.PYRGG_TEST_MODE = True
>>> get_precision(2)
0
>>> get_precision(2.2)
1
>>> get_precision(2.22)
2
>>> get... |
share/tools/ubi_reader/ubi/defines.py | zengzhen1994k/leonsioy | 143 | 89553 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################
# Adapted in part from linux-source-3.2/drivers/mtd/ubi/ubi-media.h
# for use in Python.
# Oct. 2013 by <NAME>
#
# Original copyright notice.
# --------------------------
#
# Copyright (c) International Business ... |
tests/test_schema_editor_partitioning.py | adamchainz/django-postgres-extra | 529 | 89574 | import pytest
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, models
from psqlextra.backend.schema import PostgresSchemaEditor
from psqlextra.types import PostgresPartitioningMethod
from . import db_introspection
from .fake_model import define_fake_partitioned_model
def te... |
test/test_index.py | Scartography/mapchete | 161 | 89581 | import fiona
import numpy as np
import os
import pytest
import rasterio
import mapchete
from mapchete.index import zoom_index_gen
from mapchete.io import get_boto3_bucket
@pytest.mark.remote
def test_remote_indexes(mp_s3_tmpdir, gtiff_s3):
zoom = 7
gtiff_s3.dict.update(zoom_levels=zoom)
def gen_indexes... |
vscode/utils.py | TTitcombe/vscode-ext | 140 | 89588 | <gh_stars>100-1000
from typing import Optional
__all__ = (
"log",
"camel_case_to_snake_case",
"snake_case_to_camel_case",
"snake_case_to_title_case",
"python_condition_to_js_condition",
)
def log(*args, **kwargs):
kwargs["flush"] = True
print(*args, **kwargs)
def camel_c... |
model-optimizer/extensions/front/mxnet/squeeze_ext.py | monroid/openvino | 2,406 | 89638 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from mo.front.extractor import FrontExtractorOp
from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from mo.ops.squeeze import Squeeze
class SqueezeExtractor(FrontExtractorOp):
op = 'squeeze'
enabled = True
@... |
recipes/Python/161816_Enable_xmlrpclib_maintaJSP/recipe-161816.py | tdiprima/code | 2,023 | 89657 | """A little Transport layer to maintain the JSESSIONID cookie that
Javaserver pages use to maintain a session. I'd like to use this
to make xmlrpclib session aware.
Sample usage:
server = Server("http://foobar.com/baz/servlet/xmlrpc.class")
print server.get_jsession_id();
print server.test.sayHello()
... |
tests/fakes/component.py | linshoK/pysen | 423 | 89686 | import enum
import pathlib
from typing import DefaultDict, Dict, List, Optional, Sequence, Tuple
from pysen import ComponentBase
from pysen.command import CommandBase
from pysen.diagnostic import Diagnostic
from pysen.reporter import Reporter
from pysen.runner_options import PathContext, RunOptions
from pysen.setting ... |
utils/torch_utils.py | Wassouli/projet-prat-oceano | 196 | 89751 | <gh_stars>100-1000
import torch
import shutil
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import numbers
import random
import math
from torch.optim import Optimizer
def init_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.se... |
tests/api/test_api.py | ludeeus/HARM | 456 | 89777 | import os
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.websocket import (
acknowledge_critical_repository,
get_critical_repositories,
hacs_config,
hacs_removed,
hacs_repositories,
hacs_repository,
hacs_repository_data,
hacs_settings,
hacs_s... |
mayan/apps/document_parsing/tests/test_parsers.py | eshbeata/open-paperless | 2,743 | 89799 | <filename>mayan/apps/document_parsing/tests/test_parsers.py
from __future__ import unicode_literals
from django.core.files.base import File
from django.test import override_settings
from common.tests import BaseTestCase
from documents.models import DocumentType
from documents.tests import TEST_DOCUMENT_PATH, TEST_DOC... |
stackimpact/profilers/allocation_profiler.py | timgates42/stackimpact-python | 742 | 89803 | <gh_stars>100-1000
from __future__ import division
import sys
import time
import re
import threading
from ..runtime import min_version, runtime_info, read_vm_size
from ..utils import timestamp
from ..metric import Metric
from ..metric import Breakdown
if min_version(3, 4):
import tracemalloc
class AllocationPr... |
conrad/cli.py | vinayak-mehta/conrad | 244 | 89816 | # -*- coding: utf-8 -*-
import os
import re
import sys
import json
import shutil
import hashlib
import inspect
import datetime as dt
import click
import requests
import sqlalchemy
import textdistance
from rich.table import Table
from rich.console import Console
try:
import bs4
import git
import pandas
... |
load_MNIST.py | kaixinhuaihuai/ufldl_tutorial | 595 | 89822 | <filename>load_MNIST.py
import numpy as np
def load_MNIST_images(filename):
"""
returns a 28x28x[number of MNIST images] matrix containing
the raw MNIST images
:param filename: input data file
"""
with open(filename, "r") as f:
magic = np.fromfile(f, dtype=np.dtype('>i4'), count=1)
... |
tests/components/spc/__init__.py | domwillcode/home-assistant | 30,023 | 89832 | """Tests for the spc component."""
|
tests/test_configuration.py | TurboGears/tg2 | 812 | 89833 | <gh_stars>100-1000
"""
Testing for TG2 Configuration
"""
from nose import SkipTest
from nose.tools import eq_, raises
import sys, os
from datetime import datetime
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from sqlalchemy.engine import Engine
from ming import Session
from ming.orm... |
sky/legacy/scraper.py | Asteur/sky_python_crawler | 325 | 89848 | <filename>sky/legacy/scraper.py
from training import *
from findLeaf import *
import re
from lxml.html import fromstring
from lxml.html import tostring
def stripReasonableWhite(x):
return re.sub(r"\s+", " ", x).strip()
def splitN(txt, outcome):
# consider splitting to get result
txt = stripReasonableW... |
examples/geojson.py | Yook74/dash-extensions | 250 | 89854 | <gh_stars>100-1000
import dash
import dash_html_components as html
import json
import dash_leaflet as dl
from examples import geojson_csf
from dash_extensions.transpile import inject_js, module_to_props
# Create geojson.
with open("assets/us-states.json", 'r') as f:
data = json.load(f)
js = module_to_props(geojso... |
examples/magic_app_example.py | Jan-Zeiseweis/pycaw | 234 | 89897 | """
Note
----
'import pycaw.magic' must be generally at the topmost.
To be more specific:
It needs to be imported before any other pycaw or comtypes import.
Reserved Atrributes
-------------------
Note that certain methods and attributes are reserved for the magic module.
Please look into the source code of Magic... |
RecoBTag/PerformanceDB/python/BTagPerformanceDB1012.py | ckamtsikis/cmssw | 852 | 89919 | <filename>RecoBTag/PerformanceDB/python/BTagPerformanceDB1012.py
from RecoBTag.PerformanceDB.measure.Btag_mistag101220 import *
|
guillotina/json/serialize_value.py | rboixaderg/guillotina | 173 | 89936 | <reponame>rboixaderg/guillotina
# -*- coding: utf-8 -*-
from datetime import date
from datetime import datetime
from datetime import time
from datetime import timedelta
from decimal import Decimal
from guillotina import configure
from guillotina.component import query_adapter
from guillotina.i18n import Message
from gu... |
test/hummingbot/client/config/test_config_security.py | BGTCapital/hummingbot | 3,027 | 89949 | #!/usr/bin/env python
import unittest
from hummingbot.client.config.security import Security
from hummingbot.client import settings
from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.client.config.config_crypt import encrypt_n_save_config_value
import os
import shutil
import async... |
Awesome-face-operations/Face Clustering/Script/constants.py | swapnilgarg7/Face-X | 175 | 89968 | import os
# face_data (directory) represents the path component to be joined.
FACE_DATA_PATH = os.path.join(os.getcwd(),'face_cluster')
ENCODINGS_PATH = os.path.join(os.getcwd(),'encodings.pickle')
CLUSTERING_RESULT_PATH = os.getcwd() |
encoder/esim.py | zhufz/nlp_research | 160 | 89971 | <reponame>zhufz/nlp_research<gh_stars>100-1000
#-*- coding:utf-8 -*-
import keras
import tensorflow as tf
from keras.layers import *
from keras.activations import softmax
from keras.models import Model
from keras.layers.merge import concatenate
from keras.layers.normalization import BatchNormalization
from keras.utils ... |
molotov/tests/test_sharedconsole.py | jldiaz-uniovi/molotov | 401 | 89981 | <reponame>jldiaz-uniovi/molotov<filename>molotov/tests/test_sharedconsole.py
import unittest
import asyncio
import sys
import os
import re
import io
from molotov.util import multiprocessing
from molotov.sharedconsole import SharedConsole
from molotov.tests.support import dedicatedloop, catch_output
OUTPUT = """\
one... |
Linux/etc/decript.py | Dave360-crypto/Oblivion | 339 | 89988 | #!/usr/bin/python
import os
import pathlib
from cryptography.fernet import Fernet
# Global variables/Variáveis globais.
path_atual_dc = str(pathlib.Path(__file__).parent.absolute())
path_dc_final = path_atual_dc.replace('/etc','')
def decript_file(arquivo, chave=None):
"""
Decrypt a file/Desencriptografa ... |
venv/lib/python3.9/site-packages/pendulum/parser.py | qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3 | 224 | 90036 | # -*- coding: utf-8 -*-
from __future__ import division
from .parsing import Parser as BaseParser
from .tz import UTC
from .pendulum import Pendulum
from .date import Date
from .time import Time
from ._global import Global
class Parser(BaseParser):
"""
Parser that returns known types (Pendulum, Date, Time)
... |
source/python-vsmclient/vsmclient/v1/mdses.py | ramkrsna/virtual-storage-manager | 172 | 90071 | # Copyright 2014 Intel Corporation, 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 require... |
src/job-exporter/test/test_amd.py | luxius-luminus/pai | 1,417 | 90103 | <reponame>luxius-luminus/pai
import os
import sys
import unittest
sys.path.append(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "../src"))
import amd
PACKAGE_DIRECTORY_COM = os.path.dirname(os.path.abspath(__file__))
class TestAmd(unittest.TestCase):
def setUp(self):
try:
os.c... |
chariot/resource/data_file.py | Y-Kuro-u/chariot | 134 | 90108 | <reponame>Y-Kuro-u/chariot
import os
import mmap
from chariot.util import xtqdm
class DataFile():
def __init__(self, path, encoding="utf-8"):
self.path = path
self.encoding = encoding
file_name = os.path.basename(path)
base_name, ext = os.path.splitext(file_name)
self.base... |
ipysheet/easy.py | kdop-dev/ipysheet | 495 | 90132 | """Easy context-based interface for generating a sheet and cells.
Comparable to matplotlib pylab interface, this interface keeps track of the current
sheet. Using the ``cell`` function, ``Cell`` widgets are added to the current sheet.
"""
__all__ = ['sheet', 'current', 'cell', 'calculation', 'row', 'column', 'cell_ran... |
Lib/fontbakery/profiles/hhea.py | paullinnerud/fontbakery | 351 | 90138 | <filename>Lib/fontbakery/profiles/hhea.py
from fontbakery.callable import check
from fontbakery.status import FAIL, PASS, SKIP, WARN
from fontbakery.message import Message
# used to inform get_module_profile whether and how to create a profile
from fontbakery.fonts_profile import profile_factory # NOQA pylint: disable=... |
models/losses.py | wanghaisheng/LiveSpeechPortraits | 375 | 90139 | import torch
import torch.nn as nn
from torch.autograd import Variable
import math
import torch.nn.functional as F
class GMMLogLoss(nn.Module):
''' compute the GMM loss between model output and the groundtruth data.
Args:
ncenter: numbers of gaussian distribution
ndim: dimension of ... |
cloudtunes-server/cloudtunes/handlers.py | skymemoryGit/cloudtunes | 529 | 90146 | from tornado.web import StaticFileHandler
from cloudtunes import settings
from cloudtunes.base.handlers import BaseHandler
class MainHandler(BaseHandler):
def get(self):
webapp_dir = self.settings['static_path']
homepage_dir = settings.HOMEPAGE_SITE_DIR
if self.current_user:
... |
extrafiles/tooling/ValidateYAML.py | angriman/network | 366 | 90147 | <gh_stars>100-1000
#!/usr/bin/env python3
"""
This tool validates NetworKit YAML configuration files.
"""
import nktooling as nkt
import os
import yaml
nkt.setup()
os.chdir(nkt.getNetworKitRoot())
for configFile in [".clang-format", ".clang-tidy", "CITATION.cff"]:
try:
with open(configFile, "r") as f:
... |
tests/test_zenbelly.py | mathiazom/recipe-scrapers | 811 | 90160 | <filename>tests/test_zenbelly.py
from recipe_scrapers.zenbelly import ZenBelly
from tests import ScraperTest
class TestZenBellyScraper(ScraperTest):
scraper_class = ZenBelly
def test_host(self):
self.assertEqual("zenbelly.com", self.harvester_class.host())
def test_canonical_url(self):
... |
streaming/python/runtime/remote_call.py | firebolt55439/ray | 21,382 | 90177 | import logging
import os
import ray
import time
from enum import Enum
from ray.actor import ActorHandle
from ray.streaming.generated import remote_call_pb2
from ray.streaming.runtime.command\
import WorkerCommitReport, WorkerRollbackRequest
logger = logging.getLogger(__name__)
class CallResult:
"""
Call... |
nsot/management/commands/start.py | comerford/nsot | 387 | 90207 | <reponame>comerford/nsot
from __future__ import absolute_import, print_function
"""
Command to start the NSoT server process.
"""
from django.conf import settings
from django.core.management import call_command
import sys
from nsot.services import http
from nsot.util.commands import NsotCommand, CommandError
class... |
examples/account_media.py | smaeda-ks/twitter-python-ads-sdk | 162 | 90216 | <reponame>smaeda-ks/twitter-python-ads-sdk
# Copyright (C) 2015-2016 Twitter, Inc.
# Note: All account_media/media_creatives must be uploaded via the media-upload endpoints
# See: https://dev.twitter.com/rest/media/uploading-media
from twitter_ads.client import Client
from twitter_ads.http import Request
from twitter_... |
ansible/roles/lib_git/build/src/git_rebase.py | fahlmant/openshift-tools | 164 | 90223 | <filename>ansible/roles/lib_git/build/src/git_rebase.py
# pylint: skip-file
class GitRebase(GitCLI):
''' Class to wrap the git merge line tools
'''
# pylint: disable=too-many-arguments
def __init__(self,
path,
branch,
rebase_branch,
ss... |
venv/lib/python3.7/site-packages/allauth/socialaccount/providers/angellist/urls.py | vikram0207/django-rest | 6,342 | 90234 | <gh_stars>1000+
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import AngelListProvider
urlpatterns = default_urlpatterns(AngelListProvider)
|
text/symbols.py | highmaru-public/multi-speaker-tacotron-tensorflow | 183 | 90246 | '''
Defines the set of symbols used in text input to the model.
The default is a set of ASCII characters that works well for English or text that has been run
through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details.
'''
from jamo import h2j, j2h
from jamo.jamo import _jamo_char_... |
photon__crawler_spider__examples/main.py | DazEB2/SimplePyScripts | 117 | 90257 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/s0md3v/Photon/wiki/Photon-Library
# pip install photon
import photon
photon.crawl('https://github.com/s0md3v/Photon/wiki/Photon-Library')
result = photon.result()
print(result)
with open('result.json', 'w', encoding=... |
twistedcaldav/test/test_database.py | backwardn/ccs-calendarserver | 462 | 90270 | ##
# Copyright (c) 2009-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
RecoEcal/EgammaClusterProducers/python/multi5x5SuperClustersWithPreshower_cfi.py | ckamtsikis/cmssw | 852 | 90392 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# Preshower cluster producer
multi5x5SuperClustersWithPreshower = cms.EDProducer("PreshowerPhiClusterProducer",
esStripEnergyCut = cms.double(0.0),
esPhiC... |
plugins/quetz_runexports/quetz_runexports/api.py | maresb/quetz | 108 | 90409 | <gh_stars>100-1000
import json
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm.session import Session
from quetz.db_models import PackageVersion
from quetz.deps import get_db
router = APIRouter()
@router.get(
"/api/channels/{channel_name}/packages/{package_name}/versions/"
... |
navec/train/quantiles.py | FreedomSlow/navec | 115 | 90410 |
SHARES = [
0.5, 0.6, 0.7, 0.8, 0.9,
0.91, 0.92, 0.93, 0.94,
0.95, 0.96, 0.97, 0.98,
0.99, 1.0
]
def pop(items):
return items[0], items[1:]
def get_quantiles(records, shares=SHARES):
if not shares:
return
counts = [count for _, count in records]
total = sum(counts)
acc... |
python_modules/libraries/dagstermill/dagstermill_tests/test_serialization.py | dbatten5/dagster | 4,606 | 90412 | import pytest
from dagster import Any, String, usable_as_dagster_type
from dagster.check import CheckError
from dagster.core.types.dagster_type import resolve_dagster_type
from dagster.utils import safe_tempfile_path
from dagstermill.serialize import read_value, write_value
def test_scalar():
with safe_tempfile_p... |
output/python37/Lib/idlelib/idle_test/test_outwin.py | cy15196/FastCAE | 117 | 90477 | """ Test idlelib.outwin.
"""
import unittest
from tkinter import Tk, Text
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.idle_test.mock_idle import Func
from idlelib import outwin
from test.support import requires
from unittest import mock
class OutputWindowTest(unittest.TestCase):
@... |
gpymusic/view.py | academo/gpymusic | 136 | 90510 | class View(dict):
"""A View contains the content displayed in the main window."""
def __init__(self, d=None):
"""
View constructor.
Keyword arguments:
d=None: Initial keys and values to initialize the view with.
Regardless of the value of d, keys 'songs', 'artists' an... |
asyncpg/protocol/__init__.py | baltitenger/asyncpg | 5,714 | 90563 | <gh_stars>1000+
# Copyright (C) 2016-present the asyncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
# flake8: NOQA
from .protocol import Protocol, Record, NO_TIMEOUT, BUILTIN_TYPE_NAME_MAP
|
jmilkfansblog/controllers/v1/__init__.py | xiaoyh121/program | 176 | 90605 | <gh_stars>100-1000
from pecan import rest
from wsme import types as wtypes
from jmilkfansblog.api.expose import expose as wsexpose
from jmilkfansblog.controllers.v1 import users
from jmilkfansblog.controllers.v1 import posts
class V1(wtypes.Base):
id = wtypes.text
"""The ID of the version, also acts as the r... |
Chapter 09/seq2seq_translation.py | bharlow058/Packt-TF-cook-book | 587 | 90642 | # -*- coding: utf-8 -*-
#
# Creating Sequence to Sequence Models
#-------------------------------------
# Here we show how to implement sequence to sequence models.
# Specifically, we will build an English to German translation model.
#
import os
import re
import string
import requests
import io
import numpy as np
i... |
cumulusci/tasks/robotframework/debugger/DebugListener.py | davisagli/CumulusCI | 163 | 90682 | """
Robot Debugger
"""
from cumulusci.tasks.robotframework.debugger import (
Breakpoint,
DebuggerCli,
Keyword,
Suite,
Testcase,
)
class DebugListener(object):
"""A robot framework listener for debugging test cases
This acts as the controller for the debugger. It is responsible
for m... |
webwaybooks/tests/utils/test_log.py | bysorry/telegram_media_downloader | 401 | 90708 | <filename>webwaybooks/tests/utils/test_log.py
"""Unittest module for log handlers."""
import os
import sys
import unittest
import mock
sys.path.append("..") # Adds higher directory to python modules path.
from utils.log import LogFilter
class MockLog:
"""
Mock logs.
"""
def __init__(self, **kwargs... |
.modules/.recon-ng/modules/recon/domains-credentials/pwnedlist/domain_creds.py | termux-one/EasY_HaCk | 1,103 | 90715 | from recon.core.module import BaseModule
from recon.utils.crypto import aes_decrypt
class Module(BaseModule):
meta = {
'name': 'PwnedList - Pwned Domain Credentials Fetcher',
'author': '<NAME> (@LaNMaSteR53)',
'description': 'Queries the PwnedList API to fetch all credentials for a domain.... |
components/isceobj/RtcProc/runVerifyDEM.py | vincentschut/isce2 | 1,133 | 90716 | #
# Author: <NAME>
# Copyright 2016
#
import logging
import isceobj
import mroipac
import os
import numpy as np
from isceobj.Util.decorators import use_api
logger = logging.getLogger('isce.insar.VerifyDEM')
def runVerifyDEM(self):
'''
Make sure that a DEM is available for processing the given data.
'''
... |
Configuration/Generator/python/SingleTaupt_50_cfi.py | ckamtsikis/cmssw | 852 | 90730 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
generator = cms.EDProducer("Pythia6PtGun",
PGunParameters = cms.PSet(
ParticleID = cms.vint32(-15),
AddAntiParticle = cms.bool(False),
MinPhi = cms.double(-3.14159265359),
MaxPhi = cms.double(3.14159265359),
MinPt =... |
api/urls.py | siarheipuhach/tutorialdb | 109 | 90745 | <gh_stars>100-1000
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='api-home'),
path('tutorials/', views.tutorials),
path('tutorials/<str:tags>/', views.tutorial_tag),
path('tutorials/<str:tags>/<str:category>/', views.tutorial_tag_category),
path('tags/'... |
scripts/artifacts/smanagerCrash.py | deagler4n6/ALEAPP | 187 | 90751 | <filename>scripts/artifacts/smanagerCrash.py
import sqlite3
import textwrap
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, open_sqlite_db_readonly
def get_smanagerCrash(files_found, report_folder, seeker, wrap_text):
file_foun... |
fortytwo/s02_reduce_clutter.py | rpharoah/42-workshop | 221 | 90768 | <filename>fortytwo/s02_reduce_clutter.py
"""02: Reduce Clutter
Reduce Clutter by Disabling Tools.
- We are an IDE, but we can also do a lean-and-mean UI
- Hide the Toolbar, Tool Window Bars, Navigation Bar
Repo: https://github.com/pauleveritt/42-workshop
Playlist: https://www.jetbrains.com/pycharm/guide/playlists/4... |
openstackclient/tests/unit/volume/v3/test_volume_group_snapshot.py | mydevice/python-openstackclient | 262 | 90771 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
bitex/formatters/ccex.py | ligggooo/quant2018 | 312 | 90777 | <filename>bitex/formatters/ccex.py
# Import Built-Ins
import logging
# Import Third-Party
# Import Homebrew
from bitex.formatters.base import Formatter
# Init Logging Facilities
log = logging.getLogger(__name__)
class CcexFormatter(Formatter):
@staticmethod
def ticker(data, *args, **kwargs):
retur... |
lib-src/lv2/suil/waflib/extras/softlink_libs.py | joshrose/audacity | 7,892 | 90816 | #! /usr/bin/env python
# per rosengren 2011
from waflib.TaskGen import feature, after_method
from waflib.Task import Task, always_run
from os.path import basename, isabs
from os import tmpfile, linesep
def options(opt):
grp = opt.add_option_group('Softlink Libraries Options')
grp.add_option('--exclude', default='/u... |
tools/go_generics/defs.bzl | Exhorder6/gvisor | 12,536 | 90835 | <reponame>Exhorder6/gvisor<gh_stars>1000+
"""Generics support via go_generics.
A Go template is similar to a go library, except that it has certain types that
can be replaced before usage. For example, one could define a templatized List
struct, whose elements are of type T, then instantiate that template for
T=segmen... |
modules/kobo.py | hwiorn/orger | 241 | 90867 | #!/usr/bin/env python3
from orger import Mirror
from orger.inorganic import node, link, OrgNode
from orger.common import dt_heading
from my.kobo import get_books_with_highlights, Highlight
class KoboView(Mirror):
def get_items(self) -> Mirror.Results:
def render_highlight(h: Highlight) -> OrgNode:
... |
matrix-python-project/archive_tools/auto_split_clip_by_scene/auto_clip.py | hokaso/hocassian-media-matrix | 141 | 90876 | # 在使用前,请通过「pip install scenedetect[opencv,progress_bar,scenedetect]」安装部分所需要的依赖~
from __future__ import print_function
import os
# Standard PySceneDetect imports:
from scenedetect.video_splitter import split_video_ffmpeg
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneMana... |
build_tools/install_cexts.py | MBKayro/kolibri | 545 | 90879 | """
This module defines functions to install c extensions for all the platforms into
Kolibri.
It is required to have pip version greater than 19.3.1 to run this script.
Usage:
> python build_tools/install_cexts.py --file "requirements/cext.txt" --cache-path "/cext_cache"
It reads the package name and version from req... |
tests/2d/numpy/methods.py | oojBuffalo/micropython-ulab | 232 | 90890 | <gh_stars>100-1000
try:
from ulab import numpy as np
except ImportError:
import numpy as np
a = np.array([1, 2, 3, 4], dtype=np.int8)
b = a.copy()
print(b)
a = np.array([[1,2,3],[4,5,6],[7,8,9]], dtype=np.int16)
b = a.copy()
print(b)
a = np.array([[1,2,3],[4,5,6],[7,8,9]], dtype=np.float)
b = a.copy()
print(b)... |
python-sdk/tutorials/automl-with-azureml/forecasting-bike-share/run_forecast.py | 0mza987/azureml-examples | 331 | 90899 | <filename>python-sdk/tutorials/automl-with-azureml/forecasting-bike-share/run_forecast.py
from azureml.core import ScriptRunConfig
def run_rolling_forecast(
test_experiment,
compute_target,
train_run,
test_dataset,
target_column_name,
inference_folder="./forecast",
):
train_run.... |
lang/tags/comment_block.py | quadfather85/knausj_talon | 298 | 90926 | <gh_stars>100-1000
from talon import Context, Module
ctx = Context()
mod = Module()
mod.tag("code_comment_block", desc="Tag for enabling generic block comment commands")
@mod.action_class
class Actions:
def code_comment_block():
"""Block comment"""
def code_comment_block_prefix():
"""Block ... |
tests/test_memdatasource.py | toni-moreno/loudml | 245 | 90930 | <reponame>toni-moreno/loudml
from loudml.misc import (
nan_to_none,
)
from loudml.donut import DonutModel
import logging
import unittest
from loudml.membucket import MemBucket
logging.getLogger('tensorflow').disabled = True
FEATURES = [
{
'name': 'avg_foo',
'metric': 'avg',
'field': ... |
input_pipeline.py | zmskye/unsupervised_captioning | 229 | 90940 | <filename>input_pipeline.py
import tensorflow as tf
from misc_fn import controlled_shuffle
from misc_fn import random_drop
FLAGS = tf.flags.FLAGS
AUTOTUNE = tf.data.experimental.AUTOTUNE
def batching_func(x, batch_size):
"""Forms a batch with dynamic padding."""
return x.padded_batch(
batch_size,
padded... |
release_task_lock.py | bopopescu/redis-ctl | 109 | 90979 | import config
import models.base
from models.task import TaskLock
def main():
app = config.App(config)
with app.app_context():
for lock in models.base.db.session.query(TaskLock).all():
if lock.step is not None:
lock.step.complete('Force release lock')
models.bas... |
lib/tests/py_test/test_protobuf.py | nccgroup/blackboxprotobuf | 261 | 90983 | from hypothesis import given, example, note
import hypothesis.strategies as st
import hypothesis
import strategies
import warnings
import base64
import json
import six
import blackboxprotobuf
warnings.filterwarnings(
"ignore",
"Call to deprecated create function.*",
)
try:
import Test_pb2
except:
im... |
bazel/container_push.bzl | Wyverald/core | 161 | 90985 | <gh_stars>100-1000
load("@io_bazel_rules_docker//container:container.bzl", _container_push = "container_push")
def container_push(*args, **kwargs):
"""Creates a script to push a container image to a Docker registry. The
target name must be specified when invoking the push script."""
if "registry" in kwargs... |
geometric_registration/evaluate.py | HOUYONGKUO/D3Feat | 214 | 90987 | import sys
import open3d
import numpy as np
import time
import os
from geometric_registration.utils import get_pcd, get_keypts, get_desc, loadlog
import cv2
from functools import partial
def build_correspondence(source_desc, target_desc):
"""
Find the mutually closest point pairs in feature space.
source ... |
pyorient/messages/base.py | mogui/pyorient | 138 | 90991 | <filename>pyorient/messages/base.py
__author__ = 'Ostico <<EMAIL>>'
import struct
import sys
from ..exceptions import PyOrientBadMethodCallException, \
PyOrientCommandException, PyOrientNullRecordException
from ..otypes import OrientRecord, OrientRecordLink, OrientNode
from ..hexdump import hexdump
from ..consta... |
Python/cp/staircase_problem.py | zhcet19/NeoAlgo-1 | 897 | 91023 | <filename>Python/cp/staircase_problem.py
"""This program finds the total number of possible combinations that can be used to
climb statirs . EG : for 3 stairs ,combination and output will be 1,1,1 , 1,2 , 2,1 i.e 3 . """
def counting_stairs(stair_number):
result = stair_number
# This function uses Recurs... |
tests/test_providers/test_food.py | chinghwayu/mimesis | 2,619 | 91026 | # -*- coding: utf-8 -*-
import re
import pytest
from mimesis import Food
from . import patterns
class TestFood(object):
def test_str(self, food):
assert re.match(patterns.DATA_PROVIDER_STR_REGEX, str(food))
def test_vegetable(self, food):
result = food.vegetable()
assert result in f... |
Packs/GoogleChronicleBackstory/Scripts/ExtractDomainFromIOCDomainMatchRes/ExtractDomainFromIOCDomainMatchRes_test.py | diCagri/content | 799 | 91049 | <reponame>diCagri/content
from unittest.mock import patch
import demistomock as demisto
import ExtractDomainFromIOCDomainMatchRes
ARGS = {'json_response': "{\"Artifact\": \"e9428.b.akamaiedge.net\", \"IocIngestTime\": \"2020-07-17T20:00:00Z\", "
"\"FirstAccessedTime\": \"2018-11-05T12:01:29Z\... |
pyquil/quantum_processor/transformers/__init__.py | stjordanis/pyquil | 677 | 91060 | <reponame>stjordanis/pyquil
from pyquil.quantum_processor.transformers.qcs_isa_to_compiler_isa import (
qcs_isa_to_compiler_isa,
QCSISAParseError,
)
from pyquil.quantum_processor.transformers.qcs_isa_to_graph import qcs_isa_to_graph
from pyquil.quantum_processor.transformers.compiler_isa_to_graph import compile... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.