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 |
|---|---|---|---|---|---|---|
ddot/api.py | agary-ucsd/ddot | 0 | 24000 | <reponame>agary-ucsd/ddot<gh_stars>0
import sys
import argparse
import bottle
import pandas as pd
from bottle import Bottle, HTTPError, request
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
from ddot import Ontology
import tempfile
import os
import csv
path_this = os.path.di... | 2.25 | 2 |
testing/logging/test_formatter.py | christian-steinmeyer/pytest | 4 | 24001 | import logging
from typing import Any
from _pytest._io import TerminalWriter
from _pytest.logging import ColoredLevelFormatter
def test_coloredlogformatter() -> None:
logfmt = "%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s"
record = logging.LogRecord(
name="dummy",
level=logging.IN... | 2.359375 | 2 |
crystaltoolgui/tabs/tabresmatcher.py | jingshenSN2/CrystalTool | 0 | 24002 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'tabresmatcher.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore... | 1.9375 | 2 |
src/bioregistry/export/cli.py | biopragmatics/bioregistry | 17 | 24003 | # -*- coding: utf-8 -*-
"""Export the Bioregistry."""
import click
@click.command()
@click.pass_context
def export(ctx: click.Context):
"""Export the Bioregistry."""
from .prefix_maps import generate_contexts
from .rdf_export import export_rdf
from .sssom_export import export_sssom
from .tables_... | 1.703125 | 2 |
tests/test_main.py | brettcannon/release-often | 8 | 24004 | <reponame>brettcannon/release-often<gh_stars>1-10
import json
from unittest import mock
import gidgethub.abc
import pytest
from release_often import __main__ as main
class TestMatchingPR:
@pytest.mark.asyncio
async def test_pr_found(self, data_path):
"""Test when a PR number is specified in the init... | 2.375 | 2 |
src/ezdxf/path/tools.py | dmtvanzanten/ezdxf | 0 | 24005 | # Copyright (c) 2020-2021, <NAME>
# License: MIT License
from typing import (
TYPE_CHECKING,
List,
Iterable,
Tuple,
Optional,
Dict,
Sequence,
)
import math
import itertools
from ezdxf.math import (
Vec3,
Z_AXIS,
OCS,
Matrix44,
BoundingBox,
ConstructionEllipse,
cu... | 2.078125 | 2 |
LeetCodeSolutions/python/322_Coin_Change.py | ChuanleiGuo/AlgorithmsPlayground | 1 | 24006 | <reponame>ChuanleiGuo/AlgorithmsPlayground
class Solution(object):
def coinChange(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
dp = [0] + [2 ** 31 - 1] * amount
for i in xrange(1, amount + 1):
for coin in coins... | 3.078125 | 3 |
14_TokenAuthentication/userpost/serializer.py | LIkelion-at-KOREATECH/LikeLion_Django_Study_Summary | 28 | 24007 | <gh_stars>10-100
from .models import UserPost
from rest_framework import serializers
class UserPostSerializer(serializers.ModelSerializer):
author_name = serializers.ReadOnlyField(
source='author.username'
)
class Meta:
model = UserPost
fields = [
'pk',
'a... | 2.15625 | 2 |
app/cogs/base/__init__.py | fossabot/Starboard-2 | 16 | 24008 | from app.classes.bot import Bot
from . import base_commands, base_events
def setup(bot: Bot):
base_commands.setup(bot)
base_events.setup(bot)
| 1.734375 | 2 |
model/combination_file.py | dokzai/WholeFoodsFrugality | 42 | 24009 | import model
from model import whole_foods_sale
from model import aldis_au_sale
from model import aldis_us_sale
from model import aldis_uk_sale
def go(inputs, store_name):
if store_name == 'WholeFoods':
final_df = whole_foods_sale.items_on_sale()
elif store_name == 'Aldi AU':
final_df = aldis_au_sale.items_on_s... | 2.390625 | 2 |
generalRunFiles/tideCompare.py | wesleybowman/karsten | 1 | 24010 | from __future__ import division
import numpy as np
import pandas as pd
import netCDF4 as nc
from datetime import datetime, timedelta
import cPickle as pickle
import sys
sys.path.append('/home/wesley/github/UTide/')
from utide import ut_solv
import scipy.io as sio
from stationClass import station
def mjd2num(x):
y... | 2.03125 | 2 |
gff/Scripts/gff/gff_to_genbank.py | bgruening/bcbb | 339 | 24011 | <reponame>bgruening/bcbb
#!/usr/bin/env python
"""Convert a GFF and associated FASTA file into GenBank format.
Usage:
gff_to_genbank.py <GFF annotation file> [<FASTA sequence file> <molecule type>]
FASTA sequence file: input sequences matching records in GFF. Optional if sequences
are in the GFF
molecule typ... | 3.078125 | 3 |
hard-gists/5267494/snippet.py | jjhenkel/dockerizeme | 21 | 24012 | <filename>hard-gists/5267494/snippet.py
import webapp2
from twilio import twiml
from twilio.rest import TwilioRestClient
class SendSMS(webapp2.RequestHandler):
def get(self):
# replace with your credentials from: https://www.twilio.com/user/account
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"... | 2.65625 | 3 |
app/calc/permissions.py | sajeeshen/WebCalculatorAPI | 0 | 24013 | <reponame>sajeeshen/WebCalculatorAPI<gh_stars>0
from rest_framework import permissions
class IsSuperUser(permissions.IsAdminUser):
def has_permission(self, request, view):
is_admin = super().has_permission(request, view)
return request.method in permissions.SAFE_METHODS or is_admin
class IsUser... | 2.359375 | 2 |
src/eduid_graphdb/exceptions.py | SUNET/eduid-groupdb | 1 | 24014 | <reponame>SUNET/eduid-groupdb
# -*- coding: utf-8 -*-
__author__ = 'lundberg'
class EduIDGroupDBError(Exception):
pass
class VersionMismatch(EduIDGroupDBError):
pass
class MultipleReturnedError(EduIDGroupDBError):
pass
class MultipleUsersReturned(MultipleReturnedError):
pass
class MultipleGro... | 1.585938 | 2 |
pyledserver/mqtt/client.py | oct0f1sh/PyLEDServer | 1 | 24015 | import json
import logging
import mqtt.callbacks as mqtt_util
import paho.mqtt.client as mqtt
logger = logging.getLogger('pyledserver.PyLEDClient')
logger.setLevel(logging.DEBUG)
class PyLEDClient(mqtt.Client):
def __init__(self, client_id, credentials, mqtt_topic, led_strip):
logger.debug('Creating clie... | 2.453125 | 2 |
pilco/policies/transformed_policy.py | sbrml/pilco | 0 | 24016 | from pilco.policies.policy import Policy
import tensorflow as tf
class TransformedPolicy(Policy):
def __init__(self,
policy,
transform,
name="sine_bounded_action_policy",
**kwargs):
super().__init__(state_dim=policy.state_dim,
... | 2.234375 | 2 |
src/petronia/defimpl/configuration/file/defs.py | groboclown/petronia | 19 | 24017 | <reponame>groboclown/petronia
"""
Basic type definitions.
"""
| 1.15625 | 1 |
clone-zadara-volume.py | harvard-dce/mh-backup | 0 | 24018 | <filename>clone-zadara-volume.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import logging
import logging.config
import logging.handlers
import yaml
from zadarest import ZConsoleClient
from zadarest import ZVpsaClient
logger = None
def setup_logging( log_conf=None ):
if log_conf is Non... | 2.203125 | 2 |
env/Lib/site-packages/bidict/_typing.py | NXPY123/gsoc-tagger | 9 | 24019 | <reponame>NXPY123/gsoc-tagger
# -*- coding: utf-8 -*-
# Copyright 2009-2020 <NAME>. All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Provide t... | 1.695313 | 2 |
tests/util/test_mwi_validators.py | chimmy-changa/d-mdp | 0 | 24020 | # Copyright 2021 The MathWorks, Inc.
"""Tests for functions in matlab_desktop_proxy/util/mwi_validators.py
"""
import pytest, os, tempfile, socket, random
import matlab_desktop_proxy
from matlab_desktop_proxy.util import mwi_validators
from matlab_desktop_proxy import mwi_environment_variables as mwi_env
from matlab_d... | 2.375 | 2 |
pub/models.py | DASTUDIO/MyVHost | 2 | 24021 | <filename>pub/models.py<gh_stars>1-10
# coding=utf-8
from pub.tables.resources import *
from pub.tables.map.domain import *
from pub.tables.cache.token import *
from pub.tables.map.files import *
from pub.tables.user import *
from pub.tables.cache.suspend import *
from pub.tables.notice import *
from pub.tables.templat... | 1.539063 | 2 |
editor/templates/tests/test_review.py | gocept/alphaflow | 0 | 24022 | <gh_stars>0
# Copyright (c) 2005-2006 gocept gmbh & co. kg
# See also LICENSE.txt
# $Id: test_processmanager.py 4614 2007-03-26 20:12:22Z ctheune $
import unittest
from Products.AlphaFlow.tests.AlphaFlowTestCase import AlphaFlowTestCase
from Products.AlphaFlow.process import Process, ProcessVersion
class ParallelRe... | 1.96875 | 2 |
tools/find-broken-edition-parm.py | ctheune/assembly-cms | 0 | 24023 | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
import zope.traversing.api
stack = [root['summer10']]
while stack:
page = stack.pop()
for edition in page.editions:
for tag in edition.parameters:
if not ':' in tag:
print zope.traversing.api.getPath(edition)... | 2.5 | 2 |
storm_summaries.py | uva-hydroinformatics-lab/precipitation_processing | 1 | 24024 | from storm_stats_functions import *
########################################################################################################################
# Prepare Data##########################################################################################################
#########################################... | 1.617188 | 2 |
jqi/completion.py | jan-g/jqi | 3 | 24025 | <reponame>jan-g/jqi
from .lexer import lex
from .parser import top_level
from .completer import *
from .eval import make_env, splice
def completer(s, offset, start=top_level):
evaluator = start.parse(lex(s, offset))
def complete(stream="", env=None):
if env is None:
env = {}
env =... | 2.4375 | 2 |
portfolio/Python/scrapy/loi/__init__.py | 0--key/lib | 0 | 24026 | <gh_stars>0
ACCOUNT_NAME = 'Loi'
| 0.839844 | 1 |
conda-store-server/conda_store_server/server/views/api.py | saulshanabrook/conda-store | 0 | 24027 | from flask import Blueprint, jsonify, redirect, request
import pydantic
from conda_store_server import api, schema, utils
from conda_store_server.server.utils import get_conda_store, get_auth
from conda_store_server.server.auth import Permissions
app_api = Blueprint("api", __name__)
@app_api.route("/api/v1/")
def ... | 2.296875 | 2 |
wrangle.py | brandonjbryant/regression-project | 0 | 24028 | import pandas as pd
import numpy as numpy
from env import host, user, password
import os
from sklearn.model_selection import train_test_split
import sklearn.preprocessing
############################# Acquire Zillow #############################
# defines function to create a sql url using personal credentials... | 3.125 | 3 |
server/shserver/GetCategory.py | AsherYang/ThreeLine | 1 | 24029 | <reponame>AsherYang/ThreeLine
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: AsherYang
Email: <EMAIL>
Date: 2017/7/24
Desc: get weidian token
@see https://wiki.open.weidian.com/api#94
url = https://api.vdian.com/api?param={"showNoCate":"0"}&public={"method":"weidian.cate.get.list","access_token":"9882ff6e... | 1.820313 | 2 |
tests/test_parametrized_circuit.py | mdrft/Blueqat | 25 | 24030 | from blueqat import Circuit, ParametrizedCircuit
def compare_circuit(c1: Circuit, c2: Circuit) -> bool:
return repr(c1) == repr(c2)
def test_parametrized1():
assert compare_circuit(
ParametrizedCircuit().ry('a')[0].rz('b')[0].subs([1.2, 3.4]),
Circuit().ry(1.2)[0].rz(3.4)[0])
def test_parame... | 2.609375 | 3 |
add_admin.py | xcoders-hub/file-link-telegram-bot | 1 | 24031 | <filename>add_admin.py
import sqlite3
from config import DB_PATH
def exe_query(query):
con_obj = sqlite3.connect(DB_PATH)
courser = con_obj.execute(query)
res = courser.fetchall()
con_obj.commit()
con_obj.close()
return res
try:
admin_id = int(input('Enter admin id: '))
exe_query(f'I... | 2.859375 | 3 |
resources/code/train/Python/cp.py | searene/PLDetector | 1 | 24032 | <gh_stars>1-10
# This file is part of the Hotwire Shell project API.
# Copyright (C) 2007 <NAME> <<EMAIL>>
# 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 w... | 1.765625 | 2 |
src/other/other/features/tests.py | ManuelLobo/IBEnt | 0 | 24033 | <filename>src/other/other/features/tests.py
import glob
import random
import os
import subprocess
import time
import argparse
import codecs
import logging
def brown_clusters(crf):
#num_clusters -> param c
#num_col -> param ncollocs
#min_occur -> param min-occur
#crf -> stanford or crfsuite
final_... | 2.375 | 2 |
tests/proc/test_manager.py | pmrowla/dvc-task | 2 | 24034 | <reponame>pmrowla/dvc-task<filename>tests/proc/test_manager.py
"""Process manager tests."""
import builtins
import signal
import sys
import pytest
from pytest_mock import MockerFixture
from pytest_test_utils import TmpDir
from dvc_task.proc.exceptions import (
ProcessNotTerminatedError,
UnsupportedSignalError... | 2.0625 | 2 |
laceworksdk/api/run_reports.py | kiddinn/python-sdk | 10 | 24035 | <reponame>kiddinn/python-sdk<gh_stars>1-10
"""
Lacework Run Reports API wrapper.
"""
import logging
logger = logging.getLogger(__name__)
class RunReportsAPI(object):
"""
Lacework RunReports API.
"""
def __init__(self, session):
"""
Initializes the RunReportsAPI object.
:par... | 2.578125 | 3 |
djangoautoconf/keys_default/admin_account_template.py | weijia/djangoautoconf | 0 | 24036 | admin_username = "richard"
admin_password = "<PASSWORD>" | 0.960938 | 1 |
open_box/conf/__init__.py | PeterPZhang/open-box | 2 | 24037 | import json
class ConfigObject(dict):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.load_attributes(kwargs)
def load_attributes(self, d):
for k, v in d.items():
if isinstance(v, dict):
self[k] = self.__class__(**v)
elif isinstan... | 2.890625 | 3 |
discordbot.py | reowoon/discordpy-startup | 0 | 24038 | <gh_stars>0
import discord
from discord.ext import commands
import os
from discord.ext import tasks
from datetime import datetime
bot = commands.Bot(command_prefix='&')
token = os.environ['DISCORD_BOT_TOKEN']
guild = bot.get_guild(417245684656373766)
#ステータス
@bot.event
async def on_ready():
activity = discord.Act... | 2.375 | 2 |
mplStyle/types/lib.py | khanfarhan10/mplStyle | 39 | 24039 | <filename>mplStyle/types/lib.py<gh_stars>10-100
#===========================================================================
#
# Copyright (c) 2014, California Institute of Technology.
# U.S. Government Sponsorship under NASA Contract NAS7-03001 is
# acknowledged. All rights reserved.
#
# Redistribution and use in so... | 1.335938 | 1 |
plot.py | osamayasserr/vaccum-cleaner | 2 | 24040 | import math
import pylab
from app import StandardRobot, LeastDistanceRobot, RandomWalkRobot, runSimulation
def timeNumberPlot(title, x_label, y_label, dim_length):
"""
Plots the relation between the number of robots and the average time
taken by different robots to clean a portion of the room.
"""
... | 3.453125 | 3 |
kf_lib_data_ingest/templates/my_ingest_package/ingest_package_config.py | kids-first/kf-lib-data-ingest | 3 | 24041 | <filename>kf_lib_data_ingest/templates/my_ingest_package/ingest_package_config.py
""" Ingest Package Config """
# The list of entities that will be loaded into the target service. These
# should be class_name values of your target API config's target entity
# classes.
target_service_entities = [
"family",
"par... | 2 | 2 |
src/dbmanage/database_from_csv.py | resolutedreamer/NESLDashboard | 0 | 24042 | <reponame>resolutedreamer/NESLDashboard<filename>src/dbmanage/database_from_csv.py<gh_stars>0
#!/usr/bin/env python
"""
Written by <NAME> 2015/06/20
"""
import sqlite3
import sys
#import smap_analytics as smap_analytics
open_this_file = None
if len(sys.argv) == 2:
open_this_file = sys.argv[1]
else:
open_this_... | 2.390625 | 2 |
RevCompLibrary.py | sayloren/fennel | 0 | 24043 | <filename>RevCompLibrary.py<gh_stars>0
"""
Script to perform RC sorting
<NAME>
July 5 2017
Copyright 2017 Harvard University, Wu Lab
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... | 2.59375 | 3 |
exos/temperatures.py | afafe78/python-im | 7 | 24044 | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = int(input()) # the number of temperatures to analyse
temps = input() # the n temperatures expressed as integers ranging from -273 to 5526
temps = temps.split()
if n == 0:
pr... | 3.71875 | 4 |
omep-python-test.py | yas-sim/openvino-model-experiment-package | 3 | 24045 | import numpy as np
import cv2
import matplotlib.pyplot as plt
from openvino.inference_engine import IECore
import openvino_model_experiment_package as omep
# Load an IR model
model = 'intel/human-pose-estimation-0001/FP16/human-pose-estimation-0001'
ie, net, exenet, inblobs, outblobs, inshapes, outshapes = omep.loa... | 2.34375 | 2 |
molecule/tiff/tests/request_tile_in_container.py | girder/ansible-role-large-image | 1 | 24046 | import large_image
import urllib
import pytest
@pytest.mark.parametrize("item, output", [
('590346ff8d777f16d01e054c', '/tmp/Huron.Image2_JPEG2K.tif')
])
def test_tiff_tile_source(item, output):
"""Check whether large_image can return a tile with tiff sources."""
test_url = 'https://data.kitware.com/api/v... | 2.53125 | 3 |
XSTAF/core/tool_manage.py | xcgspring/XSTAF | 2 | 24047 |
import os
import sys
import pickle
import traceback
from XSTAF.core.logger import LOGGER
class ToolManager(object):
def __init__(self):
self.settings = {"ToolsLocation" : r"tools",
"ToolsConfigureFile" : "config.pickle"}
self.tool_name_list = []
... | 2.5 | 2 |
foodies/forms.py | sharonandisi/foodgram | 0 | 24048 | <reponame>sharonandisi/foodgram
from django import forms
from .models import Image, Profile, Comments
class NewsLetterForm(forms.Form):
your_name = forms.CharField(label='<NAME>', max_length=30)
email = forms.EmailField(label='Email')
class NewImageForm(forms.ModelForm):
class Meta:
model = Im... | 2.171875 | 2 |
Oefeningen/standalone/list_comprehension_4.py | Seviran/Python_3 | 0 | 24049 |
string_input = "amazing"
vowels = "aeiou"
answer = [char for char in string_input if char not in vowels]
print(answer)
| 4 | 4 |
pyingest/tests/test_serializers.py | golnazads/adsabs-pyingest | 0 | 24050 | <filename>pyingest/tests/test_serializers.py
"""
Test serializer
"""
import unittest
import glob
import json
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from pyingest.parsers.iop import IOPJATSParser
from pyingest.serializers.classic import Tagged
from pyingest.serializers.r... | 2.296875 | 2 |
Chapter10-debugging/maxsubarray_v4.py | showa-yojyo/Software-Architecture-with-Python | 0 | 24051 | <gh_stars>0
#!/usr/bin/env python
# Code Listing #4
"""
Maximum subarray problem - final version
"""
from contextlib import contextmanager
import random
import time
# 復習
@contextmanager
def timer():
""" Measure real-time execution of a block of code """
try:
start = time.time()
yield
fi... | 3.4375 | 3 |
scripts/frontpage_sqlite_migration.py | r-anime/modbot | 3 | 24052 | """
One-time migration script from sqlalchemy models and sqlite database to custom ORM & PostgreSQL.
Not designed to work as part of the regular alembic system, merely placed here for archive purposes.
Should never need to run this again.
2021-05-03
"""
from datetime import datetime, timedelta
import sqlite3
from d... | 2.859375 | 3 |
coursera/a_8_4_romeo.py | polde-live/learnpython | 0 | 24053 | <reponame>polde-live/learnpython
# fname = raw_input("Enter file name: ")
fname = "romeo.txt"
fh = open(fname)
lst = list()
def add_to_list(words):
for word in words:
if word not in lst:
lst.append(word)
for line in fh:
words = line.split()
add_to_list(words)
lst.sort()
print... | 3.953125 | 4 |
Code/datasets/yahoo.py | jiahuanluo/label-inference-attacks | 3 | 24054 | <reponame>jiahuanluo/label-inference-attacks
from datasets.dataset_setup import DatasetSetup
from models import read_data_text
class YahooSetup(DatasetSetup):
def __init__(self):
super().__init__()
self.num_classes = 10
self.size_bottom_out = 10
def set_datasets_for_ssl(self, file_pat... | 2.984375 | 3 |
scripts/cloud_function.py | sansbacon/mfl_playoff_leagues | 0 | 24055 | from mfl_playoff_leagues import MFL
def run(request):
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.poco... | 2.953125 | 3 |
third_party/pdfium/build/gyp_pdfium.py | satorumpen/node-pdfium-native | 303 | 24056 | <reponame>satorumpen/node-pdfium-native
# Copyright 2014 PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
path = os.path.abspath(os.path.split(__file__)[0])
execfile(os.path.join(path, 'gyp_pdfium'))
| 1.109375 | 1 |
docs/source/examples/complex.py | dev10110/pyObjective | 0 | 24057 | from pyObjective import Variable, Model
import numpy as np
"""This example script is written to demonstrate the use of classes, and how more complicated models can be built,
and still passed to the solver. As a rudimentary example, it has two cubes and a sphere, and we are trying to find
the dimensions such that the... | 4 | 4 |
tests/test_inlinequeryresultgame.py | ehsanbarkhordar/botcup | 1 | 24058 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either ... | 2.4375 | 2 |
project/ui/sheet.py | surister/code-jam-3 | 2 | 24059 | import pygame as pg
class Sheet:
"""
Represents tool for extracting sprites from spritesheet.
"""
def __init__(self, sheet_path):
"""
Constructor for the sheet tool.
Loading the spritesheet.
"""
self.spritesheet = pg.image.load(sheet_path).convert_alpha()
d... | 3.40625 | 3 |
sandbox/bendpy/discont/dg_sine.py | MiroK/lega | 3 | 24060 | <filename>sandbox/bendpy/discont/dg_sine.py
# Analytical solutions for problems that can be solved with the two sine basis.
###
# Problem one is
#
# -u`` = f in [0, pi] with u(0) = u(pi) = 0 for f which is
# g on [0, pi/2) and h on [pi/2, pi]
#
###
# Problem two is
#
# u```` = f in [0, pi] with u(0) = u(pi) = 0, u... | 2.640625 | 3 |
pyunity/values/quaternion.py | rayzchen/PyUnity | 0 | 24061 | <reponame>rayzchen/PyUnity<gh_stars>0
# Copyright (c) 2020-2022 The PyUnity Team
# This file is licensed under the MIT License.
# See https://docs.pyunity.x10.bz/en/latest/license.html
"""Class to represent a rotation in 3D space."""
__all__ = ["Quaternion", "QuaternionDiff"]
from . import Mathf
from .vector import ... | 3.046875 | 3 |
db/db_connector.py | waynshang/stock_institution | 1 | 24062 | from config import secret
from utils import getLogger
DEBUG = getLogger()
class MysqlConnection:
def __init__(self, database, server_name):
self.host = secret[server_name]['mysql']['host']
self.port = secret[server_name]['mysql']['port']
self.username = secret[server_name]['mysql']['username']
self... | 2.6875 | 3 |
tests/docker/testhost/ui_test.py | huskywhale/safeplaces-frontend | 0 | 24063 | #from selenium.webdriver.remote import webdriver
from selenium import webdriver
#from selenium.webdriver.chrome import options
from page_objects import EntryPage, LoginPage, RedactionPage, ContactTracePage, AddNewRecordPage, AddDataToRecordPage, StageForPublishingPage, PublishDataPage, SettingsPage, Tools
import unitte... | 2.109375 | 2 |
kenning/outputcollectors/name_printer.py | antmicro/edge-ai-tester | 20 | 24064 | <reponame>antmicro/edge-ai-tester
"""
A small, very basic OutputCollector-derived class used to test
handling of multiple OutputCollectors in inference_runner scenario
"""
from kenning.core.outputcollector import OutputCollector
from kenning.datasets.open_images_dataset import DectObject
from typing import Any, Union
i... | 2.59375 | 3 |
plugins/bilibili_activity/contents/unknown.py | su226/IdhagnBot | 2 | 24065 | <reponame>su226/IdhagnBot
from typing import Any
from .. import util
FORMAT = '''\
🤔 {username} 发布了……一些东西
https://t.bilibili.com/{id}
目前机器人还不能理解这个qwq'''
def handle(content: Any) -> str:
return FORMAT.format(
username=content["desc"]["user_profile"]["info"]["uname"],
id=content["desc"]["dynamic_id_str"])
| 2.3125 | 2 |
georiviere/observations/tests/test_views.py | georiviere/Georiviere-admin | 7 | 24066 | <gh_stars>1-10
from collections import OrderedDict
from geotrek.authent.tests.factories import StructureFactory
from georiviere.tests import CommonRiverTest
from georiviere.observations.models import Station, ParameterTracking
from .factories import (
StationFactory, StationProfileFactory, ParameterFactory
)
cl... | 2.234375 | 2 |
lowendspirit/cloudflareAPI.py | boxcontrol/lowendspirit | 3 | 24067 | <gh_stars>1-10
import requests
from requests.auth import HTTPBasicAuth
import json
import pprint
class Cloudflare_Enduser_API:
def __init__(self, cf_token, cf_email):
self.cf_token = cf_token
self.cf_email = cf_email
self.headers = {
'Content-Type': 'application/json',
... | 2.734375 | 3 |
tests/unit_tests/test_features.py | constantinpape/mc_luigi | 0 | 24068 | import unittest
import os
from subprocess import call
import z5py
import vigra
from test_class import McLuigiTestCase
class TestDataTasks(McLuigiTestCase):
@classmethod
def setUpClass(cls):
super(TestDataTasks, cls).setUpClass()
@classmethod
def tearDownClass(cls):
super(TestDataTa... | 2.265625 | 2 |
src/images/migrations/0004_auto_20200713_1943.py | thesus/bokstaever | 0 | 24069 | # Generated by Django 3.0.8 on 2020-07-13 19:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("images", "0003_image_creation_date"),
]
operations = [
migrations.AddField(
model_name="image",... | 1.710938 | 2 |
grblas/backends/python/matrix.py | jim22k/grblas-dev | 0 | 24070 | import numba
import numpy as np
from scipy.sparse import csr_matrix
from .base import BasePointer, GraphBlasContainer
from .context import handle_panic, return_error
from .exceptions import GrB_Info
class MatrixPtr(BasePointer):
def set_matrix(self, matrix):
self.instance = matrix
class Matrix(GraphBlas... | 2.265625 | 2 |
server/medication_icons/admin.py | nickdotreid/opioid-mat-decision-aid | 0 | 24071 | <reponame>nickdotreid/opioid-mat-decision-aid
from django.contrib import admin
from imagekit.admin import AdminThumbnail
from .models import Icon
@admin.register(Icon)
class IconAdmin(admin.ModelAdmin):
list_display = ('name', 'icon_thumbnail')
icon_thumbnail = AdminThumbnail(image_field='thumbnail')
| 2.078125 | 2 |
dlutils/models/sklearn/classification.py | chelseajohn/dlapplication | 2 | 24072 | <filename>dlutils/models/sklearn/classification.py
def getSKLearnLogisticRegression(self, regParam, dim=1):
from DLplatform.learning.batch.sklearnClassifiers import LogisticRegression
learner = LogisticRegression(regParam = regParam, dim = dim)
return learner | 2.390625 | 2 |
tests/test_storage.py | tefra/pytubefm | 0 | 24073 | import json
import os
import shutil
import tempfile
from datetime import timedelta
from unittest import mock
from unittest import TestCase
from pytuber.storage import Registry
class RegistryTests(TestCase):
def tearDown(self):
Registry.clear()
Registry._obj = {}
def test_singleton(self):
... | 2.53125 | 3 |
Solutions/187.py | ruppysuppy/Daily-Coding-Problem-Solutions | 70 | 24074 | <gh_stars>10-100
"""
Problem:
You are given given a list of rectangles represented by min and max x- and
y-coordinates. Compute whether or not a pair of rectangles overlap each other. If one
rectangle completely covers another, it is considered overlapping.
For example, given the following rectangles:
{
"top_lef... | 3.890625 | 4 |
benchmark/bench_asynckafka.py | askuratovsky/asynckafka | 31 | 24075 | <gh_stars>10-100
import asyncio
from asynckafka import Producer, Consumer
import config
import utils
loop = asyncio.get_event_loop()
async def fill_topic_with_messages():
producer = Producer(
brokers=config.KAFKA_URL,
rdk_producer_config=config.RDK_PRODUCER_CONFIG,
rdk_topic_config=conf... | 3.015625 | 3 |
lcd/interrupts/interrupt3.py | BornToDebug/homeStruction | 6 | 24076 | <reponame>BornToDebug/homeStruction
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
def my_callback(channel):
print "falling edge detected on 18"
def my_callback2(c... | 2.84375 | 3 |
tests/module/module_topology_distmat_test.py | MD-Studio/MDInteract | 4 | 24077 | # -*- coding: utf-8 -*-
"""
file: module_topology_distmat_test.py
Unit tests for distance matrix computations
"""
import os
from pandas import DataFrame
from interact.md_system import System
from tests.module.unittest_baseclass import UnittestPythonCompatibility
class DistanceMatrixTests(UnittestPythonCompatibil... | 2.875 | 3 |
src/kgmk/ruijianime/scrape/comic_ids/all.py | kagemeka/python | 0 | 24078 | import typing
import bs4
import requests
class ScrapeAllComicIds():
def __call__(
self,
) -> typing.List[int]:
self.__find()
return self.__ids
def __find(
self,
) -> typing.NoReturn:
self.__ids = []
for q in self.__query:
self.__find_per_page(q)
def __find_per_page(
... | 2.671875 | 3 |
pymdownx/pathconverter.py | willstott101/pymdown-extensions | 0 | 24079 | """
Path Converter.
pymdownx.pathconverter
An extension for Python Markdown.
An extension to covert tag paths to relative or absolute:
Given an absolute base and a target relative path, this extension searches for file
references that are relative and converts them to a path relative
to the base path.
-or-
Given a... | 2.328125 | 2 |
backdoors/shell/__pupy/pupy/packages/src/VideoCapture/src/fixhtml.py | mehrdad-shokri/backdoorme | 796 | 24080 | <filename>backdoors/shell/__pupy/pupy/packages/src/VideoCapture/src/fixhtml.py
import os, string
oldWin = '''span {
font-family: Verdana;
background: #e0e0d0;
font-size: 10pt;
}
</style>
</head>
<body bgcolor="#e0e0d0">
'''
oldLinux = '''span {
font-family: Verdana;
background: #e0e0d0;
font-size: 13pt;
}
</sty... | 2.578125 | 3 |
pyaww/static_header.py | ammarsys/pyanywhere-wrapper | 5 | 24081 | from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .webapp import WebApp
class StaticHeader:
"""Contains all relevant methods to a static header."""
id: int
url: str
name: str
value: dict
def __init__(self, resp: dict, webapp: 'WebApp') -> None:
"""
Initialize the cl... | 2.96875 | 3 |
Clase6/pila.py | JoseCordobaEAN/EstructurasDeDatosUE4P | 2 | 24082 | class Nodo:
elemento = None
Siguiente = None
def __init__(self, elemento, siguiente):
self.elemento = elemento
self.Siguiente = siguiente
class Pila:
tamano = 0
top = None
def apilar(self, elemento):
"""
Agrega un elemento al tope de la pila
:param e... | 3.921875 | 4 |
mmdet/core/utils/my_hook.py | ydiller/NoMoreNMS | 0 | 24083 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import logging
from collections import defaultdict
from itertools import chain
from torch.nn.utils import clip_grad
from mmcv.utils import TORCH_VERSION, _BatchNorm, digit_version
# from ..dist_utils import allreduce_grads
# from ..fp16_utils import LossScal... | 2.03125 | 2 |
tests/fixtures/reporters/feed.py | kuc2477/news | 2 | 24084 | <filename>tests/fixtures/reporters/feed.py
import pytest
from news.reporters import ReporterMeta
from news.reporters.feed import AtomReporter, RSSReporter
@pytest.fixture
def rss_reporter(sa_schedule, sa_backend):
meta = ReporterMeta(schedule=sa_schedule)
return RSSReporter(meta=meta, backend=sa_backend)
@p... | 1.71875 | 2 |
deployer/main.py | sportsy/deployer | 0 | 24085 | <gh_stars>0
#!/usr/bin/env python
import sys
import os
import ConfigParser
import json
import time
import threading
from distutils.core import setup
import pika
import boto
import pusherclient
from boto.sqs.message import RawMessage
# set defaults
channel = None
global pusher
config = ConfigParser.ConfigParser()
cl... | 2.390625 | 2 |
nipype/workflows/dmri/mrtrix/__init__.py | felixsc1/nipype | 8 | 24086 | <filename>nipype/workflows/dmri/mrtrix/__init__.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from .diffusion import create_mrtrix_dti_pipeline
from .connectivity_mapping import create_connectivity_pipeline
from .group_connectivity import (create_group_connectivity_pipeline)
| 1.273438 | 1 |
main.py | dunderstab/SembleLang | 0 | 24087 | <reponame>dunderstab/SembleLang
import src.lex
import src.parse
import src.eval
import src.tools
import src.optimize
import src.pre
import re
import sys
def main(file, n=None, first=False):
import os
debug = False
version = "Beta 2.5"
l = src.tools.readSembleFile(file)
#if first:
# l += src.pre.import... | 2.1875 | 2 |
lib/browser.py | qwghlm/WhensMyBus | 4 | 24088 | #!/usr/bin/env python
"""
Data browser for When's My Transport, with caching and JSON/XML parsing
"""
import json
import logging
import os
import urllib2
import time
from xml.dom.minidom import parseString
from xml.etree.ElementTree import fromstring
from lib.exceptions import WhensMyTransportException
#
# API URLs ... | 2.46875 | 2 |
oommfpy/tools/plot_tools.py | davidcortesortuno/oommfpy | 9 | 24089 | <gh_stars>1-10
import colorsys
import numpy as np
# -----------------------------------------------------------------------------
# Utilities to generate a HSL colourmap from the magnetisation field data
def convert_to_RGB(hls_color):
return np.array(colorsys.hls_to_rgb(hls_color[0] / (2 * np.pi),
... | 2.640625 | 3 |
83. Remove Duplicates from Sorted List.py | fossabot/leetcode-2 | 2 | 24090 | class Solution(object):
def deleteDuplicates(self, head):
initial = head
while head:
if head.next and head.val == head.next.val:
head.next = head.next.next
else:
head = head.next
head = initial
return head
| 3.234375 | 3 |
RecSysFramework/Evaluation/Comparator.py | damicoedoardo/NNMF | 2 | 24091 | <reponame>damicoedoardo/NNMF<filename>RecSysFramework/Evaluation/Comparator.py
'''
Created on Wed Sep 18 2019
@author XXX
'''
import numpy as np
import scipy.sparse as sps
import time
import sys
import copy
from tqdm import tqdm
from enum import Enum
from RecSysFramework.Utils import seconds_to_biggest_unit
from RecS... | 2.15625 | 2 |
app/grid_model.py | vinhta314/game-of-life-visualiser | 0 | 24092 | import numpy as np
class CellularAutomationModel:
grid_width = 40
grid_height = 40
def __init__(self):
self.grid = self._randomised_grid()
def evolve(self):
"""
Evolve the current grid state using Conway's Game of Life algorithm.
:returns
dict: A dictiona... | 3.546875 | 4 |
session.py | cheng6076/virnng | 13 | 24093 | from encoder import Encoder
from decoder import Decoder
from parser import Parser
from baseline import *
from language_model import LanguageModel
from util import Reader
import dynet as dy
from misc import compute_eval_score, compute_perplexity
import os
initializers = {'glorot': dy.GlorotInitializer(),
... | 2.390625 | 2 |
funcion_mutacion.py | J0SU3IC3/Proyecto_Algoritmo_Genetico | 0 | 24094 | import random
def mutacion(indiv):
alea_1=random.randint(0,len(indiv)-1)
alea_2 = random.randint(0, len(indiv)-1)
interc_1=indiv[alea_1]
interc_2=indiv[alea_2]
indiv[alea_1] = interc_2
indiv[alea_2] = interc_1
return indiv
| 2.90625 | 3 |
examples/import_hostgroups.py | jkraenzle/steelscript-netprofiler | 5 | 24095 | #!/usr/bin/env python
# Copyright (c) 2019 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
import csv
import sys
import string
import optparse
from co... | 2.4375 | 2 |
exec.py | developerHaneum/listBug | 2 | 24096 | <filename>exec.py
from clint.textui import *
def Write():
i = 0
while True:
i += 1
text = input(colored.cyan("%d: "%i))
if text == "q":
sys.exit(0)
def Print():
print(colored.cyan("-- Bug list --"))
print(colored.cyan("-- ") + colored.red("<q:quit>") + colored.cyan(... | 2.578125 | 3 |
datasets/hscic/scrape.py | nhsengland/publish-o-matic | 0 | 24097 |
from datasets.hscic.hscic_datasets import scrape as datasets_scrape
from datasets.hscic.hscic_indicators import scrape as indicators_scrape
def main(workspace):
datasets_scrape(workspace)
indicators_scrape(workspace) | 1.414063 | 1 |
src/tests/behave/api/features/client.py | shaneutt/mercury | 4 | 24098 | <reponame>shaneutt/mercury
import copy
import json
import requests
import datetime
from src.tests.behave.common.config import get_conflagration
class APIClient(object):
def __init__(self, base_url, request_kwargs=None, client_kwargs=None):
self.cfg = get_conflagration()
token = self.get_identity_... | 2.25 | 2 |
Instrument_Examples/DMM6500/Upload_and_Execute_a_Test_Sequence_to_the_Series_2260B_Power_Supply/Upload_and_Execute_Test_Sequence_File_to_2260B_Power_Supply_Rev_B.py | 398786172/keithley | 31 | 24099 | """***********************************************************
*** Copyright Tektronix, Inc. ***
*** See www.tek.com/sample-license for licensing terms. ***
***********************************************************"""
import socket
import struct
import math
import time
import sys
echo_cmd =... | 2.9375 | 3 |