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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
15eea2c92a7e565979f784e9068f45d28574a4af | Python | alexandraback/datacollection | /solutions_1484496_0/Python/bigblind/A.py | UTF-8 | 858 | 2.828125 | 3 | [] | no_license | from __future__ import division
import itertools
inp = open('A.in')
out = open('A.out','w')
cases = int(inp.readline())
for case in xrange(1,cases+1):
numbers = [int(x) for x in inp.readline().split()[1:]]
print "case "+str(case)
out.write("Case #"+str(case)+":\n")
setlen = 1
numlen = len(numbers)
broken = Fa... | true |
5c25f87dd5cdeb6a940fa960436c4d4e200a2ac0 | Python | shantanuD1999/Tic-tac-3x3 | /tic_tac.py | UTF-8 | 2,060 | 3.65625 | 4 | [] | no_license |
v_list=["1","2","3","4","5","6","7","8","9"]
s_game=["-","-","-",
"-","-","-",
"-","-","-"]
def show_block():
print(s_game[0]+" | "+s_game[1]+" | "+s_game[2])
print(s_game[3]+" | "+s_game[4]+" | "+s_game[5])
print(s_game[6]+" | "+s_game[7]+" | "+s_game[8])
def p_inp... | true |
01e3ced9ab3aa349d7adc9b8ffa8ccf89fccca36 | Python | mlockwood/bioinformatics | /genome_clustering/mitochondria.py | UTF-8 | 834 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Michael Lockwood'
__github__ = 'mlockwood'
__email__ = 'lockwm@uw.edu'
def difference(s, t):
"""
Take two binary vectors of a population and find the resulting
difference value.
:param s: binary vector
:param t: binary vector
:retur... | true |
2c2b46e31b79c378fc694d0fef32f451223fa490 | Python | vpandiarajan20/Fundamentals-of-Computing-July-2020 | /Algorithmic Thinking/Application1Q1/Application 1 Part 3-4.py | UTF-8 | 4,075 | 3.75 | 4 | [] | no_license | #Application 1 Part 3-4
import random
import alg_dpa_trial as alg
import simpleplot
import math
def make_complete_graph(num_nodes):
"""
Takes the number of nodes num_nodes and returns a dictionary corresponding to a complete directed graph with the specified number of nodes.
A complete graph con... | true |
41fbd3b4e7da5b51b6a92570df2e06247b6c505a | Python | kadisin/Aplikacja_Trojboj_silowy | /database.py | UTF-8 | 5,304 | 2.640625 | 3 | [] | no_license | import pymysql
def last_index(select_):
connection = pymysql.connect(host="localhost",user="root",passwd="",database="trojboj_baza")
cursor = connection.cursor()
retrive = select_
cursor.execute(retrive)
rows = cursor.fetchall()
for row in rows:
last_index_ = row[0]
connect... | true |
f4fbe07e3c7958ffab37a5bf59bbe993045be09f | Python | mehulchopradev/yannick-python-core | /functions_as_objects.py | UTF-8 | 994 | 4.15625 | 4 | [] | no_license | def abc():
name = 'mehul' # name (abc)
age = 32 # age (abc)
def pqr(): # pqr (abc)
print('Pqr')
age = 20 # pqr scope
print(name) # (CLosures) inner function can very well acces the enclosing (outer) function variables
print(age) # 20
pqr()
print(age) # 32
# print(a... | true |
04d790560c2f472afefa0e2f32b2d1a5710df572 | Python | SuperstonkQuants/q1_correlations | /src/core/Stock.py | UTF-8 | 1,123 | 2.609375 | 3 | [
"MIT"
] | permissive | from yfinance import Ticker
import src.pre_processing as pp
import datetime as dt
class Stock:
def __init__(self, tk: Ticker):
self.master = tk
self.ticker = tk.ticker
self.history = None
def get_ticker_info(self):
return self.master.info
def get_history(self, start="2000... | true |
86711c2ee5c4a0917963739f6dce69f267184588 | Python | LinetTheFox/python-chess | /chess/cview/chessboard.py | UTF-8 | 1,394 | 3.71875 | 4 | [] | no_license | import os
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
def draw_empty_board():
clear()
print("โโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโ")
j = 0
for i in range(15):
if i % 2 == 0:
print(f"โ โ โ โ โ โ โ โ โ {8 - j}")
j += 1
else:
... | true |
2a5122d3a66e85b7b98e01e01791610668e11c11 | Python | chrismilson/advent-of-code | /2020/day-6/part-1.py | UTF-8 | 338 | 2.5625 | 3 | [] | no_license | if __name__ == "__main__":
group = set()
result = 0
with open('./customs-decleration.txt') as f:
for line in f:
if line == '\n':
result += len(group)
group = set()
else:
for c in line.strip():
group.add(c)
... | true |
43b712668c027021c10080e8bd1191fdd020ca68 | Python | lbolla/vr_python_example | /app.py | UTF-8 | 377 | 2.6875 | 3 | [] | no_license | import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
msg = '<br/>'.join(
'{}={}'.format(k, v)
for k, v in sorted(os.environ.iteritems()))
return msg
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.g... | true |
3c15d1558680c99036f4a92465ae3270780c0e49 | Python | SPAN-WashU/rub | /code/FixedLenBuffer.py | UTF-8 | 1,107 | 3.421875 | 3 | [] | no_license | # ########################################
# Code to provide a fixed-length buffer data type
class FixedLenBuffer:
def __init__(self, initlist):
self.frontInd = 0
self.data = initlist
self.len = len(initlist)
def list(self):
oldest = self.frontInd+1
return s... | true |
29838f62a31b14e16db773a8f70993e16a643f87 | Python | Simo0o08/DataScience_Assignment | /Ass-8/2.py | UTF-8 | 233 | 2.953125 | 3 | [] | no_license | from sklearn.preprocessing import LabelEncoder
import pandas as pd
le = LabelEncoder()
df=pd.read_csv(r"C:\Users\abc\Documents\Training Data science\datasets\titanic.csv")
df['Sex']=le.fit_transform(df['Sex'])
print(df.head())
| true |
e326da30d25f76b05675c3202a7aff2fbeb12564 | Python | tjlaboss/OpenMOC | /tests/test_geometry_dump/test_geometry_dump.py | UTF-8 | 4,779 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
sys.path.insert(0, os.path.join(os.pardir, 'openmoc'))
import openmoc
from testing_harness import TestHarness
from openmoc.log import py_printf
import os
class GeometryDumpTestHarness(TestHarness):
"""Test dumping a geometry to file."""
... | true |
70ba6f79870b37839ab41298031e45da26a22b15 | Python | Dython-sky/AID1908 | /study/1905/month01/code/Stage2/day04/bytes.py | UTF-8 | 335 | 4.03125 | 4 | [
"MIT"
] | permissive | s = "hello" # ๅญ็ฌฆไธฒ
print(s)
s = b"hello" # ๅญ่ไธฒ,ๅชๆASCIIๅญ็ฌฆๆ่ฝๅ b่ฝฌๆข
print(s)
"""
ๆๆๅญ็ฌฆไธฒ้ฝ่ฝๅค่ฝฌๆขไธบๅญ่ไธฒ๏ผ
ไฝๆฏๅนถไธๆฏๆๆ็ๅญ่ไธฒ้ฝ่ฝ่ฝฌๆขไธบๅญ็ฌฆไธฒ
"""
s = "ๆจๅฅฝ".encode() # ๅฐๅญ็ฌฆไธฒ่ฝฌๆขไธบๅญ่ไธฒ
print(s)
# ๅญ่ไธฒ ่ฝฌๆขไธบ ๅญ็ฌฆไธฒ
print(s.decode())
| true |
22b10dd25b304de9c9ffd5b346efc3acefecdeb9 | Python | sthkindacrazy/yelp | /Ensemble_of_logistic_regression.py | UTF-8 | 9,220 | 2.625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import data_loader as dl
import seaborn as sns
import matplotlib.pyplot as plt
import cleaning as cl
import re
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report
from sklearn.me... | true |
2689a0b30312221bc434ef0d44c0e31ed92d661b | Python | hayrapetyan-armine/deep-learning | /Homework_verjin/main.py | UTF-8 | 3,769 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
from models.DNN import *
from utils import create_data, get_data, create_directories
import argparse
def str2bool(value):
return value.lower == 'true'
parser = argparse.ArgumentParser(description='')
parser.add_argument('--train_images_dir', dest='train_images_dir', default='../data/train... | true |
1466d1256ad912b2a8f51139658289fd6e082808 | Python | blackarrowsec/advisories | /2018/CVE-2018-10024/CVE-2018-10024.py | UTF-8 | 2,547 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# CVE-2018-10024 - Credential leak
#
# Software: ubiQuoss Switch VP5208A
# Author: Juan Manuel Fernandez (@TheXC3LL) from BlackArrow
# Details: https://github.com/blackarrowsec/advisories/tree/master/2018/CVE-2018-10024
# Web: [www.blackarrow.net] - [www.tarlogic.com]
#
import argpar... | true |
3f029f1ae84c2e9530e29f782a56840e9acc3cb2 | Python | bkopanichuk/sevsed2 | /apps/document/services/document/set_reply_date_service.py | UTF-8 | 1,265 | 2.65625 | 3 | [
"MIT"
] | permissive | import datetime
from apps.document.models.document_constants import INCOMING
from apps.document.models.document_model import BaseDocument
class SetReplyDate:
""" ะััะฐะฝะพะฒะปัั ะบัะฝัะตะฒั ะดะฐัั ะฒัะดะฟะพะฒัะดั ะฝะฐ ะดะพะบัะผะตะฝั """
def __init__(self, doc):
self.document: BaseDocument = doc
def run(self):
se... | true |
71f4b727f64417c302ed2b78c691b6c3d4fcd07f | Python | AnmolKhawas/PythonAssignment | /Test 2/Q9.py | UTF-8 | 118 | 3.328125 | 3 | [] | no_license | #Downside pattern.
# 0000000
# 00000
# 000
# 0
for row in range(1,8,2):
print(" " *(row-1) + "O "*(8-row))
| true |
8177573ba4daf3e66e3cb77a5a087cc478b58d54 | Python | DyassKhalid007/MIT-6.001-Codes | /Week3Part2/Example_with_a_dictionary.py | UTF-8 | 3,376 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 17 14:38:58 2018
@author: Dyass
"""
"""
Topics:
Examples with a Dictionary:
1:Create a frequency distribution mapping str:int
2:Find a word that occurs the most and how many times:
use a list,in case there is mote than one word
... | true |
fb0f9fe1166c8a86a63c43905ca3725e8115c222 | Python | nyongja/Programmers | /KAKAO/2019 KAKAO BLIND RECRUITMENT/ํ๋ณดํค.py | UTF-8 | 1,097 | 2.859375 | 3 | [] | no_license | from itertools import combinations
def solution(relation):
answer = 0
n = len(relation[0]) # attributes ์
keys = []
# ๊ฐ๋ฅํ ํค ๋ชจ๋ ๊ตฌํ๊ธฐ
for comb in list(list(combinations(range(n), i)) for i in range(1, n+1)) : # ๊ฐ๋ฅํ feature ์กฐํฉ
for case in comb :
tmp = ["" for _ in range(len(relat... | true |
90bf003bb15db6f91ad8188d8a5371bb9fd5a3e2 | Python | joshiujjwal/solutions_leetcode | /Palindrome_Number/palindrome_number_sol1.py | UTF-8 | 303 | 3.234375 | 3 | [] | no_license | class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if (x < 0 or (x%10==0 and x!=0)) :
return False
r = 0
while(x>r):
r = r*10+x%10
x = x//10
return x == r//10 or x == r | true |
e630e4f356432bebdc6655deeb94f9c91e0940ce | Python | wonkim0512/BDP | /week6/13A.py | UTF-8 | 1,126 | 3.34375 | 3 | [] | no_license | # 21
def f21(tree):
if tree == []:
return 0
return 1 + max(f21(tree[1]), f21(tree[2]))
print(f21([]))
print(f21([1,[],[]]))
print(f21([1,[1,[],[]],[]]))
print("*"*20)
# f22
def f22(tree):
if tree == []:
return 0
return 1 + f22(tree[1]) + f22(tree[2])
print(f22([]))
print(f22([1,[],[]]... | true |
73331cb7e2aaac11eddd0a7756fa03d12a4f2e6a | Python | pavan-ka/StockSentimentAnalysis | /modelv3.py | UTF-8 | 2,065 | 2.6875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import train_test_split
def getSentiment(headline):
df = pd.read_csv("all-data.csv",encodin... | true |
58ae0284f65f15e0c53a7fcbcc829afcfadb1ac8 | Python | miafrank/popular-tweets-python | /popular_tweets/twitter_client.py | UTF-8 | 873 | 2.640625 | 3 | [] | no_license | import twitter
from popular_tweets import twitter_env
class TwitterClient:
def __init__(self):
self.creds = twitter_env.get_creds()
self.api = twitter.Api(consumer_key=self.creds["twitter_consumer_key"],
consumer_secret=self.creds["twitter_consumer_secret"],
... | true |
4e8ed6d6b96cadd47e009fecd5aaa7a5d0c02663 | Python | lucas-silvs/Curso-Guanabara | /Mundo - 1/Nome pessoa - SIlva.py | UTF-8 | 143 | 3.84375 | 4 | [] | no_license | nome = input('Digite o nome de uma pessoa\n')
e=nome.find("Silva")
print(f'O resultado รฉ: {e}\n Se for diferente de -1, possui o nome Silva') | true |
4a2581f87a64c38f282eacca0655e1a21b5db504 | Python | pablolich/coalescence_paper_analysis | /code/old_code/sampling_structure_test.py | UTF-8 | 4,275 | 3.296875 | 3 | [] | no_license | #Test dirichlet distribution sampling
## IMPORTS ##
import sys
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
from functions_clean import class_matrix
## FUNCTIONS ##
def concentration_vector(kf, spar, M, alpha, m, Mc):
'''
Create concentration vector for each row (substrate)
'''
... | true |
73dff32addccc66071aef5c3d06c9f8a90539a2e | Python | krok64/exercism.io | /python/luhn/luhn.py | UTF-8 | 638 | 3.1875 | 3 | [] | no_license | import re
class Luhn(object):
def __init__(self, num):
if len(num)<1:
raise ValueError
self.num = re.sub(" ","",num)
if re.search("\D", self.num) or len(num)==1:
self.invalid = True
else:
self.invalid = False
def is_valid(self):
if s... | true |
ba9116fdbf4dd2c957fcdd78e9dfd9b9c2ec9553 | Python | AkshitTayade/Malaria-Detection | /make_csv.py | UTF-8 | 1,509 | 2.828125 | 3 | [] | no_license | import glob
import cv2
import os
import matplotlib.pyplot as plt
import random
mypath = '/Users/akshit/Flask Development/Projects/Malaria Detection Web App/datasets/train/'
def image_processing(img):
img = cv2.imread(img)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_blur = cv2.GaussianBlur(img_g... | true |
98e962cf6bafc6c8c2bb36ac77cc7e3b8be18b44 | Python | Johnlky/DC-Boxjelly | /gui_testing/scrape/get_text_pos.py | UTF-8 | 620 | 2.734375 | 3 | [] | no_license | import easyocr
import pandas as pd
# setting, use English and enable the combination of characters and numbers
reader = easyocr.Reader(['en']) # be able to use CUDA, much faster than CPU
allow_list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 '
screenshot_list = ['analysis', 'client_info', 'equip... | true |
7796e5c9fb0c01c71f3b50b9e441dac249e30cb2 | Python | cristianrdev/dojoreads | /apps/login_app/views.py | UTF-8 | 1,986 | 2.640625 | 3 | [] | no_license |
from django.shortcuts import render, redirect
from .models import User
#importar los forms
from .forms.register import UserForm
from .forms.login import LoginForm
# Create your views here.
def index(request):
# si se carga el index por medio de un get
if request.method == 'GET':
# si no existe la ses... | true |
1aa7987f6e1e99cd4a5ae8b1066219d358f52616 | Python | theomarcusson/TFG | /c_vs_z_changing_t.py | UTF-8 | 1,070 | 3.125 | 3 | [] | no_license | from math import sqrt, erfc, exp, pi
from numpy import *
from matplotlib.pyplot import *
#CAMBIANDO VELOCIDAD Y DIAMETRO
di = (1.38e-23*300)/(6*3.1416*0.8513e-3*6e-9)
cB = float(5)
D = float(di)
v = float(1.6e-7)
T = float((4*D)/(pi*v**2))
#Variar t entre 1e-15 y 9e4
t0 = float (1e-15)
t1 = float (60)
t2 = float... | true |
783a88e568d39f51b8c9ac18909337c7779b04a3 | Python | Mai2407/class_def | /califi.py | UTF-8 | 1,454 | 3.390625 | 3 | [] | no_license |
nombre = input("Introducir nombre del estudiante: ")
plataforma = float(input("Introduce el valor de la calificaccion de la plataforma :"))
trabajo_Practico = float(input("Introduce el valor de la calificaccion del trabajo practico :"))
Actitud_y_Valores = float(input("Introduce el valor de la calificaccion de la... | true |
286a72474d51ace83af2c69630e2cacadc1001eb | Python | bryanvriel/iceutils | /iceutils/sim/forces.py | UTF-8 | 2,435 | 3.46875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #-*- coding: utf-8 -*-
import numpy as np
import sys
class CalvingForce:
"""
Encapsulates a time-varying forcing function at calving front.
Parameters
----------
A: float
Glen's Flow Law parameter in {a^-1} {Pa^-3}.
n: int, optional
Glen's Flow Law exponent. Default: 3.
fs... | true |
665430b853fbdc5a616d8036cd3a20bc6a8e8738 | Python | ballaneypranav/ucsd-dsa | /1-algo-toolbox/2-algorithmic-warmup/7_last_digit_of_the_sum_of_fibonacci_numbers_again/fibonacci_partial_sum.py | UTF-8 | 1,475 | 3.53125 | 4 | [] | no_license | # Uses python3
import sys
def fibonacci_partial_Sum(from_, to):
period = -1
fibListMod = [0, 1]
if from_ < 2 and to >= 1 :
Sum = 1
else:
Sum = 0
for i in range(2, to+1):
fibListMod.append((fibListMod[i-1] + fibListMod[i-2]) % 10)
if fibListMod[i] == 1 an... | true |
7fdf062a913ec901c494f473acc490c678777573 | Python | 5l1v3r1/strategy-idea | /viz.py | UTF-8 | 2,306 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 18 19:22:59 2019
@author: Amin Saqi
"""
import matplotlib.pyplot as plt
import matplotlib.dates as dates
from scipy.stats import norm, percentileofscore
import seaborn as sns
import pandas as pd
import numpy as np
# Handle date time conversions between pandas and matplo... | true |
05299a02e5e4c24cd058bb33bd19469d28153ae6 | Python | gHuwk/University | /Second course/4th semester/Computational Algorithms/Lab1 - Newton polynomial/revers.py | UTF-8 | 1,771 | 3.78125 | 4 | [
"MIT"
] | permissive | import numpy as np
from math import cos
def nearest_number(lst, x):
a = 0
b = len(lst) - 1
while a < b:
m = int((a + b) / 2)
if x < lst[m]:
a = m + 1
else:
b = m
return b
def function_recursion(x, y):
l = len(x)
if l == 1:
return y[0]
... | true |
7383fbfaa362c53c7d375c880f1320ca0608a29a | Python | anisabnis/trace_gen_git | /final_code/scale_fd.py | UTF-8 | 955 | 2.625 | 3 | [] | no_license | import sys
from collections import defaultdict
dir = sys.argv[1]
fd_file = sys.argv[2]
scale_factor = float(sys.argv[3])
fd = defaultdict(lambda : defaultdict(float))
f = open("results/" + dir + "/" + fd_file + ".txt" , "r")
l = f.readline()
l = l.strip().split(" ")
st = int(l[2])
end = int(l[3])
f1 = open("results... | true |
4115dac6e402b09de36489d0451afe8b1b11269d | Python | aarongilman/fypy | /fypy/volatility/implied/ImpliedVolCalculator.py | UTF-8 | 3,431 | 2.796875 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from typing import List
from py_lets_be_rational import implied_volatility_from_a_transformed_rational_guess
from fypy.termstructures.ForwardCurve import ForwardCurve
from fypy.termstructures.DiscountCurve import DiscountCurve
from fypy.pricing.analytical.black_scholes import *
cl... | true |
149b6c4df6b8fd271c607258591995ce41e85ceb | Python | soumyarout80/All_my_automation_scripts | /python/email.py | UTF-8 | 782 | 3.53125 | 4 | [] | no_license | #! /usr/bin/env python
import sys, re
"""
Verifies email address. Valid email addresses
must meet the following requirements:
Usernames can contain:
letters (a-z)
digits (0-9)
dashes (-)
underscores (_)
apostrophes (')
periods (.)
usernames must start with an alphanumeric character
"""
email_address = ... | true |
cd0a17bf7e1e2128639734843449b0c248f95bc8 | Python | arvidodengard/Arvid_odengard_te19c | /.vscode/laxa2.py | UTF-8 | 1,048 | 3.75 | 4 | [] | no_license | # Uppgift 1
a = float(input("valfritt tal"))
if a > 0:
print("possetivt")
elif a == 0:
print("noll")
elif a < 0:
print("negativt")
# Uppgift 3
a = float(input("Valfritt tal nummer 1"))
b = float(input("Valfritt tal nummer 2"))
if a > b:
print("Tal nummer 1 รคr stรถrst")
elif b > a:
print("Tal... | true |
b13c1ae3c3ba07fcf5000b11cf28c2a77f80349f | Python | mateusz-miernik/BootCamp_Python | /day18_turtle_graphics/exercises/turtle_figures.py | UTF-8 | 731 | 3.71875 | 4 | [] | no_license | from turtle import Turtle, Screen
import random as r
colors = ["magenta", "lime", "blue violet", "cyan", "gold", "firebrick1", "DarkSeaGreen"]
def draw_figure(obj: Turtle, number_of_sides=3, size=100):
angle = 360 / number_of_sides
for _ in range(number_of_sides):
obj.fd(size)
obj.rt(angle)
... | true |
21d2ff34ec491693eb65768e249c5e271ff25900 | Python | coddinglxf/DDI-with-rnn | /DDI-task/features/draw.py | UTF-8 | 933 | 2.8125 | 3 | [] | no_license | from sklearn.manifold import TSNE
import numpy as np
import matplotlib.pyplot as plt
number = 2
dimension = 2
all_vectors = []
all_labels = []
print("load embedding")
with open(str(number)) as openfile:
for line in openfile:
parts = line.strip("\r\n").split("\t")
if parts[0] == "4":
c... | true |
41bf07520165032e3d9b2238bb5c5c2fd0f99fbc | Python | matjazp/planet-lia | /games/planetization/bots/python3/my_bot.py | UTF-8 | 2,044 | 2.953125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import asyncio
import random
from core.bot import Bot
from core.networking_client import connect
from core.enums import *
# Example Python3 bot implementation for Planetization game.
class MyBot(Bot):
# Called only once before the match starts. It holds the
# data that you may need to setup your bot.
de... | true |
c45e164a04b302d941741d781a91df81659be04b | Python | delta2323/sg-mcmc-survey | /experiment/gaussian.py | UTF-8 | 874 | 3.171875 | 3 | [] | no_license | import chainer
from chainer import functions as F
import numpy
def gaussian_likelihood(x, mu, var):
"""Returns likelihood of ``x``, or ``N(x; mu, var)``
Args:
x(float, numpy.ndarray or chainer.Variable): sample data
mu(float or chainer.Variable): mean of Gaussian
var(float): variance ... | true |
92dee6a0b421bfa9df6725a21279c0507dbe663c | Python | allgenesconsidered/tla_bioinformatics | /sample_fastq.py | UTF-8 | 716 | 2.578125 | 3 | [] | no_license | from Bio import SeqIO
from numpy.random import choice
import argparse
def sample_fastq(fastq, n, out):
fq_list = list(SeqIO.parse(fastq, "fastq"))
subset_index = choice(fq_list,n,replace=False)
SeqIO.write(subset_index, out+".fastq", "fastq")
if __name__ == '__main__':
parser = argparse.ArgumentParser(
descri... | true |
34ca9361f0990c39a698e79332d329f77859cf15 | Python | Aasthaengg/IBMdataset | /Python_codes/p03826/s429622645.py | UTF-8 | 60 | 2.8125 | 3 | [] | no_license | a,b,c,d = map(int,input().split())
e = max(a*b,c*d)
print(e) | true |
881ac3c6dfd3f0163bcd10d6f639c72272190932 | Python | cypher9518/Youtube-Downloader | /main.py | UTF-8 | 3,044 | 2.9375 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from pytube import YouTube
Folder_Name = ""
def openLocation(): #FUN FOR FILE LOCATION
global Folder_Name
Folder_Name = filedialog.askdirectory(... | true |
6444522506e2fd1aaa6cf893d034d2af0e48ad96 | Python | chokoryu/atcoder | /problems/abc085_c.py | UTF-8 | 582 | 3.296875 | 3 | [] | no_license | # ABC085 C
def main():
n, Y = map(int, input().split())
total = 0
flag = False
res = [-1] * 3
for x in range(n+1):
total = 10000 * x
if total == Y and x == n:
res = [x, 0, 0]
break
for y in range(n-x+1):
z = n - x - y
total... | true |
4d01e33b72050f02b05fcf914f98fb7b15b18ca1 | Python | zengchenchen/OJ-Practice | /344.Reverse String.py | UTF-8 | 221 | 3.203125 | 3 | [] | no_license | class Solution(object):
def reverseString(self, s):
list_s = list(s)
list_s.reverse()
rev_s = ''.join([i for i in list_s])
return rev_s
a = Solution()
print(a.reverseString('hello'))
| true |
b6c45eee6bfa78b39c2f136d9fcc76cd9868f19d | Python | softdevteam/pyhyp_experiments | /benchmarks/deltablue/mono.py | UTF-8 | 16,825 | 2.890625 | 3 | [] | no_license | # Copyright 2008 the V8 project authors. All rights reserved.
# Copyright 1996 John Maloney and Mario Wolczko.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, ... | true |
a04ee2e74f17d3058c89beacafb3c4c43f12fd69 | Python | ullumullu/adventofcode2020 | /challenges/day2.py | UTF-8 | 2,020 | 4.09375 | 4 | [
"MIT"
] | permissive | """ --- Day 2: Password Philosophy ---
Part 1:
How many passwords are valid according to their policies?
Part 2:
How many passwords are valid according to the new interpretation
of the policies?
"""
from typing import List, Tuple
def _parse_input(password_set: str) -> Tuple[str, str, int, int]:
policy, passwor... | true |
66a83df6ac4a38c2766d231c3f51f215b811dc1b | Python | s3603075/ai-a2 | /connectfour/agents/agent_student.py | UTF-8 | 5,723 | 3.34375 | 3 | [
"MIT"
] | permissive | from connectfour.agents.computer_player import RandomAgent
class StudentAgent(RandomAgent):
def __init__(self, name):
super().__init__(name)
self.MaxDepth = 2
self.min = -10000000000
self.max = 10000000000
def get_move(self, board):
"""
Args:
... | true |
5fb55b41bd398c0bebd79a2501c30fb7a62d3340 | Python | alphin-roy2000/System-Software-Lab | /EXP6/producerconsumer.py | UTF-8 | 3,242 | 3.5 | 4 | [] | no_license | import Queue
import threading
import time
import random
exitFlag = 0 # flag indicates threads to stop
variation = 2. # defines the span for random time interval
# Parameters
# threadID : assigns unique ID to the thread
# name : assigns name to the thread
# ... | true |
ab43d27520cfd3fa0da166cd1ccc075629a28068 | Python | bunnie/EDIF-to-UCF | /iostandard.py | UTF-8 | 1,715 | 3.09375 | 3 | [
"BSD-3-Clause"
] | permissive | ''' iostandardMaps is a list of tuples
the first item in the tuple is a regex that is applied to the net name
the second item in the tuple is the corresponding I/O standard
Note that the programming aborts searching once the first match is found.
Therefore, the last item should always be ".*" as the de... | true |
a35ae9011b1f08da8c8f20b0b2ea44568542191d | Python | JoeNW/RaspberryPi | /client.py | UTF-8 | 479 | 2.921875 | 3 | [] | no_license | #client
import socket
import sys
if __name__ == '__main__': #ๅฆๆๆจกๅ่ขซ็ดๆฅ่ฟ่ก๏ผๅไปฃ็ ๅ่ขซ่ฟ่ก๏ผๅฆๆๆจกๅ่ขซๅฏผๅ
ฅ๏ผๅไปฃ็ ๅไธ่ขซ่ฟ่ก
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)#ๅๅปบTCP Socket
data_to_sent = 'hello tcp socket'
try:
sock.connect(('192.168.1.104',9999))
sent = sock.send(data_to_sent.encode())
... | true |
014dbf6b07db5a995f637525dc81ab237b82e0b9 | Python | PZ11/kagglegrocery | /wkfcst/w030_item_feature.py | UTF-8 | 7,239 | 2.6875 | 3 | [] | no_license |
"""
This is an upgraded version of Ceshine's LGBM starter script, simply adding
more average features and weekly average features on it.
"""
from datetime import date, timedelta
import pandas as pd
import numpy as np
import lightgbm as lgb
import sys
import math
import gc
import sklearn.metrics as skl_metrics
from l... | true |
fe56cccb1142ae875b7d25af085162dcdecf5759 | Python | IsabelValkrusman/PythonApplication7 | /PythonApplication7/PythonApplication7.py | UTF-8 | 8,221 | 2.53125 | 3 | [] | no_license | from tkinter import*
from tkinter import ttk
from tkinter import scrolledtext
from tkinter.filedialog import *
import fileinput
from tkinter.messagebox import*
root=Tk()
root.geometry("600x400")
root.title("Tรคhtkujud Tkinteris")
tabs=ttk.Notebook(root,width=300,height=300)
def open_(fail):
# file=askopenfilename()
... | true |
3bbe48daf0fc9260dcff792f877c9e4e0b1d3734 | Python | aliceebaird/MuSe2021 | /loss.py | UTF-8 | 2,130 | 2.59375 | 3 | [] | no_license | import torch
import torch.nn as nn
class CCCLoss(nn.Module):
def __init__(self):
super(CCCLoss, self).__init__()
def forward(self, y_pred, y_true, seq_lens=None):
if seq_lens is not None:
mask = torch.ones_like(y_true, device=y_true.device)
for i, seq_len in enumerate(... | true |
964798118578867e3d40a98681ca68052dd49550 | Python | gslinger/pyta | /pyta/overlays/simple_moving_average.py | UTF-8 | 136 | 3.109375 | 3 | [
"MIT"
] | permissive | import pandas as pd
def simple_moving_average(x: pd.Series, n: int = 20) -> pd.Series:
sma_ = x.rolling(n).mean()
return sma_
| true |
f40b70b7b621ea4f89b6ce18c5aee6d7d23f95e7 | Python | furkancetinkaya/nlp_assns | /assn06/main.py | UTF-8 | 5,456 | 3.28125 | 3 | [] | no_license | import json
import string
import os
from nltk.corpus import stopwords
from trnlp.morphology import TrnlpWord
from nltk import word_tokenize
stop_words = set(stopwords.words('turkish'))
class Dictionary:
""" Reads the dictionary.json and holds its entries. """
def __init__(self) -> None:
with open('di... | true |
c976b27a155ab981d005ccb1554fbc8422bb9550 | Python | robber5/yuna | /yuna/indicators/boll.py | UTF-8 | 1,446 | 3.296875 | 3 | [] | no_license | from math import sqrt
from ..core import TechnicalIndicator
from .ma import Ma
class Boll(TechnicalIndicator):
"""
ๅธๆๅธฆๆๆ
็ฎๆณๆฅๆบ๏ผhttps://en.wikipedia.org/wiki/Bollinger_Bands
"""
def __init__(self, data, n=20, p=2, handle='off'):
self.N = n
self.P = p
super().__init__(data, h... | true |
1d90f8826ed5e8b66b4bdf98efc9840e800ad9f9 | Python | Yasthir01/Bootcamp-Tasks-and-Projects-Part1 | /Level 1/Task 8/while2.py | UTF-8 | 654 | 4.40625 | 4 | [] | no_license | """Program that keeps asking a user to enter their name until they enter the correct one"""
name = "Yasthir" # I will be using my own name
counter = 1 # this will keep track of the number of tries
# get user input about their name
name_guess = input("Please enter in your name (type 'q' to quit) : ")
# keep on a... | true |
d5b58bedfccdcae72dd5172d3b2d7cd2b46091c6 | Python | hkamran80/chat-server_multiple-clients | /checkArgumentInput.py | UTF-8 | 1,934 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python
import socket
__author__ = 'Athanasios Garyfalos'
class ArgumentLookupError(LookupError):
"""Exception raised for errors in the input.
Attributes:
"""
pass
def __init__(self):
self.output = None
self.argument_list = []
def validate_argument_input(self, a... | true |
4a7d899ef847361dd2561e15c8f69188d09b0013 | Python | DanielPG25/proyecto_final_flask | /gamespot6.py | UTF-8 | 568 | 2.546875 | 3 | [] | no_license | import requests
import os
import sys
url_base= "https://www.gamespot.com/api/"
key=os.environ["KEY"]
parametros={"api_key":key,"format":"json","field_list":"categories"}
cabeceras={"User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0"}
r=requests.get(url_base+"articles/",params=parametros... | true |
e9658aaf20c06a96685431bf42fab5522cda2789 | Python | JACKHAHA363/langauge_drift_lewis_game | /scripts/gen_plots.py | UTF-8 | 3,697 | 3.0625 | 3 | [] | no_license | """
This script takes a tf board folder structure like
exp
|__exp1
| |__ run1
| |__ run2
| |__ run1
| |__ run1
| |__ run3
| |__ ...
| |__ runN
|
|__exp2
|__ run1
|__ run2
|__ run3
|__ ...
|__ runN
And generate plots with shaded area for all
"""
import argparse
import os
im... | true |
3b59f2b305fa054fe886d62a1a428d8ab7853eb0 | Python | Daedo/Otter | /representatives.py | UTF-8 | 1,180 | 2.890625 | 3 | [
"MIT"
] | permissive | from covering import *
import math
def get_representatives(covering: Covering) -> List[SplitClassSet]:
return explore(covering.class_sets.__iter__().__next__(), math.inf)[0]
def explore(class_set: SplitClassSet, cutoff: int) -> Tuple[List[SplitClassSet], int]:
if cutoff <= 0:
return ()
level = c... | true |
4a6af1ce5566407fa5e7de3cce952113e5362c24 | Python | freemanPy/scap_registry-foxyblue | /scap_lib/utils.py | UTF-8 | 315 | 2.84375 | 3 | [] | no_license | import re
import os
VAR_PATTERN = r'\${([A-Z]+)}'
def path_vars(path):
"""Insert the environment variables in path strings.
"""
env_vars = re.findall(VAR_PATTERN, path)
for key in env_vars:
value = os.environ.get(key)
path = path.replace("${" + key + "}", value)
return path
| true |
f0057823936ca4edeb8cb528fa5aef84414c6c1a | Python | murraycoding/Python_Examples | /normal python/nonlocal.py | UTF-8 | 137 | 3.453125 | 3 | [] | no_license | def exp(n):
n = 2
def num(x):
nonlocal n
return x**n
return num
square = exp(5)
print(square(9))
| true |
df516ec3571e5fddd64c6fcf31f8b0fa330442df | Python | voipep/infoF | /action-infoF.py | UTF-8 | 1,507 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
from snipsTools import SnipsConfigParser
from hermes_python.hermes import Hermes
from hermes_python.ontology.dialogue.intent import IntentMessage
CONFIG_INI = "config.ini"
# If this skill is supposed to run on the satellite,
# please get this mqtt connection info from <config.ini>
# Hint: MQT... | true |
5927b3dab09fc83c348ddac3446caabed481adda | Python | otilrac/face-mask-detector | /detect_mask_video.py | UTF-8 | 4,946 | 2.765625 | 3 | [
"MIT"
] | permissive | # python detect_mask_video.py
# @author: Paulo Medeiros
# Import the used packages
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
from imutils.video import VideoStream
import numpy as n... | true |
27176685818ffaf78c35b456610e17eca95c3fdc | Python | ChristianJoe/getting_to_know_tensorflow | /get_in_touch_w_tensorflow.py | UTF-8 | 1,929 | 3.65625 | 4 | [] | no_license | '''
## First steps and basic concept
In order to make my first steps with tensorflow and thus in the field of deep learning,
I used a YouTube tutorial
https://pythonprogramming.net/tensorflow-introduction-machine-learning-tutorial/
and this is the corresponding code example, pimped with my thoughts
Credits go to h... | true |
7744882efa8baa10d1cc5462882ce59c095a247f | Python | suvamdubey/InterviewPrep | /Group_People_given_their_GroupSize.py | UTF-8 | 410 | 2.921875 | 3 | [] | no_license | class Solution:
def groupThePeople(self, g: List[int]) -> List[List[int]]:
d = {}
l=[]
for i,j in enumerate(g):
if j not in d.keys():
d[j] = []
d[j].append(i)
for k in d.keys():
t=[d[k][i:i + k] for i in range(0, len(d[k]),... | true |
8866d1fb889e8223b9987a71ccfe2fd1a33eb5be | Python | YosefSchoen/FunctionalProgramming | /Homework1Assignment5/Assignment5.py | UTF-8 | 666 | 3.875 | 4 | [] | no_license | myInputList = eval(input("enter a list of integer numbers, strings, tuples, and lists"))
print(myInputList)
myTuples = []
myNestedElement = []
myNumbers = []
myStrings = []
for item in myInputList:
if isinstance(item, tuple):
myTuples.append(item)
elif isinstance(item, list):
myNestedElement.... | true |
1e8bdc2ed7b1a1767616ab176c57ca3ef57151c5 | Python | rykcode/python | /ML_Utils/RandomSampler.py | UTF-8 | 900 | 2.9375 | 3 | [] | no_license | '''
Created on Feb 21, 2013
@author: rohit
'''
'''
randomly sample any column in a delimited file
'''
from optparse import OptionParser
import random
import Utils
if __name__ == '__main__':
parser = OptionParser()
parser.add_option("-i", dest="inputFile", help="input file")
parser.add_option("-o", des... | true |
caf30a93dfb89851753afa67709f1310f153af66 | Python | Mostafa-hawa/hello-dessia | /test_1/core.py | UTF-8 | 4,355 | 2.59375 | 3 | [] | no_license | import volmdlr as vm
import volmdlr.primitives2d as p2d
import volmdlr.primitives3d as p3d
import plot_data.core as plot_data
import math
from dessia_common import DessiaObject
from typing import List
class Rivet(DessiaObject):
_standalone_in_db = True
def __init__(self, rivet_diameter: float, rivet_length:... | true |
dbaff221fc2fbaad5d043020005684a9322a46ad | Python | NicoleAlves/calculadora2020 | /calculadora.py | UTF-8 | 184 | 3.359375 | 3 | [] | no_license | def soma(x,y):
return x+y
def sub(x,y):
return x-y
def mult(x,y):
return x*y
def div(x,y):
return x/y
def elev(x,y):
return x**y
def raiz(x,y):
return x**(1/y)
| true |
37ae68eb4ac5698faecfdbd3394bfc56b502afc5 | Python | Akvanvig/Python-prosjekt | /youtube nedlasting/yt-download.py | UTF-8 | 4,299 | 2.515625 | 3 | [] | no_license | import youtube_dl, json
from youtube_dl.postprocessor.ffmpeg import FFmpegMetadataPP
#from mutagen.easyid3 import EasyID3
#Variabler brukt til รฅ lagre metadata
filnavn = ""
#Konfigurasjonsvariabler
video = False
#Brukes til รฅ loggfรธre feil, aktivere debugging
class ytdlLogger(object):
def debug(self, msg):
... | true |
a40b218047de7cd34da1d991d5c12dd11747aed6 | Python | efaysal/efaysal.github.io | /STRINGHYPERCOMP/POWERSETPYTHON/lastCODEpowset.py | UTF-8 | 16,422 | 3.1875 | 3 | [
"MIT"
] | permissive |
frame = 0
# Python program to illustrate the intersection
# of two lists using set() and intersection()
def powerSet(L):
global frame
frame += 1
if len(L) == 0:
# print('\nbase case, frame is', frame)
# print('returning [[]]')
return [[]]
else:
# print('\npre-recursive... | true |
8f72e0bbcdac8c7c59f7db2a6a1869e386bf7cdb | Python | EvgenyKarataev/raco | /raco/language/__init__.py | UTF-8 | 5,154 | 2.703125 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
import raco.expression as expression
import logging
LOG = logging.getLogger(__name__)
class Algebra(object):
__metaclass__ = ABCMeta
@abstractmethod
def opt_rules(self, **kwargs):
raise NotImplementedError("{op}.opt_rules()".format(op=type(self)))
class ... | true |
868e5f35424387beb6f5398f6469248d41abd4f1 | Python | mahehu/SGN-41007 | /code/ovarian.py | UTF-8 | 5,780 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 14:42:02 2015
@author: hehu
"""
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import cross_val_score, StratifiedKFold
from scipy.signal import lfilter
from sklearn.neighbors import... | true |
93293abccea8feac27745e3252568ae783630788 | Python | Aasthaengg/IBMdataset | /Python_codes/p03695/s520548822.py | UTF-8 | 761 | 3.015625 | 3 | [] | no_license | import sys
n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]
counter = [0,0,0,0,0,0,0,0]
counter_wild = 0
for x in a:
if x < 400:
counter[0] += 1
elif x < 800:
counter[1] += 1
elif x < 1200:
counter[2] += 1
elif x < 1600:
... | true |
e73cf18e3c586e647d8a9ec780fb048929618496 | Python | csy0x1/Python3-learning | /4/for4_1.py | UTF-8 | 348 | 3.84375 | 4 | [] | no_license | pizzas=['1','2','3','4','5','6']
print('first three:')
print(pizzas[0:3])
print('\nthe middle three')
print(pizzas[2:5])
print('\nthe last three')
print(pizzas[-3:])
friends_pizza=pizzas[:]
pizzas.append('7')
friends_pizza.append('8')
print('my:')
for pizza in pizzas:
print(pizza)
print('friends')
for pizza in fri... | true |
ac813142d99e8dd7320ba5605da3bf194304cad1 | Python | rakesh-cr/voice_assistant | /imagebtn.py | UTF-8 | 1,126 | 2.578125 | 3 | [] | no_license | import tkinter
from tkinter import *
from tkinter import messagebox
from main import chat
from main import exit
root = tkinter.Tk()
root.geometry("400x500")
#root.attributes('-alpha', 0.8)
photo = PhotoImage(file="mic.png")
photo2= PhotoImage(file="e10.png")
btn = Button(
root,
image=photo,
c... | true |
8b5919252c6202f5e3a75dbe65c573b5eacd8ed1 | Python | carloscubas/scraping | /BeautifullSoap/ScrapingLinksSiteCulinaria.py | UTF-8 | 390 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 21:31:34 2019
@author: cubas
"""
import requests
from bs4 import BeautifulSoup
url = 'https://guiadacozinha.com.br/category/almoco-de-domingo/'
page = requests.get(url)
recipe = BeautifulSoup(page.text, 'html.parser')
for card in recipe.find_a... | true |
b4d4e22b7c1d486debf242c815a2fe3890f5a28c | Python | CodyBuilder-dev/python-practice | /pythonic-code/chap01/first_class_func_parameter.py | UTF-8 | 351 | 3.53125 | 4 | [] | no_license | def square(x) :
return x**2
def bind(func,data) :
result_data = []
for i in data :
result_data.append(func(i))
return result_data
def main() :
data = [10,100]
print("data = ",data)
print("Function as Parameter : bind(square,data)")
print("result = ",bind(square,data))
if __nam... | true |
eee5125d2d2bc05dcf9dfab554afc57e33c9b24d | Python | BaronKhan/VoiceRecognitionRPG | /generators/room-generator/old/generateRoom.py | UTF-8 | 1,349 | 2.8125 | 3 | [] | no_license | import sys
import os.path
import csv
def renderBeginningFile(outputFile, outputName):
outputFile.write("\
package com.khan.baron.voicerecrpg.game.rooms;\n\
/* TODO: insert object imports */\n\
\n\
public class "+outputName+" extends Room {\n\
public "+outputName+"() {\n\
super();\n"
)
def renderEn... | true |
1ec496f9a9fa835e4738f8a74726a6a193b9aab2 | Python | flatiron-labs-and-lectures/python-class-variables-class-methods-lab-nyc-career-ds-102218 | /driver.py | UTF-8 | 2,509 | 3.734375 | 4 | [] | no_license | class Driver():
_all = [] # keeps track of all instance objects for the Driver class
# _all is a list of driver objects
_count = len(_all) or 0 # keeps track of the # of drivers in our fleet
def __init__(self,name,car_make,car_model):
self._name = name
self._car_make = car_make
... | true |
d9cd6a26320db4524b97cf313340c114e1e55b7f | Python | ppham27/Project-Euler | /problem016.py | UTF-8 | 225 | 3.65625 | 4 | [] | no_license | """
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
"""
def find_sum_digits(n):
return sum(map(int,str(n)))
n = 2**1000
print(find_sum_digits(n)) | true |
9436624c06de2a230937a7c56db10f0cdc54c62e | Python | seemantinic/Programming-Foundations-using-Python | /mini project pt2.py | UTF-8 | 478 | 4 | 4 | [] | no_license | import turtle
def draw_circle(some_turtle):
for i in range(1,44):
some_turtle.circle(i)
i += 4
def draw_art():
window = turtle.Screen()
window.bgcolor("green")
#create turtle brad for square
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("orange... | true |
f1e03299e0fbdd03f1257e389093eed2c488f1cc | Python | joramwessels/nlp | /Part B/b_step2.py | UTF-8 | 2,956 | 3.296875 | 3 | [] | no_license | #! /usr/bin/python
"""
NLP Part B
Amir Alnomani 10437797
Maurits Offerhaus 10400036
Joram Wessels 10631542
Compiles using Python version 3.5 with the following command:
./b-step1.py -h [number] -v [number] -input [non-binarized] -output [binarized]
"""
import sys, argparse
from parse import binarizeTreebank
def ma... | true |
8723688a6f2905f46d3567884f730cf0ecce3aff | Python | ahmad0711/PracticeOfPython | /05_pr_string.py | UTF-8 | 472 | 3.765625 | 4 | [] | no_license | # practice set strig
# name = input("Please Enter your name")
# print("Good Afternoon, " + name)
# letter = '''Dear <|NAME|>,
# You are selected
# Date: <|DATE|>
# '''
# name = input("Enter your name ")
# date = input("Enter Date ")
# letter = letter.replace("<|NAME|>", name)
# letter = letter.replace... | true |
b2ef87f1fa17e9b574dc748fa50593de4ce6b1bc | Python | weese/hass-apps | /hass_apps/heaty/config.py | UTF-8 | 12,639 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """
This module contains the CONFIG_SCHEMA for validation with voluptuous.
"""
import typing as T
import voluptuous as vol
from . import expr, schedule, util
from .room import Room
from .thermostat import Thermostat
from .window_sensor import WindowSensor
from .stats import StatisticsZone
def build_schedule_rule(r... | true |
dd0866a49c5311e1ef33347b8049dd9b1befee05 | Python | jacarvalho/pos_tag_neurons | /byte_LSTM/tests/utils_test.py | UTF-8 | 2,386 | 2.640625 | 3 | [
"MIT"
] | permissive | import unittest
import numpy as np
from utils import TextLoader
class utils_tests(unittest.TestCase):
def test_create_batches_1(self):
"""
Test creation of batches.
"""
# Test contains 'abcdefhij', 10 chars
data_loader = TextLoader(data_dir="tests/data/", batch_size=1,
... | true |
48daf45f1bbd3df55498156e77a2d4d8a9082740 | Python | AfiqHarith20/Lab-test-1 | /Lab test 1/function.py | UTF-8 | 302 | 4.1875 | 4 | [] | no_license | x = 10
a = 3
b = 4
def multiply_by_two(x):
return x * 2
def add_numbers(a,b):
return a + b
arguments = {
x: 10,
a: 3,
b: 4
}
print (multiply_by_two(10))
print ("Arguments are: "+str(x))
print (add_numbers(3,4))
print ("Arguments are: "+str(a)+", "+str(b))
| true |
f3fe8f6735b630683c4db49c48a1801c22388f77 | Python | jmasvial/Learning-Python-For-Network-Eng-Class | /week7/cdp-file-reader.py | UTF-8 | 519 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import re
with open("r1_cdp.txt") as f:
a = f.read()
hostname = re.search(r"Device ID: (.+)",a).group(1)
ip = re.search(r"IP address: (.+)",a).group(1)
vendor,model = re.search(r"Platform: (.+?) (.+?),",a).group(1,2)
device_type = re.search(r"Platform: .+Capabilities: (.+?) ",a).group(1)
prin... | true |
38f59ef492d5f656d60b77ace95186dc22bdff15 | Python | davidpasini/NVDA_EMAs_crossover | /bS_NVDA_ema_xover_v3FTR.py | UTF-8 | 4,068 | 3.140625 | 3 | [] | no_license | """
Title: NVDA 200-103-20 30 mins EMA crossover
Description: This is a long only strategy which buys on EMA20
crossover EMA103 if close is already above EMA200; The position is
closed based on EMA20 crossunder EMA103 or through stoplosses.
Asset class: Equities
Dataset: NYSE Minute
... | true |
610b297b0d94bc6df06f8d51a7c9c42aa06e67e4 | Python | sjw991123/store | /ไธญๅฝๅทฅๅ้ถ่ก/ไธญๅฝๅทฅๅ้ถ่ก.py | UTF-8 | 13,994 | 2.875 | 3 | [] | no_license | import random
import pymysql
# ๆฐๆฎๅบ
bank = {}
bankname = "ไธญๅฝๅทฅๅ้ถ่กๅไบฌๆๅนณๆฏ่ก" # ้ถ่กๅ็งฐ
host = "localhost"
user = "root"
password = "123456"
database = "bank"
def update(sql, param): # ๅขๅ ๆน
con = pymysql.connect(host=host, user=user, password=password, database=database) # ๅๅปบๆงๅถๅฐ
kongzhi = con.cursor(... | true |
d991109cd5c0cbe72d9ce52811225e084b929cac | Python | Liarra/CatToy | /ToyController/executables/Laser.py | UTF-8 | 401 | 2.546875 | 3 | [] | no_license | import RPi.GPIO as GPIO
laser_is_started = False
laser_pwm = None
def startup():
global laser_is_started
global laser_pwm
GPIO.setmode(GPIO.BOARD)
GPIO.setup(15, GPIO.OUT)
GPIO.output(15, True)
#laser_pwm = GPIO.PWM(15, 100)
#laser_pwm.start(0)
laser_is_started = True
def shutdown(... | true |
ab2a4465463478b784d27a72b06b94acafd926f8 | Python | rhambach/TEMimage | /CellAverage/GUI_reciprocal_basis.py | UTF-8 | 5,581 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Simple GUI for visualising and analysing FFT patterns
USAGE
An example can be found at the end of this file and can be executed
using 'python fft_plot.py'
COPYRIGHT
Copyright (c) 2011, Ralf Hambach. All rights reserved.
Use of this source code is governed by a BSD-style license that... | true |