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 |
|---|---|---|---|---|---|---|---|---|---|---|
d8e85ea8f77eed0229df58f099349d05a88ffae7 | JackMcCrack/adventofcode2020 | /day02/task2.py | UTF-8 | 509 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python3
lines=open("input", "r")
valid = 0
for i in lines:
i = i.strip()
s = i.index(':')
rule = i[0:s].split()
pw = i[s+2:len(i)]
rule_limit = rule[0].partition('-')
rule_min = int(rule_limit[0])-1
rule_max = int(rule_limit[2])-1
count = pw.count(rule[1])
print(pw[rule_mi... | true |
321423b5e627eb8fe7e78f18fa62e067569c89f2 | Benjamin-coder1/Fake_news_detector | /FakeNewsDetector/fonctions/other_tests.py | UTF-8 | 2,062 | 3.328125 | 3 | [] | no_license | import urllib.request
import rech
import error
def get_list_fake_sources() :
"""
DESCRIPTION
this function is used to recover a list of web sites gessed as carriers
of fake news
PARAMETERS
None
OUTPUT :
out1 : list
The list of the web sites
"""
# we recover the data from wikipedi... | true |
5c807caf833d12bedea05acaac02e821f9daf517 | katieannedavis/cx_freeze_help | /setup.py | UTF-8 | 2,562 | 2.5625 | 3 | [] | no_license | import sys
import os
from cx_Freeze import setup, Executable
# single files in the same folder can have just their names, to include everything in a folder give folder name
# cx_freeze will create a folder in the program of the same name
includefiles = ['example.py', 'example.ico', 'examples/', 'example.jpg']
... | true |
eef26823b613c89593b28f02dae27a10db3ab1b4 | LittleRabbitHole/FilterBubble-2016 | /get_clean_tweets.py | UTF-8 | 8,324 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 22 11:07:30 2016
from original tweets to get clean tweets and save as csv
@author: Ang
"""
import re
import json
import os
import pandas as pd
f = open("Trump_friends100tweets.txt","r")
f_tweet = open("Trump_friends100_cleantweets.txt", "w")
f_tweet.write('user'+'\t\t'+"... | true |
8680a3da3592d77108e4d5dc94fa522e45fb29c8 | 921016124/Spiders | /module/链家/spider.py | UTF-8 | 2,365 | 2.734375 | 3 | [] | no_license | """
url = https://hf.anjuke.com/
method:post
"""
import requests
from lxml import etree
from pymongo import MongoClient
def Mongo():
# Python 操作 MongoDB
conn_mongo = MongoClient("127.0.0.1", 27017)
db = conn_mongo.SunLine # 连接 mydb 数据库,没有则自动创建
return db.LianJia # 使用test_set集合,没有则自动创建
headers = {
... | true |
80376709457cfbce75486517928cfa7b3126e41d | wujcheng/timecat | /utest/test_locate_current_line.py | UTF-8 | 1,204 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
from include import *
from timecat import locate_current_line
dataset_index = 0
def judge(f, st, ed):
global dataset_index
dataset_index += 1
print("\ndataset[{}]".format(dataset_index))
#locate_current_line(f, ed, st)
locate_current_line(f, ed, st, 2)
... | true |
9cceb31c950dbefe36c82cb77ac28420229650b7 | SemiMaks/Practice_Python | /decorators.py | UTF-8 | 378 | 3.5625 | 4 | [] | no_license | from datetime import datetime
def one():
start = datetime.now()
l = []
for i in range(10**4):
if i % 2 == 0:
l.append(i)
print(datetime.now() - start)
return l
def two():
start = datetime.now()
l = [x for x in range(10**4) if x %2 == 0]
print(datetime.now() - start... | true |
167d7b4957bcb948ca0e7bceee3edb9076e1189b | HajimeKawahara/bluedot | /bluedot/iouvspec.py | UTF-8 | 1,657 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import argparse
import subprocess
from subprocess import Popen, PIPE
import time
import numpy as np
def uvspec_form1(inputfile):
# output: lamb (wavelength), rad (uu(umu(0),phi(0)) in libradtran (see p26)
# mW/(m 2 nm sr) for solar_flux
p = Popen(["uvspec", "-i", inputfile], s... | true |
cdcda45d25aa81a770a20e8eeb6bae9545dc52e2 | K-JW/Z_Jets | /Z+Jets/preproccess/check_file.py | UTF-8 | 2,533 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
FileName: check_file.py
Version: 1.0
License: MIT License
Author: KANG Jin-Wen
E-Mail: kangjinwen@vip.qq.com
Date: 2019-10-17 14:28:11
LastEditors: KANG Jin-Wen
LastEditTime: 2019-11-03 15:15:51
Description: This python script is used to detect if the hepmc file is compl... | true |
782a018d83456c7be6a59e6ffa98d91700f0a3ee | bartlesy/blockchain | /ex_pow.py | UTF-8 | 227 | 3.34375 | 3 | [
"MIT"
] | permissive | from hashlib import sha256
# say PoW is hash of int x * int y must end in 0
# x is given, must find first y st hash(xy)[-1] == 0
x = 5
y = 0
while sha256("%d".encode() % (x * y)).hexdigest()[-1] != "0":
y += 1
print(y)
| true |
b49be29428c8a34463e46aa6cd3ca29f0f51ea54 | KaterynaD/Mini-ETL-Tool | /RedshiftUtility.py | UTF-8 | 10,480 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
import boto3
from botocore.client import ClientError
import yaml
"""
RedshiftUtility.py - 03.14.16 Kate Drogaieva
The class in this module allows to create a Redshift claster standalone or in VPC
"""
#---------------------------------------------------------------------------------------------
class R... | true |
fe9d8af299fe4b50050a75f16b5431d5a78d3cdd | carletes/ci-testing-talk | /tests/test_simple.py | UTF-8 | 177 | 3.265625 | 3 | [] | no_license | def divide(a, b):
return a / b
def test_divide_works_for_integers():
assert divide(4, 2) == 2
def test_divide_works_for_floats():
assert divide(4.0, 2.0) == 2.0
| true |
8dc3dc626561f7fa3c26534cf053b7c271a844ad | alexcatmu/CFGS_DAM | /SEGUNDO/M3-POOpython/ejercicios/Alex Catalan BUENOejercicio_control_errores/funcio_error.py | UTF-8 | 339 | 3.453125 | 3 | [] | no_license | def recogeNum():
array_num = []
for i in range(4):
try:
num = int(input("Introduce un numero"))
except Exception as e:#Es de ValueError cuando introducimos una letra
print("Detectat error "+ str(e))
num = 0
array_num.append(num)
return array_num
... | true |
f64c4c8cbfa5a4e6dcffb2ecfe2800d480e28696 | Damanpreet/unibrowser | /nlp/utils.py | UTF-8 | 4,119 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | """
utils.py
Contains all the utility functions for our NLP tasks
"""
# for system path
import sys
import os
# Sets the execution path
sys.path.insert(0, os.path.realpath('./'))
import spacy
import pymongo
from pymongo import MongoClient
import nltk
import datetime
# from config.prod import DATABASE_CONFIG
# Download... | true |
78b81911c0fdab5fbb1abc52b3d9230ced53b194 | taketakeyyy/atcoder | /abc/061/c.py | UTF-8 | 687 | 3.625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
""" 方針
[入力例1]
3 4
1 1
2 2
3 3
ans = [1, 2, 2, 3, 3, 3]
K=4より、答えは3
[考え方]
num_cnt_hash[num] := 数字numが配列に何個入っているか
"""
def solve():
N, K = list(map(int, input().split()))
A, B = [], []
num_cnt_hash = {}
for i in range(N):
a, b = list(map(int, input().split()))
i... | true |
754dd34aca1d8d5c9721b214aed824e4dc47a6a2 | Jammy2211/PyAutoGalaxy | /test_autogalaxy/profiles/mass/dark/test_nfw_truncated.py | UTF-8 | 6,647 | 2.625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pytest
import autogalaxy as ag
grid = np.array([[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], [2.0, 4.0]])
def test__deflections_yx_2d_from():
truncated_nfw = ag.mp.NFWTruncatedSph(
centre=(0.0, 0.0), kappa_s=1.0, scale_radius=1.0, truncation_radius=2.0
)
# factor =... | true |
67f876d11d9d2c7ed07ab0eb5e74102f232c827f | alishka1/jkolia | /cabinets/client/auth.py | UTF-8 | 1,753 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
import time
from bs4 import BeautifulSoup
from selenium.webdriver.common.action_chains import ActionChains
from ... | true |
73cd2e6e85a99a0c4e3aa13dae47bc4f25b8ed4e | seojpark91/HackerRank_dailycoding | /marcsCakewalk.py | UTF-8 | 327 | 3.21875 | 3 | [] | no_license | def marcsCakewalk(calorie):
"""
return a long integer that represents the minimum miles necessary.
parameter:
calorie: an integer array that represents calorie count for each cupcake
"""
reversed_calorie = sorted(calorie, reverse=True)
return sum([2**i * c for i, c in enumerate(reversed_cal... | true |
c03fa42ec470cacfdfa2fb506daf781303f2e954 | anthonykid/BasicPhoneNumberInfo_UsingPython | /BasicPhoneNumberInfo.py | UTF-8 | 471 | 2.796875 | 3 | [] | no_license | import phonenumbers
from phonenumbers import timezone, geocoder, carrier
phoneNumber = phonenumbers.parse("+624115085555") #this is only a random number from Indonesia, you need to change the phonenumbers.parse to use it
timeZone = timezone.time_zones_for_number(phoneNumber)
Carrier = carrier.name_for_number(... | true |
b94d728dc50c6e49f1b8e1e3da6af5364b2407ae | abjose/misc | /org/add-drawers.py | UTF-8 | 954 | 2.796875 | 3 | [] | no_license | import sys
# Add a properties drawer to every project.
# change these
properties_drawer = """:PROPERTIES:
:business-y: 0
:complexity: 0
:cost: 0
:interesting: 0
:priority: 0
:started: C-c-!
:time: 0
:END:
"""
file_name = sys.argv[1]
output_name = file_name.split(".")[0] + "-out." + file_name.s... | true |
4cd52c19baf65698f9017794eb97ef918f75072f | saisai/tutorial | /leetcode/test.py | UTF-8 | 418 | 3.21875 | 3 | [] | no_license |
def solution(nums):
result = []
results = []
for i in range(0, len(nums)):
for j in range((i+1), len(nums)):
if nums[i] == nums[j] and i < j:
result.append((nums[i], nums[j]))
results.append((i, j))
return (result, results)
if __name__ == '__main__... | true |
9477be91982a191a05b87e89f64a5efd21a587c6 | wildwood/game-of-life | /test/python/test_grid_tick.py | UTF-8 | 1,281 | 3.234375 | 3 | [] | no_license | import unittest
from src.game_of_life import GridTick
class TestGridTick(unittest.TestCase):
def test_init(self):
tick = GridTick(3, 3, [(1,1)])
def test_empty_grid(self):
tick = GridTick(3, 3, [])
grid = ((False, False, False), (False, False, False), (False, False, False))
s... | true |
34929796899a0e3f4bd71c7745c1eef9512033eb | masenov9607/KNN | /KNN.py | UTF-8 | 1,643 | 2.953125 | 3 | [] | no_license | import pandas as pd
from scipy.io import arff
from sklearn import preprocessing
import numpy as np
class KNN(object):
def __init__(self,input_file):
data = arff.loadarff(input_file)
self.dataset = pd.DataFrame(data[0])
self.K = int(np.sqrt(len(self.dataset)))
if self.K % 2 == 0:
... | true |
eb3243f4dfaffe43a6b79af0cb58445711ae39d0 | EvanMi/s14 | /day04/my_generator.py | UTF-8 | 1,211 | 4.125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# Author: Evan Mi
# 生成一个普通列表
my_val = [[i for i in range(10)] for j in range(10)]
print(my_val)
# 生成器
my_gen = (i*2 for i in range(10))
print(my_gen)
# 只能用for循环的方式来取,因为是一个一个生成的;
for el in my_gen:
print(el)
# 用函数的方式来实现生成器
def fib(max_num):
n, a, b = 0, 0, 1
while n < max_num:
... | true |
b7b9456530c12f7e1959815fd5f1536ce61e6109 | Pythonic2/testedeautomacao | /utils.py | UTF-8 | 477 | 2.515625 | 3 | [] | no_license | from browser import ChromeAuto
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class Utiuls(ChromeAuto):
def acessar(self, url):
self.chrome.get(url)
def espera(self, elemento):
... | true |
b8a7df0ac829cbbbdc770b0a14b1b6431fb76297 | JamesLuoau/donkey-car | /data_load.py | UTF-8 | 17,396 | 2.75 | 3 | [] | no_license | import os
import pandas as pd
import pickle
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from functools import reduce
import threading
CROP_HEIGHT = 66
CROP_WIDTH = 200
MAX_ANGLE = 1.5
def full_file_name(base_folder, image_file_name):
if base_folder is None:
return image_fi... | true |
94a56f3603f97449915e13c0b7436bd443909072 | PacktPublishing/Software-Architecture-with-Python | /Chapter08/pipe_recent_gen.py | UTF-8 | 935 | 3.5625 | 4 | [
"MIT"
] | permissive | # Code Listing #12
"""
Using generators, print details of the most recently modified file, matching a pattern.
"""
# pipe_recent_gen.py
import glob
import os
from time import sleep
def watch(pattern):
""" Watch a folder for modified files matching a pattern """
while True:
files = glob.glob(p... | true |
1fffe75afc2697e2b5114d6891e102ccc6507326 | e1810/kyopro | /ac/abc140/abc140_b/9945208.py | UTF-8 | 199 | 2.953125 | 3 | [] | no_license |
n = int(input())
a, b, c = [list(map(int, input().split()))for i in range(3)]
ans = 0
prev = -1
for i in range(n):
ans += b[i]
if(prev+1==a[i]): ans += c[a[i]-2]
prev = a[i]
print(ans)
| true |
b42a9579e2e2f4b0c1857bfe3354a2d234819ecf | yuanxu-li/careercup | /chapter16-moderate/16.2.py | UTF-8 | 1,237 | 3.640625 | 4 | [] | no_license | # 16.2 Word Frequencies: Design a method to find the frequency of occurences of
# any given word in a book. What if we were running this algorithm multiple times?
class Book:
def __init__(self, content):
"""
both the content as string and content_list as list, which is a list of all words, are stored
"""
self... | true |
0b2204abed49149e1d728d8b705ab240d5393eeb | HADietrich/CORE | /Core.py | UTF-8 | 4,576 | 2.734375 | 3 | [] | no_license | import pandas as pd
import xlrd
from Constants import PE_PRR_Dict, ABC_codes_array
class Requirement:
def __init__(self, row_values):
self.year = "2022"
self.PMA = self.set_pma(row_values[8])
self.PE = self.set_pe(row_values[8])
self.funding_profile = row_values[5]
self.t... | true |
dbc17e660648468b41b8bdacce97064213990176 | jesslam948/Programming-Practice | /75-Blind/Python/TwoSum2.py | UTF-8 | 361 | 3.046875 | 3 | [] | no_license | # 09.02.2021
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
my_dict = {}
for i in range(0, len(nums)):
complement = target - nums[i]
if complement in my_dict:
return [my_dict[complement], i]
my_dict[nums[i]] ... | true |
0087298cc836122d4981722df2a1ae86cfba99d2 | Dennis-1993/mnist_test | /test_mnist_neural_network_error.py | UTF-8 | 5,662 | 2.734375 | 3 | [] | no_license |
from __future__ import print_function
import numpy as np
from keras.datasets import mnist
dot = np.dot
batch_size = 50
num_classes = 10
epochs = 10
# the data, shuffled and split between train and test sets
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(60000, 784)
x_test = x_te... | true |
f13b21f32fa37d3ea269f02b8236d284ac08ae2f | sri-shree/Thunder | /chatexchangeExtension.py | UTF-8 | 800 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import chatexchange
import Utilities
import QuietRooms
def getRoomFromID (roomID):
for each_room in Utilities.rooms:
if each_room.id == roomID:
return each_room
return each_room
def isUserRO (roomID, userID):
room = getRoomFromID (roomID)
for each_owner in room.... | true |
91290ed6cecf594b48eecfad3b164ae5ab2bed92 | w22ee/pythonLearn | /Exception.py | UTF-8 | 386 | 3.125 | 3 | [] | no_license | #syntax err
#excpetion
# print(8/0)
# while True:
# try:
# x = int(raw_input("input number \n"))
# break
# except ValueError:
# print("not number")
try:
f = open("runningman1.txt")
s = f.readline()
i = int(s.strip())
except IOError as err:
print("err is {0}".format(err... | true |
ebe968d0afe11b2bbabf35b0434d7a84add14180 | lishuangshuang0616/real_amplicon | /bin/Work.py | UTF-8 | 12,533 | 2.625 | 3 | [] | no_license | import os
import re
import sys
import ConfigParser as cp
class MyConfigParser(cp.SafeConfigParser):
def __init__(self):
cp.RawConfigParser.__init__(self)
def optionxform(self, str):
return str
def add_section(self, section, items=None):
if items:
if not self.has_secti... | true |
2d49ad0e65f3394aba875bdaf8ed95a04642cf3f | BhujayKumarBhatta/OOPLearning | /pOOP/pOOp/class_attributes.py | UTF-8 | 1,265 | 3.734375 | 4 | [] | no_license | class Robot:
pass
# instance
x = Robot()
# instance attributres
x.name = 'Marvin'
x.age = 2
print("Name of the robot is %s and age is %s" % (x.name, x.age))
print(x.__dict__)
# Attributes can be bound to class names as well , these are class atributes
Robot.metal = 'steel'
y = Robot()
# ... | true |
4d48e4553073f2013c426f8ca7936ba21eeb7e1d | robin521111/machinelearning | /1.14_courses/practise/min_function.py | UTF-8 | 652 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# cangye@Hotmail.com
"""
不需要引入函数库
需要求解的函数为
f(x, y)=x^2+y^2+1
本代码理解即可
后续课程梯度以及最小值计算有相应库进行完成
"""
print(__doc__)
def f(x, y):
"""
原函数
"""
return x**2 + y**2 + 1
def df(x, y):
"""
计算梯度,一般计算时都直接给出梯度形式,不需要进行符号计算
"""
return 2 * x, 2 * y
# 给定初始值
x = y = 1
# 定义迭代过程
for ... | true |
bd05e8a7f906c7f6bb745c86bbb1368d81ae8687 | ptkuo0322/SI507_Win2021 | /Project/Final/TestingFIle/testing.py | UTF-8 | 5,116 | 3.21875 | 3 | [] | no_license | import sqlite3
import plotly.graph_objs as go
import pandas as pd
from plotly.subplots import make_subplots
def decide_sql_query():
rating_scale = ["0", '0.5','1.0','1.5','2.0','2.5','3.0','3.5','4.0','4.5','5.0']
price_scale = ["0", '1','2','3','4','5']
order_scale = ["ASC", "DESC"]
default_list = ... | true |
25a6bdf82b0d36a6e5d5f32f2da052bfc6e47e35 | saulo-lir/processamento-de-imagens-com-python-e-opencv | /visao-computacional/07-filtros-de-suavizacao.py | UTF-8 | 991 | 3.3125 | 3 | [] | no_license | import cv2 as cv
'''
Filtros Lineares:
-> Passa-baixas (Filtros de suavização)
-> Passa-altas (Filtros de realce)
Filtros não lineares
'''
# 1) Filtro de Média (Linear passa-baixa): Substitui cada pixel da imagem pelo valor médio de sua vizinhança
image = cv.imread('images/einstein-2.png')
imageFiltrada = ... | true |
26f62d04a7235bf148fda18f356d683851a9ab29 | hywu/cluster-lensing-cov | /clens/util/scaling_relation.py | UTF-8 | 3,958 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import erfc
#from clens.util.parameters import NuisanceParameters
class RichnessSelection(object):
def __init__(self, scaling_relation, lambda_min, lambda_max):
self.scaling_relation = scaling_relation
self... | true |
96c6fbb7e4def5691da74abba3ba96e2034fd6f6 | pimoroni/flotilla-python | /examples/colour_read.py | UTF-8 | 825 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
import time
import flotilla
print("""
Reading Colour values.
Press CTRL+C to exit.
""")
# Looks for the dock, and all of the modules we need
# attached to the dock so we can talk to them.
dock = flotilla.Client()
print("Client connected...")
while not dock.ready:
pass
print... | true |
d2f0bc8d3aafcbdfa84302279774f72f1d8107e0 | timothyuan/sockets | /test_server_tcp.py | UTF-8 | 1,309 | 2.828125 | 3 | [] | no_license | import unittest
import socket
import subprocess
from mock import Mock, patch
from server_python_tcp import receiveCommand, sendFile
class TestServerTCP(unittest.TestCase):
@patch('socket.socket')
def test_receiveCommand(self, mock_socket):
mock_address = ('ip', 3000)
# valid command, saves out... | true |
ac3ea630e4e9b166ac636761aaf48ce65fd838e2 | TrangCMonash/HOI_toolbox | /main.py | UTF-8 | 1,933 | 2.515625 | 3 | [
"MIT"
] | permissive | # Author: Pranav Mahajan, 2021
import numpy as np
from numpy import genfromtxt
import scipy.io
import pandas as pd
import time
import json
import sys
import os
from toolbox.utils import save_obj, load_obj
from toolbox.Oinfo import exhaustive_loop_zerolag
from toolbox.dOinfo import exhaustive_loop_lagged
configFilen... | true |
73aa9122c452258a92cdccfbce6711f069374b3f | MichelleZ/leetcode | /algorithms/python/mostProfitAssigningWork/mostProfitAssigningWork.py | UTF-8 | 645 | 3.046875 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/most-profit-assigning-work/
# Author: Miao Zhang
# Date: 2021-03-15
class Solution:
def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[int]) -> int:
n = 100000
max_profit = [... | true |
edb87c072983c85c2623cbae5a6a3c726c5bd103 | chao-shi/lclc | /143_reorder_link_list_m/main.py | UTF-8 | 1,458 | 3.484375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reorderList(self, head):
"""
:type head: ListNode
:rtype: void Do not return anything, modify head in-place instead.
... | true |
3647f880fb8d3b29268c57122b70f26cc692b449 | anguyener/reu2018 | /converter.py | UTF-8 | 9,872 | 3 | 3 | [] | no_license | import os
import cv2
import csv
import face_detection as fd
def squarePicFaceDetected(image, image_name):
face_img = fd.crop_faces(image, image_name)
return face_img
#crops image to a square crops half the difference off wider axis
def squarePic(image):
height, width = image.shape[:2] #height t... | true |
e93c9e3b7dfddad8865f203c1699f543d25c324c | zfha/python-study | /3/index.py | UTF-8 | 1,015 | 2.734375 | 3 | [] | no_license | from core.ext import analysisImage
from core.file import walkFolder, makeDir, copyFile
import time
def append(map, key, imageInfo):
tempList = map.get(key)
if not tempList:
tempList = []
map[key] = tempList
tempList.append(imageInfo)
def move(map, parentPath):
for key, value in map.items():
fold... | true |
3b4b2d1111d4e9efcd875fc37efca225faa1c639 | leaphe/python_study | /python-lists.py | UTF-8 | 417 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
list1 = ['physics', 'chemistry', 1997, 2000]
list2 = [1, 2, 3, 4, 5, 6, 7 ]
print "list1[0]: ", list1[0]
print "list2[1:5]: ", list2[1:5]
list = [] ##
list.append('Google') ## append()
list.append('Runoob')
print list
list3 = ['physics', 'chemistr... | true |
170c6e005a896b948355d5f85850bfdf6f40f5ce | thesaurabhkr/ISL-Recognition | /ISL.py | UTF-8 | 4,870 | 2.875 | 3 | [] | no_license | ##Importing the required libraries
import numpy as np
import matplotlib.pyplot as plt
import os
import cv2
##The directory in which the datasets are located
DATADIR = "/root/Saurabh/Jupyter/Project/Dataset"
##The CATEGORIES contains all the different signs present in our dataset
CATEGORIES = ["ABOVE", "ACROSS", "ADVA... | true |
7fdd99d483476e95975e66b3d22334bce5af1424 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2940/60695/307404.py | UTF-8 | 268 | 3.03125 | 3 | [] | no_license | a = input()
if a == "BBBACCCBCCCACCCBCCCAQQ":
print("BBBA2(CCCBCCCA)QQ")
elif a == "AAAAAAAAAABABABCCD":
print("9(A)3(AB)CCD")
elif a == "sdssssssssssssssssssssss":
print("sd22(s)")
elif a == "ABTRYABTRYABTRYABTRY":
print("4(ABTRY)")
else:
print(a) | true |
8a0b907071fbcbc3eaead5b91a72ce8258a0735d | sun9121/codingTest_Python | /Greedy/Q05.py | UTF-8 | 499 | 3.328125 | 3 | [] | no_license | n, m = map(int, input().split())
balls = list(map(int, input().split()))
# 공의 무게가 달라야만 조합이 의미가 있다.
b = len(balls)
count = 0
for i in range(b):
for j in range(i + 1, b):
if balls[i] != balls[j]:
count += 1
else:
continue
print(count)
# 천 미만이라 이중for문이 상관 없을 것 같기는 하지만... m을 ... | true |
c91e28a97cdd9188aa4b47c1750332db95c5e6d3 | zbo/zbodo | /BigNumberCalculate/Common.py | UTF-8 | 215 | 3.09375 | 3 | [] | no_license | __author__ = 'zbo'
def reverse(list):
result=[];
for i in range(len(list)-1,-1,-1):
result.append(list[i])
return result
def max(a,b):
if a>=b:
return a;
else:
return b; | true |
900b73e7d804e41c7b1dfcab70a6545a0f7032a7 | Bazzibabbab/Assignment1 | /model_ver1.py | UTF-8 | 1,179 | 4.15625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 13 17:47:40 2020
# Model:
# Make a y variable.
# Make a x variable.
# Change y and x based on random numbers.
# Make a second set of y and xs, and make these change randomly as well.
# Work out the distance between the two sets of y and xs.
@author: bkeight
"""
... | true |
0284f0ad9df6e650c19c7a9bf78c88cd4e42fd6d | KenjaminButton/runestone_thinkcspy | /7_selection/exercises/7.10.4.exercise.py | UTF-8 | 1,556 | 3.890625 | 4 | [] | no_license | '''
Modify the turtle bar chart program from the previous chapter
so that the bar for any value of 200 or more is filled with
red, values between [100 and 200) are filled yellow, and bars
representing values less than 100 are filled green.
'''
import turtle
xs = [250, 150, 75, 200, 101, 50] # here is the data
maxhei... | true |
d03024708bd5aa7f01f23a942443f97e41241d3b | JaahnaviGoli/pycbit-hackathon | /1_sum_57.py | UTF-8 | 79 | 3.9375 | 4 | [] | no_license | sum=0
for i in range(0,500):
if i%5==0 and i%7!=0:
sum+=i
print(sum)
| true |
82cac57d0030cab9bcbe583689bbeacee8cf2416 | CodersDom/Route_routing | /Code Bin/Test2.py | UTF-8 | 350 | 3 | 3 | [
"MIT"
] | permissive | import networkx as nx
import matplotlib.pyplot as plt
G = nx.path_graph(5)
print(nx.shortest_path(G, source=0, target=4))
p = nx.shortest_path(G, source=0) # target not specified
p = nx.shortest_path(G, target=4) # source not specified
p = nx.shortest_path(G) # source, target not specified
nx.draw_networkx(p,... | true |
2bd5fd209f2bbd63b5a5ed90755976a23f955ab9 | rajtyagi2718/mazes | /gui.py | UTF-8 | 3,363 | 3.328125 | 3 | [] | no_license | import pygame
from pygame import Color
class GUI:
def __init__(self, maze, cell_size, agent):
self.maze = maze
self.agent = agent
pygame.init()
pygame.display.set_caption('Maze')
self.cell_size = cell_size
self.wall_size = cell_size // 5
self.surface = pyga... | true |
fb6488b06f526894d58707967b69bbbebe4f0aab | poojamaurya2569/Arth2020Task8Byteam-7.24 | /hadoop_with_lvm.py | UTF-8 | 10,180 | 2.84375 | 3 | [] | no_license | import speech_recognition as sr
import os
import pyttsx3
pyttsx3.speak("hello vikash... welcome to your Terminal.. I am your voice assistent. please tell how may i help you...")
print("\t\t\t hey vikash welcome to my TUI that makes life simple")
r = sr.Recognizer()
while True:
with sr.Microphone() as... | true |
0f4b032dde754bc633745e74e3b5e456f520b1a1 | wisdomtohe/CompetitiveProgramming | /Forks/uvapy-master/greedy/p10656.py | UTF-8 | 301 | 3 | 3 | [
"MIT"
] | permissive | from sys import stdin, stdout
numbers = [0]*1024
while True:
n = int(input())
if n == 0:
break
for i in range(n):
numbers[i] = int(stdin.readline())
seq = [str(x) for x in numbers[0:n] if x > 0]
if len(seq) == 0: # All zeros
seq = ["0"]
stdout.write(" ".join(seq) + "\n")
| true |
781964e17ea495056f159b7c76113e0025b3b3d0 | ifermon/ISP-Connection-Monitor | /inet_check.py | UTF-8 | 3,107 | 3.1875 | 3 | [] | no_license | import pyping
import time
import datetime
HOSTS = ['google.com', '209.18.47.61', '209.18.47.62']
DT_FORMAT_STR = "%a %b %d %Y %I:%M:%S %p"
TIMEOUT = 350.0 # Time to wait for ping to return
def now(): return datetime.datetime.now()
def duration_str(td):
# Assumes we will never have a difference less than a second... | true |
d1a3d8c26721df45261363482c6fe689e84f0908 | nlpaueb/bio_image_caption | /SiVL19/wmd_evaluation.py | UTF-8 | 3,392 | 3.078125 | 3 | [
"MIT"
] | permissive | import gensim
import re
import argparse
import pandas as pd
# Word Mover's Distance computes the minimum cumulative cost required to move all word embeddings of one caption
# to aligned word embeddings of the other caption. We used Gensim's implementation of WMD (https://goo.gl/epzecP)
# and biomedical word2vec embed... | true |
fc5372d9c002db6a9b196d976f098a82b3d25857 | LimeProgramming/NuggetBot4.0 | /nuggetbot/utils.py | UTF-8 | 1,085 | 2.578125 | 3 | [
"MIT"
] | permissive | """
----~~~~~ NuggetBot ~~~~~----
Written By Calamity Lime#8500
Disclaimer
-----------
NuggetBots source code as been shared for the purposes of transparency on the FurSail discord server and educational purposes.
Running your own instance of this bot is not recommended.
FurSail Invite URL: http://discord.gg/QMEgfcg
... | true |
9ba6a55ceb22f4cb7475bdc5c07b00d12ca75d80 | baitao1994/Python_Primary | /认识/五角星.py | UTF-8 | 294 | 3.3125 | 3 | [] | no_license | #红色五角星
from turtle import *
color("green","red")#color(*args) Return or set the pencolor and fillcolor.
#color() = pencolor() + fillcolor() 里面必须是字符串
begin_fill()
while True:
forward(200)
right(144)
if abs(pos()) < 1:
break
end_fill()
| true |
4dc95c255fdf9f326ff2a5e4f027c22a6265ab41 | errrr0501/cubic_spline | /tup.py | UTF-8 | 98 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
tup = ('python', 2.7, 64)
for i in tup:
print(i) | true |
773f996bed37f32372673de22ebf539dd9df51d2 | BYU-NLP-Lab/crowdflower-newsgroups | /input/txt2image.py | UTF-8 | 2,363 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3.3
import os
from os import path
from subprocess import Popen
import subprocess
from glob import glob
from multiprocessing import Pool
latex_template = '''
\\documentclass[12pt]{article}
\\usepackage[papersize={16in,24in}]{geometry}
\\pagenumbering{gobble}
\\begin{document}
\Large{
\\begin{verbat... | true |
b9478b975a51eed91a86927ca985bcd64a047b30 | Python-lab-cycle/Muhammed-Ameen | /2.(b).Square.py | UTF-8 | 166 | 4 | 4 | [] | no_license | #Square of N numbers using list comprehension
print("Enter the limit")
n=int(input())
squares=[i*i for i in range(10)]
print("square of n numbers \n",squares)
| true |
9ca5810cfa4b3e1d9d467b540696c913e9afc1ea | HeFengMarc/CSE142-Python | /HW 4/Gradanator.py | UTF-8 | 3,211 | 4.4375 | 4 | [] | no_license | # This program will help the user to weighted different types of grade and
# generate a final weighted course grade. Users input the information of each exam and
# homework. The program will use this information to create a final weighted
# grade. Then we can use the final weighted grade to determine the minimum GPA
# ... | true |
a8be0d094ab0abb3918fe6d47dcf0d96170d22d5 | huananana/pythonStudy | /python基础语法/语言基础/doy20-多线程基础/code/03-多线程2.py | UTF-8 | 657 | 3.265625 | 3 | [] | no_license | """__author__=桃花寓酒寓美人"""
from threading import Thread
from datetime import datetime
import time
class DownloadThread(Thread):
def __init__(self, film_name):
super().__init__()
self.film_name = film_name
# 这个run方法时会在子线程中自动调用的方法,要求除了self以外不能有其它的参数
def run(self) -> None:
print('%s开始下... | true |
faeb4cd0951fd481c392bac7eb0ff6d7284e5776 | liutongl5/QMark-API | /pyQMark/htmlQMark.py | UTF-8 | 2,921 | 2.59375 | 3 | [
"MIT"
] | permissive | # Qingmang Mark API based on Python
# https://github.com/liutongl5/QMark-API
# Email: liutongl5+QMark@gmail.com
import xml.etree.ElementTree as ET
from parseQMarkApi import dictParseQMark
def htmlQMark(userId=1, userSecret="", hideSecret=False):
dictQMark = dictParseQMark(userId, userSecret, hideSecret)
return htm... | true |
a5ea153dae225c80bcf8e438ba7c3a51c649251d | sadakatsu/kgs-rip | /update_user_progress.py | UTF-8 | 436 | 2.6875 | 3 | [
"MIT"
] | permissive | from sqlite3 import Connection
def update_user_progress(connection: Connection, user: str, last_year: int, last_month):
try:
with connection:
cursor = connection.cursor()
cursor.execute('update users set last_year = ?, last_month = ? where id = ?', [last_year, last_month, user])
... | true |
78aff1e68e4fa0618a9b753f087c36591184611a | sanjayramalings/Learning-Python | /Ch2/functions_start.py | UTF-8 | 771 | 4.5625 | 5 | [] | no_license | #
# Example file for working with functions
#
# define a basic function
def fun1():
print("I am a function")
#it doesnt return a value
# function that takes arguments
def fun2(arg1,arg2):
print(arg1," ",arg2)
# function that returns a value
def cube(x):
return x+x+x
# function with default ... | true |
fe1ca8bc9842990349bbc2307910d8e1dec9bbb8 | xuzhuo77/WorkSpace-FrameWork | /Utils/json2class_utils.py | UTF-8 | 1,431 | 2.90625 | 3 | [] | no_license | import json
test = {"name": "Abc", "age": "12"}
test2 = {"name": "Abc", "age": "12"}
dict = {"personLook": test}
person_list={"items":[test,test]}
def class_dict2class(_dict,class_name):
if len(_dict.keys()) > 1:
raise ValueError("not a class")
if not class_name:
class_name = list(_dict.keys... | true |
3466a734a3aca57b7a71449b439813af17292529 | valterUo/MultiCategory-backend-py | /src/category_of_collection_constructor_functors/model_categories/category_of_tree_model.py | UTF-8 | 3,153 | 3.203125 | 3 | [] | no_license | from abstract_category.abstract_object import AbstractObject
from abstract_category.abstract_morphism import AbstractMorphism
import networkx as nx
import copy
class RootObject:
def __init__(self, name):
self.name = name
class TreeModelCategory:
"""
TreeModelCategory is a category with two o... | true |
d62dc2f8d7b2444ba0053b4eeca750815a53cf94 | zachary-chiodini/natural-language-processing | /text-classification/naive-bayes-classifier/naivebayes.py | UTF-8 | 14,167 | 2.609375 | 3 | [] | no_license | import random, re
from math import log
from typing import Dict, List, Set, Union
class NaiveBayes :
'''
Multinomial Naive Bayes
'''
Count, Probaility = int, float
Class, Output, Document, Word = str, str, str, str
def __init__( self ) -> None :
self.logPc : Dict[ Class, Pr... | true |
489976619de1b6272673aa0204bae79f2c35fd7c | AlexTuisov/HW3 | /HW3_submission/25_submission/ex3.py | UTF-8 | 14,331 | 2.75 | 3 | [] | no_license | import time
import math
import random
import itertools
from copy import deepcopy
from collections import defaultdict
ids = ['206330342', '313329666']
DIMENSIONS = (10, 10)
MAX_DEPTH = 2
TIME_LIMIT = 4.85
DISCOUNT_FACTOR = 0.9
def binary_search(arr, low, high, x):
if high > low:
mid = (high + low) // 2
... | true |
c5698c4d6f6fa8ab5acdc2395dbf5558454b301d | junkiYoon/Python-Grammar | /Python Grammar/02_3_list.py | UTF-8 | 1,712 | 4.375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 리스트, 리스트 안에는 어떠한 자료형도 포함 가능
a = []
b = [1, 2, 3]
c = ['Life', 'is', 'too', 'short']
d = [1, 2, 'Life', 'is']
e = [1, 2, ['Life', 'is']]
print(b[0]) # b문자열의 0번째 값
print(b[0] + b[2]) # b문자열의 0번째 값과 2번째 값의 합
print(b[-1])
print(e[0])
print(e[-1]) # 마지막 요솟값인 리스트 출력
print(e[-1][0]) # 리스트에 포함된... | true |
e5494df54d33b8c10b4ebc59549a15c9f0db83bc | stellarbeam/observations | /mask_classifier/Data_Generator/loop_through_folder.py | UTF-8 | 513 | 2.75 | 3 | [] | no_license | import cv2
import os
from mask import create_mask
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--path", help="path to images folder")
args = parser.parse_args()
folder_path = args.path
print("Target folder: ", folder_path)
colors = [ "default", "black", "blue", "red" ]
images = [os.path.j... | true |
01c55b7bce4949fd2c15a7eaab4f1268ebec28f7 | gavinuhma/tf-encrypted | /tf_encrypted/keras/activations.py | UTF-8 | 838 | 3.09375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Provide activation functions"""
from tf_encrypted import get_protocol
def relu(x):
"""Computes relu of x element-wise"""
return get_protocol().relu(x)
def sigmoid(x):
"""Computes sigmoid of x element-wise"""
return get_protocol().sigmoid(x)
def tanh(x):
"""Computes tanh of x element-wise"""
return ge... | true |
fb921b87ef39597a72b6ff23d71a81d39a466a00 | vincentpanqi/PythonLearning | /task/11-14/judgenumber.py | UTF-8 | 420 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
# Created by Ferris on 2016/11/14
def judgeNumber(s):
for i in s:
if i in '0123456789':
pass
else:
return False
else:
return True
if __name__ == '__main__':
string = raw_input('请输入一个字符串:')
if judgeNumber(string):
... | true |
c29ee4463a0ff980e1706097e967260515475b2a | heqiang/redisLearn_py | /redis_base/String_.py | UTF-8 | 1,258 | 3.1875 | 3 | [] | no_license | import redis
"""
字符串操作
添加一个key value
根据一个key获取值
当value为数值类型时 可以自增或者自减 默认为1 通过incrby/decrby可以调整自增/自减的数值
字符串截取->getrange substr
字符串替换 -> setrange(key,offset,value) offset 偏移量 从哪里开始进行替换
字符串过期时间
-> setex 设置字符串过期时间 查看过期时间 ->ttl
-> setnx 不存在设置(分布式锁中使用)存在不会替换
字符串批量设置/获取
... | true |
e95ed59d693cb82e55bbc519dee08bde6bd452c8 | sshleifer/object_detection_kitti | /object_detection/utils/visualization_utils_test.py | UTF-8 | 5,624 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | true |
033af18a182b72d6b23de1c158b4685e9cc56e59 | margulies/ohbm2021 | /ohbm2021_abstract_book/parser_web.py | UTF-8 | 4,671 | 2.609375 | 3 | [] | no_license | import os
import requests
import pandas as pd
from bs4 import BeautifulSoup as Soup
import xmltodict
from decouple import config
df_cols = [
"abstractNumber",
"submissionNumber",
"abstractType",
"authors",
"institution",
"title",
"purpose",
"materialsMethods",
"results",
"concl... | true |
605d33953299f1f67d5911aaa2fe40c2dcce3782 | Leothechosen/CCCBot | /apirequests.py | UTF-8 | 1,271 | 2.78125 | 3 | [] | no_license | import aiohttp
import logging
import os
from dotenv import load_dotenv
load_dotenv()
cccapikey = os.getenv("CCC_API_KEY")
logger = logging.getLogger(f"CCCBot.{__name__}")
async def ccc_search(ctx, order):
async with aiohttp.ClientSession() as session:
async with session.get(f"https://www.castingcall.club/... | true |
caf219cc3810bac5480707dd645735291cff484d | gmiejski/movies-recommender-api | /deployment/scripts/metrics/AccuracyMetricsRunner.py | UTF-8 | 4,811 | 2.609375 | 3 | [] | no_license | import datetime
import os
from ansible.AnsibleRunner import AnsibleRunner
from metrics import formatter
from metrics.AccMetrics import AccMetrics
class AccuracyMetricsRunner:
def __init__(self, metric_details, result_folder="/tmp/magisterka/metrics/accuracy/"):
self.fold_results = []
self.metric_d... | true |
3b89342d16017d03439844df13e4de9de1ea7747 | SeedlingsBabylab/subjfile_duplicates | /py_scripts/check_error.py | UTF-8 | 619 | 2.625 | 3 | [] | no_license | import sys
import os
if __name__ == '__main__':
top_dir = sys.argv[1]
for folder in os.listdir(top_dir):
if os.path.isdir(os.path.join(top_dir, folder)):
dir = os.path.join(top_dir, folder)
for txt in os.listdir(dir):
if txt.startswith("path_hash_") and txt.... | true |
2026927d042c53c7192fb12873e4a93f5545353f | dalbyryan3/me-en-2450-numerical-methods | /HW5/NaiveGaussElimination.py | UTF-8 | 1,435 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 26 21:13:09 2019
Naive Gauss Elimination from HW3 Exercise 3
@author: Ryan Dalby
"""
import numpy as np
def gaussElimination(A, b):
"""
Uses naive gauss elimination method without pivoting to determine solutions to Ax = b
Will directly modify A pa... | true |
64dde4b302a06eef80861c336bd508df3d79b103 | pasu-t/myPython | /python_modules/csv/csv_dict_write.py | UTF-8 | 363 | 2.84375 | 3 | [] | no_license | import csv
with open('hosts.csv', 'r') as file:
csv_reader = csv.DictReader(file)
print(csv_reader)
with open('new_hosts.csv', 'w') as new_file:
fieldnames = ['ip_address','host_name','os','conn_protocol','user','password']
csv_writer = csv.DictWriter(new_file, fieldnames)
csv_writer.writeheader()
for line ... | true |
1d0de76eead39568658574c0d1208400bc4b3e10 | jlmadurga/jinja2-time | /tests/test_now.py | UTF-8 | 1,201 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
import pytest
from freezegun import freeze_time
from jinja2 import Environment, exceptions
@pytest.fixture
def environment():
return Environment(extensions=['jinja2_time.TimeExtension'])
@pytest.yield_fixture(autouse=True)
def freeze():
freezer = freeze_time("2015-12-09 23:33:01")
... | true |
8b1ec2150327672a249334bf0725342fbc3c8c38 | LIUJINGJI/AeroSandbox | /aerosandbox/aerodynamics/aero_3D/aero_buildup.py | UTF-8 | 4,892 | 2.59375 | 3 | [
"MIT"
] | permissive | from aerosandbox import ExplicitAnalysis
from aerosandbox.geometry import *
from aerosandbox.performance import OperatingPoint
import aerosandbox.library.aerodynamics as aero
import aerosandbox.numpy as np
class AeroBuildup(ExplicitAnalysis):
"""
A workbook-style aerodynamics buildup
"""
def __init__... | true |
527bdd37f95244db5fb1512dd6f7e35026f7cf81 | cs3157/boatswain | /remove_dropped.py | UTF-8 | 2,287 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import boatswain_env as benv
import argparse
import csv
import os
from github import Github
CMD_NAME = 'drop_students'
DESC = 'Remove dropped students from GitHub team repo'
def drop_students_deco(parser):
parser.add_argument('org',
type=str,
... | true |
621d172c5ca50c4c3d74748ca3759fe28109b4e0 | Aasthaengg/IBMdataset | /Python_codes/p03569/s573996002.py | UTF-8 | 537 | 3.078125 | 3 | [] | no_license | s = input()
s2 = ""
for i in s:
if i != "x":
s2 += i
if s2 != s2[::-1]:
print(-1)
else:
temp = s2[:(len(s2) + 1) // 2]
ans = 0
num1 = 0
num2 = len(s) - 1
for i in range(len(temp)):
count1 = 0
while s[num1] != temp[i]:
count1 += 1
num1 += 1
... | true |
d061536d4100c7af19fba013d5da834b629de69f | jcsanchez2/adelaide_swc | /test/noses/test_startdna.py | UTF-8 | 308 | 3.1875 | 3 | [] | no_license |
class UnknownBaseException(Exception):
pass
def dnastart(seq,prefix):
if 'N' in seq:
raise UnknownBaseException()
return seq[0:len(prefix)] == prefix
def test_first():
assert dnastart('atgact','at')
def test_start_itself():
dna= 'ACTGATG'
assert dnastart(dna,dna)
| true |
b8dd02c11196085732ce38ac51483cf4b5d8396c | menkonda/ffparser | /ffparser/testlib/common.py | UTF-8 | 12,107 | 2.640625 | 3 | [] | no_license | import time
import os.path
from ffparser.testcase import TestCaseStepResult, TestCaseResult
def check_dates(flat_file_object):
"""
Check the date format of a given csv according to its structure
:param flat_file_object: the FlatFile object containing the content of the flat file and file structure
:re... | true |
e6d3d31f16a77c0799cd69963bf87826e29a3662 | Aasthaengg/IBMdataset | /Python_codes/p03108/s297803399.py | UTF-8 | 958 | 2.65625 | 3 | [] | no_license | import sys
sys.setrecursionlimit(100000)
n, m=map(int, input().split())
a=[0 for i in range(m)]
b=[0 for i in range(m)]
g=[list() for i in range(1+n)]
#print(g)
par=[i for i in range(n)]
cnt_con=[1 for i in range(n)]
def root(x):
if x==par[x]:
return x
else:
par[x]=root(par[x])
return... | true |
2313ca9f6a2ff2f8aa78ad64f3b668fb7158edeb | Aasthaengg/IBMdataset | /Python_codes/p03705/s206628792.py | UTF-8 | 168 | 3.0625 | 3 | [] | no_license | N, A, B=map(int, input().split())
if N==1:
if A==B:
print(1)
else:
print(0)
else:
if A>B:
print(0)
else:
n=N-2
ans=n*B-n*A+1
print(ans)
| true |
22c2450639aa4a21f3dff34312fbc5b4347a5a88 | rejux/rklearn-lib | /rklearn/opendata_loaders.py | UTF-8 | 3,384 | 3.265625 | 3 | [
"MIT"
] | permissive | ######################
## data_loaders.py ##
######################
#############
## Imports ##
#############
import os
import sys
# import yaml
import numpy as np
import pandas as pd
from sklearn.datasets import fetch_openml
##########################
## load_mnist_sklearn() ##
##########################
def l... | true |
f2767468fab1c5e7c0d6eee8d3120719b880f0b3 | yugwas/python-functions-worksheet | /lessons/10_same_name/local_global_same_name.py | UTF-8 | 620 | 4.125 | 4 | [] | no_license | def spam():
eggs = "spam local" #1
print(eggs) #prints "spam local"
def bacon():
eggs = "bacon local" #2
print(eggs) #prints "bacon local"
spam()
print(eggs) #prints "bacon local"
eggs = "global" #3
bacon()
print(eggs) # prints "global"
#There are three variables all named eggs
#1 is a Variable named... | true |
dc0d82347f639b09fc5151d109e772818a4a9ffc | rorybolt/learning_python | /translate_mRNA.py | UTF-8 | 1,917 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import gzip
import sys
import biotools as bt
import argparse
# Use argparse
# Write a program that translates an mRNA
# Assume the protein encoded is the longest ORF
parser = argparse.ArgumentParser(
description='Translates an mRNA.')
# required arguments
parser.add_argument('--file', ... | true |
43df5e8dda9238d9ad02fa901f993809d7c9eb6c | bmunoz89/fullstack-challenge | /techk/apps/base/tests/test_serializers.py | UTF-8 | 1,992 | 2.6875 | 3 | [
"MIT"
] | permissive | from django.test import SimpleTestCase
from apps.base.models import Book, Category
from apps.base.serializers import BookSerializer, CategorySerializer
class BookSerializerTestCase(SimpleTestCase):
def test_expected_serialized_json(self):
expected_results = {
'id': 1,
'title': 'S... | true |
afbc4d2cd1102660ce46bea19b57ed1d086278aa | aggronerd/Crowd-Control | /game/tasks/interface.py | UTF-8 | 1,374 | 2.90625 | 3 | [] | no_license | __author__ = 'greg'
from direct.task import Task
from game.tasks.core import TaskHandler
class DebugInfoUpdateTaskHandler(TaskHandler):
def updateDebugOnscreenTextTask(self, task):
if self.app.mouseWatcherNode.hasMouse():
x=self.app.mouseWatcherNode.getMouseX()
y=self.app.mouseWatcherNode.getMouseY()
else... | true |