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 |
|---|---|---|---|---|
src/_dependencies/objects/data.py | dry-python/dependencies | 175 | 11016780 | <gh_stars>100-1000
from _dependencies.spec import _Spec
def _is_data(name, dependency):
return True
def _build_data_spec(name, dependency):
return _Spec(lambda: dependency, {}, set(), set(), lambda: "Scalar")
|
build_utils/load_plat.py | Lilith5th/Radiance | 154 | 11016805 | from __future__ import division, print_function, unicode_literals
import os
import sys
import re
import platform
try: import configparser # Py3
except ImportError:
import ConfigParser as configparser # Py2
_platdir = 'platform'
def read_plat(env, fn):
envdict = env.Dictionary().copy()
# can't feed configparser t... |
workflow/rules/paths.py | mathren/showyourwork | 119 | 11016810 | """
Sets global constants for the workflow.
"""
from pathlib import Path, PurePosixPath
import os
import sys
from sphinx_mock import *
_workflow = workflow
def posix(path):
"""Convert a path object to a string containing the posix path."""
return str(PurePosixPath(path))
class abspaths:
"""Absolute p... |
raiwidgets/tests/test_fairness_calculations.py | ShabadVaswani/responsible-ai-widgets | 295 | 11016831 | # Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
import pytest
import numpy as np
from raiwidgets.fairness_metric_calculation import (
compute_wilson_bounds, recall_wilson,
precision_wilson, false_positive_rate_wilson,
true_negative_rate_wilson, false_negative_rate_wilson,
mse_st... |
pyvisa/testsuite/__init__.py | jpsecher/pyvisa | 393 | 11016876 | # -*- coding: utf-8 -*-
"""PyVISA testsuite.
"""
import logging
from logging.handlers import BufferingHandler
import pytest
from pyvisa import ResourceManager, logger
try:
ResourceManager()
except ValueError:
VISA_PRESENT = False
else:
VISA_PRESENT = True
require_visa_lib = pytest.mark.skipif(
not ... |
hw2/sppm/bezier_test.py | OldNew777/Computational-Graphics-THU-2018 | 140 | 11016877 | import cv2
import numpy as np
control=np.array(
[[ 270., 0.],
[ 150., 100.],
[ 200., 200.],
[ 250., 400.],
[ 300., 500.],
[ 300., 600.],
[ 300., 700.],
[ 300., 800.],
[ 250., 800.]])
print(control)
fac=np.ones(30)
for i in range(1, len(fac)):
fac[i] = fac[i-1]*i
def bezier(t):
n=control.shape[0]-1
... |
python/cuspatial/cuspatial/tests/conftest.py | AyodeAwe/cuspatial | 347 | 11016881 | # Copyright (c) 2020-2021, NVIDIA CORPORATION.
import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
from shapely.geometry import (
LineString,
MultiLineString,
MultiPoint,
MultiPolygon,
Point,
Polygon,
)
@pytest.fixture
def gs():
g0 = Point(-1, 0)
g1 = MultiPoi... |
pxr/usd/kind/testenv/testKindRegistry.py | DougRogers-DigitalFish/USD | 3,680 | 11016903 | <reponame>DougRogers-DigitalFish/USD
#!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Tradema... |
bin/update_dns.py | daixiang0/tools | 264 | 11016923 | # Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
medusa/report_latest.py | emerkle826/cassandra-medusa | 187 | 11016954 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 Spotify AB. 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... |
src/doc/data_into_visit/data_examples/plain_text.py | visit-dav/vis | 226 | 11016957 | <filename>src/doc/data_into_visit/data_examples/plain_text.py
import math
f = open("curves.csv", "wt")
f.write("angle sine cosine\n")
npts = 73
for i in range(npts):
angle_deg = float(i) * (360. / float(npts-1))
angle_rad = angle_deg * (3.1415926535 / 180.)
sine = math.sin(angle_rad)
cosine = math.cos... |
data/transcoder_evaluation_gfg/python/MAXIMUM_SUM_SUBSEQUENCE_LEAST_K_DISTANT_ELEMENTS.py | mxl1n/CodeGen | 241 | 11016975 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , N , k ) :
MS = [ 0 for i in range ( N ) ]
MS [ N - 1 ] = arr [ N - 1 ]
for i in range ( N - 2 , -... |
tests/Unit/NumericalAlgorithms/DiscontinuousGalerkin/NumericalFluxes/TestFunctions.py | nilsvu/spectre | 117 | 11016993 | <reponame>nilsvu/spectre
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def characteristic_speeds(var_1, var_2, var_3):
return [
np.cos(i) * var_1 - (1.0 - np.sin(i)) * np.dot(var_2, var_3)
for i in range((var_2.size + 1) * (var_2.size + 1))
]
# Funct... |
typed_python/compiler/tests/class_compilation_test.py | APrioriInvestments/typed_python | 105 | 11017008 | <filename>typed_python/compiler/tests/class_compilation_test.py<gh_stars>100-1000
# Copyright 2017-2019 typed_python 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
#
# ... |
tests/tf/model/test_model.py | Jwmc999/Transformers4Rec | 415 | 11017030 | <gh_stars>100-1000
#
# Copyright (c) 2021, NVIDIA 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
emails/active/email_signup_email.py | noryb009/rmc | 164 | 11017032 | import sys
import traceback
import boto
import mongoengine as me
import rmc.models as m
import rmc.shared.constants as c
import rmc.shared.secrets as secrets
EMAIL_SENDER = 'UW Flow <<EMAIL>>'
me.connect(c.MONGO_DB_RMC)
conn = boto.connect_ses(
aws_access_key_id=secrets.AWS_KEY_ID,
aws_secret_access_key=se... |
tests/numpy/random_random.py | Fryguy/py2rb | 124 | 11017033 | import numpy as np
x = np.random.random((3,3,3))
print(x.ndim)
|
integration_test/sqldump.py | lingfengzui/bireme | 133 | 11017041 | import MySQLdb
import MySQLdb.cursors
import psycopg2
import psycopg2.extras
import binascii
import re
from cStringIO import StringIO
def sqldump(dbtype, host, port, user, passwd, db, table, *key):
try:
nameAndType = getNameAndType(dbtype, host, port, user, passwd, db, table)
nameAndType.sort()
... |
tutorials/plot_rainbow.py | Nijta/project-NN-Pytorch-scripts | 150 | 11017051 | <filename>tutorials/plot_rainbow.py
#!/usr/bin/python
"""
Modified based on https://gist.github.com/jesseengel/e223622e255bd5b8c9130407397a0494
Note:
1. Librosa is required
2. Rainbowgram is a way for plotting magnitiude and phase CQT spectrogram,
not a new type of feature
"""
import os
import sys
import numpy as n... |
usaspending_api/accounts/models/federal_account.py | g4brielvs/usaspending-api | 217 | 11017053 | from django.db import models
class FederalAccount(models.Model):
"""
Represents a single federal account. A federal account encompasses multiple Treasury Account Symbols (TAS),
represented by: model:`accounts.TreasuryAppropriationAccount`.
"""
agency_identifier = models.TextField(db_index=True)
... |
kss/pynori/dict/user_dictionary.py | link-kim/kss | 163 | 11017055 | <gh_stars>100-1000
from kss.pynori.dict.dictionary import Dictionary
from kss.pynori.dict.character_definition import CharacterDefinition
from kss.pynori.dict.trie import Trie
from kss.pynori.pos import POS
class UserDictionary(Dictionary):
"""Build User Dictionary"""
WORD_COST = -100000
LEFT_ID = 1781 ... |
nvchecker/httpclient/__init__.py | trathborne/nvchecker | 320 | 11017093 | <gh_stars>100-1000
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <<EMAIL>>, et al.
from typing import Optional
from .base import TemporaryError, HTTPError
class Proxy:
_obj = None
def set_obj(self, obj):
super().__setattr__('_obj', obj)
def __getattr__(self, name):
return getattr(self._obj, name)... |
haproxystats/pull.py | crovner/haproxystats | 104 | 11017097 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# pylint: disable=too-many-statements
# pylint: disable=too-many-arguments
# pylint: disable=too-many-branches
# pylint: disable=too-many-locals
#
"""Pulls statistics from HAProxy daemon over UNIX/TCP socket(s).
Usage:
haproxystats-pull [-f <file> ] [-p |... |
pandas/tests/indexes/categorical/test_equals.py | CJL89/pandas | 603 | 11017108 | <reponame>CJL89/pandas
import numpy as np
import pytest
from pandas import Categorical, CategoricalIndex, Index
class TestEquals:
def test_equals_categorical(self):
ci1 = CategoricalIndex(["a", "b"], categories=["a", "b"], ordered=True)
ci2 = CategoricalIndex(["a", "b"], categories=["a", "b", "c"... |
bin/curl.py | mrshu/stash | 1,822 | 11017143 | # coding=utf-8
""" Transfer a URL
"""
from __future__ import print_function
import sys
import argparse
import requests
from six.moves.urllib.parse import urlparse
try:
import clipboard
except ImportError:
clipboard = None
def main(args):
ap = argparse.ArgumentParser()
ap.add_argument('url', nargs='?... |
notebook/conditional_expressions.py | vhn0912/python-snippets | 174 | 11017152 | <filename>notebook/conditional_expressions.py
a = 1
result = 'even' if a % 2 == 0 else 'odd'
print(result)
# odd
a = 2
result = 'even' if a % 2 == 0 else 'odd'
print(result)
# even
a = 1
result = a * 2 if a % 2 == 0 else a * 3
print(result)
# 3
a = 2
result = a * 2 if a % 2 == 0 else a * 3
print(result)
# 4
a = 1
p... |
autoviml/custom_scores_HO.py | manugarri/Auto_ViML | 348 | 11017177 | <filename>autoviml/custom_scores_HO.py
import numpy as np
from sklearn import model_selection
from sklearn.metrics import confusion_matrix, mean_squared_error
from sklearn import metrics
from sklearn import model_selection, metrics #Additional sklearn functions
from sklearn.metrics import accuracy_score,f1_score... |
third_party/pyelftools/setup.py | zipated/src | 2,151 | 11017196 | <gh_stars>1000+
#-------------------------------------------------------------------------------
# pyelftools: setup.py
#
# Setup/installation script.
#
# <NAME> (<EMAIL>)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os, sys
from di... |
tests/test_casefold.py | gtmanfred/irc3 | 178 | 11017215 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from irc3.testing import BotTestCase
class TestCasefold(BotTestCase):
config = dict(includes=['irc3.plugins.casefold'])
def test_ascii(self):
bot = self.callFTU(server_config={'CASEMAPPING': 'ascii'})
self.assertEquals(bot.casefold('#testchan\\123[... |
examples/applications/parallel-sentence-mining/bitext_mining.py | ccolas/sentence-transformers | 7,566 | 11017226 | """
This scripts show how to mine parallel (translated) sentences from two list of monolingual sentences.
As input, you specific two text files that have sentences in every line. Then, the
LaBSE model is used to find parallel (translated) across these two files.
The result is written to disc.
A large source for mono... |
mctorch/optim/__init__.py | vishalbelsare/mctorch | 188 | 11017245 | <reponame>vishalbelsare/mctorch
from .radagrad import rAdagrad
from .rsgd import rSGD
from .conjugate_gradient import ConjugateGradient
from .rasa import rASA
|
matrix-python-project/auto_distribute/render.py | hokaso/hocassian-media-matrix | 141 | 11017305 | import sys, os, json, shutil, math, traceback, shlex, subprocess, ffmpeg
sys.path.append(os.getcwd())
from multiprocessing.managers import BaseManager
from db.db_pool_handler import InstantDBPool
from auto_distribute.lark import Lark
from tenacity import retry, wait_fixed
from utils.tools import Tools
from auto_distri... |
tests/json_api_test_app.py | gaybro8777/osf.io | 628 | 11017321 | from json import dumps
from django.core.handlers.wsgi import WSGIHandler
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.test.signals import template_rendered
from django.core import signals
from django.test.client import store_rendered_templates
from django.utils.functional import curry
... |
c/ch10/meshes/format22.py | thw1021/p4pdes | 115 | 11017334 | <filename>c/ch10/meshes/format22.py
# (C) 2018-2020 <NAME>
# See msh2petsc.py for usage.
# This module is based on the Gmsh ASCII format (version 2.2; legacy) at
# http://gmsh.info/doc/texinfo/gmsh.html#MSH-file-format-version-2-_0028Legacy_0029
import numpy as np
import sys
# fail and exit with message
def fail(... |
glue/managers/simple.py | glensc/glue | 514 | 11017377 | from .base import BaseManager
class SimpleManager(BaseManager):
"""Process a single folder and create one sprite. It works the
same way as :class:`~ProjectSpriteManager`, but only for one folder.
This is the default manager.
"""
def find_sprites(self):
self.add_sprite(path=self.config['s... |
L1Trigger/TrackerDTC/python/ProducerED_cfi.py | ckamtsikis/cmssw | 852 | 11017441 | <filename>L1Trigger/TrackerDTC/python/ProducerED_cfi.py
import FWCore.ParameterSet.Config as cms
TrackerDTCProducer_params = cms.PSet (
InputTag = cms.InputTag( "TTStubsFromPhase2TrackerDigis", "StubAccepted" ), # original TTStub selection
BranchAccepted = cms.string ( "StubAccepted" ), ... |
src/genie/libs/parser/junos/tests/ShowSystemQueuesNoForwarding/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 11017456 | <filename>src/genie/libs/parser/junos/tests/ShowSystemQueuesNoForwarding/cli/equal/golden_output_1_expected.py
expected_output = {
"queues-statistics": {
"interface-queues-statistics": {
"interface-queue": [
{
"max-octets-allowed": "12500",
... |
tests/test_cli.py | JulienPalard/bumpversion | 1,289 | 11017457 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import pytest
import sys
import logging
import mock
import argparse
import subprocess
from os import curdir, makedirs, chdir, environ
from os.path import join, curdir, dirname
from shlex import split as shlex_split
from textwrap import d... |
tle/util/db/__init__.py | Bigo-s-cult/TLE | 367 | 11017459 | <filename>tle/util/db/__init__.py
from .cache_db_conn import *
from .user_db_conn import *
|
hc/front/tests/test_add_slack_complete.py | karthikprabhu/healthchecks | 4,813 | 11017467 | <filename>hc/front/tests/test_add_slack_complete.py<gh_stars>1000+
import json
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(SLACK_CLIENT_ID="fake-client-id")
class AddSlackCompleteTestCase(BaseTes... |
lldb/packages/Python/lldbsuite/test/functionalities/memory-region/TestMemoryRegion.py | dan-zheng/llvm-project | 765 | 11017473 | """
Test the 'memory region' command.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class MemoryCommandRegion(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCAS... |
lib/__init__.py | aleenator/plex-for-kodi | 233 | 11017482 | <gh_stars>100-1000
from __future__ import absolute_import
import requests
# Disable some warnings. These are not security issue warnings, but alerts to issues that may cause errors
try:
from requests.packages.urllib3.exceptions import InsecurePlatformWarning, SNIMissingWarning
requests.packages.urllib3.disable... |
composer/optim/__init__.py | moinnadeem/composer | 945 | 11017518 | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""Optimizers and learning rate schedulers.
Composer is compatible with optimizers based off of PyTorch's native :class:`~torch.optim.Optimizer` API, and common
optimizers such
However, where applicable, it is recommended to use the opti... |
build/lib/autosubtakeover/command.py | JordyZomer/autoSubTakeover | 132 | 11017533 | """Collection of autosubtakeover's command line entry points that allow you to start
the program from the command-line"""
import logging
import asyncio
import socket
from typing import Tuple, Union
from datetime import datetime
from contextlib import closing
import click
import aiodns
import tldextract
import tornado... |
tracardi/process_engine/action/v1/operations/write_to_memory/plugin.py | DawidekZagajnik/tracardi | 153 | 11017542 | from tracardi.service.plugin.domain.register import Plugin, Spec, MetaData, Documentation, PortDoc, Form, FormField, \
FormGroup, FormComponent
from tracardi.service.plugin.runner import ActionRunner
from .model.config import Config
from tracardi.service.storage.redis_client import RedisClient
from tracardi.service... |
download.py | self-distilled-stylegan/self-distilled-internet-photos | 106 | 11017609 | <reponame>self-distilled-stylegan/self-distilled-internet-photos<filename>download.py
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... |
geopy/geocoders/tomtom.py | tylerlaws/geopy | 3,259 | 11017612 | <filename>geopy/geocoders/tomtom.py<gh_stars>1000+
from functools import partial
from urllib.parse import quote, urlencode
from geopy.adapters import AdapterHTTPError
from geopy.exc import GeocoderQuotaExceeded
from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
from geopy.location import Location
from geopy.u... |
keep/commands/cmd_completion.py | nfsergiu/keep | 533 | 11017628 | from shlex import quote
import click
from keep import cli, utils
@click.command('completion', short_help='Command completion helper.')
@click.option('--bash', 'shell', flag_value='bash', default=True)
@click.option('--zsh', 'shell', flag_value='zsh')
@cli.pass_context
def cli(ctx, shell):
"""Completion helpers f... |
alipay/aop/api/domain/TaskInfo.py | Anning01/alipay-sdk-python-all | 213 | 11017669 | <filename>alipay/aop/api/domain/TaskInfo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TaskInfo(object):
def __init__(self):
self._earned_point = None
self._task_code = None
self._task_desc = None
self._tas... |
tensorstore/examples/python/beam/pipeline_test.py | stuarteberg/tensorstore | 106 | 11017697 | # Copyright 2020 The TensorStore Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
examples/basic.py | vladimarius/imapy | 269 | 11017736 | # -*- encoding: utf-8 -*-
"""
Shows some basic operations with Imapy
"""
import imapy
box = imapy.connect(
host='host',
username='username',
password='password',
# you may also specify custom port:
# port=993
ssl=True,
)
# get all folder names
folders = box.folders()
""" 'folders' now contai... |
projects/personachat/scripts/languagemodel_opensub2018_interactive.py | mohan-chinnappan-n/ParlAI | 163 | 11017789 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.build_data import download_models
from parlai.core.params import ParlaiParser
from parlai.scripts.intera... |
aries_cloudagent/vc/ld_proofs/crypto/key_pair.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 11017790 | """Base key pair class."""
from abc import ABC, abstractmethod, abstractproperty
from typing import List, Optional, Union
class KeyPair(ABC):
"""Base key pair class."""
@abstractmethod
async def sign(self, message: Union[List[bytes], bytes]) -> bytes:
"""Sign message(s) using key pair."""
@... |
snakemake/modules.py | corneliusroemer/snakemake | 1,326 | 11017807 | <reponame>corneliusroemer/snakemake<gh_stars>1000+
__authors__ = "<NAME>"
__copyright__ = "Copyright 2021, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import types
import re
from snakemake.exceptions import WorkflowError
from snakemake.path_modifier import PathModifier
from snakemake import wrapper
from snakema... |
userbot/core/__init__.py | SonicXsap/Man-Userbot | 144 | 11017815 | from .decorators import check_owner
CMD_INFO = {}
PLG_INFO = {}
GRP_INFO = {}
BOT_INFO = []
LOADED_CMDS = {}
|
examples/src/dbnd_examples/tests/orchestration/tutorial_syntax/test_T12_pandas_numpy.py | busunkim96/dbnd | 224 | 11017829 | import logging
from dbnd.testing.helpers_pytest import assert_run_task
from dbnd_examples.orchestration.tutorial_syntax.T12_data_pandas_and_numpy import (
f_test_pandas_numpy_flow,
)
logger = logging.getLogger(__name__)
class TestTutorialSyntax(object):
def test_pandas_numpy(self):
assert_run_task(... |
external/PyMarchingCubes/examples/spheres.py | maorp/NeuralGraph | 117 | 11017880 | <gh_stars>100-1000
import numpy as np
import marching_cubes as mcubes
print("Example 1: Isosurface in NumPy volume...")
#print(mcubes.__dir__())
# Create a data volume (100 x 100 x 100)
X, Y, Z = np.mgrid[:100, :100, :100]
sdf = (X-50)**2 + (Y-50)**2 + (Z-50)**2 - 25**2
# Extract the 0-isosurface
vertices, triangle... |
torch_glow/tests/nodes/embedding_test.py | YaronBenAtar/glow | 2,838 | 11017881 | <filename>torch_glow/tests/nodes/embedding_test.py
# Copyright (c) Glow Contributors. See CONTRIBUTORS file.
#
# 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/lice... |
benchmarks/user/make-pbs.py | kristiantorres/devito | 204 | 11017882 | import os
import click
from benchmark import option_simulation
import devito
@click.group()
def menu():
pass
@menu.command(name='generate')
@option_simulation
@click.option('-nn', multiple=True, default=[1], help='Number of nodes')
@click.option('-ncpus', default=1, help='Number of cores *per node*') # Shoul... |
native_client_sdk/src/project_templates/init_project.py | Scopetta197/chromium | 212 | 11017893 | <reponame>Scopetta197/chromium<filename>native_client_sdk/src/project_templates/init_project.py<gh_stars>100-1000
#!/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.
"""A simple proje... |
explainer/ebp/ebp.py | jhammelman/visual-attribution | 146 | 11017894 | <filename>explainer/ebp/ebp.py<gh_stars>100-1000
import types
import torch
from explainer.ebp.functions import EBConv2d, EBLinear, EBAvgPool2d
def get_layer(model, key_list):
a = model
for key in key_list:
a = a._modules[key]
return a
class ExcitationBackpropExplainer(object):
def __init__(se... |
autoplotter/app.py | sauceboidk/autoplotter | 169 | 11017906 | <gh_stars>100-1000
import dash_bootstrap_components as dbc
import dash_html_components as html
import dash_core_components as dcc
from .side_navbar import _navbar
from .jupyter_dash import JupyterDash
from .style_sheet import *
from dash.dependencies import Input, Output, State
from .homepage import homepage
f... |
env/lib/python3.8/site-packages/plotly/validators/volume/lighting/__init__.py | acrucetta/Chicago_COVI_WebApp | 11,750 | 11017913 | import sys
if sys.version_info < (3, 7):
from ._vertexnormalsepsilon import VertexnormalsepsilonValidator
from ._specular import SpecularValidator
from ._roughness import RoughnessValidator
from ._fresnel import FresnelValidator
from ._facenormalsepsilon import FacenormalsepsilonValidator
from ... |
v2/i2c/i2c_init.py | Dilepa/micropython-async | 443 | 11017914 | # i2c_init.py Test program for asi2c.py
# Tests Initiator on a Pyboard
# The MIT License (MIT)
#
# Copyright (c) 2018 <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 restric... |
Tools/HIL/reboot.py | lgarciaos/Firmware | 4,224 | 11017958 | <reponame>lgarciaos/Firmware<gh_stars>1000+
#! /usr/bin/env python3
import serial, time
import subprocess
from subprocess import call, Popen
from argparse import ArgumentParser
import re
import sys
import datetime
import serial.tools.list_ports as list_ports
import tempfile
COLOR_RED = "\x1b[31m"
COLOR_GREEN = "\... |
python/python-vba-powerpoint/Win32COM - PowerPoint - Application-Alex-Laptop.py | josephobonyo/sigma_coding_youtube | 893 | 11017962 | <filename>python/python-vba-powerpoint/Win32COM - PowerPoint - Application-Alex-Laptop.py
# import our libraries
import win32com.client
# get the instance of PowerPoint
PPTApp = win32com.client.GetActiveObject("PowerPoint.Application")
# The applicaiton object has different properties about it, so let's explore some ... |
telegram_messages_dump/exporters/common.py | sashabaranov/telegram-messages-dump | 109 | 11017990 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: disable=too-few-public-methods
class common(object):
""" json exporter plugin.
By convention it has to be called exactly the same as its file name.
(Apart from .py extention)
"""
def __init__(self):... |
pygorithm/math/GCD.py | devilcry11/pygorithm | 4,736 | 11018010 | def find_gcd(x, y):
while(y):
x, y = y, x % y
return x
l = [2, 4, 6, 8, 16]
num1 = l[0]
num2 = l[1]
gcd = find_gcd(num1, num2)
for i in range(2, len(l)):
gcd = find_gcd(gcd, l[i])
print(gcd)
|
uchan/view/mod/mod_report.py | alanbato/tchan | 120 | 11018017 | <filename>uchan/view/mod/mod_report.py
from flask import render_template, request, abort, flash, redirect, url_for
from uchan.lib import roles
from uchan.lib.exceptions import BadRequestError, ArgumentError
from uchan.lib.moderator_request import request_moderator
from uchan.lib.service import board_service, moderator... |
python/image-content-search/src/imageData/helper/__init__.py | marclyo/aws-cdk-examples | 2,941 | 11018029 | <gh_stars>1000+
import boto3
import botocore.config
import logging
import os
cluster_arn = os.getenv('CLUSTER_ARN')
credentials_arn = os.getenv('CREDENTIALS_ARN')
db_name = os.getenv('DB_NAME')
aws_config = botocore.config.Config(
region_name = os.getenv('REGION'),
signature_version = 'v4',
retries = {
... |
helpdesk/migrations/0016_alter_model_options.py | AmatorAVG/django-helpdesk-atoria | 789 | 11018040 | <filename>helpdesk/migrations/0016_alter_model_options.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-03-08 17:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0015_expand_permission_name_size'),
]
operations = [
m... |
src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/Languages/sv.py | neurodebian/htcondor | 217 | 11018051 | <filename>src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/Languages/sv.py
apiAttachAvailable = u'API tillg\xe4ngligt'
apiAttachNotAvailable = u'Inte tillg\xe4ngligt'
apiAttachPendingAuthorization = u'Godk\xe4nnande avvaktas'
apiAttachRefused = u'Nekades'
apiAttachSuccess = u'Det... |
trove/tests/unittests/datastore/test_capability.py | a4913994/openstack_trove | 244 | 11018087 | <filename>trove/tests/unittests/datastore/test_capability.py
# Copyright (c) 2014 Rackspace Hosting
#
# 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.o... |
app/grandchallenge/evaluation/migrations/0005_auto_20210423_1305.py | nlessmann/grand-challenge.org | 101 | 11018114 | <filename>app/grandchallenge/evaluation/migrations/0005_auto_20210423_1305.py
# Generated by Django 3.1.8 on 2021-04-23 13:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("evaluation", "0004_auto_20210402_1508"),
]
operations = [
migrations.Al... |
Beginner/Lucky Four (LUCKFOUR)/lucky4.py | anishsingh42/CodeChef | 127 | 11018115 | <filename>Beginner/Lucky Four (LUCKFOUR)/lucky4.py<gh_stars>100-1000
t = int(input())
def convertArray(i):
arr=[]
while i>0:
rem = i % 10
i = int(i / 10)
arr.append(rem)
return arr
while t:
n = int(input())
count = 0
l = convertArray(n)
for i in l:
if ... |
docker/test-with-docker.py | Keendata/impala | 746 | 11018119 | #!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Lice... |
data/nist/preprocess/match_hashes.py | xiby/FedProx | 371 | 11018147 | <filename>data/nist/preprocess/match_hashes.py
import os
import sys
utils_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
utils_dir = os.path.join(utils_dir, 'utils')
sys.path.append(utils_dir)
import utils
parent_path = os.path.dirname(os.path.dirname(os.path.real... |
apps/analyzer/tasks.py | Paul3MK/NewsBlur | 3,073 | 11018152 | from newsblur_web.celeryapp import app
from utils import log as logging
@app.task()
def EmailPopularityQuery(pk):
from apps.analyzer.models import MPopularityQuery
query = MPopularityQuery.objects.get(pk=pk)
logging.debug(" -> ~BB~FCRunning popularity query: ~SB%s" % query)
query.send_email()... |
salina_examples/rl/subspace_of_policies/train.py | wooloo1121/salina | 230 | 11018166 | #
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import random
import hydra
import os
import copy
import torch
from salina import Workspace, instantiate_class
import salina.rl.functional a... |
IOMC/EventVertexGenerators/python/VtxSmearedNominalCollision3_cfi.py | ckamtsikis/cmssw | 852 | 11018167 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import NominalCollision3VtxSmearingParameters,VtxSmearedCommon
VtxSmeared = cms.EDProducer("BetafuncEvtVtxGenerator",
NominalCollision3VtxSmearingParameters,
VtxSmearedCommon
)
|
protect_archiver/downloader/download_motion_event.py | MrStevenFeldman/unifi-protect-video-downloader | 220 | 11018182 | <reponame>MrStevenFeldman/unifi-protect-video-downloader<gh_stars>100-1000
import logging
import os
from protect_archiver.dataclasses import MotionEvent, Camera
from protect_archiver.downloader import download_file
from protect_archiver.utils import make_camera_name_fs_safe
def download_motion_event(
client, mot... |
src/tools/webstudio/app_package/WebStudioApp.py | chen-hwera/rDSN | 953 | 11018245 | from WebStudioLib import *
from WebStudioUtil import *
from WebStudioBase import *
from WebStudioStatic import *
from WebStudioPage import *
from WebStudioApi import *
def start_http_server(portNum):
web_app = webapp2.WSGIApplication([
('/', PageMainHandler),
('/main.html', PageMainHandler),
... |
pysph/solver/vtk_output.py | nauaneed/pysph | 293 | 11018254 | <gh_stars>100-1000
""" Dumps VTK output files.
It takes a hdf or npz file as an input and output vtu file.
"""
from pysph import has_tvtk, has_pyvisfile
from pysph.solver.output import Output, load
from pysph.solver.utils import get_files
import numpy as np
import argparse
import sys
import os
class VTKOutput(Outpu... |
scripts/show_tracking.py | utkarsh-mishra9/SiamFC-TensorFlow | 387 | 11018255 | <filename>scripts/show_tracking.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2017 bily Huazhong University of Science and Technology
#
# Distributed under terms of the MIT license.
import os.path as osp
import sys
from sacred import Experiment
ex = Experiment()
import numpy as np
from matpl... |
backend/lk/views/tracking.py | Purus/LaunchKitDocker | 2,341 | 11018264 | <filename>backend/lk/views/tracking.py
#
# Copyright 2016 Cluster Labs, 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 requ... |
evalml/tests/component_tests/test_lsa.py | Mahesh1822/evalml | 454 | 11018300 | <reponame>Mahesh1822/evalml
import numpy as np
import pandas as pd
import pytest
import woodwork as ww
from pandas.testing import assert_frame_equal
from woodwork.logical_types import (
Boolean,
Categorical,
Double,
Integer,
NaturalLanguage,
)
from evalml.pipelines.components import LSA
from evalml... |
강의 자료/02-알고리즘/15~17-동적 프로그래밍/문제별 코드/1003-피보나치 함수/solution.py | rhs0266/FastCampus | 407 | 11018336 | import sys
sys.setrecursionlimit(100005)
si = sys.stdin.readline
Q = int(si())
dy = [[0, 0] for _ in range(50)]
# dy[][] 를 미리 계산해 놓기
def preprocess():
# dy[i][k] := fibonacci(i) 를 호출했을 때, k 가 출력되는 횟수
dy[0][0], dy[1][1] = 1, 1
for i in range(2, 41):
dy[i][0] = dy[i - 1][0] + dy[i - 2][0]
dy... |
image/plot.py | drobison00/taskflow | 3,457 | 11018337 | <reponame>drobison00/taskflow
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.gridspec as gridspec
# Fixing random state for reproducibility
costs = [5326, 1608, 920]
plt.subplot(131)
x = np.arange(3)
#plt.plot(costs, label='v1 (OpenMP)', color='black')
plt.bar(x, c... |
app/config/celery.py | kaczmarj/grand-challenge.org | 101 | 11018346 | import os
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
celery_app = Celery("grandchallenge")
celery_app.config_from_object("django.conf:settings", namespace="CELERY_")
celery_app.autodiscover_tasks()
|
allennlp_models/vision/models/heads/visual_entailment_head.py | zhiyangxu-umass/allennlp-models | 402 | 11018352 | <gh_stars>100-1000
from typing import Dict, Optional
import torch
from overrides import overrides
from allennlp.data.vocabulary import Vocabulary
from allennlp.models.heads.head import Head
@Head.register("visual_entailment")
class VisualEntailmentHead(Head):
def __init__(self, vocab: Vocabulary, embedding_dim:... |
src/betamax/matchers/host.py | santosh653/betamax | 226 | 11018371 | <filename>src/betamax/matchers/host.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from .base import BaseMatcher
from requests.compat import urlparse
class HostMatcher(BaseMatcher):
# Matches based on the host of the request
name = 'host'
def match(self, request, recorded_request):
request_host = u... |
nova/objects/volume_usage.py | zjzh/nova | 1,874 | 11018415 | # 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
# d... |
sdk/search/azure-search-documents/samples/async_samples/sample_synonym_map_operations_async.py | rsdoherty/azure-sdk-for-python | 2,728 | 11018426 | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------... |
figures/appendix/gaussians3d.py | patricknaughton01/RoboticSystemsBook | 116 | 11018447 | from scipy.stats import norm,multivariate_normal
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.patches import FancyArrowPatch
from matplotlib import cm
from mpl_toolkits.mplot3d import proj3d
import numpy as np
import math
from matplotlib import rc
#rc('font',**{'family':'sans... |
thinc/tests/layers/test_with_debug.py | TheVinhLuong102/thinc | 2,542 | 11018471 | from mock import MagicMock
from thinc.api import with_debug, Linear
def test_with_debug():
on_init = MagicMock()
on_forward = MagicMock()
on_backprop = MagicMock()
model = with_debug(
Linear(), on_init=on_init, on_forward=on_forward, on_backprop=on_backprop
)
on_init.assert_not_called(... |
hippy/module/date/timelib.py | jweinraub/hippyvm | 289 | 11018498 |
""" this imports timelib and specifically parse_date from php's timelib
"""
import py
import time
import subprocess
from rpython.rlib.rarithmetic import intmask
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.rtyper.tool import rffi_platform as platform
from rpython.rtyper.lltypesyste... |
pypyr/__main__.py | mofm/pypyr | 261 | 11018508 | <gh_stars>100-1000
"""Default execution entry point if running the package via python -m."""
import pypyr.cli
import sys
def main():
"""Run pypyr from script entry point."""
return pypyr.cli.main()
if __name__ == '__main__':
sys.exit(main())
|
tests/guinea-pigs/nose/issue_98/custom_test_loader.py | Tirzono/teamcity-messages | 105 | 11018537 | <reponame>Tirzono/teamcity-messages<filename>tests/guinea-pigs/nose/issue_98/custom_test_loader.py
from simple_tests import SimpleTests
from nose.loader import TestLoader
from teamcity.unittestpy import TeamcityTestRunner
if __name__ == '__main__':
test_loader = TestLoader().loadTestsFromTestClass(SimpleTests)
... |
metrics/base.py | manipopopo/TC-ResNet | 185 | 11018581 | from abc import ABC
from collections import defaultdict
from common.utils import get_logger
from common.utils import format_text
from common.utils import timer
class DataStructure(ABC):
"""
Define inner data structure
Should define `_keys`
"""
_keys = None
def __init__(self, data):
k... |
orttraining/orttraining/test/python/orttraining_run_frontend_batch_size_test.py | mszhanyi/onnxruntime | 669 | 11018588 | <reponame>mszhanyi/onnxruntime
import sys
import collections
import subprocess
Config = collections.namedtuple(
"Config",
[
"enable_mixed_precision",
"sequence_length",
"max_batch_size",
"max_predictions_per_seq",
"gelu_recompute",
"attn_dropout_recompute",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.