blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
7481fd54ff3d7b9d5db074f2531495d059bbbf69
vsejpal/PyPractice
/nThLastOfLinkedList.py
UTF-8
1,014
3.75
4
[]
no_license
__author__ = 'vsejpal@gmail.com' class NthLast: ''' Finds the Nth Last Element of a linked list by calling findNthLast ''' def setupList(self): a = Node("A") b = Node("B") c = Node("C") d = Node("D") e = Node("E") a.next = b b.next = c c.nex...
true
56c4e7d725faaf4cb927447e94c3458a9bcbb7ee
ubsuny/MC_RandomNetworks-RaspiZero
/utility/generate_network.py
UTF-8
7,760
3.09375
3
[]
no_license
from numpy.linalg import eigh from numpy import append, argwhere, arange, array, diag, delete, ones, random, sum, triu, zeros from matplotlib import pyplot as plt import networkx as nx class Erdos_Renyi_GNP: def __init__(self, N, p, A = None, self_edges = False): ''' N -> the ...
true
715279100115c1beb21294a9f8d2382236aa663e
j0fiN/ColorRecommender
/Tests/test_api2.py
UTF-8
463
2.828125
3
[]
no_license
import unittest import requests class MyTestCase(unittest.TestCase): def test_1(self): res = requests.get(url="http://127.0.0.1:5000/b7438d633dd9915c") self.assertEqual(res.status_code, 200) def test_2(self): res = requests.get(url="http://127.0.0.1:5000/b7438d633dd9915c") pri...
true
50b52962b628e784e0db47318cc4d6d32878ec50
minhanh29/a-star-pathfinding
/a_star.py
UTF-8
3,793
3.59375
4
[]
no_license
import pygame from Colors import Color from Cell import Cell from queue import PriorityQueue WIDTH = 500 SIZE = 50 GAP = WIDTH // SIZE window = pygame.display.set_mode((WIDTH, WIDTH)) pygame.display.set_caption("A* Path Finding") clock = pygame.time.Clock() def draw(window, width, size, grid): window.fill(Color...
true
1f531a48fdf20942a424ad9fb1b29120ad4cca02
XCSoar/xcsoar-data-content
/script/build/sortrepo.py
UTF-8
2,751
3.140625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys def parse_record(record_lines): name = "" uri = "" type = "" area = "" description = "" update = "" for line in record_lines: if line.startswith("name="): name = line.split("=")[1] name = name.strip...
true
aee0907bd36687ecd6ae4f0c82389ed70f8996ce
kunitaka0605/toiro
/toiro/classifiers/classifier_svm.py
UTF-8
2,793
3.046875
3
[ "Apache-2.0" ]
permissive
import time import pickle from sklearn.svm import LinearSVC from sklearn.metrics import f1_score from sklearn.metrics import accuracy_score from sklearn.metrics import classification_report from sklearn.feature_extraction.text import TfidfVectorizer from toiro import tokenizers from toiro import classifiers class ...
true
7fdc68aeb2f7bf0b5b742744c26692cc02ada488
agundry/soccer_pipeline
/helpers.py
UTF-8
404
2.734375
3
[]
no_license
import datetime def get_bucket_start_from_epoch(epoch): epoch_dt = datetime.datetime.utcfromtimestamp(epoch) epoch_dt_rounded = epoch_dt.replace(day=1,hour=0,minute=0,second=0,microsecond=0) return epoch_dt_rounded class dotdict(dict): """dot.notation access to dictionary attributes""" __getattr...
true
cbe8c9749150d8b7400587362f663b0aec012f64
KyungHoon0126/Algorithm
/SNIPPET/N진법 변환.py
UTF-8
777
4.1875
4
[]
no_license
# N진수 -> 10진수 : int() # 2진수 -> bin() / 8진수 -> oct() / 16진수 -> hex() # 10진수 N진수 변환 함수. ''' Case 1 ''' def convert1(number, n): answer = [] # 변환할 수(number)를 N으로 나누어 나머지를 더함. while number >= 1: number, r = divmod(number, n) answer.append(r) # 더한 나머지를 역순으로 출력. return int(''.join(map(...
true
ed3ec39f2bc9f2f070bad0f4344340cb3ef633c5
jamesfholland/galaxy-creator
/galaxygen.py
UTF-8
3,688
3.296875
3
[]
no_license
import math import random totalStars = 500000 numSpiralStars = totalStars/2 numInnerStars = totalStars/4 numAmbientStars = totalStars/4 #Barred Spiral constants used in all passes - Real pain to change A = 1.0 B = 0.25 N = 4.1 #Increase to widen spirals. Each pass uses a different width. width = 0.50 #Increase to mak...
true
8dfe2dc88be79d1f159157aea6d577a3b59e8a4f
armolina/web_scrapping
/scraper_srv/entity/request_log.py
UTF-8
372
2.5625
3
[]
no_license
import uuid def request_log(start_date, end_date, web_scrapered, payload): request_log_dict = { 'uuid': str(uuid.uuid1()), 'start_date': start_date, 'end_date': end_date, 'web_scrapered': web_scrapered, 'object_type': "href", 'number_objetcs': len(payload), '...
true
d5d96e3cf41b10539d72ace1d265dec8be73cb62
chabibabatounde/optimisation-comportement
/Algo_Genetique/AlgoGenetique.py
UTF-8
9,769
2.96875
3
[]
no_license
# coding: utf-8 from Modules import Solution as mdSolution Solution = mdSolution.Solution import random import json import pandas as pd import matplotlib.pyplot as pltl class AlgoGenetique: taillePopulation = 0 maxIterration = 0 nombreCroisement = 0 population = [] def __init__(self, probleme...
true
64a48d0b42b027d11d8e83ec7306ea1a11066aeb
Kardaani/Python_examples
/exercises/exercise_1_bis_13_mult.py
UTF-8
41
3
3
[]
no_license
for i in range(0, 100, 13): print(i)
true
5e1f0f5811d44e097a99e3244b7ff331ffb47157
gabirel1/projethub-ateka
/commands_class/commands.py
UTF-8
1,636
2.625
3
[]
no_license
class COMMANDS : def __init__(self): self.commands = [ {"sentence": 'quel est mon G P A', "fid": 1, "toSay": 'tu as', "toSay2": 'de GPA'}, {"sentence": "combien est ce que j'ai de credits", "fid": 2, "toSay": 'tu as', "toSay2": 'credits'}, {"sentence": 'Lis moi ma dernier...
true
45652c7ea8379ba84ce1e74ef72309707cb27364
samanthakucher/MecanicaClasica
/Hiperion/Hiperion.py
UTF-8
2,591
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np from matplotlib import pyplot as plt from scipy.integrate import odeint import matplotlib.animation as animation def h(x, t, G, l, M): R, Rv, T, Tv, F, Fv = x Ra = R*(Fv**2)-(G*M)/(R**2)-(9*G*M*((np.cos(T-F)**2))*(l**2))/(8*(R**4)) Fa = (3*G*M*np.sin(2*...
true
631410909181e9a6cedaf168c837397e722feeb3
liaofaz/ro
/基础/推导式.py
UTF-8
2,287
4.25
4
[]
no_license
# 推导式的作用:简化代码 # 在Python中,推导式适用于列表、字典、集合(可变类型,元祖不可变) # ---------------------------------------------------------------------------- # 列表推导式: 用一个表达式来 创建 或 控制 一个有规律的列表 # 例子:创建一个0-10的列表 # 1、用while循环实现 # list1 = [] # n = 0 # while n<=10: # list1.append(n) # n+=1 # print('list1 = ',list1) # --------...
true
e4b53ebacc8e697971d580e5707bb557c7148a0b
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_201/1122.py
UTF-8
545
2.8125
3
[]
no_license
dir="/home/yuxh/Desktop/c/c" def divide(n): if n%2==0: return n//2,n//2 else: return (n+1)//2,n//2 def magic(n,k): dic={n:1} for i in range(k-1): m=max(dic) dic[m]-=1 if dic[m]==0: del dic[m] a,b=divide(m-1) if a in dic: dic[a]+=1 else: dic[a]=1 if b in dic: dic[b]+=1 else: d...
true
9e4ea92d611ffb79d6f47323b46f62a1d34fb590
AnnotationSoftware/superannotate-python-sdk
/superannotate/db/annotation_classes.py
UTF-8
6,114
2.5625
3
[ "MIT" ]
permissive
import io import json import logging from pathlib import Path import boto3 from ..api import API from ..exceptions import SABaseException logger = logging.getLogger("superannotate-python-sdk") _api = API.get_instance() def create_annotation_class(project, name, color, attribute_groups=None): """Create annotat...
true
c570eada3c0bd5c9593e95dfc56edf35df846f90
neuphi/smodels-ml
/mlCore/trainer.py
UTF-8
7,903
2.671875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ .. module:: trainModel.py :synopsis: run gridsearch to train optimal neural networks for smodels-database maps .. moduleauthor:: Philipp Neuhuber <ph.neuhuber@gmail.com> """ import os import torch import matplotlib.pyplot as plt from copy import deepcopy from pat...
true
e00f1cf8527a77fe0cb4c66dc4c76a5599abe899
casparschwa/selfish_mining_abm
/selfish_mining_abm/selfish_node.py
UTF-8
26,393
2.53125
3
[]
no_license
import logging class SelfishNode: def __init__(self, id, block_tree, eta, current_block=0, verbose=False): self.verbose = verbose if self.verbose: logging.info("SelfishNode() instance created") self.id = id self.block_tree = block_tree self.eta = eta # hashin...
true
d896435b16fa2283557dc5eafb084558391f5c71
lluizaferreira/PYTHON-PARA-ZUMBIS
/LISTA 1.py
UTF-8
2,193
4.0625
4
[]
no_license
# Exercicio 1 n1 = int(input( '1o número: ')) n2 = int(input( '2o número: ')) print (n1+n2) # Exercicio 2 m = int(input( 'Metros: ')) print (f'Milímetros: {m*1000}') # Exercicio 3 d = int(input('Dias: ')) h = int(input('Horas:')) m = int(input('Minutos: ')) s = int(input('Segundos: ')) total = d*24*60*...
true
db44fb5fa22baa867262a4f88305a6da4eda3215
alexlobko/simplechat
/chat/fdatabase.py
UTF-8
900
3.140625
3
[]
no_license
import sqlite3 import time import math class FDataBase: def __init__(self, db): self.__db = db self.__cur = db.cursor() def addMessage(self, name, text): try: tm = math.floor(time.time()) self.__cur.execute("INSERT INTO messages VALUES(NULL, ?, ?, ?)", (name, t...
true
7ad0f243664ae1e4aa401f2647041c4b17d0b6f3
dpocheng/Python-Data-Structure-of-Python
/program1solution/fa.py
UTF-8
1,306
3.125
3
[ "Apache-2.0" ]
permissive
import goody def read_fa(file): fa = dict() for line in file: desc = line.strip().split(';') fa[desc[0]] = dict(zip(desc[1::2],desc[2::2])) return fa def print_fa(fa): print('\nFinite Automaton Description') for s in sorted(fa): print(' ',s,'transitions:',sorted...
true
a7bf3ab54c1b19b412b4f2c3e9d8ddc9fd136e0a
AlbertMukhammadiev/SnapshotsEfficiency
/efficiency/calculate.py
UTF-8
4,694
2.75
3
[ "MIT" ]
permissive
from sys import argv from argparse import ArgumentParser from csv import reader, writer from numpy import array from collections import deque import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from efficiency import migrations def create_parser(): """Parse com...
true
2da6e3aa1ca8c01f3153c8c055ee61480e3f6399
priyaSNHU/Practice-Questions
/linkedlist/remove_duplicates.py
UTF-8
923
3.75
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def add(self, data): temp = Node(data) temp.next = self.head self.head = temp def printx(self): current = self.head ...
true
5536218d962cc6fe6eb434aad0397927524c9f66
ContextLab/storytelling-with-data
/data-stories/semantic-mapping/util.py
UTF-8
13,630
2.859375
3
[ "MIT" ]
permissive
import numpy as np import tables #from matplotlib.pyplot import figure, show import scipy.linalg def make_delayed(stim, delays, circpad=False): """Creates non-interpolated concatenated delayed versions of [stim] with the given [delays] (in samples). If [circpad], instead of being padded with zeros, [...
true
f453a3308e8ec8ff5fd08bf8c7656b57f5b72562
andreArtelt/contrastive_explanations
/Implementation/lvq_models.py
UTF-8
4,185
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- coding: utf-8 -*- import numpy as np import cvxpy as cp import sklearn_lvq def compute_pertinent_positive(x_orig, y_orig, base_values, model): dim = x_orig.shape[0] # Variables x = cp.Variable(dim) # Constants epsilon = 1e-3 distmat = None if isinstance(model, sklearn_lvq.Glvq...
true
53241ca1c1b921d54bddad9556283a0d7b6fc2c9
metamemelord/Data-Structure-Basics
/Kosaraju strongly connected component.py
UTF-8
1,200
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Oct 29 16:11:47 2017 @author: MetaMemeLord- """ import sys sys.setrecursionlimit(100010) def allDone(k): for i in range(k,len(x)): if not done[i]: return i return -1 s = [] def dfs(node): if done[node]: return done[node] = True...
true
7056537e844a27564d5b94f8100e64f0d8dcaefe
yingrinsing/python_grammar
/TestTools/xmind_to_excel/xmind_to_excel.py
UTF-8
1,320
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2019-10-10 20:27 # @Author : yingrinsing # @File : xmind_to_excel.py """ 功能说明 """ import xml.etree.ElementTree as ET import xlwt import argparse g_row = 0 def do_write_excel(text, row, col): # print text + " row %d + col %d"%(row, col) ws.write(row, col, text) de...
true
a3608814c90e455d3d08d073b53ea37301dfa37d
KhangDuyLe/portfolio-selection
/Algorithms/result.py
UTF-8
4,053
2.90625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle # from universal import tools import seaborn as sns # from statsmodels.api import OLS from . import tools from matplotlib.colors import ListedColormap class AlgoResult(): """ Results returned by algo's run method. The class conta...
true
8e25bed987c76f24fa7b417ed888461fdfd834b3
grcbit/pyScripts
/mitmproxy1.py
UTF-8
1,643
2.6875
3
[]
no_license
#------------------------------------------------ #Script mitmproxy que guarda una sesion HTTP #Los datos se guardan en un diccionario y archivo #------------------------------------------------- import os def response(flow): rFlow = {} rContent = '' #----------------------------- #Diccionario para Re...
true
efdeb4880b42dd7fbbc5613d92823da4e9760418
wkordalski/cantionale
/cantionale.py
UTF-8
1,040
2.9375
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- import sys import re import os from parser import parse_file from style import Style from content_error import ContentError from song import Song from songbook import Songbook ''' If your text is one line string then you can use from reportlab.pdfbase.pdfmetrics import st...
true
d17f7f6f64e74cc4ee03854049ada26f747b173c
ShoOgino/JudgeIfAbstractIsReadable
/model.py
UTF-8
11,057
2.5625
3
[]
no_license
import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from sklearn.metrics import precision_score from sklearn.ensemble import RandomForestClassifier from sklea...
true
d5c8d2df3408ba79dd4fb2ebe8363138ce8ad10c
gamejobmob/python
/for구구단.py
UTF-8
100
4.03125
4
[]
no_license
for i in range(2, 10) : for j in range(1, 10) : print(f"{i}X{j}=", i*j) print()
true
8aca1b8581845ccc39852adb8f2e73f12cfcbddb
tmiskell/klaviyo_code_challenge
/weather_app_site/register/models.py
UTF-8
1,758
2.796875
3
[]
no_license
from __future__ import unicode_literals from django.db import models from .global_vars import US_CITY_MAX_LEN, US_STATE_MAX_LEN, AIRPORT_MAX_LEN, EMAIL_MAX_LEN # Create your models here. class Location( models.Model ): """ Currently, longest U.S. city name is 22 characters. Add extra space for names...
true
de6f2e2af69aae430d724f7a048c2abffae3af89
loveandkill/recruit
/接口项目实战一(WEB项目)/接口测试用例/新建学校.py
UTF-8
1,688
2.5625
3
[]
no_license
__author__ = 'xny' # date : 2018/6/28 import requests import json from urllib import parse # 第一步:登录教育局招生管理系统 url_login="http://127.0.0.1:8090/recruit.students/login/in?account=admin&pwd=660B8D2D5359FF6F94F8D3345698F88C" #把请求头信息进行处理,去掉一些没用的,保留一些有用头信息· headers1 = { "Connection": "keep-alive", "User-Agent": "Mozi...
true
f18bdd42cf6ead19075ea0a206aaa755a5089c27
PEGGY-CAO/ai_python
/exam1/question4.py
UTF-8
209
4
4
[]
no_license
# Use NumPy function arange to create an array of 20 even integers from 2 through 40, # then reshape the result into a 4-by-5 array. import numpy as np array = np.arange(2, 41, 2).reshape(4, 5) print(array)
true
5e72a1bebc719275f91b008fcc87e375900650ad
Suvanika/Analysis
/result.py
UTF-8
705
3.25
3
[]
no_license
import pandas as pd import numpy import csv outputfile ='lstm.csv' #outputfile ="naivebayes.csv" testfile ='trainingandtestdata/testdataset.csv' df = pd.read_csv(outputfile, names=['id', 'value' ]) pos =0 neg =0 sentiment =df['value'] count = len(df)-1 i=0 value =[] for line in sentiment: if(i==0): i=1 ...
true
7f914031cd780b56065312d61247516ab484106a
Leofighting/Practice-on-LeetCode
/LeetCodeV2/双指针/234. 回文链表.py
UTF-8
288
3.21875
3
[]
no_license
# -*- coding:utf-8 -*- __author__ = "leo" # 请判断一个链表是否为回文链表。 class Solution: def is_palindrome(self, head): lst = [] while head is not None: lst.append(head.val) head = head.next return lst == lst[::-1]
true
be31efa7493fd5426b7abed36760aabcc3cbf338
taojin526/KingsPro
/ServerBattle/fight/test/test.py
UTF-8
665
2.890625
3
[]
no_license
from fight.events.events import BEvents events = BEvents() class Test: """""" def __init__(self, name): self.name = name self.bindevents() def bindevents(self): """""" events.register("test1", self.newtest) events.register("test1", self.mytest) ...
true
c86ae0af2e2be2aa9da5cccae42eb97b355aea8c
kjosib/booze-tools
/tests/test_lalr.py
UTF-8
1,047
2.703125
3
[ "MIT" ]
permissive
import unittest from boozetools.parsing.context_free import Rule, ContextFreeGrammar from boozetools.parsing.lalr import lalr_construction def lalr_complete() -> ContextFreeGrammar: # Frank DeRemer and Thomas Pennello give an LR0 graph for a grammar that is LALR, but not NQLALR. # "Efficient Computation of LALR(1) ...
true
479b95359f6658700fed5f947566515b0a51c396
Farhannibal/ECE4600
/serverSide/socketServer.py
UTF-8
2,826
2.953125
3
[]
no_license
import bluetooth import json # Library of command def listOfCommand(command): return{ "ACK4S":0, "ACK4C":1, "UP":2, "DOWN":3, "LEFT":4, "RIGHT":5, "STOP":6, "QUIT":98 }.get(command, 99) # default will be WAIT # Definition of some basic data and address #hostMACAddress = '60:6c:66:b5:63:d1' # Farhan...
true
671fe996e3d319271be12d3dffebaddc7e393cf6
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_99/433.py
UTF-8
901
2.9375
3
[]
no_license
filein = open('./A-small-attempt0.in', 'r') fileout = open('./A-small-attempt0.out', 'w') lines = filein.readlines() data = {} for i, line in enumerate(lines): if not i == 0: if i % 2 == 1: data[(i+1)/2] = {} temp = line.split(' ') a = int(temp[0]) b = int(temp[1]) data[(i+1)/2]["A"] = a data[(i+1...
true
47b9870beada4a0dfdfa44dbeaa830abbcd87972
ksh24865/aws-study
/test.py
UTF-8
224
2.8125
3
[]
no_license
import json def lambda_handler(event, context): #print("Received event: " + json.dumps(event, indent=2)) res = "test complete !! your value = " + event['key'] + "\n" return res # Echo back the first key value
true
e5169a6084764982aeff521db9ecff79b5d61708
plewczynski/cog-abm
/src/cog_abm/ML/core.py
UTF-8
6,286
2.984375
3
[ "BSD-3-Clause" ]
permissive
""" Most useful things connected with ML """ import math from itertools import izip from random import shuffle from scipy.io.arff import loadarff from cog_abm.extras.tools import flatten class Classifier(object): def classify(self, sample): pass def classify_pval(self, sample): """ ...
true
f6c6be49a57e69aae156ecd78dcc84aebbd4db9e
nischalshrestha/automatic_wat_discovery
/Notebooks/py/dingxwsimon/titanic-framework/titanic-framework.py
UTF-8
6,965
3.640625
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Titanic # https://www.kaggle.com/c/titanic # 加入numpy, pandas, matplot等库 # In[ ]: import numpy as np import pandas as pd import matplotlib.pyplot as plt # 读入数据 # In[ ]: dataset=pd.read_csv('../input/train.csv') testset=pd.read_csv('../input/test.csv') # In[ ]: da...
true
7d30b5872d793a50b256113fdf4c0e911544b360
vidya781/Computational-Geometry
/Computational Geometry/Kleesalgoalternative.py
UTF-8
1,175
3.640625
4
[]
no_license
"""Given starting and ending positions of segments on a line, the task is to take the union of all given line segments and find the length covered by the line segments""" segments = [(2,5),(4,8),(9,12)] # a hardcoded example but can easily be altered for more points def beginandend(segments): startpoints =...
true
11272a547b477c1e0efa861d9489069ab140d93d
jampekka/pydatacube
/examples/intro.py
UTF-8
7,864
3.609375
4
[ "MIT" ]
permissive
# ## Imports and setup # To get a data in, it has to be in a format readable by importers. The # internal data format is in a bit of a flux, so input and output should be # only in these formats, meaning currently JSON-stat. We use JSON-stat in this # example, but similar stuff for PC-Axis can be done using the # `pyd...
true
9d25f8674f1a1a159d8712c4e6df0e815fcebba7
rt-jmoors/project_euler
/problem_25/1000-digit_fibonacci_number.py
UTF-8
376
4.15625
4
[]
no_license
# 1000-digit Fibonacci number def fib(n): if n == 1: return 1 elif n == 2: return 1 else: return fib(n-1) + fib(n-2) fib_list = [1, 1] while len(str(fib_list[-1])) < 1000: fib_list.append(fib_list[-2] + fib_list[-1]) print('index = ', len(fib_list)) print('length digits = ', ...
true
fb6b38a3d3d12d87d584708144764eac1c6adbd4
Aasthaengg/IBMdataset
/Python_codes/p03477/s232342903.py
UTF-8
157
3.625
4
[]
no_license
a, b, c, d = map(int, input().split()) n = a + b - c - d if n < 0: print('Right') elif n == 0: print('Balanced') else: print('Left')
true
06b3013203fc5ed569676d2b786692ba60f54286
deccico/gowest
/gowestapp/go/datasets/red_light_camera_notices/process.py
UTF-8
2,072
3.328125
3
[ "MIT" ]
permissive
''' Get dictionary of {suburb => [avg number of monthly fines, avg fine value]} ''' import csv import os def getRedLightFinesBySuburb(): file = open(os.path.dirname(os.path.realpath(__file__)) + '/data.csv', 'r') isfirst = True reader = csv.reader(file) # Start by storing totals so we can calculate we...
true
1089aea634d21462b04c9752824ae447d838a641
jayeom-fitz/Algorithms
/CodeUp/Python기초100/6065-6070[기초-조건]/6069-평가 입력받아 다르게 출력하기.py
UTF-8
316
3.75
4
[]
no_license
""" CodeUp 6069 : [기초-조건/선택실행구조] 평가 입력받아 다르게 출력하기(py) https://www.codeup.kr/problem.php?id=6069 """ n = input() if n == 'A' : print('best!!!') elif n == 'B' : print('good!!') elif n == 'C' : print('run!') elif n == 'D' : print('slowly~') else : print('what?')
true
9218547a1a196ed38ff31fb69ace872556c487c1
ulmangt/csi709-image-processing
/homework2/findcolor.py
UTF-8
2,620
3.234375
3
[]
no_license
import os, sys, scipy, numpy, Image, sophia def main(): findcolor( findfile( '20120129a.jpg' ) ).show() def findcolor( image, color=(255,131,22), tolerance=30, mode=1 ): """ Given an image (or a file path pointing to an image file) and a size three tuple representing an RGB color returns a new image with all pixe...
true
a9da16bae488ac716fa16773a12848d91fa95623
chloequinto/OnlineSocialNetworks
/A07/main.py
UTF-8
4,204
3.875
4
[]
no_license
''' Chloe Quinto HW 7 - Using the Twitterr API to access Twitter Data Description: This python script is intended to use Twitter Data for data search/retrieval and processing/analysis. It utilizes Tweepy API To Run: type into the terminal `python3 main.py` Dependencies: - Install Tweepy - Twitter Accoun...
true
7f771faba89c37c17063cd3937d923bfcd80d69a
danielbalcerzak/mobile_project
/depot.py
UTF-8
2,120
2.5625
3
[]
no_license
import mobile_operator import client from random import randint as rint from random import choice # client variables START_CALL_SEC = 1 END_CALL_SEC = 20 # depot variables NUM_OF_ACTIONS = 50 MIN_KB = 1 MAX_KB = 6 NUM_OF_USERS = 10 MIN_ITEM = 10 MAX_ITEM = 200 FIRST_NUM = 100000000 LAST_NUM = 999999999 SMS_LONG = 16...
true
a4b5c6a4827fe31a5081ec45a8a1d2a375d43d18
Jsteranko223/Term-Project-Overooked-
/Username.py
UTF-8
1,525
3.125
3
[]
no_license
def username(): import pygame pygame.init() pygame.font.init() screen = pygame.display.set_mode((1000,600)) background = pygame.image.load("Images/GameOver.png")\ .convert_alpha() myfont = pygame.font.SysFont('Segoe UI Black', 30) play = False name = ''...
true
79c9421ba1170787af07b6d7553b56b9590ee87e
HEUMMAN/codingTest
/programmers/test1.py
UTF-8
981
2.921875
3
[]
no_license
def solution(id_list, report, k): report = set(report) reported = {} mail_list = {} for id in id_list: mail_list[id] = 0 answer = [] make_reported_cases(report, reported) reported = {key:value for key, value in reported.items() if value >= k} make_mails(mail_list, report, re...
true
cbde8004b7be2badad1744e68cd5f55f263f9330
JulianFlesch/discavar-vcf
/discavar/filters.py
UTF-8
11,907
2.796875
3
[ "MIT" ]
permissive
from .cli import warning, error, Description from cyvcf2 import VCF # static method for applying a check multiple samples def all_pass(variants, check): for var in variants: if not check(var): return False return True class AnnotationFilter: """ AnnotationFilter takes an annotati...
true
2c9d9acfc852aa120d82aae839b437e792676b00
MilanHarkhani/Dino_AI
/trainNetwork.py
UTF-8
3,116
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Apr 18 12:13:48 2019 @author: Milan """ from CNN_Model import ACTIONS import numpy as np from collections import deque import random import time GAMMA =0.99 #decay rate OBESERVATION = 50000 # oberservation before start training EXPLORE = 100000 FINAL_EPS = 0....
true
1755f96ba45ba511b9c0b203dd547b5d600baedb
Augustinas01/PythonAsync
/fankcija.py
UTF-8
1,936
2.703125
3
[]
no_license
import random, hashlib # start_time = time.time() ltrs = "a06b17c28d39e4f5" # csgoroll = "d72742438a6e6a294add67905c693e139f5cf9cf86ee5f45d5678ed4b09af547" # csgoempire = "94c8ec9e17655f93f68f3fdc225ac278efc21406956b92ff8850830ddf029bc8" def randomword(length): letters = ltrs return ''.join(random.choice(le...
true
2394e75fb4288a6c3e9449271064f38ef2fb52fb
matangover/thesis-results-analysis
/deep_learning.py
UTF-8
1,017
2.921875
3
[ "MIT" ]
permissive
# --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.2' # jupytext_version: 1.2.1 # --- # %% # %matplotlib inline import numpy, matplotlib.pyplot as plt import seaborn # %% seaborn.set(font_scale=...
true
8e4735bb55a039bd70535297d40b3eaaedbc385e
piyush09/LeetCode
/Spiral Matrix.py
UTF-8
1,513
4.53125
5
[]
no_license
""" Algo: Traverse right and increment row begin. Traverse down and decrement col end. Traverse left and decrement row end. Traverse up and increment col begin. When traversing left or up, check whether the row or col still exists to prevent duplicates. T.C. - O(N) - where N is total number of...
true
682f1baf15f8b6990282d3d214ae4bf368c2c921
rippy1849/anomdetect
/Past Files/one_class_svm_outlier.py
UTF-8
439
2.90625
3
[]
no_license
from sklearn.svm import OneClassSVM import pandas as pd data = pd.read_csv('nci1.csv') number_of_rows = len(data.index) color_map = [] color_set = ['red','blue','yellow','green','orange','purple'] clf = OneClassSVM(gamma='auto').fit(data.drop(['type'], axis= 1)) clf_prediction = clf.predict(data.drop(['type'], axis= ...
true
5bfa02b031dd2bc5c8cc3922d7cfbd46ce4d0e7c
XiangLei5833/Python-
/practise2-10.py
UTF-8
222
3.34375
3
[]
no_license
#!/usr/bin/env python try: a = float(raw_input("Enter a number(0~100): ")) if 0 < a < 100: print "succession" else: print 'ValueError,Please input again' except: print "Please input again"
true
9674a4902cc8ca8f8f3be80283093640fdd296b0
bellcodo/laughing-meme
/typing_picker.py
UTF-8
709
3.1875
3
[]
no_license
# import the magic random picker import random, urllib2 # list of things to pick from url_for_list = "https://raw.githubusercontent.com/bellcodo/laughing-meme/master/typing_options.lst" raw_typing_options = urllib2.urlopen(url_for_list) list_of_options = raw_typing_options.read() #print "DEBUG - raw typing options is ...
true
6053a44382b5dd56a9d9a572b7695d1cc97f86f0
fudamai/classwork
/0303system-fulishuang/差评分析/core/analysis.py
UTF-8
4,120
2.921875
3
[]
no_license
#! python # -*- coding:utf-8 -*- # Author:fudamai """给定评论数据,分辨出差评 """ import csv import re import os import requests import jieba import jieba.analyse from core import log_fun from core.comment_hunter import Recorder BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) stop_words = os.path.join(B...
true
fa889f2152d9a3ba899ab5a4fa2224504ed0cbb7
nivha/cross-language-ml-light
/crosslanguage/learning/CVHandler.py
UTF-8
1,493
2.9375
3
[]
no_license
__author__ = 'Mojo' from sklearn.cross_validation import KFold class FoldGenerator(object): """ Gets sizes of english and spanish datasets and return indices of necessary CV stuff.. """ def __init__(self, ds_size, k_units, n_units_per_fold): self.ds_size = ds_size self.k_units =...
true
5dd09521f2d09354bbf07547c96acaabb808a6e8
gtzampanakis/projeuler
/316.py
UTF-8
372
2.984375
3
[]
no_license
import itertools import memoize digits = 6 sum_per_k = { } for di in xrange(1, 1 + digits): sum_per_k[di] = 1. @memoize.MemoizedFunction def p(k): if k > digits: sum_per_k[k] = sum_per_k[k-1] - p(k-digits) return 10**(-digits) * (sum_per_k[k]) running = 0. for a in itertools.count(1): pa = p(a) running +=...
true
24e3600adac108c9d115cbe62b48286188fca616
LucaRitz/informatik_seminar_gan
/python/mnist.py
UTF-8
2,330
2.84375
3
[]
no_license
import tensorflow as tf from tensorflow.keras import layers # Source: https://github.com/tensorflow/docs/blob/master/site/en/tutorials/generative/dcgan.ipynb def make_generator_model(): model = tf.keras.Sequential() model.add(layers.Dense(7*7*256, use_bias=False, input_shape=(100,))) model.add(layers.Bat...
true
c357206c204d42f49090cab6fc90ebdd5526981d
Moenupa/MINEWORLDY
/python_tools/others/man_grass_goat_wolf.py
UTF-8
733
3.046875
3
[]
no_license
pst = list('EEEE') def chg(obj): if obj == 'E': obj = 'W' elif obj == 'W': obj = 'E' return obj def chk2(obj1,obj2): if obj1 == obj2: return True else: return False def chk3(obj1=pst[1],obj2=pst[2],obj3=pst[3]): if obj1 == obj2 and obj2 == obj3: return Tru...
true
cfb28ed9f6d1160c43236a37c685ba188050775c
anbansal/Python-for-Everybody
/Ch7-Files/pythonicFileHandler.py
UTF-8
639
3.6875
4
[]
no_license
def search(fhand,str): count = 0 for line in fhand: if line.find(str) != -1: print(line.rstrip()) count = count + 1 print("The total no of lines which start with", str, "are ", count) if __name__ == '__main__': while True: fname = input("Type your file name: ")...
true
d1720e785dfaf0a73cd1642ef2a2146bf17c0e97
TPSGrzegorz/PyCharmStart
/itertoolsPermutations.py
UTF-8
234
3.140625
3
[]
no_license
from itertools import permutations string, n = input().split() result = list(permutations(sorted(string), int(n))) for i in result: print(''.join(i)) #print(*[''.join(i) for i in permutations(sorted(string), int(n))], sep='\n')
true
3e8a27c32ec29305c3eaa8931ab47a682d5a6020
wy51r/MovieLen-resys
/utils/__init__.py
UTF-8
119
2.71875
3
[]
no_license
#!/usr/bin/env python import sys def msg(info): """Debug output """ print >> sys.stderr, ">>", str(info)
true
18c05e065ee91548836df8ead9425d68f63f6ba1
ravi2493/Minesweeper
/constraint.py
UTF-8
1,022
3.15625
3
[]
no_license
class constraint: value = None var_list = [] def __init__(self,var_list,val): self.value = val self.var_list = var_list def delete(self,i,j): if (i,j) in self.var_list: self.var_list.remove((i,j)) def get_all_sols(self): l = self.get_sols(self.var_list,s...
true
41decfca4d8f37668d9fd63633d54be0ff06272b
jonathanvv1989/edx_mitx_icsp
/tests/test_3_lecture_ex.py
UTF-8
2,399
3.375
3
[]
no_license
import unittest import ch3_examples as ch3expl import ch3_exercises as ch3ex # Use tests for best practice # mostly uses print statements to see functions output class TestChap3Expl(unittest.TestCase): def test_sqrt_int(self): print(ch3expl.sqrt_int(25)) print(ch3expl.sqrt_int(-4)) print(c...
true
4225e01a230fe4527d671feb137ddcbc4d5d967b
gargbhoomika/Text-Generator
/text_generator.py
UTF-8
1,368
3.65625
4
[]
no_license
import string import random vowels = 'AEIOUY' consonants = 'bcdfghjklmnpqrstvwxz' letter_input1 = input("What letter do you want? Enter 'v' for vowels, 'c' for consonants, 'l' for any letter: ") letter_input2 = input("What letter do you want? Enter 'v' for vowels, 'c' for consonants, 'l' for any letter: ") letter_input...
true
4e8ecf1140913254437fa999070816e1a674ca32
digitalsleuth/RATDecoders
/malwareconfig/decoders/hrat.py
UTF-8
1,562
2.515625
3
[ "MIT" ]
permissive
import re from malwareconfig.common import Decoder from malwareconfig.common import string_printable class Hrat(Decoder): decoder_name = "Hrat" decoder__version = 1 decoder_author = "@kevthehermit" decoder_description = "Houdini and WSH RAT Decoder" def __init__(self): self.config = {} ...
true
f4d61341115d3de2386f4ed89705f9cdb970d6e0
jpsagarm95/SpellChecker
/prior.py
UTF-8
914
2.75
3
[]
no_license
import pickle fp = open("data/all-words-cleaned.txt", 'r') data = fp.read() fp.close() dic = {} splitdata = data.split('\n') numOfWords = len(splitdata) - 1 prior = {} counts = {} total = 0 words = [] for i in range(0, numOfWords): temp = splitdata[i].upper() words.append(temp) prior[temp] = 0 counts[temp] = 0 pri...
true
ccb399124b19311f151a5385d21ed74d5406519a
gabriellaec/desoft-analise-exercicios
/backup/user_253/ch23_2020_04_20_20_16_24_717964.py
UTF-8
117
3.140625
3
[]
no_license
v=int(input('qual velocidade vc foi?' )) if v>80: m=v-80*5 print(m) else: print('Não foi multado)
true
7ef5442861b8a7f220d81f2acef5b319fb49d1a7
vorzawk/pEuler
/q5_nthPrimeNo.py
UTF-8
420
3.5625
4
[]
no_license
n = 1 def chkPrime(num): d = 2 while (d*d <= num): if (num%d == 0): return False d = d + 1 return True def nthPrime(n): cntPrime = 1 # Counting 2 right away so that only odd nos can be checked for i in range(3,150000,2): if chkPrime(i): cntPrime = ...
true
f46449ccc352076ea8d912fa362cdf79c50be988
dfd/ml_utils
/ml_utils/pandas_utils.py
UTF-8
10,342
3.59375
4
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import pandas as pd import numpy as np from scipy import stats def get_num_char_vars(data, missing=False, limit=None): """ Return lists of column names for numeric and character columns data: a pandas DataFrame missing: boolean for whether to return only names...
true
b0462044d5680c82ff77495da4c823de7d400037
YKato521/ironpython-stubs
/release/stubs.min/System/Windows/Controls/__init___parts/DataGridColumnEventArgs.py
UTF-8
599
2.75
3
[ "MIT" ]
permissive
class DataGridColumnEventArgs(EventArgs): """ Provides data for the System.Windows.Controls.DataGrid.ColumnDisplayIndexChanged and System.Windows.Controls.DataGrid.ColumnReordered events. DataGridColumnEventArgs(column: DataGridColumn) """ @staticmethod def __new__(self, column): ...
true
9b3cbba98307005ecfbf182893eb4c2ec87c9bd2
mikeckennedy/pycon-sk-pythonic-talk
/code/n3_keywords/safer_calls_with_keywords.py
UTF-8
867
2.984375
3
[ "MIT" ]
permissive
def connect_v1(user, server, replicate, use_ssl): print("Connect v1, called with: ") print(f"User = {user}") print(f"Server = {server}") print(f"Replicate = {replicate}") print(f"Use SSL = {use_ssl}") print() def connect_v2(*, user, server, replicate, use_ssl): print("Connect v2, called wi...
true
f3fe2d5d6e5a1cc2e173b5e2c1746d5908ce1dd4
wisest30/AlgoStudy
/source/leetcode/1405/yan.py
UTF-8
884
3.15625
3
[]
no_license
from heapq import heappush, heappop class Solution: def longestDiverseString(self, a: int, b: int, c: int) -> str: s = '' heap = [] if a: heappush(heap, (-a, 'a')) if b: heappush(heap, (-b, 'b')) if c: heappush(heap, (-c,...
true
6b223a5161894b493a19575cba3304cecd7afc87
austins1999/AdventOfCode2020
/Day2/main.py
UTF-8
925
3.34375
3
[]
no_license
def partOne(): valid = 0 file = open("Day2/input.txt", "r") for line in file: lineList = line.split(" ") range = lineList[0].split("-") target = lineList[1][0] targetCount = 0 for char in lineList[2]: if char == target: targetCount+=1 ...
true
475f476834b714afb43016501d623f29f157af27
MuzikaFoundation/muzika-platform-server
/modules/pagination.py
UTF-8
2,327
2.546875
3
[]
no_license
from sqlalchemy import text import math class Pagination: def __init__(self, fetch, count, order, current_page, connection=None, list_num=20, page_num=5, fetch_params=None): self.connection = connection self.sql_query = {'count': count, 'fetch': fetch, 'order': order} self.list_num = int(l...
true
2be76f1f7bf695aab78077cffb6154139ccbe378
inancg/Sleep-Analyzer
/sleep_phases_analysis/test_environment.py
UTF-8
3,502
2.609375
3
[]
no_license
#! /usr/bin/env python3.4 import preprocessing as pp import data_import as di import time_unique as tu import random as r import write_to_remarks as w2r from operator import itemgetter LIGHT_SLEEP = 'lightSleep' DEEP_SLEEP = 'deepSleep' TIMES_TESTED = 50 TEST_SUBJECT_ID = 6771 af_data = dict(pp.di.f_data) avg_bad_sl...
true
05678dc6838ca9104cc58fb58ad0e79a86d565bf
jfto23/termtype
/termtype.py
UTF-8
6,724
2.921875
3
[ "MIT" ]
permissive
import curses import time import random import os def main(stdscr): curses.start_color() curses.use_default_colors() # colors curses.init_pair(1, curses.COLOR_RED, -1) curses.init_pair(2, curses.COLOR_GREEN, -1) curses.init_pair(3, curses.COLOR_MAGENTA, -1) curses.init_pair(4, curses....
true
e98166a21e424b25aed0b6961584b013ddcfe96b
brainmentorspvtltd/RDE_Python
/ME+CE/if_else.py
UTF-8
294
4.125
4
[]
no_license
num = int(input("Enter a number : ")) ''' if num % 2 == 0: print("Number is Even") else: print("Number is Odd") ''' ''' if num % 2 == 0:print("Number is Even") else:print("Number is Odd") ''' result = "Even" if num % 2 == 0 else "Odd" print(result)
true
705d22b17a50d5324558ab9651d3c3c5fba8fce0
henrylaih41/NASAHackathon
/model/player.py
UTF-8
481
2.75
3
[]
no_license
from model.modelConst import * class Player(): def __init__(self): self.hunger = HUGER_START self.spirit = SPIRIT_START self.point = POINT_START self.thirst = 0 # search history # self. def getState(self): return {"hunger":self.hunger, "spirit":self.spirit, "point":self.point, "thirst":sel...
true
c71c17003a0fff31a8b90a4edaf84dc7cc4e2398
AvisekNaug/AI6360
/Homework2/mopyhex-all/mopyhex-all/miai_mctsagent.py
UTF-8
814
3.0625
3
[]
no_license
from mctsagent import * from miai_gamestate import miai_gamestate class miai_mctsagent(mctsagent): def roll_out(self, state): """ Simulate an entirely random game from the passed state and return the winning player. """ state = miai_gamestate(state) moves = state.moves() while(state.miai_winne...
true
6c471b3f126f6a4f4ca16ef47e227e911e90259d
HOIg3r/LINFO1101-Intro-a-la-progra
/Mission/Mission 6/assistant.py
UTF-8
6,531
3.9375
4
[]
no_license
#programme Mission 6 #Réalisé par Cindie SCHEUREN et Jacques HOGGE #28 octobre 2020 print('\nBienvenue dans votre assistant personalisée !\nTaper la commande "help" pour connaitre toutes les commandes et leur fonctionnement.') #Message d'entrée du programme commands = ["file", "info", "dictionary", "search", "sum...
true
0c85e5c7d22e424845be82974fa01067cb595693
carderne/descarteslabs-python
/descarteslabs/common/tasks/exporttask.py
UTF-8
4,141
2.546875
3
[ "Apache-2.0" ]
permissive
import time from descarteslabs.client.exceptions import NotFoundError from descarteslabs.client.services.storage import Storage from descarteslabs.common.tasks import FutureTask, TransientResultError, TimeoutError class ExportTask(FutureTask): """ An export task. Accessing any attributes before the task is c...
true
e36d689f8e4dbb41d2cd278ed27ea07c7b4ec51f
PyForce/rosie
/robot/motion/MotorHandler/MotorDriver/Board/MD25.py
UTF-8
5,523
2.75
3
[]
no_license
import logging try: import smbus except: logging.error("smbus unavailable") from robot.motion.MotorHandler.MotorDriver.Dual import DualPowerMotorDriver class MD25MotorDriver(DualPowerMotorDriver): """ Class to use MD25 motor controller board using I2C bus @param i2c_bus_number: I2C bus number to ...
true
9445ee0fb258fab8ffc207f5f4d96c1c54ad7315
akanimax/T2F
/implementation/networks/TextEncoder.py
UTF-8
3,470
3.28125
3
[ "MIT" ]
permissive
""" Module defining the text encoder used for conditioning the generation of the GAN """ import torch as th class Encoder(th.nn.Module): """ Encodes the given text input into a high dimensional embedding vector uses LSTM internally """ def __init__(self, embedding_size, vocab_size, hidden_size, ...
true
bc315db2a20d24a471c46db2b24224bce7de0671
hengruizhang98/dgl
/python/dgl/_deprecate/runtime/ir/var.py
UTF-8
2,647
3.03125
3
[ "Apache-2.0" ]
permissive
"""Module for variables.""" # pylint: disable=invalid-name from __future__ import absolute_import from .program import get_current_prog class VarType(object): """Variable types.""" # Types for symbolic objects (i.e, they might not be # concretized before evaluation. FEAT = 0 FEAT_DICT = 1 # T...
true
6242076b616101cd8bec71461faef612655702c9
fr4c74l/spyclique
/main.py
UTF-8
1,498
2.859375
3
[]
no_license
#!/usr/bin/env python3 import graph import networkx as nx import matplotlib.pyplot as plt def calc_values(in_clique_nctbc, gr): values = [] for node in gr.nodes(): if node//10000000 == 9: values.append('blue') else: if node in in_clique_nctbc: values.appe...
true
3db2b5de84a1a5cca4c4bc5006ff62fda4b3e657
spanickroon/Python-Tasks
/session_3/task_3_4.py
UTF-8
1,012
4.0625
4
[]
no_license
""" Task 3.4 Implement a function, that receives changeable number of dictionaries (keys - letters, values - numbers) and combines them into one dictionary. Dict values should be summarized in case of identical keys def combine_dicts(*args): ... dict_1 = {'a': 100, 'b': 200} dict_2 = {'a': 200, 'c': 300} dict_3 = {'a':...
true
6867b0865b4cd22d91c9f05e96c39c32f44263f1
strikingraghu/Python-Advanced-Samples
/ClassBased_Decorator_Sample.py
UTF-8
550
4.21875
4
[]
no_license
""" Class objects as decorators """ class BaseClass: def __init__(self, f): print("Calling __init__ function") self.f = f print("**",f) self.count = 0 def __call__(self, *args, **kwargs): print("Calling __call__ function") self.count += 1 return self.f...
true
714ca52a5534890f1d2ff325f6015e5c4a6b7dde
souravsingh/biopython-examples
/RNA_to_protein.py
UTF-8
1,056
2.75
3
[]
no_license
#!usr/bin/env python from scripts import ProteinDictRNA from itertools import imap, takewhile from scripts import ProteinTranslator with open('data/rosalind_prot.txt') as input_data: s = input_data.read().rstrip('\n') rna_dict = ProteinDictRNA() def rna_to_protein(rna): translate = ProteinTranslator() not_stop =...
true
38d790c7c5adf607b73b42746d26ecd85f10bfea
EvelynnChou/Predictions-of-Real-Estate
/CrawlLtn.py
UTF-8
1,834
2.9375
3
[]
no_license
import requests import json import lxml from bs4 import BeautifulSoup import csv header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36'} BASE_URL = 'https://estate.ltn.com.tw/news/1' #產生總頁面彙總list response=requests.get(BASE_URL,heade...
true