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
c456f46f61d45442bdd75e29ed06440baae9e4f8
Python
ahmedius2/RTG-Sync
/src/bandwidth/periodic/data/plotter.py
UTF-8
1,182
2.90625
3
[]
no_license
import numpy as np from matplotlib import mlab import matplotlib.pyplot as plt class Plotter: def __init__ (self): self.data = {} self.labelFz = 'large' self.labelFw = 'bold' self.legendFz = 'large' self.legendFw = 'light' return def plot (self, plotName, dataH...
true
de0ec2b79dfb40372c49e10e145c683c62142250
Python
William1998/IEEEXtreme-12.0
/Barter-System.py
UTF-8
3,550
3.5625
4
[]
no_license
def backtracking (partialSol, starter, endgoal, checked): try: possible = alist[starter] except: possible = None if len(partialSol) != 0: if partialSol[len(partialSol)-1][0] == endgoal: global answer answer = partialSol[:] return if(possi...
true
61a61d18207c89e6ddac3865a50b4cbb17d85703
Python
umangahuja1/News-At-Command-Line
/ExtractMainContent.py
UTF-8
2,130
2.796875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Jul 24 21:42:05 2016-2017 @author: Ankit Singh """ import requests from configReader import ConfigurationReader from Extractor import * import textwrap class ExtractMainContent(object): def __init__(self,source,articleurl): self.extractorlist=[Huffingto...
true
7e2514db4fddaf2e035f709a8f290c75101d192a
Python
Plasmoxy/MaturitaInformatika2019
/python/noob/pocet_9.py
UTF-8
147
4.09375
4
[]
no_license
x = int(input("Zadajte prir. c. : ")) c = 0 while x > 1: if x % 10 == 9: c += 1 x //= 10 print(f"Pocet cislic 9 v cisle je {c}")
true
09d35eb1f40310ba0af4451c6ebed136bfb2c61e
Python
stephenhoward/community-calendar
/tests/unit/test_query_builder.py
UTF-8
1,874
2.625
3
[]
no_license
import unittest import event_calendar.query_builder from event_calendar.model.event import Event valid_variations = [ ( 'bar', [None, 'bar','eq'] ), ( 'baz[gt]', [None, 'baz','gt'] ), ( 'bar.baz', ['bar','baz','eq'] ), ( 'bar.baz[lte]', ['bar','baz','lte'] ) ] class TestQueryBuilder...
true
86b708b2cd6a5b664ccb792515a65c254127712e
Python
raniaarinta/Python-Machine-Learning-Deep-Learning
/tesnor2.0_img_classification/tensor2.0-img_classification.py
UTF-8
478
2.6875
3
[]
no_license
import tensorflow as tf import keras import numpy as np import matplotlib.pyplot as plt data = keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = data.load_data() class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'S...
true
afdffbeebc19df53f310ebf873e4989b37ed8fc2
Python
jfairch81/Engineering_4_Notebooks
/Python/quadratic_formula.py
UTF-8
858
4.59375
5
[]
no_license
# Jude Fairchild # Quadratic Formula Calculator import math # import math because I need to square root def roots(x, y, z): ans = [] # sets up array for answers # Discriminant d = (y*y) - 4*x*z # Are roots real? if d < 0: print("The roots are not real, please restart the program.") ...
true
a9fd929c53ec87d63d651d1e1952239a64dd86e5
Python
tigervanilla/Guvi
/Hunter21.py
UTF-8
457
3.03125
3
[]
no_license
n,m=(int(i) for i in input().split()) matrix=[] for _ in range(n): matrix.append([int(i) for i in input().split()]) pos=[] for i in range(n): for j in range(m): if matrix[i][j]==0: pos.append((i,j)) for coordinate in pos: x,y=coordinate[0],coordinate[1] for j in range(m): mat...
true
a65f7e866160d6a5926823fc22ecc4809d488fca
Python
yagavardhini/class-and-objects
/type 00 (add and sub)functions.py
UTF-8
218
3.453125
3
[]
no_license
class two: a=300 b=200 c=0 def add(self): c=self.a+self.b print(c) def sub(self): d=self.a-self.b print(d) obj1=two() obj1.add() obj1.sub() print(obj1.a,"||",obj1.b)
true
76a36263b9f302bea52d60b78855b830e03b498a
Python
cblh/ud120-projects
/text_learning/vectorize_text_part_4.py
UTF-8
668
2.953125
3
[]
no_license
import pickle ### The words (features) and authors (labels), already largely processed. ### These files should have been created from the previous (Lesson 10) ### mini-project. words_file = "../text_learning/your_word_data.pkl" authors_file = "../text_learning/your_email_authors.pkl" word_data = pickle.load( open(wor...
true
4df681728b517a08ab4644c7046d58bab9c08dda
Python
hoangp/cs3431-18s2-project
/tests/scripts/_run.py
UTF-8
7,869
2.65625
3
[]
no_license
#! /usr/bin/python import rospy from std_msgs.msg import String from sensor_msgs.msg import Image import cv2 import numpy as np from cv_bridge import CvBridge, CvBridgeError from darknet_ros_msgs.msg import BoundingBoxes def draw_rectangle(img, rect): (x, y, w, h) = rect cv2.rectangle(img, (x, y), (x+w, y+h)...
true
5ddbecb680da7b083520b20b6cf4cf35fef1ed31
Python
revdotcom/revai-python-sdk
/src/rev_ai/sentiment_analysis_client.py
UTF-8
5,358
2.6875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Client used or interacting with out sentiment analysis api""" from .generic_api_client import GenericApiClient from .models import SentimentAnalysisJob, SentimentAnalysisResult class SentimentAnalysisClient(GenericApiClient): """Client for interacting with the Rev AI sentiment analysis...
true
90fd4cb6fe30fa8f598a1f63845e0531989ea6c7
Python
nilearn/nilearn
/nilearn/glm/regression.py
UTF-8
12,497
3.40625
3
[ "BSD-3-Clause" ]
permissive
"""Implement some standard regression models: OLS and WLS \ models, as well as an AR(p) regression model. Models are specified with a design matrix and are fit using their 'fit' method. Subclasses that have more complicated covariance matrices should write over the 'whiten' method as the fit method prewhitens the res...
true
f205d0b2e5af94e483cbe5ef710dade81fbaf8ea
Python
vartanbeno/sentiment-web-crawler
/src/classes/document_parser.py
UTF-8
4,583
3.265625
3
[ "MIT" ]
permissive
from helpers import afinn, PAGES, URL, CONTENT, TOTALS, TOTAL_DOCUMENTS, TOTAL_TOKENS, TOTAL_AFINN, AVG_TOKENS, AVG_AFINN import json class DocumentParser: # static variables stats_file = "url_stats.txt" summary = "SUMMARY:" def __init__(self, file_to_parse): """ Initialize the docu...
true
92783798a94a7c402a203b1f93f1e2af6d44095b
Python
iamakshatjain/Codings
/codechef/May Challenge 2020 Division 2/CHANDF/main.py
UTF-8
97
3.28125
3
[]
no_license
t = int(input()) while(t > 0): x, y, l, r = map(int, input().split()) print(x|y) t-=1
true
ba6bf2e3513513b1b4218ad0a152c966f388523d
Python
g-jing/TorchFly-1
/torchfly/utils/file_utils.py
UTF-8
572
2.765625
3
[ "MIT" ]
permissive
import requests import tqdm def http_get(url, filename, proxies=None): req = requests.get(url, stream=True, proxies=proxies) content_length = req.headers.get('Content-Length') total = int(content_length) if content_length is not None else None progress = tqdm.tqdm(unit="B", total=total) w...
true
ce9dd3657218b92c07619cd486bdf40634a052cf
Python
Gui25Reis/Mudanca-de-base
/arquivos/outras-versoes/_outros/Mudança de Base 03.py
UTF-8
5,403
3.5
4
[ "MIT" ]
permissive
print('Resultdo: a partir do 1º zero do quociente') print('Máx. 15 dígitos') print() a = int(input("Base inicial: ", )) b = int(input("Base final: ", )) if a != 2: print() n = int(input('Número, SEM ESPAÇO: ', )) print() d1 = int(n/(10**14)) r1 = int(n%(10**14)) d2 = int(r1/(10**13)) r2 = in...
true
65779bf4100ed33c15af012431168f8bb9e75ab0
Python
podhmo/swagger-marshmallow-codegen
/examples/01ref/main.py
UTF-8
559
2.859375
3
[ "MIT" ]
permissive
import sys from person import Person if __name__ == "__main__": try: d = {"name": "foo", "age": "20"} data = Person().load(d) print("ok", data) except Exception as e: print("ng", e) sys.exit(-1) try: d = { "name": "foo", "age": "20", ...
true
dcfbae1bce07cfaeffa567984ee531b9a0068dca
Python
divyap2706/Reduced-to-home
/src/cleaning_src/Spark_Jobs/Zip_Code_Intersect.py
UTF-8
1,219
2.921875
3
[]
no_license
from __future__ import print_function # This is the code for looking for Zip Codes that appear in both lists. import sys from pyspark import SparkContext from pyspark.sql import SparkSession from pyspark.sql.functions import format_string from pyspark.sql.functions import lit from pyspark.sql.functions import date_for...
true
505c6098a950b8959b2ce54fa010f63cf0d93ffd
Python
RomeoVa/intelligent-systems
/BFS/BfsWithWeight.py
UTF-8
1,158
3.390625
3
[]
no_license
''' BFS - Search with weight Mauricio Peón A01024162 Romeo Varela A01020736 Germán Torres A01651423 ''' import csv import numpy as np def findPath(dicSonParent,path,cost,currentNode): cost += int(dicSonParent[currentNode][0][1]) currentNode = dicSonParent[currentNode][0][0] if c...
true
ff28f35b725fde5ebc000ba072af6a63763aebcc
Python
NeumannSven/pyshb_oop
/home_first.py
UTF-8
1,102
3.34375
3
[]
no_license
''' Created on 20.02.2018 @author: sven ''' class home(object): place = "" uuid = 0 devices = [] def __init__(self, uuid = 0, place = ""): self.uuid = uuid self.place = place def addDevice(self, device): self.devices.append(device) def getDevices(self): ...
true
1e93dfa557b4a0bee90d066506aeb51a871c5e7f
Python
wangzheng62/wztest
/processtest.py
UTF-8
700
2.921875
3
[]
no_license
from multiprocessing import Process,Queue import os,time # 子进程要执行的代码 def run_proc(name,q): i=0 q.put(name) while(i<100000000): i+=1 print('Run child process %s (%s)...' % (name, os.getpid())) if __name__=='__main__': q=Queue() print('Parent process %s.' % os.getpid()) p1 = Process(target=run_proc,args=('p1',...
true
f6a9c3ddaf6191569e37459d893cd4c5c42cbf4c
Python
meteostat/meteostat-python
/examples/daily/point.py
UTF-8
710
3.09375
3
[ "MIT", "CC-BY-NC-4.0" ]
permissive
""" Example: Daily point data access Meteorological data provided by Meteostat (https://dev.meteostat.net) under the terms of the Creative Commons Attribution-NonCommercial 4.0 International Public License. The code is licensed under the MIT license. """ from datetime import datetime import matplotlib.pyplot as plt ...
true
ee25dfebdebef337b6f92c5bfe6b670d6cd2abd1
Python
RnLe/AP1920-AJRM
/PeP Workshop/exercises-toolbox-1/1-python/7-wordcount/loesung2.py
UTF-8
424
3.59375
4
[]
no_license
with open('text.txt') as f: words = f.read().split() counts = dict() for word in words: # Nehme Häufigkeit des Worts oder 0, # wenn das Wort noch nicht verzeichnet ist freq = counts.get(word, 0) counts[word] = freq + 1 def get_count(x): return x[1] result = sorted(counts....
true
83574e8df82247b4a8f0f3aca13ecde67b04724d
Python
connor-john/GANs-pytorch
/GAN/preprocessing.py
UTF-8
960
2.78125
3
[ "MIT" ]
permissive
import torch import torchvision import torchvision.transforms as transforms from torchvision.utils import save_image # Get data # Using MNIST def get_data(): # Transform to normalise pixels transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(mean=(0.5,), ...
true
94f8c4b516488f8bad8e376345862f9246142964
Python
ashildebrandt/Grendel
/grendel/locations.py
UTF-8
3,785
2.6875
3
[]
no_license
import items, verbs, scripts, game def Item(item): return items.Get(item) def Verb(verb): return verbs.Get(verb) def Game(): return game.Settings() objects = [] directory = [] class InitLocation(object): def __init__(self, sDesc, lDesc = None): self.name = sDesc # Should never change after creation self.descri...
true
8a2c83608a2e1fd4c76f087b8144a1be3029564e
Python
sc-199/2018-2019
/7 კლასი/7_4/ფილფანი სანდრო/for loop.py
UTF-8
188
2.65625
3
[]
no_license
print('samnishna kenti ricxvebis jami,') print('for ciklis gamoyenebit:') s = 0 i = 0 for i in range(100): i += 1 if i % 2 == 1: s += i print('kenti samnishna ricxvebis jamia __ ' + str(s)) input('done...')
true
97526f4036f835b739f7b68f813d0984009260ab
Python
Atzingen/curso-IoT
/aula-04-grove/buzzer.py
UTF-8
731
2.765625
3
[ "MIT" ]
permissive
# -*- coding: latin-1 -*- ''' Baseado no exemplo disponibilizado pela biblioteca upm/mraa da intel Para controlar o buzzer. Gustavo Voltani von Atzingen 15/04/2017 Curso IoT 2017 - IFSP Piracicaba ''' import time import mraa from upm import pyupm_buzzer as upmBuzzer def desliga_buzzer(pino): x = mraa.Gpio(pino)...
true
2171fdfdc18238b04834059337796a8ae6aa94db
Python
hwuachen/newsapp
/application/routes.py
UTF-8
4,121
2.6875
3
[]
no_license
from application import app, db, english_bot from flask import render_template, request, json, Response, redirect, flash from trumptweets_testdata import trumpTweetsTestData from application.models import User, Trumptweet from application.forms import LoginForm, RegisterForm trumpTweets = Trumptweet.objects.all() def...
true
0e13c446dc51f07fe4d8ddb4552f850a6d23bda2
Python
jcarrete5/suitable-solution
/solver/__main__.py
UTF-8
454
3.15625
3
[]
no_license
""" Takes serial division expressions as arguments and prints the solution to each expression on a new line. """ from argparse import ArgumentParser from .divide import eval_expr parser = ArgumentParser(description=__doc__) parser.add_argument( 'expr_list', nargs='+', metavar='expr', help="Expressio...
true
cfb54251443f1d4bafc89f12f39c3a8f97ad65a8
Python
jddirr/CS466-Project
/experiment.py
UTF-8
1,719
2.859375
3
[]
no_license
from alignment import GlobalAlignment from string_generator import * import time B_RUN_INPUT_TO_LENGTH_10000 = False string_names_V = ["len 100", "len 100", "len 100", "len 1000", "len 1000", "len 1000", "len 10000", "len 10000", "len 10000"] string_names_W = ["len 100, mutated", "len 80, substring", "len 80, subst...
true
7e499560ca5b09853d98e60cff2664357e6c5b5e
Python
EllieZhao/python-utils
/binary_tree_level_order_traversal2.py
UTF-8
1,775
3.609375
4
[]
no_license
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.s = [] # @param {TreeNode} root # @return {integer[][]} def levelOrderBottom(self, root): if not root: return [] ...
true
6e3a63c8a493f1f81946398644c6b830f0f1ddf9
Python
skgigliotti/Capstone-NLP
/project/extra_data/blobtranslate.py
UTF-8
820
2.6875
3
[]
no_license
import csv import pandas as pd from urllib import request from textblob import TextBlob origText = request.urlopen("https://www.olympic.org/news/ioc-ipc-tokyo-2020-organising-committee-and-tokyo-metropolitan-government-announce-new-dates-for-the-olympic-and-paralympic-games-tokyo-2020") encoding = origText.info().ge...
true
a0cf6e6725e9b992ead0f9b8ba26bfad5cfcb43c
Python
azhagumanikandan/manikandan
/11hun.py
UTF-8
67
2.828125
3
[]
no_license
#azhagu s = input().split() for j in s: print(j[::-1],end = " ")
true
c9c79745a9084706e9e8f3a7e2fd1301487ed4a6
Python
robin-norwood/TIY-Python-Apr-2016
/week1/lotsaargs.py
UTF-8
925
3.546875
4
[]
no_license
def concatTwo(first, second): return first + ' ' + second #print(concatTwo("Joe", "BillyBob")) def concatAll(*args): return ' '.join(args) #print(concatAll()) def concatWith(sep, *strings): print("strings is a " + str(type(strings))) return sep.join(strings) #print(concatWith(", ", "John", "George"...
true
b816ea6b691dce55511bd6cd7be17fb55bb017c6
Python
Dpm99/Ethereum-Analysis
/Top_10_pouplar_services.py
UTF-8
1,321
2.9375
3
[]
no_license
import pyspark sc = pyspark.SparkContext() def good_line_transactions(line): try: fields = line.split(',') if len(fields)!=7: return False int(fields[3]) return True except: return False def good_line_contracts(line): try: fields = line.split...
true
0b295bab19651f47c35df79a85649ee3b7bcd018
Python
joshua7linares/Tecnicas3-2
/JoshuaLinares/p16.py
UTF-8
391
3.859375
4
[]
no_license
#determina los divisores comunes de un par de numeros print "ingresa dos valores enteros diferentes" a=input("ingresa el primer valor: ") b=input("ingresa el segundo valor: ") if a==b: print "los valores deben ser distintos" a=input("ingresa el primer valor: ") b=input("ingresa el segundo valor: ") n=1 while n...
true
9daf446fb648068ae688574b8e315a5e29d7b194
Python
daman2412/iosfu
/iosfu/gui/components/base.py
UTF-8
3,711
2.625
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
from os.path import join as join_path, dirname from inspect import getfile from iosfu.utils import slugify class Component(object): """ Base GUI Component object """ # Component type, do NOT modify _type = None def __unicode__(self): return self.name # class Category(Component): #...
true
e73ac06f76655e19d02a9db517caa6ee7ac0ce7c
Python
sorakunn/Friend-Recommendation
/tools/IO.py
UTF-8
703
3.109375
3
[]
no_license
import pandas as pd import numpy as np import os def read(path): """读取某一路径的csv格式数据文件""" # 获取根路径 current = os.path.dirname(__file__) parrent = os.path.dirname(current) # 使用 pandas 进行读取 path = parrent + '/' + path df = pd.read_csv(path, header=0) return df def write(df, path,header=Fal...
true
8b6448592994258a587e91ab014f1cfc940c7356
Python
christianparpart/pogobaer
/main.py
UTF-8
3,335
2.625
3
[]
no_license
#! /usr/bin/env python3 ''' Erste versuche einen eigenen Discordbot zu Schreiben. ''' import discord import asyncio import config client = discord.Client() @client.event async def on_ready(): print('Logged in as: ' + client.user.name) print('user-ID: ' + client.user.id) print('---------------------------...
true
1ce9efafedc19d75735175334bbca93f940baed3
Python
harinando/sdc-vehicule-detection
/search_classify.py
UTF-8
8,553
2.8125
3
[]
no_license
import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np import cv2 import glob import time from sklearn.svm import LinearSVC from sklearn.preprocessing import StandardScaler from skimage.feature import hog from scipy.ndimage.measurements import label from feature_extractor import * # NOTE: ...
true
69bd5d1c3498c1edc3a4a9fde7be93530134c69d
Python
feihong/python-examples
/aiohttp/synchronous_websocket_client/client.py
UTF-8
377
2.546875
3
[]
no_license
import sys import time from websocketclient import WebSocketClient def long_task(url): with WebSocketClient(url) as client: total = 15 for i in range(1, total+1): print(i) client.write(type='progress', value=i, total=total) time.sleep(0.05) if __name__ == '__...
true
7079f7032aba1785ffc43a0dba24b4975a7a7e0c
Python
vpereira/flows_to_weka
/tcp_stream.py
UTF-8
957
2.65625
3
[ "MIT" ]
permissive
from scapy.all import * from network_stream import NetworkStream from numpy import * from entropy import kolmogorov, shannon from application_detection import ApplicationDetection #We are assuming: #1) Its an IP packet #2) Its an TCP packet class TCPStream(NetworkStream): def __init__(self,pkt): super(TCP...
true
3950d1dd7327ca89a0b53b84de885269631740de
Python
rehan252/Axiom-Pre-Internship
/Learn-Python3-from-Scratch/05-Data-Structure/05-quiz.py
UTF-8
963
4.53125
5
[]
no_license
""" Quiz for Data Structure Q1: Which of the following sets of properties is true for a list? Ans: Ordered Mutable Indexed Q2: For a given data structure, ds, what is the correct way of calculating its length? Ans: len(ds) Q3: In a dictionary, key-value pairs are indexed by _____. Ans: Keys Q4: A...
true
63340370b01684af3e3f3fdfaa21ff941b4ec0ee
Python
bartvanwesten/oceanwaves-python
/tests/test_units.py
UTF-8
2,380
3.234375
3
[ "MIT" ]
permissive
from nose.tools import * import numpy as np from datetime import datetime from oceanwaves import * DIMS = [('time', [datetime(1970,1,1,0), datetime(1970,1,1,1)]), ('location', [(0,0), (1,0), (0,1), (.5,.5)]), ...
true
cd059e6b3a451428eaaaba7abaaf383534ccc8c1
Python
Richard-Walter/Regular-Expressions
/RegEx Examples.py
UTF-8
3,363
4.125
4
[]
no_license
import re """ From https://www.youtube.com/watch?v=K8L6KVGG-7o . - Any Character Except New Line \d - Digit (0-9) \D - Not a Digit (0-9) \w - Word Character (a-z, A-Z, 0-9, _) \W - Not a Word Character \s - Whitespace (space, tab, newline) \S - Not Whitespace (space, tab, newline)...
true
2682745df66d59194a85c71982c073c9ffb84cb6
Python
engrchyke/DNAtoMidi
/DNAtomidi.py
UTF-8
11,359
2.96875
3
[]
no_license
#!/usr/bin/env python import csv from midiutil import MIDIFile import random import sys import argparse from time import time def formatDNAFile(rawFile): with open(rawFile) as myfile: data=myfile.read().replace('\n', '') split_sequence = [data[i:i+3] for i in range(0, len(data)-1, 3)] return spl...
true
ac8052635a089ea53914f2267f02911a09ef0525
Python
przemokosch/PyMazeGenerator
/main.py
UTF-8
5,346
3.515625
4
[]
no_license
import pygame import sys import random class Node: def __init__(self, x, y): self._x = x self._y = y self._neighbours = list() self._connected = list() self._visited = False def add_neighbour(self, node): self._neighbours.append(node) def connect(self, nod...
true
17dcfffdd2b660cedb473dbcbee31a44d7b5fa79
Python
Josephbakulikira/Traveling-Salesman-Algorithm
/point.py
UTF-8
1,170
3.078125
3
[]
no_license
import pygame pygame.font.init() textColor = (0, 0, 0) # textFont = pg.font.Font("freesansbold.ttf", size) textFont = pygame.font.SysFont("Arial", 20) class Point: def __init__(self, x, y): self.x = x self.y = y self.radius = 1 self.alpha = 150 def Draw(self...
true
bcbf81676abf3dc5594fa4a690f917b9a6856f60
Python
gaijigoumeiren/algo_programing
/9_tree_pro/order_things.py
UTF-8
2,644
3.828125
4
[]
no_license
# -*- encoding=utf-8 -*- class TreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def build_tree_preorder_inorder(preorder, inorder): """ 前序中序建树,这个方式超级慢,而且空间大, :param preorder: :param inorder: :return: """ if preorder is Non...
true
866a445a04485a024fa137e720c362e4c2305191
Python
noamelf/Lets-build-a-Python-profiler-in-25-LOC
/src/stack_access.py
UTF-8
321
3.046875
3
[]
no_license
# stack_access.py import sys import traceback def show_stack(): for _, call_stack in sys._current_frames().items(): for frame in traceback.extract_stack(call_stack): print(f'{frame.filename}:{frame.lineno}:' f'{frame.name} - "{frame.line}"') def bar(): show_stack() bar()...
true
e80461ad21ac8b157e19b465fbc9d5cf2694e954
Python
AdamC66/July-19---04---OOP-Inheritance-Part-3
/inheritance3.py
UTF-8
3,811
4.375
4
[]
no_license
# First we'll need a class to represent the solar system. Let's call it System, # and give it an attribute bodies. bodies will start as an empty list (ie. []). class System: def __init__(self): self.bodies = [] def add(self,to_add): self.bodies.append(to_add) def total_mass(self): ...
true
7fb13e251a35ac26ad373c0c7f68e4e64d6aeaa2
Python
Aasthaengg/IBMdataset
/Python_codes/p03345/s199515440.py
UTF-8
225
3.03125
3
[]
no_license
#template def inputlist(): return [int(j) for j in input().split()] #template #issueから始める A,B,C,K = inputlist() if abs(B-A) >= 10**18: print("Unfair") exit() ans = A-B if K % 2 == 1: ans *= -1 print(ans)
true
64dda231fedfbc5e7afde5f013ab1bba1e2ee1b5
Python
srbaxter/SeniorProject_ITDashboard
/ITDashboard/UnitTest/testServer.py
UTF-8
936
2.5625
3
[]
no_license
''' Created on Feb 4, 2016 @author: Carl ''' import unittest from src.serverPull import serverLister from src.serverPull import serverDBPopulator from src.serverPull import getServerGroup class Test(unittest.TestCase): def testName(self): #a passing test pass #serverDBPopulator def testConnec...
true
e788e4b81a22c72ca310d1f7435f89c397fe5e02
Python
Kayala47/SDEV-KEKW
/code/initTracker.py
UTF-8
5,159
3.421875
3
[]
no_license
class InitTracker: trackerInfo = [] currentPlayer = 0 rounds = 0 def __init__(self): super().__init__() def printTracker(self): ''' Prints the current initiative tracker information. Inputs: None Outputs: None ''' if self.trackerInfo == []: ...
true
774309a1416d83eed273f2146b976f1dbf56db16
Python
nk900600/Bridge-Labz1
/OOPS/test/test_card_game.py
UTF-8
1,491
2.546875
3
[]
no_license
from OOPS.test_oops_util import CardGame import unittest import json with open("/home/admin1/PycharmProjects/bridge_labz/Week1/test/test") as f: test = json.load(f) class test_CardGame(unittest.TestCase): # method 1 def test_CardGame(self): array = ["test1", "test2", "test3", "test4"] f...
true
72e2277c7272d8616a01f755c5e3461e1a22c1c1
Python
daniel-reich/ubiquitous-fiesta
/5Fuf4WdJKhnHfs4ZR_20.py
UTF-8
57
3.125
3
[]
no_license
def length(s): x=0 for i in s: x+=1 return x
true
8efc3d01f676da6040aee35114c043292f7526d0
Python
paularodriguez/python-core-and-advance-course
/sec14-encapsulation/task.py
UTF-8
519
3.890625
4
[]
no_license
# Create class Patient with setter and accessor methods, one instance, set and print the fields class Patient: def setId(self, id): self.id = id def getId(self): return self.id def setName(self, name): self.name = name def getName(self): return self.name def setSS...
true
006661a5f058d9a6f16dcb93318fcba258266c49
Python
JustasB/OlfactoryBulb
/prev_ob_models/KaplanLansner2014/BCPNN.py
UTF-8
20,450
2.578125
3
[ "MIT" ]
permissive
import numpy as np import os class BCPNN(object): """ BCPNN 1) load a pattern, i.e. the normalized ob activity 2) init: initialize the weights to some uniform value initialize biases to 1 / n_patterns 3) for all patterns: calculate the post-synaptic activities: s_j 4) ge...
true
5082ae17803e774f8df0f1a63ab4541377af2b7b
Python
chenxu0602/LeetCode
/1420.build-array-where-you-can-find-the-maximum-exactly-k-comparisons.py
UTF-8
2,308
3.34375
3
[]
no_license
# # @lc app=leetcode id=1420 lang=python3 # # [1420] Build Array Where You Can Find The Maximum Exactly K Comparisons # # https://leetcode.com/problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons/description/ # # algorithms # Hard (64.35%) # Likes: 235 # Dislikes: 5 # Total Accepted: 6.3K # T...
true
18bec10b6017d0186b944d6f92b0947826886dbd
Python
wolaoa/leetcode
/python/leet_415.py
UTF-8
1,126
3.125
3
[]
no_license
class Solution(object): def addStrings(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ len1 = len(num1) len2 = len(num2) if len(num2) > len(num1): return self.addStrings(num2, num1) # malloc enough space to s...
true
6f7a82a7e791765d4a3dacf13514a5f75aabfc88
Python
nawnoes/DeepPurpleZero
/Support/OneHotEncoding.py
UTF-8
4,206
3.484375
3
[]
no_license
''' 20일 알파고 모델 학습시키기 위해 사용 testSym으로 확인 결과 이상 없음. ''' ''' 사전형 자료형에서 value로 key값 찾는 방법 (1) for name, age in mydict.items(): #mydict에 아이템을 하나씩 접근해서, key, value를 각각 name, age에 저장 if age == search_age: print name (2) [name for name, age in mydict.items() if age == search_age] [예제] dic={'name': 'pei', 'age':...
true
092d9350d132b39a76daf87c590c608174d337f0
Python
yagolabate/Projeto-de-Design-de-Software
/comidas.py
UTF-8
39,739
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 13 07:51:33 2016 @author: Yago """ def ler_dicionario_comidas(): comidas = { "Cereais e derivados": { " Arroz, integral, cozido " : [ 25.8 , 2.6 , 1.0 ] , " Arroz, integral, cru " : [ 77.5 , 7.3 , 1.9 ] , " Arroz, tipo 1, c...
true
d5b3d8349dbaa5b3b5e72f73d123bf38ff9b12a0
Python
jh247247/euler
/p20/p20.py
UTF-8
303
3.765625
4
[]
no_license
# Find the sum of the digits in the number 100! # hopefully I don't have to use the bignum libs... def sumNumDigits(num): return sum([int(i) for i in str(num)]) def factorial(order): ret = 1; for i in range(1,order+1): ret *= i return ret print(sumNumDigits(factorial(100)))
true
6765a2123226934e051ef94d21cf261ae867a963
Python
Youngiyong/Python
/Algorism/크라마/Competitive Game.py
UTF-8
616
3.25
3
[]
no_license
import collections # def cutoffRanks(scores, cutOffRank): # count = collections.Counter(scores) # ans, curRank = 0, 1 # for k, v in sorted(count.items(),reverse=True): # if curRank > cutOffRank: # break # ans += v # curRank += v # return ans def numPlayers(k, score...
true
b60ea5000864ae0903f891f915a41a6e8045f46a
Python
BlueQueen71/Python_Academy_Engeto
/projekt_1.py
UTF-8
3,384
3.21875
3
[]
no_license
TEXTS = [''' Situated about 10 miles west of Kemmerer, Fossil Butte is a ruggedly impressive topographic feature that rises sharply some 1000 feet above Twin Creek Valley to an elevation of more than 7500 feet above sea level. The butte is located just north of US 30N and the Union Pacific Railroad, which traver...
true
5cd8d7e0281d5479885f5c0766b907d152e7a583
Python
takaya0111/AtCoder
/o.py
UTF-8
524
2.96875
3
[]
no_license
import sys sys.setrecursionlimit(10**7) h,w = map(int,input().split()) # c = [list(input()) for i in range(h)] c=[input().split() for _ in range(h)] print(c) def dfs(x,y): if not(0<=x<h) or not(0<=y<w) or c[x][y]=="#": return if c[x][y]=="g": print("Yes") sys.exit() c[x][y]="#" ...
true
022e560734e733804c7611daef68779b79f5c4ef
Python
peacebytes/selenium-behave-python
/features/lib/pages/my_address.py
UTF-8
5,207
2.609375
3
[]
no_license
__author__ = 'switbe' from selenium.webdriver.common.by import By from .base_page_object import BasePage class MyAddress(BasePage): def __init__(self, context): BasePage.__init__(self, context) self.su = context.su locator_dictionary = { "addAddressButton": (By.XPATH, '//a[@title="Add ...
true
de553006c6251ecd94499a8b8fd0492fc8551089
Python
wendell0829/ftp-python-socket-
/server/core/utils.py
UTF-8
1,944
3.046875
3
[]
no_license
from server.core.database import User, session def add_user(username, password): user = User(username, password) session.add(user) session.commit() def login_check(username, password): ''' 根据username在数据库中查找记录, 然后比对password :param username: :param password: :return: ''' user =...
true
8dc41362b14552c9baf070733b5a12ae20ad2232
Python
Aasthaengg/IBMdataset
/Python_codes/p02917/s542319573.py
UTF-8
336
2.90625
3
[]
no_license
def mapt(fn, *args): return tuple(map(fn, *args)) def Input(): return mapt(int, input().split(" ")) def main(): n = int(input()) b = Input() data = 0 for i in range(n-1): if i == 0: data += b[i] continue data += min(b[i], b[i-1]) data += b[-1] pr...
true
5aa3da6903a9e6359c0fa2b70ea57c008d6f9e7f
Python
rishi-bhatnager/Abu
/marketSearch.py
UTF-8
1,755
3.09375
3
[]
no_license
import json import requests import matplotlib.pyplot as plt import numpy as np import datetime as dt key = "STHA8AW4L2LOMCWT" def plotMarket(tick): from securitySearch import check_data ticker = tick # Url to get data, other options include: # * function=TIME_SERIES_DAILY_ADJUSTED for adjusted close...
true
7531b0fc8df719535c7a2f2c7e055739b73e76d1
Python
amanjaiman/Advent-Of-Code-2016
/Day-3/D3P1.py
UTF-8
533
3.1875
3
[]
no_license
total = 0 for line in open("Day3Problem1Text", "r"): possible_triangle = line.split() a = int(possible_triangle[0]) b = int(possible_triangle[1]) c = int(possible_triangle[2]) if a+b > c and a+c > b and b+c > a: total += 1 print(total) #862 #To combine lines 2-7: #for l in open(...
true
d05eef4aaefcebc10b27dcceb0c0280b7425ad3f
Python
VinodKumarLogan/Aurora
/Preprocess/id-unique-msg.py
UTF-8
458
2.65625
3
[]
no_license
import csv as csv unique_logs = {} cleaned_logs = {} unique_logs_file = csv.reader(open("../data/unique-msg-count.csv")) cleaned_logs_file = csv.reader(open("../data/cleaned_logs_v3.csv")) unique_logs_file_v2 = csv.writer(open("../data/unique-msg-count-v2.csv","a")) for log in cleaned_logs_file : cleaned_logs[int(l...
true
2d0268c57c1461cac67ef23f4adec4ffe58f51f8
Python
krutiwalko21/Python-
/Area.py
UTF-8
111
3.640625
4
[]
no_license
radius =float(input("Enter radius of circle: ")) pi = 3.14 print("The area of circle: ", pi * radius * radius)
true
3bbe5e78ad8fe605112bf82090e64c901a28f9a3
Python
silky/bell-ppls
/env/lib/python2.7/site-packages/observations/r/brambles.py
UTF-8
1,925
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def brambles(path): """Spatial Location of Bramble Canes The `brambles...
true
21b42567535fe8b9d08b34ce2d363b3fc009c106
Python
antreashp/DL_2020
/assignment_1/1_mlp_cnn/code/alex_pytorch.py
UTF-8
5,171
2.828125
3
[]
no_license
""" This module implements a Convolutional Neural Network in PyTorch. You should fill in code into indicated sections. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch.nn as nn import torch class myAlexNet(nn.Module): """ This class implem...
true
0f3b28475796e236c43e3b55217f8155422df326
Python
GabrielRojas74/Talleres-AyP
/Taller funciones/punto#1.py
UTF-8
351
3.1875
3
[ "LicenseRef-scancode-other-permissive", "MIT" ]
permissive
"""1.Llenar las lista con los datos del archivo numeros.txt y Llenar las lista con los datos del archivo frutas.txt""" frutas = open('frutas.txt', 'r') numeros = open('numeros.txt', 'r') lista_frutas = [] lista_numeros = [] for i in frutas: lista_frutas.append(i) for i in numeros: lista_numeros.append(i) print(list...
true
2379f617616b1b047e20fd11ba905c60c0da77d9
Python
Sts0mrg0/pcc-master
/sanproba/4-1-4-2.py
UTF-8
592
3.84375
4
[]
no_license
pizzas = ['super', 'alg', 'mart'] lov = 'Я люблю пиццу ' for pizza in pizzas: print(lov + pizza.title()) print('А еще больше я люблю пельмени') frend_pizzas = pizzas[:] frend_pizzas.append('RRRR') pizzas.append('AAAA') print(frend_pizzas) print(pizzas) pp= 'Мой список любимых пицц: ' print(pp) [print(i.title()) for...
true
d69f57729d6f527cae23f74204c0566c16cd9670
Python
Starfunk/deep-reinforcement-learning-library
/testcode-keystone.py
UTF-8
18,528
3.84375
4
[ "MIT" ]
permissive
"""This file implements a neural network library 'from scratch', i.e. only using numpy to implement the matrix data structures used to construct neural networks. Precisely, you can use this library to create feedforward neural networks; this library does not support the creation of CNNs or RNNs. Credit: Much of t...
true
218dc0caabd0c3bc7131a3a45256c2abb2c0f457
Python
dyqu1748/Weather-History-App
/flaskFunctions.py
UTF-8
1,255
2.75
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Mar 17 09:36:40 2021 @author: narut """ from cassandra.cluster import Cluster cluster = Cluster(['34.71.38.163','34.69.92.195','35.225.100.34']) session = cluster.connect('firstkeyspace') #NOT DONE WITH COUNTRY def getCountryTemp(country): quer1 = "SELECT * FROM land...
true
a7c4bef926b1e955b366c20c31a115f994fda8ac
Python
NickG123/AdventOfCode2019
/day18.py
UTF-8
5,040
2.96875
3
[]
no_license
from __future__ import annotations import string from collections import deque from dataclasses import dataclass from functools import cache from typing import Deque, List, Set, Optional, Tuple INPUT = "input" KEYS = set(string.ascii_lowercase) DOORS = set(string.ascii_uppercase) WALL = "#" FLOOR = "." START = "@" ...
true
294bc3d39caeff19a28d4c2d082217b6b78ff7d0
Python
CDAT/vcs
/vcs/vcsvtk/pipeline1d.py
UTF-8
5,823
2.578125
3
[ "BSD-3-Clause" ]
permissive
from .pipeline import Pipeline import numpy import vcs import cdms2 def smooth(x, beta, window_len=11): """ kaiser window smoothing """ # extending the data at beginning and at the end # to apply the window at the borders s = numpy.r_[x[window_len - 1:0:-1], x, x[-1:-window_len:-1]] w = numpy.kai...
true
bcf6fc1509c83846167823850fcd9baf95ec1a4f
Python
HSU-11/Nature-Language-Implement
/HW2/HW2.py
UTF-8
645
3.3125
3
[]
no_license
import requests from bs4 import BeautifulSoup url = 'https://movies.yahoo.com.tw/movie_thisweek.html' response = requests.get(url=url) soup = BeautifulSoup(response.text, 'lxml') info_items = soup.find_all('div', 'release_info') for item in info_items: name = item.find('div', 'release_movie_name')...
true
25c8fa03b7df9b8338cc4dd2410f0ce7294ef713
Python
Shamsullo/HackerRank_Python-
/Basic Data Types/FindingThePercentage.py
UTF-8
424
3.28125
3
[]
no_license
if __name__ == '__main__': n = int(raw_input()) student_marks = {} for i in range(n): s = raw_input().split(" ") name = s[0] score1 = float(s[1]) score2 = float(s[2]) score3 = float(s[3]) av_scores = (score1 + score2 + score3) / 3.0 stude...
true
035c70c98b7c19c126e8add73012d89c3bf98f71
Python
AkireL/TestH3ru
/Language.py
UTF-8
468
3.40625
3
[]
no_license
import re class Language: def isInLanguage(self, word): position = 0 if len(word) <= 0 : raise Exception("Word empty!!") patronAlphabet = re.compile("[^sxocqnmwpfyheljrdgui]") matchOutLanguage = patronAlphabet.search(word) if matchOutLanguage == None: ...
true
13821c66f7ce90353b9fce1a490a4fde9d59aaa1
Python
Dhivya1210/programlevel1
/chat_box.py
UTF-8
1,891
3.546875
4
[]
no_license
def chat(): l=[] #until quit chat continuous while True: #chat of the person1 print("person 1") s1=input() #check user input if(s1=="quit"): l.append("quit") break l.append(s1) #chat of the person2 print("p...
true
c508aa6075a517359daa5e8eedae9a5ddaf46cff
Python
Ketang1008/Python-programming-practice
/multiplication_table_using_function.py
UTF-8
150
3.546875
4
[]
no_license
def multiplication_table(n): for i in range(1,11): print(n,"x",i,"=",n*i) n=int(input("Enter the number :")) multiplication_table(n)
true
4e05a355d19690222f666a1085e48013c9c08d46
Python
gabriel-valenga/CursoEmVideoPython
/ex012.py
UTF-8
261
3.734375
4
[]
no_license
largura = float(input('Qual a largura da parede?')) altura = float(input('Qual a altura da parede?')) area = largura * altura quantidadeTinta = area / 2 print('Área da parede: {}m², quantidade de tinta necessária: {:.3f} litros'.format(area,quantidadeTinta))
true
6bac847550ee646ed9e54384843ab766271cbf99
Python
datafined/homework_gb
/lesson_2/task_2.py
UTF-8
1,203
4.0625
4
[]
no_license
# Для списка реализовать обмен значений соседних элементов, # т.е. Значениями обмениваются элементы с # индексами 0 и 1, 2 и 3 и т.д. # При нечетном количестве элементов последний сохранить # на своем месте. Для заполнения списка элементов необходимо # использовать функцию input(). new_list = [] user_list = [] n = 1 m...
true
4b3b41b4bf93672db356d3c1bc13e4ad6d9de457
Python
noisyoscillator/qtrader
/qtrader/agents/pretrainer/objectives.py
UTF-8
1,335
2.8125
3
[ "Apache-2.0" ]
permissive
import numpy as np from qtrader.utils.numpy import eps def _mu_p(w: np.ndarray, r: np.ndarray) -> float: """Portfolio Returns.""" return np.dot(w.T, r) def _sigma_p(w: np.ndarray, Sigma: np.ndarray) -> float: """Portoflio Variance""" return np.dot(np.dot(w.T, Sigma), w) def _trans_costs(w: np.nda...
true
b7a5f16257735e0745338bee303a7a6130371b88
Python
hotwingsfromtroy/chain_reaction_AI
/Chain_Reaction/trial_mk_VI.py
UTF-8
15,909
2.625
3
[]
no_license
import tkinter import time import copy import random ROW_SIZE = 0 COL_SIZE = 0 DEPTH = 1 LEVEL = 0 OPT_RED = '#d10404' OPT_GREEN = '#00911f' DRAW_STATE = '#002559' MINIMAX_VANILLA = 1 MINIMAX_ALPHABETA = 2 WINNER = -2 MOVE_TIME = 0 SELECTED_ALGO = 0 UNOCCUPIED_CELL = '#485969' COMPU...
true
5cdd022810734fda57ef28b621ee8cf15770d1cb
Python
ramanchawla1290/Currency-Converter
/currency_converter.py
UTF-8
10,021
3.34375
3
[]
no_license
""" CURRENCY CONVERTOR CLI based currency convertor The program connects with an API to provide real-time exchange rates The details for the API connection are stored in a configuration file Command Format: >> currency_converter.py <from_currency_code> <to_currency_code> <amount> currency code : Interna...
true
a9d5dde616a433d58e8e6566ddf3f2ed7872734c
Python
datadave/machine-learning
/brain/validator/validate_dataset.py
UTF-8
1,143
3.03125
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
#!/usr/bin/python '''@validate_dataset This script performs validation on correpsonding dataset(s). ''' class Validate_Dataset(object): '''Validate_Dataset This class provies an interface to validate provided dataset(s) during 'data_new', and 'data_append' sessions. Note: this class explicitly in...
true
d3d48be7be110546e32df447c4f8100e4503af0b
Python
tocoli/tocolib
/tocoli/spell.py
UTF-8
3,783
2.953125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- STRICT = 'strict' WIDE = 'wide' def lookup(word, dictionary): word = word.lower() res = [] pair = False for i, c in enumerate(word): if pair: pair = False else: try: try: nextC ...
true
0a1ce52a3a6a604fa871aef39c176dafced37973
Python
MaiconRenildo/Python
/Python 2.7/Códigos/Listas/Lista3/q17.py
ISO-8859-1
462
3.96875
4
[ "MIT" ]
permissive
print 'Calculo da Area de um triangulo' base=input('Informe o tamanho da bese do triangulo: ') while base<=0: base=input('Erro! A base no pode ser menor ou igual a zero. Informe um tamanho valido: ') altura=input('Informe a altura do trinagulo: ') while altura<=0: altura=input('ERRO! A altura do triangulo no po...
true
fa228b98424083ba7604b23ad596097dd2525dad
Python
luohc2004/Dodger
/scripts/stpoint.py
UTF-8
2,458
3.375
3
[ "Apache-2.0" ]
permissive
import math import util import random import point class STPoint(object): def __init__(self, x, y, t): self.x = x self.y = y self.t = t def get_x(self): return self.x def get_y(self): return self.y def get_t(self): return self.t def within(self...
true
e0a3192e00099cdbc9462b09d898b74aa30ac3c3
Python
lanonk/CS_object_oriented_programming
/customer.py
UTF-8
1,547
3.8125
4
[]
no_license
class Customer: #the initilized variables for this class def __init__(self): self.id = " " self.name = " " self.order = [] #counts the number of orders a customer has---can also us len function def get_order_count(sel...
true
22fbbd766c154028c3d3555262ffc4192e9bd128
Python
LevTG/Python_Projects
/Shtirlitz/Monoalphabet.py
UTF-8
1,122
3.03125
3
[]
no_license
__author__ = 'Timofey Khirianov' # -*- coding: utf8 -*- class Monoalphabet: alphabet = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя" def __init__(self, keytable): lowercase_code = {x: y for x, y in zip(self.alphabet, keytable)} uppercase_code = {x.upper(): y.upper() for x, y in zip(self.alphabet, keyta...
true
1655fce486c9f2e2c598d4c57726d7f6f5e686d2
Python
levimcclenny/Reinforcement_Learning
/Chapter2/Fig2-2.py
UTF-8
2,880
2.984375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 27 02:10:33 2017 @author: levimcclenny """ import seaborn as sns import numpy as np import matplotlib.pyplot as plt sns.violinplot(data = np.random.normal(0,1,10) + np.random.randn(200, 10), color = 'gray') class Bandit: def __init__(self): ...
true
783d5e78ba6883d16b5ef34efae88958078463dc
Python
gautam-sharma1/FacialKeypointDetection
/live_inference.py
UTF-8
3,957
2.890625
3
[ "MIT" ]
permissive
""" uses haar cascade to detect faces and then uses the trained neural network to detect keypoints """ import numpy as np import os import cv2 import matplotlib.pyplot as plt from model import Net from transforms import * import torch import argparse parser = argparse.ArgumentParser(description='Live Inference') par...
true