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 |
|---|---|---|---|---|
api/features/migrations/0034_merge_20210930_0502.py | mevinbabuc/flagsmith | 1,259 | 11038536 | # Generated by Django 2.2.24 on 2021-09-30 05:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("features", "0033_feature_owners"),
("features", "0033_auto_20210918_1048"),
]
operations = []
|
exercises/practice/word-count/.meta/example.py | tamireinhorn/python | 1,177 | 11038596 | import re
from collections import Counter
WORDS = re.compile("[a-z0-9]+(['][a-z]+)?")
def count_words(text):
return Counter(word.group(0) for word in WORDS.finditer(text.lower()))
|
corehq/motech/fhir/migrations/0002_fhirresourcetype.py | omari-funzone/commcare-hq | 471 | 11038617 | <gh_stars>100-1000
from django.db import migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('data_dictionary', '0007_property_type_choices'),
('fhir', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='fhirres... |
TauAnalysis/MCEmbeddingTools/python/EmbeddingVertexCorrector_cfi.py | ckamtsikis/cmssw | 852 | 11038650 | import FWCore.ParameterSet.Config as cms
VtxCorrectedToInput = cms.EDProducer("EmbeddingVertexCorrector",
src = cms.InputTag("generator","unsmeared")
) |
gusty/building.py | chriscardillo/gusty | 103 | 11038674 | import os, yaml, inspect, airflow
from airflow import DAG
from gusty.parsing import parse, default_parsers
from gusty.parsing.loaders import GustyYAMLLoader
from gusty.importing import airflow_version, get_operator
###########################
## Version Compatability ##
###########################
if airflow_version ... |
kam1n0-clients/ida-plugin/Kam1n0/forms/ConnectionForm.py | ghalipm/Kam1n0-Community | 276 | 11038698 | # *******************************************************************************
# * Copyright 2017 McGill University 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 ... |
DataProcessor/Feature/__init__.py | Milozms/feedforward-RE | 156 | 11038702 | __author__ = 'wenqihe'
from token_feature import HeadFeature, EntityMentionTokenFeature, BetweenEntityMentionTokenFeature, ContextFeature, ContextGramFeature
from other_feature import PosFeature, DistanceFeature, EntityMentionOrderFeature, NumOfEMBetweenFeature, SpecialPatternFeature, EMTypeFeature
from dependency_fea... |
alpa/serialization.py | alpa-projects/alpa | 114 | 11038726 | """Serialization utilities for Alpa.
Adapted from https://flax.readthedocs.io/en/latest/_modules/flax/serialization.html.
Add support for DistributedArray and ReplicatedDistributedArray serialization in Alpa.
"""
import enum
import logging
import os
import re
from typing import Union, Any, Sequence
import uuid
import... |
audio_sticky_notes/note.py | sonalimahajan12/Automation-scripts | 496 | 11038729 | import tkinter
import sounddevice as sd
import soundfile as sf
import sys
def rec10s():
rec(10)
def rec5s():
rec(5)
def rec15s():
rec(15)
def rec(duration):
fs = 48000
recording = sd.rec(int(duration * fs), samplerate=fs, channels=2)
sd.wait()
return sf.writ... |
brainstorm/tests/test_handler_operations.py | PyCN/brainstorm | 1,473 | 11038734 | #!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import numpy as np
import pytest
from brainstorm.handlers import NumpyHandler
from brainstorm.optional import has_pycuda
# np.random.seed(1234)
dtype = np.float32
NO_CON = set()
def _conv2d_forward_batch(inputs,... |
rtos/pulp/gap_archi/regmap/bin/regmap_xls.py | 00-01/gap_sdk | 118 | 11038741 | <filename>rtos/pulp/gap_archi/regmap/bin/regmap_xls.py
#
# Copyright (C) 2019 GreenWaves Technologies
#
import pandas as pd
import regmap as rmap
def get_name(field):
if field[0].isdigit():
field = '_' + field
return field.replace(' ', '_')
def get_description(field):
return field.replace('\n', '... |
rdkit/ML/Data/UnitTestFilter.py | kazuyaujihara/rdkit | 1,609 | 11038754 | #
# Copyright (C) 2001,2003 <NAME> and Rational Discovery LLC
#
""" unit testing code for variable quantization
"""
import unittest
from rdkit.ML.Data import DataUtils
class TestCase(unittest.TestCase):
def setUp(self):
self.d1 = [[0, 0, 0], [1, 0, 1], [2, 0, 0], [3, 0, 1], [4, 0, 0], [5, 0, 0]]
def tes... |
homeassistant/components/nanoleaf/__init__.py | andersop91/core | 22,481 | 11038796 | <filename>homeassistant/components/nanoleaf/__init__.py<gh_stars>1000+
"""The Nanoleaf integration."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
from aionanoleaf import EffectsEvent, InvalidToken, Nanoleaf, StateEvent, Unavailable
from homeassistant.config_entries import Con... |
recipes/Python/275366_Email_address_leech/recipe-275366.py | tdiprima/code | 2,023 | 11038800 | import re
def test():
text = \
''' You can contact us at <EMAIL>
or at yourname AT server DOT site DOT com.
Also at o u r n a m e @ s e r v e r dot s i t e dot c o m
and t.h.e.i.r.n.a.m.e at server dot s/i/t/e DOT COM.
'''
for email in emailLeech(text): print... |
python2_source/BlackBoxAuditing/BlackBoxAuditor.py | alatenko/BlackBoxAuditing | 125 | 11038809 | from model_factories import Weka_SVM, Weka_DecisionTree, TensorFlow
from loggers import vprint
from GradientFeatureAuditor import GradientFeatureAuditor
from audit_reading import graph_audit, graph_audits, rank_audit_files, group_audit_ranks
from consistency_graph import graph_prediction_consistency
from measurements i... |
static/slim/quantization/export_model.py | leakyH/PaddleDetection | 7,782 | 11038810 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
SomeTest/peiqi.py | maplelearC/Unity3DTraining | 3,914 | 11038818 | <reponame>maplelearC/Unity3DTraining<gh_stars>1000+
import turtle as t
t.pensize(4) # 设置画笔的大小
t.colormode(255) # 设置GBK颜色范围为0-255
t.color((255,155,192),"pink") # 设置画笔颜色和填充颜色(pink)
t.setup(840,500) # 设置主窗口的大小为840*500
t.speed(10) # 设置画笔速度为10
#鼻子
t.pu() # 提笔
t.goto(-100,100) # 画笔前往坐标(-100,100)
t.pd() # 下笔
t.seth(-30) # 笔的... |
pybamm/input/parameters/lithium_ion/cells/LGM50_ORegan2021/copper_heat_capacity_CRC.py | manjunathnilugal/PyBaMM | 330 | 11038820 | def copper_heat_capacity_CRC(T):
"""
Copper specific heat capacity as a function of the temperature from [1].
References
----------
.. [1] <NAME> (Ed.). "CRC handbook of chemistry and physics". CRC Press
(2014).
Parameters
----------
T: :class:`pybamm.Symbol`
Dimensional tem... |
WangZhou/0001/gen_act_key.py | saurabh896/python-1 | 3,976 | 11038841 | import uuid
def gen_act_key(n):
"""
生成 n 个激活码,保存在字典。
:param n: int
:return: dict
"""
act_code_store = {}
for i in range(n):
code0 = str(uuid.uuid1()).split('-')[0]
code1 = '-'.join(str(uuid.uuid3(uuid.NAMESPACE_DNS, f'{i}')).split('-')[1:])
act_code = code0 + '-' +... |
bin/physics.py | theosech/ec | 290 | 11038857 | <filename>bin/physics.py
try:
import binutil # required to import from dreamcoder modules
except ModuleNotFoundError:
import bin.binutil # alt import if called as module
from dreamcoder.dreamcoder import *
from dreamcoder.grammar import *
from dreamcoder.program import *
import numpy as np
from dreamcoder... |
wikisql/table/__init__.py | rajasagashe/coarse2fine | 164 | 11038859 | import table.IO
import table.Models
import table.Loss
import table.ParseResult
from table.Trainer import Trainer, Statistics
from table.Translator import Translator
from table.Optim import Optim
from table.Beam import Beam, GNMTGlobalScorer
# # For flake8 compatibility
# __all__ = [table.Loss, table.IO, table.Models,... |
cooka/common/dataset_util.py | highboo52na/Cooka | 222 | 11038872 | <reponame>highboo52na/Cooka<filename>cooka/common/dataset_util.py
# -*- encoding: utf-8 -*-
import pandas as pd
def _convert_df_data_type(df, col_name, output_col_type):
df[col_name] = df[[col_name]].astype(output_col_type)
return df
def _convert_object_to_datetime(df, col_name, output_col_type):
df[col... |
rb/testing.py | duruyi/rb | 335 | 11038896 | <reponame>duruyi/rb<filename>rb/testing.py
import os
import time
import uuid
import shutil
import socket
import tempfile
from contextlib import contextmanager
from subprocess import Popen, PIPE
from rb.cluster import Cluster
from rb.utils import itervalues
devnull = open(os.devnull, "r+")
class Server(object):
... |
examples/test_cond_rnn.py | kvaidya005/cond_rnn | 182 | 11038920 | import unittest
from tensorflow.keras import regularizers
from cond_rnn import ConditionalRNN
class Test(unittest.TestCase):
def test_constructor(self):
ConditionalRNN(5, cell='GRU', kernel_regularizer=regularizers.l1_l2(l1=1e-5, l2=1e-4))
ConditionalRNN(5, cell='LSTM', kernel_regularizer=regul... |
unittest/scripts/py_devapi/scripts/mysqlx_collection_remove_prepared.py | mueller/mysql-shell | 119 | 11038945 | <reponame>mueller/mysql-shell
shell.connect(__uripwd);
session.drop_schema('prepared_stmt');
schema = session.create_schema('prepared_stmt');
collection = schema.create_collection('test_collection');
collection.add({'_id': '001', 'name': 'george', 'age': 18}).execute();
collection.add({'_id': '002', 'name': 'james', '... |
examples/gifbot.py | jsome25/SnapchatBot | 537 | 11038953 | import time, tempfile, subprocess, re, schedule
from argparse import ArgumentParser
from snapchat_bots import SnapchatBot, Snap
from lxml.html import parse
def grab_trending_gif_urls():
doc = parse("http://giphy.com").getroot()
els = doc.cssselect(".gif-link img")[:10]
ret = []
for el in els:
... |
pyclustering/cluster/tests/integration/it_kmeans.py | JosephChataignon/pyclustering | 1,013 | 11038956 | <filename>pyclustering/cluster/tests/integration/it_kmeans.py
"""!
@brief Integration-tests for K-Means algorithm.
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
import unittest
import numpy
import matplotlib
matplotlib.use('Agg')
from pyclustering.cluster.tests.kmeans_tem... |
tests/test_benchmark.py | patrikarlos/ping3 | 212 | 11038975 | import os
import timeit
dev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
stmt = "ping3.ping('127.0.0.1')"
setup = "import sys; sys.path.insert(0, '{}'); import ping3; print('ping3 version:', ping3.__version__)".format(dev_dir)
for count in (1, 10, 100, 1000, 5000):
print("Testing `{stmt}` {num... |
tests/float/int_divzero.py | learnforpractice/micropython-cpp | 13,648 | 11038979 | <reponame>learnforpractice/micropython-cpp
try:
1 / 0
except ZeroDivisionError:
print("ZeroDivisionError")
try:
0 ** -1
except ZeroDivisionError:
print("ZeroDivisionError")
|
corehq/ex-submodules/soil/views.py | dimagilg/commcare-hq | 471 | 11038988 | <gh_stars>100-1000
import logging
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponseForbidden, HttpResponseServerError
from django.shortcuts import render
from django.template.context import RequestContext
from django.utils.translation import ugettext_lazy as _
fro... |
models/braf_model/braf_rxn_analysis.py | pupster90/indra | 136 | 11039046 | import pickle
from pysb import bng
from assemble_model import assemble_model
import pygraphviz
def get_braf_species(model):
sp = [s for s in model.species if str(s).find('BRAF') != -1]
sp = [s for s in sp if str(s).find('WT') == -1]
return sp
def _get_node_name(species):
name = ''
monomer_codes =... |
scattertext/continuous/coefficientbase.py | jairoruizsaenz/scattertext | 1,823 | 11039059 | class CoefficientBase:
def __init__(self, use_non_text=False):
self.use_non_text = use_non_text
def _get_tdm(self, corpus):
return corpus.get_metadata_doc_mat() if self.use_non_text else corpus.get_term_doc_mat()
def _get_terms(self, corpus):
return corpus.get_metadata() if self.us... |
delete_dashboards_by_text_search/delete_dashboards.py | nadaj/Miscellany | 155 | 11039084 | <gh_stars>100-1000
import os
from datadog import initialize, api
def file_output(dashboard, title):
if os.path.exists("datadog_dashboards_backup.txt"):
mode = "a"
else:
mode = "w"
print(f"Writing backup for {title} on file datadog_dashboards_backup.txt.")
with open("datadog_dashboards... |
Creational/Factory/python/factory.py | jerryshueh/design-patterns | 294 | 11039099 | <reponame>jerryshueh/design-patterns<gh_stars>100-1000
class HindiLanguage(object):
"""A simple localizer a la gettext"""
def __init__(self):
self.trans = dict(dog="कुत्ता", cat="बिल्ली")
def get(self, msgid):
"""We'll punt if we don't have a translation"""
return self.trans.get... |
ev3/mindsensors.py | tankeev/python-ev3 | 158 | 11039101 | <filename>ev3/mindsensors.py
from .ev3dev import I2CS
from .ev3dev import LegoSensor
class MindSensorI2CS(I2CS):
@property
def version(self):
return self.read_byte_array_as_string(0x00, 8)
@property
def vendor_id(self):
return self.read_byte_array_as_string(0x08, 8)
@property
... |
language-python-test/test/features/classes/class_freevar_sameas_localvar.py | wbadart/language-python | 137 | 11039107 | <gh_stars>100-1000
def f():
y = 'from f'
class C():
y = 'from C'
def g(self):
nonlocal y
print(y)
C().g()
f()
|
vumi/persist/riak_base.py | seidu626/vumi | 199 | 11039159 | <reponame>seidu626/vumi
"""Basic tools for building a Riak manager."""
import json
from riak import RiakClient
from vumi.persist.model import VumiRiakError
def _to_unicode(text, encoding='utf-8'):
# If we already have unicode or `None`, there's nothing to do.
if isinstance(text, (unicode, type(None))):
... |
tests/test_stream_line_reader.py | deterok/galaxy-integrations-python-api | 1,165 | 11039204 | import pytest
from galaxy.reader import StreamLineReader
from galaxy.unittest.mock import async_return_value
@pytest.fixture()
def stream_line_reader(reader):
return StreamLineReader(reader)
@pytest.mark.asyncio
async def test_message(stream_line_reader, read):
read.return_value = async_return_value(b"a\n"... |
Tools/binding/generators/idl_cs_proto.py | asears/WebSharp | 352 | 11039268 | <filename>Tools/binding/generators/idl_cs_proto.py
#!/usr/bin/env python
# Copyright (c) 2012 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.
""" Generator for C-Sharp style binding definitions """
import glob
import os
i... |
cpp/src/core.gyp | kysko/music-synthesizer-for-android | 388 | 11039286 | {
'targets': [
{
'target_name': 'core',
'type': 'static_library',
'sources': [
'dx7note.cc',
'env.cc',
'exp2.cc',
'fm_core.cc',
'fm_op_kernel.cc',
'freqlut.cc',
'lfo.cc',
'log2.cc',
'patch.cc',
'pitchenv.cc',
... |
examples/optimizers/evolutionary/create_de.py | anukaal/opytimizer | 528 | 11039306 | from opytimizer.optimizers.evolutionary import DE
# One should declare a hyperparameters object based
# on the desired algorithm that will be used
params = {
'CR': 0.9,
'F': 0.7
}
# Creates a DE optimizer
o = DE(params=params)
|
src/examples/tufs_cnn.py | zhhengcs/sunny-side-up | 581 | 11039322 | <filename>src/examples/tufs_cnn.py
from __future__ import absolute_import
from __future__ import print_function
import os,sys
file_path = os.path.dirname(os.path.abspath(__file__))
ssu_path = file_path.rsplit('/examples')[0]
sys.path.insert(0, ssu_path)
import simplejson as json
import numpy as np
import pprint
impor... |
test/acceptance/workspaces/setup_py-app/setup.py | Codesee-io/snyk | 3,527 | 11039332 | <reponame>Codesee-io/snyk<gh_stars>1000+
#!/usr/bin/env python
from distutils.core import setup
setup(
name="test_package",
version="1.0.2",
packages=[
"Jinja2==2.7.2",
"Django==1.6.1",
"python-etcd==0.4.5",
"Django-Select2==6.0.1", # this version installs with lowercase s... |
segmentation/configs/RepLKNet-XL_MegData73M_upernet_160k_ade20k_640.py | DingXiaoH/RepLKNet-pytorch | 306 | 11039347 | _base_ = ['RepLKNet-31L_22Kpretrain_upernet_160k_ade20k_640.py']
model = dict(
backbone=dict(
large_kernel_sizes=[27,27,27,13],
channels=[256, 512, 1024, 2048],
drop_path_rate=0.5,
small_kernel=None,
dw_ratio=1.5,
norm_intermediate_features=True
),
decode_hea... |
SOA/calculate_soa.py | psyllost/semantic-object-accuracy-for-generative-text-to-image-synthesis | 103 | 11039355 | from __future__ import division
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import numpy as np
import argparse
import os
import pickle as pkl
from tqdm import tqdm
import glob
import shutil
from darknet import Darknet
from dataset import YoloDataset
from util impor... |
alipay/aop/api/domain/AlipayOpenMiniIsvCreateModel.py | antopen/alipay-sdk-python-all | 213 | 11039360 | <filename>alipay/aop/api/domain/AlipayOpenMiniIsvCreateModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.CreateMiniRequest import CreateMiniRequest
class AlipayOpenMiniIsvCreateModel(object):
def __init__(self):
... |
third_party/jsoncpp/jsoncpp.gyp | kjthegod/chromium | 231 | 11039374 | <filename>third_party/jsoncpp/jsoncpp.gyp
# Copyright (c) 2012 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.
{
'includes': [
'jsoncpp.gypi',
],
'targets': [
{
'target_name': 'jsoncpp',
'type': '... |
library/test/test_compiler/testcorpus/04_aug_assign_attr_sub.py | creativemindplus/skybison | 278 | 11039380 | <reponame>creativemindplus/skybison<filename>library/test/test_compiler/testcorpus/04_aug_assign_attr_sub.py<gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
a.b -= 2
a[0] += 1
a[0:2] += 1
|
util/mscoco_util.py | PJunhyuk/exercise-pose-guide | 161 | 11039386 | <filename>util/mscoco_util.py
import numpy as np
import scipy.io
def multi_dim_argmax(arr):
""" Getting argmax over the first 2 axes """
m, n, i, j = arr.shape
arr = np.reshape(arr, (m * n, i, j))
return np.unravel_index(np.argmax(arr, 0), (m, n))
def interweave_matrices(x, y, z):
"""Combine mat... |
databuilder/databuilder/clients/neptune_client.py | defendercrypt/amundsen | 2,072 | 11039395 | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import (
Any, Callable, Dict, List, Optional, Tuple,
)
from amundsen_gremlin.neptune_bulk_loader import api as neptune_bulk_loader_api
from boto3.session import Session
from gremlin_python.process.graph_traversal i... |
tests/genicam_tests/streamingtest.py | matt-phair/pypylon | 358 | 11039409 | # -----------------------------------------------------------------------------
# (c) 2005 by Basler Vision Technologies
# Section: Vision Components
# Project: GenApiTest
# Author:
# $Header:
# -----------------------------------------------------------------------------
from genicam import *
import unittest
f... |
test/integration/api/test_core_integration.py | BENR0/geocube | 152 | 11039432 | <gh_stars>100-1000
import json
from functools import partial
import geopandas as gpd
import pandas
import pytest
import scipy
import xarray
from numpy.testing import assert_almost_equal
from packaging import version
from rasterio.enums import MergeAlg
from shapely.geometry import mapping
from shapely.wkt import loads
... |
client/python/ff_client/__init__.py | TimeToogo/fire-and-forget-http | 747 | 11039433 | <gh_stars>100-1000
from .ff_client import FfClient
from .ff_config import FfConfig
from .ff_request import FfRequest
__all__ = ['ff_client', 'ff_config', 'ff_request'] |
pydle/client.py | bernardosulzbach/pydle | 150 | 11039462 | <gh_stars>100-1000
## client.py
# Basic IRC client implementation.
import asyncio
import logging
from asyncio import new_event_loop, gather, get_event_loop, sleep
from . import connection, protocol
import warnings
__all__ = ['Error', 'AlreadyInChannel', 'NotInChannel', 'BasicClient', 'ClientPool']
DEFAULT_NICKNAME = ... |
src/main/python/graphing-scripts/generate-plots-from-protobuff.py | gaocegege/cluster-scheduler-simulator | 161 | 11039498 | #!/usr/bin/python
# Copyright (c) 2013, Regents of the University of California
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright no... |
machine_learning/Support_Vector_Machine/Python/SVM_with_Sklearn.py | CarbonDDR/al-go-rithms | 1,253 | 11039516 | <gh_stars>1000+
# some imports
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn import svm
from sklearn import metrics
# read the dataset from sklearn dataset
cancer = datasets.load_breast_cancer()
# See the features and label names of the dataset
print("Features are: "... |
mycpp/demo/heap_growth.py | Schweinepriester/oil | 2,209 | 11039519 | <reponame>Schweinepriester/oil
#!/usr/bin/env python2
"""
heap_growth.py
"""
from __future__ import print_function
import sys
class Space(object):
def __init__(self, space_size):
self.filled_size = 0
self.space_size = space_size
def Simulate(spaces, alloc_sizes):
# TODO:
# - how to simulate garbage t... |
neon/backends/layer_mkl.py | rsketine/neon | 4,415 | 11039531 | # ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... |
src/testers/arm32/unicorn_test_arm32_interworking_arm_1.py | o2e/Triton | 2,337 | 11039558 | #!/usr/bin/env python3
## -*- coding: utf-8 -*-
from __future__ import print_function
from triton import *
from unicorn import *
from unicorn.arm_const import *
import pprint
import random
import sys
ADDR = 0x000000
STACK = 0x100000
HEAP = 0x200000
SIZE = 5 * 1024 * 1024
# NOT... |
annif/transform/transform.py | jimfhahn/Annif | 121 | 11039568 | """Common functionality for transforming text of input documents."""
import abc
from annif.corpus import TransformingDocumentCorpus
from annif.exception import ConfigurationException
class BaseTransform(metaclass=abc.ABCMeta):
"""Base class for text transformations, which need to implement the
transform func... |
docs/examples/pool.py | laggardkernel/aioredis-py | 1,777 | 11039596 | import asyncio
import aioredis
async def main():
redis = aioredis.from_url("redis://localhost", max_connections=10)
await redis.execute_command("set", "my-key", "value")
val = await redis.execute_command("get", "my-key")
print("raw value:", val)
async def main_pool():
pool = aioredis.Connection... |
Contents/Libraries/Shared/guessit/transfo/guess_episodes_rexps.py | bramwalet/Subliminal.bundle | 152 | 11039621 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 <NAME> <<EMAIL>>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software Founda... |
CommonTools/ParticleFlow/python/Tools/jetTools.py | ckamtsikis/cmssw | 852 | 11039647 | import FWCore.ParameterSet.Config as cms
def jetAlgo( algo ):
# print 'PF2PAT: selecting jet algorithm ', algo
if algo == 'IC5':
import RecoJets.JetProducers.ic5PFJets_cfi as jetConfig
jetAlgo = jetConfig.iterativeCone5PFJets.clone()
elif algo == 'AK4':
import RecoJets.JetProducer... |
tests/components/stream/test_init.py | MrDelik/core | 30,023 | 11039676 | """Test stream init."""
import logging
import av
from homeassistant.components.stream import __name__ as stream_name
from homeassistant.setup import async_setup_component
async def test_log_levels(hass, caplog):
"""Test that the worker logs the url without username and password."""
logging.getLogger(strea... |
L1TriggerConfig/L1ScalesProducers/test/L1MuScalesGlobalTagTest_cfg.py | ckamtsikis/cmssw | 852 | 11039685 | import FWCore.ParameterSet.Config as cms
# process
process = cms.Process('L1MuScalesGlobalTagTest')
# number of events and source
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.source = cms.Source('EmptySource')
# load and configure modules via Global Tag
# https://twiki.cern.c... |
tests/test_config.py | CouldBeThis/shallow-backup | 900 | 11039772 | import os
import sys
from .testing_utility_functions import setup_dirs_and_env_vars_and_create_config, clean_up_dirs_and_env_vars, FAKE_HOME_DIR
sys.path.insert(0, "../shallow_backup")
from shallow_backup.config import get_config, add_dot_path_to_config
from shallow_backup.utils import strip_home
class TestConfigMeth... |
torchelie/nn/vq.py | Vermeille/Torchelie | 117 | 11039773 | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Union, Tuple
from .functional import quantize
class VQ(nn.Module):
"""
Quantization layer from *Neural Discrete Representation Learning*
Args:
latent_dim (int): number of features along which to quantize
... |
tests/test_pylogit.py | mathijsvdv/pylogit | 153 | 11039786 | """
Tests for the user-facing choice model constructor.
"""
import unittest
from collections import OrderedDict
import numpy as np
import numpy.testing as npt
import pandas as pd
import pylogit
import pylogit.display_names as display_names
# Get the dictionary that maps the model type to the names of the model that... |
tests/checks/test_unique_constraint.py | jdaviscooke/goodtables-py | 243 | 11039821 | <filename>tests/checks/test_unique_constraint.py
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import mock
from goodtables.checks.unique_constraint import UniqueConstraint
import goodtables.ce... |
src/math/code/test_complex.py | gfrubi/theoretical-physics | 158 | 11039844 | <reponame>gfrubi/theoretical-physics
def arg(x):
"""
The argument function.
"""
from cmath import log
return log(x).imag
def generate_values():
"""
Create values to test the function at.
"""
from math import sin, cos, pi
from random import random
# Generate 3 circles in comp... |
apps/dash-cytoscape-lda/2_add_biblio_data.py | JeroenvdSande/dash-sample-apps | 2,332 | 11039854 | <gh_stars>1000+
# ========== (c) <NAME> 2020-04-02 ==========
import logging
# ===== START LOGGER =====
logger = logging.getLogger(__name__)
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
sh = logging.StreamHandler()
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(mess... |
venv/Lib/site-packages/prompt_toolkit/output/color_depth.py | ajayiagbebaku/NFL-Model | 6,989 | 11039866 | import os
from enum import Enum
from typing import Optional
__all__ = [
"ColorDepth",
]
class ColorDepth(str, Enum):
"""
Possible color depth values for the output.
"""
value: str
#: One color only.
DEPTH_1_BIT = "DEPTH_1_BIT"
#: ANSI Colors.
DEPTH_4_BIT = "DEPTH_4_BIT"
#:... |
self_driving/ml_training/test/test_all.py | cclauss/self_driving_pi_car | 724 | 11039867 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
from TestDataHolder import TestDataHolder
from TestTrainer import TestTrainer
almost_current = os.path.abspath(inspect.getfile(inspect.currentframe()))
currentdir = os.path.dirname(almost_current)
parentdir = os.path.dirname(currentdir)... |
mrgeo-python/src/main/python/setup.py | ngageoint/mrgeo | 198 | 11039895 | from codecs import open
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='pymrgeo',
packages=['pymrgeo'], # thi... |
cozy/parsetools.py | mernst/cozy | 188 | 11039946 | <reponame>mernst/cozy<filename>cozy/parsetools.py
"""Helper functions for the parser."""
from cozy.common import fresh_name
def multi(ldict, selfname, production, sep=None):
"""
Usage:
multi(locals(), NAME, P[, sep=SEP])
where P and SEP are production names.
This produces a production nam... |
softlearning/samplers/dummy_sampler.py | limash/softlearning | 920 | 11039999 | <gh_stars>100-1000
from .base_sampler import BaseSampler
class DummySampler(BaseSampler):
def sample(self):
pass
|
climt/_components/rrtmg/__init__.py | Ai33L/climt | 116 | 11040002 | from .lw import RRTMGLongwave
from .sw import RRTMGShortwave
__all__ = (RRTMGLongwave, RRTMGShortwave)
|
tests/test_get_godag.py | flying-sheep/goatools | 477 | 11040012 | <gh_stars>100-1000
#!/usr/bin/env python
"""Test downloading GO DAG."""
import os
import sys
from goatools.base import get_godag
def test_godag(prt=sys.stdout):
"""Test downloading GO DAG."""
cwd = os.getcwd()
for fin_obo in ['go-basic.obo', 'goslim_generic.obo']:
fin_full = os.path.join(cwd, fin_... |
scripts/optionizer.py | zjzh/wharfee | 489 | 11040067 | <reponame>zjzh/wharfee
# -*- coding: utf-8
"""
Docker option checker / helper.
Usage:
optionizer.py [<command>] [--implemented|--unimplemented]
-h --help Show this help
-i --implemented Show implemented commands only
-u --unimplemented Show unimplemented commands only
<command> Specify com... |
src/tiptop/_disk.py | nschloe/tiptop | 882 | 11040137 | <reponame>nschloe/tiptop
from __future__ import annotations
import psutil
from rich import box
from rich.console import Group
from rich.panel import Panel
from rich.table import Table
from rich.text import Text
from textual.widget import Widget
from ._helpers import sizeof_fmt
from .braille_stream import BrailleStrea... |
pogom/pgoapi/protos/POGOProtos/Networking/Requests/Messages/FortSearchMessage_pb2.py | tier4fusion/pogom-updated | 2,557 | 11040139 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Requests/Messages/FortSearchMessage.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messag... |
src/converters/modules/model_zoo/detectors/dbface.py | u0251077/InsightFace-REST | 269 | 11040142 | <filename>src/converters/modules/model_zoo/detectors/dbface.py
from __future__ import division
import numpy as np
import cv2
import time
import logging
from typing import Union
from numba import njit
from .common.nms import nms
from ..exec_backends.onnxrt_backend import DetectorInfer as DIO
# Since TensorRT and pycud... |
webpage/deepchat/models.py | mckinziebrandon/seq2seq_projects | 341 | 11040155 | <gh_stars>100-1000
"""app/models.py: Tutorial IV - Databases.
database models: collection of classes whose purpose is to represent the
data that we will store in our database.
The ORM layer (SQLAlchemy) will do the translations required to map
objects created from these classes into rows in the prope... |
tests/test_standalone_many.py | JoostvDoorn/pywren | 630 | 11040161 | #
# Copyright 2018 PyWren Team
#
# 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... |
apps/pretrained_protein/tape/metrics.py | agave233/PaddleHelix | 454 | 11040272 | <reponame>agave233/PaddleHelix
# 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/licenses/LICENSE... |
TWindbg/command.py | IMULMUL/TWindbg | 194 | 11040277 | import pykd
import sys
import context
import color
import traceback
from utils import *
from functools import wraps
all_commands = [
'TWindbg',
'telescope',
'ctx'
]
class CmdExecError(Exception):
def __init__(self, errmsg):
self.errmsg = errmsg
def wrap_usage(func):
@wraps(func)
def ... |
tests/unit/conftest.py | ricekot/zap-api-python | 146 | 11040293 | import pytest
import requests_mock
from zapv2 import ZAPv2
@pytest.yield_fixture
def zap():
"""
All tests will be able to share the instance of client with the same settings."""
yield ZAPv2(apikey='testapikey')
@pytest.yield_fixture
def zap_strict():
"""
All tests will be able to share the inst... |
kotlin/internal/repositories/tools.bzl | eiiches/rules_kotlin | 286 | 11040327 | """tools for managing repositories."""
def absolute_target(repo_relative_target):
"""Converts a relative path inside a repository to a fully qualified name.
This uses builtin Label to translate relative paths to repository qualified targets of the defining bzl file.
For instance, absolute_target is defin... |
scripts/cord19/find_cord19_length_outlier.py | keleog/pyserini | 451 | 11040331 | #
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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... |
octavia/common/jinja/logging/logging_jinja_cfg.py | zhangi/octavia | 129 | 11040340 | # Copyright 2018 Rackspace, US 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... |
test/integration/broken/test_ps_resource_limits_volume.py | ycyun/ablestack-cloud | 1,131 | 11040387 | <filename>test/integration/broken/test_ps_resource_limits_volume.py
# 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 un... |
tools/bin/pythonSrc/pychecker-0.8.18/pychecker2/utest/scopes.py | YangHao666666/hawq | 450 | 11040413 | from pychecker2.TestSupport import WarningTester
from pychecker2 import ScopeChecks
class RedefinedTestCase(WarningTester):
def testScopes(self):
w = ScopeChecks.RedefineCheck.redefinedScope
self.warning('def f(): pass\n'
'def f(): pass\n',
1, w, 'f', 2)
... |
PyFunceble/dataset/base.py | Centaurioun/PyFunceble | 213 | 11040470 | <gh_stars>100-1000
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ █... |
websockets/cookies/support/set-cookie.py | spao234/wpt | 575 | 11040494 | from six.moves.urllib import parse
from wptserve.utils import isomorphic_encode
def main(request, response):
response.headers.set(b'Set-Cookie', isomorphic_encode(parse.unquote(request.url_parts.query)))
return [(b"Content-Type", b"text/plain")], b""
|
src/scheduled-query/azext_scheduled_query/grammar/scheduled_query/ScheduleQueryConditionListener.py | Mannan2812/azure-cli-extensions | 207 | 11040513 | <reponame>Mannan2812/azure-cli-extensions
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------... |
alipay/aop/api/response/AlipayOpenAuthIndustryPlatformCreateTokenResponse.py | snowxmas/alipay-sdk-python-all | 213 | 11040551 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenAuthIndustryPlatformCreateTokenResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenAuthIndustryPlatformCreateTokenResponse, self).__init__()
self.... |
davarocr/davarocr/version.py | hikopensource/DAVAR-Lab-OCR | 387 | 11040602 | """
##################################################################################################
# Copyright Info : Copyright (c) <NAME> @ Hikvision Research Institute. All rights reserved.
# Filename : version.py
# Abstract :
# Current Version: 0.3.0
# Date : 2021-09-22
#######... |
openbook_moderation/views/moderation_categories/views.py | TamaraAbells/okuna-api | 164 | 11040671 | <reponame>TamaraAbells/okuna-api
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from openbook_moderation.permissions import IsNotSuspended
from openbook_moderation.models import ModerationCat... |
testing/MLDB-902-non-ascii-row-names.py | kstepanmpmg/mldb | 665 | 11040686 | <reponame>kstepanmpmg/mldb
# -*- coding: utf-8 -*-
#
# MLDB-902-non-ascii-row-names.py
# mldb.ai inc, 2015
# this file is part of mldb. copyright 2015 mldb.ai inc. all rights reserved.
#
# I should be able to create a dataset x, add a row with name françois and
# then query select * from x without error right now I get... |
third_party/org_ebaysf_web.bzl | wix/exodus | 186 | 11040726 | <reponame>wix/exodus
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_ebaysf_web_cors_filter",
artifact = "org.ebaysf.web:cors-filter:1.0.1",
artifact_sha256 = "6902914ce8fc03af5a36e2d164ddc683b61281f248379980... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.