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 |
|---|---|---|---|---|---|---|
test_spi/spi_slave_pulsegen.py | mngr0/rhea | 0 | 54300 | import sys
import os
sys.path.append( os.path.abspath("../") )
import myhdl
from myhdl import (Signal, intbv, instance, always_comb, delay, always,
StopSimulation, block)
from rhea.system import Global, Clock, Reset, FIFOBus, Signals
from rhea.cores.spi import SPIBus, spi_slave_fifo_async
from rhe... | 2.171875 | 2 |
PythonDesafios/d046.py | adaatii/Python-Curso-em-Video- | 0 | 54301 | #Faça um programa que mostre na tela uma contagem regressiva para
# o estouro de fogos de artifício, indo de 10 até 0, com uma pausa
# de 1 segundo entre eles.
from time import sleep
for i in range(10, -1, -1):
print('{}'.format(i))
sleep(1)
print('Bum, BUM, POW')
| 3.53125 | 4 |
example/project/wsgi.py | rterehov/Spirit | 0 | 54302 | <filename>example/project/wsgi.py
# -*- coding: utf-8 -*-
from django.core.wsgi import get_wsgi_application
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.local_prod")
application = get_wsgi_application() | 1.382813 | 1 |
Proper/proper/prop_hex_aperture.py | RupertDodkins/medis | 1 | 54303 | <reponame>RupertDodkins/medis
# Copyright 2016, 2017 California Institute of Technology
# Users must agree to abide by the restrictions listed in the
# file "LegalStuff.txt" in the PROPER library directory.
#
# PROPER developed at Jet Propulsion Laboratory/California Inst. Technology
# Original IDL version by... | 2.796875 | 3 |
pywebui/builder/templates/cordova/{{ cookiecutter._cordova_dir }}/cordova-plugin-pywebui/p4a/src/main.py | kahowell/pywebui | 2 | 54304 | # dummy file, not actually used
| 1.101563 | 1 |
migrations/versions/eec5a7359447_adding_nodes_edges.py | TheKidDewey/microblog | 0 | 54305 | """adding nodes / edges
Revision ID: eec5a7359447
Revises: <KEY>
Create Date: 2021-11-08 21:43:02.200062
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'eec5a7359447'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### com... | 1.273438 | 1 |
starter_simpleNN.py | MirunaPislar/Word2vec | 13 | 54306 | import numpy as np
import random
# Softmax function, optimized such that larger inputs are still feasible
# softmax(x + c) = softmax(x)
def softmax(x):
orig_shape = x.shape
x = x - np.max(x, axis = 1, keepdims = True)
exp_x = np.exp(x)
x = exp_x / np.sum(exp_x, axis = 1, keepdims = True)
assert x.shape == orig_sh... | 3.1875 | 3 |
textprocess.py | JasonYangShadow/horizonscanning | 1 | 54307 | <filename>textprocess.py
import pycurl
try:
from urllib.parse import urlencode
except:
from urllib import urlencode
try:
from BytesIO import BytesIO
except ImportError:
from io import BytesIO
import json
from gensim.utils import simple_preprocess
from gensim.parsing.preprocessing import STOPWORDS
from g... | 2.78125 | 3 |
pycrypt.py | Arucarn/pycrypt | 0 | 54308 | #!/usr/bin/env python3
from random import randint
class Caesar(object):
def shift(self, offset):
"""Shifts the alphabet using a random number.
Returns the value of the shift."""
self.alphabet = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', ... | 3.953125 | 4 |
SimpleAddition/sum_classes.py | OpenGuide/Python---Beginner-s-Guide | 35 | 54309 | <filename>SimpleAddition/sum_classes.py
# This example uses python classes for addition
class Numbers(object):
def __init__(self):
self.sum = 0
def add(self,x):
# Addtion funciton
self.sum += x
def total(self):
# Returns the total of the sum
return self.sum
if __name__ == "__main_... | 3.765625 | 4 |
newproject/basketapp/views.py | Floou/new-django-project | 0 | 54310 | from basketapp.models import TrainerBasket
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.urls import reverse
from mainapp.models import Trainer
@login_required
def index(request):
items = TrainerB... | 1.9375 | 2 |
ispyb/sp/emacquisition.py | rjgildea/ispyb-api | 0 | 54311 | <gh_stars>0
# emacquisition.py
#
# Copyright (C) 2014 Diamond Light Source, <NAME>
#
# 2014-09-24
#
# Methods to store EM acquisition data
#
import copy
from ispyb.sp.acquisition import Acquisition
from ispyb.strictordereddict import StrictOrderedDict
class EMAcquisition(Acquisition):
"""EMAcquisition provid... | 1.789063 | 2 |
examples/sensors.py | eirerocks/samsara-python-eu | 1 | 54312 | #!/usr/bin/python
"""
This script retrieves all the sensors for a group and prints their ID, Name, Mac Address.
To use it, run:
./examples/sensors --access_token <SAMSARA_API_TOKEN> --group_id <GROUP_ID>
passing in your Samsara API access token and the group ID you want to access.
"""
import click
import samsara
fr... | 3.28125 | 3 |
src/wedge_data.py | tito91/memreport-tool | 4 | 54313 | <filename>src/wedge_data.py<gh_stars>1-10
import numpy
from src.filesize.filesize import FileSize
class WedgeData:
filler_color = (0, 0, 0, 0)
merged_color = (1, 0, 0, 1)
def __init__(self, name, filesize, color, annotation_text, can_be_root, node_id=-1, is_filler=False):
self.name = name
... | 2.640625 | 3 |
examples/websocket/http.py | FabianElsmer/rueckenwind | 3 | 54314 | import rw.websocket
import rw.http
from rw import gen
class WebSocketHandler(rw.websocket.WebSocketHandler):
@gen.engine
def open(self):
print 'open'
@gen.engine
def on_message(self, message):
print 'on message'
@gen.engine
def on_close(self):
print 'on close'
d... | 2.453125 | 2 |
displayDetails.py | Megha-Bose/Plasma-Bank-MySQL-CLI | 1 | 54315 | import pretty
from pretty import *
def displayUserDetails(cur,con,loginid):
try:
query = "SELECT * FROM USER WHERE Login_id='%s'" % (loginid)
if cur.execute(query):
pretty(cur.fetchall())
con.commit()
except Exception as e:
con.rollback()
print("Display D... | 2.640625 | 3 |
client/flask_server.py | Blockchain-Simplified/Blockchain-Simplified | 9 | 54316 | import uuid
import requests
from flask import Flask, request
from flask import jsonify
import configFileControl
from cipherOperations import genrateKeys, decryptData, saveKeyinFile
# =============================================================================================================================
NODE_URL... | 2.0625 | 2 |
1-mouth01/day16/exe03.py | gary-gggggg/gary | 4 | 54317 | <filename>1-mouth01/day16/exe03.py
"""练习 1:使用生成器表达式在列表中获取所有字符串.
list01 = [43, "a", 5, True, 6, 7, 89, 9, "b"]
练习 2:在列表中获取所有整数,并计算它的平fang."""
list01 = [43, "a", 5, True, 6, 7, 89, 9, "b"]
gd1 = (item for item in list01 if type(item) is str)
for item in gd1:
print(item)
gd2 = (item2 for item2 in list01 if type(item... | 3.3125 | 3 |
todo/config.py | ruslan-ok/ruslan | 0 | 54318 | from task.const import *
app_config = {
'name': APP_TODO,
'app_title': 'tasks',
'icon': 'check2-square',
'role': ROLE_TODO,
'main_view': 'planned',
'use_groups': True,
'use_selector': True,
'use_important': True,
'sort': [
('stop', 'termin'),
('name', 'name'),
... | 1.648438 | 2 |
czsc/utils/__init__.py | vercity/czsc | 1 | 54319 | <filename>czsc/utils/__init__.py<gh_stars>1-10
# coding: utf-8
from .echarts_plot import kline_pro, heat_map
from .ta import KDJ, MACD, EMA, SMA
from .io import read_pkl, save_pkl, read_json, save_json
from .log import create_logger
from .word_writer import WordWriter
def x_round(x: [float, int], digit=4):
"""用去... | 2.5 | 2 |
py/manipulation/props/object_collection.py | wx-b/dm_robotics | 128 | 54320 | # Copyright 2020 DeepMind Technologies Limited.
#
# 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 ag... | 2.515625 | 3 |
filemanager/core.py | rameezarshad/django-filemanager | 4 | 54321 | import os, shutil
import re
from django.conf import settings
from django.core.files.base import ContentFile
from filemanager import signals
from filemanager.settings import DIRECTORY, STORAGE
from filemanager.utils import sizeof_fmt
class Filemanager(object):
def __init__(self, path=None):
self.update_p... | 2.140625 | 2 |
ecssweb/settings.example.py | Lewes/ecssweb | 4 | 54322 | <gh_stars>1-10
"""
Django settings for ecssweb project.
Generated by 'django-admin startproject' using Django 2.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
""... | 1.765625 | 2 |
parsearguments.py | ryan-feng/GRAPHITE | 3 | 54323 | <filename>parsearguments.py<gh_stars>1-10
import sys
import argparse
def getarguments():
parser = argparse.ArgumentParser(description='GRAPHITE')
# Key parameters
parser.add_argument('--victim_id', '-v', default='14', help='The victim class id.')
parser.add_argument('--target_id', '-t', default='1', he... | 2.59375 | 3 |
src/ttblit/core/dfu.py | 32blit/32blit-tools | 11 | 54324 | <reponame>32blit/32blit-tools
import pathlib
import zlib
import construct
from construct import (Checksum, Const, CString, Flag, GreedyBytes,
GreedyRange, Hex, Int8ul, Int16ul, Int32ul, Padded,
Padding, Prefixed, RawCopy, Rebuild, Struct, len_, this)
DFU_SIGNATURE = b'Dfu... | 2.1875 | 2 |
contextual_encoders/aggregator.py | StuttgarterDotNet/contextual-encoders | 0 | 54325 | """
Aggregator
====================================
*Aggregators* are used to combine multiple matrices to a single matrix.
This is used to combine similarity and dissimilarity matrices of multiple attributes to a single one.
Thus, an *Aggregator* :math:`\\mathcal{A}` is a mapping of the form
:math:`\\mathcal{A} : \\ma... | 2.609375 | 3 |
elk_pi_tube_direct/pcb/elk_pi_tube_direct.py | cclauss/myelin-acorn-electron-hardware | 42 | 54326 | <gh_stars>10-100
#!/usr/bin/python
# Copyright 2017 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.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 2.296875 | 2 |
byceps/blueprints/site/page/views.py | homeworkprod/byceps | 23 | 54327 | """
byceps.blueprints.site.page.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask import abort, g
from ....services.page import service as page_service
from ....util.framework.blueprint import create_blueprint
from .templating ... | 2.15625 | 2 |
src/icolos/utils/enums/general_utils_enums.py | CMargreitter/Icolos | 11 | 54328 | class CheckFileGenerationEnum:
GENERATED_SUCCESS = "generated_success"
GENERATED_EMPTY = "generated_empty"
NOT_GENERATED = "not_generated"
# try to find the internal value and return
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
# p... | 2.4375 | 2 |
python-if/exercise1.py | ATelders/learn-python | 0 | 54329 | <filename>python-if/exercise1.py
value = '6'
if value == '7':
print('The value is 7')
elif value == '8':
print('The value is 8')
else:
print('The value is not one we are looking for')
print('Finished!')
| 3.5625 | 4 |
src/frame/mysql_manager.py | f304646673/scheduler_frame | 9 | 54330 | import json
import frame_tools
from collections import OrderedDict
import conf_keys
from mysql_conn import mysql_conn
from loggingex import LOG_WARNING
from loggingex import LOG_INFO
from singleton import singleton
from mysql_conn import mysql_conn
class mysql_conn_info:
def __init__(self):
self.vali... | 2.296875 | 2 |
twitter_countryGeo/twitter-geo/embers/utils.py | nwself/geocoding | 3 | 54331 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# vim: ts=4 sts=4 sw=4 tw=79 sta et
"""%prog [options]
Python source code - @todo
"""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
import collections
import os
import unicodedata
import time
import datetime
import json
import calendar
import copy
from .logging_conf import ... | 2.21875 | 2 |
src/scripts/experiment-1-searchstims/generate_source_data_csv.py | NickleDave/Nicholson-Prinz-2020 | 1 | 54332 | #!/usr/bin/env python
# coding: utf-8
"""script that generates source data csvs for searchstims experiment figures"""
from argparse import ArgumentParser
from collections import defaultdict
from pathlib import Path
import pandas as pd
import pyprojroot
import searchnets
def main(results_gz_root,
source_dat... | 2.734375 | 3 |
light_aligner/suggest_tolerance.py | ffreemt/light-aligner | 3 | 54333 | """ suggest a sensible tolerance for a matrix and coverage-rate (default 0.6).
"""
from typing import Optional
import numpy as np
from tqdm import trange
from logzero import logger
from .coverage_rate import coverage_rate
# fmt: off
def suggest_tolerance(
mat: np.ndarray,
c_rate: float = 0.66,
... | 2.75 | 3 |
archiv/migrations/0001_initial.py | acdh-oeaw/nerdpool-api | 0 | 54334 | # Generated by Django 3.1.7 on 2021-03-20 12:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='NerSource',
fields=[
... | 1.867188 | 2 |
back/babar_twitter/admin.py | dryvenn/babar3 | 0 | 54335 | <filename>back/babar_twitter/admin.py
from django.contrib import admin
from .models import *
class TweetAdmin(admin.ModelAdmin):
fields = ['time', 'message', 'timestamp']
readonly_fields = ['time', 'message', 'timestamp']
list_filter = ['timestamp']
admin.site.register(Tweet, TweetAdmin)
| 1.9375 | 2 |
bin/collate_lesion_segmentations.py | rsjones94/neurosegment | 0 | 54336 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
One off for preparing lesion segmentations for validation by a neuroradiologist
"""
import os
import shutil
import pandas as pd
master_folder = '/Users/manusdonahue/Documents/Sky/segmentations_sci/pt_data/'
to_folder = '/Users/manusdonahue/Documents/Sky/lesion_trai... | 2.203125 | 2 |
utils.py | tuxskar/trending-highlighter | 1 | 54337 | <reponame>tuxskar/trending-highlighter
def json_dates_handler(obj):
if hasattr(obj, 'isoformat'):
return obj.isoformat()
return str(obj)
| 2.125 | 2 |
sdk/python/pulumi_oci/ons/get_subscriptions.py | EladGabay/pulumi-oci | 5 | 54338 | <reponame>EladGabay/pulumi-oci
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence,... | 1.671875 | 2 |
engineering_tool/areas.py | pinyoothotaboot/engineering_tool | 3 | 54339 | <reponame>pinyoothotaboot/engineering_tool
import math
class Area:
"""
Function : circularsector
Description : This function to calculate area of circular sector.
Formula : angle/2 x radius^2
Input :
- Radius number type integer or float
... | 4.46875 | 4 |
fabfile.py | sn1k/Vinos | 0 | 54340 | <reponame>sn1k/Vinos
#Dock download & install
def getDocker():
run('sudo apt-get update')
run('sudo apt-get install -y docker.io')
run('sudo docker pull sn1k/submodulo-alberto')
#Ejecucion de docker
def runDocker():
run('sudo docker run -p 80:80 -i -t sn1k/submodulo-alberto')
| 2.015625 | 2 |
academics/migrations/0011_auto_20151203_1617.py | rectory-school/rectory-apps | 0 | 54341 | <filename>academics/migrations/0011_auto_20151203_1617.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('academics', '0010_auto_20151203_0915'),
]
operations = [
migration... | 1.476563 | 1 |
openmdao/solvers/scipy_gmres.py | jcchin/project_clippy | 0 | 54342 | <reponame>jcchin/project_clippy<filename>openmdao/solvers/scipy_gmres.py
""" OpenMDAO LinearSolver that uses Scipy's GMRES to solve for derivatives."""
from __future__ import print_function
from six import iteritems
from scipy.sparse.linalg import gmres, LinearOperator
from openmdao.solvers.solver_base import Linea... | 2.25 | 2 |
m_gym/envs/excavator_digging_sparse.py | iku-work/m-gym | 0 | 54343 | import gym
from gym import spaces
import numpy as np
import os
import sys
from m_gym.envs.createsim import CreateSimulation
from m_gym.envs.meveahandle import MeveaHandle
from time import sleep
from math import exp
class ExcavatorDiggingSparseEnv(gym.Env):
def __init__(self):
super(ExcavatorDiggingSparseEnv, ... | 2.203125 | 2 |
movies/redbox/admin.py | thinkjson/movies.thinkjson.com | 0 | 54344 | <filename>movies/redbox/admin.py<gh_stars>0
from django.contrib import admin
from redbox.models import Movie
class MovieAdmin(admin.ModelAdmin):
ordering = ('-score',)
list_display = ('title', 'productid', 'metascore', 'critics_score', 'audience_score', 'score', 'format', 'mpaarating',)
list_filter = ('fo... | 1.648438 | 2 |
nxs_utils/common.py | microsoft/nxs | 5 | 54345 | <gh_stars>1-10
from __future__ import division, print_function, absolute_import
import os
import uuid
import shutil
import json
import requests
import time
def generate_uuid() -> str:
return str(uuid.uuid4()).replace('-','')
def create_dir_if_needed(dir_path):
if not os.path.exists(dir_path):
os.maked... | 2.40625 | 2 |
rtwilio/__init__.py | datamade/rapidsms-twilio | 1 | 54346 | <reponame>datamade/rapidsms-twilio<gh_stars>1-10
"Twilio backend for the RapidSMS project."
__version__ = '1.0.1'
| 0.953125 | 1 |
CPU/python/numba/multi_matrix.py | maxtcurie/Parallel_programming | 0 | 54347 | <gh_stars>0
#https://youtu.be/x58W9A2lnQc
from numba import jit
import numpy as np
import time
n=1000
run_times=2000
def matmul(A, B):
"""Perform square matrix multiplication of C = A * B
"""
return A*B
jitted_matmul=jit(nopython=True)(matmul)
a=np.random.rand(n,n)
print('*******with jit*********')
st... | 3.609375 | 4 |
data-structures/python/trie/core.py | mcqueenjordan/learning_sandbox | 1 | 54348 | <reponame>mcqueenjordan/learning_sandbox<gh_stars>1-10
class Trie(object):
'''The main Trie object.'''
def __init__(self, words):
'''Takes the text given and creates a Trie.'''
self.root = Node(None, '')
self.words = words
self.build(words)
def build(self, text):
'''... | 4.03125 | 4 |
setup.py | michaels10/pydec | 0 | 54349 | #!/usr/bin/env python
"""PyDEC: Software and Algorithms for Discrete Exterior Calculus
"""
DOCLINES = __doc__.split("\n")
import os
import sys
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
Intended Audience :: Developers
Intended Audience :: Education
License :... | 2.15625 | 2 |
drivers/oasissiren.py | BuloZB/turhouse | 0 | 54350 | # -*- coding: utf-8 -*-
from oasisbase import *
class OasisSiren(OasisBase):
__mapper_args__ = {
'polymorphic_identity': 'OasisSiren'
}
def __init__(self, device_name):
super(OasisSiren, self).__init__(device_name)
def processMessage(self, msg):
'''
process mess... | 2.296875 | 2 |
tests/test_fastarg.py | travisluong/fastarg | 1 | 54351 | from src import fastarg
import subprocess
def test_foo():
assert 'foo'.upper() == 'FOO'
def test_fastarg_no_methods():
app = fastarg.Fastarg()
assert len(app.commands) == 0
def test_fastarg_one_method():
app = fastarg.Fastarg()
@app.command()
def foo():
print("foo")
assert len(... | 2.671875 | 3 |
backends/__init__.py | chiluf/visvis.dev | 0 | 54352 | <reponame>chiluf/visvis.dev<filename>backends/__init__.py
# -*- coding: utf-8 -*-
# Copyright (C) 2012, <NAME>
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" Package visvis.backends
Visvis allows multiple backends. I tried to make implementing... | 2.34375 | 2 |
clean.py | paradoxxxzero/sutomok | 0 | 54353 | from random import seed, shuffle
import re
import os
from shutil import rmtree
import unicodedata
seed("lol")
def strip_accents(s):
return "".join(
c for c in unicodedata.normalize("NFD", s) if unicodedata.category(c) != "Mn"
)
words = []
with open("./zone.txt") as f:
for word in f.readlines():... | 2.890625 | 3 |
src/unittest/python/livestatus_service_tests.py | Scout24/livestatus_service | 10 | 54354 | <filename>src/unittest/python/livestatus_service_tests.py<gh_stars>1-10
'''
The MIT License (MIT)
Copyright (c) 2013 ImmobilienScout24
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 rest... | 1.914063 | 2 |
styletransferonnx.py | Mut1nyJD/styletransferonnx | 0 | 54355 | import argparse
from PIL import Image
import numpy as np
import onnxruntime as rt
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="StyleTransferONNX")
parser.add_argument('--model', type=str, default=' ', help='ONNX model file', required=True)
parser.add_argument('--input', type=str, d... | 2.46875 | 2 |
maketrainingimages.py | leidix/images-to-osm | 487 | 54356 | <filename>maketrainingimages.py
import imagestoosm.config as cfg
import os
import QuadKey.quadkey as quadkey
import numpy as np
import shapely.geometry as geometry
from skimage import draw
from skimage import io
import csv
minFeatureClip = 0.3
# make the training data images
# construct index of osm data, each point... | 2.546875 | 3 |
test/inspections/test_count_distinct_of_columns.py | JinyangLi01/mlinspect | 40 | 54357 | <gh_stars>10-100
"""
Tests whether CountDistinctOfColumns works
"""
from inspect import cleandoc
from testfixtures import compare
from mlinspect._pipeline_inspector import PipelineInspector
from mlinspect.inspections import CountDistinctOfColumns
def test_count_distinct_merge():
"""
Tests whether CountDisti... | 2.46875 | 2 |
app/elearn/views/sybadmin_views.py | Shetty073/soak-your-brain-elearning-app | 16 | 54358 | <gh_stars>10-100
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.hashers import check_password
from django.contrib.auth.models import Group
from django.shortcuts import render, redirect
from ..decorators import allowed_users
from ..models import *
... | 1.984375 | 2 |
lesson2/task4.py | kati-Ist/python_geekbrains | 0 | 54359 | # 4. Пользователь вводит строку из нескольких слов, разделённых пробелами.
# Вывести каждое слово с новой строки. Строки необходимо пронумеровать.
# Если в слово длинное, выводить только первые 10 букв в слове.
# userTense = "В студеную зимнюю пору я из лесу вышел, был сильный мороз 123456789abcdef"
userTense = input... | 4 | 4 |
django_mooc/assignments/migrations/0001_initial.py | cowhite/django-mooc | 0 | 54360 | <reponame>cowhite/django-mooc
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-29 10:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... | 1.804688 | 2 |
xbbg/core/pdblp.py | jkassies/xbbg | 0 | 54361 | <filename>xbbg/core/pdblp.py<gh_stars>0
from abc import abstractmethod
class Session(object):
@abstractmethod
def start(self): return False
class BCon(object):
def __init__(self, port=8194, timeout=500, **kwargs):
self.host = kwargs.pop('host', 'localhost')
self.port = port
sel... | 2.578125 | 3 |
regenerate-tool-contracts.py | mdsmith/pbcoretools | 1 | 54362 | #!/usr/bin/env python
import subprocess
import sys
import os
from pbcommand.engine import run_cmd
def run(args):
output_dir = os.getcwd()
if len(args) == 1:
output_dir = args[0]
assert os.path.isdir(output_dir), "Not a directory: %s"%output_dir
module_dir = os.path.join(os.path.dirname(_... | 2.234375 | 2 |
tests/cli-args/examples/example.py | looking-for-a-job/listify.py | 1 | 54363 | #!/usr/bin/env python
import listify
@listify.listify
def func():
return
@listify.listify
def func2():
yield "value"
@listify.listify
def func3():
return [1, 2, 3]
assert isinstance(func(), list) == True
assert isinstance(func2(), list) == True
assert isinstance(func3(), list) == True
| 3.015625 | 3 |
photobooth/views.py | dan-jugz/galleria | 0 | 54364 | <filename>photobooth/views.py
from django.shortcuts import render,redirect
from django.http import HttpResponse,Http404
import datetime as dt
from .models import Image
# Create your views here.
def home(request):
return HttpResponse(request,'home.html')
def images_of_day(request):
date =dt.date.today()
im... | 2.296875 | 2 |
src/image_output.py | malon43/entropy-visualization | 0 | 54365 | <filename>src/image_output.py
# SPDX-License-Identifier: MIT
from argparse import ArgumentTypeError, FileType
from itertools import chain
from sys import stderr, stdout
from output_common import OutputMethodBase, Parameter, print_check_closed_pipe
from math import ceil, log, sqrt
import re
from palettes import palette... | 2.40625 | 2 |
func/ref_equal.py | dineshkumar2509/learning-python | 86 | 54366 | <filename>func/ref_equal.py
#!/usr/bin/env python
# http://www.cnblogs.com/yuyan/archive/2012/04/21/2461673.html
def add_list(p):
p = p + [1]
p1 = [1,2,3]
add_list(p1)
print p1
def add_list1(p):
p += [1]
p2 = [1,2,3]
add_list1(p2)
print p2
| 2.6875 | 3 |
quest.py | MrMorning/Remember-Automaton | 2 | 54367 | <reponame>MrMorning/Remember-Automaton<filename>quest.py
import os
import pre
import math
import time
K = int(input('How much would you like to review? : '))
x = pre.x
cnt = pre.cnt
print(pre.x[0])
for i in range(0, K):
dd = x[i]
f = open('prob/{}'.format(dd['no']))
s = f.read()
print(s)
ans = in... | 3.171875 | 3 |
crowddynamics/crowddynamics/core/tests/test_vector2D_benchmarks.py | antonvs88/multiobj-guided-evac | 17 | 54368 | <gh_stars>10-100
import numpy as np
from crowddynamics.core.vector2D import rotate90, angle, dot, cross, normalize, \
unit_vector, rotate270, length, truncate
def test_rotate90(benchmark):
value = np.random.uniform(-1.0, 1.0, size=2)
benchmark(rotate90, value)
def test_rotate270(benchmark):
value =... | 2.390625 | 2 |
base/bin/scan.py | JOKER-7X/HackerMode | 2 | 54369 | from N4Tools.Design import Text,Square,ThreadAnimation,Animation,AnimationTools
import requests as req
import socket,os,time,sys
from threading import Thread as u
A = Animation()
class MA:
def CustomAnimation(min=0,max=5639,**kwargs):
yield A.Prograsse(min=min,max=max,prograsse=['│','\033[1;36m█','\033... | 2.75 | 3 |
ndnu-connect-backend/tutor_match/admin.py | NDNUSeniorProj2020/ndnu-connect | 2 | 54370 | <filename>ndnu-connect-backend/tutor_match/admin.py
from django.contrib import admin
from .models import Tutor
from .models import Student
from .models import Department
from .models import Subject
from .models import Schedule
from .models import SubjToDept
admin.site.site_header = "NDNU Connect: Admin Portal"
admin.... | 1.734375 | 2 |
RL.py | mdcpanama22/GA_and_RL | 0 | 54371 | import os
import datetime
import gym
import numpy as np
import matplotlib.pyplot as plt
from es import CMAES
import pandas as pd
import string
def sigmoid(x):
return 1 / (1 + np.exp(-x))
class Agent:
def __init__(self, x, y, layer1_nodes, layer2_nodes):
self.input = np.zeros(x, dtype=np.float128)
... | 3.21875 | 3 |
DroneVisulizer.py | gogoalexy/DroneView | 0 | 54372 | <filename>DroneVisulizer.py
import argparse
import csv
import os
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pyulog
from helper import ULogHelper
from configurations import flight_modes_table, arming_status_table
from Diagnosis import DiagnoseFailure, Vibration
fr... | 2.46875 | 2 |
src/GaIA/pkgs/libsmbios/libsmbios-2.2.19/src/python/libsmbios_c/_common.py | uninth/UNItools | 0 | 54373 | <reponame>uninth/UNItools
# vim:tw=0:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:
#############################################################################
#
# Copyright (c) 2005 Dell Computer Corporation
# Dual Licenced under GNU GPL and OSL
#
##########################################... | 2.078125 | 2 |
intro-cs/intro-to-programming/exercises/ex_10_01.py | solanyn/ossu-cs-coursework | 0 | 54374 | <reponame>solanyn/ossu-cs-coursework<filename>intro-cs/intro-to-programming/exercises/ex_10_01.py<gh_stars>0
"""
Exercise 1: Revise a previous program as follows: Read and parse the “From” lines and pull out the addresses from the line. Count the number of messages from each person using a dictionary.
After all the da... | 3.9375 | 4 |
tests/components/synology_dsm/test_config_flow.py | dzmitov/core | 1 | 54375 | """Tests for the Synology DSM config flow."""
import logging
from unittest.mock import MagicMock, Mock, patch
import pytest
from homeassistant import data_entry_flow
from homeassistant.components.synology_dsm.const import (
CONF_VOLUMES,
DEFAULT_NAME,
DEFAULT_PORT,
DEFAULT_PORT_SSL,
DEFAULT_SSL,
... | 2.375 | 2 |
tests/test_subca.py | jkacou/AutoSSL | 2 | 54376 | <reponame>jkacou/AutoSSL<filename>tests/test_subca.py
# standard packages
import os
import shutil
import tempfile
import collections
# external packages
import pytest
# autossl imports
from autossl import manager, ssl, util
from tests import util as tests_util
CertificateKeyPair = collections.namedtuple('Certificat... | 2.125 | 2 |
mega_analitika/main/migrations/0004_auto_20190703_1700.py | theodor85/mega_analitika | 1 | 54377 | <filename>mega_analitika/main/migrations/0004_auto_20190703_1700.py
# Generated by Django 2.2.3 on 2019-07-03 17:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0003_delete_ad'),
]
operations = [
migrations.AlterField(
... | 1.617188 | 2 |
wkhtmltopdf/views.py | kriwil/django-wkhtmltopdf | 1 | 54378 | <reponame>kriwil/django-wkhtmltopdf
from __future__ import absolute_import
from tempfile import NamedTemporaryFile
import re
from django.conf import settings
from django.http import HttpResponse
from django.template.response import TemplateResponse
from django.views.generic import TemplateView
from .utils import (co... | 2.484375 | 2 |
cleardl/components/models/segmentors/unet.py | shink00000/dl-study | 0 | 54379 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from ..losses import build_loss
class ConvBNAct(nn.Sequential):
def __init__(self, in_channels: int, out_channels: int):
super().__init__(
nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1, bias=... | 2.390625 | 2 |
scanner.py | digitaltembo/ghost-jukebox | 0 | 54380 | """
Scanner.py
This will run in the background and act upon any QR Codes that it sees
"""
from ghost_jukebox import conf
from io import BytesIO
from picamera import PiCamera
from PIL import Image
from pyzbar.pyzbar import decode, ZBarSymbol
from requests.auth import HTTPBasicAuth
from time import sleep
import reque... | 3.1875 | 3 |
ppcd/traditions/__init__.py | geoyee/PdRSCD | 44 | 54381 | <filename>ppcd/traditions/__init__.py
from .cva import CVA
from .basics import BaseCompute
from .mrf import MRF | 1.046875 | 1 |
backend/moonshot/tests.py | paolodamico/moonshot | 0 | 54382 | # -*- coding: utf-8 -*-
import vcr
from django.test import TestCase
from rest_framework import status # noqa: F401
from rest_framework.test import APITestCase
moonshot_vcr = vcr.VCR(
serializer="json",
cassette_library_dir="./fixtures",
record_mode="once",
match_on=["uri", "method"],
filter_heade... | 2.25 | 2 |
social-test-setup/scripts/link_sample_to_collex.py | ONSdigital/rm-tools | 1 | 54383 | <filename>social-test-setup/scripts/link_sample_to_collex.py
import os
from pprint import pprint
import requests
from config.setup_config import Config
def link_sample(collection_exercise_id: str, sample_summary_id: str):
sample_summaries = {'sampleSummaryIds': [sample_summary_id]}
link_collex_response = re... | 2.078125 | 2 |
sphinxcontrib/traceables/utils.py | superzerg/sphinxcontrib-traceables | 0 | 54384 | <filename>sphinxcontrib/traceables/utils.py
import re
from sphinx.util.texescape import escape
# =============================================================================
# Node visiting utilities.
def visit_passthrough(translator, node):
pass
def depart_passthrough(translator, node):
pass
passthroug... | 2.25 | 2 |
bdranalytics/sklearn/tests/test_model_selection.py | BigDataRepublic/bdr-analytics-py | 32 | 54385 | import numpy as np
import pandas as pd
import unittest
from bdranalytics.sklearn.model_selection import GrowingWindow, IntervalGrowingWindow
def create_time_series_data_set(start_date=pd.datetime(year=2000, month=1, day=1), n_rows=100):
end_date = start_date + pd.Timedelta(days=n_rows-1)
ds = np.random.ran... | 2.875 | 3 |
latextools/pdf.py | cduck/latextools | 13 | 54386 | import base64
class Pdf:
def __init__(self, fname=None, data=None, width='100%',
height='300px', border=False, log=None):
self.fname = fname
self.data = data
self.width = width
self.height = height
self.border = border
self.log = log
def save(s... | 2.859375 | 3 |
cogs/gitcog.py | theneeldevs/modbot | 1 | 54387 | 4jr where are you? need this, can I use?
| 0.984375 | 1 |
data_missing.py | palkibansal31/missing-data-handle | 0 | 54388 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 19 08:43:36 2020
@author: HP
"""
#dataFrameName[column_name].dtype
import statistics
import pandas as pd
import numpy as np
import random
#dataset=pd.read_csv(r"C:\Users\HP\Desktop\pp.csv")
def missing(input_file):
dataset=pd.read_cs... | 3.40625 | 3 |
src/User/InterfaceAdapters/IUserRepository.py | DigiChanges/python-experience | 0 | 54389 | from abc import ABC, abstractmethod
from src.Shared.InterfaceAdapters.ICriteria import ICriteria
from src.Shared.InterfaceAdapters.IPaginator import IPaginator
class IUserRepository(ABC):
@abstractmethod
def save(self, element):
pass
@abstractmethod
def getOne(self, id: str):
pass
... | 2.28125 | 2 |
budget/migrations/0001_initial.py | jbrass/django-kanban-budget | 46 | 54390 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-27 21:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [... | 1.71875 | 2 |
endless_piano.py | asigalov61/Endless-Piano | 5 | 54391 | <reponame>asigalov61/Endless-Piano
# -*- coding: utf-8 -*-
"""Endless_Piano.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1K32GFmZDDvEjMX1ZjIaa5Qgmvwi5NIFK
# Endless Piano (ver. 7.0)
***
## Endless Semi-Generative Performance Piano Music Make... | 1.625 | 2 |
locale/pot/api/plotting/_autosummary/pyvista-themes-_SliderStyleConfig-slider_length-1.py | tkoyama010/pyvista-doc-translations | 4 | 54392 | <filename>locale/pot/api/plotting/_autosummary/pyvista-themes-_SliderStyleConfig-slider_length-1.py
import pyvista
pyvista.global_theme.slider_styles.modern.slider_length = 0.02
| 1.039063 | 1 |
at_aloha.py | MollyZhang/PolicyTreeProtocol | 0 | 54393 | <reponame>MollyZhang/PolicyTreeProtocol<filename>at_aloha.py<gh_stars>0
import numpy as np
import random
class AT(object):
"""
This is the AT-ALOHA protocol described in this paper.
https://dl.acm.org/doi/abs/10.1145/3405671.3405817
"""
def __init__(self, name=None, active=True,
... | 3.078125 | 3 |
courses/management/commands/notify_chapter_open.py | vault19/django-courses | 3 | 54394 | <reponame>vault19/django-courses
from datetime import timedelta, datetime
from courses.management.notify_cmd import NotifyCommand
from courses.models import Run
class Command(NotifyCommand):
help = "Notify (send email) users that new chapter has opened (chapter start == today +/- time_delta)."
def handle(se... | 2.328125 | 2 |
src/Tools/Error/alternate_page.py | MarquesThiago/Manga_Downloader | 0 | 54395 | import os, sys
sys.path.insert(0, './../Error/')
from .Pattern.Controllers.alternate_page import (KeyError, NotFoundButtonAlternPg )
def ErrorIncorrectParseKey():
raise KeyError("Not indentificaed key persed")
def ErrorButtonAlternate():
raise NotFoundButtonAlternPg("Not Found Button to Alternage Page") | 2.3125 | 2 |
oleander/views/google.py | honzajavorek/oleander | 0 | 54396 | <gh_stars>0
# -*- coding: utf-8 -*-
from flask import session, request, flash, redirect
from oleander import app, google
from flask.ext.login import login_required
@app.route('/connect/google/done')
@login_required
def google_connected():
action_url = session['action_url']
error_url = session['error_url']
... | 2.609375 | 3 |
predict_traffic.py | clankster99/NN_project | 0 | 54397 | <filename>predict_traffic.py
from PIL import Image
import numpy as np
import os
def show_masked_img(roads_tensor, cars_tensor, raw_img, img_name):
# Convert to numpy
roads_pred = roads_tensor.cpu().detach().numpy()
cars_pred = cars_tensor.cpu().detach().numpy()
# Extract roads
roads_img_r = roads_p... | 2.953125 | 3 |
tiddlywebplugins/tank/closet.py | cdent/tank | 7 | 54398 | """
POST binaries to alternate storage, create a canonical uri tiddler
pointing to that storage.
"""
from httpexceptor import HTTP400
from uuid import uuid4
from mimetypes import guess_extension
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from tiddlyweb.model.bag import Bag
from tiddlyweb.... | 2.25 | 2 |
lib/assets/hellojaden.py | hongjunGu2019/cdk | 0 | 54399 | print('hello jaden') | 0.984375 | 1 |