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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dbc0c8908d4c901cd4e39ea3a86c826f0ef504db | Python | sun1279/pythontest | /mail_test.py | UTF-8 | 2,465 | 2.640625 | 3 | [] | no_license | #this case is used to test sending mail
import smtplib
#email format
from email.mime.text import MIMEText
from email.header import Header
from email.mime.multipart import MIMEMultipart
#POP_SERVER = "pop.gmail.com"
#SMTP_SERVER = "smtp.gmail.com"
POP_SERVER = "pop.163.com"
SMTP_SERVER = "smtp.163.com"
IMAP_SERVER = ... | true |
76d4467110e6b7be183b8d2315593d0e1877aa12 | Python | renyuanL/cguTranslate | /tc_Demo/python31_demo/tc_paint.py | UTF-8 | 1,199 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python
""" turtle-example-suite:
tdemo_paint.py
A simple eventdriven paint program
- use left mouse button to move turtle
- middle mouse button to change color
- right mouse button do turn filling on/off
-------------------------------------------
Play around by clicking into the canv... | true |
41f527772585fe7b550f66bca051ba5dd3d6d7d1 | Python | shawnlobo96/sttp_DL | /Lab/Day-1/lab-2_error surface.py | UTF-8 | 8,099 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 12 11:52:47 2017
@author: abc
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import ListedColormap
from matplotlib.colors import colorConverter
#%%
nb_of_samples_per_class = 20 # The num... | true |
d6d2fab9d0dcb1dea0c0747d1c7de07a1e3fd025 | Python | michaelbrownuc/GadgetSetAnalyzer | /src/static_analyzer/Gadget.py | UTF-8 | 28,398 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Gadget class
"""
# Standard Library Imports
# Third Party Imports
# Local Imports
from static_analyzer.Instruction import Instruction
class Gadget(object):
"""
The Gadget class represents a single gadget.
"""
def __init__(self, raw_gadget):
"""
Gadget constructor
:param... | true |
c25d9cd35d667f92e0a6c2906acf901cc01c0a7e | Python | mdelpozobanos/sqlebra | /test_sqlebra/test_dtype/test_list.py | UTF-8 | 5,200 | 2.828125 | 3 | [] | no_license | import unittest
import os
from sqlebra.sqlite import SQLiteDB as DB
from sqlebra.dtype import list_ as SQLlist
from sqlebra.dtype import int_ as SQLint
from sqlebra import exceptions as ex
FILE = 'unittest.sqlebra.db'
class TestInit(unittest.TestCase):
value = [10, 11, 12]
@classmethod
def setUpClass(c... | true |
214c11dfc8a2438f5f29623ce751b91852a7a9ca | Python | juan250897/Prueba-_Tecnica_TSAKANA | /2_prueba_logica/cifrado_cesar.py | UTF-8 | 1,036 | 4.03125 | 4 | [] | no_license | abc = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ"
# COLOQUE LA FUNCION CIFRAR() CON EL FIN DE PROBAR LA EFECTIVIDAD DE DECIFRAR()
def cifrar (texto, desplazamiento):
texto_cifrar = ""
for letra in texto:
suma = abc.find(letra) + desplazamiento
modulo = int(suma) % len(abc)
texto_cifrar = texto_cif... | true |
712dae9b76021ce3fb5c4ee2443dea263e669797 | Python | sp0gg/exercism | /python/bank-account/bank_account.py | UTF-8 | 1,369 | 3.078125 | 3 | [] | no_license | from functools import wraps
from threading import Lock
lock = Lock()
def validate_open(fn):
@wraps(fn)
def _validate_open(self, *args, **kwargs):
if not self._is_open:
raise ValueError('u dun goofed')
return fn(self, *args, **kwargs)
return _validate_open
def validate_amount(... | true |
3a773c255e8d4b2b6ea80f6718ae8f0541cd7cdf | Python | mikeyQuantR/BitTwit | /main.py | UTF-8 | 1,404 | 3.109375 | 3 | [] | no_license | '''
Welcome to BitTwit. This application tries to analyse the general sentiment about $BTC on Twitter
and predict prices based on them. It rests on the assumption that fluctuations in the positive attitude
towards $BTC relayed on social media will affect its price on market.
BitTwit comprises
1) twitter_scraper.py th... | true |
100a468a43ca82411e6fda16b2c3db7078072c5b | Python | cuauv/software | /hydrocode/modules/pinger/scatterplot.py | UTF-8 | 2,118 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | import math
import queue
import time
import numpy as np
from common import const, plot
class ScatterPlot(plot.PlotBase):
def plot(self, hdg, elev):
try:
self._q.put_nowait((hdg, elev))
except queue.Full:
pass
@staticmethod
def _daemon(q):
from matplotlib.t... | true |
126279fa0ff2509b9c83e1fa0384fd10fd302405 | Python | sboerlage/Mitochondrial-Image-Analysis-Scripts | /calculatedAverages.py | UTF-8 | 2,043 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 22 15:44:38 2016
@author: Sophie Boerlage
"""
import pandas as pd
import os
# Directory must be set up with a different file for each imaging condition and all the images for that condition contained within their files
# Currently, any different directry struct... | true |
58d1460c7c52025291be4b786628dab7f2bde843 | Python | James-Bedford/Python | /remove_duplicates.py | UTF-8 | 227 | 3.65625 | 4 | [] | no_license | '''
function to remove duplicates
'''
def remove_duplicates(sequence):
output = [5]
for x in sequence:
if x not in output:
output.append(x)
return output
print(remove_duplicates([1,1,2,2,5]))
| true |
01647121ce38d3faef5dcfda81041e67646de719 | Python | kartikdutt18/LeetCode-CLI | /src/create_snippet.py | UTF-8 | 1,851 | 2.890625 | 3 | [
"MIT"
] | permissive | from cfg import INCLUDE_LIBS_KEY, MAIN_KEY, SNIPPET_PATH
import json
import os
class CreateSnippet():
def __init__(self) :
super().__init__()
self.extentionLanguage = {'cpp': 'cpp', 'py': 'python', 'java': 'java'}
def WriteCode(self, text : str, filename : str) :
"""
Creates a file with given te... | true |
48f32b81205a3a2a25528a1049133415b1f885a8 | Python | trantu86/gridtools | /gridgen_example.py | UTF-8 | 3,815 | 2.71875 | 3 | [] | no_license | """
This script is for testing the use of gridgen from
octant where I am using the examples given by
Pavel Sakov.
"""
import sys
import os
try:
from octant.grid import Gridgen
except ImportError:
try:
from pygridgen.grid import Gridgen
except ImportError:
if os.name is 'posix':... | true |
821182730be05428eca75c129c35f90978e33f22 | Python | Hansari346/Facial_Recognition_Capstone | /Taking_Video/VidsFrames_upd3.py | UTF-8 | 3,175 | 2.796875 | 3 | [] | no_license | import numpy as np
import cv2
import os
from mtcnn.mtcnn import MTCNN
import time
def TakeVideo():
#move video files to "Videos" folder
os.chdir(VideosPath)
#update video name based on time
video_name = format(int(round(time.time() * 100000))) + '.avi'
out = cv2.VideoWriter(video_name,fo... | true |
8512f6bcbe4e89658c3862d9905f0094127fa3d6 | Python | RuiNian7319/Machine_learning_toolbox | /Feature_Selector.py | UTF-8 | 22,922 | 3.015625 | 3 | [] | no_license | """
Feature Selector Class for Willowglen Project
Rui Nian
Last Updated: Jan-15-2018
"""
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from copy import deepcopy
# from Data_loader import data_loader
import random
import gc
from itertools import chain... | true |
c1c91ccb623d29405247099f4178c5e4796860b8 | Python | jiwookseo/problem-solving | /SWEA/sol/1859.py | UTF-8 | 203 | 2.875 | 3 | [] | no_license | for t in range(1,int(input())+1):
n,s,=int(input()),list(map(int, input().split()));m,r=s[-1],0
for i in range(n-2,-1,-1):
if s[i]>m:m =s[i]
else:r+=m-s[i]
print(f"#{t} {r}")
| true |
de0138e7e331474d26b9cb06471d89d3395d97c4 | Python | wellington16/BSI-UFRPE | /Programas feitos/PYTHON/Praticando Python Basico/exercicio4.1 b.py | UTF-8 | 115 | 3.4375 | 3 | [] | no_license | a=int(input("Digite quantos anos do carro tem:"))
if a < 3:
print ("carro novo")
else:
print ("Carro Velho")
| true |
3250045f170c5446b2dd51d67f0a82eaabe678cc | Python | Mercy435/python--zero-to-mastery | /try.py | UTF-8 | 1,241 | 3.125 | 3 | [] | no_license | domain_names = {'Google': 'gmail', 'Yahoo': 'yahoo', 'MyFantasy': 'myfantasy',
'Microsoft': 'outlook'}
email = input('enter a valid email address: ')
# d = email[email.index('@') + 1:]
# print(d)
a = email.split('@')[1]
# print(a) # this splits the email in two, the first half is index 0 and the other... | true |
ffa86daa5bc06a6f3e4ee08a482968f0a161c995 | Python | andrewztan/foobar | /string_cleaning.py | UTF-8 | 3,143 | 4.4375 | 4 | [] | no_license | """
String cleaning
===============
Your spy, Beta Rabbit, has managed to infiltrate a lab of mad scientists who are turning rabbits into zombies. He sends a text transmission to you, but it is intercepted by a pirate, who jumbles the message by repeatedly inserting the same word into the text some number of times. At... | true |
a027a3b09d381ba29f54c94bc4291a1d2f42bd24 | Python | DierSolGuy/Python-Programs | /puja.py | UTF-8 | 204 | 3.4375 | 3 | [] | no_license | # S=(x/1)+(x/4)+(x/7)...n terms
import math
n=int(input("Enter the limit: "))
x=int(input("Enter the value of numerator: "))
sum=0
k=1
for i in range(1,n+1):
sum=sum+(x/k)
k+=3
print(sum) | true |
bad4e975b3fc893bea41ab614dc569b05124cc83 | Python | spedl/uw_python | /week07_assignment/wsgi_simple_server.py | UTF-8 | 749 | 3.03125 | 3 | [] | no_license | """
Simple WSGI application runner, including its own WSGI server
Usage: python simple_wsgi_server.py <application> <port>
Example: python simple_wsgi_server.py test.wsgi 8080
Default application is wsgi_test, default port is 8000
The application module can be named anything, but the
application callable it provid... | true |
02da3811eafb22ab042b28dfe12c160bb1427a30 | Python | prathamesh2901/Flask_Corona_App_Write | /models/state.py | UTF-8 | 858 | 2.828125 | 3 | [] | no_license | from db import db
class StateModel(db.Model):
__tablename__= 'states'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
cases = db.Column(db.Integer)
deaths = db.Column(db.Integer)
recoveries = db.Column(db.Integer)
def __init__(self, name, cases, deaths, recov... | true |
ab9d5bc6d545afd0fba7b14765e9b4beca67f0b6 | Python | gbrlas/NENR | /NN/input_processing/data_processing.py | UTF-8 | 1,347 | 2.75 | 3 | [] | no_license | import os
import numpy as np
from input_processing import data_transformation
symbols = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
data_path = os.path.abspath(__file__ + '/../../data')
def get_symbol(i):
return symbols[i]
def load_data():
X = 0
y = 0
for i, symbol in enumerate(symbols):
... | true |
8d3d56548bfb1733fc91d443e105310c300bc9a9 | Python | estraviz/codewars | /8_kyu/Even or Odd/test_even_or_odd.py | UTF-8 | 402 | 2.703125 | 3 | [] | no_license | from even_or_odd import even_or_odd
def test_even_or_odd():
assert even_or_odd(2) == "Even"
assert even_or_odd(1) == "Odd"
assert even_or_odd(0) == "Even"
assert even_or_odd(1545452) == "Even"
assert even_or_odd(7) == "Odd"
assert even_or_odd(78) == "Even"
assert even_or_odd(17) == "Odd"
... | true |
2f6d6a4e13ec9671669e7361b5d0e7feb5867713 | Python | risoyo/CodingInterviews | /排序/快排.py | UTF-8 | 626 | 3.078125 | 3 | [] | no_license | #coding=utf-8
def quick_sort(ary):
return qsort(ary, 0, len(ary)-1)
def qsort(ary, left, right):
mark = ary[left]
lp = left
rp = right
if lp >= rp:
return ary
while lp < rp:
while ary[rp] >= mark and lp < rp:
rp = rp - 1
while ary[lp] <= mark and lp < rp:
... | true |
0ad71d874c7819da9e3af0f27be4fde702e751fa | Python | Nandinishra/nanoPython | /Exercise5.py | UTF-8 | 3,374 | 3.5 | 4 | [] | no_license | # Create a food log file for each client
# Create an exercise log file for each client.
# Ask the user whether they want to log or retrieve client data.
# Write a function that takes the user input of the client's name.
# After the client's name is entered, it will display a message as "What you want to log- Diet or Ex... | true |
95816e3bead92f89c7ae25ecd0ccdd5edcf36710 | Python | Siriapps/hackerrankPython | /re.start&re.end.py | UTF-8 | 350 | 3.203125 | 3 | [] | no_license | #https://www.hackerrank.com/challenges/re-start-re-end/problem
import re
s = input()
k = input()
index = 0
if re.search(k,s):
while len(k) < len(s):
m = re.search(k,s[index:])
if m!= None:
print((index+m.start(), index+m.end()-1))
else:
break
index += m.start(... | true |
c66f9ef75542b903335ce6cc165faad6b5a81218 | Python | RyanLiu6/ML-Intro | /Class_3/utils.py | UTF-8 | 863 | 2.546875 | 3 | [] | no_license | import os
import cv2
thresh = 150
ABSPATH = os.path.dirname(os.path.realpath(__file__))
class pyImage:
def __init__(self, imageName):
self.imageName = imageName
self.imageMat = cv2.imread(imageName, cv2.IMREAD_UNCHANGED)
def cleanImage(image):
# Convert image to Grayscale
grayScale = cv... | true |
b6a9e2fe79492a0efdcd95eed673d8e05a14a15d | Python | qorjiwon/LevelUp-Algorithm | /Easy/Baek_1085.py | UTF-8 | 348 | 3.09375 | 3 | [] | no_license | """
@ Baek 1085 직사각형에서 탈출
@ Prob. https://www.acmicpc.net/problem/1085
Ref.
Ref Prob.
@ Algo: 구현(수학)
@ Start day: 20. 01. 06
@ End day: 20. 01. 06
"""
curX, curY, W, H = map(int, input().split())
step = min(curX, W-curX)
step = min(step, min(curY, H-curY))
print(step)
"""
6 2 10 3
>
1... | true |
bd321a8c327c62fd0a1a8713cf1c3003af6c7be8 | Python | Dtomazzi/CS50 | /Mario in Python/mario.py | UTF-8 | 503 | 3.65625 | 4 | [] | no_license | from cs50 import get_int
def main():
height=get_height("What is the height?:")
space=height-1
hash=1
for x in range(height):
spaces(space)
hashes(hash)
space=space - 1
hash=hash + 1
def get_height(height):
while True:
n = get_int(height)
if n > 0 and n < 9:
... | true |
0f1a25a241447aa6981ec1755bca396792083317 | Python | smolynets/class | /jj.py | UTF-8 | 712 | 4.28125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# функція меню
def menu(list, question):
for entry in list:
print 1 + list.index(entry),
print ") " + entry
try:
return input(question) - 1
except NameError:
print 'Будь-ласка, введіть число від 1 до 8'
# визначаэмо наш список опцій для меню
option... | true |
5f0633dce715f34facb91246d2b2c1b35ccf97fe | Python | kobelzy/LeetCode | /python/matplotlib/plot.py | UTF-8 | 304 | 3.296875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
#线性图
fig,zx=plt.subplots()
x=np.linspace(-1,10,20)
y1=100*x +10
y2=2**x
plt.plot(x,y1,'r+',color='r',linewidth=1.0,linestyle='-',label='line1')
plt.plot(x,y2,'bo',color="b",linewidth=1.0,linestyle='--',label="line2")
plt.xlim(-2,11)
plt.show() | true |
17190f8e048e19465ad93a002842cd58e0f26a65 | Python | AMaoYouDianFang/learnpython | /mofanpython/01PrintDemo.py | UTF-8 | 301 | 3.859375 | 4 | [
"Apache-2.0"
] | permissive | print('a')
print("hello" + "world")
print("hello" + str(4))
print(int("5") + 4)
print(float("3.2") + 7)
print("the c is ", 5)
price = 1000
count = 10
print("price ", price, " count is", count)
name = input("Enter you name:")
print("hello", name)
tt = True
if tt and False:
print("Impossible") | true |
e3833926e0825526f30943ce5b72c90629aef4c9 | Python | ZinoKader/X-Pilot-AI | /attacking/attacker.py | UTF-8 | 2,729 | 3 | 3 | [] | no_license | import helpfunctions
import math
class Attacker:
def __init__(self, ai):
self.ai = ai
self.ai.setTurnSpeed(64)
def target_alive(self, target):
pass
def attack_player(self, target = None, target_id = None):
# if server id and ship id have not been matched yet
if n... | true |
7d16076363c67aff3b085007bf6acdeeb1d45afc | Python | aratnamirasugab/cp-interview-things | /code/Split a String in Balanced Strings.py | UTF-8 | 805 | 3.390625 | 3 | [] | no_license | class Solution:
def balancedStringSplit(self, s: str) -> int:
res = 0
if s[0] == 'L':
s[::-1]
left, right = [],[]
i = 0
while i < len(s):
if len(left) == len(right) and len(left) != 0:
res += 1
left.cle... | true |
423d3efda96c8185694a2b4738b31e5db0418157 | Python | kosazna/atsurvey | /converter/formater.py | UTF-8 | 1,968 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from atsurvey.primitives import *
class TraverseFormatter:
def __init__(self, data: Any):
self.df = load_data(data)
self.angles = None
self.dists = None
self._traverse = None
@staticmethod
def join_stops_for_angle(midenismos, stasi, metrisi) -> str:... | true |
be03bc12f26bd9b389bd6f4dc628a87ce03488c9 | Python | trimcrae/Question-Answering-Deep-NLP | /code/BiLSTM.py | UTF-8 | 2,137 | 3.515625 | 4 | [] | no_license | from __future__ import division, print_function, absolute_import
import tflearn
from tflearn.data_utils import to_categorical, pad_sequences
#from tflearn.datasets import imdb
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.embedding_ops import embedding
from tflearn.lay... | true |
14d73a25e49d21cc00cbd0c2d67ca1e396b42fd5 | Python | brucehzhai/Python-JiangHong | /源码/Python课后上机实践源代码/ch5-系列数据类型/P5-prg-2-List1Distinct.py | UTF-8 | 177 | 3.359375 | 3 | [] | no_license | ##list1=[1,2,3,2,3,4]
##set1=set(list1)
##list1=list(set1)
list1=[1,2,3,2,3,4]
list2=[]
for i in list1:
if i not in list2:
list2.append(i)
print(list2)
| true |
aac91293e3e663a94d39a585f34249992a190ccc | Python | hpcn-uam/ccore | /tests/test_cparser.py | UTF-8 | 18,611 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import pytest
import cparser
import pandas as pd
import pytz
from utils import ip2int
class Test_RecordList(object):
def test_new(self):
parser = cparser.RecordList()
assert parser is not None
def test_read___gets_all_records(self, macconvs_file, sample_values):
parser = cparser.Reco... | true |
9af3183526d9758c620fa19fee751e945fd00686 | Python | haradahugo/cursoemvideopython | /ex083.py | UTF-8 | 456 | 3.90625 | 4 | [] | no_license | ## Validando expressões matemáticas
expr = str(input('Digite a expressão matemática: '))
pilha = []
for simb in expr:
if simb == '(':
pilha.append('(')
elif simb == ')':
if len(pilha) > 0:
pilha.pop() #Retira o último elemento da lista pilha
else:
pilha.append(')'... | true |
189568e2d63443bf19ccaf1c31dd93f13817b9ed | Python | Rusta12/projects_parsing_mieltn | /TSVTunload/tsvttool.py | UTF-8 | 9,516 | 2.859375 | 3 | [] | no_license | import os
import shutil
import time
from datetime import datetime
from itertools import islice
import zipfile
from dbfread import DBF
import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
url = 'http://stat.customs.gov.ru/unload'
def init_driver(driver... | true |
7dd0e79a216372423316363731e009a01a565e8b | Python | freebz/Introducing-Python | /ch04/ex4-11.py | UTF-8 | 1,051 | 4.25 | 4 | [] | no_license | # 4.11 에러 처리하기: try, except
short_list = [1, 2, 3]
position = 5
short_list[position]
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# IndexError: list index out of range
short_list = [1, 2, 3]
position = 5
try:
short_list[position]
except:
print('Need a position between 0 and', ... | true |
644d049a2ff5ebff77d443a91d17a1f2a11b43ae | Python | Arya-Programmer/TodoApp-Flutter | /TodoBackend/backend/resources/validations.py | UTF-8 | 1,041 | 2.71875 | 3 | [] | no_license | from models import User
def validate(json_data):
try:
firstname = json_data["firstname"]
lastname = json_data["lastname"]
username = json_data["username"]
email = json_data["email"]
password = json_data["password"]
except Exception:
return {"message": "Required ... | true |
a3f70768a337c282edba6842bc8f32af587ebb43 | Python | theoneandonlywoj/Object-Shape-Classification-Utilizing-Magnetic-Field-Disturbance-and-Supervised-Machine-Learning | /import_data.py | UTF-8 | 4,268 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import numpy as np
from tflearn.data_utils import to_categorical
from import_data import *
def import_csv(file_path, shuffle = False):
data = pd.read_csv(file_path)
print('*' * 70)
print('Import CSV file has been successful!')
if shuffle == True:
data.reindex(np.random.permu... | true |
51027ab33f56df1dcc282cd6f0a256b0a5bc89f7 | Python | frankieliu/problems | /leetcode/python/47/original/47.permutations-ii.0.py | UTF-8 | 609 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode id=47 lang=python3
#
# [47] Permutations II
#
# https://leetcode.com/problems/permutations-ii/description/
#
# algorithms
# Medium (38.72%)
# Total Accepted: 215.1K
# Total Submissions: 555.5K
# Testcase Example: '[1,1,2]'
#
# Given a collection of numbers that might contain duplicates, return ... | true |
702a47b99ee52e59bcf917e2d5b44f8df880554b | Python | TheXichao/pp | /work/chapter4.py | UTF-8 | 524 | 3.796875 | 4 | [] | no_license | def task1():
import random
totalNum = int()
for _ in range(10):
num = random.randint(1,10)
print('you got the number: ', num)
totalNum += num
print('total of the number: ',totalNum)
def task2():
import random
totalNum = int()
for _ in range(1000):
num = rando... | true |
c1e12644ef78aa6f49a49bed7f4da900cf5c3db8 | Python | femog008/UdacityCapstoneProject | /automatedtesting/selenium/login.py | UTF-8 | 6,496 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import time
import logging
from selenium import webdriver
#from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.common.exceptions import NoSuchElementException
#Logging Config
logging.basicConfig(
... | true |
9cb6657a5f3de4a08a8d84f39c33a3c30560d731 | Python | jxnkb/project_WEB | /zhouxiaofang/0909作业/0909代码重敲/05其他操作.py | UTF-8 | 725 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#====#====#====#====
#Author:
#CreatDate:
#Version:
#====#====#====#====
from selenium import webdriver
import time
dr=webdriver.Firefox()
# dr.get('https://www.baidu.com')
# e=dr.find_element_by_id('kw')
# e.send_keys('软件测试')
# time.sleep(2)
# #回车
# e.submit()
# #获取页面... | true |
a2f8d17700135f5d83ffaa35775a122fb07bea36 | Python | beartype/beartype | /beartype/vale/__init__.py | UTF-8 | 7,787 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2023 Beartype authors.
# See "LICENSE" for further details.
'''
**Beartype validator API.**
This submodule publishes a PEP-compliant hierarchy of subscriptable (indexable)
classes enabling call... | true |
4c7ccbb582075b35397562037a837065b486061e | Python | tomoyk/misc | /paiza/b053/a.py | UTF-8 | 747 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
H,W = [int(i) for i in input().split()]
a = [ [int(i) for i in input().split()] for _ in range(2) ]
diff_x = a[0][1] - a[0][0]
diff_y = a[1][0] - a[0][0]
ans=[]
# print(a)
# print(diff_x, diff_y)
# 最初の2行だけ片付ける
for y in range(2):
tmp=[a[y][0], a[y][1]]
start = a[y][1]
diff_x = a[y][1]... | true |
dd8fbb56c8307630bacc141fe3f0f2f11fa45d72 | Python | brianliu2/cs231n_mySolution | /assignment_2/why_batchNorm_is_important.py | UTF-8 | 2,116 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 5 13:20:40 2017
@author: xliu
"""
import numpy as np
import matplotlib.pyplot as plt
D = np.random.randn(1000, 500)
hidden_layers_size = [500] * 10
# choose a nonlinear function to be the activation function
nonlinearities = ['relu'] * len(hidden_layers_size)
act = {'... | true |
c86465c4f1bdb202409e73625eaaa71a8751e09a | Python | Luckyaxah/leetcode-python | /组合.py | UTF-8 | 567 | 2.6875 | 3 | [] | no_license | class Solution:
def combine(self, n: int, k: int):
n_list = list(range(1,n+1))
def fun(n_list ,n,k):
ret = []
if n <= 0 or k<=0:
return [[]]
for i in range(n-k+1):
first = n_list[i]
t = fun(n_list[i+1:],n-i-1,k-1)
... | true |
39084937bd38f65de424fac72bff8dda9e77a98e | Python | KDYao/mtad-gat-pytorch | /prediction.py | UTF-8 | 9,408 | 2.71875 | 3 | [
"MIT"
] | permissive | import json
from tqdm import tqdm
from eval_methods import *
from utils import *
class Predictor:
"""MTAD-GAT predictor class.
:param model: MTAD-GAT model (pre-trained) used to forecast and reconstruct
:param window_size: Length of the input sequence
:param n_features: Number of input fea... | true |
fce4caeeadec5e00479b95072a66a233507b41fb | Python | IgoAlgo/Problem-Solving | /AejiJeon/baekjoonOJ/shortestpath/7_law_of_step6.py | UTF-8 | 876 | 3.375 | 3 | [] | no_license |
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
INF = int(1e9)
# 모든 vertex 쌍의 v1 -> v2 최단경로 담는 array
distance = [[INF]*(n+1) for _ in range(n+1)]
for i in range(1, n+1):
distance[i][i] = 0
# append edges
for _ in range(m):
a, b = map(int,input().split())
distance[a][b] = 1
... | true |
8905e33980a3cc21fad92f2c6112aed6076641ef | Python | JankDev/battleship | /main/computer.py | UTF-8 | 6,755 | 2.65625 | 3 | [] | no_license | import random
try:
import pymongo as mg
except ImportError as err:
print(err)
exit()
maxSevSelDelay = 2
try:
myclient = mg.MongoClient("mongodb://localhost:27017/", serverSelectionTimeoutMS=maxSevSelDelay)
except mg.errors.ServerSelectionTimeoutError as err:
print(err)
exit()
mydb = myclient[... | true |
2d183f6efadc667707e7bcf93844cb1f8ae441eb | Python | anyuhanfei/study_PyQt5 | /078~088-QAbstractButton/081-QAbstractButton-图标设置.py | UTF-8 | 1,674 | 3.640625 | 4 | [] | no_license | '''
081-QAbstractButton-图标设置
图标设置的 API :
setIcon(QIcon(image_path)) -- 设置图标(QSize() 方法在 PyQt5.QtGui 类中)
setIconSize(QSize(w, h)) -- 设置图标大小(QIcon() 方法在 PyQt5.QtCore 类中)
() -- 获取图标
iconSize() -- 获取图标大小
'''
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton, QLabel
from PyQt5.Qt... | true |
2c992d1e494251f37fe1d3e5b020a7a65f4388a1 | Python | GauravAmarnani/Python-Basics | /com/college/practicals/practical12/program2.py | UTF-8 | 277 | 4.5 | 4 | [] | no_license | # Q. Finding Area and Circumference of a Circle using Python Inbuilt Math Module.
import math
radius = float(input("Enter Radius of Circle: "))
area = math.pi * radius ** 2
circumference = 2 * math.pi * radius
print("Area = ", area, " and Circumference = ", circumference)
| true |
dfa06852f6a281f6c9a9ee152fa74a73a5083b8f | Python | raphaeldelacruz/Cryptography | /Simon64CTR.py | UTF-8 | 2,944 | 3.046875 | 3 | [] | no_license | from Crypto import Random
from Crypto.Random import get_random_bytes
from simon import SimonCipher
def makeBlocks(messageString,size):
blocks = []
i = 0
length = size
while i < len(messageString):
if i+length < len(messageString):
blocks.append(messageString[i:i+length])
... | true |
bfea49c5d92c5b63baffc949c5d97ddc3169a66e | Python | ladouceuf/gift-cli | /gift/commands/register.py | UTF-8 | 2,330 | 3.171875 | 3 | [] | no_license | """The register command."""
import pickle
from .base import Base
#This class inherit from the Base class
class Register(Base):
"""Register to the gift exchange event"""
#this method is run when the command "register" is parsed
def run(self):
#warning for user
print("\n*********************************... | true |
10c52bab91e8ab5c57ad96c109d6b098dc0ec3ce | Python | kuzeko/nanorc | /examples/Python.py | UTF-8 | 403 | 3.1875 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
import numpy as np
from sys import io
class Foo():
def __init__(self, name = "World!"):
self.name = name
self.is_test = True
if __name__ == "__main__":
instance = Foo()
print "Hello, %s" % instance.name
# Comments
for i in range( 1, 100):
... | true |
3614201a60f7902da369802b0e9a9f3d6e6e9e9a | Python | apapadoi/Numerical-Analysis-Projects | /Second Project/Exercise5/util.py | UTF-8 | 2,331 | 3.625 | 4 | [
"MIT"
] | permissive | from math import sqrt
def matrix_mult(a, b):
"""
Function that multiplies two matrices a and b
Parameters
----------
a,b : matrices
Returns
-------
new_array : matrix
The matrix product of the inputs
"""
new_array = []
for i in rang... | true |
1d01e9cb6f4f3adf89e057b56211711ee99e616a | Python | szes/data_visual | /random_walk/random_walk.py | UTF-8 | 1,425 | 3.5625 | 4 | [] | no_license | # -*- coding=utf-8 -*-
# add by gaozhi
import random
class RandomWalk(object):
"""一个生成随机漫步数据的类"""
def __init__(self, num_point=5000):
"""初始化随机漫步的属性"""
self.num_point = num_point
# 所以随机漫步都始于(0, 0)
self.x_values = [0]
self.y_values = [0]
def get_step(self):
... | true |
62ed08af841e0b95c8b6b4c9d777f1a98cf9dffe | Python | future1111/GraphGallery | /graphgallery/gallery/gallery_model/tensorflow/densegcn.py | UTF-8 | 4,924 | 2.828125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from graphgallery.gallery import GalleryModel
from graphgallery.sequence import FullBatchSequence
from graphgallery.nn.models.pytorch import GCN as pyGCN
from graphgallery.nn.models.tensorflow import DenseGCN as tfGCN
from graphgallery import functional as gf
class DenseGCN(GalleryModel):
... | true |
776f335d8913b046b0f4a4273319a8e7605c94dd | Python | pedrolucas27/exercising-python | /list03/exer_09.py | UTF-8 | 371 | 4.3125 | 4 | [
"MIT"
] | permissive | #Faça um programa que receba dois números inteiros e gere os números inteiros
# que estão no intervalo compreendido por eles.
n1 = int(input("Informe um número:"))
n2 = int(input("Informe outro número:"))
if n1 < n2:
for i in range(n1+1,n2):
print(i)
elif n1 > n2:
for i in range(n1-1,n2,-1):
p... | true |
f5b8364e5d789f0fb20eff54d668ddafe3fc3191 | Python | raysmith619/Introduction-To-Programming | /exercises/turtle/from_others/turtle_keypress_move.py | UTF-8 | 1,662 | 4.40625 | 4 | [] | no_license | # Turtle Animation using Screen Events - Arrow Keys.
# From: https://softwareprogramming4kids.com/turtle-animation/
import turtle
screen = turtle.Screen()
screen.setup(320,320) # Set screen size.
screen.tracer(0) # Stop animation until frame is completed.
screen.title('TURTLE ANIMATION USING ARROW KEYS')
trtl ... | true |
937ca7898a165dc03a6e928ccfd38f6a721a1380 | Python | aditi0330/Codecademy-Python-for-Data-Science | /Data Visualisation/Different_plot_types.py | UTF-8 | 2,950 | 3.484375 | 3 | [] | no_license | #Simple Bar Chart
from matplotlib import pyplot as plt
drinks = ["cappuccino", "latte", "chai", "americano", "mocha", "espresso"]
sales = [91, 76, 56, 66, 52, 27]
plt.bar(range(len(drinks)), sales)
ax = plt.subplot()
ax.set_xticks(range(len(drinks)))
ax.set_xticklabels(drinks)
plt.show()
#Side by side... | true |
40947c350a09b47afa062d017d2d0a52a7aeb6eb | Python | andreaskami/Multi-Agent_GPS_Planning_Tool | /utility/path_search.py | UTF-8 | 2,373 | 3.484375 | 3 | [] | no_license | import heapq as hq
from utility.misc import distance
def a_star_search(grid, start, goal, max_dist):
"""
Performs A* search on a grid, from start to goal.
start and goal should be of the Node object type (see utility/grid.py)
If start is more than max_dist away from the goal, the path is not considere... | true |
082a16be1c45ac82a947a0642ee964042e65f360 | Python | TolarianNinja/bagoftricks | /ddate.py | UTF-8 | 6,439 | 3.140625 | 3 | [] | no_license | import datetime
# ddate.py Prints the current date of the Discordian Calendar and any
# Holydays/Whollydays of that date to the console.
# Date can be edited by changing current_date variable
# Written by Alex Hartshorn
current_date = datetime.datetime.now() ... | true |
32fc9e94ce17520402bc3cece0292f1a11afbe88 | Python | NevilleMthw/library-system | /bookReturn.py | UTF-8 | 786 | 3.796875 | 4 | [
"MIT"
] | permissive | from database import Database
class ReturnBook:
"""
This class returns the result with the bookID,
thereby checking the bookID entry and performing the respective functions.
"""
def __init__(self) -> None:
"""Initializing the database class to use the functions from that python module."""... | true |
cde6bb33df361411d0c7e374334480371ee6fa77 | Python | mmascher/WMCore | /src/python/Utils/IterTools.py | UTF-8 | 677 | 3.421875 | 3 | [] | no_license | #! /usr/bin/env python
from __future__ import division, print_function
from itertools import islice
from itertools import chain
def grouper(iterable, n):
"""
:param iterable: List of other iterable to slice
:type: iterable
:param n: Chunk size for resulting lists
:type: int
:return: iterator o... | true |
cfbb904bd5d2eb954bce5766edee77208351f965 | Python | CedricKen/Python-GUI | /Images/MAGE 1/IMAGE.py | UTF-8 | 279 | 2.796875 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
root = Tk()
calculator = ttk.Button(root, text="CALCULATOR")
calculator.grid(row=0, column=0)
logo = PhotoImage(file="calculator.PNG").subsample(5, 5)
calculator.configure(image=logo, compound=BOTTOM)
root.mainloop()
| true |
58318632c7fd74718eea20a41442ceae6707af75 | Python | hpl002/erlingPython | /del_3.py | UTF-8 | 820 | 3.765625 | 4 | [] | no_license | # du kan definere flere hjelpefunksjoner om du trenger dem
def print_diamond(N): # ikke endre den linjen
print('Tall:', N)
if int(N) > 0:
for i in range(int(N)):
for m in range (int(N) - i):
print(" ", end="")
for j in range((i * 2) - 1):
... | true |
012926ab251cec2f59bf19a563dd58f9ad6057c4 | Python | panzerkampfy/fastapi-test | /src/workshop/tables.py | UTF-8 | 648 | 2.625 | 3 | [] | no_license | from sqlalchemy import Column, Integer, Date, String, Float, Text, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
email = Column(Text, unique=True)
username = Column(Text, u... | true |
eff5ca3e2bd5bf70792f9d6336c883156eb2bb55 | Python | delphix/delphixpy-examples | /lib/GetReferences.py | UTF-8 | 9,856 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | """
Module that provides lookups of references and names of Delphix objects.
"""
import re
from datetime import datetime
from dateutil import tz
from delphixpy.v1_8_0.exceptions import HttpError
from delphixpy.v1_8_0.exceptions import JobError
from delphixpy.v1_8_0.exceptions import RequestError
from delphixpy.v1_8_... | true |
aa4c6c12c1ecbd3aa78bd9d2b46049406247a3a9 | Python | jwg4/t-tetromino | /writing/five.py | UTF-8 | 400 | 3.0625 | 3 | [] | no_license | from drawings import preamble, postamble, draw_cropped_square, draw_tetromino, draw_square
if __name__ == '__main__':
preamble()
draw_cropped_square(0, 0, 5)
tetrominos = [(0.5, 3.5, 3), (2.5, 4.5, 0), (2.5, 1.5, 1), (3.5, 1.5, 3), (4.5, 3.5, 1)]
for x, y, t in tetrominos:
draw_tetromino(x, y, ... | true |
e4fad8ca54b742e191c2798dc8006f4fdfc7f0e4 | Python | cboopen/algorithm004-04 | /Week 02/id_069/LeetCode-169-069.py | UTF-8 | 397 | 3.375 | 3 | [] | no_license | #20191027
"""
暴力解法:计数
"""
class Solution:
def majorityElement(self, nums):
numdict = {}
for num in nums:
if num not in numdict:
numdict[num] = 1
else:
numdict[num] += 1
return max(numdict.keys(), key=numdict.get)
... | true |
586e496cd45f2a26b46f38d0f2593f7e81113bb1 | Python | cao-cp/remote-management | /obey_command.py | UTF-8 | 313 | 2.75 | 3 | [] | no_license | import os
class boeyCommand():
def __init__(self):
pass
def obey(self,command):
if command.split(":")[0] == "cmd":
result = os.popen(command.split(":")[1]).read()
return result
else:
return "Sorry I can't understand what you want"
| true |
822fb782cb61c0238192854c4aae417e23aa80d7 | Python | AlecS19/EECS504_Project_F20 | /dataCreation.py | UTF-8 | 931 | 2.578125 | 3 | [] | no_license | import cv2
import os
import pandas as pd
import numpy as np
def load_images_from_folder(folder):
images = []
labels = []
for filename in os.listdir(folder):
img = cv2.imread(os.path.join(folder,filename))
if img is not None:
images.append(img)
labels.append(ord(file... | true |
35e534ab0b0af634cabc4aa358c9df75fab58887 | Python | qinyanjuidavid/Self-Learning | /CreatingModules.py | UTF-8 | 478 | 3.25 | 3 | [] | no_license | #Check the script myFunctions in the folder named myDirectory
from myDirectory import myFunctions
# import myDirectory.myFunctions #Another way of importing scripts
#import myDirectory.myFunctions as func #Another alternative
#from myDirectory import myFunctions as func #Alternative
import myModule
print("Add:",myModul... | true |
d4af7da28286b15de0a4da931cbf8a7564dff28d | Python | Brandsatz/Audio-Video-Programmierung | /Hausaufgaben/Projekt/Python/test.py | UTF-8 | 2,253 | 2.625 | 3 | [] | no_license | import rtmidi
import mido
import cv2
import numpy as np
import time
# midiOutput = mido.open_output("IAC-Treiber Bus 1")
midiOutput = mido.open_output("LoopBe Internal MIDI 1")
name = mido.get_input_names()
print(name)
# inport = mido.open_input('IAC-Treiber Bus 1')
inport = mido.open_input('LoopBe Internal MIDI 0'... | true |
f6c4eedfcd0848d8ffdaf41be0e9dcf062e2deea | Python | rinkeyrahman/EUC_ST_ML | /machine_learning/attribute.py | UTF-8 | 12,332 | 2.765625 | 3 | [] | no_license | from __future__ import print_function
import scipy.stats as stats
from scipy.stats import chisquare
from scipy.stats import pearsonr
import pymysql
import pandas as pd
import numpy as np
import json
import sys
import config as cfg
SIGNIFICANCE_LEVEL=0.05
class Attribute:
"""
This class mainta... | true |
331e649b2853b890dbd10e8c2dc6ae33818d0906 | Python | jukent/GeoCAT-examples | /Gallery/Contours/NCL_polar_1.py | UTF-8 | 4,190 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | """
NCL_polar_1.py
==============
This script illustrates the following concepts:
- Drawing black-and-white contours over a polar stereographic map
- Drawing the northern hemisphere of a polar stereographic map
See following URLs to see the reproduced NCL plot & script:
- Original NCL script: https://www.n... | true |
83c32d88883eaf95ccd79150139564f08bf6293a | Python | ghlee0304/tensorflow-basic-and-advanced | /Basic/lab01-4_linear_regression_compute_gradient.py | UTF-8 | 2,163 | 2.84375 | 3 | [] | no_license | import tensorflow as tf
import load_data
def create_weight_variable(shape):
W = tf.get_variable(name = 'W', shape = shape, dtype = tf.float32, initializer= tf.truncated_normal_initializer())
b = tf.get_variable(name = 'b', shape = shape, dtype = tf.float32, initializer= tf.constant_initializer(0.0))
... | true |
3e27a3c18794112cad1617f6acc79ac5e9eb4cbf | Python | johnsonpk/School-work | /325CSC/3Homework/hw2_funcs.py | UTF-8 | 4,911 | 3.671875 | 4 | [] | no_license | ############################
# Name: Pablo Johnson
# Class: CSC 325 - Adv. Data Structures and Algorithms
# Assignment: Implementation of KMP Algorithm
# Due: Oct 31, 2017 (Spooky)
############################
import time, sys
# Time to compare speed of algorithms
# Sys to read from stdin
# I'm going to refrain from a... | true |
9818450deb81e7d40306d5b0473906101acf0e19 | Python | tomboxfan/PythonExample | /loop/WhileExample.py | UTF-8 | 254 | 3.84375 | 4 | [] | no_license | c = 5
while c != 0:
print(c)
c-=1
c=5
while c:
print(c)
c-=1
while True:
response = input() # input() 从Console 获得输入
if int(response) % 7 == 0:
break
else:
print(response, "is not a multiple of 7!") | true |
90bc3b6949c8daa08b93b7f0ea249e7e9e071353 | Python | taufanlubis/mycode | /python/nesting-statement.py | UTF-8 | 212 | 3.515625 | 4 | [] | no_license | thing="fruit"
fruit="mango"
if thing=="fruit":
if fruit=="apple":
print 'this fruit is apple'
else:
print 'this is fruit but i don\'t know what it is'
else:
print 'this is not fruit'
| true |
1c17616b89a0d8a5d487f80d794e67c8e11d9032 | Python | beboxos/ArduinoThings | /picoRGB/backupPicoRGB/random.py | UTF-8 | 571 | 2.625 | 3 | [] | no_license | from rgbkeypad import RgbKeypad
import time
import random
keypad = RgbKeypad()
keys = keypad.keys
delais = 0.1
while True:
keypad.update()
i = random.randint(0,15)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
keys[i].set_led(r,g,b)
time.sleep(delais)
if k... | true |
97bc4d0aabd93b65d7c1877568df7c78cdace82b | Python | molchiro/AtCoder | /エクサウィザーズ2019/C.py | UTF-8 | 1,114 | 3.359375 | 3 | [] | no_license | def check_alive(n):
p = n
for spell in spells:
if spell[0] == s[p]:
p += 1 if spell[1] == 'R' else -1
if p == -1:
return 'L'
elif p == N:
return 'R'
return 'OK'
N, Q = list(map(int, input().split()))
s = [x for x in input()]
spells = [input().spli... | true |
ff30351f93c8d1ca919245ad5e7e598b353d6585 | Python | Gosols/ohkete-teht-v-t | /postitoimipaikka.py | UTF-8 | 357 | 2.515625 | 3 | [] | no_license | import urllib.request as r
import json
url = r.urlopen(
"https://raw.githubusercontent.com/theikkila/postinumerot/master/postcode_map_light.json")
html = url.read()
postitoimipaikat = json.loads(html)
postinumero = input("Kirjoita postinumero: ")
print("")
for key in postitoimipaikat:
if key == postinumero:
... | true |
0c3bcb6d3f3ea33f257b558db553c7d49bfe00d8 | Python | danilomo/PyLernkarten | /pylernkarten/workspace.py | UTF-8 | 1,388 | 2.796875 | 3 | [] | no_license | import sys
import pylernkarten.words as words
import pylernkarten.decks as decks
from pylernkarten.commands import command, parse_command
def workspace():
if sys.argv[1:]:
return sys.argv[1]
else:
return "workspace.txt"
def save_nouns(f):
for noun in words.feminine():
f.write("n di... | true |
b4aa318d2bbdd590d2853d346c46dfa5f081b7a1 | Python | 0xHendry/EulerProjectSolution | /Task001.py | UTF-8 | 123 | 3.28125 | 3 | [] | no_license |
i = 0
array = []
while i < 999:
i += 1
if (i % 3) == 0 or (i % 5) == 0:
array.append(i)
print(sum(array))
| true |
4cad2268990c9e58b0ae2677f7c68f657bbf1d74 | Python | johanarangel/condicionales_python | /ejercicios_practica.py | UTF-8 | 9,993 | 4.8125 | 5 | [] | no_license | #!/usr/bin/env python
'''
Condicionales [Python]
Ejercicios de práctica
---------------------------
Autor: Johana Rangel
Version: 1.3
Descripcion:
Programa creado para que practiquen los conocimietos adquiridos durante la semana
'''
__author__ = "Johana Rangel"
__email__ = "johanarang@hotmail.com"
__ver... | true |
6346a26dfe4e269af1280adf01f929d81850ca4d | Python | KaranJaswani/Codes | /LeetCode-Python/376. Wiggle Subsequence.py | UTF-8 | 1,475 | 3.28125 | 3 | [] | no_license | class Solution(object):
def wiggleMaxLength(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) <= 1:
return len(nums)
res = 1
lastDifference = False
lastNumber = nums[1]
start = 1
for i in range(1, len(num... | true |
7f53ab8b8fd16e4f88422f9eccdc2cbbe78b641e | Python | manishym/algorithms_in_python | /myTurtle.py | UTF-8 | 349 | 3.34375 | 3 | [] | no_license | #!/usr/local/bin/env python
import turtle
myTurtle = turtle.Turtle()
myCanvas = turtle.Screen()
def draw_spiral(mt, lineLen):
if lineLen > 0:
mt.forward(lineLen)
mt.right(90)
draw_spiral(mt, lineLen - 5)
def main():
draw_spiral(myTurtle, 200)
myCanvas.exitonclick()
if __name... | true |
92632996d5fb1fd915ffe773fb27d0653ce693f2 | Python | KirillMysnik/SP-UniShop | /srcds/addons/source-python/packages/custom/unishop/items.py | UTF-8 | 1,673 | 2.515625 | 3 | [] | no_license | # =============================================================================
# >> IMPORTS
# =============================================================================
# UniShop
from .engine import unishop_engine
from .plugins import UniShopPlugin
# ===============================================================... | true |
43724c85e66c456c0608cdb034cc05a04a337467 | Python | delovoy70/gkbrns | /2_csv.py | UTF-8 | 2,466 | 3.03125 | 3 | [] | no_license | import csv
import re
def getdata(list_of_files):
regex_prod = r'Изготовитель системы:' + '' '+'
regex_name = r'Название ОС:' + '' '+'
regex_code = r'Код продукта:' + '' '+'
regex_type = r'Тип системы:' + '' '+'
main_data = [['Изготовитель системы', 'Название ОС', 'Код продукта', 'Тип системы']]
... | true |
06c4b8fd11859cdac9e37aba78af2669f1fc20a0 | Python | lisapro/co2marine | /b3_map.py | UTF-8 | 5,623 | 2.78125 | 3 | [] | no_license | '''
Created on 15. feb. 2017
@author: ELP
'''
# script creates a map of available
# data. form WOD, field data, modeling input
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from netCDF4 import Dataset
from matplotlib.patches import Ellipse
#read netcdf f... | true |
8b98d1454f98fe4de71b4c3d2739b922fdd07dc4 | Python | Barrett97/Twitter-Sentiment-Analysis | /sentmapper.py | UTF-8 | 211 | 3.046875 | 3 | [] | no_license | import sys
import re
from datetime import datetime
for line in sys.stdin:
line = re.sub(r'\n', '', line)
words = line.split('\t')
print(words[0]+ "\t" + words[1] + "\t" + words[2] + "\t" + words[3]) | true |
c166e2edfe0d6d797b0c4591bb06957f2f41c05c | Python | Pankhuriumich/EECS-182-System-folder | /Lecture_Code/Topic_9_Loops/mymap.py | UTF-8 | 2,724 | 4.125 | 4 | [] | no_license | import pdb
'''
Goal: We want to apply a function like cube to every element of a list and
get back a new list.
Recipe:
result list should be initialized to empty.
Go through each element of the input list:
apply the function to the element and append to the result list.
'''
def mymap(f, L):
'''Apply f to elem... | true |
b2df4bf59488a628b919075b640df339dc531fe8 | Python | metamorphe/symbiot-app | /server/interpreter.py | UTF-8 | 2,268 | 3.125 | 3 | [] | no_license | import threading
import sys
import getch
import controller as controller
class KeyEventThread(threading.Thread):
def __init__(self, ard):
super(KeyEventThread, self).__init__()
self.controller = ard
self.char_buffer = []
def run(self):
print "> ",
while True:
... | true |