blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
6b38651404e98029bd0162c9b9eec986fb1a0ff0 | Python | marcoisgood/Leetcode | /0540. Single Element in a Sorted Array.py | UTF-8 | 828 | 3.765625 | 4 | [] | no_license | """
You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.
Follow up: Your solution should run in O(log n) time and O(1) space.
Example 1:
Input: nums = [1,1,2,3,3,4,4,8,... | true |
45af1592091082f3074106fb8d66a54f9c7e1937 | Python | exrishu/iPython-exercises | /Library Managment/db_app_/database.py | UTF-8 | 1,163 | 3.03125 | 3 | [] | no_license | from udemy.milestone_2.database_connection import DatabaseConnection
def create_new_file():
with DatabaseConnection('data.db') as connection:
cursor = connection.cursor()
cursor.execute('CREATE TABLE IF NOT EXISTS books(name text primary key ,author text,read integer)')
def add_books(name, author):
with Data... | true |
57744f7a507758d83f2befffb96d9a278f276b3c | Python | vanshika28/Python-HackerRankprgm | /nestedlist.py | UTF-8 | 236 | 2.90625 | 3 | [] | no_license | reportcard=[]
marks =[]
n=int(input())
for i in range(0,n):
a=input()
b=float(input())
reportcard.append([a,b])
marks.append(b)
k=sorted(list(set(marks)))[1]
for a,b in sorted(reportcard):
if b==k:
print(a)
| true |
74911fb40e7235a9f00e0d250ace72f4c26bd217 | Python | SilentCatD/Parental-Control | /Logger.py | UTF-8 | 3,708 | 2.609375 | 3 | [
"MIT"
] | permissive | import sys
import time
from pynput.keyboard import Listener
import pyautogui
import datetime
import threading
import os
from win32gui import GetWindowText, GetForegroundWindow
lock = threading.Lock()
def get_dir_name():
now = datetime.datetime.now()
parent_dir = str(now.strftime('%d-%m-%Y'))
log_dir = os... | true |
4c282f66c8bc3044cab8bb621462689f9db726ce | Python | samruddhichitnis02/programs | /ProgramsA/functional/bs.py | UTF-8 | 361 | 3.90625 | 4 | [] | no_license | import Utilities.utilities
a = [ ]
n = input('Enter a String-')
print(n)
a=list(n)
a.sort()
m=''.join(a)
print(m)
y = input('Enter the element you want to search-')
z = Utilities.utilities.binary_search(a, 0, len(a) - 1, y)
if (z != -1):
print('The element you want is at position-', z)
else:
print('The element... | true |
9f66fc95ff3f571598cf4c8544b351c5c7765e25 | Python | BerilBBJ/scraperwiki-scraper-vault | /Users/C/Cunya/rss_view_1.py | UTF-8 | 4,460 | 2.5625 | 3 | [] | no_license | import scraperwiki
# Blank Python
sourcescraper = 'rss_1'
scraperwiki.sqlite.attach("rss_1")
data = scraperwiki.sqlite.select("* from rss_1.swdata order by rating desc")
print """
<head>
<style type="text/css">
#table-2 {
border: 1px solid #eee;
background-color: #f2f2f2;
width: 100%;
border-radi... | true |
4684dcbbfb7131d66c8c378a906ef5e1f88a86d6 | Python | KiraLow/labs | /sem_1/lab2/pyth/lab2.py | UTF-8 | 1,446 | 3.828125 | 4 | [] | no_license | import math
pi = 3.14
while (True):
run = input("Вычислим функцию? (yes/no)")
if run == "yes":
x = int(input("Введите x: "))
a = int(input("Введите a: "))
v = str(input("Введите букву функции, которую хотите вычислить "))
F = 0
G = 0
Y = 0
if v == "G":
... | true |
aaf82d6d7200940bc8a4ba98c69002bad1dfb585 | Python | Amarnath0506/Inteview_tasks | /task2.py | UTF-8 | 154 | 3 | 3 | [] | no_license | ''' creating single tuple character'''
#it is created single character of the tuple
a = ("c",)
print(a)
#it is created single character
b = ("a")
print(b) | true |
86574a6212f3d1c20181aa6fc241159f4493deb9 | Python | patadadeburro/leetcode | /08/p08_01.py | UTF-8 | 2,664 | 3.453125 | 3 | [] | no_license | '''
-------------------------------------------------------------------------------
Problem : 8. String to Integer (atoi)
Description:
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge,
please do not see below and ask ... | true |
7091c72fcc8f70c5a0bd74970f616fb233036ff6 | Python | Brianorinah/Data-Structures-and-algorithms | /Searching/Hashing/Hash_table.py | UTF-8 | 2,595 | 4.0625 | 4 | [] | no_license | class HashTable:
def __init__(self):
# Nb the size is 11 a prime number so that handling of collisions can be as effective as possible.
self.size = 11
self.slots = [None] * self.size
self.data = [None] * self.size
def put(self, key, data):
hash_value = self.hash_function... | true |
6f61419c1d7d6e98cd9cbecbca3a5606cbc65f26 | Python | sinusgamma/DRL_Tennis_AI | /draw_figure.py | UTF-8 | 806 | 3.328125 | 3 | [] | no_license | # plot the scores
import pandas as pd
import matplotlib.pyplot as plt
class FigureDisplay():
"""Displays the score chart"""
def __init__(self, scores, savename="result_score.jpg"):
self.scores = scores
self.savename = savename
def display(self):
fig, ax = plt.subplots(1, 1, figsize... | true |
231fc83e23910b19dae193f6aa4a4339f6a35a58 | Python | anon556677/ROS-Dreamer-Phy | /rl_server/src/sampling_helper.py | UTF-8 | 11,861 | 2.75 | 3 | [] | no_license | import cv2
import numpy as np
from scipy import interpolate
from scipy.interpolate import UnivariateSpline
def rsign():
return np.sign(np.random.rand() - 0.5)
def gaussian(x, mu, sig):
return np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.)))
def euler2quat(yaw):
''' CONVERTS THE RZ (or YAW) INTO A ... | true |
f3f9b989a7035e953c7c1b159d68cc194a894114 | Python | Vinicius-Moraes20/personal-projects | /programming/python/ex052.py | UTF-8 | 433 | 4.21875 | 4 | [
"MIT"
] | permissive | n = int(input("Digite um numero inteiro: "))
totDiv = 0
print("O numero {} é divisivel por: ".format(n))
for count in range (1, n+1):
if (n % count == 0):
print("\033[32m", end=" ")
totDiv+=1
else:
print("\033[31m", end=" ")
print("{}".format(count), end=" ")
print("\033[m")
if (totD... | true |
752bd61bf5d0bd9f74f611108af1043c931858dc | Python | UnknownMonk/Python_basics | /lessons/if_else.py | UTF-8 | 373 | 3.75 | 4 | [] | no_license | # age = int(input('Enter your age:'))
# if age < 10:
# print('your are young stargn one')
# elif age < 40:
# print('the fire is you is strong, strange one')
# else:
# print('you are wise beyond doubt, strange one')
meaty = input('Do you eat meat? (y/n')
if meaty == 'y':
print('you meaty... | true |
cc69dc80b8139bef2a89badf09eca31356f339f9 | Python | victor2410/ChIPpipe | /ChIPpipe/count.py | UTF-8 | 384 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python3.4
# -*-coding:utf-8 -*
# count.py
# ======================
# Author: Gaborit Victor
# Date: Jun 30, 2016
# ======================
"""
Package to lines in files
"""
# packages required for this programm
import os
def countLines(filein):
myfile = open(filein, 'r')
nbline = 0
lines = myfile.read... | true |
5db3759c3f080473a270f80ca04b3d2df68479cf | Python | BlackTimber-Labs/DemoPullRequest | /Python/Vivan_Jaiswal_ThemeTogglerWindows10.py | UTF-8 | 619 | 2.65625 | 3 | [
"MIT"
] | permissive | import subprocess
theme = input('Enter theme ([l]ight/[d]ark): ')
if theme == 'l':
allowlight = '1'
command = ['reg.exe', 'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', \
'/v', 'AppsUseLightTheme', '/t', 'REG_DWORD', '/d', allowlight, '/f']
subprocess.run(comm... | true |
945f9c93c4b89f3d1d3e8a87c8ff57a18940324c | Python | plirkee/greeklish-wordlist--generator | /GreeklishWordlistGenerator.py | UTF-8 | 4,909 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
dictionary = {
u'αι': ['e', 'ai'],
u'ει': ['i', 'ei'],
u'οι': ['i', 'oi'],
u'ου': ['u', 'ou'],
u'αυ': ['av', 'ab'],
u'ευ': ['ev', 'eb'],
u'μπ': ['mp', 'b'],
u'ντ': ['nt', 'd'],
u'α': ['a'],
u'β': ['b', 'v'],
u'γ': ['g'],
u'δ': ['d'... | true |
824aa5095b26f2a9a41505341d92d00fcd0bade6 | Python | Greenwicher/Competitive-Programming | /CodeForces/Python2/221A.py | UTF-8 | 207 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 25 21:31:42 2015
@author: liuweizhi
"""
## version 1
n=input()
print ' '.join(map(str,[n]+range(1,n)))
## version 2
n=input()
for i in range(n):print i or n, | true |
056da1f44d9517f139d8f3d4290598cbb02b7e3d | Python | ericwtq/Algorithm | /project2source code/Floyd/Floyd1D.py | UTF-8 | 949 | 2.859375 | 3 | [] | no_license | import math
import numpy as np
def find_minpath(adjacency):
n1 = len(adjacency)
n = int((-1 + math.sqrt(1 + 8 * n1)) / 2)
path = [[-1]*n for i in range(n)]
for k in range(0, n):
for i in range(0, n):
for j in range(0, n):
d_ik = adjacency[int((max(i,k) + 1) * max(i,k... | true |
e67c9ba388bd42a4952237fb500f961088e79624 | Python | dksingh04/python_projects | /image-processing-opencv/contours.py | UTF-8 | 755 | 2.859375 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("scan.jpg")
cv2.imshow('Input Image', img)
cv2.waitKey(0)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#Find canny Edge
canny = cv2.Canny(img_gray, 30, 200)
cv2.imshow('Canny Image', canny)
cv2.waitKey(0)
#Find contours
contours = cv2.findContours(canny, cv2.RETR_E... | true |
b592dea934ce557bd2b07f6915cc1ae1916c4b4e | Python | thusimon/Lutos | /violinHelper/Sound/Buffer.py | UTF-8 | 450 | 2.765625 | 3 | [] | no_license | import numpy as np
class Buffer:
def __init__(self, settings):
self.chunkSize = settings.CHUNK
self.rate = settings.RATE
self.bufferSize = settings.RATE * settings.BUFF_TIMEWIN
self.format = settings.FORMAT
#TODO other dtypes
self.data = np.array([], np.int16)
d... | true |
d0525ff0f91a12cf4b8b1a05cff68cc84b0fb6de | Python | JatinSsingh/SeleniumPython | /framework/Framework/test_framework.py | UTF-8 | 1,733 | 2.75 | 3 | [] | no_license | import time
from Framework.BaseClass import Baseclass
from PageObject.CheckOutPage import Checkout
from PageObject.ConfirmPage import Checkbutton
from PageObject.HomePage import Homepage
class TestFramework(Baseclass):
def test_case1(self):
log = self.test_logg()
homepage = Homepage(self.driver)
... | true |
def0a9c013431afa90949f582e01d403839ecdfd | Python | simoneby/TDT4113-Datateknologi-Programmeringsprosjekt | /rocksPaperScissor/Historian.py | UTF-8 | 1,305 | 3.0625 | 3 | [] | no_license | from Player import*
from Action import*
from statistics import mode
import random
class Historian(Player):
def __init__(self, playername, memory):
Player.__init__(self, playername)
self.opponent_moves = []
self.memory = memory #memory er en Int
self.next_move = []
def recieve_... | true |
cdbbc8d618e22477b99cfd7bccba127b7a7d74c7 | Python | phoenix9373/Algorithm | /2020/백준문제/그래프(DFS_BFS)/DFS/DFS_강의.py | UTF-8 | 1,117 | 3.828125 | 4 | [] | no_license | # DFS는 Stack을 활용한다.
# 깊은 곳까지 갔다가 막히면, 가장 마지막에 만났던 갈림길 간선이 있는 정점으로 돌아옴.
# 1. 시작 정점 v를 결정하여 방문
# 2. 방문하지 않은 정점 w가 있으면, v를 스택에 push하고 w를 방문
# 3. w를 v로 하여 반복.
# 4. 방문하지 않은 정점 w가 없으면, 탐색의 방향을 바꾸기 위해 스택을 pop하여 받고
# 5. 가장 마지막 방문 정점을 v로 하여 다시 반복.
# 중요: 각 정점이 연결되어 있는 것을 어떻게 표현? => 인접행렬 활용. 또는 2차원 배열 활용.
# 방문, 스택 초기화 / 방문은 "상... | true |
9322aea7c1e7e7204731365381d2afcff6535740 | Python | AnetaStoycheva/Programming101_HackBulgaria | /Week_7/crawling_bg_sites.py | UTF-8 | 2,467 | 3.078125 | 3 | [] | no_license | import json
import requests
import bs4
import matplotlib.pyplot as plt
class Histogram():
def __init__(self):
self.dict = {}
def add(self, key):
if key not in self.dict.keys():
self.dict[key] = 1
else:
self.dict[key] += 1
def count(self, key):
if ... | true |
7216eeed90102c30d572fb6ae7cb13096d68c43a | Python | grisza12/laboratorium_python | /start.py | UTF-8 | 2,346 | 3.5625 | 4 | [] | no_license |
import time
#
# print "222"
#
# a, b, c = 9, 8, 7
#
# print a, b, c
#
# del a # usuwanie zmiennych
#
# calkowita = 10
# print calkowita
#
# zmiennoprzecinkowa = 10.123
# print zmiennoprzecinkowa
#
# zespolona = 3+5j
# print zespolona
#
# osemkowa =0o15
# print osemkowa
#
# szesnastkowa = 0xabc
# print szesnastkowa
#
#... | true |
239588499a3027366a1df68f029b1d351d79840f | Python | giokhar/NewHDI | /HDI TEST/DHDI.py | UTF-8 | 3,449 | 2.796875 | 3 | [] | no_license | class indicator():
def __init__(self,Type,data, year, weight):
self.Type= Type
self.data=data
self.year=year
self.weight= weight
def getType(self):
return self.Type
def getData(self):
return self.data
def getYear(self):
... | true |
db8ffe5e6a21891e650fac66811f4cc123c78762 | Python | keobox/forwarder | /forwarder.py | UTF-8 | 3,963 | 2.546875 | 3 | [] | no_license |
"Port forwarding based on activestate recipe 483732."
import asyncore
import socket
class forwarder(asyncore.dispatcher):
"The 'accept' channel."
def __init__(self, ip, port, remoteip, remoteport, allowed_addrs, backlog=5):
"Constructor."
asyncore.dispatcher.__init__(self)
self.remot... | true |
1b3922bf4ba3ac78ecf8497d75f15b136e43bf5b | Python | michaelrinderle/fb_timeline_parser | /fb_timeline_parser.py | UTF-8 | 2,777 | 2.6875 | 3 | [] | no_license | import time
from bs4 import BeautifulSoup
from fuzzywuzzy import fuzz
from google import google
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
TARGET = 'https://www.facebook.com/*'
def fb_login(browser):
browser.get("http://www.facebook.com")
email = browser.find_elemen... | true |
b0360569000a79c41073a9dfdeeaad73cf8c8603 | Python | mikegw/clock | /test/test_vector.py | UTF-8 | 3,438 | 3.703125 | 4 | [] | no_license | import unittest
import math
from lib.vector import Vector
class VectorTest(unittest.TestCase):
def new_vector(self, *args):
return Vector(*args)
def setUp(self):
self.vector = self.new_vector(3, 4, 5, 6)
def test_it_exposes_individual_values(self):
self.assertEqual(self.vector[0],... | true |
9f30f74adcd5fd82a56d2d902b9f318dcd3f5696 | Python | XinnuoXu/MiRANews | /src/model/postprocess.py | UTF-8 | 2,052 | 2.5625 | 3 | [] | no_license | import nltk
import numpy as np
from filelock import FileLock
from datasets import load_metric
try:
nltk.data.find("tokenizers/punkt")
except (LookupError, OSError):
if is_offline_mode():
raise LookupError(
"Offline mode: run this script without TRANSFORMERS_OFFLINE first to download nltk d... | true |
4f3326162d1af31f3ada0cbd0bef7660816e27cc | Python | AnaSavu/gadpython | /my_package_week_3/is_integer_keyboard_input.py | UTF-8 | 178 | 3.53125 | 4 | [] | no_license | def input_is_integer():
keyboard_input = input('Input: ')
try:
n = int(keyboard_input)
return n
except ValueError:
return 'input not integer' | true |
1f6bc72f0c7eb6f99474534d09ca930472373568 | Python | AJPV-Capstone/CI_ReportGen | /Tests/find_grades_file_test.py | UTF-8 | 2,220 | 2.890625 | 3 | [] | no_license | """Test for the find_grades_file function in grades_org
Written as if this was being used in autogeneration (i.e. iterates by program that
histograms are being generated for)
Author: Ryan Letto (rmletto)
Created on: Apr. 18, 2019
Last modified: Apr. 18, 2019
"""
# Temp import for testing
import sys
import os
sys.pa... | true |
7dca778ca608c5fa505a6866b556fa4821b8b67d | Python | skyoo2003/cse-exercises | /onlinejudges/boj/2941-croatia-alphabet.py | UTF-8 | 272 | 3 | 3 | [] | no_license | line = input()
transforms = ["c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z=", ]
cnt = 0
while line:
if line[:3] in transforms:
line = line[3:]
elif line[:2] in transforms:
line = line[2:]
else:
line = line[1:]
cnt += 1
print(cnt)
| true |
c0a66904baa9c6d4feb936710b24203df1e9f12c | Python | EgorovM/ITMO_ICT_WebDevelopment_2021-2022 | /students/K33402/laboratory_works/Borisov_Matvey/laboratory_work_1/task_1/client.py | UTF-8 | 256 | 2.8125 | 3 | [
"MIT"
] | permissive |
from socket import *
connection = socket(AF_INET, SOCK_STREAM)
connection.connect(("127.0.0.1", 14900))
connection.send(b"Hello! \n")
data = connection.recv(16384)
decoded_data = data.decode("utf-8")
print("Response: ", decoded_data)
connection.close()
| true |
339f8a09e13805ce5591167964d549338a3f4de5 | Python | VazMF/cev-python | /PythonExercicio/ex009.py | UTF-8 | 732 | 4.0625 | 4 | [
"MIT"
] | permissive | #faça um programa que leia um número inteiro e mostre sua tabuada
from time import sleep #import do sleep
print('\033[1;31m-------TABUADA-------\033[m') #titúlo
n = int(input('Insira um número: ')) #input do numero na variavel num
print(f'{n} x 1 \033[31m=\033[m {n*1}') #print da visualizacao e multiplicacao dos numero... | true |
6a0345939dc35647bc18bd2bf92a362519f35cad | Python | Akranaoff/GUI_Python | /backend.py | UTF-8 | 1,616 | 2.921875 | 3 | [] | no_license | import sqlite3
def create():
conn = sqlite3.connect("book_store.db")
cur = conn.cursor()
create_query = "CREATE TABLE IF NOT EXISTS books(title TEXT,author TEXT, isbn INT, year INT)"
cur.execute(create_query)
conn.commit()
conn.close()
def display():
conn = sqlite3.connect("book... | true |
f55892911e2fd384da11c53c3129f28e6820686b | Python | CharterTechChair/Charter-Website | /charterclub/list_filter.py | UTF-8 | 1,708 | 2.65625 | 3 | [] | no_license | from datetime import date, timedelta
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
# rollover = June 3nd
senior_year = (
date.today() - timedelta(days=153)
).year + 1
class CurrentMembershipListFilter(admin.SimpleListFilter):
# Human-reada... | true |
6841df93f9277fb2676d8f35700bba591331378c | Python | ArmanMielke/pokemon-policy-network-mcts | /policynet/cpp_model_conversion.py | UTF-8 | 1,093 | 2.546875 | 3 | [] | no_license | import torch
from switch_equivariant_agent import SwitchEquivariantAgent
def convert_model_for_cpp(
source_checkpoint_path: str,
out_path: str,
p1_pokemon_size: int,
p2_pokemon_size: int,
num_pokemon: int,
label_type: int = 1
):
# load model
p2_size = num_pokemon * p2_pokemon_size
... | true |
cdb340c8a7d18ad378a06db6da882967acf64ea0 | Python | ZhangNing777/LeetCode_Python | /006_convert.py | UTF-8 | 741 | 3.125 | 3 | [] | no_license | class Solution:
def convert(self, s: str, numRows: int) -> str:
if numRows <= 1:
return s
length = len(s)
sNew = []
a = 2*numRows-2
b = 0
for i in range(0,numRows):
index1 = i
index2 = -1
x = 0
while index1 ... | true |
e0b7563e298f45ea21171806bb713d38253e7d1c | Python | andpol5/whaleDetector | /cropAndRotate.py | UTF-8 | 6,170 | 2.796875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python
#
import os
import math
import sys
import numpy as np
import cv2
#Get the histogram. All histograms must be the same kind
def getHist(im):
hist = cv2.calcHist([im],[0,1,2],None,[16,16,16],[0,255,0,255,0,255])
return(hist)
#Divide the image in four subimages
def divImage(im):
height,wid... | true |
6b7fc537464bb69ee52868f45e258c3035eef5c2 | Python | Satyam19946/SD-Hacks-2019-Awakened | /awakened.py | UTF-8 | 2,661 | 2.75 | 3 | [] | no_license | # Import the necessary packages
from imutils.video import VideoStream
from imutils import face_utils
from imutils.video import FPS
import datetime
import imutils
import time
import dlib
import cv2
from scipy.spatial import distance as dist
import csv
import datetime
(lStart, lEnd) = face_utils.FACIAL_LANDMARKS_IDXS["l... | true |
d715b223a0494bfbdada12c5eaff9d105d5abe44 | Python | R-Varun/OsuMapper | /GA/Fitness_Function.py | UTF-8 | 2,027 | 2.90625 | 3 | [] | no_license | from GA.utils import *
class Fitness_Function:
def eval(self, entry):
pass
class FF_Close(Fitness_Function):
def __init__(self, proximity, reward, smoothing=10):
self.smoothing = smoothing
self.proximity = proximity
self.reward = reward
def eval(self, entry):
score = 0
entry = np.array(list(filter... | true |
4ef2b97404e31f72f4af720b5c44ae399318b72a | Python | gxntur/songsort | /a2.py | UTF-8 | 2,282 | 3.65625 | 4 | [] | no_license | """ William Guntur Compsci 220 Assignment 2
"Songsort" - Sorting songs based on runtime and title
through merge sort """
from operator import itemgetter
import sys
# Python recursive implementation of merge sort
def mergesort(x):
if len(x)>1:
m = len(x) // 2
l = x[:m]
... | true |
35839442ace117a92b70191224a7367d1824a81d | Python | peperoschach/logica-de-programacao | /dados-variaveis-entrada-saida/aula-pratica/exercicio-3.py | UTF-8 | 359 | 4.1875 | 4 | [] | no_license | """ Exercício 3 """
'''
Crie uma variável de string que receba uma variável qualquer.
Crie uma segunda variável, agora contendo a metade da string digitada.
Imprima na tela somente os dois últimos caracteres da segunda variável do ripo string
'''
frase = input('Digite uma frase: ')
tam = len(frase)
frase_2 = frase[i... | true |
40ecd5702fe3d69794071a822535db366068b506 | Python | sidv/Assignments | /Ramya_R/Ass12Augd14/Employee_AdvancedERP.py | UTF-8 | 2,432 | 3.84375 | 4 | [] | no_license | employees = {} #empty List
while True:
print("1. Add employee")
print("2. Delete employee")
print("3. Search employee")
print("4. Display all employee")
print("5. Change a employee name in the list")
print("6. exit")
ch = int(input("Enter your choice: "))
if ch is None:
print("no data present in Employees")... | true |
559acf351bfb409b13de28341db69cd98aa28f37 | Python | jiadong-chen/baseballInterview | /python_hiring_test/run.py | UTF-8 | 2,304 | 2.796875 | 3 | [] | no_license | """Main script for generating output.csv."""
from pandas import *
def subjectFilter(Split):
# used to return the data selected by 'Split'
data = DataFrame.from_csv('C:/Users/Jiadong Chen/Desktop/interview/python_hiring_test/python_hiring_test/data/raw/pitchdata.csv')
if Split == 'vs LHH':
return data[(data['Hit... | true |
311bb59b8180729a8ab0d52a5e45557d058edac7 | Python | gary917/scripts | /cleaning_script.py | UTF-8 | 6,048 | 2.578125 | 3 | [] | no_license | #actual cleaning, remove duplicates
import pandas as pd
import datetime
import Levenshtein
FILE_PATH = "/Users/garychen/Desktop/ELEC4120/ssh_folder/csv/08/"
TIME_FILTER = True
FILE_NAME_ENTER = "BARKER_ENTER_2018-08-16"
FILE_NAME_EXIT = "BARKER_EXIT_2018-08-16"
CSV_EXTENSION = ".CSV"
OUTPUT_PATH = "/Users/garychen... | true |
75343d90b135d44395baefe919e947179248826a | Python | xiemingzhi/pythonproject | /sort-test.py | UTF-8 | 2,438 | 4.1875 | 4 | [
"MIT"
] | permissive | # for each element in the array
# do for each element in the subarray starting from the back
# check if element[j-1] > element[j]
# then swap(element[j],element[j-1])
# worst case O(n2)
def bsort(inputArr):
for i in range(0, len(inputArr)-1, 1):
for j in range(len(inputArr)-1, i, -1):
... | true |
8d9e05dc23f2c7663aadd7e2233d3276e048c344 | Python | Ferretsroq/Brute-Justice | /Characters.py | UTF-8 | 6,225 | 3.21875 | 3 | [] | no_license | from enum import Enum
import random
import skills
import BruteJusticeSpreadsheets
class Stat(Enum):
"""Simple Enum for identifying stat pools"""
Might = 0
Speed = 1
Intellect = 2
class Weapon(Enum):
"""Simple Enum for identifying how much damage a weapon deals"""
Light = 2
Medium = 4
Heavy = 6
class Pool:
"... | true |
b9b7b4b37e4744cc0af424ea5deef24fc1bfde3b | Python | Jay-Co-LLC/process-dropships | /errors.py | UTF-8 | 205 | 2.703125 | 3 | [] | no_license | class Error(Exception):
pass
class SupplierSKUNotFound(Error):
def __init__(self, sku):
self.sku = sku
def msg(self):
return f"Supplier SKU not found for product {self.sku}"
| true |
ddd901ada7ddb713993a89ff305e2f4db4a0171a | Python | ChangxingJiang/LeetCode | /0601-0700/0696/0696_Python_1.py | UTF-8 | 962 | 3.328125 | 3 | [] | no_license | class Solution:
def countBinarySubstrings(self, s: str) -> int:
num0 = 0
num1 = 0
ans = 0
for i in range(len(s)):
n = s[i]
if i > 0 and s[i] != s[i - 1]:
if s[i] == "0":
num0 = 0
else:
num... | true |
a2ca856e12f1dfd4738ac4f19ac4a3dda73ef8a6 | Python | Eroica-cpp/LeetCode | /141-Linked-List-Cycle/solution02.py | UTF-8 | 1,326 | 3.9375 | 4 | [
"CC-BY-3.0",
"MIT"
] | permissive | #!/usr/bin/python
# ==============================================================================
# Author: Tao Li (taoli@ucsd.edu)
# Date: May 6, 2015
# Question: 141-Linked-List-Cycle
# Link: https://leetcode.com/problems/linked-list-cycle/
# ================================================================... | true |
e309c4aefdf389b7785dc205a81e1a2343bab766 | Python | wangchengrong/lambdo | /examples/example6.py | UTF-8 | 776 | 3.078125 | 3 | [
"MIT",
"Python-2.0"
] | permissive | import pandas as pd
from sklearn import ensemble
def diff_fn(X):
"""Difference between first and second fields of the input Series."""
if len(X) < 2: return None
if not X[0] or not X[1]: return None
if pd.isna(X[0]) or pd.isna(X[1]): return None
return X[0] - X[1]
def gb_fit(X, y, **hyper_model):
... | true |
a555c68a92ef68ebaa7ae2b57f19fa94a5c917d6 | Python | iandennismiller/asa-utils | /lib/asa_utils/Interactive.py | UTF-8 | 1,691 | 2.59375 | 3 | [] | no_license | # asa-utils
# (c) 2011 Ian Dennis Miller
# http://asa-utils.googlecode.com
from Amalgamate import Amalgamate, EmptyDataFolder
import sys, platform, re, os, logging, datetime
class Interactive(object):
def __init__(self):
pass
def run(self):
c = ''
while c.upper() not in ['Q']:
... | true |
ea92683b9a5c7f01e2bd8d669a0836cffc9ef6d0 | Python | byj9511/Hello-world | /learning exercises/比较两个文件内容.py | UTF-8 | 1,397 | 3.65625 | 4 | [] | no_license | differ = []
#输入两个文件名(txt),然后判别每行是否相同
def file_compare(file_name1, file_name2):
with open(file_name1) as file1,open(file_name2) as file2:
file_list1 = file1.readlines()
file_list2 = file2.readlines()
total_line1 = len(file_list1)
total_line2 = len(file_list2)
max_line = max(t... | true |
44fbbef6a6f82e60b4efe5d22da602bb861e2940 | Python | nickmwangemi/Python-Bootcamp | /Week_06.py | UTF-8 | 12,712 | 5.1875 | 5 | [] | no_license | # Data Collections and Files
# dictionaries, sets, tuples, frozensets
# Dictionaries
"""
Is a collection of unordered data, which is stored in key-value pairs.
"Unordered" refers to the way it is stored in memory as it is not accessible through an index, rather it
is accessed through a key.
Dictionaries work like a r... | true |
03569a251d4fec29870c394e26cc5af334dbeed5 | Python | aster-mori/pythonML | /algoritmo_gradiente.py | UTF-8 | 1,453 | 3.34375 | 3 | [] | no_license | ###es una tecnica de optimisacion y busca los criticos( puntos minumos y maximos)
##se puede optimisar una funcion mientras sea deribable
import math as ma
import numpy as np ##ayuda a trabajar con matrises , algebra lineal
import sklearn as sk ##tiene un montón de datoset y modelos de machien learning
import scipy as... | true |
f39d9120d1d377d99a516ebf3eae1c5611fac504 | Python | AssiaHristova/SoftUni-Software-Engineering | /Programming Fundamentals/reg_expressions/furniture.py | UTF-8 | 520 | 3.21875 | 3 | [] | no_license | import re
data = input()
spend_money = 0
data_all = ''
furniture = {}
while not data == "Purchase":
data_all += data
data = input()
pattern = r'>>(?P<furniture>[a-zA-z]+)<<(?P<price>[0-9]+\.?[0-9]+)\!(?P<quantity>[0-9]+)'
results = re.finditer(pattern, data_all)
print("Bought furniture:")
for result in resu... | true |
427c2762e87512a4141eec732622a28a2a396425 | Python | tikhomirovd/1sem_Python3 | /massive/Posl.py | UTF-8 | 891 | 3.84375 | 4 | [] | no_license | n = int(input('Введите количество чисел в массиве '))
print('Введите число ')
print('Вводим массив')
# Вводим элементы массива A
i = 0
A = []
# Проверка на то, что вводят число
for j in range(n):
x = input()
if x.isdigit():
A.append(int(x))
if len(A) == 0:
print('Введите хотя... | true |
047ec13fa469d2abead994ca107425782d8badff | Python | jmaff/Past-Work | /Project Euler/Problem34.py | UTF-8 | 246 | 3.484375 | 3 | [] | no_license | import math
def sum_of_digit_factorials(n):
digits = [math.factorial(int(x)) for x in str(n)]
return sum(digits)
factorions = [i for i in range(3, 50000) if sum_of_digit_factorials(i) == i]
print(sum(factorions))
# SOLVED 11/19/17
| true |
1c11a6f5537fbc08babe6b51def9762d2b1ff644 | Python | danielch01/Mastermind | /mastermind.py | UTF-8 | 1,266 | 3.71875 | 4 | [] | no_license | import random
# ----------------
# COLOR CODES
# ----------------
# b: blue
# g: green
# r: red
# c: cyan
# m: magenta
# y: yellow
# k: black
# w: white
choice = []
for _ in range(4):
choice.append(str(random.randint(1,6)))
print "----------------------------"
print "-- Welcome to Mastermind! --"
print "----------... | true |
e8bbf76ec5e44afb2e85634362d0e3cf497efd64 | Python | webclinic017/ml_monorepo | /Speculator/speculator/tests/unit/test_date.py | UTF-8 | 591 | 2.6875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | from speculator.utils import date
import unittest
class DateTest(unittest.TestCase):
def test_shift_epoch(self):
delorean = date.date_to_delorean(2000, 1, 1)
shift = date.shift_epoch(delorean, 'last', 'day', 2)
self.assertEqual(shift, 946512000)
def test_generate_epochs(self):
... | true |
8d1c5eb23345c1e9f92d67189f98464255c33c98 | Python | akariv/genderdb-data | /index/gdbindex/models.py | UTF-8 | 958 | 2.578125 | 3 | [] | no_license | from sqlalchemy import Column, Integer, String, Float, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Dataset(Base):
__tablename__ = 'dataset'
id = Column(Integer, primary_key=True)
title = Column(String)
cat... | true |
68629fe9512ce633d11d1fd03b3566f6e74938f6 | Python | zerebom/0513_make_disparity_picture_withCNN | /Utils/loader_underconstructing.py | UTF-8 | 5,180 | 2.640625 | 3 | [] | no_license | from PIL import Image
import glob
import os
import json
from tensorflow.python.keras.preprocessing.image import load_img, img_to_array, array_to_img, ImageDataGenerator
import numpy as np
import math
import random
"""
np.stackした後でデータを扱うか、
list型で扱うか考える必要がある。
またどの段階で変換するか。
可変性を残しつつ、最後はinput,teachをきれいに返すような形でmain.pyに送りたい... | true |
b7983a35e0ee3fb47f2c8c2d5084c23c71e5391c | Python | mramey-mramey/Data-_Science_Portfolio | /Database Compare Tool/DB_Compare.py | UTF-8 | 6,215 | 2.578125 | 3 | [] | no_license | import cx_Oracle
from sqlalchemy import types, create_engine
import pandas as pd
import time
import numpy as np
import os
import string
ctff_dt = input("Please enter Business Date in YYYYMMDD format: ")
print("The business date your entered is:", ctff_dt)
directory = (r'')
##########################... | true |
fddc7d03a5ad42158d0b18aab1296a4bb9ebd0f3 | Python | harshilpatel/Classification | /classifier.py | UTF-8 | 5,055 | 3.03125 | 3 | [] | no_license | __author__ = "Harshilkumar Patel"
__status__ = "Development"
from utils import logger
from pprint import pprint
import math
class NaiveBayes(object):
def __init__(self, data):
# 0 indexing
self.data = data or []
self.column_names = self.data[0]
self.data = self.data[1:]
... | true |
4cfc83796aa0cfb895e2b92c43c8c6724d0db8b0 | Python | kevincheng96/robin_stocks | /actions/generate_top_news.py | UTF-8 | 2,690 | 2.875 | 3 | [
"MIT"
] | permissive | import sys
sys.path.insert(1,'/Users/Kevincheng96/Documents/Coding Projects/Python projects/robin_stocks')
from actions.objects import Stock
from concurrent.futures import ThreadPoolExecutor, as_completed
import robin_stocks as r
import heapq
import time
'''
Robinhood includes dividends as part of your net gain. This... | true |
c5bdf47f2014c4dee901298c7bb72c7c3669b15a | Python | iMashiro/QuestoesHuxley | /Q1171.py | UTF-8 | 372 | 3.046875 | 3 | [] | no_license | def countsort (V):
m = 10000000 + 1
aux = [0]*m
for x in V:
aux[x] += 1
i = 0
for z in range(m):
for y in range(aux[z]):
V[i] = z
i += 1
if (i == len(V)):
break
for t in V:
print(t)
vetor = input()
vetor = vetor.spli... | true |
faa7feb1d54d7660aedd03d22ebd3bed862ebaa2 | Python | shishengjia/PythonDemos | /文件和IO/读写二进制数据_P146.py | UTF-8 | 839 | 4.125 | 4 | [] | no_license | """
二进制数据的读写,rb和wb模式
读取二进制数据,所有的数据将以二进制形式返回
同样,写入二进制数据时,数据必须以对象形式来提供,该对象可以将数据以字节形式暴露出来
"""
with open('example.bin', 'rb') as f:
data = f.read()
with open('example.bin', 'wb') as f:
f.write(b'Hello World')
"""
在做索引操作时,字节串会返回代表该字节的整数值而不是字符串
"""
b = b'Hello World'
for x in b:
print(x, end=" ") # 72 101 108 1... | true |
5e33cca856a8fc190a9f8cf82f4129a938f45749 | Python | KeveenT/HydraFrac-Acoplado | /PyEFVLib/geometry/InnerFace.py | UTF-8 | 852 | 2.703125 | 3 | [] | no_license | import numpy as np
from PyEFVLib.geometry.Point import Point
class InnerFace:
def __init__(self, element, handle, local):
self.handle = handle
self.local = local
self.element = element
self.evaluateCentroid()
self.calculateGlobalDerivatives()
def evaluateCentroid(self):
shapeFunctionValues = self.eleme... | true |
22aaf680c18bb1199e0ae1019618baa92253ed9b | Python | emabellor/TGActivityDetection | /python/projects/CNN/test/Classification/stageactivity.py | UTF-8 | 13,066 | 2.609375 | 3 | [] | no_license | from classutils import ClassUtils
import json
import os
import random
from classhmm import ClassHMM
import numpy as np
from classnn import ClassNN
from enum import Enum
class Option(Enum):
HMM = 1
BOW = 2
seed = 1234
list_classes = [
{
# Cls 0
'folderPath': os.path.join(ClassUtils.activ... | true |
b7d5ad305a3c761bfc45a4ce1901f8b1c7d3dab8 | Python | KedarH-449/KH449 | /tkup.py | UTF-8 | 161 | 2.609375 | 3 | [] | no_license | import sqlite3
conn=sqlite3.connect("demo2.db")
with conn:
cur=conn.cursor()
cur.execute("UPDATE Doctor SET Name='Kedar'where id='4'")
print("RECORD updated") | true |
a2b84a324e1c7460e3bb9d20cf2d89cc3ef9edbd | Python | pushpithaDilhan/ProjectEulerPython | /pe55.py | UTF-8 | 413 | 3.5625 | 4 | [] | no_license | import time
s=time.time()
def ispalin(n):
if str(n)==str(n)[::-1]:
return True
else:return False
def iter_count(i):
c=0
while True:
j=int(int(str(i))+int(str(i)[::-1]))
c=c+1
i=j
if ispalin(j) or c>50:
return c
print len([i for i in r... | true |
91c0c827ed5d464510f2b5d8ee2d8edea71785e3 | Python | NotGonnaGitUs/dailyprogrammer | /Easy/[Easy] Challenge 05/challenge05easy.py | UTF-8 | 466 | 3.6875 | 4 | [] | no_license | import random
def generate(length):
out = []
for i in range(length):
out.append(random.sample("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()",1)[0])
return "".join(out)
length = int(input("Enter the desired password length "))
number = int(input("Enter number of passwords... | true |
46a0328ce3cc978e5cf7c84496ad0277a9c743b5 | Python | Aasthaengg/IBMdataset | /Python_codes/p02911/s454989898.py | UTF-8 | 170 | 3 | 3 | [] | no_license | # C - Attack Survival
N,K,Q = map(int,input().split())
P = [0]*N
for _ in range(Q):
A = int(input())
P[A-1] += 1
for p in P:
print('Yes' if K-Q+p>0 else 'No') | true |
bcd8d57fb2e1bbc6dfb3093c421e89092254806b | Python | martinli8/bme590hrm | /hrmData.py | UTF-8 | 10,422 | 3.21875 | 3 | [
"MIT"
] | permissive | import logging
class hrmData():
"""This is a hrmData class. It calculates various endpoints regarding the
input heartrate monitor data
Attributes:
:rawData (readData): readData class that contains time and voltage
:intervalStart (int): the beginning time to calculate the
heartr... | true |
e0128072eb1bce5eda3c272ac59370330eec2e1d | Python | ShuraiChable/Seniales | /AM.py | UTF-8 | 744 | 3.265625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# rango de los valores en tiempo (eje x)
tiempo=np.arange(0, 0.1, 10**(-5.7)) # número de ondas
Fc=300 # frecuencia
x=np.sin(40*np.pi*tiempo) # mensaje
w=np.sin(2*Fc*np.pi*tiempo) # portadora
p=w*x # salida de la función
plt.subplot(511)
plt.plot(tiempo, x, linewi... | true |
f6a3db9472ed936b00b6af43243487b9abbae704 | Python | benkrikler/valleydeight | /tests/test_dicts.py | UTF-8 | 2,044 | 2.75 | 3 | [
"MIT"
] | permissive | import valleydeight as vd
import pytest
@pytest.fixture()
def d1():
return dict(one="hello", two="world")
def test_dict(d1):
dict_t = vd.Dict(one=vd.Str(), two=vd.Str())
assert dict_t(d1) == d1
parsed_dict = dict_t(d1)
assert parsed_dict.one == "hello"
assert parsed_dict.two == "world"
... | true |
b056da123e81a78e929e282b4f31c0ecf02ffcda | Python | Group-12-Searcher/ImageSearch | /index_semantics.py | UTF-8 | 1,489 | 2.75 | 3 | [] | no_license | # USAGE
# python index.py --dataset dataset --index index.csv
# import the necessary packages
from pyimagesearch.semanticsreader import SemanticsReader
import argparse
import glob
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-d", "--semantics", req... | true |
52e5e95e9bd88e3327cac4f6f22d81b9ad014c4a | Python | softmatterlab/Braph-2.0-Python | /braphy/test/test_random_graphs_on_sm.py | UTF-8 | 5,476 | 2.8125 | 3 | [] | no_license | import unittest
from braphy.graph.graph_factory import GraphFactory, GraphSettings
from braphy.test.test_utility import TestUtility
from braphy.graph.measures.measure_path_length import MeasurePathLength
from braphy.graph.measures.measure_transitivity import MeasureTransitivity
from braphy.graph.measures.measure_cluste... | true |
6746591d55d4376123e5922cf031e7c5c3fc58b9 | Python | TEWH/Malaria-Google-Cloud-Setup | /Malaria-Files/train_test_split.py | UTF-8 | 3,310 | 2.546875 | 3 | [] | no_license | import os
import random
from shutil import copyfile
from zipfile import ZipFile
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
CELL_IMAGES_DIR = os.path.join(ROOT_DIR, "cell_images")
PARASITIZED_DIR = os.path.join(CELL_IMAGES_DIR, "Parasitized")
UNINFECTED_DIR = os.path.join(CELL_IMAGES_DIR, "Uninfecte... | true |
3284f7b6d8103c4d57e894f5c7d4c4a1362f02bd | Python | aniszahrodl/Praktikum-Chapter-07 | /Praktikum2/Prak2_no.3.py | UTF-8 | 380 | 3.75 | 4 | [] | no_license | #membuka dan mau membaca file d:/data.txt
file=open("c:/data.txt", "r")
#baca baris pertama dari file
# simpan ke dalam variabel bil1 sbg integrer
bil1= int(file.readline())
#baca baris pertama dari file
# simpan ke dalam variabel bil2 sbg integrer
bil2= int(file.readline())
#hitung dan tampilkan hasil bagi
hasil = ... | true |
2a85e396d76968250d3dbc51d42a8847a4584db9 | Python | MajViraj7/Learning | /Sample_Submission7_csv.py | UTF-8 | 3,090 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Importing Necessary Library
# In[26]:
import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
import warnings
warnings.filterwarnings("ignore")
from s... | true |
7b1abaf93ca19a90f2b59c240f261596614a1621 | Python | GSIL-Monitor/mrbao_python | /爬虫/paChong_project/Manage.py | UTF-8 | 1,438 | 2.875 | 3 | [] | no_license | # coding:utf-8
from Data_Output import DataOutput
from HTML_Downloader import HtmlDownloader
from HTML_Paraser import HtmlParser
from URL_Manager import UrlManager
class SpiderMan():
def __init__(self):
self.manage=UrlManager()
self.downloader=HtmlDownloader()
self.parser=HtmlParser()
... | true |
09a15d8410296f2745ee3c70b983e9ac137bd8a1 | Python | henryiii/cibuildwheel | /unit_test/utils_test.py | UTF-8 | 1,839 | 2.9375 | 3 | [
"BSD-2-Clause"
] | permissive | from cibuildwheel.util import format_safe, prepare_command
def test_format_safe():
assert format_safe("{wheel}", wheel="filename.whl") == "filename.whl"
assert format_safe("command #{wheel}", wheel="filename.whl") == "command {wheel}"
assert format_safe("{command #{wheel}}", wheel="filename.whl") == "{com... | true |
5e06f0bd7d7002eabb07fc5d2b364eed0e0fe935 | Python | modoboa/modoboa | /modoboa/lib/imap_utf7.py | UTF-8 | 6,088 | 2.984375 | 3 | [
"ISC"
] | permissive | # -*- coding: iso-8859-1 -*-
"""
Imap folder names are encoded using a special version of utf-7 as
defined in RFC 2060 section 5.1.3.
5.1.3. Mailbox International Naming Convention
By convention, international mailbox names are specified using a
modified version of the UTF-7 encoding described in [UTF-7]. Th... | true |
fe43c2a8a14d72aa6cfbe75af63da0da33dc2c8a | Python | YiqunPeng/leetcode_pro | /solutions/189_rotate_array.py | UTF-8 | 522 | 3.015625 | 3 | [
"MIT"
] | permissive | class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
Running time: O(n) where n == len(nums).
"""
n = len(nums)
k %= n
self._reverse(nums, 0, n - k - 1)
self._reverse(nums, n - k,... | true |
ca51d6546b1961b1a3de686389f4619eefa3bc44 | Python | MrSuperTop/TDS | /main.py | UTF-8 | 4,497 | 2.75 | 3 | [] | no_license | from time import time
import pygame
from pygame.constants import K_ESCAPE, KEYDOWN, MOUSEWHEEL
import config
from camera import Camera
from config import window, windowCenter
from groups import bullets, texts
from sprites.collider import Collider
from sprites.entity import Entity, collidingObjects
from sprites.game_s... | true |
396d399d0151c420c5d05192f43e54ad3111f15c | Python | nakagami/django-crud-generic-view-tutorial | /memo/memo/views.py | UTF-8 | 2,484 | 2.53125 | 3 | [] | no_license | from django.contrib import messages
from django.urls import reverse_lazy
from django.views.generic import \
ListView, DetailView, CreateView, UpdateView, DeleteView
from .models import Memo
from .forms import MemoForm
class MemoListView(ListView):
"""
メモを一覧表示
テンプレートは、何も指定しないと モデル名_list.html が使われる
... | true |
b626eccd170ba25b89d82a740d3a865b8c5037dc | Python | Stefanvdw24/final-year-project | /workspace/functions.py | UTF-8 | 11,599 | 2.96875 | 3 | [] | no_license | import numpy as np
import pylab as pl
from numpy.linalg import inv
import time
def heatmap_random(data,n):
#
w0 = np.zeros(n)
w1 = np.zeros(n)
for a in range(0,n):
data_raveled = data.ravel()
data_sum = np.sum(data_raveled)
q = 0
o = np.random.uniform(0,1) * da... | true |
f9d8ffdcfc167b19d48d523eda068447fa4adcb8 | Python | sapal/wikiserver | /code/httpServer.py | UTF-8 | 7,565 | 2.6875 | 3 | [] | no_license | # coding=utf-8
import socket, ssl
from SocketServer import BaseServer
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from fileManager import fileManager,FileInfo
from urllib import quote,unquote
from SocketServer import ThreadingMixIn
from mimetypes import guess_type
from logging import debug
from helpe... | true |
c3fe8fc3b53aa7530f5bec436903621f736b995a | Python | comorehouse1620/Spatial-Data-Python | /Lab3_list.py | UTF-8 | 1,042 | 3.34375 | 3 | [] | no_license | '''
Author: Claire Morehouse
Description: This script imports the package arcpy, sets up a work environment
and then sets a variable equal to the list of feature classes in the work environment.
A for loop then describes each object in the workspaces
Inputs: feature classes in the workspace
Outputs: a description... | true |
a188de5b6a0c496251c853e56cb8f28575414a36 | Python | claireyegian/project1 | /calculatorProject.py | UTF-8 | 5,981 | 3.4375 | 3 | [] | no_license | #Claire Yegian
#11/1/17
#calculatorProject - makes calculator
from ggame import *
def mouseClick(event): #which button did the user click
if (event.x>20 and event.x<70) and (event.y>185 and event.y<235):
processNumber(1)
if (event.x>95 and event.x<145) and (event.y>185 and event.y<235):
proce... | true |
a1d0988ce98ab2c0f5811750db1d83f75b0460a0 | Python | feihong/chinese-ebooks | /tianlongbabu/print_chapters.py | UTF-8 | 102 | 3.140625 | 3 | [
"MIT"
] | permissive | import util
for i, chapter in enumerate(util.get_chapters(), 1):
print(f"{i}. {chapter['title']}")
| true |
1fc2f3cb9ea1625a0e0d89d0f50b3a305b4fa461 | Python | UT-Projects/solace-backend | /unitTests/test_crud.py | UTF-8 | 755 | 2.59375 | 3 | [] | no_license | import requests
import json
url = "http://localhost:3000/"
class TestCreateUser:
def test_basic(self):
payload = {
"uuid": "1171737d-fb41-453f-87b4-6463c890347d",
"name": "Big Chungas",
"birthdate": 1322719200.0,
"sex": "male",
"email": "chug@fa... | true |
332773209eae0bafeae9444a97b9f57e985d02b6 | Python | HeywoodKing/mytest | /MyTelnet/pytelnet.py | UTF-8 | 3,187 | 2.984375 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
"""
@File : pytelnet
@Time : 2019/12/22
@Author : flack
@Email : opencoding@hotmail.com
@ide : PyCharm
@project : MyTest
@description : 描述
"""
import time
import logging
from telnetlib import Telnet
class TelnetClient(object):
"""... | true |
f25f4cfedbc40658c3740c04843da5ba7093a305 | Python | sumsilverdragon/task_manager_final | /task_manager_final_project.py | UTF-8 | 18,889 | 3.828125 | 4 | [] | no_license | """
this program is a task manager: user can login, change login details, add tasks, read tasks, edit tasks, admin can register new users, generate reports and view statistics
-this program uses functions for each action
-this program reads, writes and uses data from txt files
"""
#import datetime to determine overdue ... | true |
2fea23490d074b65f2e7fdf465dd5340e90f9be7 | Python | rapdemonling/Python-learning | /day2/shopping.py | UTF-8 | 1,406 | 3.671875 | 4 | [] | no_license | # Author:George Ling
product_list = [
('Iphone',6000),
('Macbook Pro',12000),
('HuaWei P30',4500),
('IWatch',4000),
('Coffee',32),
('Book',58),
]
shopping_list=[]
salary = input("Input your salary:")
if salary.isdigit():
salary = int(salary)
while True:
for index,... | true |
deeb55c06d359eb85af0195bc28db49a421418ec | Python | noelmcloughlin/iot-edge-stepping-stones | /ble-gatt-service/smartlight/smartlight-gatt-server | UTF-8 | 4,701 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
import sys
import array
from bluez_components import *
from sense_hat import SenseHat
sense = SenseHat()
class SmartLightService(Service):
SVC_UUID = 'FF10'
def __init__(self, bus, index):
... | true |