blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
1e0dc0133d5f1fb7574e876c88d4dc4ce0ff6bff
Python
dev-amit-kumar/interview-data
/question/Indycium/question4ab.py
UTF-8
1,473
3.828125
4
[]
no_license
def print_pattern(n): if(n < 4): for i in range(n): print('*') return count = 3 while(count <= n): if((count+2) % 8 == 0): print(' ', end="") count += 5 else: print('*', end="") count += 1 print() count = 2 ...
true
7a392b6344830f320180b4aaf6de4c4fe32529e9
Python
Dammi87/unet_weight
/unet/label/convert.py
UTF-8
2,550
3.390625
3
[]
no_license
"""Convert image to a weight image and save in folder. The saved weight image will be normalized with a factor w0 + 1 This means, that a white pixel of value 255 is in reality a weight of w0 + 1. So, if the converted image is to be converted to the orginal weight value again, the following formula applies: weight...
true
e0b3fc535103bd36bce93ba281ac194a4f2d7c54
Python
sayands/opencv-implementations
/Image-Search-Engine/imagesearchutil/rgbhistogram.py
UTF-8
485
3.046875
3
[]
no_license
# import the necessary packages import imutils import cv2 class RGBHistogram: def __init__(self, bins): # store the no.of bins the histogram will use self.bins = bins def describe(self, image): # compute a 3D histogram in the RGB colorspace # then normalise the image hi...
true
758976e6db73afd9960cd106dc68733d86c44a1a
Python
silnrsi/libreoffice-linguistic-tools
/LinguisticTools/pythonpath/lingt/app/data/wordlist_structs.py
UTF-8
9,394
2.90625
3
[]
no_license
# -*- coding: Latin-1 -*- """ Data structures used by other parts of the application. To avoid cyclic imports, these are not defined in the WordList module. This module exports: WordInList ColumnOrder WhatToGrab """ import collections import logging import os import re from grantjenks.tribool import Tribo...
true
acb3ea73d9a25a147f08221f4ff16952be4338d3
Python
pskrillz/python_backend_demos
/demo2_flask_hello_name.py
UTF-8
1,334
3.109375
3
[]
no_license
from flask import Flask from flask_sqlalchemy import SQLAlchemy import os from dotenv import load_dotenv # creating a simple flask application that uses data from the db app = Flask(__name__) #env variable doesnt like to work with python interactive terminal app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('CON...
true
72c2ab0f7db5b575fd4c3d6ae064254597a8c864
Python
losskatsu/codility
/binary-gap.py
UTF-8
705
3.203125
3
[]
no_license
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(N): # write your code in Python 3.6 currentN = N binN = "" while(True): if(currentN==1): binN = binN + "1" break else: tmp_remain = str(currentN%2) ...
true
dea842e3c48a115a5f0d8266171fb6d2be966964
Python
adairxie/python
/mytimer2.py
UTF-8
897
2.984375
3
[]
no_license
#File mytimer.py """ timer(spam,1,2,a=3,b=4,_reps=1000) Calls and times spam(1,2,a=3) _reps times, and returns total time for all runs,with final results. best(spam,1,2,a=3,b=4,_reps=50) runs best-of-N timer to filter out any system load variation, and returns best time among _reps tests """ import sys,time if sys.p...
true
2c192275ca23c8106e0adf7d97753cb7924da006
Python
linth/learn-python
/decorator/decorator-basic-1.py
UTF-8
1,168
3.96875
4
[]
no_license
''' Reference: - https://foofish.net/python-decorator.html ''' import logging logger = logging.getLogger() logger.setLevel(logging.DEBUG) ''' [Example 1] This is decorator without parameters. ''' def use_logging(func): def wrapper(): logging.debug('{} is running'.format(func.__name__)) return ...
true
e15db3317d2682dbf65d48eb988e844d91c311e8
Python
savva-kotov/python-intro-practise
/2-2-3.py
UTF-8
275
3.390625
3
[]
no_license
''' Посчитайте сумму первых k нечетных чисел. Число k подается на вход программы. Sample Input: 2 Sample Output: 4 ''' a = int(input()) res = 0 nez = 1 for i in range(a): res += nez nez += 2 print(res)
true
79e64baf5df5c0a6404aace9e85ab7f3c6aab8b2
Python
walkccc/LeetCode
/solutions/2525. Categorize Box According to Criteria/2525.py
UTF-8
389
3.15625
3
[ "MIT" ]
permissive
class Solution: def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str: isBulky = length >= 10000 or width >= 10000 or height >= 10000 or length * \ width * height >= 1_000_000_000 isHeavy = mass >= 100 if isBulky and isHeavy: return 'Both' if isBulky: retu...
true
b006dcae3ccf814e214b80783fff2fa9b1acab8a
Python
bang-a-coder/search-engine
/indexing.py
UTF-8
1,164
2.75
3
[]
no_license
from collections import defaultdict import preprocessors from preprocessors import normalizer,tokenizer import queers from queers import and_query, or_query from indexers.biworder import biworder from pos_indexer import pos_indexer docs = { 1: 'new home sales top forecasts new', 2: 'home sales rise in july', 3: 'in...
true
22250058d83d6f8cbf4993774f43637f80c54024
Python
jaylenjohnson/Python
/HW1/Hw.py
UTF-8
1,234
4.15625
4
[]
no_license
print ("Welcome to the guessing game\n") guess=0 min=1 max=100 mid= (min + max) // 2 name = raw_input("Hi, what is your Name? ") print("Hello " + name + "," + " Lets Play a Game!") print("Think of random number from 1 to 100, and I'll try to guess it!\n") userinput="no" while userinput !="yes": randomanswer= mid ...
true
7ef35055560811628ecc8deba913a0bd517457d3
Python
btroisi/PythonProjects-SciPy
/Project8/data.py
UTF-8
7,579
3.296875
3
[]
no_license
#Brandon Troisi #2/14/17 #Data.py import csv import numpy as np from copy import deepcopy import analysis as an class Data: def __init__(self,filename=None): #fields self.raw_headers=[] self.raw_types=[] self.raw_data=[] self.header2raw={} self.raw_num_rows=0 ...
true
70d1c6381486bacd2b408cb180ef5677e735cd28
Python
anoukv/disambiguateCWSPR
/clusteringRemi/clustering.py
UTF-8
2,460
3.34375
3
[]
no_license
from random import choice from math import sqrt from collections import defaultdict class cluster: def __init__(self, center = dict() ): self.center = center self.elements_set = set(center.keys()) self.assigned_datapoints = [] def add_datapoint(self, datapoint): self.assigned_datapoints.append(datapoint) ...
true
1be968480a327f5d6efaca34ec13e5f3278276fd
Python
alkimya/scripts
/password.py
UTF-8
442
3.3125
3
[]
no_license
import string from secrets import choice alphabet = string.printable def pwd(len): while True: password = ''.join(choice(alphabet) for i in range(len)) if (any(c.islower() for c in password) and any(c.isupper() for c in password) and sum(c.isdigit() for c in passwor...
true
31e737bdbf383b0929132e437974f8d83a87bf8f
Python
roboticmonkey/hb-intro-final-project_Battleship
/utilities.py
UTF-8
6,050
3.546875
4
[]
no_license
import board import random random.seed() test_grid = board.Board() #check for valid number range. returns True of False def valid_number(user_input): if (len(user_input) == 2): if (user_input[1] == "0"): return False else: return True if (len(user_input) !=2): if (len(user_input) == 3): number = use...
true
fcfa33e093910d0e6f2c2f8a12b100e4091af9fa
Python
xiexiying/study-xxy
/note-month02/02data_manage3-8/day04/exercise4-2.py
UTF-8
180
3.609375
4
[]
no_license
""" 在一串英文字符串中,匹配出所有以大写开头的单词 """ import re str_01="How are you Jame I" res=re.findall("[A-Z][a-z]*",str_01) print(res)#['How', 'Jame']
true
0d0e3eff91d668bd8c95b8a20cbc2783467ca46a
Python
dhurley14/TitanicPrediction
/decision_tree.py
UTF-8
8,976
3.375
3
[]
no_license
import math import csv class Tree: def __init__(self, parent=None): self.parent = parent self.children = [] self.label = None self.classCounts = None self.splitFeatureValue = None self.splitFeature = None def printBinaryDecisionTree(root, indentation=""): if root...
true
04e9f968caa897c0e114542522513fc30322539b
Python
dcatp408/regex_with_jeremy
/flask_app/controllers/users.py
UTF-8
5,042
2.515625
3
[]
no_license
import re from flask.wrappers import Request from flask_app import app from flask import render_template, redirect, request, session, flash from flask_app.models.user import User from flask_app.models.saved_regular_expressions import Expression from flask_bcrypt import Bcrypt bcrypt = Bcrypt(app) @app.route("/") def ...
true
770ce84634a06e3b499c26081f6d4c02d75c5b1a
Python
RoenAronson/pokemonSpawner
/PokemonListGenerator.py
UTF-8
2,617
3.390625
3
[]
no_license
import Pokemon import os import random import math from pathlib import Path from PIL import Image pokemonImages = 'D:\PycharmProjects\PokemonRandomizer\pokemon_sprites'; pokemonList = [] # List of all of the pokemon objects, they have a weight for random encounter, # name, and associated image. weightList = [] # Li...
true
755ae54a3334d0fe4e2ae38037af6de6491ac0aa
Python
ag300g/leecode
/nextPermutation.py
UTF-8
1,449
4.34375
4
[]
no_license
# Implement next permutation, # which rearranges numbers into the lexicographically next greater permutation of numbers. # If such arrangement is not possible, # it must rearrange it as the lowest possible order (ie, sorted in ascending order). # The replacement must be in-place, do not allocate extra memory. # He...
true
0929a3d1d2b41aa3ccd298f9e4e4ee6a1bc924c8
Python
ferhatelmas/algo
/codechef/practice/easy/comm3.py
UTF-8
383
3.125
3
[ "WTFPL" ]
permissive
def dist(x1, y1, x2, y2): return ((y2 - y1) ** 2 + (x2 - x1) ** 2) ** 0.5 for _ in range(int(input())): r = int(input()) a, b = map(int, input().split()) c, d = map(int, input().split()) e, f = map(int, input().split()) l = [dist(a, b, c, d), dist(a, b, e, f), dist(c, d, e, f)] if sorted(...
true
163a645c27f2df33771e37bf879ff25f1ed0abcf
Python
elenacotan/Curs4
/Course_4_ex_3.py
UTF-8
413
3.8125
4
[]
no_license
'''Sa se scrie un program care citeste un string de la tastatura si afiseaza pe ecran fiecare cuvant din string pe cate o linie. Pentru a realiza acest lucru, se va folosi functia split. Separatorul dupa care se face despartirea este caracterul spatiu.''' def words_split(my_str): words=my_str.split() for wo...
true
27dab7eeb1d20665e02a4283b514b145cbdaf030
Python
mnazzaro/Schedule-Maker-UMD
/populate_azure_db.py
UTF-8
1,421
2.90625
3
[]
no_license
import pyodbc import requests import json server = 'ahahahahahaha.database.windows.net' database = 'ScheduleMaker' username = 'Mark' password = 'Lol this isnt my real password' driver= '{ODBC Driver 17 for SQL Server}' db = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1433;DATABASE='+database+';UID='+u...
true
3cc07758331c5fe12cad0e65e6123dccb7228b1f
Python
Matherunner/pystrafe
/pystrafe/tests/test_basic.py
UTF-8
1,421
2.6875
3
[ "MIT" ]
permissive
from pytest import approx, warns, raises from pystrafe import basic def test_collide(): v = [-1000, 123, 456] basic.collide(v, [1, 0, 0]) assert v == [0, 123, 456] def test_collide_out_of_plane(): v = [100, 100, 100] with warns(RuntimeWarning): basic.collide(v, [1, 0, 0]) assert v ...
true
5348041284f5e5d5ad3fef7e497ae1965c8b4bb5
Python
jaychen1996-byte/mmdetection_2.7
/try_mmdet/ssd_vgg.py
UTF-8
7,381
2.640625
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import VGG class SSDVGG(VGG): """VGG Backbone network for single-shot-detection. Args: input_size (int): width and height of input, from {300, 512}. depth (int): Depth of vgg, from {11, 13, 16, 19}. out_i...
true
b1fbf7f0caad526bc68b05341196b3a38f4f699a
Python
lidiiakliuchna/hw1
/HW06/hw.py
UTF-8
393
2.953125
3
[]
no_license
d = {} with open("amh.tsv", encoding='utf-8') as file: vovel = file.readline() for line in file: key, *value = line.split() d[key] = value print("Enter text: ") st = str(input()) result = list() len_st = len(st) for i in range(0,len_st): if st[i] in d: ...
true
240a989a901e227d2c150faeb5bc59b4bd78c202
Python
rickyfernandez/fastai_course_3
/course_2/exp/optimizer.py
UTF-8
4,976
2.71875
3
[]
no_license
from functools import partial from exp.utils import listify, compose class Optimizer: """Base class for all optimizers.""" def __init__(self, params, steppers, **defaults): """ Optimizer for updating gradients, params are the variables to update with steppers which is a list of functio...
true
70f70000d05f2d603f11e621c4efafb56c035b60
Python
foryou7242/smart_study
/cookbook/chapter2/12_Sanitizing_and_Cleaning_Up_Text.py
UTF-8
4,180
4.21875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Oct 13 08:14:07 2018 @author: sungyunlee """ ''' Problem Some bored script kiddie has entered the text “pýtĥöñ” into a form on your web page and you’d like to clean it up somehow. ''' # The problem of sanitizing and cleaning up text applies to a ...
true
1ab8aa3956fc2b9b8e8aaab7542d10bcc9033024
Python
nizguy/my_python_ltp
/conversions.py
UTF-8
1,163
4.21875
4
[]
no_license
def celsiusToFahrenheit(celsiusTemp): fahrenheit = celsiusTemp * (9.0/5.0) + 32.0 return fahrenheit def fahrenheitToCelsius(fahrenheitTemp): celsius = (fahrenheitTemp - 32.0) * (5.0/9.0) return celsius def showMenu(): print "A: Convert celsius to fahrenheit" print "B: Convert fahrenheit to...
true
fc500acef6c3bc8dccad9d5ba3f5cb26c2db40d6
Python
utikku1993/Text-Preprocessing-Toolkit
/tools/remove_special_characters.py
UTF-8
1,206
2.859375
3
[]
no_license
import re def run(payload): keep = [] remove = [] preserveSpaces = True if 'specialChars' in payload.keys(): if 'preserveSpaces' in payload['specialChars'].keys(): preserveSpaces = payload['specialChars']['preserveSpaces'] if 'keep' in payload['specialChars'].key...
true
e331a1e43d8968dece1e4fba1493551ab045281d
Python
h4hany/yeet-the-leet
/algorithms/Hard/336.palindrome-pairs.py
UTF-8
1,105
3.40625
3
[]
no_license
# # @lc app=leetcode id=336 lang=python3 # # [336] Palindrome Pairs # # https://leetcode.com/problems/palindrome-pairs/description/ # # algorithms # Hard (33.79%) # Total Accepted: 102.2K # Total Submissions: 302.5K # Testcase Example: '["abcd","dcba","lls","s","sssll"]' # # Given a list of unique words, return all...
true
e7c7591a2fb9bb6debdc2c67cc77d8be98e8341b
Python
littlewilliam/Datamining_Tianchi
/模型/LR_do.py
UTF-8
1,550
2.84375
3
[]
no_license
# coding=utf-8 __author__ = 'tianchuang' import pandas as pd import statsmodels.api as sm import pylab as pl import numpy as np import time # 加载数据 df = pd.read_csv("../res/user_11_26_11_28_RF.csv") # 浏览数据集 print df.head() ''' df.hist() pl.show() ''' # 需要自行添加逻辑回归所需的intercept变量 df['intercept'] = 1.0 print df.head()...
true
572eb27ea03ed55efa605e8ed871a76c2f30f933
Python
swj0418/ReverseMouseTrap
/tests/MovementTest.py
UTF-8
375
2.59375
3
[]
no_license
from loader.ImageLoader import * from detector.ObjectDetector import ObjectDetector from movements.Movements import * original, new, binary, color_matrix = load_image(Difficulty.EASY) obj_detector = ObjectDetector(new, binary, color_matrix) obj_detector.scan_image() objects = obj_detector.get_objects() object_to_mo...
true
d4c03a987007a292382617386c313cf5e478280a
Python
Bingmang/pcap2kdd
/main.py
UTF-8
1,054
2.765625
3
[]
no_license
import os import sys import time import multiprocessing if len(sys.argv) > 1: dir_name = sys.argv[1] if not os.path.exists('./Kdd'): print('main.py - Creating directory: Kdd ...') os.makedirs('./Kdd') print('main.py - Done.') def get_pcap_files(directory): res = [] for root, _, files in os.w...
true
5603ff94ad0329a5d50f948ce56ffe5190b02838
Python
saratkumar17mss040/Python-lab-programs
/Classes_and_Object_Programs/cls5.py
UTF-8
566
4.28125
4
[ "MIT" ]
permissive
# inheritance - 1 - constructor method class Person: def __init__(self, firstname, lastname): self.firstname = firstname self.lastname = lastname class Student(Person): def __init__(self, firstname, lastname, total): super().__init__(firstname, lastname) self.total = total ...
true
926ecf8e7c1aeeb1e3adb9e6deb643670bee520d
Python
tzahishimkin/extended-hucrl
/rllib/value_function/model_based_q_function.py
UTF-8
3,813
2.734375
3
[ "MIT" ]
permissive
"""Value function that is computed by integrating a q-function.""" import torch from rllib.algorithms.abstract_mb_algorithm import AbstractMBAlgorithm from rllib.util.neural_networks.utilities import DisableGradient, unfreeze_parameters from rllib.util.utilities import RewardTransformer from rllib.util.value_estimati...
true
7a2efcec6131a943aafc3fe00e3c09515a867949
Python
Pavel-98/Coursera
/Twitter/problem3.py
UTF-8
1,365
3
3
[]
no_license
import sys import json sentimentItems = {} TwitScores = {} afinnfile = open(sys.argv[1], 'r') scores = {} # initialize an empty dictionary for line in afinnfile: term, score = line.split("\t") # The file is tab-delimited. "\t" means "tab character" sentimentItems[term] = int(score) # Convert the score to an ...
true
4185a684a3f39cf2010347eacfeafed8c8746152
Python
griusfux/conceptrpg2
/Data/Scripts/Engine/rc4/rc4.py
UTF-8
3,560
3.0625
3
[]
no_license
#!/usr/bin/env python """Implementation of RC4 with drop[(nbytes)] improvement By using a class, the inital expense of generating the key-stream and drop bytes is only incurred on startup. This means a much stronger 'good enough' encryption is available with zero extra overhead. Default usage has a keystream b...
true
c7c93d218d27435d94d84cf701882f3bb82c40ff
Python
dzolotusky/advent-of-code
/2019/6/6.2.py
UTF-8
995
3
3
[]
no_license
with open("input6.txt") as f: content = f.readlines() orbiting_count = {} for line in content: line = line.strip() orbited = line.split(")")[0] orbiting = line.split(")")[1] orbiting_count[orbiting] = orbited visited = [] def count_transfers(orbiting_map, obj, counter): visited.append(obj)...
true
8d31bdf13586af1cfcc6ae3f1e6d59d8bc731d7d
Python
Doomsk/Interlin-q
/tests/test_operation.py
UTF-8
1,058
2.71875
3
[ "MIT" ]
permissive
import unittest from interlinq.objects import Operation class TestOperation(unittest.TestCase): # Runs before all tests @classmethod def setUpClass(self) -> None: op_info = { 'name': "SINGLE", 'qids': ["qubit_1"], 'cids': None, 'gate': Operation.X,...
true
05955e0919793914d5ac6d469e4311a9f37054a7
Python
Mashin08/Sitnikov_problem
/window.py
UTF-8
829
2.765625
3
[]
no_license
# coding: utf-8 # license: GPLv3 """ Visualization module. Describes main screen processes """ import ctypes import tkinter user32 = ctypes.windll.user32 window_width = round(user32.GetSystemMetrics(0) * 0.8) window_height = round(user32.GetSystemMetrics(1) * 0.6) def create_body_image(space, body): """ :...
true
781a258d40cbe58d8839058db81bf06e8d4db89d
Python
mukhal/Bi-lateral-multiperspective-matching
/data_loader/data_loaders.py
UTF-8
3,503
2.625
3
[ "MIT" ]
permissive
import torch import numpy as np from torchvision import datasets, transforms from base import BaseDataLoader import os class MnistDataLoader(BaseDataLoader): """ MNIST data loading demo using BaseDataLoader """ def __init__(self, config): super(MnistDataLoader, self).__init__(config)...
true
5e6d2800c9b79b51c9b0d6e0e7b1255fe7676a2e
Python
Nunnymolers/Stephen-Hawking
/sh.py
UTF-8
680
3.484375
3
[]
no_license
from Tkinter import * import subprocess master = Tk() def callback(): txt = "My name is Stephen Hawking, and I was born in Oxford, UK on January 8th, 1942. I was diagnosed with ALS, a paralysing disease, at age 21. I am known for my theories on black holes, and my writing. ALS does not allow me to talk, so I talk...
true
f43c28e7519683514b05a08827d3b1427c9450ab
Python
Wambuilucy/CompetitiveProgramming
/HackerRank/SolveMeFirst.py
UTF-8
137
2.90625
3
[]
no_license
#! /usr/bin/python3 # https://www.hackerrank.com/challenges/solve-me-first num1 = int(input()) num2 = int(input()) print (num1 + num2)
true
2883c2fdea0540d15b18adec1786de0b940366d6
Python
itsvrushabh/demo_site
/app1/views.py
UTF-8
642
2.671875
3
[]
no_license
from django.shortcuts import render from app1.models import Student def test(request): results = Student.objects.all() for record in results: print(record) context = { "students": results } return render(request, 'app1/students.html', context) def index(request): context = { ...
true
411ec07e009c52b4e3319c7ee05ac2d98ee2e8c6
Python
laerm0/wei-glyphs-scripts
/AddPlaceHolderBetweenEachGlyph.py
UTF-8
799
2.71875
3
[ "Apache-2.0" ]
permissive
#MenuTitle: Add Placeholder Between Each Selected Glyph # -*- coding: utf-8 -*- """""" import GlyphsApp Font = Glyphs.font Doc = Glyphs.currentDocument namesOfSelectedGlyphs = [ "/%s" % l.parent.name if hasattr(l.parent, 'name') else "\n" for l in Font.selectedLayers ] editString = "" # Replace selected text TextStor...
true
a9eee9c9e53ef2ec3311605bd2909d1bbd9dc086
Python
pyrfume/pyrfume
/pyrfume/predictions.py
UTF-8
2,631
2.859375
3
[ "MIT" ]
permissive
import pandas as pd import pyrfume from pyrfume.features import smiles_to_mordred, smiles_to_morgan_sim from pyrfume.odorants import all_smiles def get_predicted_intensities(): """Return the DREAM model predicted intensities using Mordred (not Dragon) features""" path = "physicochemical/cids-names-smiles-mor...
true
852df495fa4bdd130819b844693f3240ed05a1f4
Python
IvanLeezj/MyCookiesPool
/cookiespool/generator.py
UTF-8
1,966
2.75
3
[]
no_license
import json from cookiespool.config import * from cookiespool.db import RedisClient from login.login import WeiboCookies class CookiesGenerator(): def __init__(self, website='weibo'): self.website = website self.cookies_db = RedisClient('cookies', self.website) self.accounts_db = RedisClien...
true
e7d269c5df7d98cd26b8fc0c9c5b34e113c548a1
Python
vuamitom/Code-Exercises
/rakuten/rectilinear.py
UTF-8
829
3.390625
3
[]
no_license
# you can use print for debugging purposes, e.g. # print "this is a debug message" def is_overlap(K, L, M, N, P, Q, R, S): if R < K or M < P: return False if S < L or Q > N: return False return True def overlap(K, L, M, N , P, Q, R, S): if not is_overlap(K, L, M, N, P, Q, R, S): ...
true
97eb388e352014bfcb1902147502308037890f62
Python
crayonpop/gitPlayGround
/stringsearch.py
UTF-8
1,196
2.546875
3
[]
no_license
#-*-coding:cp949 -*- import os,codecs,sys global argv1 def proc(): ## File Searching print("Starting...") filelist= [] root = os.path.dirname( os.path.abspath( __file__ ) ) print("Match File Find Start") for (path, dir, files) in os.walk(root): for filename in files: ext ...
true
4b229af4c63f935360039b3a5e52cf2a0787eb4d
Python
TakamasaIkeda/-100-
/NLP100/chap1/knock03.py
UTF-8
355
3.34375
3
[]
no_license
#!/usr/bin/env python #-*- coding: utf-8 -*- firstCharacter = [] sentense = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics." splitSentense = sentense.split(" ") for (number, item) in enumerate(splitSentense): print item + " " + item[0:1] firstCharacter.append(item[0...
true
f286412a56ac5fb843400fffa8f97607bf99f5e1
Python
Jonahz1/CAVs_ROS_radar
/build/cavs_radar_example/catkin_generated/installspace/radar_parser.py
UTF-8
2,942
2.8125
3
[]
no_license
#!/usr/bin/env python2 #Author: Jonah Gandy #NetID: jtg390 #email: jonahgandy@gmail.com #source 1: https://pypi.org/project/cantools/ #source 2: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29 import rospy import cantools import can from radar_msgs.msg import RadarDetection #supporting func...
true
f9db5b1bdc697ae1f6912d29b4a8b8f2ce815d81
Python
yotti5160/Codility
/Lessons/5-02_GenomicRangeQuery.py
UTF-8
613
2.71875
3
[]
no_license
def solution(S, P, Q): l=len(S) book=[[0]*4 for i in range(l)] score={'A':0, 'C':1, 'G':2, 'T':3} nowCount=[0,0,0,0] for i in range(l): nowCount[score[S[i]]]+=1 for j in range(4): book[i][j]=nowCount[j] ret=[] for i in range(len(P)): if P[i]==0: ...
true
1c4e18f25a6fd61c69d41c9793de833b675369cc
Python
hukai916/FE2OG_project_draft
/scripts/parse_clstr.py
UTF-8
2,061
2.640625
3
[]
no_license
""" This script is to parse the .clstr file together with cluster id file in order to reorganize the order of sequences in each cluster by putting the structure-associated seqs on top of each cluster. Usage: python parse_clstr.py filter20.clstr Fatcat/153_0.75_domain.txt """ from Bio import SeqIO import sys import re i...
true
d2efe1747467ae11f225729897d22cb05fec9ba7
Python
kirpichik/abstractly-example
/ast.py
UTF-8
595
3.078125
3
[]
no_license
class Lexeme: def __init__(self, value): self.value = value def get_value(self): return self.value def __str__(self): return self.get_value() class NumberLexeme(Lexeme): pass class FloatLexeme(Lexeme): pass class OperatorLexeme(Lexeme): pass class EqualLexeme(...
true
a15173f9ecea1cca5620f3846bc2b5fbc38fd078
Python
mawan5512/PredicitingEngagement
/Prediction.py
UTF-8
2,485
2.9375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[2]: from sklearn.metrics import r2_score from sklearn.metrics import explained_variance_score from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import pandas as pd import numpy as np # In[3]: tweets = pd.DataFrame.from_csv('/Users/moha...
true
b37c94aaeb73811b4b66e81556fdc14dd28149b4
Python
zzeleznick/algorithms
/Graph.py
UTF-8
8,287
3.015625
3
[]
no_license
from __future__ import print_function import random from itertools import chain from collections import Mapping, Iterable from collections import OrderedDict as OD from TimeUtils import * from utils import * class Vertex(object): """A representation of a node with potential edges and weights. Vertex.edges -> ...
true
81470539ae094aab5c2b03be96d604b258a8993e
Python
baiasuka/PyhtonStudy
/leetcode/algorithm/100.py
UTF-8
1,031
4
4
[]
no_license
# 100.相同的树 class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: def preOrderTraversal(root_node): """ 使用栈来记录节点实现先序遍历,当左孩子不存在时 :return: ...
true
2b85eae46181934a6d0bd366117d88fc37d5575e
Python
MarcelRaschke/pytorch-2
/test/mobile/model_test/gen_test_model.py
UTF-8
3,572
2.53125
3
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "BSL-1.0", "Apache-2.0", "BSD-2-Clause" ]
permissive
import torch import yaml from math_ops import ( PointwiseOpsModule, ReductionOpsModule, ComparisonOpsModule, SpectralOpsModule, BlasLapackOpsModule, ) from nn_ops import ( NNConvolutionModule, NNPoolingModule, NNPaddingModule, NNNormalizationModule, NNActivationModule, NNRecu...
true
b51bbf23fe0209ae3a983fb261e7ddb4e3f34fb1
Python
SaurabhSakpal/fss16SmallThinExpert
/code/2/4.3/think4_3.py
UTF-8
975
3.296875
3
[]
no_license
import math from swampy.TurtleWorld import * def square(t, length): for i in range(4): fd(t, length) lt(t) def polygon(t, length, n): for i in range(n): fd(t, length) lt(t, 360/n) def circle(t, r): circum = 2*math.pi*r n=50 polygon(t,circum/n,n) def arc(t,r,angle): length = 2*math.pi*r /360 * angle n...
true
825f4d377a3ccdbb201bfe79213eb80f925fe242
Python
paulinacabrera/Modelamiento
/SIR.py
UTF-8
2,036
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Dec 21 05:37:42 2019 @author: Paulina """ import scipy.integrate import numpy as np import matplotlib.pyplot as plt def SIR_model(y, t, beta, gamma, N): S, I, R = y dS_dt = -beta*(S*I/N) dI_dt = beta*(S*I/N) - gamma*I dR_dt = gamma*I ...
true
7edee9459536a2afcbcd6077d31a1dee283573e4
Python
yehzhang/RapidTest
/rapidtest/_compat.py
UTF-8
5,311
2.96875
3
[ "MIT" ]
permissive
import inspect import sys from collections import Sequence PY3 = sys.version_info[0] == 3 PY2 = sys.version_info[0] == 2 PRIMITIVE_TYPES = int, float, bool, str, type(None) if PY3: # noinspection PyUnresolvedReferences import queue basestring = str range = range if PY2: # noinspection PyUnreso...
true
aa2c95377c8a8002970c8887cd10cc3e8d1d88e8
Python
MaximeGLegault/glo2005
/app/infrastructure/password_hasher_brcypt.py
UTF-8
423
2.890625
3
[]
no_license
from flask import current_app class PasswordHasherBCrypt: def __init__(self): self.bcrypt = current_app.config["hasher"] def generate_password_hash(self, password: str) -> str: return self.bcrypt.generate_password_hash(password).decode('utf-8') def check_password_hash(self, password: str...
true
8d341569a6502e9d78018faceebd6618c56b35b1
Python
xquyvu/starbucks-offer-optimisation
/src/etl/portfolio_and_profile_to_csv.py
UTF-8
596
2.953125
3
[]
no_license
import pandas as pd # Since portfolio and profile are quite nicely formatted, we can export them to csv # without further preprocessing def json_to_csv(from_path, to_path): """Read data from json and export to csv as table""" pd.read_json(from_path, orient='records', lines=True).to_csv(to_path, index=False) ...
true
f6b3ea16007f261504d03aa4598f7fe9377b0ab1
Python
bverpaalen/numberClassifier
/task5.py
UTF-8
2,455
3.234375
3
[]
no_license
import numpy as np import math as m class xor_net(): def __init__(self, x1 = 0, x2 = 1): self.x1 = x1 self.x2 = x2 self.initialWeights() def initialWeights(self): np.random.seed(200) self.weights = np.random.rand(3, 3) class GradientD(x...
true
6cccae3ebd8b078db9218be0611674a1ed9d3d5a
Python
uai-python/tim-7
/models.py
UTF-8
1,150
2.53125
3
[ "MIT" ]
permissive
from config import db class Pemain(db.Model): __tablename__ = 'pemain' id_pemain = db.Column(db.Integer, primary_key=True) salut = db.Column(db.Varchar(15)) nama = db.Column(db.Varchar(30)) usia = db.Column(db.Integer) jenis_kelamin = db.Column(db.Varchar(10)) email = db.Column(db.Varchar...
true
406b787dd4eb99b7afee1bca691953bf583eb820
Python
olafur19/forritun_OIH
/w1/test-1.py
UTF-8
102
2.6875
3
[]
no_license
heimilisfang = "Bergás 6" phoneno = "7725771" nafn = "Ólafur Ingvi Hansson" print(heimilisfang, phoneno, nafn)
true
db67d6ce5cda45b299e0884b276162245e155bca
Python
liuxushengxian/Python001-class01
/week01/homework_1.py
UTF-8
2,084
2.671875
3
[]
no_license
# 使用requests和bs4获取猫眼电影 import requests from bs4 import BeautifulSoup as bs import pandas as pd user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36' header = {'Cookie':'__mta=220435111.1593175907653.1593191724978.1593192743136.3; uuid_n_...
true
383564c5b6b873d1ae685ca718da933845f2dc96
Python
infiniteoverflow/Student-Information-Analysis
/screens/select_branch.py
UTF-8
2,454
2.859375
3
[]
no_license
from tkinter import * from screens.show_elective import * class Select_branch: def __init__(self,branch): self.root = Toplevel() self.root.geometry("2000x1024") self.root.title("Electives") self.c = Canvas(self.root,bg = "gray",height=2000,width=2024) photo = PhotoIma...
true
f330c40d82e53e63ebe65a48b008d76094a1d2ed
Python
orinbai/jobs
/wordprocess.py
UTF-8
1,035
3.296875
3
[]
no_license
# coding=utf8 import re class discretize: def __init__(self, code='utf8', maxchar=6): self.code = 'utf8' self.maxchar = 6+1 self.enumrate = range(1, self.maxchar) self.signRE = re.compile("[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()《》‘’“”;:]+".decode(self.code)) def _rem...
true
3dbe5b093152954e3aa5387ccde71ff606dd1478
Python
rollila/python-udp
/server/player_controller.py
UTF-8
1,990
2.828125
3
[]
no_license
import copy import pickle import time from threading import Lock, Timer from player_state import PlayerState from client_state import ClientState class PlayerController: def __init__(self): self.players = {} self.next_player_id = 0 self.timer = Timer(20, self.prune_disconnected) s...
true
dd4ce0de4ec465c16ed09daa310d7fa922f5c411
Python
save-repos/gymapp-python
/source/reportes.py
UTF-8
1,537
2.828125
3
[]
no_license
from tkinter import ttk,Label, messagebox as ms,Toplevel,END,BUTTON,LEFT from datetime import date import source.funciones as fn class Reporte: def __init__(self, usuario): # self.panel = Tk() self.panel = Toplevel() self.panel.title('Reportes') self.panel.iconbitmap('img/icon.ico...
true
8caa24c3c55cbdc30e310578934dfc90dd728975
Python
MattCCS/Pipers
/slowline.py
UTF-8
1,100
3.203125
3
[]
no_license
""" Tool to slow piped input with an arbitrary delay """ import argparse import sched import sys import time assert sys.version_info >= (3, 6, 0) DESCRIPTION = """\ Bottlenecks a piped process to output a line every N seconds (>= 0.001). Guarantees the delay to be at least N seconds.""" def output(text): sys...
true
f7c0e47e14b4a885ca2ce9ea38ed0ced05cb37fc
Python
abdulmakuya/IoT-and-Embedded
/Python-for-Embedded-and-IoT/basics/pyserial-with-arduino/read-light-intensity/read_ldr.py
UTF-8
188
2.75
3
[ "MIT" ]
permissive
from serial import Serial arduino = Serial('COM12', baudrate=115200, timeout=1) arduino.flush while True: arduino.write(b'r') line = arduino.readline().decode() print(line)
true
57d050d476fa7362f44985a1fc67c23e49431fce
Python
albinai/Wd
/python labs/part5/f.py
UTF-8
192
3.21875
3
[]
no_license
n = int(input()) arr = input() l = list(map(int,arr.split(' '))) checker = 0 for i in range (1,n-1): if l[i-1] < l[i] and l[i+1] < l[i]: checker += 1 print(checker)
true
e20ece591a2b8858e5c717aec509a13557a8e7bb
Python
1zb/deconv
/util.py
UTF-8
1,728
2.96875
3
[]
no_license
import numpy as np from PIL import Image import matplotlib.pyplot as plt def read_grey_image(filename): image = np.array(Image.open(filename).convert('L')) / 255.0 return image def to_pil(image): return Image.fromarray(np.uint8(image * 255)) def gen_gaussian_kernel(width=3, sig=1): ax = np.arange(...
true
b3084162a74a771166d91f78219ff0f82bd5231c
Python
krzywilk/audio-analysis
/main.py
UTF-8
449
2.546875
3
[]
no_license
import tkinter as tk from gui.master_view import MasterView from gui.player.simple_music_player import MusicPlayer from gui.player.spectrogram.simple_spectrogram import SpectrogramPlot def init_views(): views = [ ("Simple player", MusicPlayer, "Simple player"), ] return views if __name__ == "__m...
true
eaf7bb8560e871a56df93caae9c94cde8783c4e1
Python
TheShorterBomb/programs1
/School/Radical approximation.py
UTF-8
76
3.359375
3
[]
no_license
n = int(input()) i = 1 t = 1/2 while i < n: t = 1/(2+t) i += 1 print(t+1)
true
c35462a130f0a9fa7a0009db1edc81cc3916c970
Python
icebreakeris/project2021public
/tests/test_auth.py
UTF-8
1,307
2.609375
3
[]
no_license
from test_base import BaseTestCase from util import TestUtilities class AuthUnitTests(BaseTestCase): def test_register_fail(self): response = TestUtilities.register(self.app, "username", "password1", "Pass!1!", "testing@gmail.com") self.assertIn(b'Invalid details', response.data) def test_re...
true
992e1c1880beef593eaef898872bfe61964e8504
Python
AkshayMalviya/Client_Authentication_TP
/client.py
UTF-8
4,854
3.484375
3
[]
no_license
import socket import datetime import pdb def write_response(start, finish, artist, length): # This writes information to the log file 'client.log new_file = open("client.log", 'a+') new_file.write("Server took {} to complete the request for '{}' ".format(str(finish - start), artist)) new_file.w...
true
65a6143c6b4b39c3163ab96e1a79c79adda45e28
Python
ltvlx/Pizza-cutting-problem
/sublayout.py
UTF-8
3,349
3.515625
4
[]
no_license
def get_sublayout_n(pattern, x, y, wi, he, s_v, s_h): """ A function that returns the sublayout number for the given input pattern key """ if pattern == "left": if (x < s_v and x+wi-1 < s_v): return 1 elif (x >= s_v and x+wi-1 >= s_v): return 2 elif patte...
true
69de0a69e595f15432e1dc22b0278efdf047596c
Python
jimmylai/Fixit
/fixit/tests/test_rule_lint_engine.py
UTF-8
5,258
2.59375
3
[ "MIT", "Python-2.0", "Apache-2.0" ]
permissive
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from pathlib import Path import libcst as cst from libcst.testing.utils import UnitTest, data_provider from fixit import rule_lint_engine fr...
true
f249e7a6c594042804eb0ae613fe79c24fbe3ded
Python
blackivory/dtwalign
/dtwalign/step_pattern.py
UTF-8
19,439
3.015625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import networkx as nx def _num_to_str(num): if type(num) == int: return str(num) elif type(num) == float: return "{0:1.2f}".format(num) else: return str(num) class BasePattern(): """Step pattern base c...
true
f5e66eed4b8c01dbe13baea813e308923f9f51ca
Python
Yhuang93/PyExercise
/TestandExercisePython/inner_outer_function.py
UTF-8
137
2.515625
3
[]
no_license
def outerFunction(text): text=text def innerFunction(): print(text) return innerFunction outerFunction('text')
true
2ef24782c554f962651f10a80856f190564838dc
Python
argroch/python-exercises
/code_acad.py
UTF-8
1,439
3.921875
4
[]
no_license
# Needed a place to work out Code Academy exercises, outside of their environment. # def anti_vowel(text): # result = '' # vowels = ['a','e','i','o','u'] # for char in text: # if char.lower() not in vowels: # result += char # return result # # print anti_vowel("Hey look Words!") # def censor(text, w...
true
4c58d434147da62b99d964fa92a19c7419904f72
Python
Beondel/Retinopathy_Neural_Network_Grader
/data_wrangler.py
UTF-8
2,997
2.96875
3
[]
no_license
import numpy as np from PIL import Image import os from pathlib import Path import pandas as pd import xlrd as excel # Ben MacMillan # This class normalizes the retinal scan data for use in a convolutional neural network class Data_Wrangler: def __init__(self): # initialize fields self.training_fe...
true
0e90413e65c7887148059ad379c9f3978ab20a30
Python
MarryAnt/my_python
/cinema_price.py
UTF-8
6,314
3.171875
3
[]
no_license
# cinema_price film = input("Выберите фильм: ") day = input("Выберите день(сегодня, завтра): ") time = int(input("Выберите время: ")) num = int(input("Укажите количество билетов: ")) if film == "Пятница": if day == "сегодня": if time == 12: if num < 20: print("Заплатите ",250*num...
true
230826e45e753168ad2b876c12a9bd2df3c77af3
Python
ZazAndres/Talles-de-los-50-EJ
/punto26.py
UTF-8
717
4.21875
4
[]
no_license
print("---Calcular la nota final---") n1=float(input("Regaleme la primera nota: ")) n2=float(input("Regaleme la segunda nota: ")) n3=float(input("Regaleme la tercera nota: ")) n4=float(input("Regaleme la cuarta nota: ")) n5=float(input("Regaleme la quinta nota: ")) nfinal=((n1*15)/100)+((n2*20)/100)+((n3*15)/...
true
37496cf8e70bf295a9c33cf60372cebdd5234963
Python
kaviyarasujojo/kavi
/46.py
UTF-8
34
2.84375
3
[]
no_license
n1=int(input()) n1=n1+1 print(n1)
true
563f6f5956f1b7c6cb2a3f525955c8f58e5da83c
Python
probablytom/bpi_13_python
/domain_model/document_emission.py
UTF-8
2,693
2.703125
3
[ "MIT" ]
permissive
from utils import experimental_environment, manually_log document_emission_active = True def process_documents(produces=list(), consumes=list()): if 'existing documents' not in experimental_environment.keys(): experimental_environment['existing documents'] = dict() def decorat...
true
e0d768360b76c4ba3155b497badceabff6be1b4f
Python
jchen8tw-research/CTF
/REVERSE/picoCTF/quackme/quackme.py
UTF-8
585
2.6875
3
[]
no_license
# coding=utf-8 pointer8048858=[0x29, 0x6, 0x16, 0x4F, 0x2B, 0x35, 0x30, 0x1E, 0x51, 0x1B, 0x5B, 0x14, 0x4B, 0x8, 0x5D, 0x2B, 0x56, 0x47, 0x57, 0x50, 0x16, 0x4D, 0x51, 0x51, 0x5D, 0x0] greetingMessage_str='You have now entered the Duck Web, and ' greetingMessage=[] for i in range(len(greetingMessage_str)): greeti...
true
8e94eef182ffe8f99930c482af1fe8480bfc9f33
Python
vn09/cs7051
/lab2/lab2_client.py
UTF-8
527
2.609375
3
[]
no_license
import requests import random import socket import string PORT_NUMBER = 8080 HOST_DOMAIN = "" if __name__ == "__main__": sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((HOST_DOMAIN, PORT_NUMBER)) try: random_string = ''.join(random.choice(string.digits + string.ascii_lowercase) for x ...
true
2dc831338ac748e04eae2d901128d495c885fa4e
Python
tikzoxs/EyeKnowYouSSL
/file_size.py
UTF-8
327
2.625
3
[]
no_license
import os import cv2 folder = '/home/1TB/EyeKnowYouSSLData/p' total = 0 for i in range(1,15): data_folder = folder + str(i) file_list = os.listdir(data_folder) count = len(file_list) total += count image = cv2.imread(data_folder + '/' + '1.jpg') print(image.shape) print(data_folder,"___",count) print("total = "...
true
6301066e54e412c45e154869e39389b0ee469ebd
Python
mathjazz/scripts
/mozilla_l10n/searchplugins/yahoo_hardcode_params.py
UTF-8
3,246
2.515625
3
[]
no_license
#! /usr/bin/env python ''' This script assumes that localizations are stored in a structure like the following: this_script |__locales |__locale_code |__l10n-central |__mozilla-aurora |__mozilla-beta I use this script to generate the full folder structure (all locales,...
true
0b180ef09826c61a095db4ad3a5ce50f1db34ca9
Python
Aasthaengg/IBMdataset
/Python_codes/p02811/s109187286.py
UTF-8
79
2.796875
3
[]
no_license
k, y = [int(i) for i in input().split()] print('Yes' if 500 * k >= y else 'No')
true
b5116a32eb7b04e1ac502b954d7a581c199eaeee
Python
nicolevalentini/Overtime
/main.py
UTF-8
248
3.625
4
[]
no_license
def overtime(): hourly_rate = pound return hourly_rate pound = int(input("Enter your hourly rate: ")) print("Your weekly hourly rate is: {}, your Saturday's rate is: {}, your Sunday's rate is: {}".format(pound, pound //2 + pound, pound*2))
true
53af249c0a4ff976118f9ac260a671006b502f9c
Python
hyejeong99/ROS
/c1-dqn/dqn/src/DQN_├╩▒Γ/xy2Dsimulator/map.py
UTF-8
1,486
2.8125
3
[]
no_license
#!/usr/bin/env python import cv2, pygame, yaml from PIL import Image import numpy as np class map: def __init__(self): self.obstracle_x = [] self.obstracle_y = [] def map_read(self, jpg_path, yaml_path): self.map_image = Image.open(jpg_path) self.map = pygame.image.fromstring(...
true
1c7bb88750b499a1252b00c9c493b95c50a48f2d
Python
dr937/unencoded-keyboards
/main.py
UTF-8
766
2.78125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 3 10:59:46 2021 @author: msthilaire """ from flask import Flask, render_template from base64 import b64decode # create an instance of Flask. (a "Flask process") app = Flask(__name__, template_folder="src/html") # tell the web server which func...
true
f2e3918ca5dc85a2b2682da6cd5d34e443a8fee0
Python
po5i/test__stackbuilders
/crawler/tests.py
UTF-8
1,467
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from crawler.models import Crawl, Entry class CrawlerTestCase(TestCase): def test_01_first30(self): """ Get the first 30 entries """ crawl = Crawl.objects.create() output = cra...
true