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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
81bcfc83e897b71f7bd1a8268d44ebdfc6cf87a4 | Python | seanrobinson1114/IBM_Data_Science_Specialization | /Data_Visulization_with_Python/crime_rate.py | UTF-8 | 1,066 | 2.765625 | 3 | [] | no_license | # Imports
import pandas as pd
import folium
# load data into dataframe
crime_rates_df = pd.read_csv(
"/home/sean/software/coursera/IBM_Data_Science/Data_Visualization_with_Python/final_project/IBM_Data_Science_Specialization/Police_Department_Incidents_-_Previous_Year__2016_.csv"
)
print(crime_rates_df)
# initial... | true |
9a2b809a86df401bc6d7850671fb90c39359f6f9 | Python | vinny0965/phyton | /1P/1_VA_VINICIUS_ONORATO - Copia/util.py | UTF-8 | 1,079 | 2.84375 | 3 | [] | no_license | from datetime import datetime
import bancodeDados
def imprimir_clientes():
print('Clientes')
count = 1
clientes = bancodeDados.get_clientes()
for c in clientes:
print('Cliente:', count)
print('CPF:', c[0])
print('Nome:', c[1])
print('Sexo:', c[2])
print('Telefon... | true |
562049a0218a28c777fbe54b0bdb4e1e3b938a28 | Python | GTSupplyChainAR/RFID-Study-Task-Generation | /main.py | UTF-8 | 7,751 | 3.03125 | 3 | [] | no_license | import numpy
import json
import os
# This is the version number of the JSON file.
# Use this number to keep all copies of the tasks in sync across the study methods.
VERSION = "1.2"
# The Google Glass HUD client can only fit these number of orders on the screen at once.
MAX_ORDERS_PER_RACK = 6
# These are the names ... | true |
3d19c7ac08e0a84f6c4d610bf6b3085837803867 | Python | Aasthaengg/IBMdataset | /Python_codes/p02693/s801267442.py | UTF-8 | 193 | 3.203125 | 3 | [] | no_license | k= int(input())
a, b= input().split()
a= int(a)
b= int(b)
cont=0
while 1:
cont+= k
if a<= cont <= b:
print("OK")
break
if cont > b:
print("NG")
break | true |
4b8cb17e17df31731db0f2233d7d48e862c67b54 | Python | YooTimmy/promo_code_scraper | /promo_code_scraper.py | UTF-8 | 1,972 | 2.796875 | 3 | [] | no_license | from flask import *
import pandas as pd
import requests
import bs4
app = Flask(__name__)
website = "https://www.sgdtips.com/grabfood-promo-codes"
res = requests.get(website)
soup = bs4.BeautifulSoup(res.text, "lxml")
def promo_code_scraper(soup):
"""
The web scraper code is very specific for each individual ... | true |
1f006b6cd0da4f49144b40994ca08b09e91db3ff | Python | CodecoolBP20172/pbwp-3rd-si-game-statistics-BenceLovas | /reports.py | UTF-8 | 2,778 | 3.703125 | 4 | [] | no_license | # Report functions
def separate_data(file_name):
'''
In the data file every line contains properties of a game.
Properties are separated by a tab character and
lines are separated by line break characters.
The order of properties:
0 = Title (str)
1 = Total copies sold (million) (float)
... | true |
ec091f556974437742226f8e97ef307f3a11a778 | Python | dheerajgm/daily-coding-problem | /solutions/problem_350.py | UTF-8 | 811 | 3.375 | 3 | [
"MIT"
] | permissive | import sys
def get_sum_sq(target, squares):
if target == 0:
return 0
elif not squares:
return sys.maxsize
original_tgt = target
biggest_sq = squares.pop()
tally = 0
while target >= biggest_sq:
tally += 1
target -= biggest_sq
if tally:
return min(
... | true |
bf646c10c1e2e21972f8bba0bcc63b4fa1c55c46 | Python | jose-gilberto/mitx-python | /lect-01/variables.py | UTF-8 | 167 | 2.625 | 3 | [] | no_license | # Variables
pi = 3.14159
pi # 3.14159
pi_approx = 22/7
# reusing variables
radius = 2.2
area = pi*(radius**2)
# updating radius
radius = radius + 1
# radius += 1
| true |
697373c5d2865f324b1aa3312865a0290a6e30cc | Python | akihanari/AtCoder | /ABC166/C.py | UTF-8 | 280 | 2.8125 | 3 | [] | no_license | # coding: utf-8
N, M = map(int, input().split())
H = list(map(int, input().split()))
lst = [1 for i in range(N)]
for i in range(M):
A, B = map(int, input().split())
if H[A-1] <= H[B-1]:
lst[A-1] = 0
if H[B-1] <= H[A-1]:
lst[B-1] = 0
print(sum(lst))
| true |
ff23e601a54f2e5493f2aa3968ae4a2f2dec953a | Python | Harsh-2420/airbnb | /main.py | UTF-8 | 1,246 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
tr_filepath = "/Users/harshjhunjhunwala/Desktop/github_datasets/airbnb_data/train_users_2.csv"
df_train = pd.read_csv(tr_filepath, header=0, index_col=None)
te_filepath = "/Users/harshjhunjhunwala/Desktop/github_datasets/airbnb_data/test_users.csv"
df_test = pd.read_csv(te_filepa... | true |
3b450a31d1aa9dede545daf25d14ed02e03afc54 | Python | marcoguastalli/my_python | /app_prices/app_prices.py | UTF-8 | 6,223 | 2.640625 | 3 | [
"MIT"
] | permissive | import asyncio
import os
import sys
import time
from datetime import datetime
import aioschedule as schedule
from colorama import Fore, Style
from bnc_api_client.get_ticker import GetTicker as BncGetTicker
from cdc_api_client.get_ticker import GetTicker as CdcGetTicker
from db_client.create_connection import create_c... | true |
706ea0454e479715615d66febf2c0b53064ea913 | Python | Kenjart/Phonebook-Program | /phone_module.py | UTF-8 | 569 | 2.6875 | 3 | [] | no_license | """
Module containing phone numbers
"""
a = ("Joe's Mining Company main contact hotline (mincrft) : 1-800-4206-9133")
b = ("Sydney's Beauty Inc customer support hotline (not an MLM we swear) : 1-800-1234-5678")
c = ("Dave's Gas Company secondary contact hotline (ruining the enviroment one day at a time) : 1-800-... | true |
7e5c4df9e52aa06b68ec309343aac3a504375f4b | Python | aliash98/CS229-Stanford-Problems | /Problem-Set-1/Problem-1-b/main.py | UTF-8 | 2,851 | 3.140625 | 3 | [] | no_license | import utility
import numpy as np
def main():
epsilon = 0.00000001
directory = './data/ds1_train.csv'
x_1, x_2, y = utility.load_csv(directory)
x_inputs = np.array([x_1, x_2])
x_1 = np.array(x_1)
x_2 = np.array(x_2)
y = np.array(y)
# -------- Data set is ready in array --------
t... | true |
c21c9afb55f3a90383ff0364c9277a96d61e95df | Python | tarikaltuncu/distanceclosure | /distanceclosure/dijkstra.py | UTF-8 | 17,299 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Dijkstra algorithm
===================
Implementation of a generalized version of the Dijkstra algorithm using Heap Queue and multiprocessing to compute transitive closure.
This algorithm uses a modification to the path length to compute both `metric` and `ultrametric` closure.
Warning:
T... | true |
7e8d11a5d1107a7ac16885ec7979663be8b3df1c | Python | shenbakeshk/parking-lot | /parking_lot/parking_lot_builder.py | UTF-8 | 2,158 | 2.953125 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from parking_lot.parking_lot import FourWheelerParkingLot, ParkingLot
from parking_lot.parking_spot import FourWheelerSpot
class ParkingLotBuilder(ABC):
@abstractmethod
def add_four_wheeler_parking_spots(self):
pass
@abstractmethod
def init_parking_lot_dat... | true |
3c239dc4dc321b7a4ba96b1b84a1bb890a6ea523 | Python | aleksanb/MastersThesis | /a.py | UTF-8 | 1,277 | 3.328125 | 3 | [] | no_license | optimumsP3 = [(5, 10), (10, 20), (15, 30), (15, 40), (30, 50), (30, 60), (40, 70), (50, 80), (50, 90), (55, 100)]
optimumsP5 = [(15, 30), (20, 40), (20, 50), (30, 60), (30, 70), (40, 80), (45, 90), (50, 100), (55, 110), (60, 120), (70, 130), (70, 140)]
optimumsD3 = [(2, 5), (5, 10), (5, 15), (10, 20), (10, 25), (15, ... | true |
4ec504497373c60c2a7f1a82a175460c4c56926b | Python | FWSquatch/tk-mosquitto | /mq1.py | UTF-8 | 641 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python3
# Simple MQTT client that subscribes to a topic and prints messages
import paho.mqtt.client as mqtt
myBroker = 'XXX.XXX.XXX.XXX' # Your MQTT Server address goes here
def on_message(myClient, obj, msg):
print('Message in topic:',msg.topic)
print('Message:',msg.payload.decode('UTF-8'))
myCl... | true |
82550cb7970b1107b09bbd650ff339f9d84c28af | Python | Aryia-Behroziuan/optmization | /lambda.py | UTF-8 | 134 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 6 06:02:48 2019
@author: Faradars-pc2
"""
x = lambda a : a + 10
print(x(50)) | true |
1234acf6de539d852af172af681c3d9b4f57ada7 | Python | stoltzmaniac/LegLobber | /bill_grabber.py | UTF-8 | 1,855 | 2.859375 | 3 | [
"MIT"
] | permissive | import json
from urllib.parse import urlencode
from urllib.request import urlopen
import pandas as pd
# using the legiscan api: https://legiscan.com/legiscan (free tier)
api_creds = json.load(open('api_credentials.json'))
legiscan_token = api_creds['LEGISCAN_TOKEN']
base_url = "https://api.legiscan.com/?"
def get_b... | true |
9d9545044966e3692b6d73cedf68611a63ba1967 | Python | mcxu/code-sandbox | /PythonSandbox/src/leetcode/lc443_string_compression.py | UTF-8 | 2,771 | 3.421875 | 3 | [] | no_license | # https://leetcode.com/problems/string-compression/
class Solution:
def compress(self, chars) -> int:
charsOrigLen = len(chars)
count = 1
lo = 0
hi = 0
i = 0
while i < len(chars)-1:
#print("--- i=",i)
char = chars[i]
nextchar = cha... | true |
5bad1def000baf31bcec4099c2bd915e1758a67b | Python | misha-sauchuk/python130218-HW1 | /homework_11/ex11_02.py | UTF-8 | 7,789 | 3.9375 | 4 | [] | no_license | """ะ ะตะฐะปะธะทะพะฒะฐัั ะฟัะพะณัะฐะผะผั ะฟะพะดััะตัะฐ ะฟะปะพัะฐะดะธ, ะฟะตัะธะผะตััะฐ, ะพะฑัะตะผะฐ ะณะตะพะผะตััะธัะตัะบะธั
ัะธะณัั
(ััะตัะณะพะปัะฝะธะบ, ะฟััะผะพัะณะพะปัะฝะธะบ, ะบะฒะฐะดัะฐั, ััะฐะฟะตัะธั, ะพะบััะถะฝะพััั).
ะัะปะธ ะพะดะฝะฐ ะธะท ัะธะณัั ะฝะต ะฟะพะดะดะตัะถะธะฒะฐะตั ะฒััะธัะปะตะฝะธะต ะพะดะฝะพะณะพ ะธะท ัะฒะพะนััะฒ, ะฒ ะฟัะพะณัะฐะผะผะต ะดะพะปะถะฝะพ ะฑััั ะฒัะทะฒะฐะฝะพ ะธัะบะปััะตะฝะธะต
ั ัะตะปะพะฒะตะบะพ-ัะธัะฐะฑะตะปัะฝัะผ ัะพะพะฑัะตะฝะธะตะผ ะธ ะบะพััะตะบัะฝะพ ะพะฑัะฐะฑะพัะฐะฝะพ."""
# impor... | true |
80e85f71529219b1dcf3cc01f69f8cb64898e96a | Python | zointblackbriar/QuestionAnswering | /AlgorithmQuestionAnswering/ParseTree/matcher.py | UTF-8 | 7,787 | 3.109375 | 3 | [
"MIT"
] | permissive | #Reference: https://github.com/ayoungprogrammer/Lango
from nltk import Tree
import logging
logger = logging.getLogger(__name__)
class MatcherContext():
def __init__(self):
pass
def match_rules(self, tree, rules, functionCalls=None, allMatchedContext=False):
"""Matches a Tree Structure with th... | true |
3a330602dba98d746300ab16b66b5db00842483e | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_74/1265.py | UTF-8 | 2,815 | 2.671875 | 3 | [] | no_license | import math
import sys
class node():
def __init__(self):
b_action = None
o_action = None
def main():
case = 1
passed_first = False
for l in sys.stdin:
if passed_first == False:
passed_first = True
continue
l = l.strip()
l2 = l.split(' ')
line = ""
for i in range(1, len(l2), 2):
line += ' ... | true |
99ead79577d0951db4787aaf5653dae911dc967b | Python | LiorAvrahami/surface-tension-measurement-project | /cropped photos/draw_all.py | UTF-8 | 735 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import os
import addcopyfighandler
for fn in sorted(os.listdir()):
if os.path.splitext(fn)[1] != ".png":
continue
data = plt.imread(fn)
point_f_name = os.path.join(os.path.dirname(fn), os.path.splitext(os.path.split(fn)[1])[0] + "edge_point_data.txt")
with open(... | true |
6654f7447789b6a364b81c137b73de87585acaaa | Python | liyingxuan89/whetherCollect | /whetherCollect.py | UTF-8 | 1,313 | 2.703125 | 3 | [] | no_license | #!/bin/env python
import urllib
import urllib2
import sys
import os
from lxml import etree
import pandas as pd
import numpy as np
def parser(html):
content = etree.HTML(html)
pattern = '//div[@class="observation-table"]'
head = pattern + "//thead"
body = pattern + "//tbody"
data = content.xpath(head)
if... | true |
424a86a16cf59c3b572bd4ea33f8fd70cd9e19ac | Python | Sebuliba-Adrian/SelfLearningClinic-Day3 | /WordCountLab/app/wordcount.py | UTF-8 | 903 | 4.40625 | 4 | [] | no_license | def words(text):
"""Check for a string in the text sentence"""
if isinstance(text, str):
#Split the sentence by the spaces assign each string to variable words
words = text.split()
#Create a dictionary word_dicts that will store the word count
wordsDict = dict()
#Loops ... | true |
fdb63b65ee401c1fad9a6f321f3b9ba4a8f254f4 | Python | louisza/CarND-Behavioral-Cloning-P3 | /model.py | UTF-8 | 13,897 | 2.734375 | 3 | [] | no_license | from keras.models import Sequential, Model
from keras.layers.core import Dense, Activation, Flatten, Dropout, Lambda
from keras.layers.convolutional import Convolution2D, Conv2D
from keras.regularizers import l2
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, Callback
from sklearn.model_s... | true |
e59317e64e8cf270c6c28d59ee52874ecf83dedd | Python | abusamrah2005/Python | /Week-5/Day-29.py | UTF-8 | 584 | 4.4375 | 4 | [
"Unlicense"
] | permissive | # # Python Week-5 Day-29
# Python Loops 2
print("---- The For Loops ----")
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
print("--- Looping Through a String ----")
for x in "cherry":
print(x)
print("--- The break Statement ---")
fruits = ["apple", "banana", "cherry"]
for x in fruits:... | true |
efc24a5dbaa9c91ab42e59e907a2a2b0643bb57e | Python | mengqi0315/predict_car_sales_price | /workspace_for_python/Day04/2.็ปงๆฟ.py | UTF-8 | 563 | 4.5 | 4 | [] | no_license | # ็ปงๆฟ๏ผๅญ็ฑป็ปงๆฟ็ถ็ฑป๏ผๅ
ฑไบซ็ถ็ฑป็ๅฑๆงๅๆนๆณ๏ผๅนถไธ่ชๅทฑๅฏไปฅๅๆฉๅฑ
class Dog:
def __init__(self,name):
self.name = name
print('ๆ็็ฑป็ๆ้ ๆนๆณ')
def eat(self):
print('%s็ๅไธ่ฅฟ'%(self.name))
class XTQ(Dog): # ่ฎฉXTQ็ฑป็ปงๆฟDog็ฑป
def eat(self): # ๆนๆณ็้ๅ
print("%s็ๅ่ ๆก"%(self.name))
xtq=XTQ("ๅฎๅคฉ็ฌ")
print(xt... | true |
4a58005e8f6a81e98f01fdaee5556eae41f037fc | Python | DemiFr/SD201 | /TP/TP1102_YantingLI/kFoldCross.py | UTF-8 | 2,268 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 2 09:25:59 2016
@author: yali
"""
import numpy as np
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction.text import CountVectorizer,TfidfVectorizer
from sklearn import datasets
from sklearn import svm
import random
import sklearn as sk
dataFi... | true |
15aeadc7c95e1b8a9bda474da4e5cff0c00a2e82 | Python | songlin1994/my-edu | /day02/list_demo.py | UTF-8 | 1,856 | 4.28125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# ๅ
็ด
alist = [ 'ๆต่ฏ',2,'ไฝ ๅฅฝ',6,'test',1,3.2 ]
# list็่ฏปๅ,ๅ็
def list_sel():
# ้่ฟ็ดขๅผ/ไธๆ ๅๅ
็ด
# ๆญฃๅบๅ ไป้ถๅผๅงๆฐ
print(alist[0])
# ๅๅๅ ไป-1 ๅผๅงๆฐ
print(alist[-1])
# ๅ็
print(alist[1:5])
# list ๅๆ
print(alist[::-1])
def list_del():
# list.pop() : ้ป่ฎคๅ ๆๆๅไธไฝๅ
็ด , ๅนถ่ฟๅๅ ้ค็้ฃไธชๅ
็ด
... | true |
f1800374a377ddeac58775ec269657755ce2efc2 | Python | boffomarco/InternshipCode | /RapidMinerCode/DL2Alloy/DL2Alloy3.py | UTF-8 | 15,783 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# [TODO] Fix the encoding issues
# Based on:
# https://www.researchgate.net/publication/272763162_A_Non-Standard_Approach_for_the_OWL_Ontologies_Checking_and_Reasoning
# https://www.researchgate.net/publication/252772655_Model_Generation_in_Description_Logics_What_Can_We... | true |
04f05c52318f97199e22f3c90ae3a0692e21220c | Python | lishuhuakai/demo | /key_arg.py | UTF-8 | 509 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
def person(name, age, **kw):
if 'city' in kw:
pass
if 'job' in kw:
pass
print('name', name, 'age', age, 'other', kw)
person('Mick', 30)
person('Jack', 40, city='Beijing')
person('Adam', 45, gender='M', job='Engineer')
extra = {'city':'ไธๆตท', 'job':'็จๅบ็ฟ'}
person('Tiger', 29, **extra)
person(... | true |
23c2577ab37b2e649a1d649bbc5e25279d43ecc0 | Python | Brockfrancom/pythonProjects | /src/pythonBasics/lotteryGame.py | UTF-8 | 1,043 | 4.21875 | 4 | [] | no_license | """
Brock Francom
A02052161
CS-1400-001
Douglas Galarus
2/15/2018
hw6 - Exercise 5.34
"""
def run():
#import random and assign variables
import random
lotteryDigit1 = 0
lotteryDigit2 = 0
#loop is used to generate 2 different digits
while lotteryDigit1 == lotteryDigit2:
lotte... | true |
ae529cf4dea7a39bc7612fd47bc13a021950ec9e | Python | rharshith2410/filename-extension | /Filename.py | UTF-8 | 281 | 3.203125 | 3 | [] | no_license | filename = input("enter the filename")
ext = filename.split('.')
def checkKey(dict,key)
if key in dict:
print("extension of file is:" , dict[key])
else:
print("no such file exists!")
dict = { "py":"python , "txt":"text" , "zip":"zipfile")
key = ext[1]
checkKey(dict, key)
| true |
0f44eef2c0c42b24cd1c7d0e7326f3fc394e3f21 | Python | ryu577/survival | /survival/distributions/weibull.py | UTF-8 | 18,401 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.stats import exponweib
from survival.misc.sigmoid import *
from survival.distributions.basemodel import *
from survival.optimization.optimizn import *
from survival.misc.sigmoid import *
from survival.distributions.basemodel import *
from survival.optimization.optimizn import *
from scipy.... | true |
5625d31ee3043ab332ee572d705d8f09c2291897 | Python | LuoBingjun/LeetCode-Solutions | /5.longest-palindromic-substring.py | UTF-8 | 929 | 3.5625 | 4 | [] | no_license | #
# @lc app=leetcode id=5 lang=python3
#
# [5] Longest Palindromic Substring
#
# @lc code=start
class Solution:
def longestPalindrome(self, s: str) -> str:
n = len(s)
if n == 0:
return ""
res = s[0]
def extend(i, j, s):
while(i >= 0 and j < n and s[i] == s[j]... | true |
d92c8b0e4f4790b18876e2393b44a5c838024014 | Python | keshav143420/AllCodeRhythms | /test/codejam/gcj2020/qual_round/test_vestigium.py | UTF-8 | 864 | 2.8125 | 3 | [] | no_license | import unittest
import codejam.gcj2020.qual_round.vestigium as vestigium
class VestigiumTestCase(unittest.TestCase):
def setUp(self) -> None:
self.vestigum = vestigium.Vestigium()
def test_get_result_sample_data_4d(self):
n = 4
arr = [[1, 2, 3, 4],
[2, 1, 4, 3],
... | true |
006e84a338d3021ea2338ab41a4441cf340a03ab | Python | wangyy161/DDPG_CNN_Pendulum_practice | /7_CartPole_IQN.py | UTF-8 | 10,268 | 2.6875 | 3 | [] | no_license | # Cartpole
# State -> x, x_dot, theta, theta_dot
# Action -> force (+1, -1)
import datetime
import random
import gym
import matplotlib.pyplot as plt
import numpy as np
# Import modules
import tensorflow as tf
env = gym.make('CartPole-v0')
game_name = 'CartPole'
algorithm = 'IQN'
# Parameter setting
Num_action = 2
... | true |
6575b2789a09bc59f0c072557b05c70fac838474 | Python | AlexisDongMariano/leetcode | /1678 - Goal Parser Interpretation.py | UTF-8 | 1,162 | 4.15625 | 4 | [] | no_license | # ==============================
# Information
# ==============================
# Title: 1678 - Goal Parser Interpretation
# Link: https://leetcode.com/problems/goal-parser-interpretation/
# Difficulty: Easy
# Language: Python
# Problem:
# You own a Goal Parser that can interpret a string command. The command... | true |
b3919810426cd5266054317480371bb34a78c4c2 | Python | vendetta546/codewars | /Python/Authored/scooby.py | UTF-8 | 538 | 3.3125 | 3 | [] | no_license | def scoobydoo(villian, villians):
villian = villian.lower()
# Step 1 - Rotate Right by 5
villian = ''.join(shift(villian, 5))
# Step 2 - Reverse
villian = villian[::-1]
# Step 3 - Change even letters by 5
badguy = ""
num = 0
for le in villian:
num += 1
if num % 2 =... | true |
a804ed4b6ef38c0fcb871bcd749ce2af86cabcf9 | Python | beasonshu/XX-Net | /code/default/lib/tests/test_utils.py | UTF-8 | 597 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
import utils
class TestIP(unittest.TestCase):
def test_check_ipv4(self):
host = 'bat-bing-com.a-0001.a-msedge.net.'
res = utils.check_ip_valid4(host)
self.assertFalse(res)
def test_private_ip(self):
ip = 'bat-bing-com.a-0001.a-msedge.net.'
res = utils.... | true |
3b0813a6dca995d3841b310b01b88b464e33c125 | Python | aidsfintech/Algorithm-and-Query | /Algorithm/python/algorithmjobs/thursdaytest/210401/04(veryimportant)baseballgame.py | UTF-8 | 2,307 | 3.046875 | 3 | [] | no_license | import sys
# int 1, str '1' ๋ชจ๋ ์ถ๋ ฅ๋๋ฉด 1์ด๋๋ผ....
# ์ ์ ํ ์ด๊ธฐํ ์์น์ ๊ธฐ๋ณธ๋ฌธ๋ฒ์ธ ์๋ฃํ....
# ํ์ด์ฌ ํ๋ฉด ๋ณ์์ ๋ํ ๊ฐ๊ฐ์ด ๋ฌด๋์ง๋๋ฐ, ๊ทธ๋ฅ C ํธํ์ํ๋ก ์๊ฐํ์
def makeallcases(depth,case,limit):
global allcases
# print(depth,case)
if(depth>=limit):
# print('ck')
# fucking shellow copy, cuz to case=[depth]=0 when at the last all case is become [0... | true |
34799bc29d6d81d47f9b21a93f9155b597f6587c | Python | johnqh/Sudoku-Solver | /codes/solver.py | UTF-8 | 1,426 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 10 09:40:39 2020
@author: omer.eker
"""
from single_candidate import single_cand
from hidden_singles import hidden_singles
from hidden_pairs_triples_quads import hidden_pairs_triples, hidden_quads
from naked_pairs_triples_quads import naked_pairs_triples, naked... | true |
a7a0b378a75f63df2e844a97b819c5365a8b586d | Python | chaobiubiu/RMAX-KNN | /rmax_knn_td_test_pendulum.py | UTF-8 | 2,136 | 2.546875 | 3 | [] | no_license | #different k in pendulum
from rmax_knn_td import *
from rmax_knn_td_pendulum_part import *
from rmax_knn_td_part2 import *
import gym
import matplotlib.pyplot as plt
x1=[]
y1=[]
x2=[]
y2=[]
x3=[]
y3=[]
x4=[]
y4=[]
x5=[]
y5=[]
def BenchmarkExperiment(Episodes,k,x,y):
print()
print('- - - - - -')
print('INI... | true |
84d27f8c7a432377b206ba4a7b206adf8a5713e8 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2811/60827/317909.py | UTF-8 | 251 | 3.0625 | 3 | [] | no_license | p,n=[int(x) for x in input().split()]
dic ={}
c = 0
for i in range(int(n)):
value = int(input())
address =value % p
if address in dic:
print(i+1)
c= i
break
else:
dic[address]=value
if c==0:
print(-1)
| true |
3da7eb145850222a1bd85c438219433845ae485f | Python | zhouziling/sign_language_robot | /dual_ur5_control/script/pyswarms_example.py | UTF-8 | 921 | 2.71875 | 3 | [] | no_license | # Import modules
import numpy as np
import matplotlib.pyplot as plt
import math
# Import PySwarms
import pyswarms as ps
from pyswarms.utils.functions import single_obj as fx
# create a parameterized version of the classic Rosenbrock unconstrained optimzation function
def get_a_cost_val(x):
f = float(input("Inpu... | true |
8a8f23d60cc0b833c0250eb8122f6fdc14e95279 | Python | mark-styx/development_management_platform | /classes/gui/mk_btn.py | UTF-8 | 4,207 | 2.703125 | 3 | [] | no_license | from tkinter import Button,Label
class Btn():
def __init__(
self,parent,loc,size=(100,20),txt=None,img=None,
cmd=lambda:print('undefined'),
deact_cmd=lambda:print('undefined'),
label=False,label_loc='left',label_txt=None,toggle=False,
border=True,alt_clr... | true |
09082c005808b70e56e1cfa9120f6f696c1bc425 | Python | michaelstchen/machinelearn-course | /hw4 - Ridge and Kernel Logistic Regression/code/prob3_5.py | UTF-8 | 1,938 | 2.765625 | 3 | [] | no_license | import numpy as np
import math
import csv
import matplotlib.pyplot as plt
from scipy.io import loadmat
from sklearn.preprocessing import scale, binarize
def kernel_mat(X1, X2, deg, rho):
K = np.dot(X1, X2.T) + rho
return K**deg
def sig(x):
return 1 / (1 + np.exp(-x))
def risk(K, a, y):
sig_Ka = sig(n... | true |
40b701ae2c6f150e44a69adbb4841133696fdd9d | Python | Suraj124/python_practice | /16-03-2019/lec_48.py | UTF-8 | 141 | 3.4375 | 3 | [] | no_license | def display(fun):
return "hello "+fun()
def name():
return "Smith"
print(display(name)) #passing name function in display function | true |
eb702ddbe25b9042ded6d109681a393c652c1c90 | Python | smjedael/python-challenge | /PyParagraph/main.py | UTF-8 | 1,848 | 3.6875 | 4 | [] | no_license | #PyParagraph Script
#Import modules
import os
import re
#Request path and filename of data file
filepath = input('Please enter path and filename of data file (e.g. "datafolder/datafile.txt"): ')
#Declare and initialize variables to store data
sentences = []
words = []
letter_counts = []
#Open Text file and perform o... | true |
02f25e0e8cf290b59768ccc6312eb260b0ec9e6f | Python | t8toel00/Valvo | /Raspi/Valvo/detect_faces.py | UTF-8 | 4,521 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# This script will stay running and snap a picture when needed.
import cv2
from cv2 import *
import os
import datetime
if not os.path.exists('snapshots'):
os.mkdir('snapshots')
class cvCam():
def __init__(self):
# Create the haar cascade
self.faceCascPath = "haarcas... | true |
1534e4f903f08f3e62ea03a0f68f1400cddfe271 | Python | MihailoJoksimovic/cs6006-implementations | /ctci/3_4.py | UTF-8 | 1,226 | 4.28125 | 4 | [] | no_license | # Task: Implement Queue using Two stacks
# Idea: Move one stack to another and pop from another -- that's how we get a queue.
# Optimal solution: don't move back until needed
from ctci.common.classes import *
class QueueWithStacks:
def __init__(self):
# Stack used when adding elements
self.inser... | true |
ccb38fe35983a76f5ec43fd067c6498ccf6e9d6a | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2953/60717/266971.py | UTF-8 | 278 | 3.046875 | 3 | [] | no_license | def gcd(a,b):
count=0
if b==0:
return [a,count]
tmp=gcd(b,a%b)
count=int(a/b)+tmp[1]
return [tmp[0],count]
n=int(input())
output=2**20
for i in range(1,n+1):
tmp=gcd(n,i)
if tmp[0]==1:
output=min(output,tmp[1]-1)
print(output,end='') | true |
4ef8e6e2a095d8858a47cf46de5f69bc609581ad | Python | SKTPausanias/machine_learning_bootcamp-42AI | /day04/ex05/linear_cost_reg.py | UTF-8 | 1,162 | 3.484375 | 3 | [] | no_license | import numpy as np
def reg_cost_(y, y_hat, theta, lambda_):
"""Computes the regularized cost of a linear regression model from two non-empty
,โ numpy.ndarray, without any for loop. The two arrays must have the same dimensions.
Args:
y: has to be an numpy.ndarray, a vector of dimension m * 1.
y_hat: has to be an n... | true |
8d40ad392d2d2b68e06f02f9209c9bbaa2dada57 | Python | QuantLet/MVA | /QID-1530-MVAscabank56/MVAscabank56.py | UTF-8 | 632 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
x = pd.read_csv("bank2.dat", sep = "\s+", header=None)
x56 = x.iloc[:,4:]
x1 = [1] * 100
x2 = [2] * 100
xx = x56.copy()
x1.extend(x2)
xx["x1x2"] = x1
fig, ax = plt.subplots(figsize = (10, 10))
ax.scatter(xx.iloc[:100,0], xx.iloc[:100,1], c = "w",... | true |
ef85a2bcc0206d09c0ddb6e04128cc0f6d31e806 | Python | pillumina/pset4_RRT | /2a.py | UTF-8 | 1,270 | 3.703125 | 4 | [] | no_license | import random
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
# function to find the distance between 2 points
def get_distance(point1, point2):
if len(point1) != 2 or len(point2) != 2:
return 'please provide x,y coordinates for each point'
x_1 = point1[0]
... | true |
52d07b34c0729e322a6441358c67d27ca074f541 | Python | SNJIAWEI/elastic | /cn/Test.py | UTF-8 | 217 | 2.859375 | 3 | [] | no_license | import datetime
TIME_FMT_YMD = '%Y-%m-%d'
# today = datetime.date.today().strftime(TIME_FMT_YMD)
yestoday = (datetime.date.today() - datetime.timedelta(days=1)).strftime(TIME_FMT_YMD)
# print(today)
print(yestoday) | true |
c572cf19444d2c75ecfd29ebc05e50b2cf469177 | Python | almazgf/parser | /2_add_data_bd.py | UTF-8 | 446 | 2.703125 | 3 | [] | no_license |
from pymongo import MongoClient
import json
# ะงัะตะฝะธะต ะดะฐะฝะฝัั
ะธะท ัะฐะนะปะฐ
filename = 'goods.json'
rite_file = open(filename, mode='r', encoding='UTF-8')
list_goods = json.load(rite_file)
rite_file.close()
# ะกะพะทะดะฐะฝะธะต ะฑะด ะธ ะดะพะฑะฐะฒะปะตะฝะธะต ะดะฐะฝะฝัั
ะฒ ะฑะด
client = MongoClient('localhost', 27017)
db = client.barcode
co... | true |
7652fdcef23173ba4d57ee37393a0b632c36c61e | Python | CarlosFdez/pytmi | /pytmi/message.py | UTF-8 | 818 | 3.015625 | 3 | [
"MIT"
] | permissive | from .user import User
class Message:
"""Represents a user message in the twitch message interface.
Attributes
-------------
channel: :class:`str`
The channel the message was sent from
content: :class:`str`
The text content of the message
author: :class:`User`
The :... | true |
ab155c1923babc240108d0b4e9ce85aa9dd51b04 | Python | barium-project/barium | /lib/clients/gui/q_custom_text_changing_button.py | UTF-8 | 2,240 | 3.109375 | 3 | [] | no_license | from PyQt4 import QtGui, QtCore
class TextChangingButton(QtGui.QPushButton):
"""Button that changes its text to ON or OFF and colors when it's pressed.
"""
def __init__(self, button_text, parent=None):
"""
NOTE: when both labels and addtext are not None, labels take
precedence.
... | true |
b454e7d70f05b7837c2e3a6babb7f6f49885d471 | Python | qiaokangqi/wifi_robot | /cmd_receiver.py | UTF-8 | 3,222 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import threading
import struct
import os
import time
import types
class CmdReceiver(object):
cmd_reception_socket = None
host_addr = None
def __init__(self, host_addr = ('', 7997)):
self.host_addr = host_addr
self.cmd_reception_s... | true |
25f4f9f6d41b8c0498bbb557c2de7025b296aa52 | Python | jmalisano/Using_Python_for_Research | /Case Studies/GPS Tracking/GPS Tracking.py | UTF-8 | 2,671 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 25 16:01:01 2020
@author: Flat J
"""
import pandas as pd
birddata = pd.read_csv("bird_tracking.csv")
import matplotlib.pyplot as plt
import numpy as np
ix = birddata.bird_name == "Eric"
x, y = birddata.longitude[ix],birddata.latitude[ix] #indexing using a boolean
plt... | true |
ffcdef98cf92b608ac8fbd14b188712de0375a96 | Python | izeus1/python-practice | /test.py | UTF-8 | 112 | 3.03125 | 3 | [] | no_license | s = '/usr/local/bin/python'
l = s.split("/")
for i in l[1:]:
print("'{0}'".format(i), end=" ")
print(" ")
| true |
5e02316b9ae10f2c130fe1c653f3c16863e5bdc3 | Python | jkamuda/protomonk | /src/game.py | UTF-8 | 2,413 | 2.8125 | 3 | [] | no_license | __author__ = 'jkamuda'
import os
import pygame
import constants
from src.sound import SoundManager
from menu import Menu
from overhead import Overhead
from game_state import GameState
from src.load_screen import LoadScreen
from game_info import GameInfo
from src.mario_game import MarioGame
from game_over_screen impo... | true |
d79866cf3848800f3d07aab109fc0603f981d824 | Python | johannbzh/Cracking-The-Coding-Interview-Python-Solutions | /recursion_and_dp/stackOfBoxes.py | UTF-8 | 825 | 3.171875 | 3 | [] | no_license | from collections import namedtuple
def stackOfBoxes(boxes):
def helper(bottom, top, h, num_boxes_left):
if not top :
return
for i in range(num_boxes_left):
box = top[i]
if not bottom or (bottom[-1].w > box.w and bottom[-1].h > box.h and bottom[-1].d > box.d):
... | true |
2cc17b94ccd762106c5551b5f48e2d30f04bcca8 | Python | thehardwareguy2000/Weather-Analysis- | /BDA_Weather_analysis.py | UTF-8 | 3,955 | 3 | 3 | [
"MIT"
] | permissive | from google.colab import drive
drive.mount('/content/drive')
from pyspark import SparkContext
from google.colab import drive
from pyspark.sql import SQLContext, Row
import pyspark.sql.functions as sqlf
# Create a Spark Context
sc = SparkContext.getOrCreate()
# Create a sql context
sqlc = SQLContext(sc)
# Analysis on... | true |
61f555d1f4ceb4ddd942489c86675994d7fdc305 | Python | Abhijeet198/Python-Program | /45.Check whether a string contains all letters of the alphabet.py | UTF-8 | 342 | 4 | 4 | [] | no_license | # 45.Check whether a string contains all letters of the alphabet
import string
alphabet = set(string.ascii_lowercase)
input_string = 'The quick brown fox jumps over the lazy dog.'
print(set(input_string.lower()) >=alphabet)
input_string = 'The quick brown fox jumos over the lazy cat.'
print(set(input_string.l... | true |
4513d66dd95e7562f206159d51d65573620f0d08 | Python | areshta/python-edu | /misc/by_ref.py | UTF-8 | 103 | 3.265625 | 3 | [] | no_license | def fun1():
i = 1
fun2(i)
print ("i=", i)
def fun2(i):
ii = i
ii += 1
print ("ii=", ii)
fun1()
| true |
60f946df1ae8191961fecf00c6d07bdf437dd15f | Python | learningpeople/PythonTest | /python_test/tcp_udp/udp.py | UTF-8 | 639 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
import socket
#ๅๅปบsocket๏ผUDP่ฟๆฅ๏ผSCOVK_DGRAM๏ผ
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#็ปๅฎ็ซฏๅฃ๏ผไธ้่ฆ่ฐ็จlisten()ๆนๆณ๏ผ็ดๆฅๆฅๆถๆฅ่ชไบบๅๅฎขๆท็ซฏ็ๆฐๆฎ
s.bind(('127.0.0.1',9998))
print 'Bind UDP on 9998 ...'
while True:
print s.recvfrom(1024),s.recvfrom()
print s.recv()
data,addr = s.re... | true |
d7ea825537dfa9516945d7b97fda8007defb703f | Python | Nadunnissanka/day-4-Random-List-in-python | /coin-toss.py | UTF-8 | 122 | 3.453125 | 3 | [] | no_license | import random
coin_random = random.randint(0,1)
if(coin_random == 1):
print("It's Heads")
else:
print("It's Tails")
| true |
cdc5a67c66cb9f4727aac16d9f4cdda610c89691 | Python | jcchurch/PythonTutorial | /TurtleLesson2/ucodeshapes.py | UTF-8 | 687 | 4.03125 | 4 | [] | no_license | import turtle
def drawSquare(t, size):
t.down()
t.forward(size)
t.left(90)
t.forward(size)
t.left(90)
t.forward(size)
t.left(90)
t.forward(size)
t.left(90)
def moveUnderSquare(t):
t.up()
t.right(90)
t.forward(110)
t.left(90)
window = turtle.Screen()
def makeTurtle... | true |
5b9ab918b7c4a32b6341cfb4c001b1875ad945ae | Python | twangcode/eebb3 | /bb3_scanner.py | UTF-8 | 3,230 | 2.515625 | 3 | [] | no_license | import data_parser as dp
from os import listdir
from os.path import isfile, join
import numpy as np
import pandas as pd
import csv
import tuotools as tt
import time
FILEPATH = '/var/opt/lufgroup/apps/nova_lufcomp/novaStats_ma/data'
def generate_factor_dict(dict_location):
df = pd.read_csv(dict_location, header=None,... | true |
e8abb1536d0ef097ccc01ddaef0bc44db385af5f | Python | akhilabattula/Hotel-Review-Classification | /nbclassify.py | UTF-8 | 2,599 | 2.625 | 3 | [] | no_license | '''
Created on Jan 31, 2016
@author: akhila
'''
import glob
import os
import sys
import re
from fileinput import FileInput
from collections import OrderedDict
filedir=sys.argv[1]
#dp=open("","r")
word_dict=OrderedDict()
with open('nbmodel.txt', 'r') as f:
for line in f:
values=line.split(... | true |
fa4f6732e69f6bef03003daaa235529819faf260 | Python | christopher-a-johnson/Got-It | /libs/mailgun.py | UTF-8 | 1,446 | 2.625 | 3 | [] | no_license | import os
from typing import List
from requests import Response, post
class Mailgun:
FROM_TITLE = 'Pricing Service'
FROM_EMAIL = 'do-not-reply@sandbox29e1ff01c0be4282a0cfa1c0986a9fc7.mailgun.org'
@classmethod
def send_mail(cls, email: List[str], subject: str, text: str, html: str) -> Response:
... | true |
c49c15863e5c28f5b9842c47a1b409babac8d4f7 | Python | shants/LeetCodePy | /785.py | UTF-8 | 1,068 | 3.21875 | 3 | [] | no_license | class Solution(object):
def bfs(self, graph, color, s):
color[s]=0
q = []
q.append(s)
while(len(q)>0):
i = q.pop()
for j in graph[i]:
if color[j]==-1:
color[j]=1-color[i]
q.append(j)
else... | true |
1c99446177919262ba49d9b96d4b34885389571f | Python | zvxr/tickets | /app/cache.py | UTF-8 | 532 | 2.53125 | 3 | [
"MIT"
] | permissive | import redis
import app.config as config
_redis_client = None
_redis_client_pool = None
def get_client():
"""Return a client from the pool."""
global _redis_client
global _redis_client_pool
if _redis_client_pool is None:
_redis_client_pool = redis.BlockingConnectionPool(**config.REDIS)
... | true |
a2b86baf3de9e3c55cb00b738805827fa04540ea | Python | Tomaspereyra/Gamificando-Algoritmos | /Procesos Orientados al Desarrollo del Software/Proceso de implementaciรณn/GDA/negocio/DocenteABM.py | UTF-8 | 1,222 | 3 | 3 | [] | no_license | from negocio.UsuarioABM import UsuarioABM
from datos.Docente import Docente
from dao.DocenteDao import DocenteDao
class DocenteABM:
def __init__(self):
self.dao = DocenteDao()
def traerDocente(self, username):
usuario = UsuarioABM()
docente = None
if usuario.traerUsuario(user... | true |
ee26b19d995163c72f3c817352a48275245ae6cc | Python | aishwat/missionPeace | /graph/floydWarshall.py | UTF-8 | 838 | 3.5 | 4 | [] | no_license | INF = float('inf')
class Graph:
def __init__(self, vertices):
self.V = vertices
self.graph = []
def floydWarshall(self):
dist = [row[:] for row in self.graph]
for k in range(self.V):
for i in range(self.V):
for j in range(self.V):
... | true |
0d3ddb60cfca95c0edc5039a7333dc0ca753943e | Python | Mashakal/Minerva | /Minerva/luis/LuisInterpreter.py | UTF-8 | 7,672 | 2.953125 | 3 | [] | no_license | import InfoManager
import collections
# For development purposes only:
from Essentials import enter_and_exit_labels, print_smart
# Constants
# These may be better off in the Bot module.
_YES_WORDS = ['yes', 'yeah', 'okay', 'ok', 'k', 'y', 'ya', 'right', 'correct', "that's right", 'sure', 'for sure']
_NO_WORDS = ['no'... | true |
d374b7611ee1e8b1ad198fa0396653e774c73b87 | Python | soelves/portfolio | /IN1000/IN1000/Uke 5/temperatur.py | UTF-8 | 343 | 3.578125 | 4 | [] | no_license | def snitt(liste):
Sum = 0
for verdi in liste:
Sum += verdi
gjennomsnitt = Sum/len(liste)
print("Gjennomsnitt:", gjennomsnitt)
def hovedprogram():
temp = open("temperatur.txt", "r")
mnd=[]
for linje in temp:
mnd.append(float(linje))
print(mnd)
snitt(mnd)
temp.c... | true |
44f82b8873f51ebdd53ea9e221b9778e703faca3 | Python | MarcelTkacik/genderStereotypes | /pลฏv_child_books.py | UTF-8 | 850 | 3.125 | 3 | [] | no_license | import nltk
## when installing nltk, you will also need to install "wordnet" using nltk.download('wordnet')
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
file = open("/Users/tessacharlesworth/Desktop/Embeddings/Raw Data/Child_Books/child_books.txt", 'r')
outfile = open("/Users/tessacharleswor... | true |
300ae8eb219e0a1423626e9f270ce25a9753f1e7 | Python | NickHMC/LANL_2019_Clinic | /Pipeline/__init__.py | UTF-8 | 2,827 | 2.703125 | 3 | [] | no_license |
from importlib import __import__ as imp
import inspect
import os
import re
import sys
from pnspipe import PNSPipe
# This dictionary is used to register all available pipeline functions
_pipe_functions = {
x: [] for x in "preprocess;onsegment;postsegment;postprocess".split(';')}
def register_pipe_function(f):
... | true |
527eed9b3d79784d12e216f0a17240072168d91a | Python | hitechparadigm/Programming-for-Everybody | /conditional.py | UTF-8 | 139 | 3.734375 | 4 | [] | no_license | i = input('Enter Number')
if int(i) < 2:
print('Ok ',i)
if int(i) > 2:
print('Bigger than 2')
print('Done with i',i)
print('All Done')
| true |
4d57f3b17386847dc711e1e9610eec46c95a07fd | Python | pacomunuera/Concentrated_Solar_Power | /src/plot_results.py | UTF-8 | 7,671 | 3.078125 | 3 | [] | no_license | import os
import pickle
import matplotlib.pyplot as plt
from eda import *
from modeling_base import *
def get_pickle_files(dirpath):
'''
Reads all pickle files in dirpath in as dictionaries and returns a
list of dictionaries.
Parameters:
----------
dirpath : (str)
The absolute or rela... | true |
65cf1315505416074a5e00ce74bc25ed4379476f | Python | IronLanguages/ironpython2 | /Src/StdLib/Lib/test/test_import_magic.py | UTF-8 | 2,267 | 2.640625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | import imp
import sys
import unittest
# Note:
# In Python 3.x, this test case is in Lib/test/test_importlib/test_util.py
class MagicNumberTests(unittest.TestCase):
"""
Test release compatibility issues relating to precompiled bytecode
"""
@unittest.skipUnless(
sys.version_info.releaselevel ... | true |
4f410c062f8280f6243a1b7b7ce3fdb5c6006b0a | Python | bhatnitish1998/aps-2020 | /fenwick_tree_sum.py | UTF-8 | 492 | 3.53125 | 4 | [] | no_license | # Fenwick tree to calculate the sum in range queries
# Input : Update(index,value) array is 1 indexed
# qlr(left index, right index both inclusive) Note it is 1-indexed
# Output: qlr=The sum of elements in the range
#n= len(arr)
fenwik=[0]*(n+1)
def update(i,value):
global fenwik
global n
while(i<=n):
fen... | true |
7ba27718bef68aa07504735a996e6eaae94269d9 | Python | sympy/sympy | /sympy/ntheory/tests/test_primetest.py | UTF-8 | 8,937 | 2.59375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | from sympy.ntheory.generate import Sieve, sieve
from sympy.ntheory.primetest import (mr, _lucas_sequence, _lucas_selfridge_params, _lucas_extrastrong_params,
is_lucas_prp, is_square,
is_strong_lucas_prp, is_extra_strong_lucas_prp, isprime, is_eul... | true |
8352b60419772c1c0b83a0e68eb4d730b0213b01 | Python | hellJane/Python_DataAnalysis | /Optimization/curve_fit.py | UTF-8 | 1,395 | 3.234375 | 3 | [] | no_license | import numpy as np
import scipy.linalg as sl
import scipy.optimize as so
import sklearn.linear_model as slm
'''
้ช่ฏscipy.optimize.curve_fit()่ฟไธชๆนๆณ๏ผไธsklearnๅๅ
ฌๅผ็ธๆฏ่พ๏ผ็่ฎบไธ่ฆๆฏไธๆ ท็
'''
def randRange(vmin, vmax, size=20):
return vmin + (vmax - vmin) * np.random.rand(20)
def func(x, w0, w1):
'''
curve_fi... | true |
233485fb977254c86bece1e2b3c19c1aefe23203 | Python | minkpang/Damwha | /sub1/์ ์คํ/analyze.py | UTF-8 | 3,629 | 3.3125 | 3 | [] | no_license | from parse import load_dataframes
import pandas as pd
import shutil
def sort_stores_by_score(dataframes, n=20, min_reviews=30):
"""
Req. 1-2-1 ๊ฐ ์์์ ์ ํ๊ท ํ์ ์ ๊ณ์ฐํ์ฌ ๋์ ํ์ ์ ์์์ ์์ผ๋ก `n`๊ฐ์ ์์์ ์ ์ ๋ ฌํ์ฌ ๋ฆฌํดํฉ๋๋ค
Req. 1-2-2 ๋ฆฌ๋ทฐ ๊ฐ์๊ฐ `min_reviews` ๋ฏธ๋ง์ธ ์์์ ์ ์ ์ธํฉ๋๋ค.
"""
#stroes_reviews ๋ store ์ ๋ณด์ reviews ์ ๋ณด๋ฅผ ํฉ์น ํ
์ด๋ธ
... | true |
625c9b9fe150937e19ddcaa04a37e64515469604 | Python | zzzdeb/dotfiles | /scripts/tools/pdfsep.py | UTF-8 | 1,899 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import copy
import sys
import math
import PyPDF2
def split_pages(src, dst):
m = {'l':10, 'u':10, 'r':20, 'd':15}
src_f = open(src, 'r+b')
dst_f = open(dst, 'w+b')
input = PyPDF2.PdfFileReader(src_f)
output = PyPDF2.PdfFileWriter()
current = 1
for i in range(input.get... | true |
350fd9ea0312ae5d361c5c7f6522379d1bf602e0 | Python | raspibo/Thermo | /var/www/cgi-bin/mhl.py | UTF-8 | 2,636 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
## My HTML Library
#
""" ATTENZIONE: Non tutte le funzioni sono state testate/usate
alcune neanche fatte
Mon 23 Feb 2015 17:28:26 CET - Qualcosa e` stato fatto
"""
"""
Aggiornamenti: Sat 19 Mar 2016 08:31:19 AM CET
"""
## Blocchi per la costruzione della pagina web
# Html page
def My... | true |
6ca405462af7a356397c9ef911dde900fbe21705 | Python | lozdan/oj | /MOG/28.py | UTF-8 | 401 | 3.109375 | 3 | [] | no_license | # author: Daniel Lozano
# source: MatcomOnlineGrader (MOG) ( http://matcomgrader.com )
# problem name: Snail
# problem url: http://matcomgrader.com/problem/28/snail/
# date: 6/2/2017
def number_of_days(A, B, V):
result = (V - B) // (A - B)
if (V - B) % (A - B) != 0:
return result + 1
return result
... | true |
57ed04dd0df5800c724911850d80261e5fd1398d | Python | szymonsadowski3/Discord-Evaluate-Message-Positivity-Bot | /bot_extended.py | UTF-8 | 4,331 | 2.78125 | 3 | [] | no_license | import discord
from discord.ext import commands
import random
from textblob import TextBlob
import os
description = 'Bot'
bot_prefix = '?'
bot = commands.Bot(description=description, command_prefix=bot_prefix)
tts_lines = []
class Navy(object):
def read_lines(self, fname):
with open(fname... | true |
6effbac6a61df63927f0140debf4fcedb5470575 | Python | Official12345/year2_ALDS | /Week1/1.1.py | UTF-8 | 440 | 3.625 | 4 | [] | no_license | def mymax(a):
assert len(a) > 0
b = a[0]
for i in a:
assert type(i) == int or type(i) == float
if i > b:
b = i
return(b)
try:
mylist = [1, 2, 12, 3, 5, 7]
print(mymax(mylist))
except:
print("error test 1")
try:
mylist2 = []
print(mymax(mylist2))
except:... | true |
e50431fe5e9fdce50b74d365d4ad3a1056885848 | Python | missvicki/rnn | /gen_gbu.py | UTF-8 | 718 | 3.484375 | 3 | [] | no_license | """Generate sentiment analysis data."""
import numpy as np
VOCAB = ["good", "bad", "uh"]
VOCAB2 = ["one", "two", "three", "four", "five"]
def gen_gbu(nobs=1000):
"""Generate good/bad/uh data."""
data = []
sentiments = []
for _ in range(nobs):
num_positions = np.random.randint(5, 20)
... | true |
9f0de95f4d2af12c186c7ad19c0b3e2f91f14d62 | Python | codud0954/megait_python_20201116 | /13_module/quiz01/quiz01.py | UTF-8 | 324 | 3.4375 | 3 | [] | no_license | import random
lotto = list()
while (len(lotto) < 6): # ์ฐธ์ธ ๋์ ๋ฃจํ๊ฐ ๋๋ค.
randNum = random.randrange(1, 46) # 1 ~ 45
# ์ค๋ณต๋ ๋ฒํธ๊ฐ ๋์ค๋ฉด ๋ฐ์ ๋ด์ฉ์ ์ํํ์ง ์๊ณ ์กฐ๊ฑด์ ๋ณธ๋ค.
if randNum in lotto:
continue
lotto.append(randNum)
print(lotto)
| true |
fc23ed0c09c7628f091730ca74b7b253fb7c5e2f | Python | Dviejopomata/tfg | /celery/test.py | UTF-8 | 401 | 2.734375 | 3 | [] | no_license | from tasks import add
from celery import group
# se lanzar 100 tareas
for i in range(1, 100):
result=add.apply_async((i, i), )
print(i, result.get())
# se lanzan 4 tareas dentro de un grupo
numbers = [(2, 2), (4, 4), (8, 8), (16, 16)]
res = group(add.s(i, j) for i, j in numbers).apply_async(queue='priority.high... | true |
4895f6b9c346c4e9ef5c7de62a44119591de94e9 | Python | ciceropzr/DesafiosPython | /km.py | UTF-8 | 314 | 3.390625 | 3 | [] | no_license | '''
O valor de entrada contรฉm dois valores, em valor inteiro X, representatdo a ditรขncia percorrida (em Km),
e um valor real Y representando o tatal de combustivel gasto, com um digito apรณs a casa decimal.
'''
X = int(input())
Y = int(input())
consumoMedio = X / Y
print(str('%.3f' % consumoMedio) + ' Km/l') | true |
d462a5dafd84cacb2a92a9362a12859e0fdcdc1f | Python | aleksey-masl/hello_world | /even_numbers.py | UTF-8 | 72 | 2.828125 | 3 | [] | no_license | print(list(range(1, 1000, 2)))
for i in range(1, 1000, 2):
print(i) | true |