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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
346ce3d67528850c345261daf7aa158bc5860a33 | Python | Miguel235711/Competitive-Programming-3-Solutions-by-Miguel-Mu-oz- | /Section 1.4/Harder (mode tedious)/10363 - Tic Tac Toe/Python/main.py | UTF-8 | 402 | 3.078125 | 3 | [] | no_license | matrix=[[ '\0' for _ in range(3) ] for _ in range(3) ]
movs=[(1,0),(0,1),(-1,0),(0,-1),(-1,-1),(1,1),(1,-1),(-1,1)]
def main():
n=int(input())
for c in range(n):
if c:
input()
dif=0
for i in range(3):
for ch in input():
dif += -1 if ch == 'O' else... | true |
c797980767850b1191bc15eac28fa502c23682ed | Python | vilisimo/ads | /python/leetcode/easy/ex0000_0100/test/test_ex0066.py | UTF-8 | 1,135 | 2.859375 | 3 | [
"MIT"
] | permissive | import pytest
from leetcode.easy.ex0000_0100.ex0066 import InitialSolution, IterativeOnesComplimentSolution, IterativeReadableSolution
@pytest.mark.parametrize('input, expected', [
([1,2,3], [1,2,4]),
([4,3,2,1], [4,3,2,2]),
([1, 0], [1, 1]),
([8], [9]),
([9], [1,0]),
([3,9], [4,0]),
([3,9], [4,0]),
])
def te... | true |
2364b5ef677e319917542822bc10fd58e7090a2c | Python | Aasthaengg/IBMdataset | /Python_codes/p00005/s674913748.py | UTF-8 | 257 | 3.171875 | 3 | [] | no_license | def gcd(a,b):
if b == 0:
return a
else:
return gcd(b,a%b)
def lcm(a,b):
d = (a*b) / gcd(a,b)
print d
while True:
try:
x = map(int,raw_input().split(" "))
a,b = x[0],x[1]
print gcd(a,b),(a*b)/gcd(a,b)
except EOFError:
break | true |
422d30487859f5a722c8c2c195d24ed9b3a5b1d1 | Python | hawkjo/misctools | /misctools.py | UTF-8 | 3,674 | 3.3125 | 3 | [] | no_license | import sys
import os
import gzip
from itertools import izip_longest
from IPython.display import HTML
def get_gzip_friendly_open_fnc(*args):
"""
get_open_fnc returns the correct open function to use for file, gzip compatible.
Arguments:
Any number of file names, all of which are either gzipped or n... | true |
c3428c43aabfec70798967a4b884a152822d662f | Python | georggoetz/hackerrank-py | /Python/Regex and Parsing/hex_color_code.py | UTF-8 | 220 | 2.96875 | 3 | [] | no_license | # http://www.hackerrank.com/contests/python-tutorial/challenges/hex-color-code
import re
for i in range(int(input())):
m = re.findall(r'[^#]+(#(?:[A-f0-9]{3}){1,2})', input())
if m:
print('\n'.join(m))
| true |
19e93d439e13ff3b45e647470cb906270d4aa677 | Python | abrusebas1997/MadLibs | /madlibs.py | UTF-8 | 2,091 | 3.6875 | 4 | [] | no_license | # Here I used import random, so i can use it when I print my text
import random
# Here I added the color magenta in the output
import sys
sys.stdout.write("\033[0;35m")
print("Mad Libs!")
print("Enter an example of each")
0
#Here I used a for loop to make my code much more organized
adjective = []
i = 0
max_adjectives ... | true |
fdd6639ba2b3f4b584da75a01fbba13a1eec7537 | Python | Semanti1/pomdp_findit | /pomdp_problems/multi_object_search/domain/observation.py | UTF-8 | 3,126 | 3.125 | 3 | [
"MIT"
] | permissive | """
Defines the Observation for the 2D Multi-Object Search domain;
Origin: Multi-Object Search using Object-Oriented POMDPs (ICRA 2019)
(extensions: action space changes, different sensor model, gridworld instead of topological graph)
Observation:
:code:`{objid : pose(x,y) or NULL}`.
The sensor mode... | true |
4762eaa874b733c7b0cb4e7c4a11e448b56a140e | Python | NitantP/dcss-ai-wrapper | /src/dcss/connection/config.py | UTF-8 | 2,316 | 2.5625 | 3 | [
"MIT"
] | permissive | class LocalConfig:
"""
This configuration should be used when running DCSS in the terminal locally on the machine. Currently this
has only been tested in Linux. It should work for Mac. Windows support is unknown.
"""
socketpath = '/var/tmp/crawl_socket'
agent_name = 'aiagent'
crawl_s... | true |
d7f878ed379fb75a2bfe9d1ad04f3a10717472fb | Python | inagavel/airbnb | /airbnb.py | UTF-8 | 370 | 3.046875 | 3 | [] | no_license | import csv
import pandas as pd
with open('list.csv', 'r', encoding='Latin1') as csv_file:
#csv_reader = csv.reader(csv_file)
#next(csv_reader)
df = pd.read_csv(csv_file)
print(df.head)
#for line in csv_reader:
# print(line[0] +" | " +line[5]+" | " +line[6]+" | " +line[7]+" | " +line[8]... | true |
97fee9a33e00e655468e1bd4b36488b79604e879 | Python | 1987617587/lsh_py | /basics/day9/lzt/animl_test.py | UTF-8 | 609 | 3.5625 | 4 | [] | no_license | # author:lzt
# date: 2019/11/15 17:42
# file_name: animl_test
class Animal:
def __init__(self, name, type, height, weight) -> None:
super().__init__()
self._name = name
self.type = type
self.height = height
self.weight = weight
def eat(self):
print("动物吃")
clas... | true |
a1785b9a2646dd4359296aa72aaa04b237de30e9 | Python | nksoff/wordability | /3_train.py | UTF-8 | 2,304 | 2.765625 | 3 | [] | no_license | from keras.models import Model, load_model
from keras.layers import Input, Dense, Reshape, dot as dot_layer
from keras.layers.embeddings import Embedding
import glob
import time
import random
import numpy as np
def file_by_line(file, *args, **kwargs):
with open(file, 'r', *args, **kwargs) as f:
line = f... | true |
8d484d476ca244d27650a928815a19f0b68f3d7b | Python | dwayne314/ace-scaffold | /tests/unit/clone/test_clone.py | UTF-8 | 917 | 2.875 | 3 | [
"MIT"
] | permissive | """This unit test suite tests the application's "clone" command."""
import pytest
from app.cli import clone
@pytest.fixture
def clone_template(click_runner):
"""Runs the clone command from the click runner"""
return click_runner(clone)
@pytest.mark.command
@pytest.mark.clone
def test_clone_without_template(... | true |
04280e626c9a2c807b4493437f1ecfbf4a0fd103 | Python | wheatmushi/projectEuler | /euler_010 (summation of primes).py | UTF-8 | 255 | 3.40625 | 3 | [] | no_license | from math import sqrt, ceil
def isSimple(p):
for i in range(2,ceil(sqrt(p))+1):
if p%i == 0:
return False
return True
simple = [2,]
for p in range(2,2000000):
if isSimple(p):
simple.append(p)
print(sum(simple))
| true |
8000da9095e8dd2021077ede2959104bffbc4151 | Python | ranjuinrush/excercise | /Numpy/1.py | UTF-8 | 424 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 31 10:00:05 2018
@author: user
"""
import numpy as np
a = np.array([[1,2,3],[4,5,6]])
print("The dimensions of the array is:"+str(a.shape))
a.shape = (2,3)
print (a)
b=np.reshape(a,(1,(2*3)))
print(b)
sum1=np.sum(a)
print("sum of elements:"+str(sum1))... | true |
ab3066434b67615d334295f215ef97676b181d5e | Python | inuitwallet/overwatch | /overwatch/consumers/bot_balance.py | UTF-8 | 3,186 | 2.5625 | 3 | [
"MIT"
] | permissive | import logging
from channels.consumer import SyncConsumer
from overwatch.models import BotBalance, BotPrice
from overwatch.utils.price_aggregator import get_price_data
logger = logging.getLogger(__name__)
class BotBalanceConsumer(SyncConsumer):
@staticmethod
def calculate_usd_values(message):
"""
... | true |
7d93e3367142d5575d16d34f19639e358bed746b | Python | flupke/leechy | /project/apps/leechy/cache.py | UTF-8 | 1,936 | 2.734375 | 3 | [] | no_license | import os
import os.path as op
import logging
from django.core.cache import cache
from leechy import settings
from leechy.utils import force_utf8
logger = logging.getLogger(__name__)
def dir_cache_key(path):
"""
Get the cache key for *path*.
"""
path = force_utf8(path)
name = op.abspath(path).... | true |
9cffbcbdf966747f34bc26f7e3b682a8da911a50 | Python | rehth/test | /Pycharm/飞鸽传书/python17_10/协程的应用.py | UTF-8 | 731 | 2.71875 | 3 | [
"MIT"
] | permissive | import urllib.request
import gevent
from gevent import monkey
monkey.patch_all()
def download_image(image_url, image_name):
# 打开网络地址
response = urllib.request.urlopen(image_url)
print(gevent.getcurrent())
# 获取数据
image_data = response.read()
# 写入文件
with open(image_name, "wb") as file:
... | true |
147d052a68c25a288ef18a497ce0bb3bcf1480d7 | Python | alexanderbianchi/Ray-Tracer | /Components/tuples.py | UTF-8 | 4,731 | 3.53125 | 4 | [] | no_license | import math
def compare(a, b):
EPSILON = 0.002
if abs(a-b) < EPSILON:
return True
else:
return False
class Tuple():
def __init__(self, x, y, z, w):
self.x = x
self.y = y
self.z = z
self.w = w
def __getitem__(self, y):
if y == 0:
... | true |
acb81f9594855368e13fd6c7bc396eae39446b6f | Python | shaneausmus/hangman | /hangman.py | UTF-8 | 2,537 | 4.0625 | 4 | [] | no_license | from random import *
def select_word():
seeds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
seed(choice(seeds))
word_list = list()
print("Selecting word now...\n")
with open("ospd.txt", "r") as file:
# each line is only one word; append the word to the list
# and strip it just in case of whi... | true |
60c9a41d71a2fda35533cd4509d6baf8e2171d76 | Python | laurentaubin/GLO-2005-Beerbender | /backend/persistence/BeerRepository.py | UTF-8 | 889 | 2.578125 | 3 | [
"MIT"
] | permissive | import pymysql
HOST = 'localhost'
USER = 'root'
PASSWORD = 'glo2005xD'
DATABASE = 'glo2005'
class BeerRepository:
def __init__(self):
self.conn = pymysql.connect(
host=HOST, user=USER, password=PASSWORD, db=DATABASE)
def get(self, beer_id):
cmd = 'SELECT * FROM Beers INNER JOIN B... | true |
cb32eb78eb7da016867ba082ce2e91db553cc2f8 | Python | SoulVictus/MetodyNumeryczne | /Lista 8/zad1.py | UTF-8 | 179 | 3 | 3 | [] | no_license | import scipy.linalg as sp
import numpy as np
A = np.array([[-1, -4, 1],
[-1, -2, -5],
[5, 4, 3]])
w, v = sp.eig(A)
print("Wartości własna: ", w)
print("Wektory własne: ", v) | true |
200c21c43759160493ca32fff22beca858ac8fd9 | Python | congtrung2k1/CTF-Write-up | /houseplant.rtcp/RE/Fragile _ S/solve.py | UTF-8 | 129 | 3.25 | 3 | [] | no_license | s = "ÐdØÓ§åÍaèÒÁ¡"
a = "h1_th3r3_1ts_m3"
f = ""
for i in range(len(s)):
f += chr(ord(s[i]) - ord(a[i]))
print(f) | true |
365ab00d69397dc46e726af6aad3b5dfea5f8e1c | Python | mchayapol/aucs-dsa | /graph/dfs.py | UTF-8 | 885 | 3.46875 | 3 | [] | no_license | # Generate the input
# Number of vertices
V = int(input())
Adj = []
for i in range(V):
# the number of reachable vertices, list of vertices
x = input().split()
Adj.append([])
for j in range(int(x[0])):
Adj[i].append(int(x[j + 1]))
# Initialise every vertices to white (using color)
color = ['whi... | true |
99085981e3fc2aa94b2f0e8606c101b34bb58540 | Python | ChrisMaxheart/Competitive-Programming | /Codeforces/Codeforces Round 485 Div 2/High School Become Human.py | UTF-8 | 430 | 3.6875 | 4 | [] | no_license | def fast_exp(base, pangkat):
if (pangkat == 1):
return base
elif (pangkat == 0):
return 1
elif (pangkat%2):
return fast_exp(base, pangkat-1) * base
else:
return (fast_exp(base,pangkat//2))**2
x, y = map(int, input().split())
kiri = y
kanan = x
# kiri = fast_exp(x,y)
# kanan = fast_exp(y,x)
# pr... | true |
58ade59626e33eec4a683ab21734cd11b6b4d537 | Python | mumarkhan999/UdacityPythonCoursePracticeFiles | /17_calender.py | UTF-8 | 653 | 4.09375 | 4 | [] | no_license | import calendar
print("Enter 1 to check that year is leap or not")
print("Enter 2 display month of specific year")
print("Enter 3 to display calaendar of specific year")
choice = input("Enter choice...")
if(choice == "1"):
year = int(input("Enter year:\n"))
print(calendar.isleap(year))
elif(choice == "2"):
... | true |
465b3e35fee867b77f0ae661f6458791323b64ab | Python | matsub/sandbox | /python/basic_tips/lambda/ski.py | UTF-8 | 272 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# s = \x -> \y -> \z -> x z (y z)
# k = \x -> \y -> x
# i = \x -> x
s = lambda x: lambda y: lambda z: x(z)( y(z) )
k = lambda x: lambda y: x
i = lambda x: x
# church bool
true = k
false = k(i)
# church numeral
zero = k(i)
| true |
417950e531265e498f7760a5e6f20f41fcebf999 | Python | amr2393/online_courses | /01_Discrete_Optimization/Week2/knapsack/dynamic_programming.py | UTF-8 | 1,180 | 3.1875 | 3 | [] | no_license | import numpy as np
def build_cost_matrix(items, capacity):
cost = np.zeros((capacity+1, len(items)+1), dtype = int)
for item_ix in range(1, len(items)+1):
for capacity_ix in range(1, capacity+1):
if items[item_ix-1].weight <= capacity_ix:
cost[capacity_ix, item_ix] = \
... | true |
31c1ce44e3f6ec2728d18b25c63c8ad7e6fc330a | Python | stepik/SimplePyScripts | /isinstance_example/isinstance.py | UTF-8 | 214 | 2.671875 | 3 | [
"CC-BY-4.0"
] | permissive | __author__ = 'ipetrash'
if __name__ == '__main__':
print(isinstance(5, str))
print(isinstance(5, int))
print(isinstance(5, bool))
print(isinstance(False, bool))
print(isinstance("Hello", str)) | true |
c24c60a0b17911965af1376a0ae1e1db75e21b42 | Python | cisagov/cyhy-api | /src/cyhy_api/model/fields/password.py | UTF-8 | 690 | 2.765625 | 3 | [
"CC0-1.0"
] | permissive | from mongoengine.fields import StringField
from cyhy_api.util import HashedPassword
class PasswordField(StringField):
"""Password storage for documents."""
def validate(self, value):
"""Validate the internal storage of the Field."""
if not isinstance(value, HashedPassword):
self.... | true |
7e5e66f8d3e3b158f24a3a6746708abb9c89252e | Python | ssskming/pys | /wangyiyun/wangyiyun.py | UTF-8 | 1,881 | 2.984375 | 3 | [] | no_license | import requests
import json
import time
import pandas as pd
def parse_one_page(comment_url):
"""
功能:给定一页的评论接口,获取一页的数据
"""
# 添加headers
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36'
}
# ... | true |
87fbe4f1edab530cbb7d3cfe40e6d06186e16c91 | Python | JennsiS/lambda-functions | /funciones-lambda.py | UTF-8 | 1,898 | 4.4375 | 4 | [] | no_license | #Universidad del Valle de Guatemala
#Análisis y diseño de algoritmos
#Jennifer Daniela Sandoval 18962
#Proyecto 1
#Este programa tiene como objetivo representar funciones de cálculo lambda por medio de funciones lambda de python
#Referencias: https://www.geeksforgeeks.org/nested-lambda-function-in-python/#:~:text=In%20... | true |
8f98aa76bbcc752ef59e54a234787319bceba110 | Python | xmy7080/leetcode | /squaresOfASortedArray.py | UTF-8 | 435 | 3.453125 | 3 | [] | no_license | #two pointer, from left to right
class Solution(object):
def sortedSquares(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
l, r = 0, len(A)-1
ans = []
while l <= r:
if A[l] ** 2 > A[r] ** 2:
ans.append(A[l] ** 2)
... | true |
6903169151668d44942911997183280592d8dd03 | Python | DivyaBhulai/Python-3a | /copy-dictionarie.py | UTF-8 | 116 | 2.90625 | 3 | [] | no_license | getallen = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50}
def copy(g):
z = g.copy()
return z
print(copy(getallen))
| true |
57172a0e6105020191449699f7ddf9af5caeb2fe | Python | ShengChiaYu/Multi-source-Domain-Adaptation | /Cocktail/cockNetwork.py | UTF-8 | 6,356 | 2.53125 | 3 | [] | no_license | import os
import csv
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from torch.utils.data import Dataset, DataLoader
from PIL import Image
#######################################
class ImageData(Dataset):
def __init__(self,root,csv_root,sca... | true |
fc20d8077553698d88fe3047374abf79c4741a2c | Python | tschmid/mni | /mni/testmanagedsubproc.py | UTF-8 | 3,805 | 2.78125 | 3 | [] | no_license | import managedsubproc
import tempfile
import unittest
import time
import os
# Helper function maintained outside of the test suite. Used to
# demonstrate how external functions can be registered to handle output
# from a managed subprocess.
count_on_test = 0
def is_test(s):
global count_on_test
if s == "test\... | true |
7a297500b8bd7f2d0cd7a7829cfca51554684f76 | Python | nikonst/filesPythonCourse | /Section6Directories/ModuleOS/1-one.py | UTF-8 | 1,926 | 3.3125 | 3 | [] | no_license | import os
#os.getcwd()
print("Current Directory:", os.getcwd())
#listdir()
print(os.listdir())
#mkdir
try:
os.mkdir('subDirectory')
except:
print("File Exists")
#rmdir
os.rmdir('subDirectory')
#makedirs
try:
os.makedirs("sub1/sub2")
except:
print("Couldnt make dirs")
#removedirs
try:
os.remove... | true |
08194aa46a4302073da57c350251314f7b17e017 | Python | mandroizas/python-for-kids | /ColorSpira.py | UTF-8 | 376 | 3.796875 | 4 | [] | no_license | import turtle
t = turtle.Pen()
turtle.bgcolor("black")
# Вы можете задать от 2 до 6 граней - и получить крутые
# фигуры!
sides = 6
colors = ["red", "yellow", "blue", "orange", "green", "purple"]
for x in range (100):
t.pencolor(colors[x%sides])
t.forward(x * 3/sides + x)
t.left(360/sides + 1)
t.width(x*... | true |
9ad3e7321ac28d96d973c1ba580bb92800065a4a | Python | manognaification/Problem-Solving-and-Programming | /tes/test.py | UTF-8 | 166 | 3.125 | 3 | [] | no_license |
def fact(n):
if n==1:
return n
else:
return (n)*fact(n-1)
def sum(n):
if n==1:
return n
else:
return n+sum(n-1)
| true |
2b71ca950a23682b2b9d311617e69d3b6b2686f7 | Python | JohnTuUESTC/leetcode_program | /FirstMissingPositive.py | GB18030 | 815 | 3.109375 | 3 | [] | no_license | #coding:gb2312
'''
leetcode: First Missing Positive
'''
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 1
# ii-1λ
i = 0
while i < len(nums):
if... | true |
6cd9b574bbcbc340710949b54ec357f970cf43e1 | Python | muhammadahmedazizi/Blogger_Scrapper | /write_csv.py | UTF-8 | 326 | 2.96875 | 3 | [] | no_license | import csv
def write_csv(filename,*args):
args_list = []
for arg in args:
args_list.append(arg)
with open(filename, 'a', encoding='utf-8', newline="") as f:
data_handler = csv.writer(f, delimiter=",")
data_handler.writerow(args_list)
write_csv('عصمت','چغتائی','کمال')
| true |
efac7389722b2939252b517810c65f121a69526b | Python | mthgh/Enron_POI_Detector | /feature_selection.py | UTF-8 | 6,250 | 2.859375 | 3 | [] | no_license | import pickle
import numpy as np
from sklearn.feature_selection import f_classif
from sklearn.feature_selection import RFECV
from sklearn.grid_search import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
from time import time
from helper_functions import dict_... | true |
2a3a239dc687de591c969bed81ca3f0f3311ef23 | Python | manavshrivastavagit/DataStructureAndAlgorithmicThinkingWithPython | /src/chapter11searching/MaxIndexDifferenceBruteForce.py | UTF-8 | 772 | 3.25 | 3 | [] | no_license | # Copyright (c) Dec 22, 2014 CareerMonk Publications and others.
# E-Mail : info@careermonk.com
# Creation Date : 2014-01-10 06:15:46
# Last modification : 2008-10-31
# by : Narasimha Karumanchi
# Book Title : Data Structures And Algorithmic Thinking With Python
# Warranty ... | true |
a42f5c07fa7c74e5badab3cdc51c10ba7d2ce2e0 | Python | AlexanderFabisch/slither | /playground/plot_utm_heatmap.py | UTF-8 | 1,747 | 2.75 | 3 | [
"BSD-2-Clause-Views",
"BSD-2-Clause"
] | permissive | import sys
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import ticker
import utm # https://github.com/Turbo87/utm
from slither.service import Service
from slither.core.unit_conversions import convert_m_to_km
from scipy.stats import binned_statistic_2d
d... | true |
5844285b671a23247fe86a00388df1d34fbaab1d | Python | filipmor/python_simulations | /Brownian_motion/main.py | UTF-8 | 2,970 | 2.953125 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pylab as plt
from matplotlib import cm
if __name__ == "__main__":
# time in seconds
t = 10
# average number of motions in a time unit
v = 10
# number of steps in one trajectory
n = v*t
# Number of particles
... | true |
188b6ec16f0afb4f6d93edc19118eff5d8f23807 | Python | tcdat96/ShoeFinder | /PumaScraper.py | UTF-8 | 1,654 | 2.5625 | 3 | [] | no_license | from IScraper import IScraper
from Shoe import Shoe
import urllib
import requests
import json
import re
from bs4 import BeautifulSoup
from bs4 import NavigableString
class PumaScraper(IScraper):
def __init__(self):
self.domain = 'https://us.puma.com/en/us'
def getUrl(self, name, gender, sport):
if name != '':... | true |
a7e73d216b5ac529990b6b9c32898d14297ff30a | Python | bsingh17/Natural-Language-Processing | /Parts of speech tagging.py | UTF-8 | 3,300 | 3.46875 | 3 | [] | no_license | import nltk
from nltk.tokenize import PunktSentenceTokenizer
train_text="""I have three visions for India. In 3000 years of our history, people from all over
the world have come and invaded us, captured our lands, conquered our minds.
From Alexander onwards, the Greeks, the Turks, ... | true |
e3e19f086198df27aa12fbb3320e98d6bce3ae17 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/difference-of-squares/79370c8969f54b0c85d34c946b9cb993.py | UTF-8 | 293 | 3.890625 | 4 | [] | no_license | from math import pow
def square_of_sum(length):
base = sum(range(1, length+1))
return int(base**2)
def sum_of_squares(length):
squares = [int(number**2) for number in range(1, length+1)]
return sum(squares)
def difference(length):
return square_of_sum(length) - sum_of_squares(length)
| true |
48fd8c152b7512685fd47f0066796fddbf83b231 | Python | huybin1205/ReadNewsBaoThanhNien | /Index.py | UTF-8 | 463 | 3.03125 | 3 | [] | no_license | #import thư viện gTTS, nó được mô hình hóa từ Google speech
from gtts import gTTS
#import thư viện os để xử lý file
import os
f = open("content.txt","r",encoding="utf-8")
content = f.read()
print("Xin chờ! Chúng tôi đang xử lý...")
print("Có thể sẽ mất nhiều thời gian nếu nội dung dài!")
f.close()
#Xử lý
tts = gTTS(te... | true |
0ed1091ea97934f1d5c9615b06673c5551c2361d | Python | CaioBrighenti/COSC | /COSC480/projects/p3/mlr.py | UTF-8 | 4,830 | 3.78125 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def feature_expansion(x, deg=4):
'''Takes an vector of n scalar values and returns an (n x deg+1)
matrix by applying the feature expansion
x ==> [1, x, x^2, x^3, x^4, ..., x^d]
to each scalar x value.
Inputs:
x n scalar v... | true |
f8cb6fd5eb590077d2f43ac249669890454f6194 | Python | Aasthaengg/IBMdataset | /Python_codes/p03151/s783432238.py | UTF-8 | 800 | 2.8125 | 3 | [] | no_license | def resolve():
'''
code here
'''
N = int(input())
As = [int(item) for item in input().split()]
Bs = [int(item) for item in input().split()]
Ds = [a - b for a, b in zip(As, Bs)]
cnt_minus = 0
total_minus = 0
minus_list = []
cnt_plus_to_drow = 0
plus_list = []
for i... | true |
1f66cc13bc7708203495ec7be411473d5f5d697c | Python | kandarpck/leetcode | /trees/build_tree_in_pre.py | UTF-8 | 943 | 3.734375 | 4 | [
"MIT"
] | permissive | # Definition for a binary tree node
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return "{}".format(self.val)
class Solution:
def buildTree(self, preorder, inorder):
"""
:type preorder: ... | true |
52f856d86b720a99df481ad628d6d13c41adc1b7 | Python | nfredrik/pyjunk | /stock/coin_rates.py | UTF-8 | 493 | 2.796875 | 3 | [] | no_license | import urllib.request
import json
import pprint
query_currencies = "https://api.coinbase.com/v1/currencies"
with urllib.request.urlopen( query_currencies) as document:
#pprint.pprint(document.info().items())
# currencies = json.loads( document.read().decode("utf-8"))
currencies = json.loads(document.re... | true |
ef3f7db26d90af47828483f8e2767de0f7e10b25 | Python | mbagrel1/isn | /ds/ds1/bagrel-ex4.py | UTF-8 | 115 | 4.03125 | 4 | [] | no_license | nombre=input("Saisissez un nombre entier entre 10 et 50 :")
while nombre>= 0:
print nombre
nombre=nombre-1
| true |
ac4c3a275f9cb22c7d86abb73f366f760efb2eb4 | Python | bokdoll/Algorithm | /Algorithm-이것이코딩테스트다/Chapter04-구현/상하좌우.py | UTF-8 | 541 | 3.71875 | 4 | [] | no_license | # 2020/10/18 (일)
# [Chapter04-구현 예제 4-1] 상하좌우
def solution():
N = int(input())
plan = ''.join(input().split())
curX, curY = 1, 1
for direction in plan:
if direction == 'U' and curY != 1:
curY -= 1
elif direction == 'D' and curY != N:
curY += 1
elif direct... | true |
f5560a70be341c1c952f8107d38ddcd729b764d3 | Python | KRKroening/WoWPets | /NeededPets/logic.py | UTF-8 | 2,668 | 2.546875 | 3 | [] | no_license | from .models import PetsToCollect
import requests
from bs4 import BeautifulSoup as bs
import urllib3 as urllib
import pdb
def UpdateNeededPets():
# Get character specific pets
urlCollected = "https://us.api.battle.net/wow/character/doomhammer/Ziast?fields=pets&locale=en_US&apikey=zpbbcws848zkzqb3gqv5rjy2npwf2q... | true |
bf6816578aa1e2151ccae31d5829adf879ead68b | Python | pdv1703/text_from_number-ua-en- | /number_to_text.py | UTF-8 | 12,984 | 2.8125 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import (QWidget, QApplication, QTextEdit, QPushButton,
QLabel, QGridLayout, QComboBox, QDoubleSpinBox, QLineEdit)
from PyQt5.QtCore import (QRegExp)
from PyQt5.QtGui import (QRegExpValidator)
import decimal
import re
class Example(QWidget):
... | true |
4b42a92d1a2750221b50946268321a23190f6c41 | Python | hz336/Algorithm | /LeetCode/DP/!!C M Decode Ways.py | UTF-8 | 1,770 | 4.125 | 4 | [] | no_license | """
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given a non-empty string containing only digits, determine the total number of ways to decode it.
Example 1:
Input: "12"
Output: 2
Explanation: It could be decoded as "AB" (1 2) or "L" (... | true |
2d5fa63315b96814ddac33e23e2185e0564915b2 | Python | Linh-T-Pham/Study-data-structures-and-algorithms- | /monkey_river.py | UTF-8 | 4,451 | 3.890625 | 4 | [] | no_license | # Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
# Example 1:
# Input: [0,1]
# Output: 2
# Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
# Example 2:
# Input: [0,1,0]
# Output: 2
# Explanation: [0, 1] (or [1, 0]) is a longest ... | true |
9eb5f4df494b6db9e9e7d8cc4841dc4b0696038d | Python | joeynosharefood/estudos | /Python/Exercicios/69.py | UTF-8 | 952 | 3.84375 | 4 | [] | no_license | import random
c = 0#contador de vitorias
while True:
x = random.randrange(0, 11)#numeros colocados pelo computador
print(x)
y = random.randrange(1, 3)#escolha do computador (1 para impar/2 para par)
print(y)
z = int(input('Insira um valor : '))#numeros colocados pelo usuario
if z > 10:
p... | true |
2914848e4b281480749a7670976b2e7bf97c6409 | Python | tara-nguyen/pygame-football | /LineParams.py | UTF-8 | 4,530 | 3.59375 | 4 | [] | no_license | '''This module defines the following functions: getParams(), getLine(),
getDistToLine(), getIntersect(), isBetween(), and checkSide().
To get a brief description of each function, use the following syntax:
<module name as imported>.<function name>.__doc__'''
import math, random
def getParams(point1, point2):
... | true |
c18ccc265ae0bd9fe4054b5e5e963b3383eab235 | Python | hasadna/OpenTrainCommunity | /train2/chatbot/station_utils.py | UTF-8 | 1,919 | 3.1875 | 3 | [] | no_license | import re
import Levenshtein
from data.models import Stop
class StationUtils:
@classmethod
def find_matching_stations(cls, text):
matching_stations = []
all_stops = Stop.objects.all()
for stop in all_stops:
for name in stop.hebrew_list:
if cl... | true |
b2465a4e3d96cd64c6fb66d41a158a5e7e4ba297 | Python | pcmaestro/my_repository | /APUNTES/PYTHON/EJEMPLOS_FORMACION/basico18bucles/main.py | UTF-8 | 210 | 3.5625 | 4 | [] | no_license | '''
Created on 13 mar. 2020
@author: Hp 840 G2
'''
i = 1
while i < 6:
print(i)
if i == 3:
break # Con esto rompemos el bucle al cumplirse el if
i += 1
print("Ya hemos alcanzado el break") | true |
aa09b67c4304fbcf6b9e8921019a22c310e37834 | Python | mirigmirig/calculator | /calculatorFrame.py | UTF-8 | 5,600 | 3.359375 | 3 | [] | no_license | __author__ = ''
from Tkinter import *
import calculation
import UnaryOperationsLib
class CalculatorFrame(Frame):
def __init__(self, root, **options):
Frame.__init__(self, root, options)
self.grid()
self.currValue = ''
self.buttonsList = [
'1', '2', '3', '4', '5', '6',
... | true |
b84d9e9ad39cf6e5fd2e7be51c8834f360b669b8 | Python | pablodarius/mod02_pyhton_course | /Python Exercises/3_question2.py | UTF-8 | 678 | 4.28125 | 4 | [] | no_license | import unittest
# Given 2 strings, s1 and s2, create a new string by appending s2 in the middle of s1
def add_in_middle(s1, s2):
middle = len(s1) // 2
result = s1[:middle] + s2 + s1[middle:]
return result
class testing(unittest.TestCase):
def setUp(self):
print("Preparing context...")
... | true |
45eaa38a7597af786fb93517f135abe6bb99e841 | Python | antoniojxk/udacity-technical-interview | /BinarySearchPractice_iterative.py | UTF-8 | 554 | 4.03125 | 4 | [] | no_license | # taken from http://love-python.blogspot.com.co/2013/10/iterative-binary-search-in-python.html
def binary_search_iterative(li, left, right, key):
while True:
if left > right:
return -1
mid = (left + right) / 2
if li[mid] == key:
return mid
if li[mid] > key:
right = mid - 1
else:... | true |
aa3e32c12306ad7a63424dd00626d7db872207ef | Python | jiangzhongkai/python_1 | /SGA_Method.py | UTF-8 | 19,291 | 3 | 3 | [] | no_license | """-*- coding: utf-8 -*-"""
#DateTime : 2018/5/14 12:34
#Author : Peter_Bonnie
#FileName : SGA_Method.py
#Software: PyCharm
import os
import re
import numpy as np
import matplotlib.pyplot as plt
import sys
import random
from multiprocessing import Process
from functools import reduce
import pandas as pd
impo... | true |
f2bf5bc4b48f8730d814b1306447f114e75640bd | Python | JeahaOh/Python_Study | /Do_It_Jump_To_Python/1_Basic/05_FlyWithPython/05_EmbeddedFunction/any.py | UTF-8 | 389 | 3.765625 | 4 | [] | no_license | # coding: utf-8
'''
any( x )
반복 가능한(literable) 자료형을 인자로 받음.
- List,m Tuple, String, Dictionary, Set
x중 하나라도 참이면 True, 하나라도 거짓이면 False를 반환
'''
print( any( [True, True] ) ) # T
print( any( [True, False] ) ) # T
print( any( [False, False] ) ) # F
print( any( [0, 1, 2, 3] ) ) # T
print( any( [0, ""] ) ) ... | true |
6b842df65c129ab8b52b8a39d8c9ddc855d7478e | Python | Thomas00010111/Agent_RaceSimulator | /Tests/TestPickle.py | UTF-8 | 2,413 | 3.15625 | 3 | [] | no_license | import pickle
import Agent.BaseLevel as BaseLevel
import unittest
class A():
def __init__(self):
pass
def init(self, var1, var2):
self.var1 = var1
self.var2 = var2
def save(self, filename):
pickle.dump(self, open(filename, 'wb'))
... | true |
b03d1f7b9e4376b0d7549aa3ff4ce1cae1bb977c | Python | Col-R/python_fundamentals | /assignments/oop_user/user.py | UTF-8 | 1,237 | 3.859375 | 4 | [
"MIT"
] | permissive | class User:
def __init__(self,name,balance):
self.name = name
self.balance = balance
def make_withdrawal(self, amount):
self.balance -= amount
print(f"{self.name}, you have withdrawn ${amount}")
return self
def make_deposit(self, amount):
self.balance += amoun... | true |
86c9757ad0f2b45283b36e6434f253e4094cc8b7 | Python | PositroniumSpectroscopy/positronium | /positronium/constants.py | UTF-8 | 5,779 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | #! python
'''
Physical constants
'''
from __future__ import print_function, division
from math import floor, log10
import webbrowser
metric_prefix = dict([(18, 'E'), (15, 'P'), (12, 'T'), (9, 'G'),(6, 'M'), (3, 'k'), (0, ''),
(-3, 'm'), (-6, 'u'), (-9, 'n'), (-12, 'p'), (-15, 'f'), (-18, 'a')])
... | true |
480475d75b055ccccecb3eb713b74a4de7462336 | Python | DahlitzFlorian/timing-context-manager-video-snippets | /timing.py | UTF-8 | 682 | 3.6875 | 4 | [
"MIT"
] | permissive | import contextlib
import time
class Timer:
def __init__(self, description: str) -> None:
self.description = description
def __enter__(self):
self.start = time.time()
def __exit__(self, type, value, traceback):
self.end = time.time()
elapsed_time = self.end - self.... | true |
3a5d5c97d0b36fd6c74ebf488c7c6dbc0f832007 | Python | TiagoJLeandro/uri-online-judge | /python/uri_1133.py | UTF-8 | 507 | 4.34375 | 4 | [
"MIT"
] | permissive | """
Escreva um programa que leia 2 valores X e Y e que imprima todos os valores entre eles cujo resto da divisão dele por 5 for igual a 2 ou igual a 3.
Entrada
O arquivo de entrada contém 2 valores positivos inteiros quaisquer, não necessariamente em ordem crescente.
Saída
Imprima todos os valores conforme exemplo ab... | true |
c82f167a5f5aa1027f2058ce4c73714de30031ee | Python | jvs/copilot | /pico/input_channel.py | UTF-8 | 1,050 | 2.8125 | 3 | [
"MIT"
] | permissive | import board
import busio
import struct
class InputChannel:
def __init__(self):
self._uart = busio.UART(
tx=board.GP0,
rx=board.GP1,
baudrate=9600,
bits=8,
parity=None,
stop=1,
timeout=60,
)
def read_byte(self... | true |
3b2999fb5d1afc3bc13972139178da250544f3a9 | Python | gcoop-libre/pilas-simonpugliese | /piano.py | UTF-8 | 1,856 | 2.921875 | 3 | [] | no_license | #!-*- coding: utf-8 -*-
import tecla
import pilas
class PianoNuevo:
def __init__(self, dx, dy):
pilas.eventos.termina_click.conectar(self.cuando_hace_click)
self.teclas = {}
pilas.eventos.pulsa_tecla.conectar(self.presiona_nota_teclado)
self._crear_teclas(dx, dy)
self. mapa... | true |
190142b5e7b145fdd3974df44511caeb177c2698 | Python | mgely/papyllon | /qtlab/scripts/sal/qubit3/two_tone_handler.py | UTF-8 | 7,054 | 2.53125 | 3 | [] | no_license | #################################################
########## Two tone run file
################################################
# Author SJ Bosman
# Experiment script for doing two tone spectroscopy on qubit/cpb
# Basic structure:
# Define the core variables
# Setup the instruments & data structure
#
# Experi... | true |
b0a037a49bdc2d2cf1f6ca4a8b8edbd19f25a561 | Python | stannielson/feature_categorization | /Python_Scripts/CategorizeFeatureGeometry.py | UTF-8 | 13,811 | 2.546875 | 3 | [
"MIT"
] | permissive | """
Title: CategorizeFeatureGeometry
Author: Stanton K. Nielson
GIS Specialist
Bureau of Land Management
Wyoming High Desert District
snielson@blm.gov
Date: February 14, 2018
Version: 3.0
"""
import arcpy
import datetime
import string
class Ca... | true |
3b449e0c3112763a9f169c7c1dc3e126a2b7a9c8 | Python | nguyenvanhoang97/nguyenvanhoang-labs-c4e18 | /lab3/f-math-problem/eval.py | UTF-8 | 369 | 3.703125 | 4 | [] | no_license | from random import choice
def calc(x , y , op):
# x = 3
# y = 7
# op = choice(["+" , "-" , "*" , "/"])
res = 0
if op == "+":
res = x + y
elif op == "-":
res = x - y
elif op == "*":
res = x * y
elif op == "/":
res = x / y
return res
# print(... | true |
80179b44a8be242b444927d353898fb29a7d1619 | Python | chechir/anomaly | /tsfuncs.py | UTF-8 | 4,890 | 2.765625 | 3 | [] | no_license | from functools import partial
import numpy as np
import pandas as pd
from pandas import datetime
from pandas.tools.plotting import autocorrelation_plot
from statsmodels.tsa.arima_model import ARIMA
from statsmodels.tsa.stattools import adfuller
from matplotlib import pyplot as plt
import seamless as ss
cutoff = '2000... | true |
79da5ca9b86286416ec88165252c36ccb962b4b6 | Python | halflings/haiku-generator | /src/grammar_tree.py | UTF-8 | 4,003 | 3.359375 | 3 | [] | no_license | import nltk
import random
import itertools
from pos_tagger import POSTagger
from collections import Counter
class GrammarTree:
def __init__(self, tagged_dataset):
self._root, self._grammar_tree = self.__get_grammar_tree(tagged_dataset)
self._word_tree = POSTagger.get_tagged_word_tree(tagged_dataset... | true |
496dd384a1e8180e5632c7aec2d548ba6fc68436 | Python | belinguc/GEOLOC_SIGFOX | /matrix.py | UTF-8 | 7,530 | 3.1875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import sys
def read_csv(csv_file):
"""
Converts a given csv file to a pandas DataFrame
:param csv_file: a csv file
:return: a pandas Dataframe with the csv file information
"""
df = pd.read_csv(csv_file)
return df
def apply_method(method, df, means... | true |
503a4a7cf922df1e37041f26bd591f2989ac8842 | Python | donge-can/DeepLearning | /keras/keras27_cifar1.py | UTF-8 | 1,264 | 2.765625 | 3 | [] | no_license | from keras.datasets import cifar10
from keras.models import Sequential
from keras.layers import Dense, Flatten, LSTM, Conv2D, MaxPooling2D
from keras.callbacks import EarlyStopping
import numpy as np
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
print(x_train.shape) #(50000, 32, 32, 3)
print(y_train.sh... | true |
c59a77d15e14563eb33cdd975822bc1d6385528b | Python | GrowingPol/MyFirstDjango | /sap/personas/models.py | UTF-8 | 897 | 3.03125 | 3 | [] | no_license | from django.db import models
# Create your models here.
# Aqui se crea el modelo de las tablas a crearse en la base de datos, y después se hace la migración
#Primero se ponen las clases de tablas que no estan relacionadas con otras
class Domicilio(models.Model):
calle = models.CharField(max_length=255)
no_call... | true |
aa6bf732e091c7862b27cd64e3dc36bf7c567fef | Python | oed/traffic-simulation | /create_path.py | UTF-8 | 11,584 | 3.03125 | 3 | [] | no_license | import sys
import pygame
import pickle
import math
import utils
pygame.init()
print " Time to draw!\n This is how the outline of the drawing tool works:\n With TAB you go back and forth between drawing roads and buslanes.\n Press TAB once and roads are to be drawn.\n Press TAB when drawing roads buslanes will be dra... | true |
64e0f9e42aaaf51d61347c60c4cad288c3449395 | Python | deepnirmal/python-code | /fileIO.py | UTF-8 | 287 | 3.5 | 4 | [] | no_license |
count=0
total=0
inFile=open('readGrades.txt','r')
grade=inFile.readline()
while (grade) :
print(grade)
count=count+1
total=total+int(grade)
grade=inFile.readline()
avg=total/count
print("Average is : "+ str(avg))
outFile=open('avg.txt','w')
outFile.write("Average ="+str(avg))
| true |
4840b463387685709fece90fbe44bf4f2cbd7a34 | Python | innoventurist/Neural-Networks-Deep-Learning | /Logistic_Regression_with_Neural_Network.py | UTF-8 | 20,373 | 3.734375 | 4 | [] | no_license |
# coding: utf-8
### Logistic Regression with a Neural Network mindset ###
#
# Goal: to build a logistic regression classifier to recognize cats.
# This shows how to do this with a Neural Network mindset, and will also hone intuitions about deep learning.
#
### Import Packages ###
#
import numpy as np
import matplo... | true |
a3ec4ede29945bdeb056d185c9acbc31ce414b6a | Python | mengshixing/Django | /python3 note/chapter 12 常用内建模块/_contextlib.py | UTF-8 | 1,534 | 3.875 | 4 | [] | no_license | #contextlib上下文对象
#之前学到with打开文件不用担心资源未关闭
with open('bg.gif','rb') as f:
print(f.read(10))
#实际上,任何对象,只要正确实现了上下文管理,就可以用于with语句
#实现上下文管理是通过__enter__和__exit__这两个方法实现的
class test_contextlib():
def __enter__(self):
print('enter')
def __exit__(self,exc_type,exc_value,traceback):
print('exit')... | true |
187355b9356e26a895b90c619dbf9edcaa7eebda | Python | TestowanieAutomatyczneUG/laboratorium-12-tokarzmaciej | /src/zadanie2/zadanie2.py | UTF-8 | 1,190 | 2.9375 | 3 | [
"MIT"
] | permissive | class Subscriber:
def __init__(self):
self.clients = []
def addClient(self, name, email):
for client in self.clients:
if client["name"] == name and client["email"] == email:
raise Exception("This client exists")
if type(name) == str and type(email) == str:
... | true |
ddbb3d400b2bcdc3d9a4574ad51d83d99828c317 | Python | Padmabala/ProblemSolving | /Problems/Basics2_MinMax.py | UTF-8 | 364 | 3.96875 | 4 | [] | no_license | n=input("Enter the no. of elements: ")
elements=[int(input()) for x in range(int(n))]
min=elements[0]
max=elements[0]
minIndex=0
maxIndex=0
for x in range(len(elements)):
if(elements[x]<min):
min=elements[x]
minIndex=x
elif(elements[x]>max):
max=elements[x]
maxIndex=x
print(min,'... | true |
441d2020853e8918885460db93b45dffadb273ef | Python | gwqw/LessonsSolution | /stepik/DataStructure/04_Trees_BST/02_CheckBSTcorrectness.py | UTF-8 | 2,766 | 3.890625 | 4 | [] | no_license | """
Is binary search tree correct
Input: # the same as in previous task
n
key_i, left_i, right_i
Output:
CORRECT or INCORRECT
Ex.1
3
2 1 2
1 -1 -1
3 -1 -1
out: CORRECT
"""
import sys
CORRECT = "CORRECT"
INCORRECT = "INCORRECT"
class Node:
d... | true |
2ee431b60ece704534251609bb866f73e34eef44 | Python | astrobin/abc | /libabc/python/abc-test.py | UTF-8 | 741 | 2.53125 | 3 | [] | no_license | #! /usr/bin/env python
import unittest
import datetime
import PyABC
class ABCTest(unittest.TestCase):
def test_load(self):
image = PyABC.Image.fromFile('../tests/1_32i.fit')
self.assertTrue(isinstance(image, PyABC.Image))
self.assertEqual(image.type(), PyABC.ImageType.Light)
self.... | true |
f068e7dac7a3b11c7d25b344410d3d0b96be3593 | Python | potionk/baekjoon | /python/bj1655.py | UTF-8 | 693 | 3.203125 | 3 | [] | no_license | import sys
import heapq
test_case = int(sys.stdin.readline())
leftHeap = []
rightHeap = []
for i in range(test_case):
read = int(sys.stdin.readline())
if i == 0:
heapq.heappush(leftHeap, (-read, read))
elif len(leftHeap) == len(rightHeap):
heapq.heappush(leftHeap, (-read, read))
else:
... | true |
f1d293aba7aa15e8fc112b3989bbb144f4861b0d | Python | Ivan-Terex91/Async_API_sprint_1 | /app/services/genre.py | UTF-8 | 1,775 | 2.578125 | 3 | [] | no_license | from functools import lru_cache
from typing import List, Optional
from aioredis import Redis
from elasticsearch import AsyncElasticsearch, NotFoundError
from fastapi import Depends
from db.elastic import get_elastic
from db.redis import get_redis
from models.genre import Genre
GENRE_CACHE_EXPIRE_IN_SECONDS = 60 * 5
... | true |
5fb24d46e550e0d4f892dc269eff7623f2dad652 | Python | MaCanda/Project1 | /GPPowerball.py | UTF-8 | 5,128 | 3.65625 | 4 | [] | no_license | #-------------------------------------------------------------------------------
# Name: Greenphire Powerball program
# Purpose:
# This program allows the Greenphire employees to enter their
# favorite numbers and program computes the winning powerball
# number b... | true |
5d18693a0bc8fa4f7981e9a4ad16bedb3dde9a3b | Python | sthithpragya/Trajectory-generation-using-Model-Free-RL | /DQN_model/envs/modules/compute_alphaddot.py | UTF-8 | 949 | 2.65625 | 3 | [] | no_license | from .computeMM_separately import *
from itertools import chain
from .computeGG import *
from .Z1_func import *
from .Z2_func import *
import numpy as np
from math import *
def compute_alphaddot(N_mod,alpha_in,F1,F2,b,L):
alpha = [0]*N_mod
for j in range(N_mod):
alpha[j] = alpha_in[j... | true |
cf8d45ffef35b197104f6b267d2a05192a380e9e | Python | hrcosko/ip | /PJ/11_liste_reg.py | UTF-8 | 4,905 | 3.40625 | 3 | [
"Unlicense"
] | permissive | """Virtualna mašina za rad s listama; kolokvij 31. siječnja 2011. (Puljić).
9 registara (L1 do L9) koji drže liste cijelih brojeva (počinju od prazne),
2 naredbe (ubacivanje i izbacivanje elementa po indeksu),
3 upita (duljina i praznost liste, dohvaćanje elementa po indeksu).
"""
from pj import *
class LJ(enum.En... | true |
9194cddcce2ea92f2338da483fa6b358696c1d3c | Python | station-10/data_maturity_tool | /app.py | UTF-8 | 490 | 3.25 | 3 | [] | no_license | from modules.data_collection import collect_data
print("Welcome to Station10's Data Maturity Calculator")
print("What is the name of the company you would like to assess?")
company_name = input()
print("Please enter the homepage URL for " + company_name)
input_url = input()
print("Thank you")
data = collect_data(inpu... | true |
6ea23872891987962e5d51eddd7637b23b40adc5 | Python | lserraga/FTP | /test/mainTest.py | UTF-8 | 5,277 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
#Test that tests the correct functionallity of the ftp server-ftp client programs
#Include it in a Test directory but excecute it in the main directory python3 test/mainTest.py
#The test directory has to contain the 6 test files "Test1.txt","Test2.docx","Test3.jpg","Test4.pdf","Test5.c","Test6.p... | true |
34ace5ad74f4296aed82e0e5f56efeefefa578d2 | Python | sjudin/TempestBot | /SheetReader.py | UTF-8 | 1,396 | 2.71875 | 3 | [] | no_license | import gspread
import re
from oauth2client.service_account import ServiceAccountCredentials
def get_not_set_raiders():
# use creds to create a client to interact with the Google Drive API
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('service.jso... | true |
26870ef82f72a6ce0f8417c4e747a46478be7560 | Python | nguyenvantui/deepwriting-master-1 | /github_syn/mymdn4.py | UTF-8 | 8,186 | 2.875 | 3 | [] | no_license | import torch
from torch.nn.modules import Module, LSTM
import numpy as np
import matplotlib.pyplot as plt
import time
n_train = 100
device = "cuda"
def pr(a):
print(a)
def generate_data(n_train):
epsilon = np.random.normal(size=(n_train))
x = np.empty([], dtype=float)
for i in range(n_train):
... | true |
794d456b2f6d37d5d8a9587c7ad6a368a654ecc2 | Python | ggbsacet/machine-learning | /matplotlib-examples.py | UTF-8 | 2,234 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as py
import matplotlib.pyplot as plt
#a plot is something which has x axis and y axis, and we plot something on it
#Example with hard coded values for x and y
plt.plot([1,2,3],[5,7,6])
plt.show()
#Eamp... | true |