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 |
|---|---|---|---|---|---|---|
moderngl_window/timers/base.py | DavideRuzza/moderngl-window | 142 | 33900 | from typing import Tuple
class BaseTimer:
"""
A timer controls the time passed into the the render function.
This can be used in creative ways to control the current time
such as basing it on current location in an audio file.
All methods must be implemented.
"""
@property
... | 3.90625 | 4 |
accounts/views.py | aryasadeghy/simpleSocial | 0 | 33901 | <reponame>aryasadeghy/simpleSocial
from django.shortcuts import render
from django.views.generic import CreateView
from django.urls import reverse_lazy
from accounts.forms import UserCreateForm
# Create your views here.
class Signup(CreateView):
form_class = UserCreateForm
success_url = reverse_lazy('login')
... | 2.046875 | 2 |
H/283. Move Zeroes.py | shaohy/leetcode | 0 | 33902 | <filename>H/283. Move Zeroes.py
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
for i in nums:
if i == 0:
nums.append(i)
nums.remove(i) | 3.53125 | 4 |
ultimate-utils-proj-src/uutils/torch/torch_geometric/__init__.py | CBMM/ultimate-utils | 0 | 33903 |
# def draw_nx(g, labels=None):
# import matplotlib.pyplot as plt
# if labels is not None:
# g = nx.relabel_nodes(g, labels)
# pos = nx.kamada_kawai_layout(g)
# nx.draw(g, pos, with_labels=True)
# plt.show()
#
# def draw_nx_attributes_as_labels(g, attribute):
# # import pylab
# impo... | 2.734375 | 3 |
alipay/aop/api/domain/AlipayOverseasRemitFundInitializeModel.py | antopen/alipay-sdk-python-all | 213 | 33904 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOverseasRemitFundInitializeModel(object):
def __init__(self):
self._bc_remit_id = None
self._compliance_mid = None
self._extend_info = None
self._quote_route... | 1.8125 | 2 |
venv/lib/python3.6/site-packages/taggit_templatetags2/views.py | corwin-cole/lunas-picture-box | 38 | 33905 | <gh_stars>10-100
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from .settings import TAGGED_ITEM_MODEL, TAG_MODEL
class TagCanvasListView(ListView):
template_name = 'taggit_templatetags2/tagcanvas_list.html'
model = TAGGED... | 2.09375 | 2 |
run/validate_torchio.py | MarkCiampa/HippocampusSegmentationMRI | 16 | 33906 | <filename>run/validate_torchio.py
##########################
# <NAME> (2020)
# V-Net for Hippocampus Segmentation from MRI with PyTorch
##########################
# python run/validate_torchio.py
# python run/validate_torchio.py --dir=logs/no_augm_torchio
# python run/validate_torchio.py --dir=path/to/logs/dir --verbos... | 2.28125 | 2 |
data/ngrams.py | charlottelambert/old-bailey | 0 | 33907 | <filename>data/ngrams.py
#!/usr/bin/env python3
import nltk, json, os, sys, operator, argparse, copy
from nltk.tokenize import word_tokenize, sent_tokenize
from tqdm import tqdm
from nltk.corpus import stopwords
sys.path.append('../')
from utils import *
# List of stopwords to excldue from text
stop_words = set(stopwo... | 3.1875 | 3 |
ros_mstar/ros_mstar/simple_service_client.py | scchow/ros-mstar | 0 | 33908 | # Copyright 2016 Open Source Robotics Foundation, 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... | 2.28125 | 2 |
tests/test_module.py | indigoviolet/region_profiler | 0 | 33909 | import atexit
import contextlib
import time
from typing import Any, List, Type
from unittest import mock
import pytest
import region_profiler.global_instance
import region_profiler.profiler
from region_profiler import RegionProfiler, func
from region_profiler import install as install_profiler
from region_profiler imp... | 1.835938 | 2 |
main2.py | dotkom/notipi | 0 | 33910 | #!/usr/bin/env python
import datetime
import logging
import time
from threading import Thread
import requests
from requests.auth import HTTPBasicAuth
import settings
def update_notiwire(data=None, relative_url=''):
URL = settings.API_URL + settings.NAME + '/'
if not data:
data = {}
data['api_key... | 2.359375 | 2 |
Python3/0073-Set-Matrix-Zeroes/soln.py | wyaadarsh/LeetCode-Solutions | 5 | 33911 | <filename>Python3/0073-Set-Matrix-Zeroes/soln.py
class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
m, n = len(matrix), len(matrix[0])
col_zero = any(matrix[i]... | 3.25 | 3 |
grammy/urls.py | naimahassan/insta_grammy | 0 | 33912 | from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from . import views
urlpatterns=[
url('^$',views.index,name = 'index'),
url(r'^profile/(\d+)',views.profile,name = "profile"),
url(r'^create/post',views.new_post, name = "new-post"),
url(r'^foll... | 1.976563 | 2 |
chart/graphs/drawgraph.py | msamunetogetoge/AutoTrader | 1 | 33913 | <reponame>msamunetogetoge/AutoTrader<gh_stars>1-10
from chart.models import *
from chart.controllers import ai, get_data
import key
from pathlib import Path
import os
from django_pandas.io import read_frame
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
imp... | 2.484375 | 2 |
spinup/exercises/problem_set_1/exercise1_1.py | wowbob396/spinningup | 0 | 33914 | <reponame>wowbob396/spinningup
import tensorflow as tf
import numpy as np
import math
"""
Exercise 1.1: Diagonal Gaussian Likelihood
Write a function which takes in Tensorflow symbols for the means and
log stds of a batch of diagonal Gaussian distributions, along with a
Tensorflow placeholder for (previously-genera... | 2.984375 | 3 |
src/pyrouge/rouge/pyrouge/__init__.py | bzhao2718/PreSumm | 4 | 33915 | from pyrouge.base import Doc, Sent
from pyrouge.rouge import Rouge155 | 0.949219 | 1 |
tests/unit/saltenv/ops/test_unit_get_current_version.py | eitrtechnologies/saltenv | 5 | 33916 | from unittest.mock import MagicMock
from unittest.mock import patch
import aiofiles
from aiofiles import threadpool
async def test_unit_get_current_version_both_files_dont_exist(mock_hub, hub, tmp_path):
"""
SCENARIO #1
- override_version_file DOES NOT EXIST
- main_version_file DOES NOT EXIST
"""... | 2.78125 | 3 |
setup.py | yuvipanda/fakeokclient | 0 | 33917 | import setuptools
setuptools.setup(
name="fakeokpy",
version='0.1',
url="https://github.com/yuvipanda/fakeokpy",
author="<NAME>",
author_email="<EMAIL>",
license="BSD-3-Clause",
packages=setuptools.find_packages(),
)
| 0.972656 | 1 |
Archive/Presentation/Cat Code Presentation.py | JohanWinther/cat-state-encoding | 3 | 33918 |
# coding: utf-8
# $ \newcommand{\cat}[2][\phantom{i}]{\ket{C^{#2}_{#1\alpha}}} $
# $ \newcommand{\ket}[1]{|#1\rangle} $
# $ \newcommand{\bra}[1]{\langle#1|} $
# $ \newcommand{\braket}[2]{\langle#1|#2\rangle} $
# $\newcommand{\au}{\hat{a}^\dagger}$
# $\newcommand{\ad}{\hat{a}}$
# $\newcommand{\bu}{\hat{b}^\dagger}$
# ... | 1.898438 | 2 |
lib/evaluation/frequency_based_analysis_of_methods.py | YerongLi2/LTVRR | 13 | 33919 | <reponame>YerongLi2/LTVRR<gh_stars>10-100
# Written by <NAME> on Jan 2020
import numpy as np
import pandas as pd
import json
import os.path as osp
# import seaborn as sns # not critical.
import matplotlib.pylab as plt
# In[9]:
import os
import re
def files_in_subdirs(top_dir, search_pattern): # TODO: organize pr... | 2.375 | 2 |
problems/41/problem_41.py | r1cc4rdo/daily_coding_problem | 158 | 33920 | def coding_problem_41(flights_db, starting_airport):
"""
Given an unordered list of flights taken by someone, each represented as (origin, destination) pairs, and a
starting airport, compute the person's itinerary. If no such itinerary exists, return null. If there are multiple
possible itineraries, ret... | 4.09375 | 4 |
src/test_groupby.py | iisharankov/UppsalaSoftwareTesting | 0 | 33921 | import itertools
import pytest
from iterators.invalid_iter import InvalidIter
def _grouper_to_keys(grouper):
return [g[0] for g in grouper]
def _grouper_to_groups(grouper):
return [list(g[1]) for g in grouper]
@pytest.mark.parametrize("keyfunc, data, expected_keys", [
(lambda x: x, [], []),
(lambd... | 2.90625 | 3 |
paddlepalm/reader/match.py | baajur/PALM | 136 | 33922 | <filename>paddlepalm/reader/match.py
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... | 2.59375 | 3 |
examples/exmample_receiver.py | Novus-Space/SerialIO | 0 | 33923 | import serialio
class Serial(object):
def __init__(self, port, baudrate, timeout):
self.port = port
self.baudrate = baudrate
self.timeout = timeout
self._openPort()
def _openPort(self):
self.hComm = serialio.Serial(self.port, self.baudrate) # Opening the port
def read(self):
data = seria... | 3.0625 | 3 |
pirates/minigame/RepairBarnacle.py | Willy5s/Pirates-Online-Rewritten | 81 | 33924 | <gh_stars>10-100
import random
from pandac.PandaModules import Point3
from direct.gui.DirectGui import DirectFrame, DirectLabel
from direct.fsm import FSM
from direct.interval.IntervalGlobal import *
from pirates.audio import SoundGlobals
from pirates.audio.SoundGlobals import loadSfx
import RepairGlobals
MIN_SCALE = 1... | 2.03125 | 2 |
src/test/statistical.py | omn1m0n/ssc-collab | 1 | 33925 | <reponame>omn1m0n/ssc-collab<gh_stars>1-10
import numpy as np
def euclidean_norm(vectorList, listP, listQ):
"""Calculates the euclidean norm (distance) of two array-like objects, in this case vectors
Args:
listP (integer list): List of indices of the reference vector of the\
array.
... | 3.5 | 4 |
examples/adaptive/ppo2_episodes.py | llucid-97/rl-generalization | 84 | 33926 | <reponame>llucid-97/rl-generalization
import os
import time
import joblib
import numpy as np
import os.path as osp
import tensorflow as tf
from baselines import logger
from collections import deque
from baselines.common import explained_variance
import pickle
class Model(object):
def __init__(self, policy, ob_sp... | 1.898438 | 2 |
Scripts/simulation/visualization/spawner_visualizer.py | velocist/TS4CheatsInfo | 0 | 33927 | <reponame>velocist/TS4CheatsInfo<filename>Scripts/simulation/visualization/spawner_visualizer.py
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\vis... | 2.0625 | 2 |
rgs/__init__.py | slavakargin/RandomGeometricStructures | 0 | 33928 | '''
A package to manipulate and display some random structures,
including meander systems, planar triangulations, and ribbon tilings
Created on May 8, 2021
@author: vladislavkargin
'''
'''
#I prefer blank __init__.py
from . import mndrpy
from . import pmaps
from . import ribbons
''' | 1.851563 | 2 |
2017/day09/main.py | stenbein/AdventOfCode | 3 | 33929 | #!/usr/bin/python3
'''Day 9 of the 2017 advent of code'''
def process_garbage(stream, index):
"""Traverse stream. Break on '>' as end of garbage,
return total as size of garbage and the new index
"""
total = 0
length = len(stream)
while index < length:
if stream[index] =... | 3.765625 | 4 |
radec.py | mdwarfgeek/pymisc | 0 | 33930 | <reponame>mdwarfgeek/pymisc<gh_stars>0
import lfa
def convert_radec(radec, partial=False):
# Convert RA, DEC. Try : first and then space.
ra, rva = lfa.base60_to_10(radec, ':', lfa.UNIT_HR, lfa.UNIT_RAD)
if rva < 0:
ra, rva = lfa.base60_to_10(radec, ' ', lfa.UNIT_HR, lfa.UNIT_RAD)
if rva < 0:
rais... | 2.65625 | 3 |
src/utilities/NumpyHelper.py | AndMu/Market-Wisdom | 14 | 33931 | import numpy as np
class NumpyDynamic:
def __init__(self, dtype, array_size=(100,)):
self.data = np.zeros(array_size, dtype)
self.array_size = list(array_size)
self.size = 0
def add(self, x):
if self.size == self.array_size[0]:
self.array_size[0] *= 2
... | 3.140625 | 3 |
api/serializers/RouteDistanceSerializer.py | M4hakala/drf_route_api_example | 0 | 33932 | from rest_framework import serializers
from api.models import RouteModel
class RouteDistanceSerializer(serializers.ModelSerializer):
km = serializers.FloatField(source='distance', read_only=True)
class Meta:
model = RouteModel
fields = ('route_id', 'km')
| 2.21875 | 2 |
test/net_t2.py | jmbjorndalen/pycsp_classic | 0 | 33933 | <reponame>jmbjorndalen/pycsp_classic<gh_stars>0
#!/usr/bin/env python
# -*- coding: latin-1 -*-
from common import *
from pycsp import *
from pycsp.plugNplay import *
from pycsp.net import *
@process
def test1():
print("Test1")
waitForSignal()
c = getNamedChannel("foo1")
print("- Trying to write to cha... | 2.4375 | 2 |
main/commands/_listlol.py | STEUSSO/steusso | 0 | 33934 | <gh_stars>0
from discord.errors import HTTPException
from discord.ext import commands
from os import getenv
from discord import Embed
from dotenv import load_dotenv
from requests.models import HTTPError
from riotwatcher import LolWatcher
from json import load
load_dotenv(dotenv_path="config")
prefix = getenv("PREFIX")... | 2.578125 | 3 |
olfactometer/smell_engine_communicator.py | asu-meteor/The-Smell-Engine | 1 | 33935 | <gh_stars>1-10
import struct
import select
import socket
import sys
import binascii
import getopt
import time
import quantities as pq
from collections import deque
import numpy as np
import datetime
import typer
from typing import Optional
from pprint import pprint
from olfactometer.smell_engine import SmellEngine
fr... | 2.578125 | 3 |
tree/basic.py | Matioz/AlphaZero | 1 | 33936 | import numpy as np
from abc import ABCMeta, abstractmethod
class Node(object):
"""Represents state in MCTS search tree.
Args:
state (object): The environment state corresponding to this node in the search tree.
Note:
Node object is immutable. Node is left without exit edges (empty dict)... | 3.28125 | 3 |
fedot/cases/metocean_forecasting_problem.py | alievilya/nas-fedot | 13 | 33937 | import os
import random
from sklearn.metrics import mean_squared_error as mse
from core.composer.chain import Chain
from core.composer.composer import ComposerRequirements, DummyChainTypeEnum, DummyComposer
from core.models.data import OutputData
from core.models.model import *
from core.repository.dataset_t... | 2.546875 | 3 |
common/si.isystem.commons.plugin/fileManipulation.py | iSYSTEMLabs/testIDEA | 1 | 33938 |
import os
import re
import shutil
def svnLockFiles(files):
fileStr = ' '.join(files)
print('Locking files: ', fileStr)
os.system('svn lock ' + fileStr)
def svnUnlockFiles(files):
fileStr = ' '.join(files)
print('Unlocking files: ', fileStr)
os.system('svn unlock ' + fileStr)
... | 2.96875 | 3 |
language/python/modules/typing/typing_module.py | bigfoolliu/liu_aistuff | 1 | 33939 | <reponame>bigfoolliu/liu_aistuff
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
python3.5开始,PEP484为python引入了类型注解(type hints)
typing模块:
1. 类型检查,防止运行时出现参数和返回值类型不符合。
2. 作为开发文档附加说明,方便使用者调用时传入和返回参数类型。
3. 该模块加入后并不会影响程序的运行,不会报正式的错误,只有提醒pycharm目前支持typing检查,参数类型错误会黄色提示。
基本类型:
int,long,float:整型,长... | 3.4375 | 3 |
scratchpad/voids_paper/bin/tests/test_rec.py | arshadzahangirchowdhury/TomoEncoders | 0 | 33940 | <filename>scratchpad/voids_paper/bin/tests/test_rec.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import matplotlib.pyplot as plt
import os
import h5py
import sys
import time
import seaborn as sns
import pandas as pd
import cupy as cp
from tomo_encoders import Patches
from tomo_enco... | 2.15625 | 2 |
tensornetwork/linalg/linalg_test.py | sr33dhar/TensorNetwork | 0 | 33941 | import numpy as np
import time
import pytest
import jax.numpy as jnp
import jax.config as config
import torch
import tensorflow as tf
from tensornetwork.linalg import linalg
from tensornetwork import backends
from tensornetwork.backends.numpy import numpy_backend
from tensornetwork.backends.jax import jax_backend
#pyli... | 1.789063 | 2 |
src/ansible_pygments/__init__.py | felixfontein/sphinx_ansible_highlighter | 3 | 33942 | """Pygments entities for highlighting and tokenizing Ansible things."""
| 0.984375 | 1 |
Students/Zephyr/Exercise 1.py | MikelShifrin/Python1 | 3 | 33943 | <filename>Students/Zephyr/Exercise 1.py
name = input('Please enter your name:\n')
age = int(input("Please enter your age:\n"))
color = input('Enter your favorite color:\n')
animal = input('Enter your favorite animal:\n')
print('Hello my name is' , name , '.')
print('I am' , age , 'years old.')
print('My favorite co... | 3.890625 | 4 |
libraries/authenticator.py | CrimsonPinnacle/container-image-inspector | 0 | 33944 | <filename>libraries/authenticator.py
#!/usr/bin/env python3
"""
:mod: `authenticator.py` -- Common authentication helpers
================================================================================
module:: authenticator
:platform: Unix, Windows
:synopsis: This module contains classes and helper func... | 2.359375 | 2 |
main.py | Kartikei-12/Pyrunc | 4 | 33945 | """main.py file representingcomparison statistics for Pyrunc module"""
# Python module(s)
from timeit import timeit
# Project module(s)
from Pyrunc import Pyrunc
def main():
"""Main Method"""
pr_c = Pyrunc()
# --------------------------------------------------------------------------------
# ----... | 3.046875 | 3 |
tests/test_class.py | oeg-upm/easysparql | 0 | 33946 | <gh_stars>0
import unittest
from easysparql import easysparqlclass, cacher
import logging
ENDPOINT = "https://dbpedia.org/sparql"
albert_uri = "http://dbpedia.org/resource/Albert_Einstein"
albert_name = "<NAME>"
scientist = "http://dbpedia.org/ontology/Scientist"
foaf_name = "http://xmlns.com/foaf/0.1/name"
logger = ... | 2.40625 | 2 |
create_saliency_images.py | briqr/CSPN | 17 | 33947 | <gh_stars>10-100
import sys
import numpy as np
import scipy.misc
import scipy.ndimage as nd
import os.path
import scipy.io as sio
saliency_path = '/media/VOC/saliency/raw_maps/' # the path of the raw class-specific saliency maps, created by create_saliency_raw.py
save_path = '/media/VOC/saliency/thresholded_salien... | 2.265625 | 2 |
exporter/apply_for_a_licence/views.py | django-doctor/lite-frontend | 1 | 33948 | from django.urls import reverse_lazy, reverse
from django.views.generic import TemplateView
from exporter.applications.services import post_applications, post_open_general_licences_applications
from exporter.apply_for_a_licence.forms.open_general_licences import (
open_general_licence_forms,
open_general_licen... | 2.015625 | 2 |
ElexonDataPortal/vis/curtailment.py | r4ch45/ElexonDataPortal | 22 | 33949 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/vis-02-curtailment.ipynb (unless otherwise specified).
__all__ = ['get_wf_ids', 'flatten_list', 'get_curtailed_wfs_df', 'load_curtailed_wfs',
'add_next_week_of_data_to_curtailed_wfs']
# Cell
flatten_list = lambda list_: [item for sublist in list_ for item in ... | 2.4375 | 2 |
pycqed/instrument_drivers/meta_instrument/qubit_objects/qubit_object.py | peendebak/PycQED_py3 | 0 | 33950 | <filename>pycqed/instrument_drivers/meta_instrument/qubit_objects/qubit_object.py<gh_stars>0
import logging
import numpy as np
import time
import warnings
from qcodes.instrument.base import Instrument
from qcodes.utils import validators as vals
from pycqed.measurement import detector_functions as det
from qcodes.instr... | 2.046875 | 2 |
main.py | ok-tsar/VandyHacks_Heartbeat_Classification | 1 | 33951 | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import librosa
import os
import sys
import time
from datetime import datetime
from pathlib import Path
from src.python.audio_transforms import *
from src.python.model_predict import *
from src.python.graphics import plot_graph
# Hardcoding a few variable... | 2.203125 | 2 |
src/AutoTrade.py | mounan/cryptobot | 3 | 33952 | <reponame>mounan/cryptobot
from pprint import pformat
from TwitterBot import TwitterBot
from utils import *
from BinanceBot import BinanceBot
from time import *
import logging
class AutoTrader(TwitterBot, BinanceBot):
"""[summary]
:param TwitterBot: [description]
:type TwitterBot: [type]
:param Binan... | 2.78125 | 3 |
py/discover.py | dman776/micboard | 44 | 33953 | import socket
import struct
import json
import time
import os
import platform
from optparse import OptionParser
import sys
import xml.etree.ElementTree as ET
import config
from device_config import BASE_CONST
MCAST_GRP = '192.168.3.11'
MCAST_PORT = 8427
DEFAULT_DCID_XML = '/Applications/Shure Update Utility.app/C... | 2.171875 | 2 |
integrations-and-supported-tools/fastai/scripts/Neptune_fastai.py | neptune-ai/examples | 15 | 33954 | import fastai
from neptune.new.integrations.fastai import NeptuneCallback
from fastai.vision.all import *
import neptune.new as neptune
run = neptune.init(
project="common/fastai-integration", api_token="<PASSWORD>", tags="basic"
)
path = untar_data(URLs.MNIST_TINY)
dls = ImageDataLoaders.from_csv(path)
# Log al... | 2.1875 | 2 |
test/webapi/controllers/test_time_series.py | dzelge/xcube | 0 | 33955 | import unittest
import numpy as np
from xcube.webapi.controllers.time_series import get_time_series_info, get_time_series_for_point, \
get_time_series_for_geometry, get_time_series_for_geometry_collection
from ..helpers import new_test_service_context
class TimeSeriesControllerTest(unittest.TestCase):
def ... | 2.65625 | 3 |
setup.py | Ademan/psycopg2 | 2 | 33956 | <gh_stars>1-10
# setup.py - distutils packaging
#
# Copyright (C) 2003-2010 <NAME> <<EMAIL>>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your ... | 1.125 | 1 |
users/views.py | Mohit7143/class | 0 | 33957 | <gh_stars>0
from django.shortcuts import render,redirect
from django.views.generic import View
from django.contrib.auth.models import User
from .forms import LoginUser,RegisterUser
from django.http import HttpResponse,Http404
from django.contrib.auth import authenticate,login,logout
class UserLogin(View):
form_cla... | 2.1875 | 2 |
python_src/AHRS_Madgwick.py | msart/Joint-estimation-with-9dof-sensors | 3 | 33958 | from math import sqrt
from math import atan2
from math import asin
beta = 0.1
sampleFreq = 10.0
#Fastest implementation in python for invsqrt
def invsqrt(number):
return number ** -0.5
def update_IMU( gx, gy, gz, ax, ay, az, q0, q1, q2, q3):
gx = gx * 0.0174533
gy = gy * 0.0174533
gz = gz * 0.017453... | 2.78125 | 3 |
books/masteringPython/cp15/setup_template.py | Bingwen-Hu/hackaway | 0 | 33959 | import setuptools
if __name__ == '__main__':
setuptools.setup(
name='Name',
version='0.1',
# this automatically detects the packages in the specified
# (or current directory if no directory is given).
packages=setuptools.find_packages(exclude=['tests', 'docs']),
# ... | 2.25 | 2 |
compressor/base.py | rossowl/django-compressor | 0 | 33960 | import os
from django.core.files.base import ContentFile
from django.template.loader import render_to_string
from django.utils.encoding import smart_unicode
from compressor.cache import get_hexdigest, get_mtime
from compressor.conf import settings
from compressor.exceptions import CompressorError, UncompressableFileE... | 2.078125 | 2 |
tests/test_conditions.py | ranking-agent/simple-kp | 0 | 33961 | <gh_stars>0
"""Test generating SQL conditions."""
import pytest
from binder.util import build_conditions
from .logging_setup import setup_logger
setup_logger()
def test_condition():
"""Test condition generation."""
assert (
build_conditions(
**{
"a": 5,
}
... | 2.828125 | 3 |
tfx/tools/cli/commands/pipeline.py | avelez93/tfx | 1,813 | 33962 | <filename>tfx/tools/cli/commands/pipeline.py
# Copyright 2019 Google LLC. 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... | 1.875 | 2 |
lib/utils/env.py | MJ10/BioSeq-GFN-AL | 13 | 33963 | <gh_stars>10-100
import torch
class Vocab:
def __init__(self, alphabet) -> None:
self.stoi = {}
self.itos = {}
for i, alphabet in enumerate(alphabet):
self.stoi[alphabet] = i
self.itos[i] = alphabet
class TokenizerWrapper:
def __init__(self, vocab, dummy_process... | 2.3125 | 2 |
tests/test_vectors/utils.py | alex-polosky/didcomm-python | 8 | 33964 | <gh_stars>1-10
from enum import Enum
from typing import List, Union
from didcomm.common.types import VerificationMethodType, VerificationMaterialFormat
from didcomm.core.serialization import json_str_to_dict
from didcomm.did_doc.did_doc import VerificationMethod
from didcomm.errors import DIDCommValueError
from didcom... | 2.28125 | 2 |
DialogCalibrate.py | n2ee/Wind-Tunnel-GUI | 1 | 33965 | <filename>DialogCalibrate.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'DialogCalibrate.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DialogCalibrate(object):
def se... | 2.015625 | 2 |
alipay/aop/api/response/AlipayOpenAppQrcodeCreateResponse.py | antopen/alipay-sdk-python-all | 0 | 33966 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenAppQrcodeCreateResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenAppQrcodeCreateResponse, self).__init__()
self._qr_code_url = None
... | 1.992188 | 2 |
Practica3/MergeSort/Merge.py | JosueHernandezR/An-lisis-de-Algoritmos | 1 | 33967 | #Análisis de Algoritmos 3CV2
# <NAME>
# Josué <NAME>
# Práctica 3 Divide y vencerás
# Este es el algoritmo usado en merge, ya que los datos que devuelve no son los mismos usados en merge sort
# Esto lo hice para fines prácticos y ahorro de tiempo
import globalvariables as gb
def onlymerge(izq, der):
"""
Merge... | 3.734375 | 4 |
InteractionTracker/analytics/api/serializers.py | desertzebra/Lean-UX-Platform | 34 | 33968 | """
# Interaction Tracker
# @license http://www.apache.org/licenses/LICENSE-2.0
# Author @ <NAME>, Zaki
"""
from analytics.models import (Log, ActionLog)
from rest_framework import serializers
class LogSerializer(serializers.ModelSerializer):
class Meta:
model = Log
fields = ('app','appuser',... | 2.09375 | 2 |
idmatch/matching/fixtures/__init__.py | javierherrera1996/idmatch | 55 | 33969 | # coding: utf-8
from wilde import WILDE_VECTOR
from corey import COREY_VECTOR
| 0.976563 | 1 |
tournament.py | feat7/chess_lm | 0 | 33970 | # """run the models and calculate ELO ratings
# 19.11.2020 - @yashbonde"""
# from argparse import ArgumentParser
# from chess_lm.model import ModelConfig
# from chess_lm.game import Player
# import torch
# def expected(p1, p2):
# return 1 / (1 - 10 ** ((p2 - p1) / 400))
# def elo(p, e, s, k=32):
# return ... | 2.484375 | 2 |
workbench.py | swprojects/Serial-Sequence-Creator | 1 | 33971 | """
Description:
Requirements: pySerial, wxPython Phoenix
glossary and of other descriptions:
DMM - digital multimeter
PSU - power supply
SBC - single board computer
INS - general instrument commands
GEN - general sequence instructions
"""
import json
import logging
import serial
import serialfunctions as sf
imp... | 2.625 | 3 |
exawind/prelude/coroutines.py | sayerhs/py-exawind | 0 | 33972 | # -*- coding: utf-8 -*-
"""\
Coroutine utilities
-------------------
Some code snippets inspired by http://www.dabeaz.com/coroutines/
"""
import re
import functools
def coroutine(func):
"""Prime a coroutine for send commands.
Args:
func (coroutine): A function that takes values via yield
Retur... | 2.890625 | 3 |
models.py | askomorokhov/fast-api-example | 0 | 33973 | from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DateTime
from sqlalchemy.orm import relationship
import datetime
from database import Base
class Org(Base):
__tablename__ = "orgs"
id = Column(Integer, primary_key=True, index=True)
name = Column(String, unique=True, index=True)
cr... | 2.78125 | 3 |
mysterious_moose/src/virus.py | fiddlen/code-jam-5 | 1 | 33974 | import math
import pygame
class Virus:
""" Main Virus class """
def __init__(self, impact, virulence, detectability, industry, start_region, renderer=None):
self.blocks = []
self.impact = impact
self.virulence = virulence
self.detectability = detectability
# self.graph... | 3.53125 | 4 |
alipay/aop/api/domain/ReduceInfo.py | snowxmas/alipay-sdk-python-all | 213 | 33975 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ReduceInfo(object):
def __init__(self):
self._brand_name = None
self._consume_amt = None
self._consume_store_name = None
self._payment_time = No... | 2.140625 | 2 |
ex049.py | igormba/python-exercises | 0 | 33976 | <filename>ex049.py
'''Rafaça o DESAFIO 009, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for.'''
n = int(input('Digite um número para ver sua tabuada: '))
print('-' * 12)
for tabu in range(0, 11):
print('{} x {:2} = {}'.format(n, tabu, n*tabu))
print('-' * 12) | 3.9375 | 4 |
data_plotting/idlsize/plots.py | krinii/dds-on-hardware | 0 | 33977 | #!/usr/bin/python3
import sys
import time
import array
import numpy as np
import pandas as pd
import statistics
import matplotlib.pyplot as plt
import seaborn as sns
# sns.set_theme(style="darkgrid")
x_b = [1, 10, 100, 1000, 10000, 100000, 1000000]
cyc_pi2 = [8379072, 8379072, 3675200, 372864, 37312, 3728, 368]
cyc... | 2.234375 | 2 |
app/extensions.py | rileymjohnson/fbla | 0 | 33978 | from flask_bcrypt import Bcrypt
from flask_caching import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
import logging
bcrypt = Bcrypt()
login_manager = LoginManager()
db = SQLAlchemy()
migrate =... | 2.03125 | 2 |
tests/scripts/negative_linenumber_offsets.py | andyfcx/py-spy | 8,112 | 33979 | import time
def f():
[
# Must be split over multiple lines to see the error.
# https://github.com/benfred/py-spy/pull/208
time.sleep(1)
for _ in range(1000)
]
f()
| 2.125 | 2 |
starfish/core/imagestack/parser/crop.py | haoxusci/starfish | 164 | 33980 | <filename>starfish/core/imagestack/parser/crop.py<gh_stars>100-1000
from collections import OrderedDict
from typing import Collection, List, Mapping, MutableSequence, Optional, Set, Tuple, Union
import numpy as np
from slicedimage import Tile, TileSet
from starfish.core.imagestack.parser import TileCollectionData, Ti... | 2.28125 | 2 |
mpc_ros/script/teleop_keyboard.py | NaokiTakahashi12/mpc_ros | 335 | 33981 | #!/usr/bin/python
# This is a modified verison of turtlebot_teleop.py
# to fullfill the needs of HyphaROS MiniCar use case
# Copyright (c) 2018, HyphaROS Workshop
#
# The original license info are as below:
# Copyright (c) 2011, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms... | 1.789063 | 2 |
gym-dubins-airplane/gym_dubins_airplane/envs/config.py | hasanisci/gym-dubins-ac | 2 | 33982 | <reponame>hasanisci/gym-dubins-ac<filename>gym-dubins-airplane/gym_dubins_airplane/envs/config.py
import math
class Config:
G = 9.8
EPISODES = 1000
# input dim
window_width = 800 # pixels
window_height = 800 # pixels
window_z = 800 # pixels
diagonal = 800 # this one is u... | 1.890625 | 2 |
exemplos/exemplo-aula-04-01.py | quitaiskiluisf/TI4F-2021-LogicaProgramacao | 0 | 33983 | <reponame>quitaiskiluisf/TI4F-2021-LogicaProgramacao
# Apresentação
print('Programa para identificar a que cargos eletivos')
print('uma pessoa pode se candidatar com base em sua idade')
print()
# Entradas
idade = int(input('Informe a sua idade: '))
# Processamento e saídas
print('Esta pessoa pode se candid... | 3.734375 | 4 |
etl/parsers/etw/Microsoft_Windows_UAC_FileVirtualization.py | IMULMUL/etl-parser | 104 | 33984 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-UAC-FileVirtualization
GUID : c02afc2b-e24e-4449-ad76-bcc2c2575ead
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import S... | 1.992188 | 2 |
fetchData.py | charlingli/automatic-ticket-assignment | 0 | 33985 | <reponame>charlingli/automatic-ticket-assignment<filename>fetchData.py
import requests
from requests.auth import HTTPBasicAuth
from elasticsearch import Elasticsearch
import json
import sys
import datetime
from operator import itemgetter
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning... | 2.28125 | 2 |
Code/3. Baseline_LSTM.py | davidpaulkim/Stock-price-prediction-using-GAN | 63 | 33986 | <filename>Code/3. Baseline_LSTM.py
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import tensorflow
from numpy import *
from math import sqrt
from pandas import *
from datetime import datetime, timedelta
from sklearn.preprocessing import LabelEncoder, MinMaxScaler
from sklearn.preprocessing im... | 2.875 | 3 |
Algorithms_medium/0081. Search in Rotated Sorted Array II.py | VinceW0/Leetcode_Python_solutions | 4 | 33987 | """
0081. Search in Rotated Sorted Array II
Medium
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]).
You are given a target value to search. If found in the array return true, otherwise return false.
Example 1:
Input... | 3.90625 | 4 |
augmentation/main.py | LinaGamer15/withBears | 0 | 33988 | <gh_stars>0
import pathlib, typing, random, xml.etree.ElementTree as ET
from itertools import chain
from typing import List, Tuple
from PIL import Image, ImageOps
def split_background(background: Image.Image) -> list[Image.Image]:
res = []
for x in range(0, background.width-416, 416):
for y in range(0,... | 2.578125 | 3 |
HinetPy/win32.py | seisman/HinetPy | 54 | 33989 | """
Processing data in win32 format.
"""
import glob
import logging
import math
import os
import subprocess
import tempfile
from fnmatch import fnmatch
from multiprocessing import Pool, cpu_count
from subprocess import DEVNULL, PIPE, Popen
# Setup the logger
FORMAT = "[%(asctime)s] %(levelname)s: %(message)s"
logging.... | 2.375 | 2 |
examples/simple.py | realazthat/aiopg-trollius | 1 | 33990 | import asyncio
import aiopg
dsn = 'dbname=aiopg user=aiopg password=<PASSWORD> host=127.0.0.1'
@asyncio.coroutine
def test_select():
pool = yield from aiopg.create_pool(dsn)
with (yield from pool.cursor()) as cur:
yield from cur.execute("SELECT 1")
ret = yield from cur.fetchone()
asse... | 2.65625 | 3 |
sta_etl/__init__.py | XeBoris/git-etl | 0 | 33991 | """Top-level package for sta-etl."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
#from sta_etl import *
| 1.179688 | 1 |
care/facility/api/viewsets/patient_external_test.py | MaharashtraStateInnovationSociety/care | 0 | 33992 | from collections import defaultdict
import io
import hashlib
from datetime import date, datetime
from pyexcel_xls import get_data as xls_get
import pandas
import magic
from contextlib import closing
import csv
from django.db import connection
from io import StringIO
import uuid
from psycopg2.errors import UniqueViolati... | 1.859375 | 2 |
tests/bsmp/test_commands.py | lnls-sirius/pydrs | 0 | 33993 | <reponame>lnls-sirius/pydrs
from unittest import TestCase
from siriuspy.pwrsupply.bsmp.constants import ConstPSBSMP
from pydrs.bsmp import CommonPSBSMP, EntitiesPS, SerialInterface
class TestSerialCommandsx0(TestCase):
"""Test BSMP consulting methods."""
def setUp(self):
"""Common setup for all tes... | 2.578125 | 3 |
data/hsd11b1_validation/get_smiles_cactus.py | AstraZeneca/jazzy | 0 | 33994 | """Converts synonyms into SMILES for the data from Gerber's paper."""
# data/hsd11b1_validation/get_smiles_cactus.py
from io import BytesIO
import pandas as pd
import pycurl
def getsmiles_cactus(name):
"""Converts synonyms into SMILES strings.
A function to use the public cactus (National Institutes of Canc... | 3.15625 | 3 |
scripts/snippets/eval-clevr-instance-retrieval/eval-referential.py | Glaciohound/VCML | 52 | 33995 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : eval-referential.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 30.07.2019
# Last Modified Date: 16.10.2019
# Last Modified By : Chi Han, Jiayuan Mao
#
# This file is part of the VCML codebase
# ... | 1.898438 | 2 |
plenum/test/view_change/slow_nodes/conftest.py | steptan/indy-plenum | 0 | 33996 | import pytest
@pytest.fixture(scope="module")
def client(looper, txnPoolNodeSet, client1, client1Connected):
return client1Connected
| 1.601563 | 2 |
lib/python/cellranger/feature/utils.py | qiangli/cellranger | 1 | 33997 | #!/usr/bin/env python
#
# Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#
# Utils for feature-barcoding technology
import numpy as np
import os
import json
import tenkit.safe_json as tk_safe_json
def check_if_none_or_empty(matrix):
if matrix is None or matrix.get_shape()[0] == 0 or matrix.get_shape(... | 2.359375 | 2 |
A_SHERIFS_CAD/lib/hm_visual/Sampling_analysis.py | fault2shaESCWG/CentralApenninesLabFAULT2RISK | 0 | 33998 | <reponame>fault2shaESCWG/CentralApenninesLabFAULT2RISK<gh_stars>0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""SHERIFS
Seismic Hazard and Earthquake Rates In Fault Systems
Version 1.0
@author: thomas
"""
import numpy as np
import os
from scipy.stats import chisquare
from scipy.stats import multivariate_norma... | 2.40625 | 2 |
tests/rimu_test.py | srackham/rimu-py | 0 | 33999 | import json
import rimu
from rimu import options
def unexpectedError(_, message):
raise Exception(f'unexpected callback: {message}')
def test_render():
assert rimu.render('Hello World!') == '<p>Hello World!</p>'
def test_jsonTests():
with open('./tests/rimu-tests.json') as f:
data = json.load... | 2.4375 | 2 |