max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tools/multiscale_shape.py | marvin-eisenberger/hamiltonian-interpolation | 5 | 23300 | import torch
from shape_utils import Shape, load_shape_pair, scatter_shape_pair
from torch_geometric.nn import knn
from param import *
from arap_potential import arap_vert
def load_multiscale_shapes(folder_path, file_name, scales, offset=0.5*torch.ones([3], device=device, dtype=torch.float32)):
"""Like 'load_shap... | 2.171875 | 2 |
src/RBF.py | KastnerRG/sherlock | 0 | 23301 | import numpy as np
import scipy
import scipy.linalg as linalg
import scipy.spatial
import scipy.special
import scipy.optimize
import sklearn
def bases(name):
if name == 'linear':
f = lambda x: x
elif name == 'cubic':
f = lambda x: x**3
elif name == 'multiquadric':
f = lambda x, s: ... | 2.609375 | 3 |
web/pyshop/admin.py | Andrew7891-kip/Ecommerce-pyshop | 0 | 23302 | <filename>web/pyshop/admin.py
from django.contrib import admin
from .models import *
class ProductAdmin(admin.ModelAdmin):
list_display=['name','category','price_is']
prepopulated_fields = {"slug": ("name",)}
class CartAdmin(admin.ModelAdmin):
list_display=['item','user','created']
class OrderAdmin(adm... | 2.109375 | 2 |
extract/tef/incident_reflected_power_test.py | PuffyPuffin/LO_user | 0 | 23303 | <reponame>PuffyPuffin/LO_user<gh_stars>0
"""
Test of the cancellation of terms in the calculation of
tidal energy flux.
This will follow Mofjeld's notation.
F is proportional to the energy flux of the original signal, and
FF is proportional to the sum of the energy fluxes of the incident and
reflected waves.
RESULT:... | 2.5625 | 3 |
tests/test_recipe.py | iruoma/DevCookbook | 20 | 23304 | from recipe_compiler.recipe import Recipe
from recipe_compiler.recipe_category import RecipeCategory
def test_recipe_slug():
# Given
name = "<NAME>"
residence = "Seattle, WA"
category = RecipeCategory("dessert")
recipe_name = '"Pie" Shell Script'
quote = "Hello, World"
ingredients = [""]
... | 2.65625 | 3 |
lms_app/v1/serializers/user_serializers.py | Etomovich/lms-backend | 0 | 23305 | from flask_restplus import Namespace, fields
class UserDataModel(object):
"""Represents the user data transfer object."""
api = Namespace(
'user', description='user authentication and signup resources'
)
this_user = api.model('Register input data', {
'username': fields.String(
... | 2.96875 | 3 |
Unit 7 Objects/LessonQ33.1.py | ItsMrTurtle/PythonChris | 0 | 23306 | <reponame>ItsMrTurtle/PythonChris
# -*- coding: utf-8 -*-
"""
Created on Wed May 27 18:48:24 2020
@author: <NAME>
"""
class Stack(object):
def __init__ (self):
self.stack = []
def get_stack_elements(self):
return self.stack.copy()
def add_one(self, item):
self.stack.append(item)
... | 4.03125 | 4 |
src/data_analysis_util.py | vikramnayyar/Customer-Identification-for-Bank-Marketing | 0 | 23307 | """
The script declares functions used in 'data_analysis.py'
"""
import os
import yaml
from logzero import logger
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.patches import Patch
import plotly.graph_objects as go
from utility import parse_config
config_path = "config/config.yaml"
con... | 2.59375 | 3 |
api/crawller/admin.py | MahsaSeifikar/tweetphus | 0 | 23308 | <filename>api/crawller/admin.py
from django.contrib import admin
from crawller.models import User
# Register your models here.
admin.site.register(User) | 1.46875 | 1 |
featureflags/config.py | enverbisevac/ff-python-server-sdk | 0 | 23309 | """Configuration is a base class that has default values that you can change
during the instance of the client class"""
from typing import Callable
BASE_URL = "https://config.feature-flags.uat.harness.io/api/1.0"
MINUTE = 60
PULL_INTERVAL = 1 * MINUTE
class Config(object):
def __init__(self, base_url: str = BA... | 2.90625 | 3 |
src/users/management/commands/populate_tables.py | pimpale/BQuest-Backend | 0 | 23310 | <filename>src/users/management/commands/populate_tables.py<gh_stars>0
from django.core.management.base import BaseCommand
from users.models import Major, Minor, Course
from django.db import IntegrityError
from os import path
import json
class Command(BaseCommand):
def _create_majors(self):
base_path = pat... | 2.609375 | 3 |
contrib/stack/stripmapStack/unpackFrame_risat_raw.py | vincentschut/isce2 | 1,133 | 23311 | #!/usr/bin/env python3
import isce
from isceobj.Sensor import createSensor
import shelve
import argparse
import os
from isceobj.Util import Poly1D
from isceobj.Planet.AstronomicalHandbook import Const
from mroipac.dopiq.DopIQ import DopIQ
import copy
def cmdLineParse():
'''
Command line parser.
'''
... | 2.078125 | 2 |
distla/distla_core/distla_core/linalg/qr/test_qr_ooc.py | google/distla_core | 2 | 23312 | """Tests for qr.py."""
from jax import lax
import jax.numpy as jnp
import numpy as np
import pytest
import tempfile
from distla_core.linalg.utils import testutils
from distla_core.linalg.qr import qr_ooc
from distla_core.utils import pops
DTYPE = jnp.float32
seeds = [0, 1]
flags = [True, False]
def _dephase_qr(R,... | 2.265625 | 2 |
modules/preprocessing/text/NeMo/nemo_text_processing/text_normalization/ar/taggers/cardinal.py | serkhanekarim/AI | 0 | 23313 | <gh_stars>0
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright 2015 and onwards Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... | 2.203125 | 2 |
robot.py | dragonrobotics/2018-PowerUp | 2 | 23314 | import wpilib
import constants
import swerve
import lift
import winch
import sys
from teleop import Teleop
from autonomous.baseline_simple import Autonomous
from sensors.imu import IMU
def log(src, msg):
try:
full_msg = "[{:.3f}] [{}] {}".format(
wpilib.Timer.getMatchTime(), str(src), str(msg)... | 2.265625 | 2 |
2019/06-hsctf/web-networked/solve.py | wani-hackase/wani-writeup | 25 | 23315 | import requests
text = "0123456789abcdefghijklmnopqrstuvwxyz_}"
flag = "hsctf{"
for _ in range(30):
time = [0.1 for _ in range(38)]
for _ in range(5):
for i in range(38):
payload = {"password": flag + text[i]}
r = requests.post(
"https://networked-password.we... | 2.890625 | 3 |
gda-public/multidim/covertree.py | drkostas/tda_examples | 1 | 23316 | <reponame>drkostas/tda_examples<gh_stars>1-10
r"""This module contains the essential classes for the "Cover-tree with
friends" algorithm, namely:
- :class:`CoverTree`
- :class:`CoverLevel`
This module also defines the constants
- :code:`ratio_Ag` :math:`=\sqrt{2} - 1=0.414\ldots`, the inverse of the silv... | 2.5625 | 3 |
azure-iot-device/azure/iot/device/iothub/models/message.py | elhorton/azure-iot-sdk-python | 1 | 23317 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""This mo... | 2.140625 | 2 |
scraping/test001.py | flaviogf/Exemplos | 0 | 23318 | <filename>scraping/test001.py
import pandas
import requests
with open('avengers.csv', 'w') as file:
file_url = 'https://raw.githubusercontent.com/fivethirtyeight/data/master/avengers/avengers.csv'
response = requests.get(file_url)
file.write(response.text)
with open('avengers.csv', 'r') as file:
data_... | 3.125 | 3 |
backup/guitemplates/custominvocationcutdurationdialog.py | calebtrahan/KujiIn_Python | 0 | 23319 | <reponame>calebtrahan/KujiIn_Python
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'custominvocationcutdurationdialog.ui'
#
# Created by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.Q... | 1.859375 | 2 |
benchmarks/pytorch_alexnet_inference.py | d3dave/python-macrobenchmarks | 20 | 23320 | <gh_stars>10-100
import json
import time
import torch
import urllib
import sys
if __name__ == "__main__":
start = time.time()
model = torch.hub.load('pytorch/vision:v0.6.0', 'alexnet', pretrained=True)
# assert time.time() - start < 3, "looks like we just did the first-time download, run this benchmark aga... | 2.5 | 2 |
Curso Python Completo - Udemy/Teste/core/poo1.py | Cauenumo/Python | 0 | 23321 | # class Circle(object):
# pi = 3.14
# # O círculo é instanciado com um raio (o padrão é 1)
# def __init__(self, radius=1):
# self.radius = radius
# # Método de cálculo da área. Observe o uso de si mesmo.
# def area(self):
# return self.radius * self.radius * Circle.pi
# # Mét... | 4.15625 | 4 |
gen-raw-logs.py | lightoyou/grapl | 0 | 23322 | #!/usr/bin/env python
try:
from typing import Any, Dict, Union, Optional
except:
pass
import time
import string
import boto3
import random
import zstd
import sys
def rand_str(l):
# type: (int) -> str
return ''.join(random.choice(string.ascii_uppercase + string.digits)
for _ in ran... | 2.25 | 2 |
src/bot/lib/economy/economy.py | rdunc/rybot | 1 | 23323 | <filename>src/bot/lib/economy/economy.py<gh_stars>1-10
#!/usr/bin/env python3
import requests, json, threading, sys
import collections, os, time
from bot.lib.economy import EconomyInit
from bot.lib.core.benchmark import Benchmark
from bot.lib.core.log import Log
from bot.helpers.color_helper import ColorHelpe... | 2.53125 | 3 |
CF_Functions/Arcade/WordPower.py | glickmac/Misc_Scripts | 0 | 23324 | <reponame>glickmac/Misc_Scripts
def wordPower(word):
num = dict(zip(string.ascii_lowercase, range(1,27)))
return sum([num[ch] for ch in word])
| 3.640625 | 4 |
python/mapper.py | qoofyk/zipper | 0 | 23325 | <reponame>qoofyk/zipper
import sys
import math
def contiguous_mapper(mpi_rank, mpi_size, num_endpoints):
group_size = math.ceil(mpi_size/num_endpoints) # round up
local_id = mpi_rank % group_size
group_id = mpi_rank // group_size
return (group_id, local_id)
def generate_endpoint_file(endpoint_list, mpi... | 2.921875 | 3 |
src/deepcover.py | nce11/deepcover | 25 | 23326 | <filename>src/deepcover.py
from keras.preprocessing import image
from keras.applications import vgg16
from keras.applications.vgg16 import VGG16
from keras.applications import inception_v3, mobilenet, xception
from keras.models import load_model
import matplotlib.pyplot as plt
import csv
import argparse
import os
imp... | 2.515625 | 3 |
phigaro/cli/batch.py | bobeobibo/phigaro | 31 | 23327 | from __future__ import absolute_import
import argparse
import logging
import multiprocessing
import os
import sys
import uuid
from os.path import join, exists
import yaml
from phigaro.context import Context
from phigaro.batch.runner import run_tasks_chain
from phigaro.batch.task.path import sample_name
from phigaro.... | 2 | 2 |
MachineLearning.BayesianNetwork/python-imp/bayes_core.py | JillyMan/decision-tree | 0 | 23328 | <filename>MachineLearning.BayesianNetwork/python-imp/bayes_core.py<gh_stars>0
import math
RangeType = 'Range'
BinaryType = 'Binary'
class Hipothesis:
def __init__(self, id, name, p):
self.id = id
self.name = name
self.p = p
class Attribute:
def __init__(self, id, name, question, _type... | 2.765625 | 3 |
tests/test_load_bin_log.py | bols-blue-org/pid_evaluation | 1 | 23329 | <gh_stars>1-10
import unittest
from ape.load_bin_log import LoadBinLog
class LoadBinTestCase(unittest.TestCase):
def test_LoadBinLogAll(self):
data = LoadBinLog("../tests/log_0_2020-5-1-14-53-42.bin")
self.assertGreater(len(data), 0, "no data")
def test_LoadBinLogString(self):
data =... | 2.609375 | 3 |
rdsslib/kinesis/client.py | JiscSD/rdss-shared-libraries | 0 | 23330 | <gh_stars>0
import json
import logging
from .errors import MaxRetriesExceededException, DecoratorApplyException
MAX_ATTEMPTS = 6
class KinesisClient(object):
def __init__(self, writer, reader):
"""
Writes and reads messages to and from Kinesis streams
:param writer: handles writing of p... | 2.75 | 3 |
offer/10-qing-wa-tiao-tai-jie-wen-ti-lcof.py | wanglongjiang/leetcode | 2 | 23331 | '''
剑指 Offer 10- II. 青蛙跳台阶问题
一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。
答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。
提示:
0 <= n <= 100
'''
'''
思路:递归
'''
class Solution:
def numWays(self, n: int) -> int:
if n == 0:
return 1
if n == 1:
return 1
if n ... | 3.265625 | 3 |
recipes/libmount/all/conanfile.py | KristianJerpetjon/conan-center-index | 0 | 23332 | from conans import ConanFile, tools, AutoToolsBuildEnvironment
from conans.errors import ConanInvalidConfiguration
import os
class LibmountConan(ConanFile):
name = "libmount"
description = "The libmount library is used to parse /etc/fstab, /etc/mtab and /proc/self/mountinfo files, manage the mtab file, evalua... | 2.15625 | 2 |
code/tmp_rtrip/nntplib.py | emilyemorehouse/ast-and-me | 24 | 23333 | """An NNTP client class based on:
- RFC 977: Network News Transfer Protocol
- RFC 2980: Common NNTP Extensions
- RFC 3977: Network News Transfer Protocol (version 2)
Example:
>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print('Group', name, 'ha... | 3.09375 | 3 |
tests/required_with_test.py | roypeters/spotlight | 9 | 23334 | <gh_stars>1-10
from src.spotlight.errors import REQUIRED_WITH_ERROR
from .validator_test import ValidatorTest
class RequiredWithTest(ValidatorTest):
def setUp(self):
self.other_field = "test1"
self.field = "test2"
self.required_with_error = REQUIRED_WITH_ERROR.format(
field=sel... | 3.03125 | 3 |
default-approach/data-collection/harpers-data/scraper_scripts/get-harpers-links.py | the-browser/recommending-interesting-writing | 5 | 23335 | BASE_URL="https://harpers.org/sections/readings/page/"
N_ARTICLE_LINK_PAGES = 50
OUTPUT_FILE = 'harpers-later-urls.json'
WORKER_THREADS = 32
import json
import datetime
import dateutil.parser
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from datetime import datetime
from newspaper imp... | 2.921875 | 3 |
rulm/models/neural_net/encoder_only.py | IlyaGusev/rulm | 0 | 23336 | from typing import Dict
import numpy as np
import torch
from torch.nn.functional import linear, log_softmax, embedding
from torch.nn import Dropout, LogSoftmax, NLLLoss
from allennlp.common import Params
from allennlp.models.model import Model
from allennlp.data.vocabulary import Vocabulary, DEFAULT_PADDING_TOKEN
from... | 2.234375 | 2 |
api/queries/models.py | django-doctor/lite-api | 3 | 23337 | <gh_stars>1-10
from api.cases.models import Case
class Query(Case):
"""
Base query class
"""
pass
| 1.367188 | 1 |
src/scs_airnow/cmd/cmd_csv_join.py | south-coast-science/scs_airnow | 0 | 23338 | """
Created on 22 Feb 2019
@author: <NAME> (<EMAIL>)
source repo: scs_analysis
"""
import optparse
# --------------------------------------------------------------------------------------------------------------------
class CmdCSVJoin(object):
"""unix command line handler"""
def __init__(self):
"... | 2.234375 | 2 |
test/receive_message.py | unknown-admin/easymq | 1 | 23339 | <filename>test/receive_message.py<gh_stars>1-10
import os
from easymq.mq import MQ
def receive(headers, body):
print("---->", body)
mq = MQ(
mq_user=os.environ.get("mq_user"),
password=os.environ.get("password"),
host_and_ports=[
(os.environ.get("host"), os.environ.get("port")),
],
... | 2.34375 | 2 |
test/unit/agent/common/util/text.py | dp92987/nginx-amplify-agent | 308 | 23340 | <reponame>dp92987/nginx-amplify-agent
# -*- coding: utf-8 -*-
from hamcrest import *
from test.base import BaseTestCase
from amplify.agent.common.util.text import (
decompose_format, parse_line, parse_line_split
)
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__... | 2.015625 | 2 |
test/adb_test.py | bugobliterator/python-adb | 1,549 | 23341 | <reponame>bugobliterator/python-adb
#!/usr/bin/env python
# Copyright 2014 Google 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/licen... | 2.3125 | 2 |
06_Statistik_und_Wahrscheinlichkeiten/Aufgabe.py | felixdittrich92/numerisches_python | 0 | 23342 | <gh_stars>0
from random import randint
import numpy as np
from collections import Counter
from pprint import pprint
import time
# Aufgaben Siehe Buch
print('-------------Aufgabe 1-------------')
outcomes = [ randint(1,6) for _ in range(10000)]
even_pips = [ x for x in outcomes if x % 2 == 0]
greater_two = [ x for x i... | 3.4375 | 3 |
lib_dsp/iir/iir/design/iir.py | PyGears/lib-dsp | 3 | 23343 | <gh_stars>1-10
from pygears import gear, Intf
from pygears.lib import dreg, decouple, saturate, qround
@gear
def iir_1dsos(din, *, a, b, gain):
# add input gain and init delayed inputs
zu0 = din * gain
zu1 = zu0 | dreg(init=0)
zu2 = zu1 | dreg(init=0)
# perform b coefficient sum
a1 = (zu1 * ... | 2.34375 | 2 |
read_iceye_h5.py | eciraci/iceye_gamma_proc | 0 | 23344 | <gh_stars>0
#!/usr/bin/env python
u"""
read_iceye_h5.py
Written by <NAME>' (03/2022)
Read ICEYE Single Look Complex and Parameter file using GAMMA's Python
integration with the py_gamma module.
usage: read_iceye_h5.py [-h] [--directory DIRECTORY]
TEST: Read ICEye Single Look Complex and Parameter.
optional argument... | 2.203125 | 2 |
scripts/baxter_find_tf.py | mkrizmancic/qlearn_baxter | 4 | 23345 | <filename>scripts/baxter_find_tf.py
#!/usr/bin/env python
"""Calculate transformation matrices and broadcast transform from robot's base to head markers."""
import rospy
import tf
import math
from PyKDL import Vector, Frame, Rotation
if __name__ == '__main__':
rospy.init_node('baxter_find_transformation')
lis... | 2.1875 | 2 |
car/migrations/0004_sale_cc.py | jobkarani/carnect | 0 | 23346 | # Generated by Django 3.2.9 on 2022-01-10 12:39
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('car', '0003_auto_20220110_1507'),
]
operations = [
migrations.AddField(
model_name='sale',
... | 1.695313 | 2 |
src/prepare_data/task_prepare_r_effective_by_rki.py | covid-19-impact-lab/sid-germany | 4 | 23347 | import pandas as pd
import pytask
from src.config import BLD
@pytask.mark.depends_on(BLD / "data" / "raw_time_series" / "reproduction_number.csv")
@pytask.mark.produces(BLD / "data" / "processed_time_series" / "r_effective.pkl")
def task_prepare_rki_r_effective_data(depends_on, produces):
df = pd.read_csv(depend... | 2.40625 | 2 |
conv.py | aenco9/HCAP2021 | 0 | 23348 | <gh_stars>0
import numpy as np
def convolucion(Ioriginal, kernel):
'''Método encargado de realizar una convolución a una imagen
Entrada:
Ioriginal - imagen original en forma de matríz
kernel - kernel para barrer la imagen
Salida:
res - imagen resultante'''
#fr - filas, cr - columnas
fr = len(Ioriginal)-(len(k... | 2.828125 | 3 |
setup.py | viatoriche/vtr_utils | 0 | 23349 | <gh_stars>0
import os
from distutils.core import setup
from setuptools import find_packages
package = 'vtr_utils'
version = "0.1.0"
packages = find_packages()
def get_package_data(package):
"""
Return all files under the root package, that are not in a
package themselves.
"""
walk = [(dirpath.re... | 1.9375 | 2 |
radical_translations/agents/tests/test_models.py | kingsdigitallab/radical_translations | 3 | 23350 | from collections import defaultdict
import pytest
from radical_translations.agents.models import Organisation, Person
pytestmark = pytest.mark.django_db
@pytest.mark.usefixtures("vocabulary")
class TestOrganisation:
def test_agent_type(self, title):
obj = Person(name="<NAME>")
obj.save()
... | 2.484375 | 2 |
addons/website_sale_coupon/controllers/main.py | SHIVJITH/Odoo_Machine_Test | 0 | 23351 | <reponame>SHIVJITH/Odoo_Machine_Test
# -*- coding: utf-8 -*-
from odoo import http
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.http import request
class WebsiteSale(WebsiteSale):
@http.route(['/shop/pricelist'])
def pricelist(self, promo, **post):
order = request.websi... | 2.03125 | 2 |
go/apps/http_api/tests/test_views.py | lynnUg/vumi-go | 0 | 23352 | from go.apps.tests.view_helpers import AppViewsHelper
from go.base.tests.helpers import GoDjangoTestCase
class TestHttpApiViews(GoDjangoTestCase):
def setUp(self):
self.app_helper = self.add_helper(AppViewsHelper(u'http_api'))
self.client = self.app_helper.get_client()
def test_show_stopped(... | 2.21875 | 2 |
PyPowerStore/utils/helpers.py | dell/python-powerstore | 15 | 23353 | # -*- coding: utf-8 -*-
# Copyright: (c) 2019-2021, Dell EMC
"""Helper module for PowerStore"""
import logging
from pkg_resources import parse_version
provisioning_obj = None
def set_provisioning_obj(val):
global provisioning_obj
provisioning_obj = val
def prepare_querystring(*query_arguments, **kw_query_... | 2.265625 | 2 |
minidump/streams/MiscInfoStream.py | lucasg/minidump | 1 | 23354 | <gh_stars>1-10
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import io
import enum
#https://msdn.microsoft.com/en-us/library/windows/desktop/ms680388(v=vs.85).aspx
class MinidumpMiscInfo2Flags1(enum.IntFlag):
MINIDUMP_MISC1_PROCESS_ID = 0x00000001 #ProcessId is used.
MINIDUMP_MISC1_PROCESS_TIMES = 0x000... | 2.171875 | 2 |
test/python/transpiler/test_transpile.py | filemaster/qiskit-terra | 0 | 23355 | # -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=redefined-builtin
"""Tests basic functionality of the transpile function"""
from qiskit import QuantumReg... | 2.265625 | 2 |
repiko/module/calculator.py | liggest/RepiKoBot | 1 | 23356 | <gh_stars>1-10
import random
class Calculator():
symbol=["+","-","*","/","(",")"]
def __init__(self):
pass
def cal(self,s):
if self.isnumber(s[0]):
return s
elif s[0]=="error":
return ["error",s[1]]
elif "(" in s[0] or ")" in s[0]: #or "^" in s[0]:
... | 3.3125 | 3 |
tests/retrieve/test_segment.py | openghg/openghg | 5 | 23357 | <gh_stars>1-10
# import os
# import uuid
# import numpy as np
# import pandas as pd
# import pytest
# mocked_uuid = "00000000-0000-1111-00000-000000000000"
# @pytest.fixture(scope="session")
# def data():
# filename = "bsd.picarro.1minute.248m.dat"
# dir_path = os.path.dirname(__file__)
# test_data = ... | 2.046875 | 2 |
setup.py | jjhelmus/break_my_python | 0 | 23358 | <filename>setup.py
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name='break_my_python',
version='0.0.2',
description='This package tries to breaks your python interpreter, do not install it',
long_description=long_description,
author='<NAME>',
... | 1.4375 | 1 |
n4ofunc/comp.py | noaione/n4ofunc | 4 | 23359 | """
MIT License
Copyright (c) 2020-present noaione
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | 2.109375 | 2 |
mpas_analysis/ocean/time_series_sst.py | alicebarthel/MPAS-Analysis | 0 | 23360 | # This software is open source software available under the BSD-3 license.
#
# Copyright (c) 2020 Triad National Security, LLC. All rights reserved.
# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights
# reserved.
# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved.
#
# Additional copyright... | 2 | 2 |
codes/data_scripts/test_dataloader.py | DengpanFu/mmsr | 0 | 23361 | import sys
import os.path as osp
import math
import torchvision.utils
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from data import create_dataloader, create_dataset # noqa: E402
from utils import util # noqa: E402
def main():
dataset = 'REDS' # REDS | Vimeo90K | DIV2K800_sub
opt = {}
... | 2.203125 | 2 |
python/iceberg/api/transforms/transforms.py | moulimukherjee/incubator-iceberg | 58 | 23362 | # 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
# "License"); you may not u... | 2 | 2 |
biocodes/re_eval.py | yjc9696/biobert-my | 0 | 23363 | <filename>biocodes/re_eval.py
import argparse
import numpy as np
import pandas as pd
import sklearn.metrics
import sklearn.metrics
parser = argparse.ArgumentParser(description='')
parser.add_argument('--output_path', type=str, help='')
parser.add_argument('--answer_path', type=str, help='')
parser.add_argument('--tas... | 2.390625 | 2 |
mysite/ChainLicense/apps.py | Hwieun/ChainLicense | 2 | 23364 | from django.apps import AppConfig
class ChainlicenseConfig(AppConfig):
name = 'ChainLicense'
| 1.03125 | 1 |
tests/test_find_deployment.py | Suremaker/consul-deployment-agent | 6 | 23365 | # Copyright (c) Trainline Limited, 2016-2017. All rights reserved. See LICENSE.txt in the project root for license information.
from os.path import join
import unittest
from mock import patch
from agent.find_deployment import find_deployment_dir_win
class Fake(object):
def __init__(self, **kwargs):
self._... | 2.296875 | 2 |
model/embeddings.py | johnnytorres/crisis_conv_crosslingual | 0 | 23366 | import os
import logging
import argparse
import numpy as np
import tensorflow as tf
from keras_preprocessing.text import Tokenizer
from tqdm import tqdm
from data import DataLoader
class EmbeddingsBuilder:
def __init__(self, args):
logging.info('initializing...')
self.args = args
self.da... | 2.59375 | 3 |
bin/ADFRsuite/CCSBpckgs/mglkey/__init__.py | AngelRuizMoreno/Jupyter_Dock_devel | 0 | 23367 | #############################################################################
#
# Author: <NAME>
#
# Copyright: <NAME> and TSRI 2015
#
#########################################################################
#
# $Header: /mnt/raid/services/cvs/mglkeyDIST/mglkey/__init__.py,v 1.1.1.1 2016/12/07 23:27:34 sanner Exp $
#
... | 1.617188 | 2 |
source/rttov_test/profile-datasets-py/div83/027.py | bucricket/projectMAScorrection | 0 | 23368 | <reponame>bucricket/projectMAScorrection
"""
Profile ../profile-datasets-py/div83/027.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div83/027.py"
self["Q"] = numpy.array([ 1.51831800e+00, 2.02599600e+00, 2.94787100e+00,
3.99669400e+00, 4.716538... | 1.875 | 2 |
stanCode_Projects/break_out_game/breakoutgraphics.py | kunyi1022/sc-projects | 0 | 23369 | """
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>
File: breakoutgraphics.py
Name: <NAME>
-------------------------
This python file will create a class named BreakoutGraphics for the break out game.
This class will contain the building block for creating that game.
"""... | 3.84375 | 4 |
PythonExercicios/ex020.py | github-felipe/ExerciciosEmPython-cursoemvideo | 0 | 23370 | <filename>PythonExercicios/ex020.py
from random import shuffle
a1 = str(input('Digite o nome de um aluno: '))
a2 = str(input('Digite o nome de outro aluno: '))
a3 = str(input('Digite o nome de mais outro aluno: '))
a4 = str(input('Digite o nome do último aluno: '))
lista = [a1, a2, a3, a4]
shuffle(lista)
print(f'A orde... | 3.59375 | 4 |
okta/models/profile_enrollment_policy_rule_action.py | ander501/okta-sdk-python | 0 | 23371 | # flake8: noqa
"""
Copyright 2021 - Present Okta, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | 1.773438 | 2 |
test/test_compression.py | Peter42/iasi | 0 | 23372 | import datetime
import unittest
import luigi
import numpy as np
from netCDF4 import Dataset
from iasi.compression import (CompressDataset, CompressDateRange,
DecompressDataset)
class TestCompression(unittest.TestCase):
def test_dataset_compression(self):
task = CompressDat... | 2.296875 | 2 |
bird_classify.py | google-coral/project-birdfeeder | 26 | 23373 | # Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.109375 | 2 |
memory/test/test_memory.py | MaxGreil/hail | 789 | 23374 | import unittest
import uuid
from memory.client import MemoryClient
from hailtop.aiocloud.aiogoogle import GoogleStorageAsyncFS
from hailtop.config import get_user_config
from hailtop.utils import async_to_blocking
from gear.cloud_config import get_gcp_config
PROJECT = get_gcp_config().project
class BlockingMemoryC... | 2.046875 | 2 |
feladatok.py | python-feladatok-tesztekkel/-05-02-01-fuggvenyek-halado | 0 | 23375 | # feladat.py
# 1. feladat
# Írjon függvényt szokoev_e néven
# A függvény térjen vissza igaz értékkel, ha a paraméterben megadott évszám szőköév
def szokoev_e(ev:int) -> bool:
# 2. feladat
# A függvény bemenő paraméterei az a, b, c egész számok
# Írjon kódot amely eredményeként az a változóba lesz a legnagyobb szám,... | 2.78125 | 3 |
bin/pymodules/objectedit/__init__.py | mattire/naali | 1 | 23376 | <filename>bin/pymodules/objectedit/__init__.py
#from editgui import EditGUI
#from only_layout import OnlyLayout as EditGUI
| 1.257813 | 1 |
audiomate/processing/pipeline/onset.py | CostanzoPablo/audiomate | 133 | 23377 | import librosa
import numpy as np
from . import base
from . import spectral
class OnsetStrength(base.Computation):
"""
Compute a spectral flux onset strength envelope.
Based on http://librosa.github.io/librosa/generated/librosa.onset.onset_strength.html
Args:
n_mels (int): Number of mel ban... | 2.6875 | 3 |
friction_ramp_analysis/classes/callForceRampGUI.py | JSotres/AFM-Friction-Ramp-Analysis | 0 | 23378 | from PyQt5.QtWidgets import QMainWindow, QApplication, QFileDialog
import sys
from .readNanoscopeForceRamps import *
import matplotlib.pyplot as plt
from ..qt5_ui_files.ForceRampGUI import *
from matplotlib.backends.backend_qt5agg import (NavigationToolbar2QT as NavigationToolbar)
import os
import math
from ..qt5_ui_fi... | 2.34375 | 2 |
onebarangay_psql/users/tests/test_admin.py | PrynsTag/oneBarangay-PostgreSQL | 0 | 23379 | """Create your tests for the admin app here."""
import pytest
from django.contrib.auth import get_user_model
from django.urls import reverse
pytestmark = pytest.mark.django_db
User = get_user_model()
class TestUserAdmin:
"""Test the admin interface."""
def test_changelist(self, admin_client):
"""Tes... | 2.703125 | 3 |
neuroscout/resources/dataset.py | jdkent/neuroscout | 5 | 23380 | from flask_apispec import MethodResource, marshal_with, doc, use_kwargs
from webargs import fields
from ..models import Dataset
from ..core import cache
from .utils import first_or_404
from ..schemas.dataset import DatasetSchema
class DatasetResource(MethodResource):
@doc(tags=['dataset'], summary='Get dataset by... | 2.03125 | 2 |
tests/test_measures.py | lanxuedang/TIGER | 88 | 23381 | import numpy as np
from graph_tiger.graphs import o4_graph, p4_graph, c4_graph, k4_1_graph, k4_2_graph
from graph_tiger.graphs import two_c4_0_bridge, two_c4_1_bridge, two_c4_2_bridge, two_c4_3_bridge
from graph_tiger.measures import run_measure
def test_measures():
measure_ground_truth = { # graph order: o4,... | 1.945313 | 2 |
AuroraAppCode/login.py | zahraahhajhsn/automatic-student-counter | 0 | 23382 | <filename>AuroraAppCode/login.py
import verifyController
import pyodbc
from PyQt5.QtWidgets import QMessageBox
from PyQt5 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import (QCoreApplication, QMetaObject,QSize,Qt)
from PySide2.QtGui import (QCursor, QFont,QIcon)
from PySide2.QtWidgets import *
from PyS... | 2.0625 | 2 |
ml/association/apriori.py | thorwhalen/ut | 4 | 23383 | """Association mining -- apriori algo"""
__author__ = 'thor'
from numpy import *
# Modified from:
# <NAME> & <NAME> (https://github.com/cse40647/cse40647/blob/sp.14/10%20-%20Apriori.ipynb)
#
# Itself Modified from:
# <NAME> (https://gist.github.com/marcelcaraciolo/1423287)
#
# Functions to compute and extract associ... | 3.109375 | 3 |
setup.py | TechAtNYU/api-python | 0 | 23384 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
description='Tech@NYU API Python Client',
author='TechatNYU',
url='https://github.com/TechAtNYU/pytnyu',
author_email='<EMAIL>',
version='0.0.4',
install_requires=['requests'],
namespace_pa... | 1.359375 | 1 |
hardware/max7219.py | gcurtis79/letsrobot | 26 | 23385 | import spidev
columns = [0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8]
LEDOn = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]
LEDOff = [0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
LEDEmoteSmile = [0x0,0x0,0x24,0x0,0x42,0x3C,0x0,0x0]
LEDEmoteSad = [0x0,0x0,0x24,0x0,0x0,0x3C,0x42,0x0]
LEDEmoteTongue = [0x0,0x0,0x24,0x0,0x42,0x3C,0xC,0x0]
LEDEmoteS... | 2.125 | 2 |
kkl_wikicommons_upload.py | wmilbot/wikiscraper | 3 | 23386 | #!/usr/bin/env python
from datapackage_pipelines.wrapper import ingest, spew
import logging, collections
from pipeline_params import get_pipeline_param_rows
from google.cloud import storage
from contextlib import contextmanager
from tempfile import mkdtemp
import os
import pywikibot
import time
from pywikibot.pagegener... | 1.976563 | 2 |
Badger/scripts/besdirac-wms-decaycard-get.py | zhangxt-ihep/IHEPDIRAC | 0 | 23387 | #!/usr/bin/env python
import DIRAC
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Base import Script
Script.setUsageMessage( """
Insert random trigger file into the File Catalog
Usage:
%s [option] lfn
""" % Script.scriptName )
fcType = 'FileCatalog'
Script.parseCommandLine( ignoreErrors = False )
options = S... | 2.21875 | 2 |
GraphSAGE/fix.py | attre2vec/attre2vec | 0 | 23388 | <filename>GraphSAGE/fix.py
import pickle
import networkx as nx
import numpy as np
import torch
for name in ('cora', 'citeseer', 'pubmed'):
with open(f'data/datasets/{name}.pkl', 'rb') as fin:
dataset = pickle.load(fin)
test_graph = dataset['original_graph']
e2i = dataset['edge2idx']
H = data... | 2.375 | 2 |
finder.py | giuseppebrb/Pynder | 3 | 23389 | <gh_stars>1-10
import os
import fnmatch
import smtplib
import email.mime.application
import sys
import subprocess
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from pathlib import Path
home = str(Path.home()) # Return a string representing the user’s home directory
fileFound = 0... | 2.78125 | 3 |
sushy/tests/unit/resources/fabric/test_endpoint.py | sapcc/sushy | 37 | 23390 | <filename>sushy/tests/unit/resources/fabric/test_endpoint.py
# 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 requir... | 1.867188 | 2 |
engine/core/it_singleton.py | torrotitans/torro_community | 1 | 23391 | #!/usr/bin/python
# -*- coding: UTF-8 -*
from db.it.db_it_mgr import it_mgr
__all__ = {"itSingleton"}
class itSingleton():
def get_cmd_sql(self, sql):
return it_mgr.get_cmd_sql(sql)
it_singleton = itSingleton()
| 2.453125 | 2 |
analyses/seasonality_paper_st/lai_only/shap_interaction/model_analysis_shap_interaction_1.py | akuhnregnier/wildfire-analysis | 0 | 23392 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from pathlib import Path
from wildfires.utils import handle_array_job_args
try:
# This will only work after the path modification carried out in the job script.
from specific import (
CACHE_DIR,
SimpleCache,
get_model... | 1.90625 | 2 |
tests/test_res_grp_config.py | danos/vplane-config-npf | 0 | 23393 | #!/usr/bin/env python3
# Copyright (c) 2019, AT&T Intellectual Property.
# All rights reserved.
#
# SPDX-License-Identifier: LGPL-2.1-only
#
"""
Unit-tests for the qos_config.py module.
"""
from vyatta.res_grp.res_grp_config import ResGrpConfig
TEST_DATA = {
'vyatta-resources-v1:resources': {
'vyatta-re... | 1.929688 | 2 |
fandango/objects.py | rhomspuron/fandango | 0 | 23394 | <gh_stars>0
#!/usr/bin/env python2.5
#############################################################################
##
## file : objects.py
##
## description : see below
##
## project : Tango Control System
##
## $Author: <EMAIL>, <EMAIL>, <EMAIL> $
##
##
## $Revision: 2008 $
##
## copyleft : ALBA Synchrot... | 1.78125 | 2 |
vdvae_flax/blocks.py | shaun95/google-research | 23,901 | 23395 | <reponame>shaun95/google-research
# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited and the Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | 2.453125 | 2 |
test_hrm_code.py | liameirose/bme590hrm | 0 | 23396 | import pytest
import json
import numpy as np
@pytest.mark.parametrize("candidate, expected", [
(1.345, True),
(-4.554, True),
('9999', True)
])
def test_number_please(candidate, expected):
from hrm_code import number_please
assert number_please(candidate) == expected
def test_import_data():
... | 2.484375 | 2 |
core/migrations/0044_auto_20190510_0921.py | raheemazeezabiodun/art-backend | 4 | 23397 | # Generated by Django 2.1.7 on 2019-05-10 09:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0043_auto_20190424_1029'),
]
operations = [
migrations.RemoveField(
model_name='statetransition',
name='stat... | 1.6875 | 2 |
postgres_connector/splitters.py | sandboxws/beam-postgres-connector | 0 | 23398 | <reponame>sandboxws/beam-postgres-connector
import re
from abc import ABCMeta, abstractmethod
from datetime import datetime
from typing import Callable, Iterator
from apache_beam.io import iobase
from apache_beam.io.range_trackers import (LexicographicKeyRangeTracker,
OffsetR... | 1.875 | 2 |
apis/python_interface_helpers/stk_env.py | davetrollope-fsml/sequence_toolkit | 0 | 23399 | from stk_sequence import *
from stk_tcp_server import *
from stk_tcp_client import *
from stk_data_flow import *
from stk_options import stk_clear_cb
import time
class stk_callback:
def __init__(self):
self._caller = None
self._mapobj = None
pass
def add_callback_ref(self,caller):
self._caller = caller
def ... | 1.992188 | 2 |