blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
24bb42aa1f7bc230b8c4bcdd4e4864093e0d6bb6 | 1a8701ee9fb049ff1276028c5eca57120bec1a03 | e-wallero/my_search_engine | /Emmas_search_engine.py | Python | py | 8,422 | no_license | import sys
import nltk
from nltk import pos_tag
from nltk.tokenize import TreebankWordTokenizer
from nltk.corpus import wordnet
from nltk.stem import WordNetLemmatizer, SnowballStemmer
from nltk.stem.porter import *
import shelve
import time
import collections
from operator import itemgetter
lemclass = WordNetLemmati... |
bfadb5590844ab4df24723bab537dc76a1933698 | a8eca1e79769df41da42b0c8df1a77049f639554 | not2envy/weatherapp | /the_weather/weather/views.py | Python | py | 876 | no_license | import requests
from django.shortcuts import render
from .models import City
from .forms import CityForm
def index(request):
url = 'http://api.openweathermap.org/data/2.5/weather?q={}&units=imperial&appid=8ec8135c04753570396796a35394e2fa'
if request.method == 'POST':
form = CityForm(request.POST)
... |
59784f4fedb306dbdb7e884e23000de9b022958f | e28b0b433ae4de3a7929ead5925fe1603f74f031 | jorueda/fundamentos_de_programacion | /personas.py | Python | py | 1,065 | no_license | # Ejercicio 1
# En este ejercicio deberás crear un script llamado personas.py que lea los datos de un fichero
# de texto, que transforme cada fila en un diccionario y lo añada a una lista llamada personas.
# Luego recorre las personas de la lista y para cada una muestra de forma amigable todos sus
# campos. El fiche... |
015f87947d71a6803ae04fecf90462f7c8216d2d | 463c9083165c6245dedfa23b321b647d4ca7b3c3 | BrianHanna/FRC1450SteamWorks2017 | /ImageProcessingTest.py | Python | py | 1,627 | no_license | def emptyCallBack(pram1, pram2):
return;
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
# create trackbars for color change
#cv2.createTrackbar('HMin','image',0,255,nothing)
cv2.namedWindow('image')
cv2.createTrackbar('HMin','image',0,255,emptyCallBack)
cv2.createTrackbar('HMax','image',0,255,emptyCallBa... |
ddc077114550f9d79ccc4509b84a21d48e3f8a76 | ff1dafa0b8ec61cdd1c641c7e0f32d62639018d9 | joshmarshall/dhtest | /server.py | Python | py | 307 | no_license | #!/usr/bin/env python
import os
from dhtest.app import App
from tornado.ioloop import IOLoop
def main():
app = App()
port = int(os.environ.get("PORT", 8080))
app.listen(port)
print "Listening on port {0}".format(port)
IOLoop.instance().start()
if __name__ == "__main__":
main()
|
4cdfc534584976350aa9d72539d717edb413b665 | c7e438227ca8ece479e6cc9a2b036403eb254912 | caleith/hello-world-linux | /Hello-PyEz.py | Python | py | 219 | no_license | from pprint import pprint
from jnpr.junos import Device
dev = Device(host="172.25.11.1", user="lab", password="lab123")
try:
dev.open()
except:
print("\n*** Connection rror ***\n")
pprint (dev.facts)
dev.close()
|
aac6eccc1c1a72c20874fec6d4bfba0b29780386 | 39465f4bea9034cac913717d275fda831a6ddf8c | machinaut/programming_challenges | /ICPCtraining/colors.py | Python | py | 613 | no_license | #!/usr/bin/env python
import sys
from pprint import pprint
def next_color(lst_item):
nxt_lst = []
if type(lst_item) is list:
for i,sub in enumerate(lst_item):
lst_item[i] = map(next_color, sub)
return lst_item
else:
nxt_sub = []
for i in xrange(lst_item+2):
... |
7bf0e3a56e46871f1ad1f496844b6e00edd42a69 | 6b5bbeb2f18456cb47893a36c3842fda2f2902d1 | NobleWolf42/Python101 | /Fun Python/backgrnd.py | Python | py | 801 | no_license | import sys, pygame
from pygame import*
atbg=pygame.image.load("at.png")
im=pygame.image.load("im.png")
bgrect=atbg.get_rect()
screen=pygame.display.set_mode((1250,703))
x=800
y=50
vx=0
vy=0
done=False
while(not done):
for event in pygame.event.get():
if event.type==pygame.QUIT:
done=True
... |
d7d283444ada6165d0a1ea70658e40aefd0d0ba2 | 5343c4f180b2ee9dc81984047c8f618037f1ef4e | jai-somai-lulla/Sem8 | /SoftComputing/421076/Soft Computing _ Optimization Algorithms/Codes/Assignment 2 - Perceptron/Perceptron.py | Python | py | 1,334 | no_license | class Perceptron(object) :
def __init__(self, weights, bias, alpha):
self.weights = weights
self.bias = bias
self.alpha = alpha
def fire(self, inputs, outputs):
yin = sum([i*w for (i,w) in zip(inputs, self.weights)]) + self.bias
yout = self.activate(yin)
self.co... |
c52e41335f5832bcee4eabbfa7f8270c10652c84 | fb107ecfdc36ad9e54dac07ba4d0573fb3c85a8b | Sa-LL/ComputacionBlanda | /PredicciónTemaAudio/AudioTema/audio/views.py | Python | py | 1,770 | no_license | from django.shortcuts import render
from django.views.generic import CreateView, TemplateView, DetailView
from django.urls import reverse_lazy, reverse
from .models import Audio
from .forms import AudioForm
from django.http import HttpResponseRedirect
from .volverTexto import volverTexto
from .predictorBackEnd i... |
fd39de9100e5280681368e951bb6c9546a890247 | 627cc89f61b97e8c78e2f58da9d8c39e2b14f7da | dong435085505/Python-Plugins | /TpFriend/TpFriend.py | Python | py | 16,221 | no_license | __author__ = 'DreTaX'
__version__ = '3.7.2'
import clr
clr.AddReferenceByPartialName("Fougerite")
import Fougerite
import math
import System
from System import *
import re
import sys
path = Util.GetRootFolder()
sys.path.append(path + "\\Save\\Lib\\")
try:
import random
except ImportError:
pass
red = "[color... |
5c555423a3578c0b9a25c5a9fe84f3cd764c1b09 | ac8f8f1325473a05f2807eab1b0be3ff81fd1036 | Maria14Pr/dipserver | /CGApi/cg_api_server/manage.py | Python | py | 633 | no_license | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cg_api_server.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ... |
50c72383a30b548a32f5d50d35d6ab7e0ec2c57f | 4e3863a3a73b75f39b3e704dad5790381e51ae96 | leeryu/python-for-sysadmin | /jumptopython/tab04.py | Python | py | 223 | no_license | import sys
src = sys.argv[1]
dst = sys.argv[2]
print(src)
print(dst)
f = open(src)
tab_content = f.read()
f.close()
space_content = tab_content.replace("\t", " " * 4)
f = open(dst, "w")
f.write(space_content)
f.close() |
4dc546f853b9ea816b90e4bef1a8fc09d3123fcc | 3e639a5828c7ee544643f1788f96483c94a6d408 | gregdavill/KiBuzzard | /KiBuzzard/deps/fonttools/Tests/t1Lib/t1Lib_test.py | Python | py | 5,499 | permissive | import unittest
import os
import sys
from fontTools import t1Lib
from fontTools.pens.basePen import NullPen
from fontTools.misc.psCharStrings import T1CharString
import random
CWD = os.path.abspath(os.path.dirname(__file__))
DATADIR = os.path.join(CWD, 'data')
# I used `tx` to convert PFA to LWFN (stored in the data ... |
d6687ee594ef0ec6ecfa4984d867386343e3c325 | ad112a100517c0eb19d3342175d8136c7ae78d41 | shei-pi/podio | /podio/llegada/tokens.py | Python | py | 458 | no_license | from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils import six
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
def _make_hash_value(self, user, timestamp):
import pdb; pdb.set_trace()
return (
six.text_type(user.pk) + six.text_type(ti... |
49df38fac137473359565d694c5a49f1a4bc71d6 | 030f52f19c701cc1321e48543ad048d666607e98 | AnjiEasonChan/leetcode | /寻找两个正序数组的中位数/寻找两个正序数组的中位数.py | Python | py | 820 | no_license | class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
n1 = len(nums1)
n2 = len(nums2)
if n1 > n2:
return self.findMedianSortedArrays(nums2,nums1)
k = (n1 + n2 + 1)//2
left = 0
right = n1
while left < right :... |
189eedf1e2ee0b806594f5ea86e2a6d5dad7800a | b2b5a99bc0f5d35383f37aab259f41932e8e3254 | dmittov/spb-tf20170205 | /graph_simple.py | Python | py | 631 | permissive | import tensorflow as tf
x = tf.constant(1.0, name='input')
w = tf.Variable(0.8, name='weight')
y = tf.mul(w, x, name='output')
y_ = tf.constant(0.0, name='correct_value')
loss = tf.pow(y - y_, 2, name='loss')
train_step = tf.train.GradientDescentOptimizer(0.025).minimize(loss)
for value in [x, w, y, y_, loss]:
tf... |
7788d3b3886a4c9b2e8823d4a44bbbd594eb3d88 | 8c9b3373477e9d78e40ad647035346b44ff824c8 | azmi989/project-template-lms | /account/migrations/0001_initial.py | Python | py | 3,347 | no_license | # Generated by Django 3.1.2 on 2020-10-22 21:44
import account.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Profession',
fields=[
... |
6bbd6f9791684987d5324c822aedfeff60ffbb9a | 6bf89b6c50f6cc6beed6b1cd419b4029f2a9a577 | sanpj2292/Flask-Blog | /flaskblog/routes.py | Python | py | 6,003 | no_license | from flask import render_template, url_for, flash, redirect, request, abort
from flaskblog import app, bcrypt, db
from flaskblog.forms import RegistrationForm, LoginForm, UpdateAccountForm, PostForm
from flaskblog.models import User, Post
from flask_login import login_user, current_user, logout_user, login_required
imp... |
0ddd42507c98011aca4db8f7ab16537d71fc0215 | c9f9b01d59627dc2607b88fad533ce7f13516ef0 | soyoungpark9187/algorithmStudy | /이코테/두배열의원소교체.py | Python | py | 236 | no_license | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort(reverse=True)
for i in range(k):
if a[i] < b[i]:
a[i], b[i] = b[i], a[i]
else:
break
print(sum(a))
|
8143bdb71326f104de78408a7ffa4ba5b23e08ff | bfb43763d706a4f8f163ad0dad048600c69fc02e | saurabhjinturkar/cedar | /app/__init__.py | Python | py | 1,257 | no_license | from flask import Flask, render_template
#from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
login_manager = LoginManager()
login_manager.session_protection = 'strong'
login_manager.login_view = 'auth.login'
app = Flask(__name__, static_url_p... |
eb7b01f7611a445dea74f25c19db054b3a131613 | 54bae8d0f940368fb6dd6211bcf4f5e55b7a3530 | sandriichenko/contacts | /contacts_exist_model.py | Python | py | 830 | no_license | from config import load, save
try:
phonebook = load()
except FileNotFoundError:
phonebook = {}
def _contact_exists(message, g):
def decorator(f):
def wrapper(name, *args):
if g(name not in phonebook):
raise KeyError(message)
return f(name, *args)
re... |
2bdd4e12644541ccbc4efc69bfe425f1eca4fb1b | 905116d904673bbebf09f06cff981dcad601e4bc | Tunjii10/Deployment-of-titanic-ml-model | /packages/ml_api/api/app.py | Python | py | 434 | permissive | from flask import Flask
from api.config import get_logger
_logger = get_logger(logger_name=__name__)
def create_app(*, config_object)-> Flask:
'''create a flask app instance'''
flask_app = Flask('ml_api')
flask_app.config.from_object(config_object)
#import blueprints
from api.controller import prediction_ap... |
bee1473afa696f07e5ad670fd043dd90e92b57d5 | 3cd70232a389cfc18b8e9fb22437148c2d092e80 | arpandhakal/python_powerworkshop | /jan 19/list/2.py | Python | py | 279 | no_license | num = int(input("Enter number of items in the list: "))
list_1 = []
for each in range(num):
item = input("Enter item: ")
list_1.append(item)
count = 0
for each in list_1:
if len(each) >= 2 and each[0] == each[len(each)-1]:
count += 1
print("{count}") |
cd900a34db7e72da4b4213258db02507a75e372f | f687bef4d1f10cfb9d653e7e4c88a59db0e36a50 | Cepesp-Fgv/tse-dados | /web/tests/responses/test_duplicated_votes.py | Python | py | 1,303 | no_license | import pandas as pd
from web.tests.utils import get_years, get_request_url
APTOS = {
1998: 106_049_062,
2000: 102_644_778,
2002: 115_166_810,
2004: 118_464_969,
2006: 125_826_156,
2008: 128_746_974,
2010: 135_721_843,
2012: 138_544_294,
2014: 142_821_358,
2016: 144_048_995
}
... |
d79c284ee0dcdee1bb4312f8e3babc5e94e4eeeb | ab7c0e0618387844a0744bb22db9a53cefeb054f | gregstuder/cluster_test | /test_lib/provisioning.py | Python | py | 19,313 | no_license | """Provisioning on local network, AWS or other cloud provider."""
import datetime
import time
import json
import os
import sys
import boto.ec2 as ec2
from boto.s3.connection import S3Connection
from boto.s3.key import Key
CLUSTER_TEST_KEY = 'purpose'
CLUSTER_TEST_VALUE = 'cluster_test_framework'
TEST_NAME_KEY = 'tes... |
f0626c4f9e6c9dff7b3453237d6c74aa9bb12239 | 3d49ffa8f0a4f2533d126b7d66af1bccc7343da5 | ThomasKing2014/mcsema | /tests/linux/generate_expected_output.py | Python | py | 5,354 | permissive | #!/usr/bin/env python
import os
import sys
import json
import tempfile
import argparse
import shutil
import subprocess
import time
import base64
def b64(f):
""" Base64 encodes the file 'f' """
with open(f, 'r') as infile:
return base64.b64encode(infile.read())
def run_a_program(pargs, outfile, errf... |
7b7b87e5fd2654880b5a2a8c9e6b1b9d59d8ebfe | 7e1c92907b3a170ff4181e014325a7575a09f08c | icyeyes1999/DataScience | /Yst/toJSON.py | Python | py | 1,092 | no_license | #@by yst 2020.7.02
#修改只需要修改files,path1,path3根据需要来修改
from __future__ import unicode_literals
import xlrd
from collections import OrderedDict
import json
import codecs
path1 = 'C:/Users/RIO/Desktop/抖查查榜单数据/抖查查-抖数据查询平台'
path2 = '.xlsx'
path3 = 'C:/Users/RIO/Desktop/抖查查榜单数据/JSON/'
files = [
'7.6',
'7.8',
'7.11'... |
cf4b510e50278fc563bd19e27bc1428cf5b5a383 | 53aa00e6176564048b4f40508f37f8a1d4e70ab9 | SusanMorton/CP1404_Practicals | /prac_08/taxi_simulator.py | Python | py | 1,339 | no_license | from prac_08.carv2 import Car
from prac_08.taxi import Taxi
from prac_08.silver_service_taxi import SilverServiceTaxi
MENU = "q)uit, c)hoose, d)rive"
def main():
taxis = [Taxi("Prius", 100), SilverServiceTaxi("Limo", 100, 2), SilverServiceTaxi("Hummer", 200, 4)]
current_taxi = None
current_bill = 0
pr... |
de02d23edfa0a91ceaab72f67e58e2ec7374e8aa | 3078183b276f4deaee30f8b9abe79d1245a6d6f9 | Kiseloff/flask-restful | /resources/itemList.py | Python | py | 227 | no_license | from flask import request
from flask_restful import Resource, reqparse
class ItemList(Resource):
def __init__(self, **kwargs):
self.items = kwargs['items']
def get(self):
return {'items': self.items}
|
7e2d47d736aae1dbf554266f5e8a17a6113d0376 | 49d129d9a7acf7ca10ae4b05dc0f3423159ce55b | cen-ai/program-y | /src/programy/storage/stores/sql/store/variables.py | Python | py | 2,489 | permissive | """
Copyright (c) 2016-2018 Keith Sterling http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, m... |
22a1e2fd3e38b576eccf602f2b813b6fb2063e51 | 089e939b79a05a57618d738bafe22e366d2cbff1 | AkshaySharma-Akay/MyPress | /evo/views/login.py | Python | py | 2,585 | no_license | from django.shortcuts import render,redirect, HttpResponseRedirect, HttpResponse
from django.contrib import auth
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from evo.forms import SigninForm, SignupForm
from evo.models import EvoUser, StatusStuden... |
b383102ed5bd34a8771f69a513d1ec4c2f43498e | e268e0d0abcba8ba12e48a2bc16054ec84d35b3c | laysakura/todo9 | /data/gen_jap.py | Python | py | 436 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
if __name__ == '__main__':
with open("./names.txt") as f_names:
with open("./dos.txt") as f_dos:
l_names = f_names.readlines()
l_dos = f_dos.readlines()
for l_name1 in l_names:
for l_name2 in l_names:
... |
f0dcbe5cb81c777fa13251bbd4cfd58d89060551 | 1bc05185997434f46eebb099b855eea67b1dd86c | lmorek/python_codecademy | /python_codecademy/filte_the_number.py | Python | py | 247 | no_license | __author__ = 'morek'
def filter_string(string):
temp=""
list=["1","2","3","4","5","6","7","8","9","0"]
for number in string:
if number in list:
temp=temp+number
return temp
print filter_string("l345asdasdfa")
|
d1e335b8d756768eac7a0d89d75543ef5a583b20 | 128e9602ca17cca1f08d96234e229664115f5f93 | jbakermalone/intellij-community | /python/testData/inspections/PyTypeCheckerInspection/BuiltinsPy3.py | Python | py | 755 | permissive | def test_operators():
print(2 + <warning descr="Expected type 'int', got 'str' instead">'foo'</warning>)
print(b'foo' + <warning descr="Expected type 'bytes', got 'str' instead">'bar'</warning>)
print(b'foo' + <warning descr="Expected type 'bytes', got 'int' instead">3</warning>)
def test_numerics():
... |
9c348fefb0a6fedbf565ea50bf367541080cd7f9 | bb3e6fc9c88d1e53803fe0f2461e60abb8b5dae3 | crass/django-social | /social/views/subscription.py | Python | py | 1,297 | no_license | from django.http import Http404
from django.shortcuts import redirect, get_object_or_404
from django.contrib.contenttypes.models import ContentType
from ..models import Subscription
from django.contrib import messages
def subscribe(request,content_type,object_id,success_message="Subscription added"):
content_type = ... |
eff072c1b9b4604c0011a82d8e4867f9c3f4a725 | ab3073ceef203c654d85941d3b9df9ad7b79dc54 | maximka65/python | /алгоритмы на python geek/les8/task3.py | Python | py | 1,087 | no_license | # 3. Написать программу, которая обходит не взвешенный ориентированный
# граф без петель,
# в котором все вершины связаны,
# по алгоритму поиска в глубину (Depth-First Search).
def dfs(graph, start, visited=None):
graph2 = {}
for i in range(len(graph)):
graph2[i] = set(graph[i])
if visited is Non... |
67ee06cf7db7d549b3c4d3b3b8f3e713491e6c4e | ee0f525a95e3b05c027f4b197ac00e955ea2153f | Da9elgit/Macro-Explain-o-Matic | /macro/exceptions.py | Python | py | 17,013 | permissive | ''' Defines exceptions used to report errors in parsing and execution
of macros.
'''
import exceptions
from macro.interpret.txt_token import TxtToken
from macro.util import NULL_POSITION, NULL_TOKEN_ID
# Base exception class with a shared rendering method.
class MacroError():
''' Base class for mac... |
c11f825f966491e8ccb51bb08a260194ac809c8b | 4682c5632c32466760893a48e52b3b4005ed649c | djtests/learndjango | /blog/migrations/0011_auto_20180312_1329.py | Python | py | 2,720 | no_license | # Generated by Django 2.0.1 on 2018-03-12 13:29
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blog', '0010_auto_20180304_0705'),
]
operations = [
migrations.CreateModel(
name='Author',
... |
9910baeaa6b8379ccf358b07d43fd80142683825 | 235cb5a0407f6ca0a18715c1f01bd7507a52b0bd | padalev/tree-cover-model | /presentation/bifplots1.py | Python | py | 414 | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import ode
from scipy import optimize
def x(r):
return (-r)**(1/2)
plt.figure(1)
r = np.linspace(-1,0,1000)
plt.plot(r,x(r),'k--',zorder=2)
plt.plot(r,-x(r),'k-',zorder=2)
plt.axis('off')
ax = plt.gca()
plt.axhline(0, color='grey',zorder=1)
... |
ab2ce3729401e5e2b39fbcf89337843a5bcac098 | 10617855adcf857cbb7a1b9bda968a972ada068b | marlobaguyos/mb | /config/urls.py | Python | py | 805 | no_license | """config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
c2592c44d70c328715329ff39f981a6c15dc9764 | af5288e1bdeaa97a317fb4a3600f6d9ee3b745fe | pruth17/CS185C | /MIDTERM2/preprocess/observation.py | Python | py | 777 | no_license | import json
observation_symbols = ['mov','push','add','call','cmp','jmp', 'imul',
'xor','pop','jz','jnz','lea','sub','test',
'retn','or','and','inc','nop','dec','shr',
'movzx','jb','sbb','adc','shl','leave',
'jnb','jbe','discarded']
#... |
f69d6d2987575438cad17d49d2c32afb69597c73 | cb070cead3268b304c7abea33601c9c1862a1f4b | joshiaakash99/Covid-19-Detection-using-Chest-X-rays | /app.py | Python | py | 4,925 | no_license |
from flask import Flask, render_template, request, session, redirect, url_for, flash,session
import os
from werkzeug.utils import secure_filename
from tensorflow.keras.models import load_model, model_from_json
import matplotlib.pyplot as plt
import cv2
import numpy as np
import mysql.connector
UPLOAD_FOLDER = './... |
086bb0f845f6efb1eeee14cd8cfe2b6f92d25811 | aa117446876dce9a5b3694a4d9c07437ea30b92e | bha6kar/DataAnalyticsProject | /autoencoder.py | Python | py | 2,302 | no_license | from keras.layers import Input, Dense
from keras.models import Model
from keras import regularizers
import pandas as pd
import numpy as np
class AutoEncoder:
def __init__(self, encoding_dim):
self.encoding_dim = encoding_dim
def build_train_model(self, input_shape, encoded1_shape, encoded2_shape, dec... |
5c93cad5423ac1aa1f51bed2be0a734c14299873 | 4124b9995341dc6ea92ab58aff4397a7f3faf2f0 | GouravGakkhar7576/PythonBasicFramework | /ControlledLocators/Waits.py | Python | py | 561 | no_license | from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
class Waits:
def __init__(self, driver):
self.driver = driver
def staticWaitTime(self):
global timeperiod
timeperiod = 30
return timeperiod
def waitFor... |
73ffeaa7848d779dc21a2e0ae0b09384370a34b6 | c57ba982b5c6c94d929959b4707a18767d95baac | katryo/leetcode | /147-insertion-sort-list/solution.py | Python | py | 1,848 | no_license | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def insertionSortList(self, head):
if not head:
return None
helper = ListNode(0)
cur = head
pre = helper
... |
b530e37cdf090e9b646779036a0a56ab5452cc75 | e7481868a3fb3830f8960a15edf1aedb976a3c61 | EMorf/greenbot | /greenbot/web/routes/api/timers.py | Python | py | 2,399 | permissive | import logging
from flask_restful import Resource
from flask_restful import reqparse
import greenbot.modules
import greenbot.utils
import greenbot.web.utils
from greenbot.managers.adminlog import AdminLogManager
from greenbot.managers.db import DBManager
from greenbot.managers.sock import SocketClientManager
from gre... |
08d891df78e6a8850b5c3e4f2fb355e361aabc11 | 2733baffba4e3299dc7bb8b1a5bf48f9bc16b5a0 | srdjanradojcic/ATT_Zadatak | /src/REST/Control.py | Python | py | 770 | no_license | from flask import Response
class Control():
def __init__(self):
from Data.Driver import Driver
self.driver = Driver()
def postRequest(self, url):
if self.driver.isNewLink(url):
return self.newLink(url)
else:
return self.oldLink(url)
def newLink(self... |
5430155d3ad8fa36f859f053cefd3913fa43652c | 5691ec1a9be433d8eac37ead0797793e445e384b | Lia-k/py_course | /lesson16/homework16/human.py | Python | py | 1,122 | no_license | class Human:
def __init__(self, name: str, age: int, gender: str):
self.__name = name
self.__age = age
self.__gender = gender
self.__status = "alive"
self.__age_limit = 100
def grow(self):
self.__is_alive()
if self.__age < self.__age_limit:
se... |
6a6941a951dd55979781cb3578c86bde1d555491 | baf72eada9ffee776550b9b138c24faedb00aa6b | w1zex/aimbot | /aim_trainer.py | Python | py | 976 | no_license | from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
'''while keyboard.is_pressed('q') == False:
while 1:
if pyautogui.locateOnScreen('stuckman.png', confidece=0.8) != None:
print("i can see it!")
time.sleep(0.05)
else:... |
e2bfcc19677c30568be9226c8997be75bcd7a446 | bb34d925aef1b5f796b08e76e1ac2c621d959d86 | janetat/zmrenwu-django-blog-tutorial | /comments/admin.py | Python | py | 237 | no_license | from django.contrib import admin
from .models import Comment
# Register your models here.
class CommentAdmin(admin.ModelAdmin):
list_display = ['name', 'post', 'text', 'created_time', ]
admin.site.register(Comment, CommentAdmin)
|
5fe10f163fe02d11c86aafaacb42fa650332e99f | 16d9cb52e40738e10468240649900092d5aa13aa | ny-a/RTTY | /psk31/frame_filter.py | Python | py | 3,788 | no_license |
def frame_to_bit_chunks(frame_values, baud_rate=31.25):
binary_values = frame_to_binary_values(frame_values)
bit_duration_values = binary_values_to_bit_duration(binary_values)
bit_values = bit_duration_to_bit_values(bit_duration_values, baud_rate)
decoded_bit_values = decode_fec(bit_values)
bit_chu... |
90ba548c62cee6d7eda0cdbb363a7f98c5ae76f5 | a00dbdc405eb0f00301908426a8c157c6c4ed379 | 2248203169/create_experiment_research | /translate.py | Python | py | 2,325 | no_license | #提取URL静态特征
import xlwt
import pandas as pd
from xlutils.copy import copy
def translate(a,b):
f = pd.read_excel(a)
book = xlwt.Workbook()
sheet1 = book.add_sheet('sheet1')
url_list = f['url']
num_list = []
call_list = []
letter_list = []
rate_list = []
letter = 0
d... |
3aef3495a6841b5face686ee579282a9ae12eb24 | 6d3dc9e98f7a86dcf14e480c04c826e1d8b2ef18 | app-sre/manifest-bouncer | /cli/main.py | Python | py | 3,595 | permissive | #!/usr/bin/env python
import argparse
import sys
import pkgutil
import importlib
import anymarkup
from lib import CheckRunner, CheckBase
class EnableDisableAction(argparse.Action):
def __call__(self, parser, ns, values, option):
setattr(ns, self.dest, option.startswith('--enable-'))
# import all chec... |
e017286631cf513dcc94f4406a6621ab202a1e5c | eccb1ed7afee576bd4d85e8a76e897736020616a | aboerzel/German_License_Plate_Recognition | /models/official/nlp/nhnet/raw_data_process.py | Python | py | 3,829 | permissive | # Lint as: python3
# Copyright 2020 The TensorFlow 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
4ad74c59999925be5d2fa4a1e86590d27b454283 | 468cd08b5af03882062b3ad79dc4bcc5333c25d4 | Dharmesh-Poddar/Sports-Fight-website | /app.py | Python | py | 461 | no_license | from flask import *
app= Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/register')
def register():
return render_template('register.html')
@app.route('/contact')
def contact():
return render_template('contact.html')
@app.route('/demo')
def demo():
return render_... |
b068923e602c7d35b009955f1014ff2e318bd696 | 45c53d7d1a6ec9d0937d845b9f1f8d2267375d2b | anEffingChamp/compSci321 | /chapter1/1.17.py | Python | py | 640 | no_license | # (Turtle: draw a line) Write a program that draws a red line connecting two points (-39, 48) and (50, -50) and displays the coordinates of the two points, as shown in Figure 1.19b.
import turtle;
firstX = -39;
firstY = 48;
secondX = 50;
secondY = -50;
firstString = "This position is: " + str(firstX) + ', ' + str(... |
22f3d5b1ac38f7b9ad303eaa6fe8f561e002d556 | 5c0eee8ad5cb213c826044d0388f3f30030ff141 | sheuvi21/simple-convnet | /tools/image.py | Python | py | 466 | no_license | from PIL import Image
import numpy as np
from settings import IMAGE_SIZE
def preprocess_image(fp):
im = Image.open(fp)
im = im.convert('RGB')
side = min(im.size)
x = (im.width - side) / 2
y = (im.height - side) / 2
square = (x, y) + (side,) * 2
im = im.crop(square)
im = im.resize(IMAGE... |
f079c409c72808b1a4f1cb260b204e737bf5c754 | d2cc7f812543796a9d5cfced27b19fe0d2292ec0 | openvinotoolkit/openvino | /src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_program-only.py | Python | py | 573 | permissive | # Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
x_value = [[1.,2.,3.],[3.,2.,1.]]
tf_x = tf.constant(x_value)
tf_y = tf.compat.v1.... |
1afce9f8aa649a76756223cfcf5cec685e898f67 | 970e59fd7c6691873650c291b0f6534aeb8f550c | byrenx/MoonHauz | /app/models/land.py | Python | py | 389 | no_license | #python libraries
from datetime import datetime, timedelta
#ferris linraries
from ferris import BasicModel, ndb
from app.models.property import Property
class Land(Property):
# RESIDENTIAL ,COMMERCIAL, AGRICULTURE
land_type = ndb.StringProperty(required=False)
land_area = ndb.FloatProperty(required=False)... |
05a00a063681ed02032b4f3a72a724834e309133 | 6525f8c5f3eaf3cf231d4ce05eda401a28482f47 | room9ho/sac1 | /data/registry_model/datatype.py | Python | py | 2,621 | permissive | # pylint: disable=protected-access
from functools import wraps, total_ordering
class FromDictionaryException(Exception):
"""
Exception raised if constructing a data type from a dictionary fails due to missing data.
"""
def datatype(name, static_fields):
"""
Defines a base class for a datatype t... |
b626b9360b8395531d7ac80efbdc4df6f01796ee | 020f229b742f0e6d9d9e19418afbef5463e4231e | belovmd/ggrc-core | /test/selenium/src/lib/rest_services/control_rest_service.py | Python | py | 1,513 | permissive | # Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""REST service for Control app entities."""
from lib.app_entity import control_entity
from lib.rest import base_rest_service, rest_convert
class ControlRestService(base_rest_service.ObjectRestService):
"... |
78678f7d6dc1e522adb19e0b71502b9c39628dfa | 19f3faa042fcd17de541912e294a3bc2f3276a3a | hicaro/practice-python | /queue/SinglyLinkedList.py | Python | py | 6,135 | no_license | """
Implementation of a singly linked list.
"""
class SinglyLinkedList(object):
""" Singly linked list implementation using head and tail pointers """
class Node(object):
""" Single node to hold an element in a singly linked list """
def __init__(self):
self._value = None
... |
21fe5007809e25a555623f810ebae7f4e2a833f1 | 45f04644baa1ad638f799b2423ee385b8fd44060 | milogert/website_old | /app/mod_boardgames/controllers.py | Python | py | 3,899 | permissive | # Import flask dependencies
from flask import Blueprint, request, render_template, \
flash, g, session, redirect, url_for, jsonify, abort
import json
import urllib
from xml.dom import minidom
from collections import Counter
# Import password / encryption helper tools
from werkzeug import check_passw... |
8576f08f7b3afe0e8fdcf1c7a053535449df0117 | 0097ae65dc92b1211a247871a73e49061836ce5c | dan-mi-sun/apply-app | /hypha/public/home/migrations/0002_create_homepage.py | Python | py | 1,211 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... |
d0207e1ec2d3f967f9bef2126a55865dcddc049f | 11151f40ebd0b06c1945f9e7e8a3ecc711e6a7b5 | danhgun01/Clustering-Data-Cmeans | /tests/image_clustering.py | Python | py | 1,020 | no_license | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import ndimage
from sklearn import cluster
from algorithms.fcm import FCM
from algorithms.gk import GK
from file_path_manager import FilePathManager
sns.set()
image = ndimage.imread(FilePathManager.resolve("images/car.jpg"))
plt.figu... |
89df87d9953f0d945fd3eb428822f08ba220c8d3 | 8112a2c190702a1d760d260597d867b797675465 | leaguilar/easeml | /client/python/easemlclient/easemlclient/model/type.py | Python | py | 3,166 | permissive | """
Implementation of the `ApiType` class.
"""
import requests
from copy import deepcopy
from enum import Enum
from typing import Dict, Any, TypeVar, Generic, Optional, Tuple, List, Type
from .core import Connection
T = TypeVar('T', bound='ApiType')
class ApiType(Generic[T]):
"""The User class contains informat... |
3b78666f8b04babc55989ef2d0bf9a01f879bbcb | e568d94fe093a0c13edb8b4cb60ef6570ed2861a | psmith/LearnToProgramPython | /a2.py | Python | py | 2,073 | no_license | def get_length(dna):
""" (str) -> int
Return the length of the DNA sequence dna.
>>> get_length('ATCGAT')
6
>>> get_length('ATCG')
4
"""
return len(dna)
def is_longer(dna1, dna2):
""" (str, str) -> bool
Return True if and only if DNA sequence dna1 is longer than DNA sequence
... |
904178be73e53f87b338959956867076ea885cd4 | c4f4a92dae6b06d3d062e825764e01585ff0c3c6 | changbl/ryu | /ryu/app/inception_conf.py | Python | py | 5,152 | permissive | # -*- coding: utf-8 -*-
# Copyright (C) 2014 AT&T Labs All Rights Reserved.
# Copyright (C) 2014 University of Pennsylvania 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 ... |
7bcdef5d5db32ffffc7403dd0b618c7731a1ae70 | 6d6779edba10dc3726ed3f3426ff218cec5a2514 | shouya-1/prediction | /app/app.py | Python | py | 2,033 | no_license | from flask import Flask, render_template, request
#importing required libraries & dataset for the project
import pandas as pd
import numpy as np
import sklearn
from sklearn import datasets
from sklearn import preprocessing
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinM... |
ff498acdf1deb0b253442c074076e1c5558de639 | 937226e079cbc40acad8086131aeb91cc3808eec | shuizhonghaitong/WMPoetry-master | /preprocess/build_dic.py | Python | py | 1,618 | no_license | #coding=utf-8
import cPickle
import argparse
parser = argparse.ArgumentParser(description="""Build dictionary.""")
parser.add_argument("-i", "--input", required=True, help="the input file")
def lineSplit(line):
line = line.decode("utf-8")
chars = []
for c in line:
chars.append(c.encode("utf-8"))
... |
e40022d5fce40c7ec47bb7ca83978c53f93200ff | 071dac7726bdbf227d2424cd59524b5b662b6512 | AdrienLemaire/dashboardmods | /dashboardmods/__init__.py | Python | py | 588 | no_license | __version_info__ = {
'major': 0,
'minor': 2,
'micro': 0,
'releaselevel': 'final',
'serial': 1
}
def get_version():
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
vers.append(".%(micro)i" % __version_info__)
if __version_info__['releaselevel'] ... |
a472fd9a59458ee3c5af4be372b7b9017c3d20a9 | cf9f8ee450a5b075c83b8ac89c6eb19249e692d8 | khotilov/cmssw | /RecoBTag/PerformanceMeasurements/test/runBTagAnalyzer_mc.py | Python | py | 17,177 | no_license | ##*****************************************************
##*****************************************************
##******** for MC
##*****************************************************
##*****************************************************
import FWCore.ParameterSet.Config as cms
from SimTracker.TrackAssociation.Tra... |
179327afbd747ff83b12fd9d20624bf30105e982 | ad3570c1f344bca432918a51669f676649730282 | betty29/code-1 | /recipes/Python/279230_getReverseConnectivity/recipe-279230.py | Python | py | 763 | permissive | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def getReverseConnectivity(connectivity):
"""getReverseConnectivity(connectivity) -->
resort connectivity dict with nodes as keys"""
reverseConnectivity = {}
for el, conn in connectivity.items():
for node in conn:
if node not in reverseCon... |
b1f7efef68f09240a541c0ff493b56cb74236e33 | d8f6cec677a3e086763bd00680623e3c90733647 | tasim313/python_assignment_1 | /README.py | Python | py | 849 | no_license | '''
Django==3.1.2
python = 3.8
crispy_forms
'''
'''
create class module in models.py file where Student attribute define
class name is student
'''
'''
In views.py file create classBased View
CreateView ( Enter Student Information)
ListView( Student Information List View)
DetailView(Student information DetailVi... |
f10f2d4fb7edddaabd4ea93b361544e614e16cf5 | aea4ce96f78e1f81e3455ebbb76f734674603ef9 | GabrieleMaurina/olimpiadi-di-sopramonte | /src/domain/team.py | Python | py | 707 | no_license | class Team:
def __init__(self, team_id="", name="", color="", comp_num_min="", comp_num_max="", race_time_male="", race_time_female=""):
self.teamId = team_id
self.name = name
self.color = color
self.compNumMin = comp_num_min
self.compNumMax = comp_num_max
self.raceTi... |
aa0529597a3698f3942d896cab7792504b0680d4 | 8dd7ea8a38325cd9dada8af2c90aa76699e9a1d0 | danilocutrim/microblog | /app/__init__.py | Python | py | 1,636 | no_license | from flask import Flask
from config import Config
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
import logging
from logging.handlers import SMTPHandler
from logging.handlers import RotatingFileHandler
import os
app = Flask(__name__)
app.config.from_object... |
7e4db62f8a43f234769d1d53e7eeb91df37e7256 | 5ed6a118d846c98ebb0ab76b1d975346650f7020 | Yellowshuohahaha/PointNetLK | /utils/so3.py | Python | py | 5,175 | permissive | """ 3-d rotation group and corresponding Lie algebra """
import torch
from utils import sinc
from utils.sinc import sinc1, sinc2, sinc3
def cross_prod(x, y):
z = torch.cross(x.view(-1, 3), y.view(-1, 3), dim=1).view_as(x)
return z
def liebracket(x, y):
return cross_prod(x, y)
def mat(x):
# size: [*,... |
234581b48c8440efe575647515a2070f15031496 | 8d151424455ab559dba397e18788c6e215265f24 | cocoa-dev-1/coding-class | /2502.py | Python | py | 323 | no_license | d, k = map(int, input().split())
a, b = 1, 1
for _ in range(4, d+1):
a, b = b, a+b
print(a)
print(b)
finish1 = 1
finish2 = 0
while True:
finish = k - a*finish1
if finish < 0:
break
elif finish % b == 0:
finish2 = finish // b
break
finish1 += 1
print(finish1)
print(finis... |
0a3111c9974be8f750db389f928836ce4b196391 | ec4681e146c1b6696bd8a0cd387fddf89f4d21e2 | liukai178/unittest_api | /common/handleconfig.py | Python | py | 828 | no_license | # 读取配置文件的工具(conf)
from configparser import ConfigParser
from common.handlepath import *
import os
# from common.gettoken import *
#通过section,option获取value的类
class HandleConfig(ConfigParser):
def __init__(self,filename):
super().__init__(self)
# 继承父类的构造函数
self.filename = filename
sel... |
6955c28eacff1673bea9224ff5d52f4900a492fe | 95d54d21fccd23f8f4bcf3566f9ebc5dec6374f9 | DhanyaAB/new | /venv/lib/python3.7/site-packages/jenkinsapi/node.py | Python | py | 18,021 | permissive | """
Module for jenkinsapi Node class
"""
import json
import logging
import xml.etree.ElementTree as ET
import time
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.custom_exceptions import PostRequired, TimeOut
from jenkinsapi.custom_exceptions import JenkinsAPIException
from six.moves.urllib.parse impo... |
8485e89a27d36d49231c24ad615ad7d7768c1c3d | 6325ab5eb4b034f5114020ac3884cf030af7bb00 | isasiluis28/superbar | /facturas/signals.py | Python | py | 6,238 | no_license | from django.core.exceptions import ValidationError
from django.dispatch import receiver
from django.db.models.signals import post_save, post_delete, pre_save
from facturas.models import FacturaVenta, Recibo
@receiver((post_save, post_delete), sender="facturas.FacturaCompraGasto")
def actualizar_monto(sender, instanc... |
bb57298d714a2f5c181db64035201987cf856dfb | 67198b002a1d54c01e0821d394e3967d2e1b9c04 | SuperLittleH/meiduo_56 | /meiduo_mall/meiduo_mall/apps/carts/views.py | Python | py | 9,191 | no_license | import base64
import pickle
from django.shortcuts import render
from django_redis import get_redis_connection
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from carts import constants
from goods.models import SKU
from . import serializers
class... |
40c3966b4011fcd60cbc317a93dd3d8b73e2d371 | 1c9f5177eb82ab7d115eb040e149bf1d232b87e1 | auppunda/GeneOntologyEncoders | /Precomputed_vector/encoder/encoder_model.py | Python | py | 7,441 | no_license |
from __future__ import unicode_literals, print_function, division
from io import open
import unicodedata
import string, re, sys, os, pickle
from tqdm import tqdm
import numpy as np
from collections import namedtuple
from tempfile import TemporaryDirectory
import logging
import json
from scipy.special import softmax... |
3c5e1f3a6b89d9105234f8682c0098f1ef794f84 | e6d902e2fa0289058b69a21b6ea65c98fb61fef2 | mktums/comics | /comics/spiders/lfg.py | Python | py | 1,238 | no_license | # coding: utf-8
from os.path import exists
from urlparse import urljoin
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.utils.response import get_base_url
from comics.utils import remove_disallowed_fil... |
ee9d79007119377fea7b2e1baac2fbb4c47546bc | e9e92e91dff0a7faa7ae78ef08b957a6815563ac | hokekiyoo/advent-calendar-2018 | /day10-m5stack.py | Python | py | 670 | no_license | from m5stack import lcd, speaker
from machine import I2C
import time
i2c = I2C(freq=400000, sda=21, scl=22)
while True:
temp_byte = i2c.readfrom(72, 2) # アドレス72番から2byte読み込み
temp = int.from_bytes(temp_byte,"big")/128 # 温度換算
print(temp)
if temp > 30:
lcd.clear(lcd.RED)
lcd.s... |
9754a0e8925aead3130b94de6d3724e9828aaeb7 | 9105a73bdbbc55ce7dce6d45ae1a49ceef6ca3cc | dataholic0/Algorithm_Test | /Baekjoon/tomato.py | Python | py | 1,628 | no_license | col, row = map(int, input().split())
arr = []
for _ in range(row):
data = list(map(int, input().split()))
arr.append(data)
def tomatoes(arr):
# Make padding to avoid index error while searching
temp = [[2]*(len(arr[-1])+2)]
for i in range(len(arr)):
temp.append([2] + arr[i] + [2])
temp.append([... |
444197fd52a948d890cf77d22f3e57a660bb000e | d15e3b7929ad843a5bd3d0766ce403497b0dd48e | aristoteleo/dynamo-release | /tests/test_pl_utils.py | Python | py | 3,503 | permissive | # import utils
import copy
import matplotlib.pyplot as plt
import networkx as nx
import pytest
import dynamo as dyn
@pytest.mark.skip(reason="unhelpful test")
def test_scatter_contour(processed_zebra_adata):
dyn.pl.scatters(processed_zebra_adata, layer="curvature", save_show_or_return="return", contour=True)
... |
f342ce963b531730619200384c2e871a38f1f3c7 | 76de08c675901d19c5e3b8ee7a5f0e55dcd95044 | kumarsandeep91/free_sms | /freesms/wsgi.py | Python | py | 392 | no_license | """
WSGI config for freesms project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... |
1c8f6a525fcc308aa9b1374c5799f3449278c8f9 | a9c378a1c061cea681de4912626bebc21f07cd16 | diogomarchi/Processador-Digital-de-sinais | /aula-11/venv/Scripts/pip3-script.py | Python | py | 468 | no_license | #!C:\Users\Diogo\Documents\FACULDADE-MATERIAS\Processador-Digital-de-sinais\aula-11\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0]... |
8ab05f1191a4743dce10c9b871ea6f82270e007d | 95ea870ae357beb5cb2cd9a97b7bd21f5ecbec1e | Petzall/pypibot | /code/framework/modules/SingleMotor.py | Python | py | 6,057 | no_license | #import RPi.GPIO as GPIO
import pigpio
from utils import *
import collections
class SingleMotor():
def __init__(self,a,b,e,enca,encb,name,use_pid=True):
self.a = a
self.b = b
self.e = e
self.enca = enca
self.encb = encb
self.name = name
self.use_pid = use_pid... |
871662666d44820e0e4adc7fc051f4d60e98f8d5 | 77e488384ccca3860ccc583611db3bf3f2c5f6f8 | ValentynKurylo/django5 | /django5r/asgi.py | Python | py | 393 | no_license | """
ASGI config for django5r project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETT... |
4ede7717cb9933160dbb0d1b8d3876f75d3bffc9 | b90129c2ed1924990157eb0a0bc75296fdef5b6b | YangLiyli131/Leetcode2020 | /in_Python/0490 The Maze.py | Python | py | 2,002 | no_license | class Solution(object):
def hasPath(self, maze, start, destination):
"""
:type maze: List[List[int]]
:type start: List[int]
:type destination: List[int]
:rtype: bool
"""
def check(a, b):
return a[0] == b[0] and a[1] == b[1]
visite... |
082f23880e3b7dad57e5003fe77a66b53c9a658d | 4c14dc25d12777c89f168de7167da57b3d9bef89 | humorbeing/python_github | /kaggle_song_git/Final_LVL2/REAL_LIGHT_LVL2_program.py | Python | py | 3,691 | no_license | import sys
sys.path.insert(0, '../')
from me import *
from LVL2_LIGHT import *
import pandas as pd
import lightgbm as lgb
import time
import pickle
import numpy as np
from catboost import CatBoostClassifier
from sklearn.metrics import roc_auc_score
since = time.time()
K = 3
print()
print('This is [no drill] training.... |
a40b6ef41f012152349c3f11588641fce37be7a0 | 886e99e190ad07dbb6e842f9d0ec38901733b094 | PatOnTheBack/django | /django/db/models/fields/related_descriptors.py | Python | py | 53,430 | permissive | """
Accessors for related objects.
When a field defines a relation between two models, each model class provides
an attribute to access related instances of the other model class (unless the
reverse accessor has been disabled with related_name='+').
Accessors are implemented as descriptors in order to customize acces... |
f8f202fac6efdaaca2210b1e2a198b08541cf5a6 | a3bc6d8132f2d9a26d672acbdb7b38e85a0913e3 | dhparks/als_speckle | /speckle/simulation/__init__.py | Python | py | 374 | no_license | """ Simulations of coherent scattering events such as random walking balls
illuminated by a pinhole and generation of time-stamped single-photon events.
Author: Keoki Seu (kaseu@lbl.gov)
Author: Daniel Parks (dhparks@lbl.gov)
"""
__all__ = [
"singlephoton",
"random_walk",
"domain_generator",
]
for mod i... |
c5b12eac8db802e0462b678b674685cd564b0de0 | 8ba031123f7e92dddbf313c3f6659944b7ef93cd | AdamZhouSE/pythonHomework | /Code/CodeRecords/2374/60625/301166.py | Python | py | 786 | no_license | class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
# 思路:将字符和其对应的频率保存到一个map中去,对频率进行排序并进行字符串拼接
count = {}
s = list(sorted(s))
while len(s) != 0:
ct = s.count(s[0])
count[s[0]] = ct
s ... |
977a40e4b8ce4782883cfa64766e5636cfe213b1 | df623f58d351223d9fdc89d6ef63656236f3b7fb | goldenhairs/pythonProject2 | /machine_learning/Strategy/In_Stock_all.py | Python | py | 4,770 | no_license | import pymysql
import pandas as pd
import datetime
from time import sleep
def category(stocklist):
condition = 'stock_code ='
marketdic={}
for i in range(len(stocklist)):
if i != len(stocklist)-1:
condition = condition + "'{}'".format(stocklist[i])+' OR stock_code ='
else:
... |
bc5fe2b4f4063ad539fd5974058cc41ab5d12694 | f179aea015a74571a8a9a2e517c4269811ad6c28 | shivamdattapurkayastha99/python-rough-sheets | /d4.py | Python | py | 778 | no_license | from collections import defaultdict
class graph:
def __init__(self,vertices):
self.graph=defaultdict(list)
self.V=vertices
def addedge(self,u,v):
self.graph[u].append(v)
def topologicalsortutils(self,v,visited,stack):
visited[v]=True
for i in self.graph[v]:
... |
3285a8c16d4590959bc02006c073d59aae3fdbd6 | 15f9bdd846a5cf8502c6da04933ab3ed5d18805d | p4nc/calendario | /main.py | Python | py | 597 | no_license | from tkinter import *
from tkinter import ttk
from datetime import datetime
class Calendar(ttk.Frame):
def __init__(self, parent, **kwargs):
ttk.Frame.__init__(self, parent, height=kwargs['height'], width=kwargs['width'])
class MainApp(Tk):
def __init__(self):
Tk.__init__(self)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.