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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
93e0762b50c2519c3776a739ad0a9794cb3a319b | Python | fabriciomatos1/Desafios-Python | /desafio12.py | UTF-8 | 1,056 | 4.65625 | 5 | [] | no_license | #Desafio 12
from time import sleep
#Decorações
def linha1(x):
print("\033[1;34m<\033[m"*len(x))
print(f"\033[1;32m{x}\033[m")
print("\033[1;34m>\033[m"*len(x))
return x
#Chamadas e título
linha1("Mestre da matemática")
lista1= []
lista2= []
soma= []
#Comandos principais
for i in rang... | true |
32f5ef203a7598b729b36696142a467e038573ed | Python | sriramrn/chemotaxis | /simulation/Strategy_comparison/Analysis/Analysis_Comparison.Subsets.py | UTF-8 | 2,046 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 14:00:28 2015
@author: Sriram
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 24 14:58:48 2015
@author: Sriram
"""
import numpy as np
import matplotlib.pyplot as plt
source=[1000,1000]
ncells=50
simtime=5000
dt=1
r=[1,3,4,5,9,10,11,15,... | true |
8818f19ee7201d427fa37a353574fe53c4e07f38 | Python | silkylaroux/cs445 | /A4/notebookcode.py | UTF-8 | 7,962 | 3.46875 | 3 | [] | no_license |
# coding: utf-8
# $\newcommand{\xv}{\mathbf{x}}
# \newcommand{\Xv}{\mathbf{X}}
# \newcommand{\yv}{\mathbf{y}}
# \newcommand{\zv}{\mathbf{z}}
# \newcommand{\av}{\mathbf{a}}
# \newcommand{\Wv}{\mathbf{W}}
# \newcommand{\wv}{\mathbf{w}}
# \newcommand{\tv}{\mathbf{t}}
# \newcommand{\Tv}{\mathbf{T}}
# \newcommand{\muv}{\b... | true |
cf6fa14cd8dda1dc16ecad542fd7ace90ea9a8dc | Python | jiacai2050/pysh | /pysh/util.py | UTF-8 | 1,717 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from __future__ import (
print_function, absolute_import, unicode_literals
)
import sys
import codecs
import itertools
from chardet.universaldetector import UniversalDetector
def stderr_print(msg):
if isinstance(msg, unicode):
msg = msg.encode("utf-8")
print(msg, file=sys.st... | true |
78597529e23788c4e1fba464764f1743365fb6e5 | Python | Nasafato/networks | /UdpChat.py | UTF-8 | 4,903 | 2.984375 | 3 | [] | no_license | import argparse
import re
import unittest
from server import Server
from client import Client
class ArgsException(Exception):
pass
def main():
parse_command_line()
def parse_command_line():
parser = create_parser()
args = parser.parse_args()
if args.server:
server = Server(args.server)
... | true |
4c11567827f652c4855bf4541f597614848e2953 | Python | reinerasis78/pythonWithTkinter | /test2.py | UTF-8 | 198 | 3.5625 | 4 | [] | no_license | class cat:
def __init__(self,gender):
self.gender = gender
def classification(self):
print("cat gender is {}".format(self.gender))
mark = cat("female")
mark.classification() | true |
d7eb21a91be2acdeddb3c8f0461604d39a3001b7 | Python | ThunderPhantom/PyGameProjects | /Challenges.py | UTF-8 | 118 | 3.8125 | 4 | [] | no_license | x = 1
while x <= 10:
y = 1
while y <= 10:
y=y+1
print(' ')
print (y, end='')
| true |
7b315720800824dfd20d2fade1f54d370a4cda41 | Python | arnehilmann/netkraken | /src/main/python/counterdb/__init__.py | UTF-8 | 3,297 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
from __future__ import division
import json
import os
import sys
class CountDB(object):
@classmethod
def open(clazz, filename):
self = CountDB(filename)
self.mode = "readonly" # TODO use enums/constants for self.mode instead of plain strings
self.load()
... | true |
30cece6f393fcecc21bcb6fd040aa0aa1f7d58b6 | Python | JPEspinoza/life | /main.py | UTF-8 | 3,927 | 3.359375 | 3 | [] | no_license | import tkinter
master = tkinter.Tk()
size = 800
divisions = 50
partition = size / divisions
#simulation time between ticks
tickTime = 200
#is the simulation active?
simulating = False
#false = dead
#anything else = alive
board = [[False for _ in range(divisions + 1)] for _ in range(divisions + 1)]
#parallel to t... | true |
404d272ab5a4e865fdc9e6dab79fa64b17e5da79 | Python | leschultz98/sm_basics | /python_basics.py | UTF-8 | 6,823 | 3.859375 | 4 | [] | no_license | from math import sqrt
from string import punctuation
from time import sleep
from pygame import init
from pygame.mixer import Sound
# Waypoint 1: Say Greeting
def hello(name):
"""Display a simple greeting."""
return 'Hello {}!'.format(name.strip())
# Waypoint 2: Pythagorean Theorem
def calculate_hypotenuse(... | true |
07c4115df878d106fa3d12b7964a55d4a39c1c6c | Python | Murali1125/Fellowship_programs | /DataStructurePrograms/anagram_primeNumbers_stack.py | UTF-8 | 1,132 | 4.375 | 4 | [] | no_license | """----------------------------------------------------------------------
-->Add the Prime Numbers that are Anagram in the Range of 0 - 1000 in a
--Stack using the Linked List and Print the Anagrams in the Reverse Order.
--Note no Collection Library can be used.
--------------------------------------------------------... | true |
e1f060f759a1b421771c00af9e6be5874c47fa08 | Python | Artemish/euler | /convergents.py | UTF-8 | 1,467 | 3.34375 | 3 | [] | no_license | def square_root_cf(n):
root = n ** 0.5
m = int(root)
if m * m == n:
return None
first = m
rest = []
y0, y1, y2 = 1, m, n - m*m
seen = set()
while True:
val = (y0 * root + y1) / y2
m = int(val)
y0, y1, y2 = y2*y0, y2*(m*y2-y1), y0*y0*n - (m*y2 - y1) * (... | true |
957a07b1a3c7a0c0a1fc46b066d942b2e843dda4 | Python | Akbar2998/stepic | /week3/modules/request2.py | UTF-8 | 463 | 2.78125 | 3 | [] | no_license | import requests
download_link = 'https://stepic.org/media/attachments/course67/3.6.3/'
filename = '213837.txt'
while filename:
print(filename)
r = requests.get(download_link + filename)
filename = None if r.text.startswith('We') else r.text
print(r.text)
# We are the champions, my friends,
# And we'll k... | true |
9113b2967424cdc29e0962cea23c6de0dd666274 | Python | eazow/leetcode | /98_validate_binary_search_tree.py | UTF-8 | 1,024 | 3.59375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
import sys
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def isValidBST(self, root):
"""
:param root: TreeNode
:return: bool
"""
return self.dfs(roo... | true |
ca5b256d1c4ca1c564944971a307b906f9203a8d | Python | kim-mini/Image_processing | /data_set_custom/rename.py | UTF-8 | 2,572 | 2.59375 | 3 | [] | no_license | import os
cnt = 1
path = '/home/mini/study/Yolo_mark/x64/Release/data/img4'
fileList = os.listdir(path)
ext = '.jpg'
ClassName = 'ramen'
for filename in fileList:
if filename == 'Untitled.ipynb':
break
if filename.endswith(ext):
srcpath = os.path.join(path, filename)
if cnt < 10:
... | true |
257fe67ef0a58e7b1988451877d30771649c6ab1 | Python | GiftCarder-API/client | /docs/generate.py | UTF-8 | 6,117 | 2.65625 | 3 | [
"MIT"
] | permissive | try:
from pydocmd import document
from pydocmd.imp import import_object
from pydocmd import loader
from pydocmd.__main__ import main
from yapf.yapflib.yapf_api import FormatCode
except ImportError:
print("You need to run `pip install pydoc-markdown yapf` to generate docs")
import inspect
import ... | true |
b3bda88dcb2753a8c648914dfdcee48495424f10 | Python | chessesio/modelingTwitter | /tweet.py | UTF-8 | 563 | 3.15625 | 3 | [] | no_license | # construct the tweet object
# A tweet contains the username of user tweeting, a message, an optional picture, date and time of the tweet, and a list of comments
# A tweet can take in comments
from datetime import datetime
class Tweet:
def __init__(self,username,message,picture=None,date_time=datetime.now(),co... | true |
d329c2dd2a5d7bac4ce6fb17718629e105a1c266 | Python | s52047qwas/py39AutoTest | /tools/handle_request.py | UTF-8 | 1,656 | 2.765625 | 3 | [] | no_license |
import requests
from tools.handle_loging import my_logger
class SendRequest:
def __init__(self):
self.headers = {"X-Lemonban-Media-Type": "lemonban.v2", "Content-Type": "application/json"}
def __handle_headers(self,token=None):
if token:
self.headers["Authorization"] = "Bearer {}... | true |
491f97e7d9364db1e6d6f40501abc2a9b8a11a04 | Python | neoqy/flask_init | /hello.py | UTF-8 | 1,790 | 2.671875 | 3 | [] | no_license | import os # only needed in cloud 9
from flask import Flask, url_for, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return 'Index Page'
@app.route('/hello')
def hello_world():
return 'Hello World!'
@app.route('/username/<username>')
def show_user_profile(username):
return 'U... | true |
6b3a6f9664913b94166ae1530461a56a352e97a4 | Python | ntrang086/python_snippets | /linked_list/clone_randomly_linked_list.py | UTF-8 | 2,379 | 4.65625 | 5 | [] | no_license | """Clone a linked list that has a next pointer and the other pointer
points randomly at another node in the list"""
from doubly_linked_list import *
def clone_linked_list(linked_list):
"""Clone a randomly linked list.
Consider previous pointer the random pointer"""
clone = DoublyLinkedList()
# Create... | true |
dc537f086aa212225daec1079bfd3b42fcc7e3f7 | Python | thearod5/memory-network | /models/builder.py | UTF-8 | 6,920 | 2.796875 | 3 | [] | no_license | """
Responsible for defining a memory network model configurable to multi-answer responses.
"""
from keras.layers import Activation, BatchNormalization, Dense, Dropout, Input, LSTM, Permute, RepeatVector, \
TimeDistributed, add, \
concatenate, dot
from keras.layers.embeddings import Embedding
from keras.models ... | true |
1ac3c3f25ddf513626aceaf3bc6b9b4ecd558a98 | Python | CrazyPassion/PycharmProjects | /l1/quotes.py | UTF-8 | 438 | 3.140625 | 3 | [] | no_license | __author__ = 'vonking'
str1 ='It is a "test".'
str2 ="It's a dog"
#str3 =" test quote in"quote"."
#str4 = ' test in 'test'.'
str5 = '''he
she
my 'q1'
"q2"
test'''
print str1
print str2
# print str3
# print str4
print str5
print 'hello python\nhello python'
print r'hello python\nhello python' #natural string
print ... | true |
2cc820ceb88069c752d2913806e02f2be4c84dca | Python | RodericDay/advent2018 | /y2017/p02.py | UTF-8 | 326 | 3.25 | 3 | [] | no_license | def main(text, simple):
sheet = [[int(n) for n in line.split()] for line in text.splitlines()]
if simple:
print(sum(max(line) - min(line) for line in sheet))
else:
divs = lambda line: (a / b for a in line for b in line)
print(sum(int(n) for line in sheet for n in divs(line) if not n ... | true |
205c9e866bffcd4824b56cbdfd810d543171eab5 | Python | eric496/leetcode.py | /array/849.maximize_distance_to_closest_person.py | UTF-8 | 1,334 | 3.828125 | 4 | [] | no_license | """
In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty.
There is at least one empty seat, and at least one person sitting.
Alex wants to sit in the seat such that the distance between him and the closest person to him is maximized.
Return that maximum distance to cl... | true |
cee94a365c930c1afbd782ec7dd4b8ef71dea143 | Python | logic-life/LeetCode | /LC50_Pow(x, n)_Math.py | UTF-8 | 691 | 3.796875 | 4 | [] | no_license | class Solution:
def myPow(self, x: float, n: int) -> float: # 快速幂算法 数学
result = 1
if (x == 0.0) : return 0.0 # 注意float型的输出
if (n < 0) : x, n = 1 / x, -n # 负数次幂的处理,易忘易错
while n:
if (n & 1) : result *= x # 满足影响result数值的条件
x *= x # 不管能不能影响result,x都应该继续按照... | true |
11950fef5b6cb6b206171fd30c7223659a1d213a | Python | Christian-programming/BachelorThesisSimToReal | /tqc_models.py | UTF-8 | 6,568 | 2.859375 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import Module, Linear
from torch.distributions import Distribution, Normal
from torch.nn.functional import relu, logsigmoid
class Actor(Module):
def __init__(self, state_dim, act... | true |
47b994408cb377803352686e3a81013c8671f8c8 | Python | Friedmannn/wikiminer | /models.py | UTF-8 | 11,240 | 2.65625 | 3 | [] | no_license | '''
Copyright Yongqian Li
Released under GPL v3
'''
class Redirect(object):
def __init__(self, dest_id=None, dest_fragment=None, label=None):
self.dest_id = dest_id
self.dest_fragment = dest_fragment
self.label = label
def __repr__(self):
#return 'Redirect(lab... | true |
f837202af039758db5e7c3e4cd3bb6ee5654b72d | Python | sikander441/Codechef | /MNMX.py | UTF-8 | 108 | 3.03125 | 3 | [] | no_license | t=int(input())
for _ in range(t):
n=int(input())
l=[int(x) for x in input().split()]
print(min(l)*(n-1))
| true |
e30ae3f9c9df3de20f3057a8ca749c879f2f9849 | Python | tortious/dotfiles-9 | /local/bin/images_to_video | UTF-8 | 1,197 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import glob
import re
import imageio
import tqdm
def natural_sort(l):
convert = lambda text: int(text) if text.isdigit() else text.lower() # NOQA
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)] # NOQA
return sorted(l, key=alphanum_key)
... | true |
75dcd9cdf8ef3652d57f6237c167607ebbcd871a | Python | GucciGavin/Pyth0n | /random_int.py | UTF-8 | 206 | 2.96875 | 3 | [] | no_license | # save this file as random_int.py
from random import randint
def ranint():
r = randint(65,91)
return r
def main():
for r in range (1000000000000000):
rint = ranint()
print (rint,end="")
main()
| true |
c7b417bb9093a8cac870becbed60e85c811a9707 | Python | xentrick/autopwn | /autopwn/services/phpmyadmin.py | UTF-8 | 2,668 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
import requests
import argparse
from bs4 import BeautifulSoup
import logging
log = logging.getLogger(__name__)
class PHPMyAdmin:
def __init__(self):
self.__host = None
self.__port = 80
self.__path = "/phpmyadmin/index.php"
self.__token = None
self.... | true |
ac171503c42b57bcaee3122b5757a7ed6fece09a | Python | deepakreddy5511/pythonprobs | /bank.py | UTF-8 | 1,861 | 3.53125 | 4 | [] | no_license |
def random(balance,n):
count=0
import random
v=random.randrange(222222,999999,234)
print("\nyour otp is:",v)
k=int(input("Please enter your otp: "))
if(k==v):
c=check(balance,n)
return c
elif k!=v:
for i in range(0,2):
count=count+1
print("\no... | true |
20d458e932533b41ffa3ded935d84fa9a466e7ec | Python | cashgithubs/Huge_py | /CRE/HUGE-SPAMMER/smsBOMB.py | UTF-8 | 3,298 | 2.9375 | 3 | [] | no_license | """Made By Toki and revisited by venam => Now VENAMTEAM"""
from mechanize import Browser
import threading
############FUNCTION THAT CUT A FILES IN MANY PARTS######################
def chunkIt(seq, num):
avg = len(seq) / float(num)
out = []
last = 0.0
while last < len(seq):
out.append(seq[int(last):int(las... | true |
1b848634041124c1890339081fdf55f6d1d2aacd | Python | nakazono0424/forecaster | /acf.py | UTF-8 | 1,172 | 2.859375 | 3 | [] | no_license | import datetime
from datetime import datetime as dt
import numpy as np
def datesToOcurreds(dates, rang):
length=int((rang[1]-rang[0]+datetime.timedelta(days=1)).days)
occurreds = np.zeros(length, dtype=int)
days_num=(rang[1]-rang[0]).days + 1
seq_dates=[rang[0]+datetime.timedelta(days=x) for x in ... | true |
1952c0dff9f75c7eaa7d90bb4deb1716e47a5bc6 | Python | masmangan/sturdy-octo-sniffle | /aula11/somador.py | ISO-8859-1 | 318 | 4.09375 | 4 | [
"MIT"
] | permissive | # Escreva um programa em Python que recebe valores inteiros informados via teclado. A digitao termina quando o usurio digitar
#99. Ao final da digitao, apresente a soma dos nmeros digitados
# Exemplo
# 10
# 10
# 99
# Soma=20
s = 0
while True :
n = int( input() )
if n == 99:
break
s = s + n
print(s) | true |
77aa93052d54bac297ac68fc84219c485e52db0c | Python | starrye/LeetCode | /Queue_/面试题13.机器人的运动范围 200408.py | UTF-8 | 2,858 | 4 | 4 | [] | no_license | #!/usr/local/bin/python3
# -*- coding:utf-8 -*-
"""
@author:
@file: 面试题13.机器人的运动范围 200408.py
@time: 2020/4/8 10:10
@desc:
"""
import collections
"""
地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] 。一个机器人从坐标 [0, 0] 的格子开始移动,
它每次可以向左、右、上、下移动一格(不能移动到方格外),也不能进入行坐标和列坐标的数位之和大于k的格子。
例如,当k为18时,机器人能够进入方格 [35, 37] ,因为3+5+3+7=18。但它不能进入方格 ... | true |
cd4b8c3cd24391fc0798dd66319e828ad17d4f59 | Python | james-learns-to-code/python-test-http_echo_server | /http_echo_server.py | UTF-8 | 580 | 2.890625 | 3 | [] | no_license | from http.server import BaseHTTPRequestHandler, HTTPServer
from io import BytesIO
class PostHandler(BaseHTTPRequestHandler):
def do_POST(self):
content_length = int(self.headers['Content-Length'])
body = self.rfile.read(content_length)
self.send_response(200)
self.end_headers()... | true |
83b1d44ee8ce6f740bfad218a4bfe9cd76dec31b | Python | kdglider/buoy_detection | /sandbox/opencvGMMTest.py | UTF-8 | 912 | 2.59375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | '''
Copyright (c) 2020 Hao Da (Kevin) Dong, Anshuman Singh
@file opencvGMMTest.py
@date 2020/04/02
@brief TBD
@license This project is released under the BSD-3-Clause license.
'''
import numpy as np
import cv2
image = cv2.imread('training_set/yellowTrainingSet.png')
height = image.shape[0]
width... | true |
c523f568bbaf499d9df07df18a282ded8acced0f | Python | MUSKANJASSAL/PythonTraining2019 | /Session21A.py | UTF-8 | 1,896 | 3.421875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup # External Library for Parsing HTML Data
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# url = "https://www.imdb.com/india/top-rated-indian-movies/"
url = "https://www.imdb.com/chart/top"
response = requests.get(url)
soup = BeautifulSoup(response.... | true |
e8edb6afb58ddd8222cd131266acaff8314ec619 | Python | amin-nikanjam/drlinter | /EndToEnd.py | UTF-8 | 1,794 | 2.625 | 3 | [] | no_license | import os
import sys
import DQN_Parser
import GrooveParser
import time
def main():
groovePath = "groove-5_7_4-bin/groove-5_7_4/bin/"
grammarName = "DRL-metamodel"
arguments = sys.argv
if len(arguments) != 3:
raise SystemExit('usage: endtoend.py [input filename] [output filename]')
else:
... | true |
83447e7ac3d3803de2f5383ee1c8b04f64684ce7 | Python | zyryc/Python-Scripts | /standard.py | UTF-8 | 267 | 3.390625 | 3 | [] | no_license | numbers = [1,2,3,4,5,1,4,5]
Sum = sum(numbers)
count = len(numbers)
avarage = Sum / count
squared = 0
for number in numbers:
first = number - avarage
squared = first*first
# print(number)
second = squared / count
final = second**(1/2.0)
print(final) | true |
83f9997545bedcd9f7d8ac3154d1d0b8684ca8a8 | Python | ohnchangmin/KB_study | /python/mldl/cv04.py | UTF-8 | 463 | 2.828125 | 3 | [] | no_license | import cv2
import matplotlib.pyplot as plt
mainimg=cv2.imread('main.jpg')
mainimg=cv2.resize(mainimg,(640,680))
print(mainimg.shape)
indoimg=cv2.imread('indo.jpg')
indoimg=cv2.resize(indoimg,(640,680))
print(indoimg.shape)
# cv2.imshow("indoimg",indoimg)
# cv2.waitKey(0)
result = cv2.add(mainimg, indoimg)
plt.imshow... | true |
8a3364eef5323c96f6bedb957373b16e396c50e1 | Python | L-ashwin/exploring-vision | /detection/tf-detection-api/scripts/utility.py | UTF-8 | 1,652 | 2.984375 | 3 | [] | no_license | import os
import glob
import pandas as pd
import xml.etree.ElementTree as ET
def get_object_csv_from_xmls(SOURCE):
"""
parse all xml files from given directory/list return dataframe with a row for each object instance.
xml structure
root:
filename
size
width
... | true |
3230fcbdb9586ab793d55ca76b63349b9eea4cdf | Python | khanfahad/plots | /quran_wordcloud.py | UTF-8 | 1,752 | 2.734375 | 3 | [] | no_license | from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
quran_words = open('quran.txt', 'r').read()
stopwords = set(STOPWORDS)
quran_wc = WordCloud(background_color = 'white', stopwords = stopwords)
stopwords.add('ye')
stopwords.add('lo')
stopwords.add('ha... | true |
ae4611f09d7563b59944d5a6cfdfb3e253c30a2a | Python | TheolZacharopoulos/algorithms-playground | /data_structures/heaps/cookies.py | UTF-8 | 2,652 | 3.84375 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/jesse-and-cookies
class MinHeap:
def __init__(self):
# start from element 1 (root)
self.array = [None]
def __str__(self):
return str(self.array)
def swap(self, index_a, index_b):
temp = self.array[index_a]
self.array[index_a... | true |
d666a1cba30041aa8bec0890e285c24fd742f767 | Python | CelesVI/hacker-ranks-scripts | /Hacker rank/hr ginortS.py | UTF-8 | 717 | 3.265625 | 3 | [] | no_license | import string
parseL, parseU, parseE ,parseO = [], [], [], []
lower=set(list(string.ascii_lowercase))
upper=set(list(string.ascii_uppercase))
even=set([str(i) for i in range(9) if i % 2 == 0])
odd=set([str(i) for i in range(10) if i % 2 == 1])
palabra = input()
for i in palabra:
if i in lower:
pars... | true |
9c77d9f013474e113f9d3d53a04db38d7c2312a2 | Python | PeteLowth/company-matching | /app.py | UTF-8 | 1,579 | 2.5625 | 3 | [] | no_license | from flask import Flask, request, render_template, url_for
import numpy as np
import pandas as pd
from model import prepare_data, match_companies_knn, build_model
app = Flask(__name__)
@app.route('/api/', methods=['POST'])
def makecalc():
test_companies = request.get_json()
df_prediction = match_companies_kn... | true |
7bf46d00d192b1692ca2169bc53cf2a3f96316e4 | Python | bimoe/tg_faka_bot | /getways/mugglepay/example.mugglepay.py | UTF-8 | 2,316 | 2.671875 | 3 | [] | no_license | import json
import sqlite3
import requests
# mugglepay密钥
TOKEN = ''
# 支付后返回地址
RETURN_URL = "https://kangle.bakbak.cn/paysuccess.html"
def submit(money, name, trade_id):
header = {
"token": TOKEN
}
data = {'merchant_order_id': trade_id, 'price_amount': money, 'price_currency': 'CNY', 'success_ur... | true |
12091214d69232a5ea8724026f55f97fc0b9971d | Python | zzf531/leetcode | /二叉树/236.二叉树的最近公共祖先.py | UTF-8 | 1,436 | 3.78125 | 4 | [] | no_license | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
# 用于存储LCA节点的变量。
self.ans = None
def lowestCommonAncestor(self, root, p, q):
def recurse_tree(current_node):
# 如... | true |
228737c71c5d121899b6a78789c8699de4c52026 | Python | stevieflow/standard | /tools/summary-table-schema.py | UTF-8 | 2,851 | 2.578125 | 3 | [] | no_license | import json
from collections import OrderedDict
import jsonref
import sys
table_schema = []
with open("../360-giving-schema.json") as schema_file:
data = jsonref.load(schema_file,object_pairs_hook=OrderedDict)
def get_field_info(field_def):
validation = ''
if 'string' in field_def['type']:
suffi... | true |
196fff69be6453c0cc3c6cfd85b689fad441add9 | Python | kmollee/2014_fall_cp | /6/other/findRoot3.py | UTF-8 | 1,329 | 4.0625 | 4 | [] | no_license | def findRoot3(x, power, epsilon):
'''
x and epsilon int or float, power an int
epsilon > 0 and power > 1
'''
if x < 0 and power % 2 == 0:
return None
low = min(-1, x)
high = max(1, x)
ans = (low + high) / 2.0
while abs(ans ** power - x) > epsilon:
if ans ** power ... | true |
7217b474751eee8bbda9912d62038857471e87d1 | Python | ViniciusQueiros16/Python | /projetosiniciantes/decida por mim.py | UTF-8 | 294 | 3.046875 | 3 | [
"MIT"
] | permissive | from random import choice
respostas = ['Sim!', 'Claro', 'Obvio que sim', 'Logico que sim', 'Concerteza',
'Não', 'de maneira alguma', 'acho que não', 'Infelizmente não', 'eu seila porra']
escolha = choice(respostas)
usuario = str(input('Faça alguma pergunta: '))
print(escolha)
| true |
2a5b7ef41f9186a2539254857b390faacb6efcd7 | Python | lixali/Recognizing-handwritten-digit-using-deep-neural-network | /src/main.py | UTF-8 | 1,640 | 2.859375 | 3 | [] | no_license | import time
import mnist_loader
import numpy as np
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
import csv
import numpy as np
import network
###########read test dataset###############
def read_csv(filename):
with open(filename, "r") as f_input:
return [np.asarray(tuple(ma... | true |
f9f7a5705dbad18b550923b751192aaaa9e2db1c | Python | xandrzoll/usfull_stuff | /sales_model_simcards/train_model.py | UTF-8 | 1,884 | 2.90625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import pickle
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import r2_score
from sklearn.metrics import mean_absolute_error # scikit-learn
fr... | true |
390901842581eee4b1429ef1ea6095b493d7adf1 | Python | naveenrc/new_york_citibikes | /download/transit_time.py | UTF-8 | 2,420 | 3.046875 | 3 | [] | no_license | # Compute transit times from one station to other using Google Distance Matrix API
import requests
import pandas as pd
import time
from multiprocessing import Pool, Lock
import sys
#API request and write to file
def calc_transit(lat_lon):
# parse destinations
destinations = ''
for i in lat_lon[1:]:
... | true |
9579c57775d2ceed0726d304842aa070859ca3ee | Python | qijintech/awesome-search | /blog.py | UTF-8 | 1,008 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# coding=utf-8
class Blog:
def __init__(self, id, title, link, author, date):
self.id = id
self.title = title
self.link = link
self.author = author
self.date = date
def setDoc(self, doc):
self.doc = doc
def getDoc(... | true |
ed39e9dae241f6dabb0281aee31a525692c88363 | Python | CraigKelly/datasimple | /bin/rpt-export.py | UTF-8 | 3,223 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import argparse
import os.path as path
import re
import sys
import csv
from datasimple.cli import log
from datasimple.core import panic
if sys.version_info[0] < 3:
raise ValueError('Python 3, please')
def _err(msg, *args):
if args:
msg = msg.format(*args)
raise ValueError... | true |
9819a37e0afdbf1659bf9d7fd6ba35f2f42ae6ea | Python | yuhuaLydia/-DocumentSimilarityProject | /Main.py | UTF-8 | 657 | 2.578125 | 3 | [] | no_license | from conn import *
from insertData import *
if __name__ == "__main__":
fileName = "Test.txt"
docID = 1
db = connSQL()
cursor = db.cursor()
cursor.execute("select * from wordsCalculator")
results = cursor.fetchall()
for row in results:
document_id = row[0]
word = row[1]
... | true |
629f0bd4bdca626eb112a1d1a9cce0d91cf89002 | Python | zhanghuicuc/channelChangeMonitor | /changeChannel.py | UTF-8 | 8,210 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
#coding:utf-8
###
# This script can change live channels automatically and calculate related stats
# Author:
# zhang hui <zhanghui9@le.com;zhanghuicuc@gmail.com>
# LeEco BSP Multimedia / Communication University of China
###Basic Design Idea is as follows:
'''
input device ip, change times and inte... | true |
999a09610cdd682575760af8821ec7c1520fb28e | Python | francistianlal/codability_challenge | /ArrayInversionCount.py | UTF-8 | 830 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 27 16:26:52 2020
use the bisect module
which quickly give the position of the new introduced number in a sorted array
@author: frank
"""
import unittest
N_range = range(0,int(1e5+1))
from bisect import bisect
def solution(A):
array = []
count =... | true |
977548b7a2a5694cdab7212bdca2ce4d7030f6fc | Python | infernalheaven/dc2019f-aoool-public | /remote-interaction/exploit.py | UTF-8 | 11,373 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from os.path import *
import re
import random
import string
import time
import sys
import traceback
import requests
import click
from pwn import *
context.arch = 'amd64'
context.log_level = 'error'
HOST = 'localhost'
PORT = 8080
DEBUG = 0
TIMEOUT = 3.0
# exec ./exploit.py --help for usage n... | true |
b65777654747be90ab1f4417fad4f9e8991642b6 | Python | shuryak/ege-inf | /efficient-algs-and-sort-and-freq-analysis/1.py | UTF-8 | 1,288 | 3.46875 | 3 | [] | no_license | N = int(input())
# smin_even = 60001 # Наихудший случай - все числа = 30 000
# smin_odd = 60001
smin = [60001, 60001]
# m_even = 60001
# m_odd = 60001
m = [60001, 60001]
for i in range(N):
x = int(input())
# if x % 2 == 0: # x - чётный
# # Сумма x (чёт) + m_even (чёт) будет чётной
# smin_even... | true |
53221bcd22368b3bd59a3a16d7021d9feb80f8ca | Python | sandaniel/Machine-Learning | /kMean-01.py | UTF-8 | 3,522 | 3.296875 | 3 | [] | no_license | '''
K-means is a clustering algorithm that tries to partition a set of points
into K sets (clusters) such that the points in each cluster tend to be near each other.
It is unsupervised because the points have no external classification.
'''
import numpy as np
import matplotlib.pyplot as plt
import scipy as s... | true |
a4dcf16619ea4a7fa0bcd864d91ffafc647607a4 | Python | alexandre146/avaliar | /media/codigos/2/2sol758.py | UTF-8 | 471 | 3.375 | 3 | [] | no_license | n1=int(input())
n2=int(input())
n3=int(input())
if n3>=n2 and n2>=n1:
print(n1)
print(n2)
print(n3)
elif n3>=n1 and n1>=n2:
print(n2)
print(n1)
print(n3)
elif n2>=n3 and n3>=n1:
print(n1)
print(n3)
print(n2)
elif n2>=n1 and n1>=n3:
print(n3)
print(n1)
... | true |
9aeea4efa1ef4ba66884ac65cf114de097dfab1e | Python | mave007/dns_completitude_and_compliance | /dns-comp.py | UTF-8 | 3,251 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
from deepdiff import DeepDiff # For Deep Difference of 2 objects
import yaml
import argparse
import shlex
import subprocess
import re
from pprint import pprint
# Function to compare 1 YAML output (expected_yaml) with a dict output (output_cmd) and ignore (excludelist) items
def compare_query_re... | true |
42ec874e4d6c960f7de2173e6e7b2ea02223a1f5 | Python | lauraromerosantos/Exercicio08_Algoritmos_Programacao_II | /Students.py | UTF-8 | 997 | 3.484375 | 3 | [] | no_license | class Student:
def __init__(self, code, name, subscription):
self.code = code
self.name = name
self.subscription = subscription
def printStudent(self):
print('Código: {} - Nome: {} - Matrícula: {}'.format(str(self.code), self.name, self.subscription))
############################
class HighSchool... | true |
3efcca408a19d65e2fc14b98a3f7f2896aa354bc | Python | chenzyhust/torch_classification | /utils.py | UTF-8 | 8,987 | 2.5625 | 3 | [] | no_license | """ helper function
author baiyu
"""
import os
import sys
import re
import datetime
import numpy as np
import random
import torch
import torch.nn.parallel
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from nncls.transformer import build_transformer
def get_tr... | true |
5ffde360700c599a5cd1eb2b0fef8ed8fbb536be | Python | EdAllenPoe/Python_Projects | /Python OOP/products1.py | UTF-8 | 1,502 | 3.1875 | 3 | [] | no_license | class Product():
def __init__(self,itemname,price,weight,brand):
self.status = "for sale"
self.price = price
self.itemname = itemname
self.weight = weight
self.brand = brand
self.cost = 0
self.status = "for sale"
self.tax=1.10
def sell(self,sell)... | true |
db4a5370d8df612d82c9180cc9a2620e64355249 | Python | cyjo9603/TIL | /quiz/programers/js/level1/수박.py | UTF-8 | 87 | 2.8125 | 3 | [] | no_license | def solution(n):
watermelon = '수박'
return watermelon * n // 2
solution(3) | true |
ca0badb9d0d7844a11fe25012d9ab975bf8c041a | Python | ganxby/voice-recognition | /test.py | UTF-8 | 2,905 | 2.625 | 3 | [] | no_license | from tinkoff_voicekit_client import ClientSTT
import re
import datetime
import random
import psycopg2
import os
API_KEY = ""
SECRET_KEY = ""
client = ClientSTT(API_KEY, SECRET_KEY)
audio_config = {
"encoding": "LINEAR16",
"sample_rate_hertz": 8000,
"num_channels": 1
}
while True:
try:
global... | true |
33fd1e3eea68be4eac85916b0cfb7529e9c3b16c | Python | jwalgran/python-omgeo | /omgeo/services/base.py | UTF-8 | 4,583 | 3 | 3 | [
"MIT"
] | permissive | import copy
from urllib import urlencode, urlopen
from json import loads
from xml.dom import minidom
class GeocodeService():
"""
A tuple of classes representing the geocoders that will be used
to find addresses for the given locations
"""
_preprocessors = []
"""
Preprocessor classes to appl... | true |
49e7fbd9a083f0951ae445c7b50f7cb158f3ccc1 | Python | RiptideBo/csslab | /methods/network.py | UTF-8 | 26,208 | 3.078125 | 3 | [
"MIT"
] | permissive | #-*- coding:utf-8 -*-
'''
目的:
用于对复杂网络相关的分析,创建网络,计算网络特征等
结合了networkx, igraph, pygrahistry的接口
方法:
* 从边数据生成网络 - get_graph_from_edgedata
* 从边数据获取节点 - get_nodes_from_edgedata
* 将有向边转化为无向边 - as_undirected_edgedata
* 合并两个网络 - merge_edgedata
* 计算网络的特征 - calculate_graph_features
* 计算节点的特征 - cal... | true |
6a658109f8affbdcd11fda3001449c6dea355aa1 | Python | AlfonsoVA/ProyectoRedes2 | /src/cliente.py | UTF-8 | 3,668 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Proyecto 2 - Redes de Computadoras.
Integrantes:
Karla Fernanda Jiménez Gutierrez.
Jonathan Suárez López.
Alfonso Vargas Alba.
CLIENTE.
'''
import socket
import pickle
import sys
## Número máximo de intentos.
intentos_max = 5
##Tiempo de espera de respuesta del ... | true |
ede21a8591c14155478cd301c44133f5067384c9 | Python | big-Bong/dataquest | /Python-Files and loops/crime_rates.py | UTF-8 | 637 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 20 11:39:48 2016
@author: toshiba
"""
#Challenge from data quest's Data science -> Python foundation -> Files and loops
crime_rates_file = open("crime_rates.csv")
crime_rates_data = crime_rates_file.read()
crime_rates_raw_list = crime_rates_data.split("\n")
crime_rates... | true |
7485620e3ffbc628c3d8d0ba4c4cad865844cb71 | Python | AustinTSchaffer/DailyProgrammer | /AdventOfCode/2020/day_04/solution.py | UTF-8 | 2,225 | 3.140625 | 3 | [
"MIT"
] | permissive | #%%
passport_data_plaintext = open("passport_data.txt").readlines()
passports = []
current_passport = {}
for batch_file_line in passport_data_plaintext:
batch_file_line = batch_file_line.strip()
if len(batch_file_line) == 0:
passports.append(current_passport)
current_passport = {}
else:
... | true |
9bdaf7178478b86d44b540f9ccfd9a2b664a5db4 | Python | ajia95/fakenewsdetection | /collection.py | UTF-8 | 2,725 | 2.546875 | 3 | [] | no_license | import csv
from nltk.corpus import stopwords
#from nltk.tokenize import word_tokenize
from nltk.tokenize import TweetTokenizer
import nltk
import os
nltk.download('stopwords')
nltk.download('punkt')
path = os.path.abspath("")
stop_words = set(stopwords.words('english'))
def getDocCount(bodiesFile):
with open(bo... | true |
d8619f1f95dd53bb2ff692b420441010b62a002e | Python | ZhaoYangbjtu/Natural_Language_Processing | /Author Identification/try.py | UTF-8 | 174 | 3.078125 | 3 | [] | no_license |
from nltk import ngrams
sentence = 'this is a foo bar sentences and i want to ngramize it'
bigrams = ngrams(sentence.split(), 2)
for grams in bigrams:
print grams
| true |
90e289787efc25c6095a84fb9179928eaa333e24 | Python | nauseri/automation_tutorial | /automation_tutorial/python_execution.py | UTF-8 | 1,134 | 3.046875 | 3 | [] | no_license | # https://automatetheboringstuff.com/appendixb/
# ::convenient ways to execute Python scripts::
# shebang line, tells computer to execute program
#
# On Windows, the shebang line is #! python3.
# On Linux, the shebang line is #! /usr/bin/python3.
#! python3.
# You will be able to run Python scripts from an... | true |
c18495377cd7f9f88bd00516b923d4333d71413c | Python | renhui19931001/1D_Gaussian_GAN | /1D Gaussian GAN.py | UTF-8 | 7,506 | 2.65625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
class DataDistribution(object):
"""docstring for DataDistribution"""
def __init__(self, mu, sigma):
self.mu = mu
self.sigma = sigma
self.range = range
def get_samples(self, N):
samples = np.random.norma... | true |
7ba11d95378ac23fa9438d92f6434a9c547596ad | Python | VBoB13/TeachAdmin-OLD | /teachadmin/graph.py | UTF-8 | 8,683 | 2.609375 | 3 | [] | no_license | from .models import *
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
import io
import urllib
import base64
ASSIGNMENT = Assignment()
EXAM = Exam()
LESSONTEST = LessonTest()
HOMEWORK = Homework()
SINGLE_SCORE_MODELS = (ASSIGNMENT, EXAM, LESSONTEST, HOMEWORK)
LESSON ... | true |
36028fdc0eee15873f4d9a2329f47a18f142fb8e | Python | okornoe/Hangman | /Topics/Set/Mystery set/main.py | UTF-8 | 139 | 2.78125 | 3 | [] | no_license | # mystery_set has been defined
string = input()
# delete string from mystery_set
if string in mystery_set:
mystery_set.discard(string) | true |
1527eb732be942cea9ba28e021e9351aad5d229c | Python | MehwishFatimah/pgn_modified | /model/reduce_state.py | UTF-8 | 1,954 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 6 10:40:29 2020
@author: fatimamh
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from model.model_helper import *
import model_config as config
'''-----------------------------------------... | true |
4e7a8762d6cb80f2256f5650ceacbd0bc7061bba | Python | slinksoft/PySlots | /slot.py | UTF-8 | 3,599 | 3.6875 | 4 | [] | no_license | import random
from os import system
from time import sleep
print('''Welcome to PySlots!
You'll start with $50.
Answer with yes/no. you can also use y/n. Case sensitivity does not apply.
To win you must get one of the following combinations:
BAR\tBAR\tBAR\t\tpays\t* 10 of stake
BELL\tBELL\tBELL/BAR\tpays\t * 5 o... | true |
a225bc4e615a138dad76915c52741f639e9c2311 | Python | dclabby/gridForecaster | /exploratoryDataAnalysis.py | UTF-8 | 1,556 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 19 15:30:05 2021
@author: dclabby
based on tutorial: Time Series Analysis using Pandas in Python
by Varshita Sher
available from: https://towardsdatascience.com/time-series-analysis-using-pandas-in-python-f726d87a97d8
"""
import matplotlib.pyplot a... | true |
31f0382314f272df6a285abf09ff20f56de16a58 | Python | gistable/gistable | /all-gists/11019717/snippet.py | UTF-8 | 8,252 | 3.40625 | 3 | [
"MIT"
] | permissive | #!/Users/Rad/anaconda/bin/python
# (c) 2013 Ryan Boehning
'''A Python implementation of the Smith-Waterman algorithm for local alignment
of nucleotide sequences.
'''
import argparse
import os
import re
import sys
import unittest
# These scores are taken from Wikipedia.
# en.wikipedia.org/wiki/Smith%E2%80%93Waterm... | true |
37c9786a0dd028d6af67f1b2afd7a66c8e7cb321 | Python | KimRaicho/smartClassAPI | /folder_preprocess.py | UTF-8 | 1,090 | 2.765625 | 3 | [] | no_license | import os
from PIL import Image
filepath = 'database'
for folder_name in os.listdir(filepath):
img_path = filepath + '/' + folder_name
i = 35 # attentive
j = 32 # not attentive
k = 30 # sleepy
for img in os.listdir(img_path):
if folder_name == 'attentive':
... | true |
06b740b33df32efc0475ec25710d84455c7473f0 | Python | sky-dream/LeetCodeProblemsStudy | /[0064][Medium][Minimum_Path_Sum]/Minimum_Path_Sum_2.py | UTF-8 | 1,684 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# leetcode time cost : 60 ms
# leetcode memory cost : 15.1 MB
# Time Complexity: O(m*n)
# Space Complexity: O(n)
# solution 2, 2 dimesion DP
class Solution:
#def minPathSum(self, grid: List[List[int]]) -> int:
def minPathSum(self, grid):
m,n = len(grid),len(grid[0])
... | true |
2162cb49b208ba9c8b0d912d8d024843b8b41fae | Python | soumitra9/BFS-2 | /employee_import.py | UTF-8 | 1,249 | 3.25 | 3 | [] | no_license | # Time Complexity : Add - O(N)
# Space Complexity :O(N), N is the no. of employees
# Did this code successfully run on Leetcode : Yes
# Any problem you faced while coding this : No
'''
1. I have used hashmap to maintain the adjacency list and then used BFS
'''
from collections import defaultdict, deque
class Solution:... | true |
5d426aebd3b658a203bbd606f0eccb15d0702667 | Python | tarek421995/all_project- | /udacity-catalog-app-master/database_setup.py | UTF-8 | 1,701 | 2.609375 | 3 | [] | no_license | # from sqlalchemy import Column, ForeignKey, Integer, String, UnicodeText
# from sqlalchemy.ext.declarative import declarative_base
# from sqlalchemy.orm import relationship
# from sqlalchemy import create_engine
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCH... | true |
c2f76933f90c164c99cd43f4d8abee8a912f8012 | Python | KaiJoseph04/gwc-2017 | /app.py | UTF-8 | 1,961 | 3.25 | 3 | [] | no_license | class User:
# Define the fields and methods for your object here.
def __init__(self, newUsername, newUserID):
self.username = newUsername
self.userID = newUserID
self.friends = []
def getUserName(self):
return self.username
def getUserID(self):
return self.userID
def getFriends(self):
r... | true |
a1e4318f7cde0c252a0fa298456e5b03be38317a | Python | macanepa/logistics-solver | /CODE/mcutils/json_manager.py | UTF-8 | 266 | 2.890625 | 3 | [
"MIT"
] | permissive | import json
def get_dict_from_json(path):
with open(path, "r") as json_file:
dictionary = json.load(json_file)
return dictionary
def generate_json(path, dictionary):
with open(path, "w") as json_file:
json.dump(dictionary, json_file)
| true |
882b3043c87c7770798d6b029b0ae8396d17c50b | Python | Python-Cameroun/PyToMe | /api/scraper/utils.py | UTF-8 | 379 | 2.625 | 3 | [] | no_license | """
Will contain some default utils function like one which will
just serialize scraped data into a .json file. It should be used as callback in the
run() method of the scraper engine
"""
import json
def json_callback_writer(stuff):
file_json = open('scrapper.json', 'w')
file_json.write(json.dumps(... | true |
2b7cffde103110e699ae81af74f7af2b0ac18051 | Python | oria66/course-intro2mobilerobotics-mooc | /lecture_00/ex2/ex2.py | UTF-8 | 290 | 2.921875 | 3 | [] | no_license | import myfirstscript
import numpy
import matplotlib.pyplot as plt
myListX=list(range(0, 360, 1))
myListY=[]
print(myListX)
for i in myListX:
myListY.append(myfirstscript.mathFunction(numpy.deg2rad(myListX[i])))
plt.plot(myListX, myListY)
plt.ylabel('Function')
plt.savefig('image.png') | true |
3ef4730c449cd6b84672f6a4efe20711bd1d7e58 | Python | olufemiigbekele/hacked2013 | /test/getLights.py | UTF-8 | 324 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
import json, httplib
def connect():
api = httplib.HTTPConnection('192.168.2.208', 80)
api.connect()
return api
def getLights(api):
api.request('GET', '/api/1234567890/lights', json.dumps({}))
return json.loads(api.getresponse().read())
api = connect()
lights = getLights(api)
print lig... | true |
8b6ade634220d9514c686cdf8201fecdcd1ac7fc | Python | kcolemanbd/Algorithms | /HanoiTowerSolver.py | UTF-8 | 1,054 | 3.578125 | 4 | [] | no_license | # HanoiTowerSolver-in-Python
# Artificial intelligence Solver for Hanoi Towers
from System import *
class HanoiSolver(object):
def computedTowers(count, source, dest, spare):
if count == 1:
Console.WriteLine("Move disk from pole {0} to pole {1}", source, dest)
else:
HanoiSolver.computedTowers(count - 1, s... | true |
5fd81354a759d619b8831b97546dbaeb6ba04270 | Python | PsLink/MyCodes | /1028.py | UTF-8 | 842 | 2.953125 | 3 | [] | no_license | n = input()
s = raw_input()
s = s.split()
flag = True
tList = []
for word in s:
if (word == 'if'):
tList.append("i")
if (word == 'then'):
if ((len(tList) > 0) and (tList[-1] == "i")):
tList.pop()
tList.append("t")
else:
flag = False
break
if (word == 'else'):
if ((len(tList) > 0) and (tLi... | true |
7e299f16e00a31454241d637dfaa67f08e711216 | Python | alex-brisnehan/djpro-django | /on_air/management/commands/rotateplaylist.py | UTF-8 | 4,197 | 2.671875 | 3 | [] | no_license | import django.db.transaction
class Command(django.core.management.base.NoArgsCommand):
help = '''Designed to be run as a cron job, this command does three things:
1. Increment the song's and artist play count for each played song in the playlist.
2. Moves the played songs from the current playlist to the hist... | true |
ec2f2c1dd8f5ca500fbfc1d409a91c1792a08bbe | Python | HarjeetSinghGoldy/problems | /leetcode/top100/Linklist/linklistbuilder.py | UTF-8 | 579 | 3.59375 | 4 | [] | no_license | class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class LinkList:
def __init__(self):
self.head = None
def insert(self,val):
newNode = ListNode(val)
if self.head:
current = self.head
while current.next:
... | true |
699c7b3ea5fdecd1bdc12e98b1bc664fcbc4f275 | Python | skinpanda/projecteuler-answers | /solutions/problem_2.py | UTF-8 | 545 | 4.6875 | 5 | [] | no_license | # Title: Even Fibonacci Numbers
# Generate a list of Fibonacci numbers less than <limit>
# Returns [1, 1, 2, 3, ...]
def fibonacci_sequence(limit):
fibonacci_list = []
a, b = 0, 1
while b < limit:
fibonacci_list.append(b)
a, b = b, a + b
return fibonacci_list
fibonacci = fibonacci_... | true |
f9a7e0aa16fd233b99ffb1f0d9e872d02965502a | Python | sicoyle/Research | /decorated_recursive_fib.py | UTF-8 | 384 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
from functools import wraps
#def cache(f):
# cache = { }
# @wraps(f)
# def wrap(*arg):
# if arg not in cache: cache[arg] = f(*arg)
# return cache[arg]
# return wrap
#@cache
def fibRec(n):
if n < 2:
return n
else:
return fibRec(n-1) + fibRec(n-2)
from datetime import datetime
tstart = date... | true |