blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
4ff8dba74ad2d96482dcdd5da29c5b7855136294 | sisyphusking/learn-tensorflow | /level_0/mnist_cnn_name_scope.py | UTF-8 | 5,921 | 2.765625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('../data/mnist', one_hot=True)
batch_size = 100
n_batch = mnist.train.num_examples//batch_size
def variable_summaries(var):
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
... | true |
9e25e548ee4bd693c2fdb9c7e738b9d214cc35c9 | eweilow/simulation-and-modeling | /tasks/task3/3_6.py | UTF-8 | 1,053 | 3.21875 | 3 | [
"MIT"
] | permissive |
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import random as rnd
import math
from gradient_plot import plotGradientLine
def runRandomWalk(steps):
X = []
Y = []
indices = []
x = 0
y = 0
for i in range(steps):
direction = math.floor(rnd.uniform(0, 4))
... | true |
3c13f8fec4ed6846468e71e2b2631aa2087e2625 | gm332211/workspace_p3x | /day7/执行命令版socket/socket客户端.py | UTF-8 | 583 | 2.671875 | 3 | [] | no_license | import socket
client=socket.socket()
client.connect(('localhost',8019))
while True:
cmd=input('>>:').strip()
if len(cmd)==0:continue
client.send(cmd.encode('utf-8'))
data_size=client.recv(1024)
client.send('准备就绪'.encode('utf-8'))
data_size=int(data_size.decode('utf-8')) #接收数据大小
recv_size=0... | true |
c38de42d4516b26f46adc0b80ab5af2d87390db7 | collincates/neverdropped | /scraper/clapi.py | UTF-8 | 8,135 | 2.53125 | 3 | [] | no_license | import logging
import re
import time
from bs4 import BeautifulSoup
import requests
from scraper.constants import RANDOM_SLEEP, URLS_CAN, URLS_UK, URLS_USA
from scraper.query import get_queries
logging.basicConfig(
filename='../scraper.log',
filemode='a',
format='%(asctime)s - %(module)s - %(levelname)s - ... | true |
5816311ecaa74ae6438155192e57d9c361788937 | jingruhou/python3Learning | /function/personFun_kw.py | UTF-8 | 222 | 3.0625 | 3 | [] | no_license | def person(name, age, **kw):
if 'city' in kw:
pass
if 'job' in kw:
pass
print('name', name, 'age', age, 'other', kw)
print(person('Jack', 24, city='Kunming', adr='Chenggong', zipcode=547688))
| true |
8e8521fec91a51e0666620c169bef125fc8ed369 | chinuteja/100days-of-Code | /New folder/Rounding.py | UTF-8 | 174 | 3.75 | 4 | [] | no_license | def Rounding(n):
a = (n//10)*10
b = a + 10
if n - a > b - n:
return b
else:
return a
def main():
print("enter a number")
n = int(input())
print(Rounding(n))
main() | true |
0f6220b7fba49d8b1b4fa2b6a0cc1b007343a586 | lagzda/Exercises | /PythonEx/palindrome.py | UTF-8 | 1,341 | 4.71875 | 5 | [] | no_license | """Have the function Palindrome(str) take the str
parameter being passed and return the string true if the parameter is a palindrome,
(the string is the same forward as it is backward) otherwise return the string
false. For example: "racecar" is also "racecar" backwards. Punctuation and numbers
will not... | true |
c401bda77616b60a188aa0aad16bb665256b1ab9 | shaheerkhan199/MyPythonPracticeWithLibraries | /Django/TextUtils/TextUtils/views.py | UTF-8 | 970 | 2.59375 | 3 | [] | no_license | from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return render(request, 'index.html')
def remove_punctuation(request):
text = request.GET.get('txt')
isCountChars = request.GET.get('countchars')
# print(text)
if isCountChars == 'on':
count = 0
... | true |
1c6c4044f85036d9b81550ab031283a070c3e205 | Damishok/PP2 | /TSIS1/9.py | UTF-8 | 573 | 3.5625 | 4 | [] | no_license | #1
fruits = ["apple", "banana", "cherry"]
print(fruits[1])
#2
fruits = ["apple", "banana", "cherry"]
fruits[0] = "kiwi"
#3
fruits = ["apple", "banana", "cherry"]
fruits.append("orange")
#4
fruits = ["apple", "banana", "cherry"]
fruits.insert(1,"lemon")
#5
fruits = ["apple", "banana", "cherry"]
fru... | true |
0986fc7dc9017338f9559658150ce643ca3c0708 | pablomlago/Matrix-Numerical-Analysis | /Practica4_jacobi/jacobi.py | UTF-8 | 1,630 | 3.171875 | 3 | [
"MIT"
] | permissive | import numpy as np
ITERATION_LIMIT = 100000
# initialize the matrix
A = np.array([[2., 1.],
[5., 7.]])
A = np.array([[5.00000000, 0.300000012, 0.400000006, 0.500000000, 0.600000024 , 0.699999988],
[0.300000012, 5.00000000, 0.500000000, 0.600000024, 0.699999988,... | true |
90a1f116a2c4e5938faefb434d3b5d0f704eb4e9 | qinjian623/plib | /python/wiki_project/uni/parsers.py | UTF-8 | 16,452 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@author: Jian QIN
@contact: qinjian@mapbar.com
@version: 0.0.1
1. 命名规范:所有名称都以XXParser命名,其中XX为infobox可以识别出的类型或者识别的目的,不再以Wiki开头。
2. 关系规范:所有Parser都继承统一的一个Parser
@TODO
'''
import json
import re
from lxml import etree
class Parser():
"""解析器父类,提供通用工具方法和唯一的解析接口"""
def... | true |
f504bbb74916751194c73420d47b4b74102b5772 | Albertpang7/UTS | /Server.py | UTF-8 | 408 | 3.0625 | 3 | [] | no_license | import socket
s = socket.socket ()
host = socket.gethostname ()
port = 8080
s.bind((host,port))
s.listen(1)
print(host)
print("Menunggu koneksi ... ")
conn, addr = s.accept()
print(addr, "Sudah terkoneksi ke server")
filename = input(str("Please enter the filename of the file : "))
file = open (filename,... | true |
34f070cc0999b08cc874db294d276bd469b8cfa8 | southworks/azure-ai-bonsai | /simulator/src/simulation_local_brain.py | UTF-8 | 4,177 | 2.90625 | 3 | [] | no_license | from typing import Any, Dict
import importlib
import requests
from simulator_session import SimulatorSession
from util import get_environment_variable
# Class to run simulations with a local Bonsai brain.
class SimulationLocalBrain():
def __init__(
self,
model_name: str,
render: bool = Fa... | true |
603e74b92c1908d19d7c0f8807d9ebd686896b05 | waltercoan/ALPC1ano2018 | /testefor.py | UTF-8 | 290 | 3.421875 | 3 | [] | no_license | #repete = True
#while repete:
# print("Repete...")
# resp = input("quer repetir? sim/nao")
# if resp == "sim":
# repete = True
# else:
# repete = False
print(list(range(10)))
for umnumero in range(10):
umnumero = umnumero + 2
print("REPETE...", umnumero) | true |
4fcbe3de3073a1bf427c0077cf1d0a25bf9bcf27 | iamzin/Study-Algorithm | /python/programmers/스택_큐/[42587_스택큐_프린터_2].천재승.py | UTF-8 | 364 | 2.8125 | 3 | [] | no_license | from collections import deque
def solution(priorities, location):
answer=0
deq=deque([(pri,i) for i,pri in enumerate(priorities)])
while deq:
item=deq.popleft()
if deq and max(deq)[0]>item[0]:
deq.append(item)
else:
answer+=1
if item[1]==locati... | true |
d8853c125d14496dd2dd72497f3fff22a8eaf223 | hexu1985/Learning.Processing | /code/chp04_variables/example_04_05_systemvars/example_04_05_systemvars.pyde | UTF-8 | 476 | 3.921875 | 4 | [] | no_license | # Learning Processing
# Daniel Shiffman
# http://www.learningprocessing.com
# Example 4-5: Using system variables
def setup():
size(480, 270)
def draw():
background(50)
stroke(255)
# frameCount is used to color a rectangle.
fill(frameCount / 2)
rectMode(CENTER)
# The rectangle will always ... | true |
4d0421ea9d0ffeac6f40d9b1a43e823da45f29cd | PingPingE/Python_Project | /basic/FlaskEx/flaskTest04.py | UTF-8 | 245 | 2.609375 | 3 | [] | no_license | from flask import Flask, url_for
app = Flask(__name__)
#url_for: 특정함수를 호출하는 URI찾기
@app.route('/')
def index():
return 'hi'
if __name__ == '__main__':
with app.test_request_context():
print(url_for('index')) | true |
e5b4175fdb371f66e488170def6c614cc1126037 | poqwerty1998/Database-Project | /database.py | UTF-8 | 5,618 | 3.765625 | 4 | [] | no_license | class Table():
'''A class to represent a SQuEaL table'''
def __init__(self):
'''(Table, list of str, list of str) -> NoneType
Creates a table. Values inside every table is stored in a dictionary,
which has the column as keys mapped to the values that are under that
column.
... | true |
60c9b3bface511cb13cc34d1ff4cb0937324823c | maddyxplore/instagrambot | /insta.py | UTF-8 | 4,868 | 2.546875 | 3 | [] | no_license | from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import time
import datetime
name = input("Enter your Username or Name: ")
password = input("Enter your Password: ")
date = datetime.datetime.now()
date = int(date.strftime("%H"))
if date >= 12 and date <=18 :
na ... | true |
cb22211a26ccc8be156c420d4d3918645797fbc8 | martin-bozon/runtrack-python | /jour03/job02/main.py | UTF-8 | 319 | 3.046875 | 3 | [] | no_license | import re
f = open("data.txt", "r")
lines = f.readlines()
f.close()
count = 0
for line in lines:
for mot in line.split(" "):
wordwhitoutpunctuation = re.sub(r'[^\w\s]', '', mot)
m = re.findall(r'(\S[a-zA-Z]*\S)', wordwhitoutpunctuation)
if m != None:
count += 1
print(count)
| true |
1464ba41f594dfd7654da386b579595e2b2818c1 | fnkap/shiny-happiness | /Nonogram/multiple_nonogram.py | UTF-8 | 9,825 | 3.40625 | 3 | [] | no_license | import re
import time
first_pattern = r"\*+" # Match a batch of consecutive asterisks
second_pattern = r"\*+ " # Match a batch of consecutive asterisks interrupted by a space
# num_columns = 5
# num_rows = 5
# columns = []
# rows = []
# col_parse = '''"5","2,2","1,1","2,2","5"'''
# row_parse = '''"5","2,2","1,1","2... | true |
89fb427b699ee7f8441a152eafcaa154e7d131df | Naysla/Machine_Learning | /15_Time Series Analysis in Python_/18_Compare the ACF for Several AR Time Series.py | UTF-8 | 1,164 | 3.875 | 4 | [] | no_license | #Compare the ACF for Several AR Time Series
#The autocorrelation function decays exponentially for an AR time series at a rate of the AR parameter. For example, if the AR parameter, ϕ=+0.9, the first-lag autocorrelation will be 0.9, the second-lag will be (0.9)2=0.81, the third-lag will be (0.9)3=0.729, etc. A smaller ... | true |
9bbf79efeb3db43ce34fb2945ee63e6d7dc4b11c | fgiovanucci/python_programming | /session3.py | UTF-8 | 387 | 3.40625 | 3 | [] | no_license | import math
print(math.pi)
import time
print(time.time())
#time gives you time in seconds
seconds = time.time()
print('seconds = ',seconds)
minutes = (seconds// 60)
print('minutes = ',(seconds// 60))
hours = (minutes / 60)
print('hours = ', (minutes // 60))
days = (hours /24)
print('days = ', (hours // 24))
year... | true |
ab7590453cefe99b6e0449d839fc28b8774b70f6 | Aasthaengg/IBMdataset | /Python_codes/p02730/s376040099.py | UTF-8 | 207 | 3.484375 | 3 | [] | no_license | def isKaibun(ss):
return ss==ss[::-1]
s = input()
ans=True
n=len(s)
if not isKaibun(s):
ans=False
if not isKaibun(s[:((n-1)//2)]):
ans=False
if ans:
print("Yes")
else:
print("No")
| true |
53c9c9401a5ecf22b49749b732a52af0345f879a | Thanmayee30/bi0s-tasks | /Week-1/nlists.py | UTF-8 | 503 | 2.921875 | 3 | [] | no_license | x=int(input())
inp_arr=[[input(),float(input())] for _ in range(0,x)]
inp_arr.sort(key=lambda k: (k[1],k[0]))
nameofstudents = [n[0] for n in inp_arr]
marksofstudents = [n[1] for n in inp_arr]
minvalueofmarks=min(marksofstudents)
while marksofstudents[0]==minvalueofmarks:
marksofstudents.remove(marksofstuden... | true |
2a37ef772bae4b8214695da881bf0579ed07feb9 | remvord/mir_py | /day1/mydatetime.py | UTF-8 | 499 | 3.046875 | 3 | [] | no_license | from datetime import date, time, datetime as dt
if __name__ == '__main__':
print(dt.today())
d = dt.today()
print(f'Date-{d.day} month-{d.month} year-{d.year}')
d1 = date.today()
d2 = d1.replace(1999, 12, 10)
print(d2.strftime('%Y/%m/%d'))
d4 = date(1980, 5, 10)
print(d4.strftime('%Y/%m... | true |
7468b3790276d0f31731a5c102740f0fad2419cb | AnSpake/EmailSender | /client_smtp.py | UTF-8 | 3,827 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# pylint: disable=missing-docstring
import os
import ssl
import smtplib
import mimetypes
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.audio import MIMEAudio
from email.mime.image import MIMEImage
from email.mime.multipart im... | true |
977801a0719a7b70f038579263a053a2b6396359 | wangtiancai/ActionRecognition | /hog+SVM/Detection.py | UTF-8 | 3,917 | 2.984375 | 3 | [] | no_license | import cv2
import imutils
import numpy as np
class Detector:
def __init__(self,stride = 8, padding = 36, scale = 1.1, min_width=400):
# self.subtractor = cv2.createBackgroundSubtractorMOG2(history=history)
# self.kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kernel_size, kernel_size))
... | true |
015e54b90022925db7b2a1ad80daab1940ba84a0 | melano-gaster/vigenere | /analyse.py | UTF-8 | 1,133 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
def monoanalyser(ss=int):
seq = ''
for i in range(subseqNo):
seq += (task[ss][i])
for j in range(subseqNo , len(task[ss])):
if seq in db[ss].keys() :
db[ss][seq] += 1
else:
db[ss][seq] = 1
seq += task[ss][j]
seq = seq[1:]
tag = [(i , db[ss][i]) for i in db[ss]... | true |
8a6e5d67ca0777c42b59c6e05bbbc2238b534176 | pelorenz/reading-processor | /object/textInstance.py | UTF-8 | 459 | 2.625 | 3 | [] | no_license | import sys, os
class TextInstance(object):
def __init__(self, tok_idx, v_num, a_idx, ms, t_val):
# address index
self.addr_idx = a_idx
# reference to manuscript of cited text
self.manuscript = ms
# cited text of specified MS at address
self.content = t_val
... | true |
c50a19c34f0c236258b08bc6e950e7cb33fb7cb1 | Lwangmengyuan/MeetingManagement | /pages/home_page.py | UTF-8 | 1,528 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author : 杨佳
# @Time : 2020/11/17 19:52
# @File : home_page.py
from common.base_page import BasePage
class HomePage(BasePage):
# 定位首页元素
home_locator = ('xpath', '//*[@id="app"]/section/section/aside/div/ul/div/li[1]/span')
# 定位会议预约元素
metting_order_locator = ('xpath', '//*[@id=... | true |
b20cc7b4468edbcb74586ef8b103d738f3f1d767 | candlewill/TensorFlow_learn | /5_linnear_regression.py | UTF-8 | 683 | 2.859375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
# create data
x_data = np.random.rand(10).astype(np.float32)
y_data = x_data * 0.1 + 0.3
# create tensorflow structure start
Weights = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
biases = tf.Variable(tf.zeros([1]))
y = Weights * x_data + biases
loss = tf.reduce_mean(tf.s... | true |
9bd452c214efba5810647a66439d17a65a211877 | gmladk04/python_challenge | /브루트포스/1436_bm.py | UTF-8 | 233 | 3.203125 | 3 | [] | no_license | import sys
n = int(sys.stdin.readline())
count=1
i = 666
while count < n :
i += 1
st = str(i)
c = 0
for s in st:
c = c+1 if s == '6' else 0
if c==3:
count +=1
break
print(i) | true |
67aac9e9f7cf42d05c72ae468574201264411b04 | radomirbrkovic/algorithms | /hackerrank/other/picking-numbers.py | UTF-8 | 630 | 3.390625 | 3 | [] | no_license | # Picking Numbers https://www.hackerrank.com/challenges/picking-numbers/problem
from collections import defaultdict
def pickingNumbers(arr):
d = defaultdict(int)
r_val = 0
for val in arr:
d[val] += 1
r_val = max(r_val, d[val]+d[val+1], d[val]+d[val-1])
return r_val
... | true |
b01a709ab6b206bb9bcadf1b3f679406e38be97e | fujunguo/learning_python | /old_boy_exercises/week5/module_xml/xml_test.py | UTF-8 | 319 | 3.109375 | 3 | [] | no_license | import xml.etree.ElementTree as ET
tree = ET.parse('xmltest.xml')
root = tree.getroot()
print(root)
print(root.tag)
# 遍历xml文档
for child in root:
print(child.tag, child.attrib)
for i in child:
print(i.tag, i.attrib, i.text)
# 寻找单个标签
for i in root.iter('author'):
print(i.text)
| true |
6b285373af2a1fc4a8173a2ea6530d9199168b21 | hansarandjelovac/bottle-counter | /main.py | UTF-8 | 1,988 | 3.078125 | 3 | [] | no_license | import time
import mysql.connector
import functools
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO_TRIGGER = 18
GPIO_ECHO = 24
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="ubiquiti",
... | true |
bad988ad65d2feb0a80a898a7c2fc97e6966de91 | MohiniMohiniMohini/headFirstPython | /chptr3_dict_tups_sets/vowels4.py | UTF-8 | 434 | 4 | 4 | [] | no_license | vowels = ['a', 'e', 'i', 'o', 'u']
word = input("Provide a word to search for vowels: ")
found = {}
#initialize found dict.
#for letter in vowels:
# found[letter] = 0
for letter in word:
if letter in vowels:
found.setdefault(letter, 0)
found[letter] += 1
for k, v in sorted(found.items()):
... | true |
9c06d407a97e991ab03c6d2646a6a37ae61b26e6 | kipland-m/PythonPathway | /ReverseString.py | UTF-8 | 429 | 4.0625 | 4 | [] | no_license | # This program is a part of my program series that I will be using to nail Python as a whole.
# The purpose of ReverseString.py is to take a user's input and output their string reversed.
def Main(data):
data = data[::-1]
print("Your reversed string: "+data)
def UserInput():
print("Please input the stri... | true |
6d1e12f8bc6cbd0545344862e09273136593103e | ddvega/rclone_sync | /cloud_manager.py | UTF-8 | 6,521 | 2.953125 | 3 | [] | no_license | import os
from decouple import config
from utils import *
class CloudManager():
def __init__(self, cloud_remote) -> None:
self.cloud_remote = cloud_remote
self.local_path = self.set_local_path()
self.create_main_folder()
self.local_dirs = {}
self.cloud_dirs = {}
sel... | true |
32d66635c6cc008a010f1b5baaa49ad8f63a4d2f | petersontylerd/prettierplot | /examples/bar_v.py | UTF-8 | 601 | 2.53125 | 3 | [
"MIT"
] | permissive | from prettierplot.plotter import PrettierPlot
from prettierplot import data
import numpy as np
df = data.attrition()
# capture unique EmployeeField values and frequency counts
unique_vals, unique_counts = np.unique(
df[df["EducationField"].notnull()]["EducationField"], return_counts=True)
# create plotting instance
... | true |
a5fc3db719b2a259dd39ee15bfd04b2779e80555 | dom-inic/data-strucures-and-algos | /quick_sort.py | UTF-8 | 706 | 4.0625 | 4 | [] | no_license | import random
def quick_sort(list):
"""
creates a pivot by taking the first element on the list
using the pivot it combares if there are element lesser or greater than the pivot
the process continues recursively until there is a sorted list
"""
# check if list is equal to 1
if len(li... | true |
646599ad72d6195e5e4acf08fe1f5f792005bb16 | CHENXI-s1874351/Leetcode_excecise | /reverse_string_two.py | UTF-8 | 563 | 2.953125 | 3 | [] | no_license | class Solution:
def reverseStr(self, s: str, k: int) -> str:
quotient = len(s) // (2 * k)
reminder = len(s) % (2 * k)
i = 0
new_s = ''
while i < quotient:
new_s += s[i*2*k: (i+1)*2*k-k][::-1]
new_s += s[(i+1)*2*k... | true |
064c46fd8484abdc63251018787b9d523b2a7c06 | cn1289/keras-chinese-resume-parser-and-analyzer | /keras_cn_parser_and_analyzer/library/utility/parser_rules.py | UTF-8 | 3,077 | 3 | 3 | [
"MIT"
] | permissive | import re
def extract_email(s, line):
email = None
match = re.search(r'[\w\.-]+@[\w\.-]+', line)
if match is not None:
email = match.group(0)
return email
def extract_sex(s, line):
parts = line.split(' ')
sex_found = False
sex = None
for w in parts:
if '性别' in w:
... | true |
be2f54921c54ab8b97870bc666fe0e99c900cdd0 | jm-begon/masterthesis | /code/util/subwindows.py | UTF-8 | 1,199 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 13 11:23:38 2014
@author: Jm
"""
import numpy as np
def totalSW(w, h):
h2 = h**2
w2 = w**2
return (1./4) * (h2*w2 + h2*w + h*w2 + h*w)
def nbSW1D(S, m, M=None):
"""
S :
The size
m :
the minimum size
M :
the maximum si... | true |
a4a980d2dbacc049fabc65d1831d7748c692c926 | bengwall3/ProjectEuler | /Python/099.py | UTF-8 | 803 | 3.90625 | 4 | [] | no_license | #Comparing two numbers written in index form like 211 and 37 is not difficult,
#as any calculator would confirm that 2^11 = 2048 < 3^7 = 2187.
#However, confirming that 632382^518061 > 519432^525806 would be much more difficult,
#as both numbers contain over three million digits.
#Using base_exp.txt (right click and ... | true |
27cd726e81e2400a4206e460d5d04b68367981a5 | giordafrancis/adventofcode2019 | /day10_station.py | UTF-8 | 5,227 | 3.140625 | 3 | [] | no_license | """
https://adventofcode.com/2019/day/10
"""
from typing import List, NamedTuple, Iterator, Tuple, Dict
from collections import defaultdict
import math
class Asteroid(NamedTuple):
x: int
y: int
Asteroids = List[Asteroid]
def parse_raw(inputs:str)->Iterator[str]:
for row in inputs.strip().split("\n"):
... | true |
4d32ef2cf6d328d6a557d8e87ea249580386fe17 | Gadangadang/Cosmology | /Project1/CodeBase/proj1_8.py | UTF-8 | 1,253 | 3.015625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def U(x, om, ow, w):
return -(om/x + ow*x**(-(1+3*w)))
def E(x, om, ow):
return 1 - om - ow + x - x
x = np.linspace(0,3,3001)
a0index = int(np.where( np.abs(x - 1.) < 1e-5 )[0])
omega_m = 0
omega_w = 0.377
w = -1.5
omega_m2 = 0.24
omega_w2 = 0.65
w2 = -1.... | true |
cc9ad51a0c3664dfd9190164fa646571ecd44e43 | SG-325/Homework_Course_Python_2 | /h_1/f_1.py | UTF-8 | 446 | 3.5625 | 4 | [] | no_license | def func(dic:dict)->list:
'''
Description:
The function returns a list of all letter combinations.
Parameters:
dic (dict):The given dictionary.
Returns:
l (list):List of all combinations.
'''
l = []
for k_1 in dic.values():
for k_2 in dic.values():
if k_1 != k_2:
... | true |
5516d378a197f12727f33e492bcab49e4ace205e | cmkatarn/Mastermind | /Mastermind.py | UTF-8 | 1,446 | 3.59375 | 4 | [] | no_license | from array import array
import random
sequence = array('c', [' ', ' ', ' ', ' '])
turnsTaken = 1
combinationNotYetFound = True
def generate_random_number():
return random.randint(0, 4)
def get_letter_from_number(number):
switcher = {
0: 'R',
1: 'G',
2: 'B',
3: 'Y'
}
... | true |
6edfe04efc49ee2489996e6ca2738e8591e9f4a8 | kieumy2870/Breast_Cancer_Classification | /Code/Inception ResNet v2/2_class_classification/evalModel.py | UTF-8 | 4,480 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from helpers.dataloader import *
import pickle
import os
import time
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torch.utils.data import Dataset, DataLoader
import iter... | true |
68205457337383ab860c050eda6097315b2a73d5 | Andrei-Raev/another_project_name | /project/sample_classes/inventory.py | UTF-8 | 12,385 | 2.765625 | 3 | [] | no_license | # ---------- IMPORTS ----------
# Импорт системных библиотек
import sys
import math
import time
import importlib.util
# Импорт сторонних библиотек
# from threading import Thread
from copy import copy
from PIL import Image, ImageFilter
from pygame.threads import Thread
from screeninfo import get_monitors
import pygam... | true |
0c2a7d0929f2b44798b541f930d3e68eb692dcb0 | albin3/aliyun-odps-python-sdk | /odps/lib/tests/test_ext_types.py | UTF-8 | 4,988 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | true |
c145aca6839cda32972e91b8a11408fd3fd82855 | hejt25/aitool | /aitool/basic_function/exe_time.py | UTF-8 | 1,041 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: UTF-8 -*-
# @Time : 2021/3/10
# @Author : xiangyuejia@qq.com
# Apache License
# Copyright©2020-2021 xiangyuejia@qq.com All Rights Reserved
import time
def exe_time(print_time=False, detail=False):
def wrapper(func):
def decorate(*args, **kw):
t0 = time.time()
if d... | true |
eb6dcf996e775e6135ef14ed4827bf257dc32990 | Yerin99/1day1commit | /kakao_2017_secret_map.py | UTF-8 | 638 | 3.5 | 4 | [] | no_license | # 2017 카카오 1차 코딩 테스트
# 1번 문제 - 비밀 지도
# 난이도 : 하
n = int(input())
arr1, arr2 = eval(input()), eval(input())
result1, result2 = [], []
for i in range(n):
binar2 = bin(eval(bin(arr1[i])) | eval(bin(arr2[i])))
print(binar2)
result1.append(binar2)
for i in range(n):
string = ""
for index, x in enumera... | true |
c9da74f1578f7b324d1073c29636d4d67b6443d2 | gabriel-barreto/uri | /begginer/2582.py | UTF-8 | 637 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python3
#-*- coding: utf-8 -*-
# Define static values
songs = {
0: "PROXYCITY",
1: "P.Y.N.G.",
2: "DNSUEY!",
3: "SERVERS",
4: "HOST!",
5: "CRIPTONIZE",
6: "OFFLINE DAY",
7: "SALT",
8: "ANSWER!",
9: "RAR?",
10: "WIFI ANTENNAS"
}
# Getting user input
n = int(input(... | true |
dfb7bf1c524c7f0151f84273fe30190638a7cda4 | skonienczwy/LearningPython | /ex0041.py | UTF-8 | 574 | 4.3125 | 4 | [] | no_license | print('##Exercicio 41##')
num = []
n = int(input('Insira um valor: '))
num.append(n)
while True:
x = str(input('Deseja continuar inserindo valores? '))
if x in 'Ss':
n = int(input('Insira um valor: '))
num.append(n)
print(num)
else:
break
media = sum(num)/... | true |
0cf29ade1cdaa0ec00db310f7d510186941179e4 | nivertech/xmpp_course | /xmpp_samples/py/echobot.py | UTF-8 | 1,184 | 2.515625 | 3 | [] | no_license | #! /usr/bin/python
# XMPP echo bot
# REQUIRED:
# sudo pip install sleekxmpp
import sleekxmpp
import traceback # for debug purposes
JID = "echobot@xmpp.nivertech.com/EchoBot"
PWD = "mypass"
class EchoBot:
def __init__(self, jid, password):
self.xmpp = sleekxmpp.ClientXMPP(jid, password)
self.... | true |
451a204e4a2c13a2b91d0d5e356af15a785f3fd8 | JinSungYoon/sports_analysis_graduate_work | /Python_study/linear algebra.py | UTF-8 | 10,130 | 3.71875 | 4 | [
"MIT"
] | permissive | # 스칼라(scalar) : 숫자 하나로 이루어진 데이터
# 벡터(vector) : 여러 개의 숫자로 이루어진 데이터 레코드
# 행렬(matrix) : 데이터 레코드가 여러 개 잇는 데이터 집합
import numpy as np
import math
x1 = np.array([[5.1],[3.5],[1.4],[0.2]])
x2 = np.array([[4.9],[3.0],[1.4],[0.2]])
A = np.array([[5.1,3.5,1.4,0.2],[4.9,3.0,1.4,0.2]])
# 영벡터
zero = np.zeros(10)
# 일벡터
one = np.... | true |
9343278e0dc7b43c90ab2c8c9e19da1c6776fc95 | faisal-almayouf/machine-learning-1 | /final project/poi_id.py | UTF-8 | 8,012 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python
import sys
import pickle
sys.path.append("../tools/")
import scipy
import pandas
import numpy
import tester
import matplotlib
from matplotlib import pyplot
from sklearn.feature_selection import SelectKBest
from feature_format import featureFormat, targetFeatureSplit
from tester import du... | true |
2728de8a151d95324138ce2ef56a18e39c8a61ba | adriansarstedt/deep_dolphin | /deep_dolphin/nii/nii_directory_parser.py | UTF-8 | 661 | 2.609375 | 3 | [] | no_license | import os
import errno
from deep_dolphin.nii.helpers import is_nii_file
class NiiDirectoryParser(object):
def __init__(self, directory_path):
if os.path.exists(directory_path):
self.directory = directory_path
else:
raise FileNotFoundError(
errno.ENOENT, os.... | true |
c64e953023c0cd2ac8855a916e245290c1c946c9 | TianPeilong/learn-book | /leetcode/algorithms/33.py | UTF-8 | 1,519 | 3.328125 | 3 | [] | no_license | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
if nums[0] > nums[-1]:
return self.searchIn(nums, target, 0, len(nums) - 1)
else:
... | true |
4d3e6a604ff0e946701c5bc2fa30447fb896549d | chi-yan/leetcode | /first-missing-positive/first-missing-positive.py | UTF-8 | 583 | 2.765625 | 3 | [] | no_license | class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
i = 0
if nums == []:
return 1
li = [0 for _ in nums]
for i in range(len(nums)):
j = nums[i]
if j-1 < len(li) and... | true |
f245f6f8d42cfc3898132574789e932c2513665d | gledford/TwitterQueries | /statusparser.py | UTF-8 | 1,777 | 2.78125 | 3 | [] | no_license | import tweepy
from tweepy import OAuthHandler
import time
import json
import re
import sys
from accesstokens import AccessTokens
token_accessor = AccessTokens()
auth = OAuthHandler(token_accessor.get_consumer_key(), token_accessor.get_consumer_secret())
auth.set_access_token(token_accessor.get_access_token(), token_ac... | true |
ca0f4f404fe6986f68cc3ae96646c09b00ec7944 | rleguizamon01/maraton-pygame | /Amenaza.py | UTF-8 | 5,511 | 3.3125 | 3 | [] | no_license | import pygame
# Enemigo
class Amenaza(object):
def __init__(self, xamenaza, yamenaza):
# Solicita la posicion inicial de la amenaza mediante xamenaza e yamenaza
self.xamenaza = xamenaza
self.yamenaza = yamenaza
# Las amenazas comienzan con 3 corazones
self.coraz... | true |
d7fc22efddd6cd79f13f1a91c05cbe3354ca50cf | lucaderi/sgr | /2011-2020/2019/Fabrizi/AppDetection.py | UTF-8 | 1,026 | 2.5625 | 3 | [] | no_license | import argparse
from manager import *
def main():
# instanzio un oggetto parser
parser = init_parser()
# effettuo il parsing degli argomenti
args = parser.parse_args()
# instanzio un oggetto manager per la gestione dei vari thread
manager = Manager(
interface=args.interface,
ip_app_f... | true |
3d3cdbb2738b096b53d48f3cceca6b0dd39a74f5 | Pop0097/Object_Following_Cart | /configuration/draw_box_simple.py | UTF-8 | 1,930 | 3.515625 | 4 | [] | no_license | # NOTE: to make this file run, move it to the root directory. For some reason it doesn't work when it's in this directory.
"""
This file is just made to get an idea of how to get the coordinates of the ball and draw a rectangle on the image.
"""
import cv2
import numpy as np
image_path = 'image/ball.jpg'
image = cv2... | true |
7d57019ce5bbda4acc791fae68be39f56a9eb986 | rbtprograms/python_learning | /other/usefuloperators.py | UTF-8 | 2,079 | 4.375 | 4 | [] | no_license | mylist = [1,2,3]
#range is useful to get standard items
#prints all 10
for num in range(10):
print(num)
#prints 3-10
#start value, end value
for num in range(3, 10):
print(num)
#step by 2
for num in range(0, 10, 2):
print(num)
#how to build a list out of it
list(range(0, 11, 2))
#enumerate function
#having an... | true |
7bba0da10e8e070ba75801b796b545d019ba174f | andreyklimkin/DDPG-Radial-for-MORL | /LQR/TerminateChecker.py | UTF-8 | 1,604 | 2.96875 | 3 | [] | no_license | eps = 1e-2
class TerminateChecker():
def __init__(self, start_value, alpha, window_size, no_profit_max_times):
self.ema = start_value
self.alpha = alpha
self.last_n_values = [start_value]
self.n = window_size
self.ma = start_value / self.n
self... | true |
87b59c297eb41842869de4962fa50d5696f0aeeb | ana-mariatambur/23.09.20 | /pr.3.py | UTF-8 | 46 | 3.359375 | 3 | [] | no_license | a=10
print(a*4)
print(6*(a**2))
print(a**3) | true |
cf0f0c801186268aad625653653dc4329561af7e | KB-perByte/CodePedia | /Gen2_0_PP/Contest/q4.py | UTF-8 | 2,379 | 3.921875 | 4 | [] | no_license | ''' Question 4 - contest 3
Debrup lives in Infiniteland.In Infiniteland time never moves in periodic fashion. Debrup is a very competitive person. Now, one day he goes to a horse race and wants to bid for the winning horse. There are N horses competing in the race. Now because Debrup wants to win the race, he bribes hi... | true |
6975460d31e727fbd8dd3a7d3f697be05cc7c3e1 | ChenZhongPu/leetcode | /algorithm/4Sum/Solution3.py | UTF-8 | 1,333 | 3.375 | 3 | [] | no_license | class Solution(object):
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
nums.sort()
result = []
for i in range(len(nums) - 3):
if i > 0 and nums[i-1]==nums[i]:
continu... | true |
1f7630714267f0fbb329410c1d693a2d2b551e96 | albutko/pybell | /pybell.py | UTF-8 | 2,251 | 3.03125 | 3 | [] | no_license | #! user/bin/env python
"""Main file used to run facial recognition and detection
Usage: python pybell.py
"""
import cv2
from components.camera import CameraStream
from components.face_detector import FaceDetector
from components.face_recognizer import FaceRecognizer
from components.util.eigenfaces import load_faces... | true |
33a7f466394f76937fd0f84cdf3b9dff2bb0a19a | 12wb/OpenCV | /U4/test 双边滤波.py | UTF-8 | 841 | 2.515625 | 3 | [] | no_license | import numpy as np
import cv2 as cv
def nothing(x):
pass
img = cv.imread('./IMG/img8.jpg')
cv.namedWindow('windows',0)
cv.createTrackbar('d','windows',0,100,nothing)
cv.createTrackbar('sigmaColor','windows',0,200,nothing)
cv.createTrackbar('sigmaSpace','windows',0,200,nothing)
font = cv.FONT_HERSHEY_SI... | true |
83280ac8bdaca19e38fedf3bd18bc36e7b9383ef | xiabofei/python_details | /withas.py | UTF-8 | 472 | 3.78125 | 4 | [] | no_license | #encoding=utf8
"""
测试with as在python中的用法 可以选择性的处理异常
"""
import sys
class test:
def __enter__(self):
print("enter")
return 1
def __exit__(self, type, value, traceback):
print("exit")
return isinstance(value, NameError)
with test() as t:
print("t is not the result of test()")
... | true |
cb744d414871d634900dfec0a27b89b575571a1a | eldenseropian/knitting-pattern-parser | /classes/in_row_repeat.py | UTF-8 | 1,871 | 3.25 | 3 | [] | no_license | from pattern import is_valid_row_component
from pattern import is_equal_pairwise
class InRowRepeat:
"""Represents a series of stitches that are repeated within a single row."""
def __init__(self, components, until=None):
"""Create a new InRowRepeat.
Keyword Arguments:
components -- a ... | true |
f30e3b7926d70e04b8434865dcadd9350472a824 | pedro-lourenco/Desafio-Carrefour | /Markowitz.py | UTF-8 | 2,084 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
from pandas_datareader import data as wb
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# In[29]:
tickers = ['CRFB3.SA', 'ABEV3.SA']
pf_data = pd.DataFrame()
for t in tickers:
pf_data... | true |
f89845cce9fbdf99630aa18e23509c07592a978b | EeEmEyeEl/test | /main.py | UTF-8 | 3,013 | 2.84375 | 3 | [
"MIT"
] | permissive | import subprocess
import os
import argparse
from datetime import date, timedelta
from itertools import zip_longest
WEEK_LENGTH = 7
TODAY = date.today()
PARSED_INPUT = []
COMMIT_FILE_NAME = "art"
def get_program_arguments():
parser = argparse.ArgumentParser(description='sampleText')
parser.add_argument('-inp... | true |
be9d28466732d579184af3dbced6366e38b82f88 | fgeller/euler | /problem_033/solution.py | UTF-8 | 628 | 3.484375 | 3 | [] | no_license | import time
from fractions import Fraction as F
def istrivial(numer, denom):
if denom % 10 == 0 or denom / 10 != numer % 10: return False
return float(numer / 10) / (denom % 10) == float(numer) / denom
def run():
fracs = []
for numer in range(11, 100):
for denom in range(numer + 1, 100):
... | true |
85f3ff374c42246cdcd0e6cbc76235765659b89a | henrytxz/ctci6 | /Chapter16/calculator_16_26.py | UTF-8 | 2,329 | 4.21875 | 4 | [] | no_license | """
16.26 Calculator
Given an arithmetic equation, +ve ints, +,-,* and /
for eg,
input: "2*3+5/6*3+15"
output: 23.5
thoughts:
perhaps take in the str, break it by the operators
break by + and - 1st?
2*3, 5/6*3, 15
"""
import re
def calculate(expr):
sub_expressions = re.split('[+-]', expr)
sub_expr_values = [... | true |
fae8eb251ba6aa84d1ba1f21676894427b23bf7f | keosariel/keyword-analysis | /keyword_analyzer.py | UTF-8 | 6,402 | 2.9375 | 3 | [] | no_license | import nltk
from nltk.corpus import stopwords
from string import punctuation
import json
import logging
import os
import pickle
from gensim.utils import simple_preprocess
# Tokenize the documents.
from nltk.tokenize import RegexpTokenizer
from nltk.stem.wordnet import WordNetLemmatizer
# Compute bigrams.
from gensim.... | true |
bae4fc9d278c46e6bf0ce025e7d4918169936326 | fpfaende/data-science-1 | /7-aqicn/basic-request.py | UTF-8 | 665 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
r = requests.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22shanghai%22)%20%20%20and%20u%3D'c'&format=json&env=store%3A%2F%2Fdatatables... | true |
e24f5780e5876dfa6252ae5749b2892b0807ee03 | tiduswr/Algoritimos_P1_UEPB_CCEA_CAMPUS_VII | /Lista 06/lista06ex06.py | UTF-8 | 632 | 3.9375 | 4 | [] | no_license | ordem = 0
matriz = []
soma = 0
print('=' * 50)
print('{:^50}'.format('Calculo dos Numeros abaixo da Diagonal Principal! '))
print('=' * 50)
ordem = int(input('Insira a Ordem da Matriz: '))
for i in range(ordem):
matriz.append([0] * ordem)
for i in range(ordem):
for j in range(ordem):
matriz[i][j] = ... | true |
6053cdac20035f2286eddcbddeeb8ce9ae23c2d4 | jakethedev/statblock5e | /tools/inline-imports.py | UTF-8 | 4,425 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import argparse
import os.path as p
import re
from bs4 import BeautifulSoup
DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
def getDocument( content ):
return BeautifulSoup( content, 'html5lib', from_encoding = 'utf-8' )
def generateInlineFile( source_file_path ):
final_doc = getDo... | true |
4422039fa182e611a3e1fd533e1421b270d85f62 | hideo54/myssh | /myssh.py | UTF-8 | 1,362 | 2.921875 | 3 | [
"MIT"
] | permissive | import os
import sys
import subprocess
import json
dirname = os.path.dirname(__file__)
usage = '''---
myssh 1.0
Usage: python main.py connect <name>
** name must be defined in {dirname}/hosts.json. **'''.format(dirname=dirname)
f = open(dirname + '/hosts.json', 'r')
jsonData = json.load(f)
f.close()
def main():
... | true |
18f69459a086e4e42373d535e48ae937d5fa135e | Helumpago/SimplePhysics | /region.py | UTF-8 | 3,964 | 3.609375 | 4 | [] | no_license |
from .base_obj import BaseObj
from .value import Number, Ratio, Vector2d
"""
" Base class for all regions
"""
class Region(BaseObj):
"""
" CONSTRUCTOR
" @param BaseObj parent: Object to which the new object should be parented.
" Expected to be either a BaseObj, subclass of BaseObj, or None
" @param string Name... | true |
cb423677612d13df5a6fe0b4b4f4b3ba9533a27d | gurolsaglam/Voice-Commanded-Chess | /errors.py | UTF-8 | 777 | 2.984375 | 3 | [] | no_license | class IllegalMovement(Exception):
def __init__(self):
pass
def __str__(self):
return "This is not a legal movement."
class NotPlayersPiece(Exception):
def __init__(self):
pass
def __str__(self):
return "This is not your piece."
class EmptyHeadTile(Exception):
def __init__(self):
pas... | true |
152a32a81fc921e80a49b97d27366d169793afd3 | yughurt1984/Python | /小甲鱼课堂/test.py | UTF-8 | 79 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
# coding:utf-8
import math
a = 4
b = math.sqrt(a)
print(b) | true |
a9017694d9aaa8667b6d89282ed9a6ce1b957ddd | pdhhiep/Computation_using_Python | /truncated_normal/normal_01_mean.py | UTF-8 | 1,731 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
#
def normal_01_mean ( ):
#*****************************************************************************80
#
## NORMAL_01_MEAN returns the mean of the Normal 01 PDF.
#
# Licensing:
#
# This code is distributed under the GNU LGPL license.
#
# Modified:
#
# 03 March 2015
#
# Author:
#
# ... | true |
f229e27493e6f7bbecb38469075ac1d945ef2d25 | katlings/adafruit | /backup/halfmousevert.py | UTF-8 | 893 | 2.859375 | 3 | [
"MIT"
] | permissive | # Gemma IO demo
# Welcome to CircuitPython 2.2.4 :)
from adafruit_hid.mouse import Mouse
from touchio import TouchIn
import adafruit_dotstar as dotstar
import board
import time
dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
dot.brightness = 0
dot.show()
mouse = Mouse()
touch0 = TouchIn(board.A0)
touc... | true |
fb20100289ac6361ef678c34bda1030a27692a03 | Aasthaengg/IBMdataset | /Python_codes/p02665/s975023954.py | UTF-8 | 497 | 2.984375 | 3 | [] | no_license | N = int(input())
a_list = [int(a) for a in input().split()]
if a_list[0] > 1:
print(-1)
exit()
ans = 1
temp1 = [""]*(N+1)
temp1[-1] = a_list[-1]
for n in range(N-1, 0, -1):
temp1[n] = temp1[n+1]+a_list[n]
temp2 = 1
for n in range(1, N+1):
temp2 = (temp2-a_list[n-1])*2
# print(temp2, temp1[n])... | true |
6c1546135e1842823e0ddc0234e126df7e0c4752 | libowei1213/LeetCode | /71. Simplify Path.py | UTF-8 | 627 | 3.296875 | 3 | [] | no_license | class Solution:
def simplifyPath(self, path):
"""
:type path: str
:rtype: str
"""
paths = path.split("/")
simple = []
for folder in paths:
if folder == '':
continue
elif folder == '.':
continue
... | true |
4da6f7fdf905f1fb10840571735eaff87ce3596c | rexsace/MabuhayEnergyExam | /part1_5.py | UTF-8 | 988 | 3.921875 | 4 | [] | no_license | def find_intersection(string1=None, string2=None):
if string1 is None:
string1 = input("First: ")
else:
print("First:", string1)
if string2 is None:
string2 = input("Second: ")
else:
print("Second:", string2)
arr1 = [x.strip('\'\" ') for x in string1.split(',')]
... | true |
1d6abbe265eed0922956e31f51387f630c1b4d28 | Blue6641/c4t-15 | /session 3/cond_elif.py | UTF-8 | 371 | 4.25 | 4 | [] | no_license | # n = int(input ("Enter Month: "))
# if n < 4:
# print ("Spring")
# elif 4 <= n < 6:
# print ("Fall")
# elif 6 <= n < 9:
# print ("Autumn")
# else:
# print ("Winter")
import random
number = random.randint(0, 100)
print (type(number))
print (number)
if number < 30:
print("Rainy")
elif 30 < number... | true |
75a9f9d779b859cde000d3bba226b4e580201737 | shi18/lungDieseaseClassificationAndVisualization | /testCode/generateTestPatches.py | UTF-8 | 5,146 | 2.625 | 3 | [] | no_license | import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os, sys, glob
import SimpleITK as sitk
import numpy as np
import cv2
import copy
def rescale(inArr, a, b):
m = inArr.min()
M = inArr.max()
numerator = (b - a) * (inArr - m)
denominator = (M - m)
out = (numerator / d... | true |
8a9ea68547d60c9e19b2e37e6da8cd73969d387e | wikiAvinasH/Face-Recognition-Sequential-Model | /Sequential_Model.py | UTF-8 | 7,724 | 2.734375 | 3 | [] | no_license | # Importing all the required libraries and packages here
import numpy as np
import pandas as pd
import glob
import os
from PIL import Image
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, BatchNormalization
from keras.layer... | true |
473d117a346bd183d473f904a3dca81c5c98c2ed | notjamesheck/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/9-multiply_by_2.py | UTF-8 | 120 | 3.125 | 3 | [] | no_license | #!/usr/bin/python3
def multiply_by_2(my_dict):
d = dict(my_dict)
for key in d:
d[key] *= 2
return d
| true |
ad29f7eb7ff1843c918e64ed770a12142e05ada8 | shengqiaowei/temp | /pylib/TeacherLib.py | UTF-8 | 5,339 | 2.65625 | 3 | [] | no_license | import requests,json
from pprint import pprint
from config import g_vcode
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
class TeacherLib:
url = 'http://ci.ytesting.com/api/3school/teachers'
def __init__(self):
self.g_vcode = g_vcode
#列出老师
def listTeacher(self,subjecti... | true |
506868029f75592806db28ba5ad66a090c2e8477 | codeInven/NEPRA_SPIDER | /detail.py | UTF-8 | 512 | 2.53125 | 3 | [] | no_license | import urllib.request
from urllib.parse import urlsplit, urlunsplit, urljoin, urlparse
import re
url="http://www.nepra.org.pk"
found_links=[]
found_detail=[]
try:
response = urllib.request.urlopen(url)
page = str(response.read())
pattern = '<a [^>]*href=[\'|"](.*?)[\'"].*?>'
found_links ... | true |
775234179ccd1b336925ef78f6e887b3e73849b3 | nischalshrestha/automatic_wat_discovery | /Notebooks/py/agodwinp/deep-sea-dive-into-top-10-survival-guide/deep-sea-dive-into-top-10-survival-guide.py | UTF-8 | 127,695 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:cod... | true |
0198ccf4284321fecc71ab8b5c6a0a206d6641b1 | jason-li-z/DSA-Python | /leetcode.py | UTF-8 | 825 | 3.65625 | 4 | [] | no_license | # 230
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def kthSmallest(root, k):
# Inorder --> Left --> Root --> Right
result = []
currNode = root
stack = []
while currNode is not None or stack:
if currNode is not None:
... | true |