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
1d628d3bedd01442773ca98cc4e8382addb2484f
zeeshanhanif/ssuet-python
/16April2017/DemoDictionary/DemoDictionary4.py
UTF-8
163
3.328125
3
[]
no_license
myDictionary = {"name":"Adnan", "age":45,"email":"adnan@gmail.com"} for key in myDictionary.keys(): print(key) for value in myDictionary.values(): print(value)
true
e0b12d66d36b828252b3f30c9047dd8794b03234
kaustav8319/kgdpython
/ifelsesolve1.py
UTF-8
206
2.9375
3
[]
no_license
import math import os import random import re import sys n=int(input("Enter input ")) if(n%2==0 and n in range(6,20)): print("Weird") elif(n%2==0 and n in range(2,5) or n>20): print("Not Weird")
true
234c40f743b3bbe272bc8622a3ee515cf5ed6442
calvia76/Python
/Alvia_Chrystian_Assignment4/Alvia_Chrystian_assignment4_problem3.py
UTF-8
1,504
4.125
4
[]
no_license
left = False right = False while(True): x = int(input("\nHow many columns? (Enter a positive integer) ")) if(x<0): print("\n---------- INVALID ENTRY: Enter a positive integer ----------") continue elif(x==0): print("\n---------- INVALID ENTRY: Enter a number above 0 ---------- ") ...
true
9a749b2f2c5fa26f47e3560458e8a9a22b803e0d
ClemensKnights/Writeups
/xmasctf/xn-mas/gf_poly.py
UTF-8
2,478
2.828125
3
[]
no_license
# https://stackoverflow.com/a/48067397/1106415 # (C) user6655984, CC-BY-SA 3.0 import itertools from functools import reduce from sympy import symbols, Dummy from sympy.polys.domains import ZZ from sympy.polys.galoistools import (gf_irreducible_p, gf_add, \ gf_sub, gf_mul, gf_rem, ...
true
058b73b4ad3af40e5d35188524bd2211d1b4b41b
Anne19953/LearnPython
/Day9/进程锁模拟买票.py
UTF-8
854
2.96875
3
[]
no_license
#!/usr/bin/env python # coding:utf-8 """ Name : 进程锁模拟买票.py Author : anne Time : 2019-08-26 17:07 Desc: """ from multiprocessing import Process,Lock import time,json,random def search(): dic=json.load(open('db.txt')) print('\033[43m剩余票数%s\033[0m' %dic['count']) def get(): dic=json.load(open('db.txt')) ...
true
74eecff3fedcba8d1be5bd4d3631c4994a44db97
routerating/route-rating-serverless
/api/handlers/users_handler.py
UTF-8
3,668
2.546875
3
[]
no_license
import logging from api.api_gateway import ApiGatewayEvent from api.users.user import User from api.users.users_service import UsersService from api.utils.handler_utils import handler, admin_handler, basic_handler log = logging.getLogger(__file__) def validate_user_fields(users_service: UsersService, user: User) -...
true
8704a7b64097797ec089f4a99f9acbe970f02b31
Alex9823/hw
/tf_idf.py
UTF-8
2,338
3.34375
3
[]
no_license
#tf- term freq #idf - inverted document #считаем df # потом мы считаем idf #считаем tf-idf #для каждого слова в текстке #берем 5 слов с минимальным значением import os import re from math import log punct = '[.,!«»?&@"$\[\]\(\):;%#&\'—-]' tabs= '[\t\n]' def preprocessing(text): # функция предобработки ...
true
7f690ff9e0beb86b376119d9ff132798f7d792e9
matheusvictor/estudos_python
/curso_em_video/mundo_02/ex039.py
UTF-8
1,261
3.75
4
[]
no_license
from datetime import date ano_atual = date.today().year print('\033[1;31m+=\033[m' * 50) print(f'Estamos em {ano_atual} e queremos saber se você já tem idade para se apresentar ao Serviço Militar.') opcao = int(input('Para começar: você é do sexo masculino?\n1-Sim\n2-Não\nDigite uma das opções acima: ')) if(opcao == ...
true
98ea4fafb6fc58089c1c4fd892af8ba9a7e65f51
jsalvatier/mcex
/mcex/distributions/special.py
UTF-8
3,812
2.6875
3
[]
no_license
''' Created on Mar 17, 2011 @author: jsalvatier ''' from theano import scalar,tensor import numpy from scipy import special, misc class GammaLn(scalar.UnaryScalarOp): """ Compute gammaln(x) """ @staticmethod def st_impl(x): return special.gammaln(x) def impl(self, x): return G...
true
fd00d703db2aa644a33d3e30c12a3bd0b9e4a5a8
jkesanie/rahti-test
/helloworld.py
UTF-8
333
2.640625
3
[]
no_license
#import numpy as np import pandas as pd import os cwd = os.getcwd() print(cwd) #/app df = pd.read_csv("./src/data/testi.csv") print("Hello world!") print(df.columns) print(df["title"].tolist()) df.to_csv("./data/output.csv") print(os.path.exists("./data/output.csv")) print(os.path.exists("/app/data/output.csv")) pr...
true
c8fbee77bcdde10568aa7f3d49296b7bd8e73505
vaibhavv62/vaibhavv62-Institute-Administration-Using-Django
/IAProject/populate_students.py
UTF-8
1,123
2.765625
3
[]
no_license
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE','IAProject.settings') import django django.setup() import random from faker import Faker from BranchApp.models import Branch from StudentApp.models import Student faker = Faker() branches_list = Branch.objects.all() def addFakeStudents(n): for _ in range...
true
a70535dc469a123c30f362055a6d3196a244d2b2
faultuser/self.code
/algorithm/sorts/bubble_sort.py
UTF-8
909
3.890625
4
[]
no_license
# ============================================================================= # Author: falseuser # Created Time: 2019-10-28 17:47:26 # Last modified: 2019-10-29 16:07:16 # Description: 冒泡排序 # 从前往后比较,已排序的放在后面 # ============================================================================= def sort(collection): ...
true
9dda11ef1276a4dc7685f7ab23ce97741f0cc8fe
Sijiu/library
/filestudy/test_pickle.py
UTF-8
929
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- import pickle, shelve # pickle 泡菜 shelve 搁置,上架 # 二进制文件dat # brand = ["pickle", "shelve", "text"] # dit = {"first": "html", "second": "C", "third": "java"} # fl = open("pickle2.dat", "wb") # pickle.dump(brand, fl, True) #默认为 Flase 文本格式写入 # pickle.dump(dit, fl) # fl.close() # 反序列化 # f = open...
true
6812dea33147c5a592a4e94280611cd9e8209908
jrs026/SentenceAlignment
/python/feature_function.py
UTF-8
4,062
3.28125
3
[]
no_license
import math class FeatureFunction(object): """A generic class for extracting features from a sentence pair.""" def __init__(self, opts): self.opts = opts def get_features(self, source, target): return [] @staticmethod def poisson_prob(mean, observed): p = math.exp(-mean) for i in xrange(ob...
true
77b7b9569097c6bd2ab38f6896c0e952b48cddd7
flexo333/Euler
/P020.py
UTF-8
149
2.875
3
[]
no_license
def problem(): prod =1 for x in range(1, 101, 1): prod *=x return sum(map(int,list(str(prod)))) if __name__ == "__main__": print(problem())
true
a2a0ca1cfa1644bfc4446ef0e14c66cba9c171e7
queryor/algorithms
/leetcode/49. Group Anagrams.py
UTF-8
1,437
3.8125
4
[]
no_license
# Given an array of strings, group anagrams together. # Example: # Input: ["eat", "tea", "tan", "ate", "nat", "bat"], # Output: # [ # ["ate","eat","tea"], # ["nat","tan"], # ["bat"] # ] # Note: # All inputs will be in lowercase. # The order of your output does not matter. class Solution: def groupAnagrams...
true
7743dab537dc1a832d246f4543a2f9f0ae757507
anshbordia/Projects-and-Algorithms
/Greedy Algorithms/fractionalknapsack.py
UTF-8
1,420
4
4
[]
no_license
# Fractional Knapsack Program # Greedy Algorithm # Runs in O(nlgn)...this includes the time to sort in decreasing order as well # If already sorted and sorting part of program is removed then works in linear time: O(n) # Function takes in list of format -> [[item mass1, item value1]...and so on] def solveknapsack(tup...
true
71e9a6b3a58bc935810a7437827f79fea48e313b
DeepaliVerma/VisualNews-Repository
/eval/myeval.py
UTF-8
1,524
2.546875
3
[]
no_license
""" This script should be run from root directory of this codebase: https://github.com/tylin/coco-caption """ from pycocotools.coco import COCO from pycocoevalcap1.eval import COCOEvalCap import json from json import encoder encoder.FLOAT_REPR = lambda o: format(o, '.3f') import sys, pdb def myeval(input_json, annFil...
true
c4410bc7112ebf7ab6423b002d62f032e1a0fbfd
MahonriM/ULAM
/ULAM.py
UTF-8
246
3.25
3
[ "MIT" ]
permissive
numero=int(input("\tIngresa un numero y te mostrare la sucesion ulam")) if numero>0: while int (numero!=1): div=numero%2 if (div ==0): numero=numero/2 print(numero) else: numero=numero*3+1 print(numero)
true
8b79bf46329fd5f1ad6a156b787b60c866bd7587
DataEdgeSystems/Analytics_Vidya
/test.py
UTF-8
1,080
3.1875
3
[]
no_license
import os import sys import pandas as pd import re #Get the presently working directory (which is the parent path and the root of the Project) parent_path = os.getcwd() test_file = os.path.join( parent_path , 'data' , 'test.csv') train_file = os.path.join( parent_path , 'data' , 'train.csv') def Run_sentiment_analys...
true
efb81e1df09bea1ad0dab1b427495739f26e30d8
Hironobu-Kawaguchi/atcoder
/atcoder/abc034_c.py
UTF-8
340
2.921875
3
[]
no_license
# https://atcoder.jp/contests/abc034/tasks/abc034_c W, H = map(int, input().split()) def nCr(n, r, mod=10**9+7): r = min(r, n-r) numer = denom = 1 for i in range(1, r+1): numer = numer * (n+1-i) % mod denom = denom * i % mod return numer * pow(denom, mod-2, mod) % mod prin...
true
a0a6f10c6878a6c4bc9ee962dd858e97f0443810
alvarojbarros/aircrewprogram-modelo
/Aircraft.py
UTF-8
643
2.703125
3
[]
no_license
import Tools class Aircraft(object): def fieldsDefinition(self): res = {} res['Code'] = ('str',3) res['Name'] = ('str',20) res['Type'] = ('str',10) return res def __init__(self,fields): if not Tools.validateFieldsType(self.fieldsDefinition(),fields): return ...
true
5c9fb718e0d751b56ea149f61cb4dbf83ed789dc
HarshCasper/pororo
/pororo/tasks/phoneme_conversion.py
UTF-8
8,541
3.078125
3
[ "Apache-2.0", "LicenseRef-scancode-secret-labs-2011", "HPND", "ISC", "MIT", "Unlicense", "BSD-2-Clause", "Python-2.0", "BSD-3-Clause" ]
permissive
"""Grapheme to Phoneme related modeling class""" import os from typing import List, Optional, Union from pororo.tasks.utils.base import PororoFactoryBase, PororoSimpleBase class PororoG2pFactory(PororoFactoryBase): """ Conduct grapheme to phoneme conversion English (`g2p.en`) - dataset: g2pE ...
true
03301746dbd1c00b15e034d49f40173465788143
pgomezboza/holberton-system_engineering-devops
/0x16-api_advanced/2-recurse.py
UTF-8
929
3.125
3
[]
no_license
#!/usr/bin/python3 """ Recursive function that queries the Reddit API and returns a list containing the titles of all hot articles for a given subreddit. """ import requests def recurse(subreddit, hot_list=[], after=None): url = "https://www.reddit.com/r/{}/hot.json?after={}" headers = {'user-agent': 'agent'}...
true
85afda532716c96dccb92603fa0223fec45f297b
niemasd/tools
/fastq_header_rename_illumina.py
UTF-8
1,620
2.515625
3
[]
no_license
#! /usr/bin/env python3 # parse user arguments import argparse parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-i', '--input', required=False, type=str, default="stdin", help="Input FASTQ file (default is standard input)") parser.add_ar...
true
8394c2276514a3ad88fe536a67d9602750944ca6
alseambusher/SemanticTyping
/tests/numeric.py
UTF-8
965
2.78125
3
[ "MIT" ]
permissive
import random from scipy.stats import mannwhitneyu, f_oneway, ks_2samp __author__ = 'alse' def kolmogorov_smirnov_test(train_examples, test_examples): sample1 = random.sample(test_examples, 100 if len(test_examples) > 100 else len(test_examples)) sample2 = random.sample(train_examples, 100 if len(train_examp...
true
1b7c3b3020a92023d5d365fbbb6ac6865e330ba3
LorenaGaMo/cs229_dl_multiomics
/analysis.py
UTF-8
13,995
2.59375
3
[]
no_license
from sklearn.preprocessing import MinMaxScaler from sklearn.impute import SimpleImputer import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.cluster import KMeans from sklearn.svm import LinearSVC from utils import * import pandas as pd import numpy as np import scipy as sci import pdb ...
true
a4cfedc0db91a8752f9cb9d2c3c17e4c1efc4fe0
Aasthaengg/IBMdataset
/Python_codes/p02763/s969586100.py
UTF-8
1,362
3.34375
3
[]
no_license
class BIT: def __init__(self, N): self.tree = [0] * (N + 1) # 1-indexed self.N = N def add(self, i, x): """tree[i]と関連個所にxを加える""" tree = self.tree N = self.N while i <= N: tree[i] += x i += i & (-i) def sum(self, i): tree = se...
true
1e8ceb9c79c6bf2c1c9d868926241e1bd8b5de5d
vikasprashar99/Scrape-Google
/location.py
UTF-8
494
2.734375
3
[]
no_license
import requests from bs4 import BeautifulSoup from textblob import TextBlob from pprint import pprint import re import pandas user_input=input("Enter to search:") google_search= requests.get("https://www.google.com/search?q="+user_input) soup=BeautifulSoup(google_search.text,'html.parser') # print(soup.prettify()) m...
true
550f66c4b817b27491239adc67dedb6740d51353
vdhug/practical-machine-learning
/svm.py
UTF-8
1,203
3.3125
3
[]
no_license
import numpy as np from sklearn.model_selection import train_test_split from sklearn import preprocessing, svm import pandas as pd # Reading database as csv file df = pd.read_csv('breast-cancer-wisconsin.data') # Replacing missing values for a really big negative number, this will create outlayers, that our algorithm ...
true
e5736cce9b745789ae0f2d3ad7866e6df1620c9b
AniruddhaHumane/nd00333-capstone-ML-Engineer
/starter_file/HyperDrive/train.py
UTF-8
2,315
2.515625
3
[]
no_license
from sklearn.ensemble import RandomForestClassifier import argparse import os import numpy as np from sklearn.metrics import mean_squared_error import joblib from sklearn.model_selection import train_test_split import pandas as pd from azureml.core.run import Run from azureml.data.dataset_factory import TabularDatasetF...
true
e96aa2407e362393e9013eb9b0eda1155cf9ba3e
babychoujr/Map_Quest
/output.py
UTF-8
2,801
3.4375
3
[]
no_license
#Eric Chou 95408627 #PROJECT 3: : Ride Across the River #output.py import mapquest def find_latlng_list(json_result: dict)-> str: #Finding the latitude and longitude from the JSON object latlng_list = [] route_entry = json_result['route'] locations = route_entry['locations'] for site in loca...
true
7fdc40a5b49ddd95072d2a0ea256a56602de8da5
kgalloway2/VSC-Code
/MA515/newton_lagrange.py
UTF-8
538
3.15625
3
[]
no_license
import guassian as g data = [(2,2),(4,3),(6,1),(8,3),(10,2)] k = len(data) '''based on newton lagrange mtehod from page 108. worked on example he did.''' matrix = [] for i in range(k): matrix.append([1]) prev_entry = 1 for j in range(1, k): if j > i: matrix[i].append(0) else:...
true
95e3404c6f582787b020b968c782046b97a6c3b0
aaronhwoo/webscraping_hw
/app.py
UTF-8
1,251
2.671875
3
[]
no_license
from flask import Flask, render_template, redirect, request from flask_pymongo import PyMongo import pymongo import scrape_mars app = Flask(__name__) #setup PyMongo connection app.config["MONGO_URI"] = "mongodb://localhost:27017/mars" # setup mongo connection conn = "mongodb://localhost:27017" client = pymongo.Mongo...
true
a91f88b3eb747df33ade2fa8cec073d6c239537a
Mamata720/if-else
/divisible.py
UTF-8
117
3.828125
4
[]
no_license
varx=int(input("enter a number")) if varx%2==0: print("it is divisible") else: print("it is not divisible")
true
81e1d370487fac8600299c88b8dfc0e686cef954
gurkslask/HAMC
/Kompensering.py
UTF-8
3,067
3.703125
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- class Kompensering: '''Kompensering är en klass som används för utekompensering. Man får sätta lite olika brytpunkter med SetVarden metoden, sätta MinMax och sen kör CountSP med utetemperaturen för att få tillbaka ett börvärde ''' def __init__(self...
true
fd454073157f8518e0552025f6a8910bf0f80f54
c17r/AoC
/day15-2.py
UTF-8
10,064
3.09375
3
[ "MIT" ]
permissive
# Utility import re import sys import copy import arrow from dataclasses import dataclass, field from pprint import pprint from collections import abc from collections import Counter, defaultdict, namedtuple, deque from functools import lru_cache from itertools import permutations, combinations, chain, cycle, ...
true
1837794c773ba34bf9dca1ca034285d0c1347c10
olexxxa/CIS106-Oleksa-Ivankiv
/Session 9/S9.2.py
UTF-8
96
3.296875
3
[]
no_license
a=1 b=1 for x in range (0, 20): next=a+b print(a) a=b b=next
true
b38de0aa61b4fe79cbf9cec4076175d3ecfaf5ef
ImagClaw/Python_Learning
/Networking/Lab2aServer.py
UTF-8
502
3.109375
3
[]
no_license
import socket def main(): host = '0.0.0.0' port = 8080 buffer = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print("Starting socket on port: {}".format(port)) s.bind((host, port)) s.listen(10) conn, addr = s.accept() print("Connection received from {}".format(addr)...
true
f09b2fa430d4dd1cc1e6e33963e574cfacdcf02b
fvictorio/project-euler
/095/095.py
UTF-8
1,207
2.828125
3
[]
no_license
MAX_N = 1000000 criba = {} # divisors lac = {} # longest amicable chain for i in range(2, MAX_N + 1): criba[i] = [1] lac[i] = 0 i = 2 while 2*i <= MAX_N: n = 2*i while n <= MAX_N: criba[n].append(i) n += i i += 1 best_lac = 1 min_elem = 28 for i in range(2, MAX_N + 1): a = i ...
true
b95b00b98ef944149a1de93320fefb2a3983413c
davidsram/written-examination-questions
/convert-min.py
UTF-8
110
3.34375
3
[]
no_license
def convert_min(min): hour,min=divmod(min,60) print('%s hour %s minutes'%(hour,min)) convert_min(123)
true
a22c15953fe42fa515adbf1f6b692637eca7ccd2
lukepfister/scico
/scico/math.py
UTF-8
3,274
2.96875
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- # Copyright (C) 2020-2021 by SCICO Developers # All rights reserved. BSD 3-clause License. # This file is part of the SCICO package. Details of the copyright and # user license can be found in the 'LICENSE' file distributed with the # package. """Math functions.""" from typing import Union i...
true
05c403c8ece96f3cd55c01ecc8c5af53c2b980f1
AlexSkrn/sqlite_bash_scripts
/mongo_db_course/01_data_extraction/09_xml_example2.py
UTF-8
458
2.75
3
[]
no_license
import os import xml.etree.ElementTree as ET import pprint tree = ET.parse(os.path.join('data', 'exampleresearcharticle.xml')) root = tree.getroot() title = root.find('./fm/bibl/title') # xPath expression title_text = '' for p in title: title_text += p.text print('\nTitle:\n', title_text) print('\nAuthor ema...
true
9c11f06e1fe2b910b6e07bad03a5a50764c1e3df
Kinnoo/cs404.1-1
/python/src/util/queue.py
UTF-8
478
3.25
3
[ "MIT" ]
permissive
from python.src.util.linkedlist import LinkedList class Queue: def __init__(self): self.list = LinkedList() def __iter__(self): return iter(self.list) def peek(self): return self.list.front() def enqueue(self, value): self.list.insert_end(value) def dequeue(sel...
true
52f864f40a2b951115080089b696650105db84b9
rafaelperazzo/programacao-web
/moodledata/vpl_data/178/usersdata/276/96896/submittedfiles/contido.py
UTF-8
550
4
4
[]
no_license
# -*- coding: utf-8 -*- n= int (input('Digite a quantidade de termos da primeira lista: ')) m= int (input('Digite a quantidade de termos da segunda lista: ')) a = [] b = [] for i in range (0,n,1): valor_a = float (input('Digite o elemento da primeira lista: ')) a.append (valor_a) for i in range (0,m,1): ...
true
9ab3749bb5df99185ff720c7fc37e0053948b813
pyvista/pyvista-docs
/version/0.38/api/plotting/_autosummary/pyvista-CompositeAttributes-reset_colors-1.py
UTF-8
320
2.53125
3
[]
no_license
# Set individual block colors and then reset them. # import pyvista as pv dataset = pv.MultiBlock([pv.Cube(), pv.Sphere(center=(0, 0, 1))]) pl = pv.Plotter() actor, mapper = pl.add_composite(dataset, color='w') mapper.block_attr[1].color = 'r' mapper.block_attr[2].color = 'b' mapper.block_attr.reset_colors() pl.show()
true
502525771954e61adb4a9ac86897e5f193f2b76a
jdwittenauer/ionyx
/ionyx/contrib/category_to_numeric.py
UTF-8
2,642
3.859375
4
[ "Apache-2.0" ]
permissive
import numpy as np class CategoryToNumeric(object): """ Transform class that replaces a categorical value with a representative target value for instances that belong to that category. This technique is useful as a method to turn categorical features into numeric values for use in an estimator, and c...
true
be921b13e8896688e02637c2a92013413b7fc3a5
appleface2050/Coursera-ML
/johnwittenauer/src/simple_linear_regression.py
UTF-8
1,577
3.5
4
[ "MIT" ]
permissive
# coding=utf-8 """ http://www.johnwittenauer.net/machine-learning-exercises-in-python-part-1/ """ import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from util.lib import computeCost, gradient_descent path = os.getcwd() + "\data\ex1data1.txt" data = pd.read_csv(path, header=None, names=[...
true
04dea8245120626c2ef23a18b3b15a6432ed0362
ml-edu/EM_Image_Segmentation
/generators/custom_da_gen.py
UTF-8
28,043
2.65625
3
[]
no_license
import tensorflow as tf import numpy as np import random import os from tqdm import tqdm from PIL import Image from PIL import ImageEnhance from data_2D_manipulation import random_crop from util import img_to_onehot_encoding import imgaug as ia from imgaug im...
true
41948784eb413f1d5e7975be99c39cd9d407edbb
notaidea/python
/yufa/copy1.py
UTF-8
202
3.484375
3
[]
no_license
# -*- coding : utf-8 -*- """ 练习时用list 浅拷贝:仅仅是复制了引用 深拷贝:完全复制 """ a = [11, 22, 33] b = a print(id(a)) print(id(b)) a.append(44) print(id(a)) print(id(b))
true
88b7e5581f1ef0802834dde8826d679c931be15d
MilesFryettUofA/stonks
/backend/getpastreddit.py
UTF-8
3,096
2.953125
3
[]
no_license
import pandas as pd import requests import json import csv import time import datetime import threading subStats = {} def convertdates(start_date, end_date): ''' Converts a D/M/Y time to a UNix timecode Example (D/M/Y = "01/12/2011") args - start/end date: Date of start / end of reddit search (D/M/Y) retuns - st...
true
ebfc4cad612c011a959297231ba454d1a2669d8d
majaar/workshops
/workshops/spotkanie3/zakupy.py
UTF-8
746
3.0625
3
[]
no_license
from spotkanie1 import task5_vat_paragon def zakupy(cennik, lista_zakupow): suma = 0 lista_cen = [] for produkt in lista_zakupow: suma += lista_zakupow[produkt] * cennik[produkt] lista_cen.append(lista_zakupow[produkt] * cennik[produkt]) return suma, lista_cen cennik = { ...
true
7ebce10d68a688ea43b7451e4277737296880308
BulochkaBU/stepik_python_one
/28.py
UTF-8
1,467
3.671875
4
[]
no_license
''' Условие задачи: Когда Антон прочитал «Войну и мир», ему стало интересно, сколько слов и в каком количестве используется в этой книге. Помогите Антону написать упрощённую версию такой программы, которая сможет подсчитать слова, разделённые пробелом и вывести получившуюся статистику. Программа должна считывать одну с...
true
bfd544f2955b4a5682cf74ad68ab67a43cedaf17
yncreahdf-robotics/flotte_M2_2020-2021-preparateur
/catkin_ws/src/test_python/scripts/IHM.py
UTF-8
949
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- import curses def print_menu(stdscr, selected_row_idx, menu): stdscr.clear() h,w=stdscr.getmaxyx() # get the size of the screen height and width stdscr.addstr(h//2-len(menu)//2, w//2 - len("MENU FLOTTE")//2,"MENU FLOTTE") #consigne = "Use ARROWS to navigate and ENTER to validate - ESC t...
true
2a620c27fb27547797ac97e8a1cea1b971d87ac8
LamotheMax/MSR_2018_Android_API_Study
/FileFollower.py
UTF-8
2,581
2.71875
3
[]
no_license
import git import logging def get_project_repository(repo_dir): repository = git.Repo(repo_dir) assert not repository.bare return repository def follow_file(file_name, repo, latest_tag, earliest_tag): g = repo.git # look into git log -- path also, see the benefits of each and chose one hex...
true
6aee12e5b41269728c784f37201ea6f483f169ab
ccdxc/demo
/linux/linux-dbus/dbus/py/dteeth.py
UTF-8
4,063
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import dbus import _introspect_parser import getopt, sys MARGIN_WIDTH = 4 ONE_MARGIN = ' ' * MARGIN_WIDTH # signal是个元组,它有一个元素,是一个列表。列表的元素是signal的参数 # 列表的每个元素都是字典。它有两个元素,键值分别是'type'和'name' def show_signal(name, signal, margin): print margin+name+'(', args = signal...
true
4dcecda43549cef76038a937fa594dde96c3f65d
nthieu173/SwimmingSwarm
/pyGui.py
UTF-8
9,114
3.0625
3
[]
no_license
import pygame import math pygame.font.init() pygame.init() # Define some colors BLACK = ( 0, 0, 0) WHITE = ( 255, 255, 255) OFFWHITE = ( 235, 235, 235) GREEN = ( 0, 255, 0) RED = ( 255, 0, 0) BLUE = ( 0, 0, 255) CYAN = ( 0, 255, 255) GREY = ( 192, 192, 192) DARK_G...
true
98b21abc815c814a6a35fe9fe95d1bb45312c005
tianhenmei/Machine-Learning
/Project/_turtle2.py
UTF-8
590
3.375
3
[]
no_license
import turtle def draw_rhombus(t): t.forward(50) t.right(60) t.forward(50) t.right(120) t.forward(50) t.right(60) t.forward(50) def draw_cort(): window = turtle.Screen() window.bgcolor('#ff0084') t = turtle.Turtle() t.color('#fff') t.shape('turtle') t.speed(5) f...
true
00fa54a5e9e7df24e0351e9cdb63e1c7c08f43a5
whcas/CS1822Project
/Breakdown.py
UTF-8
600
3.5625
4
[]
no_license
def Breakdown(Expenses): Catagories = [] for Expense in Expenses: cat = Expense.Category new = True for Catagory in Catagories: if cat == Catagory[0]: new = False if new == True: Catagories.append(cat) for Catagory in Cata...
true
adbd1d2746231b51db45b9e9692bf764d152fe12
joss13aws/tak_maya_preset
/plug-ins/rungeKutta.py
UTF-8
5,151
2.53125
3
[]
no_license
"Fourth order Runge Kutta method to solve the second order differential equation for mass-spring-damper systems" __author__ = "Paolo Dominici" __version__ = "Version: 1.0" __date__ = "Date: 2008/12/04" import sys, math from maya import OpenMaya, OpenMayaAnim, OpenMayaMPx nodeName = "rungeKutta" spNodeId = OpenMaya.M...
true
7716295c5c0b3307ad989661555927d64a417152
hjortnaes/congra_parser
/scripts/dijikstra.py
UTF-8
1,736
3.296875
3
[ "MIT" ]
permissive
nodes = ['A', 'B', 'R'] edges = [(1, 'R', 'A'), (1, 'R', 'B'), (40, 'A', 'B'), (50, 'A', 'B'), (10, 'B', 'A'), (20, 'B', 'A')] #Min heap structure class heap: def __init__(self): self.store = [] def push(self, val): self.store.append(val) i = len(self.store)-1 ...
true
85611464305066ec31d0efc4c25b31c6432b37db
mattweiss/public
/synthetic_data/synthetic_sensor_data_generator.py
UTF-8
2,932
2.609375
3
[]
no_license
import os, sys from abc import ABC, abstractmethod import pandas as pd from pdb import set_trace as st class SyntheticSensorDataGenerator(ABC): """ Abstract base class for synthetic sensor data """ def __init__( self, dataset_dir = None, trials = None, se...
true
ec1cc7a5e5e3c1de1b8bffa76037ab249b52581b
livinlefevreloca/data-engineer-airflow-challenge
/tests/unit/news_pipeline/test_tabularize.py
UTF-8
1,255
2.71875
3
[]
no_license
import pytest import time import os import requests import dags.news_pipeline.values as vals from dags import news_pipeline as n class TestTabularize: @pytest.fixture def api_data(self, retries=0): api_key = os.environ["API_KEY"] headers = {"X-API-Key": api_key} url = "https://newsap...
true
0a7d9b34cf6d6402f758488c1138c017a8e1075a
rdgleeson/occs364s19-degreepath
/loadData.py
UTF-8
11,014
3
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 7 23:55:52 2019 @author: JayMessina """ import pandas import os classes = {} dict_wint = {} dict_cd = {} dict_wadv = {} dict_qfr = {} #import myClasses #from myClasses import Course class Course(): def __init__(self, cid, dep, wint, cd, qfr...
true
80c94503491c0cc796d0babf25aaea504c8d8b67
clEsperanto/pyclesperanto_prototype
/pyclesperanto_prototype/_tier0/_cl_image.py
UTF-8
7,223
2.71875
3
[ "Python-2.0", "BSD-3-Clause" ]
permissive
import pyopencl as cl from functools import lru_cache import numpy as np from typing import Tuple from .._tier0 import get_device def empty_image(ctx, shape, dtype, num_channels=1, channel_order=None): if not len(shape) in [2, 3]: raise ValueError( "number of dimension = %s not supported (can...
true
67675967d13abdf7ae0201fc9a7c8ab3f813d838
chagge/SemanticModellingPaperSimilarity
/code/crank.py
UTF-8
8,261
2.796875
3
[]
no_license
import networkx as nx #import numpy import timeit import sys '''Implementation of C-Rank for testing purposes''' def main(args): #G = nx.Graph() ###### Graph Nr 1 ############################################### #G.add_nodes_from([('Publication_1', {'Class':'Publication'}), ('Publication_2', {'Class':'Pub...
true
fc95c14c9707d85849df3d45c71be55bd05b6732
Murrii/stepik-auto-tests-course
/lesson2.2_step3.py
UTF-8
1,016
3.375
3
[]
no_license
from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.support.ui import Select # Открыть браузер con = WebDriver() # Открыть страницу http://suninjuly.github.io/selects1.html con.get("http://suninjuly.github.io/selects1.html") # Найти веб-элементы с числами, выпадающим списком и ...
true
4aabc453f702f3520e8b043b6439f2f7807972a7
pramod-Paratabadi/InfyTQ-Course-Solutions-and-References
/Programming in Python/Day-7/PF-Assgn-48.py
UTF-8
840
2.84375
3
[]
no_license
#PF-Assgn-48 def find_correct(word_dict): correct,almost,wrong=0,0,0 for key,value in word_dict.items(): if key == value: correct=correct+1 else: if len(key)!=len(value): wrong=wrong+1 continue incorrect=0 for i in ...
true
1553bf5694b5a73d4cdae14912b651ab7ece1e4f
Poethalphyu/python-exercises
/ex101.py
UTF-8
518
3.546875
4
[ "MIT" ]
permissive
tabby_cat = "\tI'm tabbed in." persian_cat = "I'am split\non aline." backslash_cat = "I'am \\ a \\ cat." fat_cat = """ I'll do a list: \t* cat food tabby_rat = "\tI'm tabbed in." persian_rat = "I'am split\non aline." backslash_rat = "I'am \\ a \\ dog." fat_rat = """ I'll do a list: \t* Rat food \t* Fish...
true
7261cdaf9836c117e7fcef094f5d91c9afc9c309
anaeliaovalle/atc-mt-dti
/atc/LINE-master/utils/line.py
UTF-8
1,668
2.71875
3
[ "MIT" ]
permissive
import torch import torch.nn as nn import torch.nn.functional as F class Line(nn.Module): def __init__(self, size, embed_dim=128, order=1): super(Line, self).__init__() assert order in [1, 2], print("Order should either be int(1) or int(2)") self.embed_dim = embed_dim self.order ...
true
ec600ea49dfe01ac3c60911dc19ffcc87c883051
sonhal/OOPPyAaaS
/tests/test_column.py
UTF-8
487
2.890625
3
[ "MIT" ]
permissive
import unittest from oop_pyaaas.dataset import Column class ColumnTest(unittest.TestCase): def test_to_dict(self): data = [1,2,3,4] name = "id" attribute_type = "IDENTIFYING" column = Column(name=name, cells=data, attribute_type=attribute_type) column_dict = column.to_dict...
true
06a7118eda830346cd76668747faaa54bff71e64
Sem31/Data_Science
/3_pandas-practice/12_merging_and_concatenating.py
UTF-8
1,708
3.671875
4
[]
no_license
#merging joining and Concatenating import numpy as np import pandas as pd df = pd.DataFrame({'A' : ['A0','A1','A2','A3'], 'B' : ['B0','B1','B2','B3'], 'C' : ['C0','C1','C2','C3'], 'D' : ['D0','D1','D2','D3']},index = [0,1,2,3]) df1 = pd.DataFrame({'A' : ['A4','A5','A6','A7'], 'B' : ['B4','B5','B6','B7'], 'C...
true
05d1dccc3395022973a498e60fc9ee56dc235b60
Ishan2K1/Class-XII
/Q-18.py
UTF-8
630
3.84375
4
[]
no_license
class ringTower: def __init__(self): self.list=[] def push(self,x): if len(self.list)==0: self.list.append(x) elif x<=self.list[0]: self.list.insert(0,x) elif x>=self.list[len(self.list)-1]: self.list.append(x) def pop(self): if len...
true
9762ece02344aae5b409bf7ebf4470e679812690
opencv/opencv
/samples/dnn/text_detection.py
UTF-8
9,341
2.625
3
[ "Apache-2.0" ]
permissive
''' Text detection model: https://github.com/argman/EAST Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1 CRNN Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch How to convert from pb to onnx: Using classes from here: htt...
true
8d4e09498c0bcaeefbade0576fe5f8f6d1e4d12e
Vhavoc11/Team-2-Accountabuddy
/queueup.py
UTF-8
6,381
2.921875
3
[]
no_license
import discord from discord.ext import commands import os import asyncio from discord.ext.commands import has_permissions, MissingPermissions import bot_config from keyvaluemanagement import * from filemanagement import * interestsfile = "interests.txt" datadir = "queue/" queuefile = datadir+"userqueue.txt" #Chang...
true
d447a2ed76aacc7b505be5afa4a28ffa9254dde4
mcx797/persona
/spider/spider.py
UTF-8
4,272
2.515625
3
[]
no_license
from spider.url import Url from spider.path import Path from spider.saveFile import saveFile import urllib.request import json import sys import os class Spider: myUrl = Url("", "") def __init__(self, urlIn): self.myUrl = urlIn def spiderList(self, urlName): strHtml = urllib.request.urlo...
true
461516fb4ceecf5d9fc199ddfecb6043443ebbad
lisheung/C291A2
/btreeCreatePopDB.py
UTF-8
1,143
3.03125
3
[ "MIT" ]
permissive
# Berkeley DB # author: Bing Xu # email: bx3@ualberta.ca # Edited by Chris Li # Creating and populating a database for btree. import bsddb3 as bsddb import random import subprocess import datetime as dt DB_SIZE = 100000 DB_SEED = 10000000 def getRandom(): return random.randint(0,63) def getRandomChar(): re...
true
8ea1ccb7a0e98899568bd85e87f00fe31c8d71fd
aabishkaryal/exercism-python
/phone-number/phone_number.py
UTF-8
469
3.328125
3
[]
no_license
import re class PhoneNumber: def __init__(self, number: str): number = re.sub(r"[.|(|)|\-|+| ]", "", number) number = re.sub(r"^1", "", number) if re.fullmatch(r"[2-9]\d{2}[2-9]\d{6}", number): self.number = number self.area_code = number[:3] else: ...
true
a3dbec19349a9e3832a4650a7ad5a726bc9debc2
KangEunseo/2019-python-class
/First Semester/Test4.py
UTF-8
367
3.484375
3
[]
no_license
# 주차요금 계산 import sys print("주차시간을 입력하세요.(단위:분)", end=' >> ') time=int(input()) money=0 if 0<time and time<30+1: money=2000 elif time>24*60: print("24시간을 넘길 수 없습니다.") sys.exit() else: money=2000 for i in range(31, time+1, 10): money+=1000 if money>25000: money=25000 print(str(money)+"원")
true
dbd5f0a07402871c33b11c6390bf758fdc0cb53c
obetsa/itea_advanced_new
/work3/home3/home3_2.py
UTF-8
2,386
3.640625
4
[]
no_license
"""2. Покрыть тестами задачу из прошлой домашки с матрицами: сложение, умножение на число, возникновение ошибки. Либо если не получается с матрицей, то взять любую другую задачу из дз и написать тесты для неё.""" class InvalidMatrixDimensions(Exception): pass class Matrix: def __init__(self, rows): ...
true
355a4ce770c015c984c52add8c9f43761ce66ebe
jashansudan/CafeServer
/client.py
UTF-8
4,294
2.921875
3
[]
no_license
import socket from random import * import json import time # Class for standard client class Client: def __init__(self, a_code): # Set up basic client information, like access code SERVER = "127.0.0.1" PORT = 8080 if a_code == 0: access_code = randint(50, 300) e...
true
7901b9177cb7da2ade6ab30c72031acf6ac1a0d9
wsgan001/PyFPattern
/Data Set/bug-fixing-4/118d6217d6c04aac4bc35934a549336e1c50b7b6-<test_append>-fix.py
UTF-8
999
3.0625
3
[]
no_license
def test_append(self, sort, float_frame): mixed_frame = float_frame.copy() mixed_frame['foo'] = 'bar' begin_index = float_frame.index[:5] end_index = float_frame.index[5:] begin_frame = float_frame.reindex(begin_index) end_frame = float_frame.reindex(end_index) appended = begin_frame.append(...
true
6f95bbfc87af208fd6d69ded6c6f3227fe6e532a
superdingwei/Mini-Tools
/Image-Edit/mainWindowLayout.py
UTF-8
6,864
2.546875
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGui, QtWidgets class MainLayout(object): def setupUi(self,window): window.resize(1000, 600) #窗口标题 self.setWindowTitle(...
true
2513550b4d1779fb98d611fdcb62f97aad12c5f8
petii/aoc2020
/aoc2020/days/day1.py
UTF-8
1,176
3.296875
3
[ "MIT" ]
permissive
from typing import List, Dict, Callable, Tuple class Solution: input: List[int] def __init__(self, input: List[int]): self.input = input def _part1(self, input: List[int], sum: int) -> Tuple[int, int, int]: for index in range(0, len(input) - 1): current = input[index] ...
true
6811bcdb9eb91591393747c9d2258369c373a0cd
swarnanjali/python-programes
/swap.py
UTF-8
48
2.546875
3
[]
no_license
e,f=map(int,input().split()) e,f=f,e print(e,f)
true
857685e9857b794f5fe0142c339d1b73873b34e5
ewu23/PFFlow
/dope.py
UTF-8
1,390
3.046875
3
[]
no_license
run = True stupid = True dumb = [] connum = 1 subnum = 97 side = raw_input("What side?") dumb.append(side) while(run == True): var = raw_input("Contention = a, Subpoint = s, Evidence = d, Misc = f, Stop = end ") if(var is "a"): con = raw_input("What's the contention? ") dumb.append("Contention " + str(connum...
true
614359a99c6914664e19bbeaada9afb60c9abbd6
1757/Assorted-ML-Homeworks
/KNN, Linear mapping/Assignment1-Question3.py
UTF-8
5,426
3.5
4
[]
no_license
""" Stephen Vu Xuan Kim Cuong - 1000646 ESD Class of 2016 Fall 2015 Machine Learning SUTD """ import numpy as np import matplotlib.pyplot as plt import sys #-------------------PART B: GENERATING AND PLOTTING DATA SETS-------------------------- #Generate binary label base on set probability def binLab(vector): #throw ...
true
b173cab0cc78aca0b825a63e4b9ba29507fc09a4
Siddharth46/python_common_questions
/methd.py
UTF-8
261
3.15625
3
[]
no_license
class stud: def __init__(self,fname,lname,age): self.fname=fname self.lname=lname self.age=age def emailgen(self): return "{}.{}@school.com".format(self.fname,self.lname) stud1=stud('siddharth','dixit',25) print(stud1.emailgen())
true
e3b4444b5d98a546d6b236eeaba660b57e67c5ee
shen-ee/dr-2019sp
/RetinaNet/retinanet_train.py
UTF-8
2,374
2.546875
3
[]
no_license
import os import sys import matplotlib.image as mpimg def convert(model_train,model_pred): script_convert = "python k/keras_retinanet/bin/convert_model.py " command_convert = " ".join([script_convert, model_train, model_pred]) # print(command_convert) os.system(command_convert) def train(labels, cla...
true
8a8624d07f1d79be348ae5ab712ba9663c390207
Lyxn/linprog
/test_dw.py
UTF-8
1,902
2.515625
3
[]
no_license
import numpy as np from decomposition import simplex_dantzig_wolfe from linprog import linprog from utils import to_array, to_array_list DEBUG = True def test_dw0_revised(): c = [-4, -1, -3, -2] b = [6, 4, 5, 1, 2, 6] A = [[2, 2, 1, 2], [0, 1, 2, 3], [2, 1, 0, 0], [0, 1, 0, 0], [0, 0, -1, 2], [0, 0, 1, ...
true
b7a52911260ca160c9713dbf7d0aa43355e40acd
Enthuons/python-calculator
/calculator.py
UTF-8
6,262
2.828125
3
[]
no_license
from tkinter import * def btnClick(numbers): global operator numbers = str(numbers) operator = str(text_input.get()) operator = operator + str(numbers) leng =len(operator) text_input.set(operator) entry.icursor(leng) def clickEquals(values): global operator operator ="" ...
true
a1aad4b9ffcc0dba16ba54775d7cf1882a81b81d
jss367/cv_dataclass
/src/cv_dataclass/dota_metadata.py
UTF-8
4,122
2.90625
3
[]
no_license
""" This includes the categories added in version 1.5 TODO: What should image_data['id'] be? TODO: Should number be forced to ints? If so, when? http://cocodataset.org/#format-data COCO consists of an overall datadict, which contains an info dict, images dicts, annotation dicts, and a license dict This file dumps a...
true
449c8e7f329bcf50e19226b550ddcd8badc12051
gideontong/YiQi
/modules/Slack.py
UTF-8
1,109
2.84375
3
[]
no_license
""" This is the function of the code that reads from memory the location to how to update the Slack service. It manages the logic of handling multiple Slack servers and allows users to update all of them at once. """ API_ROUTE = '/api/users.profile.set' # TODO: Create this function. def sendUpdate(token: str, status:...
true
794aab61e29fc7e0f77ca8c814bd7ffe52db37c1
hsakas/CounterfeitDetectors
/searcher/temp.py
UTF-8
2,021
2.90625
3
[]
no_license
""" @author: aswamy @github: hsakas """ from time import time import torch import torch.nn as nn from annoy import AnnoyIndex from flair.data import Sentence from flair.embeddings import FlairEmbeddings from flair.embeddings import StackedEmbeddings from flair.embeddings import WordEmbeddings # pylint: disable=inval...
true
eb917b14c8fed07ba1da4734a76c7b89bcd53d09
ZXdatascience/Hierarchical_text_classifier
/base_classifier.py
UTF-8
604
2.921875
3
[]
no_license
from sklearn.svm import LinearSVC from sklearn.linear_model import LogisticRegression from sklearn.multioutput import MultiOutputClassifier def base_classifier(tree_type): """ You can add your own base classifiers here. To make sure it works, your selection of base classifier must be compatible with the mu...
true
33da613d7e724c7797665474dc17d35269e213c6
Monaco12138/Pagerank
/blockMemory.py
UTF-8
2,181
2.796875
3
[]
no_license
import ReadWrite import time block = 100000 #一个Block大小 N = 1000000 Beta = 0.8 M = ReadWrite.Read(N) #M = [[0,1,3,5],[0,5],[3,4],[0,3,2],[3,2],[4,5]] K = N // block #共K组,每组有一个Block大 Mblock = [None]*K #将M分成K个小Mblock destination = -1 destList = [] for i in range(N): de...
true
9af2228d1da50486bf893ce5e90fb1d4a52914e8
anthony-314/python-portfolio-2020
/term 1/Week 7/oop.py
UTF-8
1,268
3.09375
3
[]
no_license
import pygame, sys pygame.init() class Bullet3: def __init__(self,image): self.speed = [2,2] self.image = pygame.image.load(image) self.rect = self.image.get_rect() def move(self): self.rect = self.rect.move(self.speed) if self.rect.left < 0 or self.rect.right > width:...
true
81597f91c204edbda7c17f63d1ba2cd7c7a81432
Mounika-bs/Mounika
/8.py
UTF-8
228
3.890625
4
[]
no_license
PI = 3.14 radius = float(input(' Please Enter the radius of a circle: ')) diameter = 2 * radius circumference = 2 * PI * radius print('diameter of the circle is:',diameter) print('circumference of the circle is:',circumference)
true
30598290c7c5956c312779d3c33c26d0ce7a6cef
pabrodbra/BioSearch
/SparqlBS/utilities.py
UTF-8
13,774
2.828125
3
[]
no_license
from SPARQLWrapper import * def convert_json_format_into_list(results): """ Given a dictionary containing the results of a SPARQL query in JSON format, it creates a list of lists in which the first element is a list containing the variables used in the query, and the rest of the elements are lists rep...
true
34e2bd7238270dafd208202c300a21867a8f7ad0
eternidad33/csp
/Python/第1题/跳一跳.py
UTF-8
339
3.09375
3
[ "AFL-3.0" ]
permissive
a = list(map(int, input().split())) n = len(a) score, temp = 0, 2 for i in range(n): if a[i] == 0: break elif a[i] == 1: score += 1 temp = 2 else: if a[i - 1] == 1 or i == 0: score += 2 temp += 2 else: score += temp temp...
true