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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
81f455f95ed24cf73bea4314751a67bd3caf081c | Python | steph-meyering/DSandAlgorithms | /leetcode/1512.py | UTF-8 | 246 | 2.75 | 3 | [] | no_license | class Solution:
def numIdenticalPairs(self, nums: List[int]) -> int:
count = Counter(nums)
res = 0
for val in count.values():
if val >= 2:
res += ((val-1) ** 2 + val-1)//2
return res | true |
eb2272045be8056c51150519580fec9d77d5ce5f | Python | amaurilopez90/SampledSoundSynth | /PCPrototype/code/tools.py | UTF-8 | 5,622 | 3.265625 | 3 | [
"MIT"
] | permissive | # ####################################################################################################
#
# => Contributors: Amauri Lopez, Darrien Pinkman
# => Course: Senior Project I
# => Semester: Fall 2017
# => Advisor: Dr. Anthony Deese
# => Project name: Polyphonic Sampled Sound Synthesizer
# => Description: Thi... | true |
4554164e9cc132fcac3e2e324b644e279897c0e7 | Python | subhashl7/subhashpython | /voworconst.py | UTF-8 | 267 | 3.46875 | 3 | [] | no_license | #subbu#vowel or consonant:
yy=raw_input()
if((yy>='a' and yy<='z') or (yy>='A' and yy<='Z')):
if (yy in ['a','e','i','o','u','A','E','I','O','U']):
print('Vowel')
else:
print('Consonant')
else:
print('invalid')
| true |
5d6f74295d04aa03b2ba327ebf050c912487a58a | Python | liusy182/tensorflow-trial | /5_input_data.py | UTF-8 | 3,053 | 2.640625 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import pandas as pd
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.datasets import mnist
tf.logging.set_verbosity(tf.logging.INFO)
FLAGS = {'directory': 'tmp/mnist', 'val... | true |
39303fc5a2b5528a2c2bdc5e61d2884747b242e8 | Python | aitorlopez98/iw-ejercicios-python | /Ejercicios/_8_Clases_objetos/Ejercicio 4.py | UTF-8 | 1,180 | 3.84375 | 4 | [] | no_license | import math
class clsTriangulo:
def __init__(self, cat1, cat2, base):
self.cat1 = cat1
self.cat2 = cat2
self.base = base
def area(self):
_base = self.base
_cat1 = self.cat1
_cat2 = self.cat2
s = _cat1 + _cat2 + _base
a = (s*(s-_cat1)*(s-_cat2)*(... | true |
1bb48e404d22a8dcee29468a0d126487036dd2a0 | Python | NewtonLicciardiJr/persona | /persona/intent/model.py | UTF-8 | 2,566 | 2.703125 | 3 | [] | no_license | import numpy as np
from keras.models import Sequential
from keras.layers import Input, LSTM, Dense, Embedding
def IntentModel(model):
model = model.lower()
if model == "onehot":
return OneHotModel
elif model == "embeddings":
return EmbeddingsModel
else:
print("{} does not exist... | true |
5e04a33096bebb931a1fbe7027ac2caef11659d5 | Python | songhappy/pythonlearn | /src/leetCode/binarySearchTree/n86bst.py | UTF-8 | 1,999 | 4.3125 | 4 | [] | no_license | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
Example of iterate a tree:
iterator = BSTIterator(root)
while iterator.hasNext():
node = iterator.next()
do something for node
"""
class BSTIterator:
"""
@param: ... | true |
82f5c8edfc1ac4746784f8c884c9e892f90ff8dc | Python | patrick333/euler-project-solutions | /euler052/solution.py | UTF-8 | 242 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python
#Permuted multiples
def getDigits(N):
return sorted(str(N))
def main():
n=9999
while not getDigits(2*n)==getDigits(3*n)==getDigits(4*n)==getDigits(5*n)==getDigits(6*n):
n+=9
print n
# print getDigits(194967)
main() | true |
c893541616ae4d3b6c1a2c6783acc9e432cb19cf | Python | SimonWithWoogi/SchedulingProto | /Environment/Renderer.py | UTF-8 | 2,082 | 2.71875 | 3 | [] | no_license | import numpy as np
import tkinter as tk
import matplotlib.colors as mcolors
import pyscreenshot
from PIL import Image
from PIL import ImageTk
ColorList = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf',
'#1f77b4', '#ff7f0e', '#2ca02c', '#d62728... | true |
602a02519f9fc071fff818289715fbefb0235112 | Python | samaeen/leet_code_solutions | /longestCommonPrefix.py | UTF-8 | 215 | 3.171875 | 3 | [] | no_license | class Solution:
def longestCommonPrefix(self, strs):
for i in range(len(strs)):
print(strs[i][0])
a=["flower","flow","flight"]
#print(a[0][2])
#print(len(a))
print(Solution().longestCommonPrefix(a)) | true |
e4ece13eedb6016d008604443d064190c0fa51cb | Python | roger1993/text_classification | /python3/segment.py | UTF-8 | 754 | 2.984375 | 3 | [
"MIT"
] | permissive | import jieba
def main():
stopwordset = set()
with open('/Users/roger/Downloads/text_classification/stopwords.txt','r',encoding='utf-8') as sw:
for line in sw:
stopwordset.add(line.strip('\n'))
texts_num = 0
output = open('wiki_seg.txt','w')
with open('wiki_texts.txt','r') as ... | true |
c8a6f239830fc1ca85a2bf91b613f3fce9b26ba8 | Python | chijuzipi/ChineseAuthor | /src/NPG/urlGenerator2.py | UTF-8 | 1,276 | 2.8125 | 3 | [] | no_license | from bs4 import BeautifulSoup
class URLGenerator:
def __init__(self):
# when the urls from file
self.generate()
# when the urls can be direct synthesized
#self.synthesis()
def generate(self):
f1 = open('archive/NatureGene/NatureGeneIssueList.html', 'r')
f2 = open('archive/processed/Natur... | true |
9316c7524b8992840e9c9da4812965f1ba08ca2a | Python | janvrany/bricknil | /bricknil/sensor/light.py | UTF-8 | 1,944 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019 Virantha N. Ekanayake
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | true |
4bdecfa16459c2703cddaeb16c3221c0ecdeffbb | Python | gamecmt/jandan | /img_spider.py | UTF-8 | 7,255 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import hashlib
import re
import base64
import os
import sqlite3
import time
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
def page_source(url):
''' 读取网页 '''
options = Options()
options.add_argumen... | true |
d54e0cf415e6798e02ce8be6c2effc28e3ec5807 | Python | telegrambotproject/MainRepository | /functions.py | UTF-8 | 8,727 | 2.59375 | 3 | [] | no_license | import requests
import pickle
import datetime
import requests
import json
import urllib
import urllib.request as urlrequest
import ssl
now = datetime.datetime.now()
# functions for requests
with open('keys/imdbapi.txt') as f:
imdb_key = f.read()
with open('keys/apikey.txt') as f:
key = f.read()
def re... | true |
87fb791555073a1f95760b36b5a65af9ee958741 | Python | hmcRobotLab/robot-reu-2012 | /irobot_nav/src/HandleData.py.save.1 | UTF-8 | 9,691 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import roslib; roslib.load_manifest('irobot_nav')
import rospy
import irobot_mudd
import cv_bridge
import cv
import sensor_msgs.msg as sm
from std_msgs.msg import String
from irobot_mudd.srv import *
from irobot_mudd.msg import *
import TheHive
import ImageProcessing
import RangeProcessing
import ... | true |
b29dd12a0a21d6e9b73c8ed5734d3f633cb7b384 | Python | almazakhmetzyanov/semrush_task | /Libs/Utils/headers_extractor.py | UTF-8 | 1,859 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tests_config
import re
class HeadersExtractor:
@staticmethod
def _prepare_url_for_regexp(url):
# символы которые надо спрятать от регулярного выражения, это тупо, зато просто
symbols_for_replacing = ['?', '.', '-', '+']
for i in symbols_for_replacing:
... | true |
2aa72a9b19bf2db8747eda4ebe316b3128137d2c | Python | continuoustests/OpenIDE.CodeSamples | /.OpenIDE/scripts/read-configuration.py | UTF-8 | 1,064 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
import sys, subprocess
# Runs process and returns lines ouputted by the process
def run_process(exe):
p = subprocess.Popen(exe, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
lines = []
while(True):
retcode = p.poll() # returns None while subprocess is running
line ... | true |
351c1068ee65a7efe96a40d5c45bc09760b19f99 | Python | atmadjahenry/Tugas | /Mengganti Huruf Vokal.py | UTF-8 | 356 | 3.640625 | 4 | [] | no_license | '''[Mengganti Huruf vokal]
Input:
- Masukkan teks: 'Hari ini adalah hari Rabu.'
- Masukkan huruf vokal: 'o'
Output:
Horo ono odoloh horo Robo.
'''
import re
vokal = '[aeiou]'
teks = input('Masukkan teks = ').lower()
pengganti = input('Masukkan karakter pengganti = ').lower()
output = re.sub(vokal,... | true |
6e3a446137d1557e9e37279f066fd6fe13f116e0 | Python | NosevichOleksandr/firstrepository | /homework...idk.py | UTF-8 | 199 | 3.140625 | 3 | [] | no_license | def func(b):
answ = ''
if b.isdigit():
return b
else:
for i in str(b):
if i.isdigit() == False:
answ += i
return answ
print(func('abc3'))
| true |
f394032e975d56ebcf7b39f79b36a2bc26fc8813 | Python | A090MA/Py_challenge | /PyPoll/main.py | UTF-8 | 1,199 | 3.328125 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import os
from pathlib import Path
import csv
import pandas as pd
import numpy as np
# In[2]:
file1 = "Resources/election_data.csv"
poll_df = pd.read_csv(file1)
poll_df.head()
# In[7]:
# The total number of votes cast
len(poll_df['Voter ID'].value_counts())
# In[12]:
# A complet... | true |
91571fccb67f9c96d7d05596c89ed0b60bef1d0f | Python | matthewsklar/OpenAI | /Test/TensorImage.py | UTF-8 | 3,103 | 3.234375 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('tmp/data/', one_hot=True)
# Nodes per hidden layer
n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 = 500
n_classes = 10
batch_size = 100 # Process 100 images at a time
# 784 = 28 X 28
x = tf.place... | true |
ea990468dc4a5998797258f24fad85b4a84c3890 | Python | DatDLuu/Short_Python_Algorithm | /challenge/rockPaperScissor.py | UTF-8 | 1,980 | 3.59375 | 4 | [] | no_license | # given a string represents rock paper scissor moves
# calculate corresponding moves based on rules
'''the rules you'll be following:
If you win, switch to what your opponent played
If you lose, switch to whatever wasn't played that round
In case of a draw, choose the move you've played least frequently
If there's a t... | true |
2dddf69977bb7b30724dcde8031873dd2e045c47 | Python | Xavilien/word-game | /test_preprocessing.py | UTF-8 | 434 | 2.671875 | 3 | [] | no_license | from unittest import TestCase
from preprocessing import *
class Test(TestCase):
def test_remove_prefix(self):
self.assertEqual(remove_prefix(['a', 'ab'], ""), ['a'])
self.assertEqual(remove_prefix(['a', 'ab', 'ac'], ""), ['a'])
self.assertEqual(remove_prefix(['a', 'ab', 'ac', 'b', 'ba', 'b... | true |
22b6cdd6c76de1061bbb30d96c80c15d03c1f910 | Python | Wattyyy/LeetCode | /submissions/valid-number/solution.py | UTF-8 | 351 | 3.078125 | 3 | [
"MIT"
] | permissive | # https://leetcode.com/problems/valid-number
class Solution:
def isNumber(self, s: str) -> bool:
invalids = {"inf", "-inf", "+inf", "Infinity", "-Infinity", "+Infinity"}
if s in invalids:
return False
try:
res = float(s)
return True
except ValueE... | true |
3c54026b524d35eae1dea89c25a59f08b94baf5a | Python | litakgit/DSAlgo | /IC_Problems/77_form_bst_from_pre_in_order.py | UTF-8 | 902 | 3.765625 | 4 | [] | no_license |
class BSTNode(object):
def __init__ (self, data, left=None, right=None):
self.data = data
self.left, self.right = left, right
def __repr__(self):
return str(self.data) + " left " + str(self.left) + " right " + str(self.right)
def form_tree(inorder, preorder ):
if not inorder or no... | true |
e9bbdcf6040698448a183d5004c24061e8d51dbc | Python | Tishacy/InstagramSpider | /instagram/instagram.py | UTF-8 | 8,032 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Author: Tishacy
# Date: 2021-03-26
import os
import logging
import pandas as pd
from .query import Query
from .parser import PostParser, CommentParser, TagPostParser
from .downloader import Downloader, Resource
from .common import POSTS_QUERY_HASH_PARAM, \
COMMENTS_QUERY_HASH_PARAM, TAG_P... | true |
08536f23fe92ac0d62557b23bc1699aea6faeb4c | Python | superpavelka/Python-basics | /py_tasks-2/py_tasks-2-1.py | UTF-8 | 446 | 3.375 | 3 | [] | no_license | my_list_1 = [6, 5, 8, 2, 7, 7, 4]
my_list_2 = [6, 7, 7, 8, 4]
# можем выдать на печать
print(set(my_list_1) - set(my_list_2))
# можем запихнуть в переменную и после распечатать
lst_diff = set(my_list_1) - set(my_list_2)
print(lst_diff)
# можно привести к листу и снова его напечатать
lst_diff = list(lst_diff)
print(type... | true |
1e7e7eaa306db7e14212fa9cd02621831f7d357f | Python | qaiser-mahmood/dnt | /Prototype_code/AltOCR/amazon_text.py | UTF-8 | 559 | 2.875 | 3 | [] | no_license | def OCR_amazon_text(path):
import boto3
# Read document content
with open(path, 'rb') as document:
imageBytes = bytearray(document.read())
# Amazon Textract client
textract = boto3.client('textract')
# Call Amazon Textract
response = textract.detect_document_text(Document={'Bytes... | true |
2b58ecc0d5ef0cf29e318cc3bcc5bdc0f116e518 | Python | NEleanor/compbio-galaxy-wrappers | /vcf_tools/var_select.py | UTF-8 | 1,335 | 2.671875 | 3 | [] | no_license | """
Select variants in a VCF.
Example usage: var_select.py 'input.vcf' 'fc' 'output.vcf'
var_select.py '/Users/onwuzu/Downloads/test_output_var_label.vcf' 'fc' --exclusive '/Users/onwuzu/Downloads/test_output_var_select.vcf'
Details: Select variants in input VCF.
"""
import argparse
import vcf_tools
VERSION = vcf_t... | true |
7168299d58881214563a0d59475a6c7eb126bc28 | Python | waynerbarrios/lab16 | /app.py | UTF-8 | 1,697 | 2.6875 | 3 | [] | no_license | from flask import Flask, request, render_template, jsonify, make_response, session
from forms import FormaLogin
import os
import db
app= Flask(__name__)
app.secret_key= os.urandom(32)
@app.route('/')
@app.route('/index')
def index():
if 'username' in session:
usu= session['username']
clave= sessio... | true |
820ef30b08851275d5a6d592badf50757c217439 | Python | JonasGroeger/ddns-inwx | /vendor/tldextract/tldextract.py | UTF-8 | 14,174 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""`tldextract` accurately separates the gTLD or ccTLD (generic or country code
top-level domain) from the registered domain and subdomains of a URL.
>>> import tldextract
>>> tldextract.extract('http://forums.news.cnn.com/')
ExtractResult(subdomain='forums.news', domain='cnn', suf... | true |
d136c178450cf488e6ae75cfd62921a0b884cbad | Python | jeevananthanr/Python | /PyBasics/tuples.py | UTF-8 | 590 | 4.21875 | 4 | [] | no_license | #Tuples
#constant/immutable list
num_tup=(1,5,'hello','Python',1.5)
print num_tup,"->",type(num_tup)
num_tup=tuple(range(5,11))
#reassign
num_tup=tuple(range(1,11))
print num_tup
#num_tup[5]=10 --will throw an error
#count
print num_tup.count(5)
#index
print num_tup.index(7)
print num_tup.index(7,3... | true |
0a1684fbe86523b22da0d94fe846123d7d2f2ebd | Python | Obarads/torchpcp | /torchpcp/modules/XTransformation.py | UTF-8 | 1,106 | 2.59375 | 3 | [
"MIT"
] | permissive | import torch
from torch import nn
from torchpcp.modules.Layer import Conv2D
class XTransform(nn.Module):
def __init__(self, in_channel, k):
super().__init__()
self.conv1 = Conv2D(in_channel, k*k, (1,k)) # [B, k*k, N, 1] # pf.conv2d is not this order
self.conv2 = Conv2D(k*k, k*k, (1,1), co... | true |
eada3d7a9daa581feffcfd64209deadca2ae4c28 | Python | billtubbs/game-learner | /test_tictactoe.py | UTF-8 | 6,662 | 3.296875 | 3 | [] | no_license | # !/usr/bin/env python
"""Unit Tests for tictactoe.py. Run this script to check
everything is working.
"""
import unittest
import numpy as np
from tictactoe import TicTacToeGame, GameController, RandomPlayer, \
TicTacToeExpert
from gamelearner import train_computer_players
class TestTicTacToe... | true |
d686e9c45b277b1d9bdf2748b89cf376b959ea54 | Python | luroto/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/1-search_replace.py | UTF-8 | 350 | 3.328125 | 3 | [] | no_license | #!/usr/bin/python3
def search_replace(my_list, search, replace):
if my_list is None:
return(my_list)
else:
newlist = my_list.copy()
for i in range(len(my_list)):
if my_list[i] == search:
newlist[i] = replace
else:
newlist[i] = my_li... | true |
6706b43700491b765aa2a11a65121f6ca9c582d1 | Python | AdityaMalani/RSA | /rsa.py | UTF-8 | 1,647 | 3.296875 | 3 | [] | no_license | import math
import random
def isPrime(num):
for i in range(2,int(num/2)+1):
if(num%i==0):
return 0
return 1
def calculateE(p,q,phi):
list1 = []
for e in range(2,phi):
if math.gcd(e,phi) == 1:
list1.append(e)
return list1
def calculateD(phi,e):
for d in range(1,phi):
if (d*e)%phi is 1:
return d
... | true |
580db10085397c9ca3abaea93b075c4ac4056c28 | Python | Smurodkhon12/lesson1 | /text1/10_dars.py | UTF-8 | 1,411 | 3.140625 | 3 | [] | no_license | # import time
# soat = []
# minut = []
# sekund = []
# if input("soat, minut yoki sekund kiriting: ") == soat:
# print(time.strftime("%H"))
# elif input("soat, minut yoki sekund kiriting: ") == minut:
# print(time.strftime("%M"))
# elif input("soat, minut yoki sekund kiriting: ") == sekund:
# print(time.str... | true |
bb310197ac8e241b51ab733b11581e3fe5c9c6d7 | Python | MouseLand/kesa-et-al-2019 | /EnsemblePursuitModule/EnsemblePursuitNumpyFast.py | UTF-8 | 13,229 | 2.6875 | 3 | [] | no_license | import numpy as np
import time
from sklearn.cluster import KMeans
def fit_one_ensemble_seed_timecourse(X, C, seed_timecourse = [], lam = 0.005):
NT, NN = X.shape
valid_neurons=np.ones((NN,),dtype=bool)
bias = seed_timecourse @ X
current_v = seed_timecourse
C_summed = bias.flatten()
iorder = ... | true |
f4d0fbd414f453917913aed6c37e8f712e58fc49 | Python | lwang-astro/Agama | /pytests/example_self_consistent_model3.py | UTF-8 | 8,282 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
"""
Example of construction of a three-component disk-bulge-halo equilibrium model of a galaxy.
The approach is explained in example_self_consistent_model.py;
this example differs in that it has a somewhat simpler structure (only a single stellar disk
component, no stellar halo or gas disk).
Another m... | true |
4ba29ecb372db94b8082aa66de1036c271904c0a | Python | sormehka/PaymentCode | /src/antifraud.py | UTF-8 | 7,664 | 3.265625 | 3 | [] | no_license | import csv
import pandas as pd
import sys
import numpy as np
def parse_input(batch_file, stream_file, batch_file_fixed, stream_file_fixed): # 1. The message column contains extra commas which complicates the import with separator ','. The files were fixed using split command and saved as new csv files\
with open... | true |
ac4c281432301ceb27ffe71da5326688d7f962dd | Python | junefish/adventofcode | /adventofcode2022/day19/day19problem1.py | UTF-8 | 1,207 | 2.890625 | 3 | [] | no_license | blueprints = []
with open('adventofcode2022/day19/day19example.txt') as input:
for line in input:
label = (line.strip().split(': '))[0].split(' ')
number = int(label[-1])
list = []
robots = (line.strip().split(': '))[-1].split('. ')
for bot in robots:
inf... | true |
5743398f487fcceb3247a0ee2e76cc624f565c9d | Python | anisimovkv/sudoku | /src/test_sudoku.py | UTF-8 | 1,422 | 3.140625 | 3 | [] | no_license | import unittest
from typing import Tuple
import numpy as np
from .sudoku import sudoku_solver
class MyTestCase(unittest.TestCase):
def test_sudoku_solver(self):
input, expect_output = self.init_data()
output = sudoku_solver(input.copy())
print(input)
print(output)
print(... | true |
cee6a7df33c05f87ab8353a6c7877fb6542a0402 | Python | yanruibo/machine-learning | /bayes/preprocess_data.py | UTF-8 | 720 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
# encoding: utf-8
'''
Created on Nov 6, 2015
@author: yanruibo
'''
import numpy as np
if __name__ == '__main__':
data = np.loadtxt(fname='unformatted-data.txt', dtype=np.int64, delimiter=',')
data = np.delete(data, [0], axis=1)
for i in range(len(data)):
if(data[i,0]==2):
... | true |
b6733c2077bb1a4a5ab1615f454da4efe08c29fa | Python | deku-M-O/zuoye | /作业4.py | UTF-8 | 193 | 3.265625 | 3 | [] | no_license | print(5*"*")
for i in range(3):
print(1*"*"+3*(" ")+1*"*")
print(5*"*")
def fang(a):
print(a*"*")
for i in range(a):
print(1*"*"+(a-2)*(" ")+1*"*")
print(a*"*")
fang(8) | true |
21fae895fd99cb9fc7445a0c41bf6c2d3825fa6e | Python | Jomij/ml2 | /nnet.py | UTF-8 | 483 | 2.90625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plf
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
data = pd.read_csv("train.csv").as_matrix()
print("Matrix data\n",data)
clf = DecisionTreeClassifier()
X_train = data[0:21000,1:]
Y_train = data[0:21000,0]
X_test = data[21000:,1:]
Y_test = data[210... | true |
41ae3bc502fb6639764742da7f442373084c105c | Python | jiangshipan/zy-web | /zy-web/service/user_service.py | UTF-8 | 669 | 2.734375 | 3 | [] | no_license | # coding=utf-8
class UserService(object):
def __init__(self):
self.__user = {
'jiangshipan': '123456',
'zhangzhiyu': '123456',
'yangboxin': '123456'
}
self.login_token = {
'jiangshipan': '123456_login',
'zhangzhiyu': 'qqqqq_login',... | true |
670c5e0d6984baa4e42794598c82db99333bf2fe | Python | PeterZhangxing/codewars | /no_five.py | UTF-8 | 239 | 3.578125 | 4 | [] | no_license | #!/usr/bin/python3.5
def dont_give_me_five(start,end):
n = 0
for i in range(start,end+1):
if '5' not in list(str(i)):
n += 1
return n
if __name__ == "__main__":
n = dont_give_me_five(4,17)
print(n) | true |
c0870ca1471613a57bcc3a695c670cbcc1c9f510 | Python | XuanC6/Identifying-Duplicate-Questions | /DupQues/src/trainer.py | UTF-8 | 5,516 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import random
class Trainer:
def __init__(self):
self.data1 = None
self.data2 = None
self.length1 = None
self.length2 = None
self.labels = None
self.data_idxs = None
def _feed_raw_data(self, raw_data, shuffle_flag=True):
... | true |
96a6b3bb1846472d5a2e6df6f5e2b297f6ff6263 | Python | ayushbansal323/TE | /python/sudoku.py | UTF-8 | 1,317 | 3.140625 | 3 | [] | no_license | import random
def makesudoku():
a=[[0,0,0],[0,0,0],[0,0,0]]
iCount=int(random.uniform(1,9))
jCount=int(random.uniform(1,4))
i=0;
do=1
while(do == 1):
a=[[0,0,0],[0,0,0],[0,0,0]]
i=0;
while i<iCount:
j=int(random.uniform(1,4))-1
no=int(random.uniform(1,4))
if no not in a[j]:
if no != a[0][i%3] ... | true |
2f1eebb592dc64b4e6653e4a0522cd02796bb8df | Python | ballaneypranav/rosalind | /archive/scsp.py | UTF-8 | 665 | 3.40625 | 3 | [] | no_license | def main():
a = input()
b = input()
print(interleave(a, b))
archive = {}
def interleave(a, b):
if (a, b) in archive.keys():
return archive[(a, b)]
elif len(a) <= 1 or len(b) <= 1:
result = a + b
archive[(a, b)] = result
return result
elif a[0] == b[0]:
... | true |
0776d7c9de1c69ab7c25673481e6e808e0f3c9e1 | Python | noza7/Python_Home | /pro_store/change_pics/pics/new.py | UTF-8 | 1,064 | 2.84375 | 3 | [] | no_license | import cv2
import numpy as np
def cvt_background(path, color):
"""
功能:给证件照更换背景色(常用背景色红、白、蓝)
输入参数:path:照片路径
color:背景色 <格式[B,G,R]>
"""
im = cv2.imread(path)
im_hsv = cv2.cvtColor(im, cv2.COLOR_BGR2HSV)
aim = np.uint8([[im[0, 0, :]]])
hsv_aim = cv2.cvtColor(aim... | true |
a3e803e8f5497ce9c589ac05c6a53d3beb24b312 | Python | Eric-L-Manibardo/CaseStudy2020 | /MADRID_code/Deep Learning/02-Test/NAIVE_test.py | UTF-8 | 694 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 25 14:24:26 2020
@author: eric
"""
import numpy as np
import pandas as pd
from sklearn.metrics import r2_score
espiras = ['4458','6980','10124','6132','3642','4192','3697','3910','3500', '5761']
#Loop about 4 studied forecasting horizons t+1,t+2... | true |
0c9defff6cd9dbd846376e74522763af9b287199 | Python | alexteachey/MoonPy | /export_conda_env_to_yml.py | UTF-8 | 1,016 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
### identify your working environment
current_environment = os.environ['CONDA_DEFAULT_ENV']
### export this environment to a .yml file
output_name = input("What name do you want to give the output environment file? (Press ENTER to keep it the same as the current environment): ")
if output_name == '':
out... | true |
425fa42a12f2bcb27aef6dfcdf7de7a4cdd1895d | Python | yassine2403/GOMYCODE | /aaslema5.py | UTF-8 | 110 | 3.75 | 4 | [] | no_license | import math
x=input("enter a number ")
print("the factorial of ur number is "+str(math.factorial(int(x))))
| true |
467c56d6f9bfeac4d143155c7f568bd35481df14 | Python | gitshangxy/tutorial | /L44并发和异步IO/3主线程和子线程.py | UTF-8 | 844 | 3.5625 | 4 | [] | no_license | import threading
import time
def run(n):
""" 倒计时 """
print('task', n)
time.sleep(1)
print('2s')
time.sleep(1)
print('1s')
time.sleep(1)
print('0s')
time.sleep(1)
for i in range(3):
# 生成子线程
t = threading.Thread(target=run, args=('t{}'.format(i),))
t.setDaemon(True)
t... | true |
34b8a5776a0af73faa08fe923a974a24c41a6fed | Python | tlillis/ai3202 | /Assignment7/prior.py | UTF-8 | 1,552 | 2.875 | 3 | [] | no_license | import helpers
from random import random
print("Prior Sampling\n")
raw_samples = helpers.getSamples()
samples = []
raw_samples = []
for i in range(len(raw_samples)):
if (i) % 4 == 0:
sample = {
"c": raw_samples[i],
"s": raw_samples[i+1],
"r": raw_samples[i+2],
... | true |
dfe71e1361aeafda6649116e93dc0d39473e02c0 | Python | nyquist/scorobot | /games/game.py | UTF-8 | 5,680 | 2.78125 | 3 | [] | no_license | import time
import random
from globalcfg import backend
from games.players import Team, SinglePlayer
from games.rules import SoccerChampionship
import pprint
class Game:
def __init__(self, team1, team2, score1, score2,duration='90'):
global backend
self.teams = (team1, team2)
self.score = (... | true |
6c619c5b1d6abdc4704c1db1ddb7a6db272a7457 | Python | IRTSA-SoftwareProject/IRTSA-Server | /server/commands/ris_processing/read_ris.py | UTF-8 | 4,329 | 3.40625 | 3 | [] | no_license | """ Created on 11 Apr. 2018
This module provides a method to read *.ris files into a numpy
multidimensional array. Note that *.ris files are 16-bit per pixel.
<<<<<<< HEAD
@author: James Moran [jpmoran.pac@gmail.com]
"""
import re
import numpy
import struct
def _get_metadata(file):
""" Read the metadata of the *... | true |
f151219fc26686f940d9a9a67ac4c474b22f87f9 | Python | BenPortner/panflute-filters | /filters/tabulate-elements.py | UTF-8 | 1,102 | 2.703125 | 3 | [] | permissive | """
Count frequency of each element
Sample usage:
> pandoc example.md -F tabulate-elements.py --to=markdown
Element Freqency
------------- ----------
MetaBool 2
SoftBreak 1
Str 46
MetaInlines 18
RawInline 7
Doc 1
MetaBlocks 1
... | true |
9489c50102fc9b6740df2bebef2877640b9bd996 | Python | Gobidev/discord-mute-bot | /config_viewer.py | UTF-8 | 2,676 | 2.859375 | 3 | [] | no_license | import os
import pickle
guilds = []
class Guild:
"""Class to save the configuration for individual guilds"""
def __init__(self, guild):
self.name = str(guild)
self.guild_id = guild.id
self.is_muted = False
self.game_channel_name = "Crew"
self.dead_channel_name = "Ghost... | true |
767e5332a67360f3879e0433c8739a8d9dc97387 | Python | yunjung-lee/class_python_numpy | /DataAnalysis/day1_3/HomeWork.py | UTF-8 | 487 | 2.921875 | 3 | [
"MIT"
] | permissive | import re
emails = ['python@mail.example.com', 'python+kr@example.com', # 올바른 형식
'python-dojang@example.co.kr', 'python_10@example.info', # 올바른 형식
'python.dojang@e-xample.com', # 올바른 형식
'@example.com', 'python@example', 'python@examp... | true |
0289f1f5d51ccb978c08e7fafaeb9c7a1c665aac | Python | rtealwitter/QuantumQueryOptimizer | /paper/experiments.py | UTF-8 | 12,387 | 2.609375 | 3 | [
"MIT"
] | permissive | import quantum_query_optimizer as qqo
import numpy as np
import matplotlib.pyplot as plt
import random
def get_domain_all(n):
'''
Parameters:
n : size of bit string
Returns:
D : list of all n-bit strings
'''
return [np.binary_repr(i, width=n) for i in range(2**n)]
... | true |
8d73dd79189933b0270f60d53171c3e7da4f17a0 | Python | kapsitis/ddgatve-stat | /youtube-data/scraper/sentiment_analysis.py | UTF-8 | 4,622 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import os
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
import nltk
import time
from selenium import webdriver
from selenium.webdriver import ChromeOptions
from selenium.webdriver.common.by import By
from selen... | true |
c05140ba9fbfdd4d457255e6a9a3cf154a5ebce0 | Python | rackerlabs/openstack-usage-report | /usage/reading.py | UTF-8 | 9,986 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import copy
from exc import NoSamplesError
from exc import UnknownCounterTypeError
from log import logging
from conversions import convert
from conversions.time_units import seconds_to_hours
from data import trim
ALLOWED_METER_TYPES = set(['gauge', 'cumulative', 'delta'])
logger = logging.getLogger('usage.reading')
... | true |
54773670c8c14383fa0dc12930b3148eba788008 | Python | nicholasvoltani/Programas-feitos-durante-a-Graduacao | /Introdução ao Caos/Strogatz-Example/strogatz_example.py | UTF-8 | 1,005 | 3.1875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
iteration = lambda x,p: np.sin(x)/p
ps = np.linspace(1.1, 0, 5000)
x0 = 0.001
x1 = -0.001
Ttrans = 1000
Tstat = 1000
plt.figure()
## Points which will be plotted
xf = []
pf = []
for p in ps:
xu = x0
xb = x1
## Removing the transient
for i in ran... | true |
583b8d2572f45275ea8d2bf7e06fd697be1be210 | Python | sask1217/ai3202 | /Assignment5/Sam_Skolnekovich_Assignment5.py | UTF-8 | 7,204 | 3.03125 | 3 | [] | no_license | # Sam Skolnekovich
# HW5
# 10/07/15
'''
' Calculating this with different values for error changes the program a great deal.
' This program is set to break for suboptimal solutions.
' Some of the nodes will act as sinks for the print function and will cause a never ending loop.
' To fix for finding suboptimal solutio... | true |
10036f99b909b0ae2c5128817c72fd0af417b7c5 | Python | judong-520/QT_trade | /cg/cg_spot/huobi_exchange.py | UTF-8 | 7,609 | 2.796875 | 3 | [] | no_license | import json
import pandas as pd
from urllib.request import urlopen, Request
pd.set_option('expand_frame_repr', False) # 当列太多时不换行
# API 请求地址
BASE_URl = "https://api.huobi.pro"
def get_url_content(url, max_try_number=5, headers=None):
"""抓取数据"""
try_num = 0
while True:
try:
request ... | true |
db3fa10ac98c7c89a6d0746f54eb6c77db1b499a | Python | Potatology/coding | /balanced_p.py | UTF-8 | 414 | 3.1875 | 3 | [] | no_license | import stack
def balancedParents(parents):
closedParentStack = stack.Stack()
for parent in parents:
if parent=='(':
closedParentStack.push(')')
else:
if closedParentStack.isEmpty():
return False
else:
closedParentStack.pop()
... | true |
127feeebca8b7d09f28845de1f71d2a3411c72e2 | Python | DheerajJoshi/Python-tribble | /Dictionary/src/built In Directory function/typedict.py | UTF-8 | 97 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
dict1 = {'Name': 'Zara', 'Age': 7};
print ("Variable Type : %s" % type (dict1)) | true |
ce138302c95e08689188eb2f8706edfce2d9693d | Python | bolivierjr/advent-of-code | /2018/day05/day05_pt2.py | UTF-8 | 1,188 | 3.265625 | 3 | [] | no_license | import os
from string import ascii_lowercase
directory = os.path.dirname(os.path.abspath(__file__))
filename = os.path.join(directory, 'input.txt')
with open(filename, 'r') as fp:
data = fp.read()
def reactors2(polymers: str) -> int:
not_found = True
polymer_lengths = set()
while not_fo... | true |
5ad9a69ad1bb0bb46bdd82454abe84e30dc8bce3 | Python | jessedezwart/De_Wah | /motor.py | UTF-8 | 1,583 | 2.828125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
# set gpio mode
GPIO.setmode(GPIO.BCM)
# set pins
left_engine_pins = [17,4,3,2]
right_engine_pins = [27,22,10,9]
for pin in left_engine_pins:
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, 0)
for pin in right_engine_pins:
GPIO.setup(pin, GPIO.OUT)
GPIO.o... | true |
a03c0bbcd80f8808b92319d93d6edb141a00bb79 | Python | redpanda-ai/ctci | /solutions/successor.py | UTF-8 | 1,307 | 3.875 | 4 | [] | no_license | class Node:
def __init__(self, value, left=None, right=None, parent=None):
self.value = value
self.left = left
self.right = right
self.parent = parent
def set_left(self, other):
self.left = other
other.parent = self
def set_right(self, other):
self.r... | true |
20b1498b757d3ff141ac49b2f207a1a6b416665a | Python | jffcole7/Bioinformatics | /egglib_sliding_windows.py | UTF-8 | 27,195 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# egglib_sliding_windows.py
# calculate ABBA-BABA stats, dxy, pi and S for sliding windows in genomic data
# Written for "Evaluating the use of ABBA-BABA statistics to locate introgressed loci"
# by Simon H. Martin, John W. Davey and Chris D. Jiggins
# Simon Martin: shm45@cam.ac.uk
# John Davey:... | true |
2902b2a26cbcbeff567b94c1aa98a3fb0bd39b01 | Python | hsnsd/ai-explore | /simple_arbitrage.py | UTF-8 | 1,426 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 20 23:31:44 2018
@author: hsnsd
A simple program to give you arbitrage opportunity of any input coin using cryptonator's api.
"""
import pandas as pd
import requests
import json
from matplotlib import pyplot as plt
import numpy as np
def getArbitr... | true |
57987f36113a1e5ea5184dd902eb7f7b7d679740 | Python | aligg/PythonPractice | /diceroller.py | UTF-8 | 1,244 | 4.125 | 4 | [] | no_license | from random import randint
name = input("Welcome to the dice game, what's your name?")
answer = input("Hey there %s. In the dice game the rules are as follows: You get three turns total. If you roll a 1 you get 0 points and a 6 gets you 10 points. For all other rolls, the score matches the number on the dice. Are you ... | true |
4c88c526aec8e55a0e580283829d5b0774187428 | Python | eastrd/HighAnonProxyPool-v2 | /scrapers/hidemy.name.py | UTF-8 | 1,386 | 2.671875 | 3 | [] | no_license | from framework import scrape
from db import save_new_proxy_record
from time import sleep
from loglib import log_print
time_interval = 60 * 10
# Genearlize URL template to hold all proxy urls
url_template = "https://hidemy.name/en/proxy-list/?type=hs&anon=4&start={NUM}#list"
# url_pages are a list of strings to be i... | true |
9fea6bb200237bbe51e1fd2c055cbf0db14319ed | Python | vendyv/A2OJ-Ladders | /A2OJ-11/075_B_Fence.py | UTF-8 | 582 | 3.1875 | 3 | [
"MIT"
] | permissive | """
75 Fence - https://codeforces.com/problemset/problem/363/B
"""
def main():
n, k = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l[:k])
min = s
x=0
for i in range(1,n-k+1):
s = s - l[i-1] + l[k+i-1]
# print(sum(l[x:i]))
if s < min:
... | true |
b5917b741bde0d8847796609d90672b6d15554b3 | Python | mit308/OpenCV | /Working on Images/Adding or merging two images.py | UTF-8 | 324 | 2.703125 | 3 | [] | no_license | import cv2
import numpy as np
img=cv2.imread("messi5.jpg")
img2=cv2.imread("opencv-logo-white.png")
# Resizing the two images to add or merge
img=cv2.resize(img, (512, 512))
img2=cv2.resize(img2, (512, 512))
merge=cv2.add(img, img2) # Merging two images
cv2.imshow('Messi', merge)
cv2.waitKey(0)
cv2.destroyAllWindo... | true |
5dea282a965c085389b936b44c9f05cdcae4aa8c | Python | deedee1886-cmis/deedee1886-cmis-cs2 | /textgame.py | UTF-8 | 1,271 | 3.859375 | 4 | [
"CC0-1.0"
] | permissive |
#Stranded on an island is a program that will ask the user to make many choices, their choices will determine their survival on this uninhibited island.
a = raw_input("type your name here ")
print "Welcome to, Stranded on an Island"
print "Hello " + str(a) + ", your ship have crashed and you have been stranded on isl... | true |
6b21f583f8660ff2c3dfbfa17a69f3a738c3f0b8 | Python | UOSAN/DEV_scripts | /fMRI/fx/models/SST/direct_regression/experiment_with_whole_brain_task_alignment.py | UTF-8 | 525 | 2.734375 | 3 | [] | no_license |
#what would it look like to take each whole-brain series, and align it to the moment of the tone?
#then we would have to have a series of images associated with each trial, and a set of metadata capturing the trials those images related to
#then we could produce maps of the max and min activity; but we still wouldn't... | true |
38f276c2920a0baf18754d38e09b714d80f8d618 | Python | albertosanfer/MOOC_python_UPV | /Módulo 2/Práctica2_4.py | UTF-8 | 321 | 3.96875 | 4 | [
"Apache-2.0"
] | permissive | # El código a continuación tiene un **input** que solicitará tu nombre y un
# **print** que tratará de darte la bienvenida. Modifica la variable bienvenida
# de modo que concatene tu nombre dentro del mensaje de bienvenida.
nombre = input('¿Como te llamas?')
bienvenida = 'Bienvenid@ : ' + nombre
print(bienvenida)
| true |
a9d7432cdf89eabc454e1b65cd8329c5b01cd788 | Python | geoolekom/vkart | /vkapi/group_classification/feature.py | UTF-8 | 784 | 2.609375 | 3 | [] | no_license | from .. import api as vkapi
from pprint import pprint
import re
from .parameters import max_posts
def text_process(s):
return ' '.join(filter(lambda x: len(x) > 0, re.sub('[^a-zA-Zа-яА-Я ]', '', s.replace('\n', ' ').lower()).split(' ')))
def extract_text(api, group_id, **kwargs):
texts = vkapi.get_group_tex... | true |
17ddaf3109e64561b68be5dd6e20f2127db60a74 | Python | sn8ke01/movieranker | /test.py | UTF-8 | 2,143 | 3.1875 | 3 | [] | no_license | import bs4
import collections
import re
import csv
with open('movie_ratings.csv') as csvfile:
read_csv = csv.reader(csvfile, delimiter=',')
x = "TITANIC"
for row in read_csv:
#print(row)
print(re.search(x, str(row)))
# reMovieList = collections.namedtuple('MovieList', 'rank, ... | true |
248969e3bb197f5d7e80c5949d8932d3592bf64d | Python | CaimeiWang/python100 | /080.py | UTF-8 | 874 | 4 | 4 | [] | no_license | '''
海滩上有一堆桃子,五只猴子来分。第一只猴子把这堆桃子平均分为五份,多了一个,这只猴子把多的一个扔入海中,拿走了一份。
第二只猴子把剩下的桃子又平均分成五份,又多了一个,它同样把多的一个扔入海中,拿走了一份,第三、第四、第五只猴子都是这样做的,问海滩上原来最少有多少个桃子?
'''
#method1:
for n in range(6,10000):
m = n
for i in range(5):
a=m//5
b=m%5
m=m-a
if b!=1:
break
if b==1:
print(n)... | true |
40e118395751605624c927214ce0c2fed784e96a | Python | turovod/Otus | /4_Data_Driven_Testing/Iterators/example4-generator-function.py | UTF-8 | 492 | 2.609375 | 3 | [
"MIT"
] | permissive | import gzip, bz2
from pathlib import Path
def gen_open(paths):
for path in paths:
if path.suffix == '.gz':
yield gzip.open(path, 'rt')
elif path.suffix == '.bz2':
yield bz2.open(path, 'rt')
else:
yield open(path, 'rt')
def gen_cat(sources):
for sr... | true |
4e4472c3c4cd0822b0c3d4251d4447e25c082f38 | Python | Linuxoid-Rostyan/Text-Generator | /text_generator.py | UTF-8 | 2,388 | 3.015625 | 3 | [] | no_license | from nltk.tokenize import regexp_tokenize
from nltk import bigrams
from collections import Counter
from string import ascii_uppercase
import random
file = open(input(), "r", encoding="utf-8")
bigram_list = list(bigrams(regexp_tokenize(file.read(), r'\S+')))
file_list = [str(bigram[0]) for bigram in bigram_list]
trigram... | true |
75b5c57c94d275053e0bc2566bf8e34f41e8631e | Python | SJ12896/TIL | /startcamp/day1/lunch.py | UTF-8 | 342 | 3.171875 | 3 | [] | no_license | menu = ['예향정', '장가계', '첨단공원국밥']
# print(menu)
# print(menu[0], menu[-1])
phone_book = {'예향정' : '123-123', '첨단공원국밥' : '456-456', '장가계' : '789-789'}
# print(phone_book)
# print(phone_book['첨단공원국밥'])
import random
print(f'{phone_book[random.choice(menu)]} 의 전화번호는 {123}') | true |
e4d0990f78266c3ce0c1b245f6fdf5e8c9774c28 | Python | yuwinzer/GB_Python_basics | /hw_to_lesson_01/6_sport.py | UTF-8 | 719 | 3.609375 | 4 | [] | no_license | num_1day = int(input("Введите количество километров за первый день пробежки: "))
min_dist = int(input("Введите минимальное расстояние, которое должен пробежать спортсмен: "))
print(f"1-й день: {num_1day} км")
next_day_dist = num_1day
a = True
i = 2 # начинаем цикл со второго дня
while a:
next_day_dist += next_da... | true |
7a94a72669119f42c7f03a87bad0a9405d4f0b06 | Python | krishnakrib/wer | /char1.py | UTF-8 | 140 | 3.109375 | 3 | [] | no_license | test_str="geeksforgeeks"
count=0
for i in test_str:
if i=='e':
count=count+1
print("count of e in geeksforgeeks=" + str(count))
| true |
df6aff3a98bedb5f065b579c5bd2fb065922df5d | Python | Aasthaengg/IBMdataset | /Python_codes/p03626/s403375817.py | UTF-8 | 603 | 3 | 3 | [] | no_license | n = int(input())
s = [list(input()), list(input())]
MOD = 1000000007
dp = [0]*n
if s[0][0] == s[1][0]: # tate
dp[0] = 3
else: # yoko
dp[0] = 6
for i in range(1,n):
if s[0][i] == s[0][i-1]:
dp[i] = dp[i-1]
elif s[0][i-1] == s[1][i-1] and s[0][i] == s[1][i]: # tate & tate
dp[i] = dp[i-1... | true |
6d76d1da4fd44827f742ae24b113581a2b19ebcc | Python | osamhack2021/AI_MaskDetector_Kitty | /tests/test_mask_detector.py | UTF-8 | 1,265 | 2.8125 | 3 | [
"MIT"
] | permissive | import pytest
import cv2
import numpy as np
import tensorflow as tf
from mask_detector import MaskDetector, FacenetDetector
test_image_filename = "resource/sample/image/pexels-gustavo-fring-4127449.jpg"
@pytest.fixture
def faces():
facenet_detector = FacenetDetector()
faces, _, _ = facenet_detector.detect_f... | true |
4ff7788fe49350a7f539c567dee8c68c23c170f3 | Python | ChengHsinHan/myOwnPrograms | /CodeWars/Python/8 kyu/#238 String Templates - Bug Fixing #5.py | UTF-8 | 255 | 3.15625 | 3 | [] | no_license | # Oh no! Timmy hasn't followed instructions very carefully and forgot how to use
# the new String Template feature, Help Timmy with his string template so it
# works as he expects!
def build_string(*args):
return "I like {}!".format(", ".join(args))
| true |
a7fc25b61458359ac469cd50a5d8e0acd0260b8f | Python | badHax/Simplified-RSA | /Scripts/client.py | UTF-8 | 3,846 | 3.484375 | 3 | [] | no_license | # Client to implement simplified RSA algorithm.
# The client says hello to the server, and the server responds with a Hello
# and its public key. The client then sends a session key encrypted with the
# server's public key. The server responds to this message with a nonce
# encrypted with the server's public key. The c... | true |
bc8d26969e88bf3739dd3610d95b316c9ac00e11 | Python | elisa-lj11/tier2019 | /scrapers/blog_scraper.py | UTF-8 | 1,883 | 2.75 | 3 | [] | no_license | # Created by Elisa Lupin-Jimenez
# Program to scrape HTML formatted blog code for text comments and posts
# outputs a new text file with just the comments and posts
import os
#from html.parser import HTMLParser
from bs4 import BeautifulSoup
#from selectolax.parser import HTMLParser
# Change this to read data from a s... | true |
fe7137a1bd8a6b68c40ba34ad33c0b2f964875e5 | Python | code-moe/copycat | /#14 Phyton List Set and Timer.py | UTF-8 | 922 | 3.578125 | 4 | [] | no_license | #name : Python List Set and Timer
#author : CodeMoe
#date : 23 August, 2019
#true-a : Code taken from Shirayuki-sama from Python Discord
#import modules Timer and ascii_letters
from timeit import Timer
from string import ascii_letters
#fill list_a & list_b with ascii letters
list_a = list(ascii_letters)
list_b = ... | true |
c9d8c1afa3f1b4d2a7abfd78e68fad3af58628ed | Python | zhangxi0927/mycube | /mycube_code/mycube_3d.py | UTF-8 | 20,718 | 2.578125 | 3 | [] | no_license | from vpython import *
import sys
import serial
import glob
import random
import kociemba
import numpy as np
import cv2
fps=12
turnNumber=0
scene.title = 'cube' # 设置窗口标题
faces={'F': (color.green, vector(0, 0, 1)),
'B': (color.blue, vector(0, 0, -1)),
'U': (color.yellow, vector(0, 1, 0)),
'L': (color.red, ... | true |
7eba93896858bb2ff8a3b18a03c5c523bc5b71d5 | Python | duguxy/pycoldatom | /pycoldatom/functions/centerofmass.py | UTF-8 | 1,545 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
"""Center of mass algorithm based on Fourier transform and filtering"""
import numpy as np
def center_of_mass(img):
"""Find the center of mass of a focused spot on a noisy background.
This is done by the Fourier transform method as discussed by Weisshaar et al.
(http://www.mnd-umwe... | true |
b6e2874102f3b69a783f39030d2ea5c5d68e408c | Python | MJDeeks/AFPwork | /splicing_introns.py | UTF-8 | 612 | 3.78125 | 4 | [] | no_license | #part 1
my_dna = 'ATCGATCGATCGATCGACTGACTAGTCATAGCTATGCATGTAGCTACTCGATCGATCGATCGATCGATCGATCGATCGATCGATCATGCTATCATCGATCGATATCGATGCATCGACTACTAT'
ex1 = my_dna [0:63]
ex2 = my_dna [90:]
print('Original seqence {0} \n'.format(my_dna))
print('Coding ex 1: {0} \nCoding ex 2: {1}'.format(ex1, ex2))
#used [] instead of {}
#par... | true |
750301025bad947c008f01df55e5a3749db2a970 | Python | nbudin/solidfuel | /solidfuel/Controllers/curves.py | UTF-8 | 7,245 | 3.40625 | 3 | [] | no_license | # -*- tab-width: 4 -*-
import math, random
class Curve:
def __init__(self, start, length=None):
self._start = start
self._length = length
if self._length is not None:
self._end = start + length
else:
self._end = None
def start(self):
return self... | true |