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
458e4cd4451a56e07fe5e0fa6432662f2bea8949
PzanettiD/practice
/digpow.py
UTF-8
439
3.53125
4
[]
no_license
# Is there an integer k # such as : (a ^ p + b ^ (p+1) + c ^(p+2) + d ^ (p+3) + ...) = n * k # n * k = t_sum def digpow(n, p): number = list(map(int, str(n))) t_sum = 0 for i in range(len(number)): number[i] = number[i] ** (p + i) t_sum += number[i] k = t_sum / int(n) k = ...
true
db7b2a1d8e385267fce8ab302f9d38d923dfb45c
yaoyaowd/tensorflow_demo
/seq2seq/ptb_word_lm.py
UTF-8
6,304
2.765625
3
[]
no_license
import numpy as np import tensorflow as tf import reader flags = tf.flags logging = tf.logging flags.DEFINE_string("model", "small", "A type of model. Possible options are: small, medium, large.") flags.DEFINE_string("data_path", None, "data_path") FLAGS = flags.FLAGS class PTBModel(object): """The PTB model...
true
d3544a9f90d97a7412ea990dc15c62d81e79f863
liberion1994/AA18_Project_Bootstrap
/utils/check_and_visualize.py
UTF-8
14,116
2.6875
3
[]
no_license
# coding: utf-8 import os import json import graphviz as gv import argparse class Clazz(object): def __init__(self, id): self.id = id class Relation(object): def __init__(self, id, source, target, name=None): self.id = id self.source = source self.target = target self...
true
82c2694d7308a5b4e33d8f0a92ce4f2334343c2c
23thibja/python
/python/school-scedule.py
UTF-8
1,836
3.375
3
[]
no_license
while True: First = input ("What is your first name: ") Last = input ("What is your last name: ") ID = input ("What is your student ID: ") class1 = input ("Enter your first class, enter Stop to end:") if class1 == "Stop": break room1 = input ("Enter the room number: ") print ("*\tBlock...
true
5c4a5e063989ac5b6d4c7612bde0425fe8f79db8
yusi0928/All-labs
/Data pipeline/Car analysis/Car analysis.py
UTF-8
1,189
2.953125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[2]: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns year = int(input('Enter the year: ')) title = 'Top 10 Manufacturers by Fuel Efficiency ' + str(year) def acquire(): data = pd.read_csv('/Users/abc/Portfolio/Data pipeline/vehicles.csv') ...
true
7bb4c2a96d271e5365baac35bd9814f0bcc4d460
thehighestmath/ANN-2021
/8382/Terekhov/pr/3/main.py
UTF-8
728
2.78125
3
[]
no_license
import numpy as np def pr3(matrix: np.ndarray, y, x, width, height): assert width > 0 assert height > 0 shape = matrix.shape col_start = y - width // 2 col_end = y + width // 2 + width % 2 row_start = x - height // 2 row_end = x + height // 2 + height % 2 assert (col_start >= 0) as...
true
2bf8f684043d50873c200f196b986e2599a1ac8c
stasinopoulos/panoptes
/src/panoptes.py
UTF-8
5,363
2.578125
3
[]
no_license
#!/usr/bin/env python3 import glob import os import hashlib import time import csv from optparse import OptionParser import argparse from functools import partial from colorama import init, Fore, Back, Style # VARIABLES #paths = ["/bin", "/sbin", "/usr/bin", "/usr/sbin", "/boot"] paths = ["/bin"] outfile = "ids.db" n...
true
a3063b34944a526278e7c4499e20d4a71ca80662
timbledum/pyxel-projects
/top_down/top_down.py
UTF-8
1,642
3.203125
3
[]
no_license
import pyxel def xclamp(n): # return max(min(144, n), 0) return n def yclamp(n): # return max(min(128, n), 0) return n class App: def __init__(self): pyxel.init(128, 128, caption='test game') pyxel.image(0).load(0, 0, 'assets/test.png') self.speed = 2 self.player_...
true
e59686f63fe11ea8e30a3c6cf7f2d4cedf712da8
GreedyOsori/Chat
/Greedy/Sibal.py
UTF-8
34
2.609375
3
[ "MIT" ]
permissive
a = 3 b = 4 print type(a)==type(b)
true
09adbcbf55353821ebbabce1f85950332c79896c
avatargu/AID1908
/1_PYTHON/common/list_helper.py
UTF-8
4,667
4.1875
4
[]
no_license
""" 列表助手模块 """ class ListHelper: """ 列表助手类 """ @staticmethod def get_all(list_target, func_condition): """ 在列表中查找符合某个条件的所有元素 :param list_target: 列表 :param func_condition: 条件 :return: 元素 """ for item in list_target: if fu...
true
ce98e53cd1a73d0b8d2babcbae00a6c4492b0e8d
sunboya/web
/webpy/todos-backbone/server/webpy/mysqlite.py
UTF-8
641
2.9375
3
[]
no_license
class sqldb: #先验证数据库是否存在 def __init__(self): if os.path.exists("todos.db"): #如果数据库存在,就直接连接 self.conn = db.connect("todos.db") self.cu = self.conn.cursor() else: #如果数据库不存在,连接,并生成表 self.conn = db.connect("todos.db") self.cu = self.conn.cursor() self.cu.execute("""cre...
true
c190130e2a5cbc0454b75e500204cb251f1f927c
astravital/gbpylessons
/Lesson_1_1.py
UTF-8
189
3.1875
3
[]
no_license
r = 5 p = 3.14 color = 'red' print('r = ', r, '; p = ', p, '; color = ', color) print('') a = input('Input a - ') print(a) b = input('Input b - ') print(b) c = input('Input c - ') print(c)
true
8e6e0e9a798c44042a1bf2512244a5fe81e61553
ChathurikaDissanayaka/e16-co326-Agriculture-Monitoring-and-Control-System
/Pump and distribution/SENSOR_MQTT/MQTT_sensors_pub.py
UTF-8
2,344
2.765625
3
[]
no_license
import os import time import sys import paho.mqtt.client as mqtt import json import random # MQTT broker MQTT_Broker = 'broker.mqttdashboard.com' # topics TOPIC_HUMIDITY = "/CO326/2021/PDU/water_quality_humidity" TOPIC_PH = "/CO326/2021/PDU/water_quality_ph" TOPIC_TEMPERATURE = "/CO326/2021/PDU/wa...
true
4d778f2c4637c4994697fa09ba6457cce02de4f1
haiyan1/test
/while循环.py
UTF-8
273
3.953125
4
[]
no_license
#定义一个整数变量,记录循环次数 num = 1 #开始循环 while num<=5: #1、希望在循环内执行的代码 print("hello world") #2处理计数器 num=num+1 #3观察一个,循环结束后num是多少 print("循环结束后,%d"%num)
true
c05b82ee3e15595524d2a39d9b18f8c2117f529b
javad-amin/Datalogi-1-DA2001
/Lab 8/translate_morse.py
UTF-8
2,163
3.546875
4
[]
no_license
import morse as m def translate_to_morse(character): ''' Överätter ett tecken till morse. Argumentet är ett tecken. Retunerar en morse enligt teckenlexikon. ''' if character is ' ': return ' ' else: character = character.upper() return m.char_dictionary[character] ...
true
7a492c00bc1bc54ceccda0b9fbf926d6b0fc5162
HaripriyaChavala/MTech
/Sem2/MachinePerception/svm.py
UTF-8
3,950
2.515625
3
[]
no_license
import numpy as np import pywt import cv2 import matplotlib.pyplot as plt from sklearn import svm from os import listdir from os.path import isfile, join def w2d(imArray, mode='haar', level=1): #imArray = cv2.imread(img) #Datatype conversions #convert to grayscale imArray = cv2.cvtColor(imArray,cv2.COL...
true
7fb122e148c786b06df9bb2df7cdf7593b28c8a2
jonathan-cook235/DSSGxUK-ITU
/src/scripts/map_offline/data_gathering/opendata.py
UTF-8
10,394
2.5625
3
[]
no_license
from osgeo import gdal import geopandas as gp import os from data_gathering.opendata_utils import * from data_gathering.opendata_scrap import * from school import * from data_gathering.opendata_facebook import * from feature_engineering import configs from data_gathering.opendata_satellite import * """OPENDATA SUP...
true
68059f489043ba6b4740a26b53fd171d115babe3
umap-project/umap
/umap/management/commands/import_pictograms.py
UTF-8
1,902
2.5625
3
[ "WTFPL" ]
permissive
import os from django.core.files import File from django.core.management.base import BaseCommand from umap.models import Pictogram class Command(BaseCommand): help = 'Import pictograms from a folder' def add_arguments(self, parser): parser.add_argument('path') parser.add_argument('--attribu...
true
bc5a07ae60c0235516ebc9ce5881b2d9d2a0464a
dahe-cvl/vhh_sbd
/vhh_sbd/Shot.py
UTF-8
1,439
3.859375
4
[ "GPL-3.0-only" ]
permissive
class Shot(object): """ This class represents on shot and contains shot properties such as start/end frame index of a shot, shot-id and video_name. """ def __init__(self, sid, movie_name, start_pos, end_pos): """ Constructor. :param sid: This parameter is used to specify ...
true
a6e98e527d6b354e98ed02e5e9c52859bff3f9bf
tanjased/design_patterns
/02.cr builder/builder.py
UTF-8
3,204
4.375
4
[]
no_license
# If you want to build a simple html paragraph using a list text = 'hello' parts = ['<p>', text, '</p>'] # print(''.join(parts)) # you're given a bunch of words and you want to make a html list out of these words. # designing a html page with html tags words = ['hello', 'world'] parts = ['<ul>'] for w in words: pa...
true
85cd07035a488fa269cd40663c853daa374c5a2d
storyskya/python_student
/tuple.py
UTF-8
233
2.765625
3
[]
no_license
list1 = ['1','3','a'] t1 = ('a','b','c','d','e','f') haft = 'appl', # print(list1) # print(t1) # print(tuple(list1)) # print(list(t1)) dict1 = {} # dict1['x1'] = t1 # print (dict1['x1'][3]) dict1[haft] = 'e' print(dict1)
true
b2d43c0fa6b62315937a81fcfa0b2e6f2f1bbde1
Straikerus/autoservice
/recording/utils.py
UTF-8
3,745
2.8125
3
[]
no_license
from datetime import datetime, timedelta from django.conf import settings from .models import Record RECORDING_TIMES = [] def generate_times_list(): """ Генерация списка возможных для записи времён Пример списка ['10:00', '11:00', ..., '17:00'] """ time = int(settings.START_WORKING_TIME[:2]) * ...
true
7a0ef6d41a7bb34ebaad64b94f664ab6779724b6
MarcoLaud/MyPythonSolutionsToLeetCode
/CreateTargetArrayInGivenOrder.py
UTF-8
750
3.90625
4
[]
no_license
# Given two arrays of integers nums and index. Your task is to create # target array under the following rules: # # Initially target array is empty. # # From left to right read nums[i] and index[i], insert at index index[i] # the value nums[i] in target array. # # Repeat the previous step until there ...
true
f75ae4b9952c48043de32879c9c7b11c81739109
toggri/sample1
/sample2.py
UTF-8
156
3.296875
3
[]
no_license
# This line is a comment def spam(): eggs = 12 return eggs print spam() monty = True python = 1.234 monty_python = python**2 print monty_python
true
5630f0b24514656fcfe828bc88c486eae8bc9c03
suhasghorp/QuantFinanceBook
/Solutions to Exercises/Chapter 3/Python Codes/Exercise_3_3.py
UTF-8
1,382
3.265625
3
[]
no_license
#%% """ Created on Wed Oct 16 2019 Exercise 3.3- plot payoff for a call opton @author: Irfan Ilgin & Lech A. Grzelak """ import matplotlib.pyplot as plt import numpy as np import scipy.stats as st import enum # This class defines puts and calls class OptionType(enum.Enum): CALL = 1.0 PUT = -1....
true
eba65d459bcd9bd07dee50703a5621dc0f2040d7
moxlev/AtCoder
/abc/abc025A.py
UTF-8
205
2.859375
3
[]
no_license
import itertools def main(): S = input() N = int(input()) c = list(itertools.product(S, repeat=2)) ans = c[N - 1][0] + c[N - 1][1] print(ans) if __name__ == '__main__': main()
true
43d7c4a917c7b018790d281a6eec99d395171bd3
algobot76/leetcode-python
/leetcode/674_longest_continuous_subsequence/solution1.py
UTF-8
351
2.75
3
[]
no_license
class Solution: def findLengthOfLCIS(self, nums): n = len(nums) if n == 0: return 0 if n == 1: return 1 ans = 0 anchor = 0 for i in range(1, n): if nums[i - 1] >= nums[i]: anchor = i ans = max(ans, i - a...
true
e45811c0a47d20ac01966c654feeb2517b27ee65
rohitshakyaa/python
/rock paper scissor.py
UTF-8
1,481
4.125
4
[]
no_license
# rock paper scissor :) import random # function to find out winner def winner(pc, user): print("Your choice: {}".format(user)) print("PC choice: {}".format(pc)) if pc == user: print(f"Both players selected {pc}. It's a tie.") elif pc == "rock": if user == "paper": print("...
true
2d027c9b9fa8872e11373aa659531b5ba10d7fbf
mehtajinesh/HCA-DBSCAN
/dbscan_wiki.py
UTF-8
2,628
2.6875
3
[]
no_license
import scipy.spatial as spatial import numpy as np import time import sys start_time = time.time() def dbscan(d,eps,min_pts): clusters=[] neighbour_pts=[] noise=[] points = np.array(d.keys()) point_tree = spatial.cKDTree(points) for p in d.keys(): if d[p]==1: con...
true
0da08e472c913b359a71c97ad55dae2768256ebb
myriadhero/Python-CNTK-Tensorflow-learning
/reFormatDataForCNTK.py
UTF-8
2,666
2.71875
3
[]
no_license
import numpy as np import time np.random.seed(int(time.time())) #parameters input_dim = 6000 # can incorporate this into code, #but best to be sure and know from start out_classes = 2 # same as above trainSetPercent = 0.6 #60% for training data_scaling = 13000.0 # have to also know this from...
true
a280ff3157bfd55cd4b3ed92ed4687dda224943f
JUNGEEYOU/python-algorithm
/12/3.py
UTF-8
751
3.203125
3
[]
no_license
def solution(s): answer = len(s) # 중복이 없는 경우 for step in range(1, len(s)//2 + 1): # 1 ~ 문자열 절반 단위까지 쪼갬 result = '' # 압축결과 pre = s[0:step] count = 1 for i in range(step, len(s), step): if pre == s[i:i + step]: # 이전 결과와 동일한 경우 count += 1 ...
true
cdbcdcae916f64c555a6621570917d671e641fe2
oscarcorreag/PhD-code
/Steiner Forest LP Directed/steiner_forest_lp_directed.py
UTF-8
4,915
2.65625
3
[]
no_license
import operator from scipy.optimize import linprog from graph import Graph class SteinerForestLPDirected: def __init__(self, graph, requests): self.__graph = graph self.__terminals = [r[1:] for r in requests] self.__roots = [r[0] for r in requests] def steiner_forest(self): v...
true
cb8cfd929f89b996bd259bd817a51b1532aefebb
lucagrementieri/candlelight
/candlelight/functional/linear.py
UTF-8
616
2.59375
3
[ "Apache-2.0" ]
permissive
from typing import Tuple import torch import torch.nn.functional as F def linear( input: torch.Tensor, value: torch.Tensor, domain: Tuple[float, float] = (0, 1) ) -> torch.Tensor: input_shape = input.shape input = 2 * (input.flatten() - domain[1]) / (domain[1] - domain[0]) + 1 input = torch.stack((in...
true
4f0a8dae06d379e5197f780aeb8577069aaab223
iriscult/python
/Lesson 3/3.py
UTF-8
396
4.21875
4
[]
no_license
# 3. Реализовать функцию my_func(), которая принимает три позиционных аргумента, и возвращает сумму наибольших двух аргументов. def my_func(a, b, c): try: return sum((a, b, c)) - min(a, b, c) except TypeError: return "Please enter number!" print(my_func(8, 9, 2))
true
d3b4b3c5d3e4e3587ca351efb28f4ae282444a0a
xalumok/proga
/proga4 iterator/generator.py
UTF-8
235
2.84375
3
[]
no_license
from calculator import calc def generator(begin, end, step, EPS): if EPS <= 0 or begin > end or step <= 0: raise ValueError("Bad input") cur = begin while cur < end: yield calc(cur, EPS) cur += step
true
28c07dc93030590d998f5bcff88b970bfcc043b2
ggzhang0071/pytorch-esn
/examples/SaveDataCsv.py
UTF-8
526
3.03125
3
[ "MIT" ]
permissive
import csv import os newdata =[0,0,0,0,0,0] """ examples Path='./Results/' FileName='AccuracyRate.csv' PathFileName=os.path.join(Path,FileName)""" def SaveDataCsv(PathFileName,newdata): with open(PathFileName,'r') as readFile: reader =csv.reader(readFile) lines = list(reader) li...
true
4d74f25979047544cb052e0723c1568fbb4c2e7d
Tiger-a11y/PythonProjects
/Sets.py
UTF-8
404
3.515625
4
[]
no_license
s1 = set((1,2,3,4)) s2 = {1, 5, 7, 9, 3} '''print(s1) print(type(s1)) print(s2)''' for x in s1: print(x) Fruits = { "mango", "carrot","onion","grapes"} print("onion" in Fruits) Fruits.add("orange") print(Fruits) Tropical = {"mango","apple", "banana", "cherry"} All = Fruits.union(Tropical) print(All) Fruits.remove("...
true
6981c7a29229377f16441cdeed2b551bda56d5d5
fluffmoln/Citymapper
/show_route_dates.py
UTF-8
1,122
2.9375
3
[]
no_license
import sys import csv import urllib import zipfile # Function to call the specific columns/info from specific csv/txt file def csv_dict_reader(csvfile): reader = csv.DictReader(csvfile, skipinitialspace=True, dialect="excel") for line in reader: print "Service", print(line["service_id"]) + ":",...
true
13a9adbd30e46b1678454d5a8225217617d65704
YeongHyeon/adVAE
/source/neuralnet.py
UTF-8
18,742
2.609375
3
[ "MIT" ]
permissive
import tensorflow as tf class adVAE(object): def __init__(self, height, width, channel, z_dim, mx, mz, leaning_rate=1e-3): """The class adVAE conducts constructing adVAE with N steps as below. Step 1. Constructing neural network. Step 2. Defincing the loss functions. Step 3. Split...
true
6e6fd2f924db99881b3f33bfdb1103b5a7888aca
andycasey/ads
/ads/tests/test_export.py
UTF-8
1,552
2.640625
3
[ "MIT" ]
permissive
""" Tests for ExportQuery """ import unittest import six import os from .mocks import MockResponse, MockExportResponse from ads.export import ExportQuery, ExportResponse from ads.config import EXPORT_URL class TestMetricsQuery(unittest.TestCase): """ test the ExportQuery object """ def test_init(se...
true
ac100f41cc5904abcac9c223c3bb53e8575785d7
manquintero/sre-bootcamp
/auth_api/python/tests.py
UTF-8
1,394
2.71875
3
[]
no_license
import unittest import werkzeug from methods import Token, Restricted class TestStringMethods(unittest.TestCase): def setUp(self): self.convert = Token() self.validate = Restricted() def test_generate_token(self): """ Happy path """ self.assertEqual('eyJ0eXAiOiJKV1QiLCJhbGc...
true
bc11dc13807f951801e0ae2595c1195aec2589cd
limwonki0619/Python-lecture
/Python_coding_dojang/Test/Unit08.py
UTF-8
611
4.03125
4
[]
no_license
# Unit 08. 심사문제 : 합격 여부 출력하기 # 표준 입력으로 국어, 영어, 수학, 과학 점수가 입력됩니다. # 국어는 90점 이상, 영어는 80점 초과, 수학은 85점 초과, # 과학은 80점 이상일 때 합격이라고 정했습니다. # (한 과목이라도 조건에 만족하지 않으면 불합격). # 다음 소스 코드를 완성하여 합격이면 True, # 불합격이면 False가 출력되게 만드세요. # (input에서 안내 문자열은 출력하지 않아야 합니다) a, b, c, d = map(int, input().split()) print(a >= 90 and b > 80 and c...
true
ad1e9b774d23ea255a979575bb04b9ee7e8435a1
tezansahu/Computer_Vision_Projects
/6_Object_Size_Measurement/object_size.py
UTF-8
4,602
2.78125
3
[]
no_license
# import the necessary packages from scipy.spatial import distance as dist from imutils import perspective from imutils import contours import numpy as np import argparse import imutils import cv2 def midpoint(ptA, ptB): return ((ptA[0] + ptB[0]) * 0.5, (ptA[1] + ptB[1]) * 0.5) # construct the argument parse and ...
true
722a7566a4e53912cdff60e3884650b0f83e5bf6
texttest/storytext-selftest
/pygtk/other_ui_features/autologging/inline_entry_completion/target_ui.py
UTF-8
1,444
2.96875
3
[]
no_license
#!/usr/bin/env python import time import pygtk pygtk.require('2.0') import gtk class EntryCompletionExample: def __init__(self): window = gtk.Window() window.set_title("Entry Completion") window.connect('destroy', lambda w: gtk.main_quit()) vbox = gtk.VBox() label = gtk.Lab...
true
9e5d698dad5abdebc8d27b76f8d525906132d860
cohenor1112/Recognize-animal-sounds-W-python-W-deep-learning-
/final_project_advanced_version/main.py
UTF-8
6,306
2.765625
3
[]
no_license
#working on dataset : import load_prepared_datasets import prepare_datasets import divide_dataset #------------------------------- #working on the model : import build_and_compile_model import fit_save_or_load_fitted_model #------------------------------- #analyzing model : import model_evaluation import analyze_model ...
true
b2173cc28ae75cc0b5ca08e43cd12d0ca792f5c8
jasonjcwu/grapDoubanTop250
/ctrip.py
UTF-8
1,561
2.921875
3
[]
no_license
from lxml import html import time, re,requests import json temp_url=('https://hotels.ctrip.com/hotel/changde201/p{}') headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)\ AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"} stripD = re.compile('[^\d*]') etree = h...
true
69407e1f495be6dd24da2357eee1b6b1da521871
gangtar/base64
/base64secret.py
UTF-8
1,041
3.3125
3
[]
no_license
import re # 此方法用来将包含隐藏信息的字母转换为base64编码表对应的序列值(十进制数)并返回 def base64change(s): table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' # base64编码表,恰好索引值对应字母 for i in range(len(table)): if table[i] == s: return i # 此方法用来获取隐藏信息二进制字符串 def base64solve(): f = op...
true
5bb09224af6f3cd777919b438340c2c801b1a1e0
mikehung/leetcode
/749.Contain_Virus.py
UTF-8
2,548
3.03125
3
[]
no_license
import collections class Solution: def containVirus(self, grid): """ :type grid: List[List[int]] :rtype: int """ def connect(grid): index = 0 seen = [[False for c in range(n)] for r in range(m)] for r in range(m): for c in...
true
00e4944e0321fca105c880fbedab60e832dbe65a
avkramarov/gb_python
/lesson 5/Задание 3а.py
UTF-8
1,010
4.09375
4
[]
no_license
# Создать текстовый файл (не программно), построчно записать фамилии сотрудников # и величину их окладов (не менее 10 строк). # Определить, кто из сотрудников имеет оклад менее 20 тыс., # вывести фамилии этих сотрудников. Выполнить подсчет средней величины дохода сотрудников. with open("Задание 3а.txt", "r", enco...
true
545eb7bacf0fa5c7a05de64915a6dc8dd2713a1c
darksun113/blockchain
/MinerWatch-py/watchdog.py
UTF-8
1,391
2.6875
3
[]
no_license
import RPi.GPIO as GPIO import time import urllib2 import json rig1 = 17 rig2 = 15 rig3 = 18 rigname1 = "37db33" rigname2 = "9265bc" rigname3 = "cae414" threshold = 10.0 def reboot_it(rig): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(rig,GPIO.OUT) print "LED on" GPIO.output(rig,GPIO....
true
9257eed6ce3ad19c7445fe24d2e4a9769a52cec1
snerligit/mhc-pep-threader
/ia/chain_split.py
UTF-8
972
2.890625
3
[]
no_license
#!/usr/bin/python # Sgourakis Lab # Author: Santrupti Nerli # Date: February 1, 2018 # Email: snerli@ucsc.edu # ''' CHAIN_SPLIT class contains all the necessary functionalities required to divide a pose into two separate chains based on the given residue number also referred to as cutpoint. ''' # Load ...
true
9dca1472391fa0cc8a278be559cdb921fdb77ca3
anlen123/python
/力扣/38.报数.py
UTF-8
941
2.765625
3
[]
no_license
# # @lc app=leetcode.cn id=38 lang=python3 # # [38] 报数 # # @lc code=start class Solution: def countAndSay(self, n: int) -> str: def xx(s): if len(s)==1: return '1'+s ss = "" sum = 1 for i in range(len(s)-1): ...
true
f8c5872d2cbeb30cadfb5e860df59bc018db3bfc
sayalipawade/PythonBasics
/add.py
UTF-8
320
4.21875
4
[]
no_license
#Addition of two integer numbers a=int(input('enter first no=')) b=int(input('enter second no=')) sum=a+b print("addition is=",sum) #Addition of two float numbers a=float(input("Enter first no:")) b=float(input("Enter Second no:")) sum=a+b print("Addition of two float no=",sum)
true
f29849b3c8fe279ad857df48a9dfae52eae3b3d5
ajridley/RidleyTools
/FixLinks.py
UTF-8
5,655
2.609375
3
[]
no_license
##FixLinks.py ##Created Spring 2016 by Adam Ridley, GIS Specialist #Cottonwood Field Office - Bureau of Land Management ## FixLinks serves as a module to support functions which parse GIS-related file paths and attempt to find matches within the file system. ## FixLinks supports the ReportBrokenMXDs and ReportBroke...
true
33df9eafbc7b8ff531c6c6d8c4f48d2edb6bd201
caomw/KittiBox
/decoder/yolo_ish.py
UTF-8
19,481
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """Trains, evaluates and saves the model network using a queue.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np import scipy as scp import random from utils import train_utils i...
true
6b0223344157072de1d4adc5b12f8518a1f6d2f5
carllevif/nolimix86
/tests/unit/test.py
UTF-8
1,158
2.875
3
[ "MIT" ]
permissive
#! /usr/bin/env python3 import subprocess import os import sys import re GREEN = '\033[92m' RED = '\033[91m' BOLD = "\033[1m" ENDC = '\033[0m' FNULL = open(os.devnull, 'w') class suite: def __init__(self): self.failed = 0 self.passed = 0 def call_on_dir(self, test_dir): for f in sort...
true
d27557a68e17dcc319e198501a8c5ddacca35742
svarun115/IntermediateCodeGenerator-CD-Project-
/cse.py
UTF-8
6,319
2.78125
3
[]
no_license
import re def dead_code(): lhs=[] rhs=[] dead=[] for i in inp[1:]: if 'goto' in i: rhs.append(i) continue elif '=' not in i: rhs.append(i) continue temp=i.split('=') if '[' not in temp[0]: lhs.append(temp[0].strip()) else: l=re.search(r'.*\[(.*)\].*',temp[0]).group(1) rhs.append(l) ...
true
983440fed94b7fa97b6ac35753f98710ff7ecd94
vas3k/vas3k.club
/users/utils.py
UTF-8
629
2.8125
3
[ "MIT" ]
permissive
def calculate_similarity(my, theirs, tags): similarity = {} for group in ('personal', 'hobbies'): all_names = {tag.code for tag in tags if tag.group == group} my_names = all_names & my their_names = all_names & theirs both = my_names | their_names same = my_names & their_...
true
7f863af1e1b06d5568753b141019c08dfa13b7fd
mango2017/douban
/damai.py
UTF-8
2,360
2.65625
3
[]
no_license
from selenium import webdriver import os import time import json # wd = webdriver.Chrome() # wd.get("https://passport.damai.cn/login?ru=https%3A%2F%2Fwww.damai.cn%2F") # wd.switch_to.frame("alibaba-login-box") #进入iframe # wd.find_element_by_id("fm-login-id").send_keys("15002449401") # wd.find_element_by_id("fm-login-p...
true
df038ccb9b31080f403f7b2cb6230a5dc4ad1528
sanatanghosh/python-programs
/technical_questions/list.py
UTF-8
135
3.609375
4
[]
no_license
x= [[1,2,3],[4,5,6],[7,8,9]] print(x) for i in range (len(x)): for j in range(len(x[0])): print(x[i][j],end='') print()
true
23a8e998208f5789484a09047c6776a21ad62213
ncisrobert/Python
/week1/template/chattemplate.py
UTF-8
525
3.046875
3
[]
no_license
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> # Knights to was "ni" video reference # https://www.youtube.com/watch?v=zIV4poUZAQo file = open("stop-words.txt") stopwords = file.readlines() for word in stopwords:...
true
88cdc00fbcb98e4192ce17e295deaa33501c509d
leonbagaric/programi
/Python/Kombinacije.py
UTF-8
1,999
3.171875
3
[]
no_license
import re import math v1 = "+" v2 = "+" v3 = "+" results = [] equations = [] sorts = [] duplicates = [] lastint = -1 #0 = plus #1 = minus #2 = puta #3 = podjeljeno vars = ["+","-","*","/"] dodatni = [" 1","-1"] dodatni2 = ["2","2**2","2**3","2**4","2**5"] dodatni3 = ["3","3**2","3**3","3**4","3**5"] dodatni4 = ["...
true
1154f492fb8efbdc9f2f6a3b018d7884de0b1c82
rohitkg98/Neural-Network-from-Scratch
/nnet/optimizer.py
UTF-8
1,570
3.140625
3
[]
no_license
# NOTE: You can only use Tensor API of PyTorch import torch # Extra TODO: Document with proper docstring def mbgd(weights, biases, dw1, db1, dw2, db2, dw3, db3, lr): """Mini-batch gradient descent Args: weights (dict of torch.tensor): weights b/w the layers of the neural network in a dictionary. Siz...
true
1a0d05fead33f02f682d15c6d3b2716d8df4e04a
MrBadExample/scrappers
/scrapper.py
UTF-8
2,226
2.984375
3
[]
no_license
from googlesearch import search import requests # def google_search_for_web_sites(query, list_of_words): # for web_page in search(query, tld="com", lang='en', num=100, stop=100, pause=2): # try: # score = [] # r = requests.get(web_page).text.lower() # for word in list_o...
true
6b9e1bb4e06b0549b1aecac8619ca716f6588142
BinHeRunning/wi_deid
/AddDicFeatures.py
UTF-8
3,246
2.9375
3
[]
no_license
import os import sys # python AddDicFeatures.py dicfolderpath train.data train_dic.data test.data test_dic.data def AddDicFeaturesToTest(dics, testdata, testdicdata): fr = open(testdata, 'r') fw = open(testdicdata, 'w') line = fr.readline() #count = 0 while line != '': if line == '\n': ...
true
ec9a5f2261f0cff790dbcd60e2e4064e38275613
wangweifei-504/fewshot_generalization
/case_study_toolbox/loaders.py
UTF-8
5,395
2.75
3
[ "MIT" ]
permissive
import functools import pickle import torch import numpy as np def get_labels_stats(labels): labels_set = torch.unique(labels).numpy().tolist() num_labels = len(labels_set) n_sample_per_label = labels.shape[0] // num_labels return num_labels, n_sample_per_label def data_subset(data, labels, n_way, wa...
true
7a92826cc7c391fefa080a14c8d3438063bd2f8c
gjones1911/Project2_ML_PCA_k-means
/k_means_cluster.py
UTF-8
19,261
2.515625
3
[]
no_license
from ML_Visualizations import * from Process_CSV_to_Json import get_basic_stats from DimensionReduction import x_to_z_projection_pca from collections import Counter # -----------------------------------------Utility functions(make things easy--------------------------------------- # cheap print function def p(str): ...
true
71dbcaa72fecc7aca0c79b31c01a257430f83e1b
webclinic017/fa-absa-py3
/Python modules/hf_unit_pricer.py
UTF-8
6,520
2.6875
3
[]
no_license
"""---------------------------------------------------------------------------- PROJECT : D1 HF Linked Notes PURPOSE : This script sets/updates spot price of an input instrument. The price is calculated as an aggregated column value...
true
60a680b293ad8ec689876ccfdbbd86ff440cdea2
kevinelong/advanced_python
/decorators.py
UTF-8
497
4.59375
5
[]
no_license
# Decorators augment a function by wrapping it which allows us to do extra work before or after the function def the_decorator(wrapped_function): def wrapper(): print("before") wrapped_function() print("after") return wrapper # 1. Without Decorator Syntax def say_hello(): print("H...
true
f8dbd7ccf5ab6b12cd9af8b0d3f97c8d21b173a3
melizalab/dstrf
/dstrf/data.py
UTF-8
4,888
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- # -*- mode: python -*- """ This module will load stimuli and responses """ from __future__ import print_function, division import numpy as np def randomize_stimuli(data, random_seed=10): """Randomly shuffle stimuli in a dataset""" pass def randn(cf, random_seed=None): """Gaussi...
true
94ed529b20fb921cf45508240a4edc5f5bf93626
PaParaZz1/treevalue
/docs/source/tutorials/advanced_usage/rise_demo_2.demo.py
UTF-8
991
3.515625
4
[ "Apache-2.0" ]
permissive
from treevalue import TreeValue, subside, rise if __name__ == '__main__': # The same demo as the subside docs t1 = TreeValue({'a': 1, 'b': 2, 'x': {'c': 3, 'd': 4}}) t2 = TreeValue({'a': -14, 'b': 9, 'x': {'c': 3, 'd': 8}}) t3 = TreeValue({'a': 6, 'b': 0, 'x': {'c': -5, 'd': 17}}) t4 = TreeValue({'...
true
8e3c11968b8fde08e4b383e303fcad0f51215fc1
suriyaa/fprime
/Gds/src/fprime_gds/common/loaders/python_loader.py
UTF-8
4,881
2.90625
3
[ "Apache-2.0" ]
permissive
""" @brief Base class for all loaders that load dictionaries of python fragments The PythonLoader class inherits from the DictLoader base class and is intended to be inherited by all loader classes that read dictionaries in the file system made up of multiple python file fragments. This Class only adds helper functio...
true
7af97818784d69f48625f5b0b5a76caeff3e5510
seandst/cfme_tests
/sprout/sprout/log.py
UTF-8
3,062
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- from . import sprout_path import inspect import sys from django.db.models import Model from types import ModuleType from utils.log import create_logger as _create_logger log_directory = sprout_path.join("log") MAX_FILE_SIZE = 20 * 1024 * 1024 MAX_BACKUPS = 10 class LogWrapperForObject(objec...
true
09d2644cbfa0770c09f36f3bf77006e72eec3188
aditya119/Networking
/node.py
UTF-8
3,490
3.015625
3
[]
no_license
import socket from uuid import getnode as get_mac class Node: def __init__(self, ip, port): self.node_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.ip = ip self.port = port def act_as_server(self): self.node_socket.bind((self.ip, self.port)) ...
true
1f7c0287b6b45cd73383b057583adf6946aad387
NaorFahima/Course-Programming-Languages
/Exercise 1/q6.py
UTF-8
3,539
4.5625
5
[]
no_license
import math # geometric Shape class GeometricShape(object): def area(self): pass def perimeter(self): pass # Rectangle class Rectangle(GeometricShape): def __init__(self, height, width): self.height = height self.width = width def area(self): ...
true
7616167fbaa6db43c730060a172db730662d383c
menhuan/notes
/python/douyin/image2.py
UTF-8
20,425
3.765625
4
[ "Apache-2.0" ]
permissive
from PIL import Image, ImageDraw, ImageFont # 引入图片,画图笔,图片字体三个库 def show_image(news_contents): news_contents = news_contents.replace(' ','') news_content = news_contents.splitlines() import textwrap # 该库用于手动换行文字 news_wrap = [] # 准备一个数组来装我们的结果集 line_max = 20 # 按每行20个字分割成数组 for line in news_conten...
true
0624ab2e291bb2de629ad81e9fbce3c3e66fee9f
savyasachi-sa/pytorch-starter
/experiment.py
UTF-8
7,455
2.65625
3
[]
no_license
import os from datetime import datetime, timedelta import torch from torch.utils.data import DataLoader, random_split import numpy as np from dataset_factory import get_datasets from file_utils import * import matplotlib.pyplot as plt from constants import ROOT_STATS_DIR from model_factory import get_model class Exp...
true
b39abf47427c791a149ea8db0f3ec67581800cd0
sandwu/leetcode_problems
/专题训练/数组/简单/在数组中删除给定值的所有值并返回长度.py
UTF-8
271
2.671875
3
[]
no_license
class Solution: def removeelements(self,nums,val): if not nums:return index = 0 while index < len(nums): if nums[index] == val: del nums[index] continue index += 1 return index
true
e64f7c8f5fb0f7c1923f05bd8ea829de414b90ba
GauravSahani1417/Coder-s-Week-ML
/Day6/app.py
UTF-8
1,168
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jun 3 17:05:40 2020 @author: gaurav sahani """ from flask import Flask, render_template, request import joblib import numpy as np app=Flask(__name__) @app.route('/') def home(): return render_template('home.html') @app.route("/predict", methods=['G...
true
4b1180c46dd4e5115a40f62d627b920b6897686b
tswann/ansible_control_center
/create_playbook.py
UTF-8
2,124
2.90625
3
[]
no_license
#!/usr/bin/env python import sys import os HELP_TEXT = """ Usage: ./create_playbook.py /path/to/playbookname [role1 role2 ...] Creates an empy playbook skeleton, with any roles that are specified. e.g. ./create_playbook.py /tmp/pyplaybook web db cache """ def main(): args = sys.argv if len(args) < 2: ...
true
1c53b210753d60f89aab3c230720c67c3359340e
hyesungoh/AA_Algorithm
/python/BOJ_10819.py
UTF-8
497
3.078125
3
[]
no_license
def calcur(tl): t = 0 for i in range(n-1): t += abs(tl[i] - tl[i+1]) return t def bt(depth, tl): if depth == n: ans.append(calcur(tl)) return for i in range(n): if visit[i]: continue visit[i] = True tl.append(l[i]) bt(depth+1, tl...
true
8cf939ad9b108b4ebb11b4fe468438a28e6b7b1e
shibinp/ANAND_PYTHON
/chapter_5/number_of_lines.py
UTF-8
529
3.375
3
[]
no_license
#Write a function to compute the total number of lines of code in all python files in the specified directory recursively. import re import os n=[] def listallfiles(): q=os.listdir(".") return q def search_python_files(l): for u in l: y=re.match(r'.\w*.py$',u) if ...
true
55fe8c0d6fe0c0cda3aa726cd19219de60a19518
sugia/leetcode
/Basic Calculator II.py
UTF-8
1,722
4.3125
4
[ "Apache-2.0" ]
permissive
''' Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero. Example 1: Input: "3+2*2" Output: 7 Example 2: Input: " 3/2 " Output: 1 Example 3: Input: "...
true
c3e6c15af8f7fc9b9866fa34a80799df94ae0a70
mthrok/rosalind
/problems/corr.py
UTF-8
2,124
2.9375
3
[]
no_license
from __future__ import print_function from collections import defaultdict def preprocess(raw_data): strings = [] for chunk in raw_data.strip().split('>')[1:]: strings.append(''.join(chunk.split('\n')[1:])) return strings def rev_comp(string): convert = { 'A': 'T', 'T': 'A', ...
true
c68b339b61f4e094162b6e17b623307d5c584a07
archibanerj/IITKGP-Computational-Physics-Spring-2021
/Solutions/A8/A8_Q1.py
UTF-8
945
3.71875
4
[]
no_license
import numpy as np def func(x): return x**4 - 2*x + 1 def trapezoidal(domain,f): h = domain[1] - domain[0] return h*(2*np.sum(f) - f[0] - f[len(f)-1])/2 def euler_maclaurin(domain,f): h = domain[1] - domain[0] term_1 = trapezoidal(domain,f) dx = 1e-5 a = domain[0] b = domain[len(domai...
true
5e3759af3faa7fa2f9e1cb9aca1c88c359d698f0
Aasthaengg/IBMdataset
/Python_codes/p02685/s990225381.py
UTF-8
530
2.765625
3
[]
no_license
n,m,k = map(int,input().split()) mod = 998244353 ans = 0 def comb(n, r, mod): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fact[n] * factinv[r] * factinv[n-r] % mod fact = [1, 1] factinv = [1, 1] inv = [0, 1] for i in range(2, n+1): fact.append((fact[-1] * i) % mod) inv.app...
true
71e19b6ed4f4b2b2212363aefa8296b7c7d2a8bb
pchessah/learn-python-the-hardway
/ex43.py
UTF-8
3,383
3.40625
3
[]
no_license
class Scene(object): def enter(self): pass class Engine(object): def __init__(self, scene_map): pass player = input("Enter player name: ") def play(self): print("--------------------------------------------------------") print(f"The spaceship has been invaded,...
true
a578f44566f4f570b3fac9bdb7ebfabdbbad7e2a
raphaeldscorrea/GeneticAlgorithmVectorized
/tests/crossover_test.py
UTF-8
6,033
2.546875
3
[]
no_license
""" Tests related to Perm Crossover """ import os import pytest import numpy as np from src.heuristics.game.operators.perm.crossover import PermCrossover from tests.instance import Instance CROSSOVER_FILES = [f for f in os.listdir('tests/crossover_tests/crossover/inputs') if os.path.isfile(os.p...
true
1d7261d8a87878c15afe14da2046fe7e17ebd313
ArvindSinghRawat/SQL-Utilities
/app/test/test_config.py
UTF-8
1,947
2.6875
3
[ "MIT" ]
permissive
""" This module tests the Configurations """ import unittest from flask import current_app from flask_testing import TestCase from manage import app class TestDevelopmentConfig(TestCase): """This class is used for Testing Dev Config Args: TestCase (Class): Original Test Case Class """ def ...
true
105c9df4f030ff5c85194dff9314320645f73746
qiuhuadong2015/Uda_Projects
/DLND-1/P1/Task3.py
UTF-8
3,227
3.921875
4
[]
no_license
""" 下面的文件将会从csv文件中读取读取短信与电话记录, 你将在以后的课程中了解更多有关读取文件的知识。 """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ 任务3: (080)是班加罗尔的固定电话区号。 固定电话号码包含括号, 所以班加罗尔地区的电话号码的格式为(080)xxxxxxx。 第一...
true
36a333794c022b5bb6d8bc1f283e2f9d66822d10
YiSoJeong/Algorithm_Python
/SW/Basic/6247_반복9.py
UTF-8
76
3.5
4
[]
no_license
i = 4 while i: print('{}{}'.format(' '*(4-i), '*'*(i*2-1))) i -= 1
true
fd6809210d95bd1cc3f8a99b2973e62cc72e3ff2
amzoss/websci14
/parse_categories.py
UTF-8
2,762
2.890625
3
[]
no_license
#!/Users/az49/anaconda/bin/python import nltk import csv #from operator import itemgetter unigrams = nltk.defaultdict(list) #key is word, value is category bigrams = nltk.defaultdict(list) #key is bigram, value is category trigrams = nltk.defaultdict(list) #key is trigram, value is category #with open('some_categori...
true
c24e1f81c675ff4f68827fbc6a71a1a67e3c16aa
Feez/Algo-Challenges
/DynamicProgramming/MinStrEditDist.py
UTF-8
3,590
3.546875
4
[ "MIT" ]
permissive
from collections import deque def GetMinimumStringEditDistance(a : str, b : str): # Number of rows = len(a) + 1 # Number of columns = len(b) + 1 # - The (+ 1) is for the null/empty string matrix = [[0 for j in range(len(b) + 1)] for i in range(len(a) + 1)] steps = [[None for j in range(len(b) +...
true
cdf5e716feca1b9d1da68721d639ad182b559938
dm-alexi/acmp
/0201_0300/0291/0291.py
UTF-8
303
2.796875
3
[]
no_license
with open("input.txt", "r") as f, open("output.txt", "w") as q: n = int(f.readline()) t = [] for i in range(n + 1): s = f.readline().strip() t.append({x : s.count(x) for x in s}) q.write(str(sum((False not in (l in t[n] and x[l] <= t[n][l] for l in x)) for x in t[:n])))
true
e427aaf161c9aca40654afae39f51ec430dd5e1d
FFranKKK122/ROTG
/hw1/IterativeImprovement.py
UTF-8
2,154
2.796875
3
[]
no_license
from tool import Tool import copy import random import multiprocessing as mp class IterativeImprovement: def __init__(self): self.test_data_path = './PFSP_benchmark_data_set/tai50_20_1.txt' self.tool = Tool() self.max_span_time = 10000 self.span = self.tool.io(self.test_data_path) ...
true
1ebff84cc6363f8d3dbd82bbb6606625b6dee3a2
baambox5/algorithm
/190805/ex2.py
UTF-8
328
3.28125
3
[]
no_license
arr = [3, 6, -2, 7, -3, 1, -5, -1, 5, 4] N = len(arr) for subset in range(1 << N): sum_subset = 0 for i in range(N): if subset & (1 << i): sum_subset += arr[i] if sum_subset == 0: for i in range(N): if subset & (1 << i): print(arr[i], end=' ') ...
true
b61e9220eef8f63d7d312de887c7f5ff31c91620
HearyShen/SudaArchive
/7 AI and Knowledge/Exercises/ex1/ex1.py
UTF-8
2,667
3.796875
4
[]
no_license
# -*- coding: utf-8 -*- # ex1 产生式系统实验 # 1427405017 # 沈家赟 import copy class Deduct: def __init__(self, t_conditions, t_results): self.conditions = t_conditions self.results = t_results def deduct(self, facts): for con in self.conditions: # 匹配全部condition,产生式才能推导 con_matc...
true
e21997753c8a816184c84b50dc8ec8ac582f3d8f
DetectorPersonas/PeopleDectectionCountingSys
/Recursos/ModelosClasificacion/Entrenamiento/HoGSVM/trainingHOGSVM.py
UTF-8
15,586
2.953125
3
[]
no_license
import sys, glob, argparse import numpy as np import math, cv2 from scipy.stats import multivariate_normal import time from sklearn import svm from sklearn.ensemble import RandomForestClassifier from cyvlfeat.gmm.cygmm import cy_gmm from cyvlfeat.fisher.cyfisher import cy_fisher from sklearn.externals import joblib d...
true
f2457da3536cba94ab98fe54a31314425970d9b5
acidjackcat/codeCampPython
/Training scripts/Electro_cars.py
UTF-8
308
2.765625
3
[]
no_license
class Car(): """Простая модель автомобиля.""" def __init__(self, make, model, year): self.make = make self.model = model self.year = year self.odometer_reading = 0 def get_descriptive_name(self): long_name = str(self.year) + ' ' + self.make + ' ' + self.model return long_name.title()
true
23487fcb003ed2af877eea677d672fe30810e274
anjocordero/LOSER
/agents/strategies.py
UTF-8
671
2.96875
3
[ "MIT" ]
permissive
from enum import Enum ''' Possible strategies each bot can use The strategy will be given to an agent's on_step function by the agent_selector The agent_select will decide on a strategy through a Q table ''' class Strategies(Enum): # Offensive HEAVY_ATTACK = 0 MEDIUM_ATTACK = 1 LIGHT_ATTACK = 2 # ...
true