blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f2a948b75eea3ef4b811d34f2ddb26c6a7ce3cd1 | Python | tksatc/CIT228 | /Chapter15/plotly.py | UTF-8 | 1,296 | 2.65625 | 3 | [] | no_license | import plotly.graph_objects as go
from plotly import offline
# percentage of fast food consumption per day by different sexes and age groups
#https://www.cdc.gov/nchs/data/databriefs/db322_table.pdf#page=1
men = [37.9,46.5,37.6,25.6]
women = [35.4,43.3,37.8,22.7]
total=[36.6,44.9,37.7,24.1]
age_range=["Over 20","20-3... | true |
637ca4931260cc38264cfbee61e32275481fec00 | Python | zthang/CurvGN | /play_npz.py | UTF-8 | 2,231 | 2.859375 | 3 | [] | no_license | import numpy as np
import scipy.sparse as sp
def load_dataset(file_name):
"""Load a graph from a Numpy binary file.
Parameters
----------
file_name : str
Name of the file to load.
Returns
-------
graph : dict
Dictionary that contains:
* 'A' : The adjacency matrix... | true |
2ac154097adeb9262ebd64ee0e1c21bbe599f7e4 | Python | pyxuweitao/django-clothing-enterprise-project | /sklcc/utilitys.py | UTF-8 | 10,000 | 2.59375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
__author__ = 'Administrator'
import datetime
from django.db.transaction import connections
from django.db import transaction
from copy import deepcopy
from urllib import unquote
import sys
# import requests
# import thread
# import time
class Current_time:
time_str = ""
def __init__(s... | true |
89f6d8822c3e716747595174f37958ea6256de3b | Python | joyDDT/python_code | /py/conditional_fruits.py | UTF-8 | 430 | 3.78125 | 4 | [] | no_license | favorite_fruits = ['banana','apple','cherry','orange']
if 'banana' in favorite_fruits:
print('You really like bananas.')
if 'cherry' in favorite_fruits:
print('You really like cherrys.')
if 'apple' in favorite_fruits :
print('You really like apples.')
if 'orange' in favorite_fruits:
print('You really... | true |
618d7f6a735e64c74a4815b598fd3ed26a0b3cea | Python | alila5/-Methods-of-collecting-and-processing-data-from-the-Internet | /GHUB API JSON.py | UTF-8 | 1,169 | 2.578125 | 3 | [] | no_license | import requests
import re
import json
import datetime
import os
from bs4 import BeautifulSoup as BS
username = 'alila5'
password = '****'
mlink = 'https://api.github.com'
r= requests.get('https://api.github.com/user', auth=(username, password))
print(r.text)
print(r.json())
repos = requests.g... | true |
319d9a35c4c8e76647329bcca0b76aa0374d14e2 | Python | sai-karthikeya-vemuri/PPP | /discrete_AC.py | UTF-8 | 4,765 | 3.109375 | 3 | [] | no_license | """
Solve time discretized version of Allen-Cahn Equation(which describes the process of phase separation in multi-component alloy systems).
strategy:
->Output of NN is calculated simultaneously for all data points and loss is squared average from all data points.
->The loss is of both domain and boundary togethe... | true |
6028f22c78710fc7d20fa386fbd4233e393be372 | Python | amit3992/PythonStuff | /DS&Algorithms/Stacks&Queues/SlidingWindowMax.py | UTF-8 | 783 | 3.5625 | 4 | [] | no_license | from pythonds.basic import deque
def sliding_window_max(array, win_size):
if win_size > len(array):
return
window = deque()
# Find max of first window
for i in range(0, win_size):
while window and array[i] >= array[window[-1]]:
window.pop()
window.append(i)
p... | true |
41b24a84c87a8787b795128eed14a7f0c855a70b | Python | adampehrson/Kattis | /venv/bin/PieceOfCake.py | UTF-8 | 278 | 3 | 3 | [] | no_license | def cakevolume(lst):
a = 0
b = 0
if 2*lst[1] > lst[0]:
a = lst[1]
else:
a = lst[0] - lst[1]
if 2 * lst[2] > lst[0]:
b = lst[2]
else:
b = lst[0] - lst[2]
return a*b*4
print(cakevolume(list(map(int, input().split()))))
| true |
d576f4074bb56baf51b82b9bf525db46c494f312 | Python | CarlaCCP/EstudosPython | /Python/aula4_elif.py | UTF-8 | 302 | 3.78125 | 4 | [] | no_license | numero = int(input("Digite um número: "))
if numero%3 ==0:
print("Numero divisivel por 3")
else:
if numero%5 ==0:
print("Numero divisivel por 5")
if numero%3 ==0:
print("Numero divisivel por 3")
elif numero%5 ==0:
print("Numero divisivel por 5")
| true |
9eb537e00f6648e495ac2a4444f48f386b15c0af | Python | pombredanne/cex.io | /main.py | UTF-8 | 2,846 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# core
import collections
import logging
import pprint
import time
# 3rd party
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.sup... | true |
4d7fb810659c7e555044ddbbb6269aa551e2e6ff | Python | agneet42/IoT | /Social/Weight_Calc/division.py | UTF-8 | 795 | 3.0625 | 3 | [] | no_license | import re
import numpy as np
infile = open ('newdata.txt', 'r')
outfile = open('test.txt', 'w')
column = 1
for line in infile:
if not re.match('#', line):
line = line.strip()
sline = line.split()
outfile.write(sline[column] + '\n')
infile.close()
outfile.close()
arr = np.zeros(400)
k=0
newfile = open('te... | true |
68059314b37c0b9d1a0bbd3181810d919a373899 | Python | Leo4Bey/bmicalc | /bmical.py | UTF-8 | 546 | 3.59375 | 4 | [
"MIT"
] | permissive | kilo = float(input("Kilonuzu giriniz kg cinsinden: "))
boy = float(input("Boyunuzu giriniz cm cinsinden: "))
bmi = kilo / (boy / 100) ** 2
if bmi >= 10 and bmi < 18.5:
print(bmi)
print("Zayıf")
elif bmi >= 18.5 and bmi < 25:
print(bmi)
print("Sağlıklı")
elif bmi >= 25 and bmi < 30:
pr... | true |
bf78fe0a99d493f750a416db35bbf6a95c6145eb | Python | purplecat7/PyCharmProjects | /Level2/IEA_2018_redsquirrel/src/ItemCollection.py | UTF-8 | 6,612 | 3.796875 | 4 | [] | no_license | import datetime
try:
from .Item import Item
except ImportError:
class Item:
def __init__(self, title, identity, checkout_date):
self._identity = identity
self._title = title
self._checkout_date = checkout_date
def get_identifier(self):
return sel... | true |
1de6f612f6b13b941fa2342a624002416f371f9b | Python | nachiketjahagirdar/cp | /cp_problem.py | UTF-8 | 180 | 3.578125 | 4 | [] | no_license | n=int(input("enter the number"))
c=1
while n>1:
if(n%2==0):
n=n/2
c=c+1
else:
n=3*n+1
c=c+1
print(c)
| true |
e9ae9a610f69ecb386940d3f0cf80bd3f15cd4f7 | Python | IshanManchanda/competitive-python | /Code Jam 2019/1A/d.py | UTF-8 | 6,082 | 2.921875 | 3 | [
"MIT"
] | permissive | def main():
from sys import stdin, stdout
rl = stdin.readline
wl = stdout.write
int1 = int
letts = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
t = int1(rl())
for tn in range(1, t + 1):
n = int1(rl())
words = {l: [] for l in letts}
for _ in range(n):
a = rl().strip()[::-1]
words[a[0]].append(a[1:])
for key in ... | true |
7b01ef640d83ce079f019fcbaa2c56a75cbc10c4 | Python | huchaoyang1991/py27_class | /py27_14day/run_test.py | UTF-8 | 1,250 | 2.671875 | 3 | [] | no_license | """
============================
Author:柠檬班-木森
Time:2020/3/5 21:11
E-mail:3247119728@qq.com
Company:湖南零檬信息技术有限公司
============================
"""
import unittest
from py27_14day.tstcases import LoginTestCase
# 第一步:创建测试套件
suite = unittest.TestSuite()
# 第二步:加载测试用例到测试套件
# 第一种:通过测试用例类去加载
loader = unittest.TestLoader... | true |
a93f9f3fc208ecc059ef85f1484d2adbf4c9118e | Python | Hubwithgit89/PythonLearn | /may20/ClassIntro.py | UTF-8 | 129 | 2.953125 | 3 | [] | no_license |
class computer:
def disp(self):
print("disp method")
c1=computer()
c2=computer()
#computer.disp(c1);
#c2.disp();
| true |
c7cfcb5e678ce12724e43d50da518b52b9f30f7f | Python | foumacray/ILRA | /code/offline_ova_stage.py | UTF-8 | 6,469 | 2.671875 | 3 | [] | no_license | __author__ = 'pedroamarinreyes'
import numpy as np
import sys
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import LeaveOneOut
import random
from utils.transformations import Ilr
def modelar(datos, pert, muestras):
datos_model = []
muestras_model = []
gnb = GaussianNB()
datos... | true |
b377178aaef13060bb534541d2535f3f37733ceb | Python | WaiYanNyeinNaing/Real-Time-Gender-Classification-with-Deep-Learning | /detect_gender.py | UTF-8 | 3,897 | 2.671875 | 3 | [
"MIT"
] | permissive | from keras.preprocessing.image import img_to_array
import imutils
import cv2
from keras.models import load_model
import numpy as np
import pyttsx3
import pyaudio
import matplotlib.pyplot as plt
from keras.preprocessing import image
from statistics import mode
def get_labels(dataset_name):
if dataset_name == 'imd... | true |
70604168feca05df5eb8adfa1095329c57d6d4a4 | Python | bhajojo/RobotFrameworkTraining | /PythonCode/Classes/ClassExample.py | UTF-8 | 276 | 3.671875 | 4 | [] | no_license | class ExampleClass:
def example1(self):
print "example1"
def example2(self):
print "example2"
def example3(self):
print "example3"
#Creating object of class
x=ExampleClass()
x.example1()
#x.example2()
x.example3()
| true |
24c0601101644f5dd327278786c3211750e1046a | Python | UncleRus/cherryBase | /src/cherrybase/plugins.py | UTF-8 | 8,378 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from cherrypy.process.plugins import SimplePlugin
import threading
import Queue
import logging
from cherrypy.process.wspbus import states
class ExitThread (Exception):
pass
class IterativePlugin (SimplePlugin):
def __init__ (self, bus, name = None):
super (IterativePlugin, ... | true |
c1c3bb786f6c7921d46bc47418f41b6130d46a66 | Python | twinstae/realworld-fastapi | /app/models/orm/profile.py | UTF-8 | 1,080 | 2.515625 | 3 | [] | no_license | from tortoise import fields
from tortoise.models import Model
class Profile(Model):
id = fields.IntField(pk=True)
user = fields.OneToOneField("app.User", related_name="profile")
username = fields.CharField(16)
bio = fields.CharField(256, null=True)
image = fields.CharField(256, null=True)
fol... | true |
8bc4f36fd85437555e34aefb8c7374cfe28fa971 | Python | littlefish0331/Python-pengpeng-2020 | /python-training/08_loop-control.py | UTF-8 | 1,056 | 4.65625 | 5 | [] | no_license | # break 的簡易範例
n=0
while n<5:
if n==3:
break
print(n) # 印出迴圈中的 n
n=n+1
print("最後的 n:", n) # 印出迴圈結束後的 n
# ---
# continue 的簡易範例
n=0
for x in [0,1,2,3]:
if x%2==0: # x 是偶數
continue
print(x)
n=n+1
print("最後的 x:", x) # 印出迴圈結束後的 n
print("最後的 n:", n) # 印出迴圈結束後的 n
# ---
# else 的簡易範例
su... | true |
1dde44b1b1d5b26e46835dbf3bc4c98663e11de4 | Python | fabianazioti/lccs.py | /lccs/cli.py | UTF-8 | 19,263 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #
# This file is part of Land Cover Classification System Web Service.
# Copyright (C) 2020-2021 INPE.
#
# Land Cover Classification System Web Service is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""Command line interface for the ... | true |
5e6b49965d2b90f82d59111ec9411b083d0710e3 | Python | Shivang-Agarwal11/python-proj | /RockPaperScissorCMDGame/simpleRPSGame.py | UTF-8 | 696 | 3.75 | 4 | [] | no_license | from random import randint
print("WELCOME TO ROCK, PAPER, SCISSOR\n")
player= input(" ROCK (r),Paper (p),Scissor (s)\n")
computer = randint(1,3)
if computer==1:
computer_ch='r'
elif computer==2:
computer_ch='p'
else:
computer_ch='s'
print(computer_ch,'VS',player)
#logic
if player=='r' and computer_c... | true |
1afdc56ed0f7acda7f7ef43282412a607a7fa324 | Python | dongchen6698/Data_Analysis | /Python/Project_Practice/COMP_6411_Assignment_3/Monitor.py | UTF-8 | 1,942 | 3 | 3 | [] | no_license | from threading import RLock
from threading import Condition
class FileControl:
def __init__(self):
self.__lock = RLock()
self.__readers = Condition(self.__lock)
self.__writers = Condition(self.__lock)
self.__isReading_Count = 0
self.__waitingWriters_Count = 0
self._... | true |
c273267063929981e01cd5027c605fbfbb166c5b | Python | nart4hire/Tubes_Daspro | /testcsv/generateuser.py | UTF-8 | 2,378 | 2.875 | 3 | [] | no_license | import random
from fb01 import pihash
first_names = [
'Ava', 'Beatrice', 'Courtney', 'Dave', 'Ethan', 'Faris',
'George', 'Hamilton', 'Ignis', 'Jean', 'Katnis',
'Laetitia', 'Maureen', 'Nobita', 'Ophelia', 'Priscilla',
'Quake', 'Randal', 'Sven', 'Tabatha', 'Ursula', 'Victoria',
'William', 'Xander', '... | true |
06d00ed90114822a110a0b8fb7e8e41b6c141a90 | Python | nidhi-jain-cse/python-files-curd-operations | /curdop.py | UTF-8 | 4,893 | 3.3125 | 3 | [] | no_license | import os
z = 1
while(True):
print("\n 1. Add Record")
print("\n 2. Display all record")
print("\n 3. Search student record by name ")
print("\n 4. Search student record by rollno.")
print("\n 5. Delete student record")
print("\n 6. Update student record")
print("\n 7. Exit\n")
n = int... | true |
8ede50ea4e96064a379990f4044a170dd65c09a0 | Python | DataSciencePolimi/TwitterCrawling | /run_crawlers.py | UTF-8 | 4,161 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from pymongo import MongoClient
import datetime
import time
import logging as logger
logger.basicConfig(format="%(asctime)s %(message)s", level=logger.DEBUG,filename="/Users/emrecalisir/git/out.log")
import subprocess
import dao
from datetime import datetime, timedelta
def format_date(year_start, year_end, month_star... | true |
92c338234465c3e17115c1d0665a7357e7d1982c | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2541/60755/294379.py | UTF-8 | 240 | 2.671875 | 3 | [] | no_license | n = int(input())
all = input()[2:-2].split("],[")
a = []
for i in all:
a.append(i.split(","))
res = []
num = []
for i in len(a):
for k in len(a[i]):
if res.count(a[i][k])==0:
num.append(a[i][k])
while len(num)!=0 | true |
e5b9056e2d8917ff2aca4744e47b61328222e280 | Python | jiangsuliji/icon2vec | /data/preprocess.py | UTF-8 | 3,275 | 2.765625 | 3 | [] | no_license | """Preprocess train/dev/test.txt - generate embedding for word2vec, fasttext, GloVe"""
import numpy as np
import pickle as pk
from pretrained_embeddings import Word2Vec
from pretrained_embeddings import FastText
from pretrained_embeddings import GloVe
# Authorship
__author__ = "Ji Li"
__email__ = "jili5@microsoft.com"... | true |
c75b916cd76e08571c05c03b0eea17fe8658421c | Python | piush2611/Masai-Submissions | /week_13/day_4/countConsonants.py | UTF-8 | 258 | 4.03125 | 4 | [] | no_license | vowels = ["a", "e", "i", "o", "u"]
ip = input("Please enter the list of strings seperated with space : ")
strings = ip.split(' ')
for string in strings:
count = 0
for vowel in vowels:
count += string.count(vowel)
print(len(string)-count) | true |
47d9bc7dbd8a34b6b88af97ef39f1f2b1cbf3e4f | Python | akash1601/algorithms_leetcode_solution | /solutions/minDepth.py | UTF-8 | 545 | 3.046875 | 3 | [] | no_license | class Solution:
def minDepth(self, root: TreeNode) -> int:
depth = 0
if not root:
return 0
queue = []
queue.append(root)
while queue:
depth += 1
for _ in range(len(queue)):
node = queue.pop(0)
if not node.lef... | true |
5ea264a422f0d6b0d53c155ca48cbe08e7a22a8c | Python | inkyu0103/BOJ | /Dynamic Programming/9095.py | UTF-8 | 336 | 2.921875 | 3 | [] | no_license | #9095
def solve (_input) :
global count
if _input == 0:
count += 1
return
elif _input < 0:
return
else:
solve(_input-1)
solve(_input-2)
solve(_input-3)
tc = int(input())
for i in range(tc):
target = int(input())
count = 0
solve(target)
... | true |
d25f2a38319c1b6aed389410a3bcc2a2a7c0d701 | Python | jakekrafczyk/Real-Estate-Analysis | /search_allrep.py | UTF-8 | 5,893 | 2.828125 | 3 | [
"MIT"
] | permissive | from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from bs4 import BeautifulSoup
import requests
import pandas as pd
import time
import random
# optional first step, define the driver, ie chrome or Brave
driver = webdriver.Chrome('./chromedriver 2')
# define dataset
df = pd.r... | true |
f3a4c2213727a670eedc5f9d119f4aec8e40aef6 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2685/60714/282637.py | UTF-8 | 199 | 3.546875 | 4 | [] | no_license | T = int(input())
for i in range(0, T):
n = int(input())
if n % 9 == 0:
ans = "9" * (n // 9) + "0" * n
else:
ans = str(n % 9) + "9" * (n // 9) + "0" * n
print(ans)
| true |
863ccf702af07f1278c8d2cb86bd9affc30045ef | Python | janLo/advent-of-code-2020 | /d10/p2.py | UTF-8 | 495 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
if __name__ == "__main__":
with open("input", "r") as fn:
data = [0] + list(sorted(int(line.strip()) for line in fn))
data.append(data[-1] + 3)
data.reverse()
track = [1]
for pos in range(1, len(data)):
cur = data[pos]
back_slice = data[pos - min... | true |
1828e59d100e143dbe4c87b7bfa6becad065ef4e | Python | john-fante/sahibinden-fotograf-indirme | /ilan_goruntu_indirme.py | UTF-8 | 1,678 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 15 21:57:57 2020
@author: john-fante
"""
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from bs4 import BeautifulSoup
import urllib.request
# Kategorik link ve ChromeDriver dizini giriş olarak kullanarak tüm ilanda bulunan
# tüm fo... | true |
cf55248ee200ec0b99cdf06c1e30805d3ef265a5 | Python | icorso/wn_api | /test/bulk_payment/bulk_payment_handler.py | UTF-8 | 2,972 | 3.03125 | 3 | [] | no_license | import csv
import hashlib
from csv import *
from datetime import datetime, timedelta
from enum import Enum
def today(days=0, hours=0, format='%d-%m-%Y:%H:%M:%S:000'):
return (datetime.now() + timedelta(days=days, hours=hours)).strftime(format)
class DialectEnum(Enum):
delimiter = (',', ';', ' ')
quot... | true |
633d6f8c9f75839ff8b4298530ba687e8c0bb64d | Python | wangyin0810/algorithm010 | /Week08/merge.py | UTF-8 | 679 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 31 20:44:36 2020
@author: YinWang
"""
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[List[int]]
:rtype: List[List[int]]
"""
if not intervals: return []
intervals.sort()
res = []
... | true |
5dcfa1d18d8da26dab5f96d540f41ebf8d8c6995 | Python | PolarisJunior/ml-server | /ml_modules/k_means.py | UTF-8 | 1,617 | 2.953125 | 3 | [] | no_license |
import numpy as np
from ml_modules.ml_base import MlBase
class KMeans(MlBase):
algo_id = 1
def __init__(self, data, args):
print("Constructed KMeans")
self.data = data
self.k = 1
self.dims = 1
if "k" in args:
self.k = args["k"]
if "dims" in ar... | true |
ece6363f0f6ec6f33237bf9360fdb2df8d6ec8bf | Python | ABHIP26/stock_prize_system | /Python_project 2.py | UTF-8 | 761 | 2.765625 | 3 | [] | no_license | from Tkinter import *
from PIL import ImageTk, Image
class Application(Frame):
def __init__(self, master):
Frame.__init__(self)
self.grid()
self.FirstFrame()
def FirstFrame(self):
Frame.__init__(self)
self.img = ImageTk.PhotoImage(Image.open('stok.jpg'))
self... | true |
e019eb0cd2ad7223ed003c60714d5ec60931b845 | Python | chandanr/xfs-xattr-benchmark | /scripts/python/json-to-graph.py | UTF-8 | 5,049 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
import json
import subprocess
space_usage_prog = '''
set autoscale
set grid
set xlabel "Leaf sl no."
set ylabel "Leaf space used (in bytes)"
set xtic auto
set ytic auto
set xrange [1:]
set yrange [1:5000]
# 1916,1012
# 30000,2024
set terminal pngcairo enhanced size 30000... | true |
ee7e466ffbc9e80aafe766ca8d95918f7db7af33 | Python | hosyaeuw/ubit_react | /src/static/test.py | UTF-8 | 916 | 3.296875 | 3 | [] | no_license | from PIL import Image, ImageDraw
image = Image.open('123.jpg') # Открываем изображение
draw = ImageDraw.Draw(image) # Создаем инструмент для рисования
width = image.size[0] # Определяем ширину
height = image.size[1] # Определяем высоту
pix = image.load() # Выгружаем значения пикселей
for x in range(width):
... | true |
366e6822c9e68a54f8aa4f17daba2623a5a94c73 | Python | aakritanshuman/mtp | /scripts/collect_lnd_ping_times.py | UTF-8 | 2,677 | 2.875 | 3 | [
"MIT"
] | permissive | import json
import subprocess
import pingparsing as pp
import statistics as stat
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse
from config import *
parser = argparse.ArgumentParser(description='Collect ping times to lnd nodes')
parser.add_argument('--rerun-ping', action="stor... | true |
3fd5d76dbf2fd2b2aae0f98830eb8c78c4ccce73 | Python | oopil/Ewha_brainMRI | /machine_learn.py | UTF-8 | 8,846 | 2.765625 | 3 | [] | no_license | import pandas as pd
import seaborn as sns
from excel_data_reader import *
from FD_python.FD_data import *
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier, VotingClassifier, BaggingClassifier
from sklearn.metrics import classification_re... | true |
d01942e59a4770cada5f904b2f6f6a5c1d1b7bec | Python | ppolewicz/ant-colony | /antcolony/world_generator_factory.py | UTF-8 | 5,964 | 2.921875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from point_generator import SimplePointGenerator, ChessboardPointGenerator, HexagonPointGenerator
from edge_generator import ChessboardEdgeGenerator, CrossedChessboardEdgeGenerator, LimitedQuantityEdgeGenerator, LimitedRangeEdgeGenerator
from edge_cost_generator import DistanceEdgeCostGenerator, ThresholdDistanceFromCo... | true |
9065680fc8160a7ce829d216ad2779217b68bf0d | Python | khw5123/Algorithm | /Programmers/x만큼 간격이 있는 n개의 숫자.py | UTF-8 | 122 | 3.078125 | 3 | [] | no_license | def solution(x, n):
answer = [x]
for _ in range(1, n):
answer.append(answer[-1] + x)
return answer | true |
bf28a853b8a7b3f52f2216346f2d479c269f2ee0 | Python | paul-maher/creeknet | /datainserter.py | UTF-8 | 4,804 | 3.515625 | 4 | [
"MIT"
] | permissive |
import pandas as pd
# Class to insert spot entries into specific CSV data files. Relies on the pandas libraries for the CSV manipulation.
class DataInserter:
# Initialise the class, TODO: get the name root from the config file
def __init__(_self, nameRoot, tf):
_self.nameRoot = nameRoot... | true |
00058c531302c789252f2afcedb418192516dccd | Python | xianglingchuan/python-learn-project | /com/demo/range.py | UTF-8 | 2,130 | 3.96875 | 4 | [] | no_license | # -- coding: utf-8 --
#1、生成列表
print range(1, 11);
L =[];
for x in range(1,11):
L.append(x * x);
print L;
print [x * x for x in range(1, 11)];
'''
任务
请利用列表生成式生成列表 [1x2, 3x4, 5x6, 7x8, ..., 99x100]
提示:range(1, 100, 2) 可以生成list [1, 3, 5, 7, 9,...]
'''
print [x * (x+1) for x in range(1, 100, 2)]
print ('============... | true |
268a98cb02a74d44ff293c5a2fc6e9c3f1c7df68 | Python | easylist/EasyListHebrew | /tools/generalFinder.py | UTF-8 | 1,203 | 2.84375 | 3 | [] | no_license | import sys
import re
class Filter(object):
def __init__(self, fil, typ, domain):
self.filter = fil
self.typ = typ
self.domain = domain
def __str__(self):
return ",".join(sorted(self.domain)) + self.typ + self.filter
regex = re.compile(r"^([a-zA-Z0-9-.]+)(#{2}[#.]?)(.*)", re.... | true |
a64f87da01bb23fb61b8b0f966aa990eaa04f7f9 | Python | MurilloFagundesAS/Exercicios-Resolvidos-Curso-em-Video | /Ex011-AreaPintarParede.py | UTF-8 | 268 | 3.734375 | 4 | [] | no_license | l = float(input('Qual a Largura da Parede? '))
h = float(input('Qual a Altura da Parede? '))
area = l * h
pintar = area//2
print()
print('Largura = {:.2f}\nAltura = {:.2f}\nArea da Parede = {:.2f}m2\nE preciso de {}l de tinta para pintar'.format(l, h, area, pintar)) | true |
40606439a9a2c8421e667f4a13f6831b198b0d8a | Python | pramilagm/coding_dojo | /python/OOP/bank_account_oop.py | UTF-8 | 1,339 | 4.09375 | 4 | [] | no_license | class BankAccount:
def __init__(self, int_rate, balance):
self.int_rate =int_rate
self.balance =balance
def deposit(self, amount):
self.balance += amount
return self
def withdraw(self,amount):
if amount>self.balance:
print(f"Insufficient funs:cha... | true |
42cf544f3665820a30ee41f85841f3abfe25edb1 | Python | samreising/nand2tetris | /projects/06/Assembler/parser.py | UTF-8 | 2,949 | 3.375 | 3 | [] | no_license | class Parser:
def __init__(self, input):
self.file = open(input, 'r')
self.currentLine = None
self.nextLine = None
# Are there more commands in the input?
def hasMoreCommands(self):
self.currentLine = self.file.readline()
if self.currentLine == '':
retur... | true |
6dfd10beb3b6a88a4563fe0e3b60c53212264dad | Python | despairEndless/pyRepo | /pyProj/testProject/hello.py | UTF-8 | 20 | 2.640625 | 3 | [] | no_license | a=60
b=70
print(a+b) | true |
18a512f25cabab64a2c21bdf4a7f839df0270306 | Python | adnansamad769/Lab-task-and-Class-Work | /Lab 6/PF Lab 6/Question 3.py | UTF-8 | 140 | 3.546875 | 4 | [] | no_license | def even(x):
for i in range (2,x+1):
if i%2==0:
print(i,end=(','))
elif i%3==0:
print(i,end=(','))
even(10) | true |
4db35a9f6013798b055d578dcc946722c522345d | Python | betapleb/hangman-fun-game-haha | /games.py | UTF-8 | 3,066 | 3.875 | 4 | [] | no_license |
handle = open("Hangman.py")
from random import *
from Hangman import *
seed()
def letterInWord(x, y):
indexes = []
for i in range(len(y)):
if x == y[i]:
indexes.append(i)
return indexes
class Game():
def __init__(self):
self.listing = []
self.secretW... | true |
99c47c75c184fe5a39812268369822626fb46e0e | Python | BSalita/selfbid | /gen_bidding.py | UTF-8 | 1,446 | 2.703125 | 3 | [] | no_license | import sys
from kbb.bidder import KnowledgeBasedBidder
from core.hand import Hand
from core.callhistory import Vulnerability, CallHistory
from core.position import Position
from core.call import Pass
kbb_bidder = KnowledgeBasedBidder()
def hands_from_deal_str(deal_str):
result = []
for hand in deal_str.split... | true |
b4436a25d6dc0961e83bd18642ae3b32bcdff222 | Python | das-developers/das2py | /examples/ex09_cassini_fce_ephem_ticks.py | UTF-8 | 4,553 | 2.875 | 3 | [
"MIT"
] | permissive | #import numpy
import sys
import os.path
import numpy as np
import matplotlib.pyplot as pyplot
import matplotlib.ticker as ticker
import das2 # General data stuff
import das2.mpl # matplotlib helpers
# ########################################################################### #
# Plot Helpers #
def dayTicks(s... | true |
1627258c697f096cc4c655b51bcbe1eb5928d10f | Python | icgeass/python | /http/http_req.py | UTF-8 | 799 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import json
import decimal
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
return float(o)
super(DecimalEncoder, self).default(o)
def post(url=No... | true |
53317e7ca42ad128ef326c8c5e071032dd83d660 | Python | C-o-r-E/ahoy | /listen.py | UTF-8 | 381 | 2.765625 | 3 | [] | no_license | import socket
import time
local_ip = "0.0.0.0"
bcast_port = 2050
sock_info = (local_ip, bcast_port)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(sock_info)
start = time.time()
print "listening for connections..."
while True:
data, addr = s.recvfrom(1024)
now = time.time()
delta = int(now ... | true |
7b21d7bb6d26a925cf8459a4f7ac33b2250591f3 | Python | spacetiller/experiment | /dm/hebing/map_cipin.py | UTF-8 | 731 | 2.59375 | 3 | [] | no_license | #!/bin/env python
#-*-encoding:utf-8-*-
import sys
import jieba
import jieba.analyse
reload(sys)
sys.setdefaultencoding('utf-8')
for line in sys.stdin:
tmp_list = line.strip().split('\x01')
if tmp_list == '':
continue
if len(tmp_list) < 14:
continue
else:
#print tmp_list[13... | true |
7b39653265c63c40eb8af5ddb7cc1c6925bf73a1 | Python | Jnmendza/pythonpractice | /Introductions/binaryTrees.py | UTF-8 | 3,039 | 4.46875 | 4 | [] | no_license | # Root - The topmost node in the tree
# Child - A node directly connected to another node when moving away from the root node.
# Parent - A node directly connected node when moving towards the root node.
# Siblings - Nodes that share the same parent are considered siblings.
# Leaf - A node that does not have any ch... | true |
5e9883c7caf5a91ac9cb6c0aa07986f1b4f15235 | Python | mashpolo/leetcode_ans | /100/leetcode140/ans.py | UTF-8 | 1,149 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
"""
@desc:
@author: Luo.lu
@date: 2019-07-10
"""
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: List[str]
"""
# 借助139,判断是否存在可分的情况,否则特例可能会超时
if not s:
... | true |
e4d1baf27979e1ef30d6e106dd38d37a1bb0d752 | Python | JakobKruijer/visualising-nuclear-accidents-around-the-world-using-Bokeh | /dashboard.py | UTF-8 | 18,718 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 25 19:41:53 2021
@author: jakob
"""
#import libraries
import pandas as pd
from bokeh.io import show, output_file
from bokeh.plotting import figure, ColumnDataSource, curdoc
from bokeh.palettes import Spectral4, Colorblind5
from bokeh.layouts import row, column
... | true |
8d37a056b56ccd8146bbb766840c72c983102d52 | Python | nuisttlj/AI_study | /test20190708/test02.py | UTF-8 | 376 | 2.53125 | 3 | [] | no_license | import torch
class MyNet(torch.nn.Module):
def __init__(self):
super(MyNet, self).__init__()
self.fc1 = None
self.fc2 = None
def forward(self, x):
y = self.fc1(x)
y = self.fc2(y)
return y
net = MyNet()
opt1 = torch.optim.Adam(net.fc2.param... | true |
7f09daabf5cae8d96695c49906e3c7987b3d547c | Python | biobot-01/logs-analysis | /logs_analysis.py | UTF-8 | 3,780 | 3.8125 | 4 | [] | no_license | #!/usr/bin/env python3
"""Reporting tool that prints out reports based on data in a database"""
# Questions this tool should answer:
# 1. What are the most popular three articles of all time?
# 2. Who are the most popular article authors of all time?
# 3. On which days did more than 1% of requests lead to errors?
impo... | true |
9395a648a3c11cfaa2ce8b2855b606b886b35db0 | Python | Dophix/inoft_vocal_framework | /platforms_handlers/alexa/session.py | UTF-8 | 1,855 | 2.890625 | 3 | [] | no_license | class Session:
json_key = "session"
def __init__(self):
self._new = bool()
self._sessionId = str()
self._application = dict()
self._user = dict()
self._attributes = dict()
@property
def new(self):
return self._new
@new.setter
def new(self, new: ... | true |
9e6fdae88dcc7bb8d2c1891a9d4fc88bbdd2ad71 | Python | Aasthaengg/IBMdataset | /Python_codes/p03213/s832152702.py | UTF-8 | 889 | 3.109375 | 3 | [] | no_license | import bisect
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
def main():
N = int(input())
... | true |
c474ee24faa259cc05a4b4be8413d62575109ffe | Python | misvu/guestbook-app | /app.py | UTF-8 | 4,160 | 2.515625 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, flash
import os
from flask import g
import sqlite3
import string
app = Flask(__name__, static_folder="static", static_path="")
# Secret key is needed to keep the client-side sessions secure
# os.urandom(n) returns a string of n random bytes
app.se... | true |
a5ff2608c3a800f71b5d8ca3429ad35bac3bf64e | Python | CoderArshia/C111 | /math.py | UTF-8 | 3,363 | 3.0625 | 3 | [] | no_license | import plotly.figure_factory as ff
import pandas as pd
import csv
import statistics
import random
import plotly.graph_objects as go
df=pd.read_csv("studentMarks.csv")
data=df["Math_Score"].tolist()
# fig=ff.create_distplot([data],["math scores"],show_hist=False)
# fig.show()
# mean=statistics.mean(data... | true |
a85d953ceeb0c55d2bbd96c6bad1a52a2e1d5100 | Python | tp-yan/PycharmProject | /ForTensorFlow2/04TensorFlow/03selective_index02.py | UTF-8 | 2,414 | 3.234375 | 3 | [] | no_license | import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# Selective Indexing:选择索引。按照给定索引重新选择及其顺序
a = tf.random.normal([4,35,8])
# 1.tf.gather():只在一个维度上做选择索引
print(tf.gather(a,axis=0,indices=[2,3]).shape) # axis=0(默认)在第一个维度上进行索引选择。这里选择第一维上的第2,3个元素
print(a[2:4].shape)
print(tf.gather(a,axis=0,indices... | true |
83cd3269261fafb629b86ba884c0ca42595130b8 | Python | BartWaaang/leetcode | /algorithms/LongestPalindromicSubstring/LongestPalindromicSubstring.py | UTF-8 | 935 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
'''
github: https://github.com/gitferry
author: Fangyu Gai <gaigai508@gmail.com>
date : 02/07/2015
'''
class Solution:
# @param {string} s
# @return {string}
def longestPalindrome(self, s):
expand_s = "#".join("^{}$".format(s))
s_length = len(expand_s)
p... | true |
4bb492350f03205163c017e6d89fc0eccdcb617a | Python | romeo9/atcs | /goodreads.py | UTF-8 | 1,829 | 3.6875 | 4 | [] | no_license | """
1 - Select favourite book
2 - Check manually if Goodreads has reviews on this book
3 - Either study the API to pull information or scrape reviews
4 - Use standard term frequency approaches(TFIDF) to extract meaningful terminology from the reviews.
5 - Review you approach. What challenges do you see?
6 - Is there a... | true |
dc380ac3899a1f0f374e4ccb1226cda7f25b495d | Python | JuunKR/DesignPattern | /0_basic/k_dependency/client.py | UTF-8 | 458 | 2.90625 | 3 | [] | no_license | from barista import Barista
from espresso_machine import EspressoMachine
class Client:
def main(self):
barista = Barista()
espresso_machine = EspressoMachine()
barista.set_espresso_machine(espresso_machine)
espresso = barista.make_espresso()
print(((((((((((((esp... | true |
6c6bead73891a1485ccc670c721d5aadf4bde240 | Python | mkenane/Code_Guild_OLD | /nov_29_day_lists.py | UTF-8 | 171 | 3.375 | 3 | [] | no_license | # lst = ['apple', 'banana', 'grape']
#
# print(lst[0][-1]) #print out only the e in apple:
lst = ['chris', 'Mor']
someone = 'chelsea'
lst.insert(1, someone)
print(lst)
| true |
9da85e5feb8ba034dfb957e02432351376a1a41e | Python | malekmahjoub635/holbertonschool-higher_level_programming-2 | /0x0A-python-inheritance/3-is_kind_of_class.py | UTF-8 | 474 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python3
"""
is_kind_of_class
"""
def is_kind_of_class(obj, a_class):
"""
function to check if an object is an instance of a class
Args:
obj (object): the object
a_class (class): the class
Returns:
True: if object is an instance of class or inherited from it
F... | true |
61244a06bc86b3b1165abaacfa5955d397c60c50 | Python | britig/MtechCodes | /Codes/Holder Table.py | UTF-8 | 12,672 | 2.859375 | 3 | [] | no_license | import GPyOpt as gpt
import numpy as np
from numpy.random import seed
# Global Variables Declaration
_bounds_list = []
_x_list = []
_y_list = []
_result_list = []
_epsilon = 2
_iter_count_opt = 10
_iter_count_cutoff = 10
#_delta = 1
_founded_minima_list = []
_x1_lower_range = -10
_x1_upper_range = 10
_x2_lower_range =... | true |
55197a499a4727a8354cdc6c681e1f6aef0330e0 | Python | rixo/atom-refs | /spec/modules/python.py | UTF-8 | 2,359 | 3.390625 | 3 | [] | no_license |
global1 = 1
global2 = 1
print(global2)
global2 = 3
global3 = 3
def inner_global():
print(global3)
global4 = 'global'
def global_shadow():
global4 = 'local'
global5 = 5
def shadow_global_and_inner():
global5 = 'local'
local = 5
def inner():
global5 = 'inner'
print(local)
global6... | true |
9ee2dae8c08aee0f5688a85e5324caf6fa450dc7 | Python | Luquicas5852/Small-projects | /easy/evenorodd.py | UTF-8 | 315 | 4.5 | 4 | [] | no_license | #Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user.
num = int(input("Enter with any positive number: "))
remainder = num%2
if remainder == 0:
print("the number " + str(num) + " is even!")
else:
print("the number " + str(num) + " is odd!")
| true |
9513ff424a8142f3f35d799e750b37a89a61abcc | Python | bmcfee/miasma | /miasma/layers.py | UTF-8 | 2,361 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | # CREATED: 2/20/17 18:50 by Justin Salamon <justin.salamon@nyu.edu>
from keras import backend as K
from keras.engine.topology import Layer
class SoftMaxPool(Layer):
'''
Keras softmax pooling layer
'''
def __init__(self, axis=-1, **kwargs):
super(SoftMaxPool, self).__init__(**kwargs)
... | true |
4eb047c32adbad6ecb4f01469f5cef87e736b72f | Python | jwallace145/SendDBProcessor | /clients/event_parser.py | UTF-8 | 915 | 2.9375 | 3 | [] | no_license | import json
from clients.logger import create_logger
class EventParser:
def __init__(self, event: dict) -> None:
self.event = event
self.resource = event['resource']
self.payload = self.parse_event(event)
# create logger
self.logger = create_logger(__name__)
# lo... | true |
98787450da0d77771fb938410c3a72bdedbc80b9 | Python | jackrosenthal/algobowl | /algobowl/lib/problem_tester.py | UTF-8 | 4,887 | 2.765625 | 3 | [
"MIT"
] | permissive | """Automated tester for the problem format."""
import io
import pathlib
import sys
import pytest
import algobowl.lib.problem as problemlib
@pytest.fixture
def problem(problem_dir):
return problemlib.Problem(problem_dir)
def stringio_from_path(path, convert_to_dos=False):
contents = path.read_text()
a... | true |
79b52b184c33982c87c35ebfa3070d0ee85f909f | Python | lailson/uri | /python/1012.py | UTF-8 | 337 | 3.484375 | 3 | [] | no_license | A, B, C = map(float, input().split(" "))
triangulo = (A * C) / 2
circulo = 3.14159 * C ** 2
trapezio = ((A + B) * C ) / 2
quadrado = B * B
retangulo = A * B
print(f'TRIANGULO: {triangulo:.3f}')
print(f'CIRCULO: {circulo:.3f}')
print(f'TRAPEZIO: {trapezio:.3f}')
print(f'QUADRADO: {quadrado:.3f}')
print(f'RETANGULO: {... | true |
b43fe73a67a5d760278a523a49a7b01ad27ea017 | Python | KastroWalker/algoritimos | /Aula12/victor_castro_avaliacao_1.py | UTF-8 | 331 | 4.1875 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
value = float(input('Digite o valor que deseja sacar: '))
fifty_notes = int(value // 50)
rest = value % 50
twenty_notes = int(rest // 20)
rest = rest % 20
ten_notes = int(rest // 10)
print(f"""Sacando:
{fifty_notes} notas de 50
{twenty_notes} notas de 20
{ten_notes} notas... | true |
6bd27e4d3b6f891c0b2b616600d536c00a48ea9b | Python | saiteja-05/Machine-Learning | /Ensemble Learning/Stacking/stacking.py | UTF-8 | 2,138 | 2.859375 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn... | true |
87527cc028be4a92ca72799f02e0e58d84bba245 | Python | LeVeloute/easy_vrp | /GenerateSimulation.py | UTF-8 | 3,055 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import time
import os
### CAMION 1
vrp1 = {}
vrp1['nodes'] = [{'label' : 'depot', 'demand' : 0, 'posX' : 0, 'posY' : 0}]
file = open("truck0", "r")
line = file.readline()
line = file.readline()
line = file.readline()
line = file.readline()
while(line != ""):
inputs = ... | true |
c6df6bc4f34699528dafb8b3a4d396e2664f23aa | Python | markobalasko/wargame-rpa | /wargame/orcrider.py | UTF-8 | 682 | 3.25 | 3 | [] | no_license | """wargame.orcrider
Ovaj modul sadrži implmentaciju OrcRider klase.
:copyright: 2020, None
:license: The MIT License (MIT) .
"""
from gameunit import GameUnit
class OrcRider(GameUnit):
"""Klasa koja predstavlja lika Orc Rider
Stavite opis metode i parametre (argumenti ili atributi) i ... | true |
efb9cf3412a58822423561c734fc8d5ef2c188db | Python | FisicaComputacionalPrimavera2018/20180807-primerrepositorio-Carlospotrero | /test.py | UTF-8 | 41 | 2.796875 | 3 | [] | no_license | sum=0
count=1
sum=sum+count
print(sum)
| true |
1949f245a6fac3b5ffd21c229b520a68a20aa664 | Python | MVCompany/python | /DaoPyFramework/daoFramework/dao/Dao.py | UTF-8 | 1,833 | 2.859375 | 3 | [] | no_license | '''
Created on Aug 3, 2018
@author: michel.valentin
This class have goals to be a interface for the persistence objects.
@attention: The methods must be implement of:
1) insert
2) merge
3) delete
4) find
That object is just a reference and if needs others methods can be created.
@param connecti... | true |
851656a59e82bab3e5216126cca123835590a4e2 | Python | dba-base/python-homework | /Day08/作业/ftpserver/test_sc.py | UTF-8 | 1,629 | 3.109375 | 3 | [] | no_license | # __author__ = "xiaoyu hao"
#
# __author__ = "xiaoyu hao"
#
import sys,time
import os
# def __progress(trans_size, file_size, mode):
# '''
# 进度条方法
# :param trans_size: 已传输得数据大小(字节)
# :param file_size: 文件的总大小(字节)
# :param mode: 传输方式
# :return:
# '''
# UNIT_SIZE = 1048576
# bar_lengh =... | true |
8264b0fb68e3e74235ca81c28676da8be07a3c5f | Python | paloitsingapore/Lab3AgritechCron | /ExtarctSystemRun.py | UTF-8 | 1,991 | 2.625 | 3 | [] | no_license | from crate import client
import json
import datetime
data_path ='/home/pi/data'
print (datetime.datetime.now())
current_timestamp = datetime.datetime.now()
status_ok ='OK'
status_nok='NOK'
query_max_time ="select max(load_time) from activity_s3_load where status='OK' "
query_load ="INSERT INTO activity_s3_load (load_ti... | true |
eb76f1b7d68c665af0dd6b009b0e224c186e883e | Python | Aasthaengg/IBMdataset | /Python_codes/p02264/s382976582.py | UTF-8 | 348 | 2.90625 | 3 | [] | no_license | n, q = map(int, input().split())
array = [[s for s in input().split()] for i in range(n)]
total_time = 0
while len(array) != 0:
a = array.pop(0)
a_t = int(a[1])
if a_t - q <= 0:
total_time += a_t
a[1] = total_time
print(a[0], a[1])
else:
a[1] = a_t - q
array.appen... | true |
8d11a61bb47bfa83023faa4125b0d65db512d5b6 | Python | YiNPNG/Python_Spider | /just_test/01_wenzi_part2.py | UTF-8 | 789 | 2.8125 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
from bs4 import BeautifulSoup
import requests
# 获取章节链接
if __name__ == '__main__':
server = 'http://www.biqukan.com/'
target = 'http://www.biqukan.com/1_1094/'
# 构造一个向服务器请求资源的request对象
# 返回一个包含服务器资源的response对象
req = requests.get(url=target)
html = req.text
div_bf = Bea... | true |
d0086a471406f3fea22dac1fc8da4cf5dfcbca57 | Python | grimmer0125/algorithms-vscode | /waysToDest/solution_permutations.py | UTF-8 | 3,631 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# slow, should use the way in solution_fastest.py
import sys
import math
from functools import reduce
import operator as op
from multiprocessing import Process, Queue
def cal_part1(n, r):
num = reduce(op.mul, range(n, r, -1), 1)
return num
def cal_choices(choic... | true |
35c1d01a077c39b8ac018e7732b0b521b3c3d8be | Python | flash1117/OpenCV | /grab-cut.py | UTF-8 | 4,297 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 1 13:41:18 2018
@author: USER
"""
import numpy as np
import cv2
BLUE, GREEN, RED, BLACK, WHITE = (255,0,0), (0,255,0),(0,0,255),(0,0,0),(255,255,255)
DRAW_BG = {'color':BLACK, 'val':0}
DRAW_FG = {'color':WHITE, 'val':1}
rect = (0,0,1,1)
drawing = False
rectangle = Fa... | true |
cc4952de6da551f71beb3b054f70ac769d0f7fde | Python | DouglasYuen/ProjectBobo | /Source/Condition.py | UTF-8 | 353 | 2.828125 | 3 | [
"MIT"
] | permissive | ## Condition class, holding onto a list of attributes
## Dated
from Field import Field
class Condition():
#Initialiser method
def __init__(self, theCondition, theSubtype):
self.conditionID = theCondition
self.subtypeID = theSubtype
self.fields = []
def addFieldToCondition(self, theField)... | true |
4498bea86e8bea31031952825bfd1e36cfa22389 | Python | Tonyroux/testing-codes | /Test-1.py | UTF-8 | 1,639 | 3.15625 | 3 | [] | no_license | import time as t
start = input("Are you ready kids?").lower()
if (start == "aye aye captain"):
print()
part_2 = input("I can't hear you!").lower()
if (part_2 == "aye aye captain"):
print()
print("OOOOOOOOO")
print()
part_3 = input("Who lives in a pineapple under th... | true |
c1ba1760fe6572bb5b2fa3c57624b142c7697eb1 | Python | Joentze/NRIC_PDPA | /nric_main/main.py | UTF-8 | 1,796 | 3.140625 | 3 | [] | no_license | import itertools as it
import time
def ChecksumNRIC(NRICstring):
checkDigits = [2 ,7 ,6 ,5 ,4 ,3 ,2]
FgArr = {0:'X', 1:'W', 2:'U', 3:'T', 4:'R', 5:'Q', 6:'P', 7:'N', 8:'M', 9:'L', 10:'K'}
StArr = {0:'J', 1:'Z', 2:'I', 3:'H', 4:'G', 5:'F', 6:'E', 7:'D', 8:'C', 9:'B', 10:'A'}
totalDigitSum = 0
for i in ra... | true |
80e951ed04fb84ba130b7ff6148f9de1816abf35 | Python | lch91/Compphys | /project3/plot.py | UTF-8 | 2,848 | 2.859375 | 3 | [] | no_license | from scitools.std import *
infile = open('2_Earth.dat', 'r')
N = 400000
t = zeros(N)
spin = zeros(N)
i=0
for line in infile:
line = line.split()
t[i] = float(line[0])
spin[i] = float(line[5])
spin[i] = spin[i]/(1.0*10**(30))
i += 1
#print spin[:i], t[:i]
plot(t[:i], spin[:i])
xlabel('time [yr]')
ylabel('energy [... | true |