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
7b29655b12c325e827bd9b750516a484e3f1adeb
ivnxyz/practicas-programacion-inviertete
/José/propina.py
UTF-8
107
3.140625
3
[]
no_license
subtotal = 44.50 prop = 0.10 subt = 0 total = 0 subt = prop * subtotal total = subt + subtotal print(total)
true
65f36396d734d75ea7faff059ddec85ce4eab387
nielsrolf/rl-midi-agent
/musicrl/data.py
UTF-8
6,271
2.875
3
[]
no_license
""" Data generators for training and validation data """ import numpy as np from random import shuffle from musicrl.render import midi2mel from musicrl.midi2vec import PostProcessor, generate_random_sequence REAL = 1 GEN = 0 class RandomSeqGenerator: """ Take some real data and build a generator that can be...
true
f3b7d6b7ddde163cb653681db4e1d14375cf6dbb
ACE857/IOT
/esiot/IOT/IoT/servo.py
UTF-8
615
2.953125
3
[]
no_license
import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) p = GPIO.PWM(12, 50) # channel=12 frequency=50Hz p.start(2.5) # Initialization try: while True: p.ChangeDutyCycle(5) time.sleep(0.5) p.ChangeDutyCycle(7.5) time.sleep(0.5) p.ChangeDutyCycle(10) time.sleep(0...
true
60323fe13801aeb10609704c46ff81c4b3baf174
zhoulin97/channel_pruning_lasso
/data.py
UTF-8
2,044
2.53125
3
[]
no_license
from PIL import Image import os import glob import random import numpy as np import torch import torchvision.transforms as transforms class MyDataSet(object): """ Underlying dataset to support uniform api for different data loader. """ def __init__(self): pass def __len__(self): ...
true
3c76f0b54e76328af3641c139e9187c887e0c4c6
hiromichinomata/atcoder
/abc/abc191/d_circle_lattice_points/main.py
UTF-8
335
3.328125
3
[]
no_license
#!/bin/python3 import sys input = sys.stdin.readline from math import ceil, floor def main(): x, y, r = list(map(float, input().strip().split())) min_x = ceil(x-r) max_x = floor(x+r) result = 0 for i in range(min_x, max_x+1): h = (r**2-(x-i)**2)**0.5 result += floor(y+h) - ceil(y-h) + 1 print(r...
true
3c655e26530f134003a8df74ade8b331f01101cb
johnnychen94/jill.py
/jill/utils/interactive_utils.py
UTF-8
1,368
3.34375
3
[ "MIT" ]
permissive
import sys def query_yes_no(question, default="yes"): """Ask a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning a...
true
7e5fcd0c342c8ce17aab42afa76a6610bb02b3ed
myersw12/wimax_ldpc_lib
/python_ldpc/ldpc_decoder.py
UTF-8
4,877
2.75
3
[ "MIT" ]
permissive
import numpy as np class ldpc_decoder: """ LDPC Decoder Initialize with the desired alist See http://www.inference.org.uk/mackay/codes/alist.html for documentation on the .alist format alist -- string, name of alist file """ def __init__(self, alist): ...
true
fadf1e144536b39bd77d27f8097294e9306ececb
jsahlmann/prgsieve
/module_html.py
UTF-8
407
3.015625
3
[]
no_license
import sys # https://vidigest.com/2018/12/02/generating-an-html-table-from-file-data-using-python-3/ def write_ul(mylist): fileout = open("result.html", "w") result = "<h1>Search results</h1>\n" result += "<ol>\n" for row in mylist: result += " <li><a href = '{0}'>{0}</a></li>\n".format(row[...
true
6f7611cfcaa4b8ba4e75b1585e3d8ef6778b3759
GameMoon/top11-ericsson2017
/2feladat/main.py
UTF-8
1,560
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- from interface import CommunicationInterface from converter import OutputGenerator from test_env import TestEnvironment from env_helper_classes import * # kommunikál a szerverrel #interface = CommunicationInterface() # A szervertől érkező adatokat konvertálja, megjeleníti generator = OutputGen...
true
84a5dc94e8bfbdbd475f9d30ae00507b0c5b41fe
tolik0/Lab_3
/classroom.py
UTF-8
1,496
3.90625
4
[]
no_license
class Classroom: """ Class for classroom representation """ def __init__(self, number, capacity, equipment): """ (Classroom, str, int, list) -> NoneType Create new classroom """ self.number = number self.capacity = capacity self.equipment = equip...
true
b656decafb573c7069c6f5673d89fbd65067a236
BenBausch/Mapf-with-Blocking-Containers
/Environment/world.py
UTF-8
3,648
2.625
3
[]
no_license
import sys import Algorithms import World """ G = Graph(1, 9) G1 = Graph(3, 1) # for i in range(G.xdim): # for j in range(G.ydim): # node = G.nodes[j][i] # print(str(node) + " is " + str(node.occupied)) print("-----------------------------------------------------------------------") print(str(G)) pr...
true
05a1026089d81226ea502bcd9bc12d7844adc36b
sachinyadav31/intro-to-programming
/week-4/examples/disappearanceAtTheRedWizard.py
UTF-8
4,128
3.828125
4
[ "CC-BY-4.0" ]
permissive
import sys # Please tag us if used! # We'd love to see what you make: # @ScienceOxford def start(): print(name + " wakes up in a strange place.") print("On their left is a desk with a note on it, ahead they can see a door.") print("To read the note, type READ. To exit through the door, type LEAVE") w...
true
b42a05e3e6ffbe7be88d4fbdd32d8135ab87cea6
SimoneRebora/style_of_criticism
/Extend_lexicons.py
UTF-8
2,555
2.796875
3
[]
no_license
import os import gensim import urllib.request import os.path import pandas import numpy as np #%% First step: define the word embedding file # if not present, it is downloaded automatically (it might take a while, as it is a 2Gb file) filename = 'wiki.it.vec' download_link = "https://s3-us-west-1.amazonaws.com/fast...
true
736bb02edec17ccb530905a480b25274f88020ee
afedynitch/AstroPhoMes
/utils/scaling_models_from_data.py
UTF-8
2,307
2.953125
3
[ "MIT" ]
permissive
"""Functions for the mass scaling exponent based on data """ import numpy as np from scipy.interpolate import interp1d from os.path import join import sys sys.path.append('../') from config import * nsc = np.load(join(global_path, 'data/scaling_lines.npy')) e = np.linspace(.1, 800, 300) def sigm(x, shift=0., gap=1,...
true
6f08d7297a67f237fefce999dee128319211d200
andremenezees/CursoPython
/Aulas/2_Meio/Set_comprehension.py
UTF-8
468
4.15625
4
[]
no_license
""" Set comprehension listas = [1, 2, 3, 4, 5] set = {1, 2, 3, 4, 5} #Set é uma lista que não permite elementos repetidos e os valores no set são ordenados automaticamente. """ #Exemplos numeros = {num for num in range(1, 7)} print(numeros) #Exemplo 2 numeros = {x ** 2 for x in range(10)} print(numeros) #GERAN...
true
5a517eed6c924143bd1d24d4976d17b74914d654
k8godzilla/-Leetcode
/1-100/L243.py
UTF-8
1,365
3.46875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 28 16:15:48 2019 @author: sunyin """ ''' 给定一个单词列表和两个单词 word1 和 word2,返回列表中这两个单词之间的最短距离。 示例: 假设 words = ["practice", "makes", "perfect", "coding", "makes"] 输入: word1 = “coding”, word2 = “practice” 输出: 3 输入: word1 = "makes", word2 = "coding" 输出: 1 ...
true
6f173e12a827339d631954fbcc6178ead6d33387
wintersalmon/programming-challenges-archive
/src/uva/slash_maze/solution.py
UTF-8
5,813
3.34375
3
[]
no_license
from sys import stdin class Node(object): def __init__(self, number): self.number = number self.adjacent = set() def connect(self, node): if isinstance(node, Node): self.adjacent.add(node) else: raise NotImplementedError('invalid node type: {}'.format(t...
true
bf7156f241e8d7ff3bcdb76b98f817482871046e
iyohan/Python200ForBeginners
/146.py
UTF-8
268
2.84375
3
[]
no_license
from os.path import getsize file1 = './sources/stockcode.txt' file2 = './sources/img_sample.jpg' file_size1 = getsize(file1) file_size2 = getsize(file2) print(f'File Name: {file1}\t File Size: {file_size1} B') print(f'File Name: {file2}\t File Size: {file_size2} B')
true
ee2aac7152a93d78da3084e2f2883abd546b5bc6
weiszr/FigInterdisCapcity
/figure_main.py
UTF-8
4,527
2.9375
3
[ "MIT" ]
permissive
import matplotlib matplotlib.rcParams['text.usetex'] = True matplotlib.rcParams['text.latex.unicode'] = True import matplotlib.pyplot as plt import matplotlib.patches as patches from numpy import * from matplotlib.lines import Line2D from matplotlib.artist import Artist from matplotlib.mlab import dist_point_to_segment...
true
0b3d09966ff1254ff7ff4861e41252cef74c6be1
wesenu/6.036
/Project_2/6036_Project2/Problem 5/mlp.py
UTF-8
1,925
2.5625
3
[]
no_license
import numpy as np import h5py np.random.seed(12321) # for reproducibility from keras.models import Sequential, Model from keras.layers import Input from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.layers.convolutional import Conv2D from keras.layers.pooling import MaxPooling2D from keras...
true
596d2bd7e8f76c3cbc5cab8af3961bca186fcad8
hammi99/Unix-Directory-emulator
/v3/server.py
UTF-8
8,260
2.625
3
[]
no_license
import os import pickle import threading import socket as sc # initialization code def init(): global maxMetaDataSize, metaData, SSD, voids, pwd, metas, lock maxMetaDataSize = 2**10 # loading directory structure if os.path.exists('sample.data'): SSD = open('sample.data', 'rb+') ...
true
f6a32c3764a1496fce6e13653eb6d1357db0841d
suafeng/BaldmanBolder
/146_LRU.py
UTF-8
3,415
3.546875
4
[]
no_license
# Design and implement a data structure for Least Recently Used (LRU) cache. It # should support the following operations: get and put. # # get(key) - Get the value (will always be positive) of the key if the key # exists in the cache, otherwise return -1. # put(key, value) - Set or insert the value if the key is not a...
true
76a958e3bcd74acb7099e362e79381c540e565f4
MedhatSedhom/Laptopshop
/backend/sortByPriceSameVagunessScore/sort_by_price_same_vaguness_score.py
UTF-8
1,019
3.40625
3
[]
no_license
class SortByPrice: def calculateIndex_tillSameScore(self, liste): index = 0 for i in range(1, len(liste)): if liste[i]["vaguenessScore"] == liste[i - 1]["vaguenessScore"]: index += 1 else: break return index # ---------------------...
true
e627ee4ce4d48edf70fa8553830ef34b8741eed9
dinobobo/Leetcode
/19_remove_Nth_node_from_end.py
UTF-8
505
3.421875
3
[]
no_license
# Keep a slow pointer that tails the fast one by n class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: fast = head slow = head for _ in range(n): fast = fast.next if fast == None: return head.next while fast.next != None: ...
true
1d73d80f3678df691ab3f425b45cf7bac8c1c8cf
Mohdtalibakhtar/Python-codes
/main1.py
UTF-8
210
3.4375
3
[]
no_license
def add(a,b): return a+b def str(string): return f"Hello {string}" print("And the name is ", __name__) if __name__ == '__main__': print(str("Talib")) # c= add(4,6) # print("Addition is", c)
true
211619680f8d275cdd1d0fea2638949a0c701816
francisA88/The-StickMan
/helpers.py
UTF-8
148
3.296875
3
[ "MIT" ]
permissive
class List(list): def forEach(self, function): for i in range(len(self)): function(self[i]) if __name__ == '__main__': li = List([6,7,8,9])
true
ca87ef72c4f93450157e2f77c2bd4d703beae2f7
vinhyard/PY4E
/grosspay.py
UTF-8
394
3.71875
4
[]
no_license
hours = input('Enter Hours: ') rate = input('Enter Rate: ') float(1.5) try: if float(hours) > 40.0: rate1 = float(hours) - 40.0 rate4 = float(rate) * 1.5 rate2 = rate1 * rate4 rate3 = float(hours) * float(rate) + float(rate2) print(rate3) else: pay = float(hours) ...
true
2d1f1d4653d3a14b2f35d817f42e9b2bfef18f62
sachinruk/pymc3
/pymc3/tests/test_quadpotential.py
UTF-8
4,290
2.53125
3
[ "Apache-2.0", "AFL-2.1" ]
permissive
import numpy as np import scipy.sparse from pymc3.step_methods.hmc import quadpotential import pymc3 from pymc3.theanof import floatX import pytest import numpy.testing as npt def test_elemwise_posdef(): scaling = np.array([0, 2, 3]) with pytest.raises(quadpotential.PositiveDefiniteError): quadpotent...
true
3302cb5f19097e0f43cc829f6d981410a67486e4
joachimsiaw/Phosphodata_trial_python
/Phosphodata.py
UTF-8
1,028
3.375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ # ============================================================================= # Pseudocode # import libraries import pandas as pd import numpy as np # define file path and save path to a variable filepath = 'C:/Users/joach_000/OneDrive/...
true
eea33f9481f0426e859b0ad8ced13c4573c7d20e
rafaelri/coding-challenge-solutions
/python/single-digit-dates/single_digit_dates.py
UTF-8
659
3.453125
3
[]
no_license
from datetime import timedelta class SingleDigitDates(): def __init__(self, start): self.date = start while not self.valid(): self.date = self.date + timedelta(days=1) def valid(self): digits = set() digits.update([c for c in str(self.date.month)]) ...
true
0088e5ba705c20ba6861a6b463d1bf5681a4f5eb
Athaagra/Social_Network_Analysis
/BFS-snacs.py
UTF-8
3,538
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Dec 5 18:14:22 2017 @author: Kel3vra """ from collections import Counter import operator import csv import functools import collections import queue as que from operator import itemgetter from numpy.random import randint from random import choice from random...
true
22efcaee4fd0eda845c98a8d44882cd2d6221add
jefinpaul/codes_useful_forme
/datacamp.py
UTF-8
1,947
3.84375
4
[]
no_license
# Dictionary of dictionaries europe = { 'spain': { 'capital':'madrid', 'population':46.77 }, 'france': { 'capital':'paris', 'population':66.03 }, 'germany': { 'capital':'berlin', 'population':80.62 }, 'norway': { 'capital':'oslo', 'population':5.084 } } # Print out the capital of Fran...
true
d0c34a3185e2333a46fa0f7369266aa4e10b1685
tt6746690/misc_impl
/pe/models_cgan.py
UTF-8
18,748
2.703125
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm class ConditionalBatchNorm2d(nn.Module): """ https://github.com/pytorch/pytorch/issues/8985#issuecomment-405080775 """ def __init__(self, num_features, num_classes): super(ConditionalBa...
true
f5518e7aede769e514c49ba7dd1f67f50d2726fd
m-oot/PiMotionDetector
/ServoControl/ServoControl.py
UTF-8
958
2.9375
3
[]
no_license
import sys import termios import tty import os import RPi.GPIO as GPIO import time servoPIN = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(servoPIN, GPIO.OUT) currentDC = 6 right = 12.5 middle = 6 left = 2.5 def move(n): p.ChangeDutyCycle(n) def getch(): fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd...
true
356b8e4343f8fd335bc5fd34dd9c65c8eb73e06b
Dan-Burke-P/Server-Client-Prototype
/Server-Client-Prototype/ClientPrototype/main.py
UTF-8
1,663
3.140625
3
[]
no_license
import socket import struct import time from MessagePack import MessagePack, MsgType if __name__ == '__main__': # Global variables node_name = "Test_name" central_server_name = "NOT SET" # Attempt to establish connection to central server def connect_to_server(): # give global access to ...
true
80e4d33f3f4537e0a38b63f21cfd0d228ea8d5b0
mikietechie/random-python-scripts
/text_shapes.py
UTF-8
1,512
3.453125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Apr 10 10:41:19 2020 @author: MIKE Zinyoni """ def right_angled_triangle_triangle(n): ''' * ** *** **** ''' for i in range(n): print('*'*i) def rectangle(l,w): ''' ********** ********** ''' for i in range(w): ...
true
96baf77620e63deb398b03d1c0940692db00f853
Bracewind/SimpleURDF
/simpleurdf/urdf_parser/urdf_parser.py
UTF-8
884
2.59375
3
[]
no_license
# from .URDFRepresentation import URDFRepresentation # from .UrdfToUrdf2 import UrdfToUrdf2 from lxml import etree from simpleurdf.urdf2model import Model from .urdf2_to_urdf import Urdf2ToUrdf #import simpleurdf.urdfParser.urdf as urdf class UrdfParser: """class used to load, traverse, and create URDF files"...
true
455cb90c5eaf36dbe3a95c7b201165f80779574b
dhruvsharma1999/data-structures-algorithms
/basic-python-interview-Qs/palindrome.py
UTF-8
611
4.71875
5
[ "MIT" ]
permissive
""" given astring, write a function to determine if it is a palindrome""" import string #python STL, for removing punctuations from a string def is_palindrome(s): """ function to check if a string is palindrom or not Returns a boolean value """ s = s.lower() #convert the whole string into lowerca...
true
b9fac0edc051b030bddd509283a8922071dd53cf
nii-yamagishilab/self-attention-tacotron
/preprocess_ljspeech_wavenet.py
UTF-8
1,432
2.578125
3
[ "BSD-3-Clause" ]
permissive
# ============================================================================== # Copyright (c) 2018, Yamagishi Laboratory, National Institute of Informatics # Author: Yusuke Yasuda (yasuda@nii.ac.jp) # All rights reserved. # ============================================================================== """ Preprocess...
true
cdfa8aa6e23eb09b982099e117ba7665bae1e273
kiady66/Stone_Age
/Player.py
UTF-8
6,729
2.859375
3
[]
no_license
from __future__ import annotations import abc from typing import TYPE_CHECKING if TYPE_CHECKING: from Controller import Controller from abc import ABC from random import Random from typing import Dict, Set, List import Action from Building.Building import Building from Civilization.Civilization import Civilizat...
true
4c5d3899ed546825b2cfbcd4e7a7ad8800125a54
Rajkumar55/SMSService
/SMS/serializers.py
UTF-8
1,241
2.640625
3
[]
no_license
from rest_framework import serializers from .models import * class SMSSerializer(serializers.Serializer): from_number = serializers.CharField() to_number = serializers.CharField(required=True, allow_null=False, allow_blank=False) text = serializers.CharField(required=True, allow_null=False, allow_blank=Fa...
true
28c0304e7a18aeab4c508cb68e6bc63454114e0f
hamjihyeon/Programming-Python-
/VII. 파일 처리/read_text_file2.py
UTF-8
462
3.203125
3
[]
no_license
fi = open("history.ama", "r", encoding="utf-8") sum = 0 while True: data = fi.readline() if not data: break # print(data, end = "") # 한줄 안에서 이름 가격 ... 자르기 l = data.split() #화이트스페이스 \t, \n 뛰어쓰기 있는걸 다 지움 sum += int(l[1]) #음료의 가격 합계를 구한다. # 총금액 계산하고 출력하기 print("총금액 : " + str(sum)...
true
33cbdeffedd477079f7d5eb1076491c77d8f0f73
agnessgeorge/daily_commit
/daily_commit_20210423.py
UTF-8
269
3.625
4
[]
no_license
# 4.23 friday all_words = input("Type in: ") all_words_split = all_words.split(' ') single_words = [] for i in all_words_split: if i not in single_words: single_words.append(i) else: continue single_words.sort() print((' ').join(single_words))
true
07c5a7583ddfd7308470760fdecc247478b1a440
jessicaohy/algorithms
/Suffix Tree/suffixTree.py
UTF-8
9,445
3.40625
3
[]
no_license
# Jessica Oh Hui Yu class Node: leafEnd = -1 # applies to all nodes def __init__(self, startIndex, endIndex, checkLeaf): """ This function initialises the variables. :param startIndex: :param endIndex: :param checkLeaf: ...
true
380992295bb58e3d42002afc92d5f909570f5e07
markuspf/GoldHammer
/cayley_graph_utils.py
UTF-8
834
2.9375
3
[]
no_license
import json import networkx as nx def load_group_elements(filename): with open(filename, 'r') as f: j = json.load(f) for i in range(len(j)): j[i] = j[i].strip().replace(' ', '*') # print('len(j)', len(j)) return j def load_group_edges(filename): with open(filename, 'r') as f: ...
true
964812a9b1ba3cb8f9d94908b69e5f0ac041d1ce
Aasthaengg/IBMdataset
/Python_codes/p02257/s079302678.py
UTF-8
361
3.109375
3
[]
no_license
import sys import math count = 0 judge = 0 for line in sys.stdin.readlines(): num = int(line.strip()) if judge == 0: judge = 1 else: flag = 0 for i in range(2, int(math.sqrt(num)) + 1): if num % i == 0: flag = 1 break if flag ...
true
5948e6ec90f6b53bef17bec9a3bcd3a64e55961f
sidgan/repodoctor
/server/checker/github.py
UTF-8
1,922
2.578125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from urllib.request import urlopen import requests class RepoScanner: def __init__(self, owner, repo): self.owner = owner self.repo = repo self.contents = None def get_contents(self): # FIXME: find a better way to handle getting c...
true
7cc6993ccc3c17fa6c03356d0c50c6b8ea4baf38
FRC2539/scouting
/csvoutput.py
UTF-8
3,605
2.6875
3
[]
no_license
import csv import v3client from team import Team from v3client.api.event_api import EventApi from v3client.api.match_api import MatchApi with open('csvfile.csv', 'w', newline='') as csvfile: writer = csv.writer(csvfile, delimiter=' ') event_key = '2019pahat' eventApi = EventApi() matchApi = MatchApi(...
true
418895ce1abb3b5ef08abeedaab702dc46d19a04
TomRiddelsdell/AutomatedInvestments
/universe_reduction.py
UTF-8
2,381
2.8125
3
[]
no_license
import pandas as pd import scipy.cluster.hierarchy as sch from optimize_fns import correl_distance import itertools from operator import itemgetter import datetime as dt class UniverseReduction(object): def __init__(self, fixings, asset_info): # cluster the assets into groups from which we can choose the...
true
48fc39ea11129190b8dc3cf6362c2a64244094db
vvkio/datasets
/tensorflow_datasets/scripts/generate_visualization.py
UTF-8
1,628
2.984375
3
[ "Apache-2.0" ]
permissive
""" Script for generating dataset example figures Uses show_examples() to generate example figures of a dataset and stores it temporary in examples/ Typical usage example: ds_name = 'beans' generate_visualization(ds_name) """ import os from PIL import Image from absl import app import matplotlib.pyplot import ...
true
3dee49e33b10bd2683a9effc89e12190a5f2b2a6
Moongomi/mynotebook
/sound.py
UTF-8
2,097
3.140625
3
[]
no_license
''' EBS 수학으로 배우는 인공지능을 보면서 추가한 코드가 있습니다. mp3 to wav는 오류가 존재해서 주석처리 항상 소리가 나는게 불편해서 start 버튼을 눌러야만 소리가 재생되도록 수정했습니다. ''' # 소리 데이터에 필요한 외부 모듈 설정하기 # 소리 파일을 다루기 위한 모듈 import numpy as np # 행렬 및 벡터 데이터 관리를 위한 numpy 모듈 import matplotlib.pyplot as plt # 음성 데이터의 그래프 ...
true
19bcb37e93b2694f35550c9bcb9976db4ac9ae6b
M2LabOrg/WRF_little_r
/time_series_converter.py
UTF-8
1,519
3.421875
3
[ "Apache-2.0" ]
permissive
''' Functions for converting a time series to a little_r file. File source: https://github.com/tommz9/python-little_r Adapted here by: Michel Mesquita, Ph.D. (July 2021) ''' from record import Record def time_series_to_little_r(timestamps, data, station_id, lat, lon, height, variable, obs_filename, ...
true
ba5e3aa6795992f632596fbb4303a0ef02c34e4e
Terron23/IS211_Assignment11
/todoapp.py
UTF-8
2,606
2.84375
3
[]
no_license
from flask import Flask from flask import render_template from flask import redirect from flask import url_for from flask import request import re import sys import sqlite3 app = Flask(__name__, template_folder='templates') con = sqlite3.connect('todo.db', check_same_thread=False) cur = con.cursor() create_table = "CR...
true
5b04937438fbc8ed85eaf4130e729c960ca2c224
Javakin/5-semester
/leo/sandkasse/pub1.py
UTF-8
494
2.6875
3
[]
no_license
#!/usr/bin/python import zmq import random import sys import time # setup port port = "5556" if len(sys.argv) > 1: port = sys.argv[1] int(port) # setup port context = zmq.Context() socket = context.socket(zmq.PUB) socket.bind("tcp://*:%s" % port) mouse = open('/dev/input/mice', 'rb') data, dx, dy = mouse....
true
ffafcc17df5f8ce8ac042bda4344bc9cba81b8de
TogrulAga/Linear-Equations-Solver
/Topics/Decorators in OOP/Time/main.py
UTF-8
196
3.390625
3
[]
no_license
class Time: def __init__(self, hour, minute): self.hour = hour self.minute = minute @classmethod def from_string(cls, string): return cls(*string.split(':'))
true
3bcd54e053f0de7a53667c2fcffb3cc581eea475
statco19/doit_pyalgo
/ch1/triangle_lb.py
UTF-8
199
3.84375
4
[]
no_license
n = int(input("type an integer: ")) """ for i in range(1,n+1): for j in range(i,i+1): print('*'*j) """ for i in range(n): for j in range(i+1): print('*', end='') print()
true
5b2684f298d3c7527b901e4e3c91b2856814f184
AdamZhouSE/pythonHomework
/Code/CodeRecords/2879/39160/307867.py
UTF-8
175
2.9375
3
[]
no_license
n=int(input()) a=[0]*(n+1) b=[0]*(n+1) ans=[] for i in range(1,n*n+1): x,y=map(int,input().split()) if a[x]+b[y]==0: ans+=[str(i)]; a[x]=1; b[y]=1 print(' '.join(ans))
true
80c1fd2dac11bc03079fa9acbf85750dd34b9792
hornikcoding/theme-coding
/twitter/theme_clf.py
UTF-8
2,489
3.53125
4
[ "MIT" ]
permissive
import re import os ### this file defines some functions and a class used to classify tweets as ### relevant to themes 'addiction', 'health', 'policy', and 'youth'. ### ### lists of inclusionary, exclusionary, etc. terms are loaded when the ### `ThemeClf()` class is instantiated with a theme. ### ### ...
true
4847d8c789448dd240829af7094106abdf605ccf
Mohish-Nemade/FoodMLSpecs
/FoodMLSpecs1/Tensorflow.py
UTF-8
2,201
2.65625
3
[]
no_license
import subprocess import os,shutil import io def image_into_tensorflow(directory): p = subprocess.Popen( r'python $HOME/tensorflow/tensorflow/examples/label_image/label_image.py --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt --input_layer=Mul --output_layer=final_result --input_mean=128 --input_...
true
3639fefb1280702ddf8744b8c40b3fe17fa8cfd4
RomanPutsilouski/M-PT1-37-21
/Tasks/Titov_Tasks/Task1/task_1.py
UTF-8
492
3.75
4
[]
no_license
""" Формула сложных процентов Депозит: начальная сумма - 20000 BYN срок - 5 лет процент - 15% ежемесячная капитализация Вычислить сумму на счету в конце указанного срока. """ money = 20000 percent = 15 years = 5 money_result = money * (1 + percent / 100 / 12) ** (12 * years) print("Amount on the account after", ye...
true
0762be64303ffbee358f2fbdb07aee85b1986b23
adam-stogsdill/MedEI
/Gene_Engine/codon_tree_node.py
UTF-8
2,988
3.734375
4
[]
no_license
class Node(object): def __init__(self, value: str, nodes=None, leaf_value=""): if nodes is None: nodes = [] self.value = value self.nodes = nodes self.leaf_value = leaf_value def append_node(self, node): self.nodes.append(node) def get_node_and_existe...
true
0f6d5a0b30abb93e46d6222a0d6d0832fce00f22
tommccallum/smartbot
/client/src/FifoFile.py
UTF-8
1,694
3.40625
3
[ "MIT" ]
permissive
import logging import os class FifoFile: """ Fifo object that handles directory and file creation """ instance_counter = 1 """Makes any fifo name unique""" def __init__(self, fifo_path=None, filename_prefix = "smartbot"): self.fifo_filename = "{}_{}.{}".format(filename_prefix, str(Fi...
true
93689f5969809355acbf408e75ab21cc79a00ef9
Aasthaengg/IBMdataset
/Python_codes/p03795/s312437861.py
UTF-8
155
3.34375
3
[]
no_license
N = int(input()) bonus = 0 pay = 0 for i in range(1,N+1): if i % 15 == 0: bonus += 200 pay += 800 sum = pay - bonus print(sum)
true
3c0cc80c6f37aa138a764724befbbd861248c324
Gincoeng/BIT_MOOC_Spider_notes
/r_get.py
UTF-8
117
2.671875
3
[]
no_license
import requests r = requests.get('http://www.baidu.com') print(r.status_code) r.encoding = 'utf-g' print(r.text)
true
3df385534323fa72474ab978ceafc5d9b86bbc22
Murugo/RDR-Proto-Tools
/Python/tex2png.py
UTF-8
3,494
3.15625
3
[ "MIT" ]
permissive
"""Converts a .TEX image to .PNG. Some image types may be unsupported. Example usage: python tex2png.py path/to/image.tex Optionally, you can provide the output path for the .PNG file: python tex2png.py path/to/image.text path/to/output.png """ import os import png import struct import sys def err(ms...
true
5e074a6119ff6698f166e4f88623fb2c2eef8d5d
squigglepuff/firebytes
/sec_utils/SecSSL.py
UTF-8
15,858
2.734375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # *-* coding: utf-8 *-* import sys import re import socket import ssl from datetime import datetime as dt import cryptography.x509 import cryptography.hazmat.backends.openssl if sys.version_info[0] < 3: from logger import PrintLog else: from sec_utils.logger import PrintLog ''' \brief T...
true
f9f85a1e07543ee48b09f9c446f8a6a49f82a3ae
nickjj/flask-secrets
/flask_secrets/cli.py
UTF-8
985
2.84375
3
[ "MIT" ]
permissive
import click from secrets import choice from string import ascii_letters, digits TOKEN_CHARSET = ascii_letters + digits TOKEN_LENGTH = 99 TOKEN_COUNT = 10 PREFIXES = ['dev_', 'test_', 'prod_'] @click.command() @click.option('--length', default=TOKEN_LENGTH, show_default=True, help='Character length.'...
true
5f09b080740902df949388ada24f03082969506a
troberts777/C750-Data-Wrangling
/count.py
UTF-8
1,496
3.03125
3
[]
no_license
import xml.etree.cElementTree as ET import pprint import re from collections import defaultdict # Create Sample File OSM_FILE = "map_PHX_Metro.osm" # Iterative Parsing # Count Tags def count_tags(filename): tags = {} for _, elem in ET.iterparse(filename): tag = elem.tag if tag not in t...
true
1ca349695951cf2ad23a895ae8e8ffc603927240
ujuc/exercises-in-programming-style
/ch8/08-29.py
UTF-8
2,042
3.203125
3
[]
no_license
#!/usr/bin/env python2 # coding: utf-8 # 데이터 공간 # 제약조건 # 1. 동시에 실행되는 단위가 하나 이상 존재한다. # 2. 여러 병행 단위에서 데이터를 저장하고 가져오는 데이터 공간(data space)이 # 하나 이상 존재한다. # 3. 여러 병행 단위는 데이터 공간을 통하지 않고 다른 ㅂ아법으로 데이터를 직접 # 교환하지 못한다. import re import sys import operator import Queue import threading # 두 개의 데이터 공간 word_space = Queue.Qu...
true
fb832875da66cc4f7547ec47d572a9c7dc011218
bridder/factory
/py/test/pytests/modem_security.py
UTF-8
2,096
2.515625
3
[ "BSD-3-Clause" ]
permissive
# Copyright 2019 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Verify and close modem access authority. Description ----------- This test verifies the modem access level. If the access level is not 0, this test wi...
true
4647c0e58b246039d4b05bc4e431be40654999dd
CRThu/KeyMouseStatistics
/DataStorage.py
UTF-8
7,625
2.75
3
[ "Apache-2.0" ]
permissive
import collections import SQLite_oper class DataStorage(object): def __init__(self, sqlite_path='kmstat.db'): self.sqlite_path = sqlite_path self.sql = None def open(self): self.sql = SQLite_oper.SQLite_oper(self.sqlite_path) self.sql.open() if self.sql.is_newdb: ...
true
84110a2ff0166d46a36c1b30df0bdd5fc13294d7
zymITsky/twittomatic
/helpers/hadoop/wikipedia/lighttag/utils.py
UTF-8
953
2.640625
3
[]
no_license
import gzip import json import datetime from contextlib import contextmanager @contextmanager def profiled(str): start = datetime.datetime.now() yield start diff = datetime.datetime.now() - start print(str % diff) def iterate_anchors(anchorfile): with gzip.open(anchorfile, 'r') as inputfile: ...
true
e633366be252cff41b8ac1d4fdc16dd6cdbfb806
2434325680/Learnbgame
/All_In_One/addons/compute_nodes/math_node.py
UTF-8
2,148
2.625
3
[]
no_license
import bpy from bpy.props import * from llvmlite import ir from . compute_node import ComputeNode operation_items = [ ("ADD", "Add", "", "NONE", 0), ("SUBTRACT", "Subtract", "", "NONE", 1), ("MULTIPLY", "Multiply", "", "NONE", 2), ("DIVIDE", "Divide", "", "NONE", 3), ("SIN", "Sin", "", "NONE", 4) ]...
true
70c157c4420922ef5277f6b02eaaebe5c77a04c2
gkouretas/evision-scraper
/selenium_setup.py
UTF-8
1,155
2.546875
3
[]
no_license
import os import time from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import Select def chromeSetUp(): chromeOptions = Options() if bool(os.environ.get("GOOGLE_CHROME_BIN")): chromeOptions.binary_location = os.environ.get("GOOGLE_CHROME_BI...
true
6f58423f90a3fbc77ed043863f21b7c3be7a0a0c
hyuan27/loan_wolves
/hw.py
UTF-8
4,198
2.953125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from scipy import interpolate class HullWhiteModel: def __init__(self): self.corr = 0.1 self.a_cmt = 0.1 self.a_ted = 1.8 self.time = np.arange(1,11) self.term_cmt = interpolate.interp1d(np.arange(1,11), self.spot_curve([0.0...
true
7ef7afa8f7a6778a1b30e1f419f0044bda3da8f0
k8godzilla/-Leetcode
/1-100/L019.py
UTF-8
869
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jul 4 17:05:34 2019 @author: admin """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: cache_li...
true
2d64bbadfacf71dd69790f27eab905e3c6784b56
ATarsky23/Year9DesignPythonAT
/Excersise 1- Console Work/ConVolCylStep2.py
UTF-8
844
4.625
5
[]
no_license
import math #Input #What inputs are needed to calculate the volume of a cylinder? print("\n\tThe volume of a Cylinder is:") print("\n\t\t\tV = \u03C0\u00d7radius\u00b2\u00d7height") print("\n\tThis program will take as input the radius and height") print("\tand print the volume.") name = input("What is your name: ...
true
ffbcf50d2fc1f5c1c4398016cfcdc556cf7aa152
jeremysherriff/HTPC-Manager
/libs/sqlobject/tests/test_basic.py
UTF-8
9,472
2.765625
3
[ "MIT" ]
permissive
from sqlobject import * from sqlobject.tests.dbtest import * class TestSO1(SQLObject): name = StringCol(length=50, dbName='name_col') name.title = 'Your Name' name.foobar = 1 passwd = StringCol(length=10) class sqlmeta: cacheValues = False def _set_passwd(self, passwd): self....
true
a170f3147c466128fc03b74428774621bd3e1c25
tinachai/products
/products.py
UTF-8
1,684
4.3125
4
[]
no_license
#檢查檔案在不在電腦裡 import os #operating system 透過載入模組(os)來進行isfile功能,檢查檔案在不在 def read_file(filename): #()內寫成參數 加參數 products = [] with open(filename, 'r') as f: #開始讀取檔案 for line in f: if 'name,price' in line: continue name, price = line.strip().split(',') #先把換行的符號去掉(str...
true
46ab73e01478b6114a1e0adb1ce025ddb1205761
Vasudeva1997/UrvashiVasudeva
/PycharmProjects/GUI/CreatingDropDownMenu.py
UTF-8
1,185
2.703125
3
[]
no_license
from tkinter import * # *********Menu************* def doNothing(): print("ok ok I wont.......") root=Tk() menu= Menu(root) root.config(menu=menu) subMenu =Menu(menu) menu.add_cascade(label="file",menu=subMenu) subMenu.add_command(label="Now Project.....",command=doNothing) subMenu.add_command(label=...
true
b146011e876b7c718ed9aca661d34cfe69d9a13c
MetaNovitia/code
/HackerRank/solutions/time-conversion/code/1-Pass.py
UTF-8
91
3.0625
3
[]
no_license
a=input() h=int(a[:2]) if h==12: h-=12 if a[8]=="P": h+=12 print(f"{h:02d}"+a[2:8],end="")
true
a235c95f56fd626dc926d703ab2570fbbc2f69b5
HsuBokai/stockAnalysis
/backtest.py
UTF-8
2,612
2.546875
3
[]
no_license
#coding=utf-8 from functools import partial import numpy as np STOCKS = { \ '2801' : '彰銀', \ '2809' : '京城銀', \ '2812' : '台中銀', \ '2834' : '台企銀', \ '2836' : '高雄銀', \ '2845' : '遠東銀', \ '2849' : '安泰銀', \ '2880' : '華南金', \ #'2883' : '開發金', \ '2884' : '玉山金', \ '2885' : '元大金', \ '2886' : '兆豐金', \ '2888' : '新光金...
true
9f095bf03e6400afda5abeb96d0e25b750def4ee
pasqualespica/my-realpyhton-tutorial
/Logging/_04_own_logger.py
UTF-8
1,142
3.484375
3
[]
no_license
import logging """ The most commonly used classes defined in the logging module are the following: Logger: This is the class whose objects will be used in the application code directly to call the functions. LogRecord: Loggers automatically create LogRecord objects that have all the information related to ...
true
9aa90010a95263d2c083ca4b1c682a62d30b3cb7
yeochinyi/codetest
/exercism/python/bob/bob.py
UTF-8
661
3.03125
3
[]
no_license
import re def response(hey_bob): hey_bob = hey_bob.strip() if len(hey_bob) == 0: return "Fine. Be that way!" is_query = re.match(r'.*\?\s*$', hey_bob) != None # is_caps = re.match(r'^[A-Z\d\,]+[A-Z\s\'\,]+[\!\?]?$', hey_bob) != None is_caps = re.match(r'^[A-Z\d\s\'\,]+[A-Z][A-Z\d\s\?\!\%\^\*...
true
2514535e9bed69d90bab09ef820d402e2f4b030b
sunny-sunwoo/django-calculator
/calculator/views.py
UTF-8
3,527
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.http import HttpResponse def calculator(request): # Creates a context dictionary (map) to send data to the templated HTML file context = {} # Retrieve the 'name' parameter, if present, and add...
true
0a6eee16805de8c3cc2f87ee6a6ec88bbecf9f9c
diegovivas/Hospital_API_Rest
/modelos/hospital.py
UTF-8
1,820
2.59375
3
[]
no_license
#!/usr/bin/python3 """ clase Hospital hereda de BaseModel """ import modelos from modelos.base_model import BaseModel, Base from sqlalchemy import Column, String, ForeignKey, Table, Boolean from sqlalchemy.orm import Session, relationship from sqlalchemy.ext.declarative import declarative_base import sqlalchemy as db ...
true
e3d01b107c2fe4527937f7247c7987250cb46730
BoPeng/simuPOP-examples
/wiley_book/ch7_assortativeMating.py
UTF-8
1,941
2.703125
3
[]
no_license
import simuPOP as sim from random import normalvariate sigma = 1 def traits(geno): 'genotypes are arranged as a1a2b1b2c1c2... where a,b,c are specified loci' A = sum(geno[:20]) + normalvariate(0, 2.5) B = sum(geno[20:40]) + normalvariate(0, 2.5) I = sum(geno[40:60]) + normalvariate(0, 2.5) D...
true
a7692c87560dca7a3d0b41e0645b8cc1990f90d2
LPirch/tagvet
/src/extract/features.py
UTF-8
6,548
2.609375
3
[ "MIT" ]
permissive
import argparse import os import io import pickle from zipfile import ZipFile import xml.etree.ElementTree as ET from tqdm import tqdm from sklearn.feature_extraction.text import TfidfVectorizer def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('data_zip', help='zip file with glog data...
true
d62e1c570adc4ed0217a1b576028b37403a9e4c5
JesperDramsch/advent-of-code
/2019/tests/test_day1.py
UTF-8
901
3.15625
3
[ "MIT" ]
permissive
# Test Working solutions to Build a nice Day Class import sys import pytest sys.path.insert(0, ".") from util import Day from day01 import * def test_part1(): part1 = Day(1, 1) part1.load(typing=int) assert sum(part1.apply(fuel)) == 3279287 @pytest.mark.parametrize("data,result", [(12, 2), (14, 2), (19...
true
73cf11c0b10ca43feef11f47849aa01936391d49
ArlenPP/Machin_Learning_Fin
/9/roi.py
UTF-8
2,711
2.671875
3
[]
no_license
import os import csv import math #test_result = open('./test-result','r') test_result = open('../../../output/9/test-result','r') test = open('./test.csv','r') labels= [] open = [] close = [] for row in csv.DictReader(test_result, delimiter=' '): labels.append(float(row['labels'])) for row in csv.DictReader(test): ...
true
41c32aa7fcaa9e5c92535fd0a508f583c1905bde
ebellocchia/bip_utils
/examples/bip44.py
UTF-8
1,324
3.171875
3
[ "MIT" ]
permissive
"""Example of keys derivation using BIP44.""" from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44, Bip44Changes, Bip44Coins ADDR_NUM: int = 5 # Generate random mnemonic mnemonic = Bip39MnemonicGenerator().FromWordsNumber(Bip39WordsNum.WORDS_NUM_24) print(f"Mnemonic string: {mnemon...
true
894ce4734b524c91622e39057e1557e346762844
StevenJW/some-cscircles-solutions
/chap8/centering-text.py
UTF-8
1,078
4.40625
4
[]
no_license
''' For this program, the first line of input is an integer width. Then, there are some lines of text; the line "END" indicates the end of the text. For each line of text, you need to print out a centered version of it, by adding periods .. to the left and right, so that the total length of each line of text is width...
true
574d43d23738f0e3c6ee7f2b821c09ddb25d552e
Krishnaarunangsu/LoggingDemonstration
/ai/simple_linear_regression-1.py
UTF-8
853
3.71875
4
[]
no_license
import numpy as np from sklearn.linear_model import LinearRegression # regressor x = np.array([5, 15, 25, 35, 45, 55]) print(f'The array is:{x}') x_transformed = x.reshape(-1, 1) # print(f'The array is:{x_transformed}') x = x_transformed print(f'The Regressor is:\n{x}') # predictor/regressand y = np.array([5, 20,...
true
9966872ff0584545d07247bece0ee1738200501d
karthik1997/nlp
/bleu.py
UTF-8
357
2.890625
3
[]
no_license
import nltk l1,l2=0,0 c1,c2=0,0 with open ("Hindi") as f2: for line in f2: c2=c2+1 str2=line.split(' ') print str2 hypothesis = ['It', 'is', 'a', 'cat', 'at', 'room'] reference = ['It', 'is', 'a', 'cat', 'inside', 'the', 'room'] #there may be several references BLEUscore = nltk.translate.bleu_score.sentence_ble...
true
8fae154c8a6bb64dea62e0a51febb292b85a0209
Harrisonsam932/Python
/Previous Courses/Crash Course/Assignments/5studentmarks.py
UTF-8
1,089
3.34375
3
[]
no_license
num = [] name = [] m1 = [] m2 = [] m3 = [] start = 0 end = 5 # while start < end: num.append(input("What is your student number? ")) name.append(input("What is your name? ")) m1.append(int(input("What is mark 1? "))) m2.append(int(input("What is mark 2? "))) m3.append(int(input("What is mark 3? ")...
true
183b6e3b5487fe5f8d35ecdb4e69a5cc95ee5732
HyeonJun97/Python_study
/2018_Final/Problem_1.py
UTF-8
1,370
3.65625
4
[]
no_license
import math def indexOfSmallestElement(x): idx=0 nmin=10 for i in range(len(x)): if nmin>x[i]: nmin=x[i] idx=i return idx, nmin def mean(x): sum=0 for i in range(len(x)): sum+=x[i] return sum/(len(x)) def deviation(x): m=...
true
ea0057f03cdc90f93ee79b470e25e05ac174db4f
yamendrasinganjude/200244525045_ybs
/day9/MobileNumValidOrNot.py
UTF-8
298
3.84375
4
[]
no_license
''' 2. Write python program to check that given number is valid mobile number or not? ''' import re mob = input("Enter Mobile Number : ") matched = re.fullmatch("[7-9]\d{9}", mob) if matched != None: print(mob, "is Valid Mobile number ..") else: print(mob, "is not Valid Mobile number ..")
true
ffd717c6e383ed76d1b6b0926277a6bb4d93e115
fedebrasburg/Teoria_Algoritmos
/TP3/src/creador_grafos.py
UTF-8
2,350
3.671875
4
[]
no_license
from random import randint from grafo import Grafo # Crea un grafo de n vertices y 2*n aristas, junto con el archivo correspondiente # Importante: No correr el algoritmo para n <= 4, ya que para esos n, 2*n > n*(n-1)/2 # (Aristas en grafo completo), por lo que no existe grafo posible con n vertices y 2*n aristas def ...
true
412ed9ea6b368870558bd7e26adad7f824ac1023
joseant12/CellSegmentationProject
/kerasSegmentation/KeraQA.py
UTF-8
861
2.71875
3
[]
no_license
''' Created on 23 ago. 2018 @author: ganso ''' import unittest from modelo import* #Modulo de pruebas unitarias class TestKeras(unittest.TestCase): def test_carga_modelo(self): modelo_test=cargar_modelo("best_female_model.h5") self.assertNotEqual(modelo_test,None ,...
true
063ad96d83f8552afc1be61a584dac537f53d87b
finsqm/four_in_a_row
/game.py
UTF-8
1,235
2.890625
3
[ "MIT" ]
permissive
import numpy as np from easyAI import TwoPlayersGame class FourInARowGame(TwoPlayersGame): """ """ # --------------------------------------------- # Easy AI Methods # --------------------------------------------- def __init__(self, board): if len(players) == 2: self.playe...
true