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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d082076ca829106f44a86d66ab2a29c396e02fd0 | Python | StepanKniazevich/My_practic | /lab4_2.py | UTF-8 | 644 | 3.578125 | 4 | [] | no_license | from array import array
arr=['князевич_князь','степан','іванович']
mas=[]
p=0
r=0
print("Вихідні слова: ",arr)
for k in range(len(arr[r])):
for i in [1,2]:
for j in range(len(arr[i])):
if arr[r][k]==arr[i][j]:
p=p+1
... | true |
87f3c0273836a595e016ac3d30cabe95072ee139 | Python | snowde/crc-status-dash | /layout/treemap.py | UTF-8 | 2,860 | 2.625 | 3 | [] | no_license | import numpy as np
import plotly.graph_objs as go
import squarify
def treemap(df):
bs = df
liab = [
"totalcurrentliabilities",
"totalnoncurrentliabilities"
]
ass = [
"netppe",
"totalcurrentassets",
"totalnoncurrentassets"
]
equ = [
"totalcommo... | true |
e5ac72c5f44ad90c1b2f23abc5147784cc9708f9 | Python | verdecit/CPS-3320 | /hangmangame.py | UTF-8 | 920 | 3.84375 | 4 | [] | no_license | # Hangman game!
# Assume the answer is "hangman"
import random
r =random.randint(0,2)
words = [['s','n','o','w'],['s','p','e','e','d'],['p','y','t','h','o','n']]
A = words[r]
L = ['_','_','_','_','_','_','_']
play = True
incorrect = 0
while play == True:
letter = str(input("Guess a letter: "))
i = 0 # Check to se... | true |
1b4252becb274111f252e889141ca804f03cde06 | Python | jankin3/project-leetcode | /dp/309-best-time-to-buy-and-sell-stock-with-cooldown.py | UTF-8 | 797 | 3.21875 | 3 | [] | no_license | class Solution:
def maxProfit(self, prices) -> int:
dp = {}
dp[0] = 0
if len(prices) <= 1:
return dp[0]
dp[1] = prices[1] - prices[0] if prices[1] > prices[0] else 0
for i in range(2, len(prices)):
max_profit = dp[i - 1]
for j in range(i-1... | true |
7c21b1f7139b9c63a2347a5a8f1916a9c0f6d6d9 | Python | 316112840/Programacion | /Tareas/Tarea02/Ejercicio3.py | UTF-8 | 1,410 | 4.4375 | 4 | [] | no_license | # Mariana Yasmin Martínez García
# Correo: mariana_yasmin@ciencias.unam.mx
# Ejercicio 2.3: Práctica con el módulo math.
from math import *
# a)
def SumaEntera(L):
'''Sumará la parte entera de los números de la lista dada'''
N = [0]
for numero in L:
N.append(floor(numero) + N[len(N)-1])
return... | true |
b9c35df6039b62ec1bfb3ddae8e497f107191cad | Python | scipp/scipp | /tests/spatial/scaling_test.py | UTF-8 | 999 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | import scipp as sc
from scipp.spatial import inv, scaling_from_vector, scalings_from_vectors
def test_from_scaling_vector():
transform = scaling_from_vector(value=[1, 0, -2])
vector = sc.vector(value=[1, 2, 3], unit=sc.units.m)
assert sc.allclose(transform * vector, sc.vector(value=[1, 0, -6], unit=sc.un... | true |
e01393d2eab724d4c1cfbe5814861d09fe08826e | Python | jonoreilly/python | /pygame/AoE/AoE_test2/cursors.py | UTF-8 | 6,559 | 2.609375 | 3 | [] | no_license | import pygame
index = {}
def add(msg, pos):
index[msg] = pos
add("hand",(3,3))
hand = [[
" ",
" BB ",
" BWWB ",
" BWWWWB BB ",
" BWWWWWB BWWB ",
" BWWWWWB BBWWWB ",
" BWWWWWB BWWBWWWB "... | true |
04de6b0db3bf4208bb2ff1ab1d3735db4466318f | Python | ihristova11/python-basics | /Homework/04. If-Else-Harder/04. SumOfNumbers.py | UTF-8 | 100 | 3.578125 | 4 | [] | no_license | n = int(input())
sum = 0
for i in range(n):
current = int(input())
sum += current
print(sum) | true |
d00af45f4a84804c3d3757b50c16812764a7ec24 | Python | EGA-archive/ont_readuntil_server | /shortReadServer.py | UTF-8 | 2,028 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # shortReadServer.py
# Index files are created with BWA. Specify the reference file name in 'index'
# The Mask file is 1 byte per position, divided into upper and lower 4 bits
# for forward and reverse strands.
# Specify the the name of the map file in 'mapfile'
# Usage: curl 127.0.0.1:8000/map?TTTACG
# Specify the s... | true |
652dab34017df6ec90a93882328d5eb503f2bfdd | Python | bagindakarli/MachineLearning-Python3.7 | /Exercise 9.py | UTF-8 | 11,825 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[43]:
# Baginda
# 130-
# Pembelajaran Mesin (IF-41)
# In[2]:
import numpy as np
np.random.seed(213)
def affine_forward(X, W, b):
V = np.dot(X, W) + b
return V
def affine_backward(dout, X, W, b):
dX = np.dot(dout, W.T)
dW = np.dot(X.T, dout)
db = np.... | true |
dcdc81d95bc27c4f0006d4dff1f931dfc76c8048 | Python | lhaneda/EEG-Platform-Proto | /website/make_csv.py | UTF-8 | 372 | 2.953125 | 3 | [] | no_license | import csv
def create_csv(result_file):
file_basename = 'output.csv'
result_csv = open(file_basename,'w+')
result_csv.write('Channel, Band, Function, Value, Start Time, End Time, TS Completed \n')
for row in result_file:
row_as_string = str(row)
result_csv.write(row_as_string[1:-1] + '... | true |
4b80969225b16192d85f536d9af7b401c927d0d6 | Python | barawalojas/Hacktoberfest2020-1 | /areaoftriangle.py | UTF-8 | 271 | 4.21875 | 4 | [] | no_license |
#Let a,b,c are the lengths of the side of a triangle.
a=int(input("Enter a: "))
b=int(input("Enter b: "))
c=int(input("Enter c: "))
s=(a+b+c)/2
#Where,s is half the perimeter,
area=(s*(s-a)*(s-b)*(s-c))**0.5
print('The area of the triangle is %0.2f'%area)
| true |
116fc90829fab68733c8a597ea11bc035efb7c48 | Python | Miami-stack/graduation_work_automation | /pages/shopping.py | UTF-8 | 7,038 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | import logging
from common.base import BaseClass
from locators.main_page import MainLocators
from locators.shopping_cart import ShoppingLocators
from common.constants import RandomGoods
logger = logging.getLogger()
class ShoppingPage(BaseClass):
def __init__(self, app):
self.app = app
def add_to_ca... | true |
f86dc0ab1f93eb3c1e368b1617a29289cb59c4ec | Python | CarineGhisiCadorin/Exercicios_LP_B1 | /10.py | UTF-8 | 137 | 3.484375 | 3 | [
"MIT"
] | permissive | a = float(input("Informe o valor que você possui na carteira: "))
b = (a / 5.41)
print("Você pode comprar essa quantia de dollar: " ,b) | true |
1287bdfee29ccf830d4e0590922d3483b8421e19 | Python | agus179e/SchoolProject1 | /Seever.py | UTF-8 | 1,267 | 2.53125 | 3 | [] | no_license | from http.server import BaseHTTPRequestHandler,HTTPServer
import threading, os, time
class HttpThread(threading.Thread):
def __init__(self,l,e1,e2,num):
self.num=num
self.f="<META HTTP-EQUIV=REFRESH CONTENT=0.5><iframe src=http://localhost:8089/strelka"+num[0]+".html width=500 height=500 fram... | true |
93d798e06e3d282725d0d3d310e6de3590f2236a | Python | marcelogomess/SMSFactory | /Classes/SMS.py | UTF-8 | 1,127 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
import re
import gammu
class SMS:
def __init__(self,phonenumber,textmessage):
self.phonenumber = str(''.join(re.findall('\d', phonenumber)))
self.textmessage = str(textmessage).rstrip('\r\n')
def getNumber(self):
return self.phone... | true |
52cfc0135f4171db1ccede18e0fc55be866f4711 | Python | jazzlly/ryan-jupyter-notebook | /z000bs4/estrans.py | UTF-8 | 1,437 | 2.75 | 3 | [] | no_license |
import re
import time
import os
import json
import translators as ts
from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch(
['192.168.11.27'],
http_auth=('elastic', 'Pekalles12#$'),
scheme='http', port=9200)
zh_regex = re.compile(r'[\u4e00-\u9fa5]') # 匹配中文字符
key_regex... | true |
c10a2d3c291343e6aeb57c73632403737dbf20ac | Python | amelgikha/UJIAN_MODUL_2 | /SOAL2.py | UTF-8 | 3,091 | 2.65625 | 3 | [] | no_license | import plotly.graph_objects as go
import matplotlib.pyplot as plt
import mysql.connector
import pandas as pd
db = mysql.connector.connect(
host = 'localhost',
port = 3306,
user = 'root',
passwd = 'taikucing',
database = 'world'
)
query1 = '''select country.Name as Negara_ASEAN, countr... | true |
d5694a33c3c410a29d718fb812ee357b327389ff | Python | shadab-iqbal/URI | /Task1098.py | UTF-8 | 450 | 3.515625 | 4 | [] | no_license | i = 0.0
x, y, z = 1.0, 2.0, 3.0
while i <= 2:
if i.is_integer():
print(f'I={int(i)} J={int(x)}')
print(f'I={int(i)} J={int(y)}')
print(f'I={int(i)} J={int(z)}')
else:
i = round(i, 1)
x = round(x, 1)
y = round(y, 1)
z = round(z, 1)
print... | true |
40a1b2e2f51d9f33af92bee2f2560200a6d23e30 | Python | PointerFLY/2048-AI | /greedy.py | UTF-8 | 426 | 2.890625 | 3 | [] | no_license | from agent import Agent
class GreedyAgent(Agent):
def next_action(self):
legal_actions = self.state.legal_actions()
if not legal_actions:
return
def get_score(action) -> int:
old = self.state.score
new = self.state.direct_successor(action).score
... | true |
d6bc1d2e96ae6f850986e8d5229b9e68b1cf1c79 | Python | Golpette/antibiotic-resistance | /Data analysis scripts/extra/construct_geno_from_seq_changeSeqFormat.py | UTF-8 | 7,408 | 2.921875 | 3 | [] | no_license | #
# Script to take ordered list of driver mutations ("sequence") and convert
# it to a mutational pathway (of form: 00000 00010 00011 etc).
# Also produces weighted graphviz file.
#
import os
from os import listdir
from os.path import isfile, join
# arguments from command line
import sys
# for logarithmic normalizer co... | true |
1fcdf7986d84127d03a9818102a3e2850a177ed4 | Python | Gscsd8527/python | /多线程/lx_2.py | UTF-8 | 285 | 3.265625 | 3 | [] | no_license | # 查看当前时间
import time
lst = []
while 1:
# 读取当前时间、日期、年份、星期几
mytime=time.ctime(time.time())
print(mytime)
print(type(mytime))
tp=mytime.replace('17','10086')
# lst=tp.split()
# print(lst)
time.sleep(5)
break
| true |
8521b46d423a4699a9b0209ffcdcbbb364cbe453 | Python | jiakechong1991/search | /sug/preprocess/dump_pinyin_weight.py | UTF-8 | 3,860 | 2.53125 | 3 | [] | no_license | # coding: utf8
import argparse
import codecs
from collections import defaultdict
import copy
import json
import logging
from config.conf import MIN_WORD_LEN, MAX_WORD_LEN, MAX_MIX_NUM, LOGGING_FORMAT
from utils.common import get_row_num
from utils.pinyin_generator import PinyinGenerator
def dump_pinyin_weight(file_in... | true |
399d260f2a063f481410a26663283a24bd8fa590 | Python | jsliacan/misc | /project-euler/p24.py | UTF-8 | 504 | 3.515625 | 4 | [] | no_license | """
IDEA: there are 9! permutations starting with 0, same number
starting with 1. Our permutation must start with 2, since
3*(9!)>999999. Proceed similarly for each digit.
"""
def fac(n):
"""factorial function"""
if n == 0:
return 1
else:
return n*fac(n-1)
N = 999999 # this many number... | true |
dcba5776bfcc4213887fe0efbb8bce6e030c7358 | Python | loongqiao/learn | /python1707A/0724/bigfile.py | UTF-8 | 590 | 3.703125 | 4 | [] | no_license | """
由于计算机内存有限所以对大文件
进行分开处理
"""
def copy():
#提示用户输入原文件名称
source=input("请输入源文件名称")
target=input("请输入目标文件名称")
#打开文件
old_file=open(source,"br")
new_file=open(target,"bw")
#复制文件
while True:
contennt=old_file.read(1024*1024)
if contennt:
new_file.write(contennt)
... | true |
f92f93c93d4e64568a68a4f369912c97cf3dae7a | Python | bthaqi/hack-zurich-2019 | /hack-zurich-flaskr/main.py | UTF-8 | 2,671 | 2.578125 | 3 | [] | no_license | """
This project is developed during Hack Zurich, 2019.
Details about the project:
(*) Challenge setter = Credit Suisse
(*) Team = Hack-a-bank
"""
from flask import Flask
import json
import requests, json, os
from elasticsearch import Elasticsearch
from ssl import create_default_context
from flask_cors import CORS
f... | true |
37e83be7ab357a46b7c31a89424b32344ac62577 | Python | VIZ-Blockchain/viz-python-lib | /viz/utils.py | UTF-8 | 984 | 3.046875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import json
from datetime import datetime
from toolz import assoc, update_in
def json_expand(json_op, key_name="json"):
"""Convert a string json object to Python dict in an op."""
if type(json_op) == dict and key_name in json_op and json_op[key_name]:
try:
return u... | true |
63cf10c226b11698da6927097f90282a03818ad0 | Python | junhua/django-service-objects | /tests/test_fields.py | UTF-8 | 1,735 | 2.75 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from django import forms
from django.core.exceptions import ValidationError
from service_objects.fields import MultipleFormField
class FooForm(forms.Form):
name = forms.CharField(max_length=5)
class MultipleFormFieldTest(TestCase):
def test_sanitation(self):
f = Mult... | true |
6e0a31525f416914a3b8c5dc7943bba2ffb1d255 | Python | bourdeau/image-worker | /imageworker/image.py | UTF-8 | 1,629 | 3.28125 | 3 | [] | no_license | import os
import re
from PIL import Image as PILImage
class Image:
"""Handle image processing."""
def __init__(self, img_path: str):
"""Init."""
self.img_path = img_path
def resize(self, dest_dir: str, size: int, quality: int = 100) -> None:
"""Resize the image and save it (metho... | true |
d9880a6bf0fe451a99796925a8db89653470e017 | Python | ashutoshdhondkar/basic-python | /even.py | UTF-8 | 145 | 3.6875 | 4 | [] | no_license | #program to generate the first 'n' even numbers
n=int(input("Enter number of terms : "))
for x in range(n+1):
if x%2 == 0:
print(x)
| true |
d0eb723eae06a8a935f11a1e9edf8e1ae8347d1c | Python | e93fem/PyTorchNLPBook | /pytorch/xor/multilayer_perceptron.py | UTF-8 | 2,001 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | import torch.nn.functional as F
import torch.nn as nn
class MultilayerPerceptron(nn.Module):
"""
"""
def __init__(self, input_size, hidden_size=2, output_size=3,
num_hidden_layers=1, hidden_activation=nn.Sigmoid):
"""Initialize weights.
Args:
input_size (int):... | true |
e82919ac61f4325b2ac11d6e41609cee3b152db6 | Python | MagnoCarlos/File_ComparisonPy | /File_Comparison/main.py | UTF-8 | 3,697 | 3.265625 | 3 | [] | no_license | import docx
import PyPDF2
# This program will compare and find the differences between two contracts or docs page by page
def ReadingText(filename): # get each paragraph
count_pargphs = 0
doc = docx.Document(filename)
completed_file1 = []
# print("paragraphs ", end=""),
# print(len(doc.paragraph... | true |
ca8ff8e1610737832ecefda156b796e5b544a9e6 | Python | icyfig/Backend | /copy_of_prob4.py | UTF-8 | 9,022 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 01:24:18 2020
@author: icy
"""
def main():
row = input().strip()
row_list = row.split()
T = int(row_list[0])
B = int(row_list[1])
for i in range(T):
if(B%2 == 0):
ans = handle_even(B)
else:
ans ... | true |
83da8d50937f5a0ece1429f71e0a6e6aed795960 | Python | RoryMichelen/Reinforcement-Learning | /Project3/env.py | UTF-8 | 4,413 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 29 14:43:08 2020
@author: Rory
"""
import numpy as np
class environment:
def __init__(self,state,is_test=False):
np.random.seed(1)
self.num_states=8
self.num_actions=5
self.state=state
self.is_test=is_test
... | true |
37ee5b2c99647d71e0c061fde555044888082a19 | Python | AnadeLuna/streamlit_me_mola | /main.py | UTF-8 | 1,568 | 2.984375 | 3 | [] | no_license | import streamlit as st
import src.manage_data as dat
import plotly.express as px
import pandas as pd
import folium
import codecs
from streamlit_folium import folium_static
import streamlit.components.v1 as components
from PIL import Image
imagen = Image.open("images/portada2.jpg")
st.image(imagen)
st.write("""
# My a... | true |
13cbe3fc9c2b2349b6caf34fa8a4c4eee398f3da | Python | ZhuqingZhang0422/Pacwar-local-search-AI | /python/GA_xw.py | UTF-8 | 7,266 | 2.71875 | 3 | [] | no_license | import _PyPacwar
import numpy
# simple hill climbing
import random
import sys
import os
from collections import defaultdict
import util_xw as util
import threading # multiple thread
class GA():
def __init__(self, initialparent, sites=[[0, 4], [4, 20], [20, 23], [23, 26], [26, 38], [38, 50]]):
self.start ... | true |
6d6ada6bd9c892d24e04043efc1147c41b7f2376 | Python | RajvirSingh1313/Robert-Assistant | /App/Robert.pyw | UTF-8 | 7,612 | 2.75 | 3 | [] | no_license | import pyttsx3
import speech_recognition as sr
import datetime
import time
import wikipedia
import webbrowser
import wolframalpha
import os
import random
import matplotlib.pyplot as plt
from PIL import ImageGrab
def speak(audio):
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProp... | true |
61e9f4d061c44980856b5c55921ad1187f532726 | Python | chameleon10712/test-csm | /test_csm/webda/vpython/py/Ball-Spin.py | UTF-8 | 2,157 | 2.53125 | 3 | [] | no_license | def scene_init():
global init_value_box, ball_spd_box, count, ball
display(width = 700, height = 700, background = vec(1, 1, 1),center = vec(0, 0.25, 0), range = 1.5, forward = vec(0, -0.8, -1))
floor = box(length = 3, height = 0.01, width = 2, texture=dict(file=textures.wood))
init_value_box = labe... | true |
2d8e7a80a0bf0986d21013b51ebc1b78edf857b7 | Python | michael-ng/baytech-rpc | /rpc.py | UTF-8 | 1,910 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import getpass
import sys
import telnetlib
DEBUG = True
class rpc3:
def __init__(self,host,login=None, passwd=None):
print ("Initializing")
self.host = host
self.login = login
self.passwd = passwd
self.status = "offline"
# 8 outlets
self.ou... | true |
749809055d0562bcd837343663e6b4be1536e0a1 | Python | xiphodon/leetcode_studio | /00001_00100/00084_柱状图中最大的矩形.py | UTF-8 | 5,113 | 3.75 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/3/16 17:30
# @Author : GuoChang
# @Site : https://github.com/xiphodon
# @File : 00084_柱状图中最大的矩形.py
# @Software: PyCharm
"""
给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。
求在该柱状图中,能够勾勒出来的矩形的最大面积。
以上是柱状图的示例,其中每个柱子的宽度为 1,给定的高度为 [2,1,5,6,2,3]。
图中阴影部分为... | true |
836c2302985f93917b51b31982e09601ed494084 | Python | soundtemple/automate_python | /ch3_helloFunc.py | UTF-8 | 1,335 | 4.84375 | 5 | [] | no_license | # The hello function is defined
def hello():
print('Hello there.')
hello()
# A parameter is a variable that an argument is stored in when a function is called.
def hello(name):
print('Hello ' + name)
hello('Alice')
hello('Bob')
# The value that a function call evaluates to is called the return value of the... | true |
3d9333ebf1e0fa87b9cc2dc909ef95b8b64c2e2a | Python | phcchan/invNN | /invLayer.py | UTF-8 | 11,756 | 2.734375 | 3 | [] | no_license | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# This enables a ctr-C without triggering errors
import signal, sys
signal.signal(signal.SIGINT, lambda x, y: sys.exit(0))
import numpy as np
import tensorflow as tf
from keras.layers import Layer, Dense, Lambda, Input
from keras.models import Model
from keras impor... | true |
51827f2d580c5e5922e71bab943bacd0f9b849cb | Python | dannyboy15/cpsc471-p3 | /commands.py | UTF-8 | 949 | 2.96875 | 3 | [] | no_license | import utils
# import commands
import subprocess as sp
def print_cmd(cmd, desc):
print "{command} {description}".format(\
command = cmd.ljust(16),\
description = desc)
def do_help():
print "The following commands are available:"
print_cmd('get <file name>', '(downloads <file name> from the... | true |
182eec6329ef6aa1598110f707ce7378e04805f0 | Python | vancemiller/printf-to-cout | /converter.py | UTF-8 | 3,424 | 2.921875 | 3 | [] | no_license | #!/usr/bin/python
import re
import sys
class converter:
# Line contains printf, return a string containing the entire printf without newlines
# Will read additional lines from f until reaching the end of the printf statement
@staticmethod
def _coalesce_printf(line, f):
match = re.match(r'(.*)printf\((.*?... | true |
a2e6dbc4b8c2418cd1976fdba17c04aa2605573b | Python | agonzs11/Polinomio-del-caos | /chaospy/distributions/collection/generalized_half_logistic.py | UTF-8 | 2,070 | 2.890625 | 3 | [
"MIT"
] | permissive | """Generalized half-logistic distribution."""
import numpy
from scipy import special
from ..baseclass import Dist
from ..operators.addition import Add
from .deprecate import deprecation_warning
class generalized_half_logistic(Dist):
"""Generalized half-logistic distribution."""
def __init__(self, c=1):
... | true |
26346b1eeef47057c8a64172e76e99559a7fa0d0 | Python | nholtappels/Pumpernickel | /processing/processing.py | UTF-8 | 4,361 | 2.765625 | 3 | [] | no_license | '''
Created on 16.12.2013
@author: Nick
'''
from NaiveBayes import NaiveBayes
from create_filenames import create_names
import numpy as np
from slice_merge import slice_csv, merge_csvs
lower_threshold = 1
upper_threshold = 100
numlines_train = 100 # 0 will be interpreted as all lines
numlines_test = 100 # 0 will b... | true |
f4c21a25ba124ba2ad002fe1af38d64732baa8b8 | Python | oucs638/MLGame | /Week04-Lab02_KMeans_Ball.py | UTF-8 | 3,053 | 2.765625 | 3 | [] | no_license | import pickle
import numpy as np
from os import path
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from sklearn.model_selection import train_test_split
from sklearn import metrics
from mpl_toolkits.mplot3d import Axes3D
def transformCommand(command):
if 'RIGHT' in str(command):
r... | true |
6558ee444a3f485b52463ba1d5ede37b698cd5f8 | Python | ManojDjs/python-3 | /exceptions try catch finally.py | UTF-8 | 106 | 3.03125 | 3 | [] | no_license | k=0
try:
k=1/2
i=1/0
except:
print("exception at dividing with 0")
else:
print(k)
| true |
453cf4a814dfc79dc68e0c1bcbe63dd88305ad2b | Python | kweird/githubintro | /7_Communicating/agentframework.py | UTF-8 | 2,197 | 4.34375 | 4 | [
"MIT"
] | permissive | import random
class Agent():
def __init__(self, environment):
"""
Initialise an object of class Agent with two variables, x and y,
which are randomly generated ints between 0 and 99
Returns
-------
None.
"""
self.environment = environment
s... | true |
38e1139d00d1a33319cb4abd97aef1352872c175 | Python | jorgemachucav/qlf | /backend/framework/bin/procutil.py | UTF-8 | 964 | 3.0625 | 3 | [] | no_license | import logging
import psutil
import signal
import os
logger = logging.getLogger()
def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True,
timeout=None, on_terminate=None):
""" Kill a process tree (including grandchildren) with signal
"sig" and return a (gone, still_alive) tuple.
... | true |
0b56b1aff7d981922ee3301eabf7f8b3573b4c10 | Python | JoseIgnacioRetamalThomsen/Emerging-Technologies-Assessment-2019 | /webapp/prototype/imagehelper.py | UTF-8 | 7,784 | 3.140625 | 3 | [
"MIT"
] | permissive | # Jose I Retamal
# Emerging Technologies
# GMIT 2019
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from io import BytesIO
import base64 as b64
from collections import deque
"""
Provide some helper methods for prepare images containig numbers for use in a model
trained using Mnist dataset.... | true |
be6dabe33bdc215251911cc7746b7ed15294e042 | Python | DMamrenko/Project-Euler | /p49.py | UTF-8 | 678 | 3.21875 | 3 | [] | no_license | #Project Euler Problem 49
valids = []
sequence = []
def isPrime(n):
mid = n+1 // 2
if n < 0:
return False
else:
for i in range(2, mid):
if n % i == 0:
return False
return True
for i in range(1001, 10000):
if isPrime(i):
valids.appen... | true |
cc69ebc680eb6dd016fdd6fdf234392624cb2e89 | Python | KameliaZaman/Data-Communication-Laboratory | /Project/delta.py | UTF-8 | 1,466 | 3.15625 | 3 | [] | no_license | # Delta Modulation
import numpy as np
import matplotlib.pyplot as plt
import pylab as pl
#fsz = (7,5) # figure size
Fs = 80 # sampling rate
fm = 10 # frequency of sinusoid
tlen = 1.0 ... | true |
f7ecec04b4404f93bdffa97137c9d35ab57c043c | Python | yassinebencheikh/OCR_Arabe | /nombre des mot et caracteres de notre dataset.py | UTF-8 | 2,314 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 25 12:14:44 2020
@author: Abdellah-Bencheikh
"""
import cv2 as cv
import os
from glob import glob
from tqdm import tqdm
img_paths = glob('..\\Dataset\\scan/*.jpg')
txt_paths = glob('..\\Dataset\\texte/*.txt')
script_path = os.getcwd()
directory = {}... | true |
f6af0d73d11c1f8b1bbf25e286b1918ada16ebfb | Python | swipswaps/terminal-hero | /th/controller.py | UTF-8 | 2,847 | 2.90625 | 3 | [
"MIT"
] | permissive | from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.effects import Print
from asciimatics.event import KeyboardEvent
from asciimatics.exceptions import StopApplication
from asciimatics.widgets import PopUpDialog
from .constants import HELP
from .renderers import FretboardDynamic,... | true |
24d4b5504516d02ecc7669d6f8647ae875c4f828 | Python | Yinan-Zhao/PANet | /dataloaders/transforms.py | UTF-8 | 20,447 | 2.953125 | 3 | [] | no_license | """
Customized data transforms
"""
import random
from PIL import Image
from scipy import ndimage
import numpy as np
import torch
import torchvision.transforms.functional as tr_F
import math
import numbers
import collections
import cv2
from copy import deepcopy
class RandomMirror(object):
"""
Randomly filp ... | true |
d2b2c44969c4e0461a855d696760501facd2be96 | Python | tootap/Ol-Birty-Dastard-II | /collect.py | UTF-8 | 3,104 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import serial
import time
import glob
import os
import json
# Not an immediate thing to read
SLEEP_TIME=.3
def setup():
# Sets up the serial interface
# Usually USB0 but sometimes not so grab newest
serials = glob.glob('/dev/ttyUSB*')
if len(serials) > 0:
serialfile = seri... | true |
a0e1f10515d1cb563bf2fe4c1518802b9bd1730c | Python | colinxy/ProjectEuler | /Python/project_euler132.py | UTF-8 | 1,018 | 3.25 | 3 | [] | no_license | from mathutil import prime_under
def pow_mod(power, p):
"""
power mod for base 10
in case power is too big
given that base is 10, and p and 10 are coprime
"""
e = power % (p - 1)
return pow(10, e, p)
def repunit_mod(p, degree=9):
"""
compute R(10 ** degree) % p
... | true |
3212deb23365ced6354abb9b30e5b33dc276712e | Python | AllehGonj/IC3 | /3.0/bot.py | UTF-8 | 1,592 | 3.359375 | 3 | [] | no_license | from PIL import ImageGrab, ImageOps
import pyautogui
import time
import numpy as np
class coordinates():
# Coordinates of the reset game button
replaybutton = (515, 405)
# Coordinates of the top-right corner of the dinosaur
dinasaur = (300, 420)
# Restart the game, by clicking the re... | true |
3f6f70bbc006ec6a0f854cbdd8d26774a4115c5e | Python | justinfoust/web-scraping-challenge | /Missions_to_Mars/app.py | UTF-8 | 841 | 2.65625 | 3 | [] | no_license | ###---------------------------------------------------------###
### Web Scraping HW -- Mission to Mars ###
### Justin Foust -- 01/11/2020 -- Data Boot Camp ###
###---------------------------------------------------------###
from flask import Flask, render_template, redirect
from flask_... | true |
839d5a9ea0fae57ec18a5ababe262cfd22ccd627 | Python | JohnAlexGuerrero/Taller-01-python | /punto-03.py | UTF-8 | 662 | 3.796875 | 4 | [] | no_license | import os
os.system('cls')
posiciones = int(input('Número de casillas para conformar el vector: '))
ultimo = posiciones - 2
vector = []
for recorre in range(posiciones):
numero = int(input("Ingresa un valor: "))
if recorre < (posiciones-1):
vector.append(numero)
else:
while (vector[0]+ve... | true |
bd7b179b1815214509248cfb3e95eef9b2209c03 | Python | AnderSon277/DEBER_3 | /Nombre.py | UTF-8 | 2,953 | 2.828125 | 3 | [] | no_license | import turtle
t=turtle.Pen()
t.penup()
t.forward(-100)
#LETRA A
for x in range(1,4):
if(x==3):
t.penup()
else:
t.pendown()
t.left(120)
t.forward(200)
t.pendown()
t.left(180)
t.forward(50)
t.penup()
t.forward(150)
t.left(180)
t.pendown()
t.forward(50)
t.penup()
t.forward(100)
for x in r... | true |
78dd31eee92c97fad0fadbd515998f1d337a2858 | Python | LinusSkucas/Today | /datecore/datecore.py | UTF-8 | 924 | 3.03125 | 3 | [] | no_license | from datetime import date
from enum import Enum
import arrow
from jinja2 import Environment, PackageLoader
from random import choice
class DateFormat(Enum):
NORMAL = "dddd[, the ]Do [of] MMMM"
NORMAL_YEAR = "dddd[, the ]Do [of] MMMM[, ]YYYY"
class Date:
def __init__(self, date: date = date.today(), date... | true |
86e6f7a2899a44537e381e43f565fa9a8517a9df | Python | jelenaj98/Project5 | /code/plot.py | UTF-8 | 18,317 | 2.5625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
a = False
b = False
c_ODE = False
c_MonteCarlo = False
d_ODE = False
d_MonteCarlo = True
e_ODE = False
e_MonteCarlo = False
if a:
tid, S, I, R = np.loadtxt("../outputs/rungeKutta_A.txt", usecols=(0,1,2,3), unpack =True)
plt.plot(tid,S, label="S", color='#F5B... | true |
30ec235274276c75471c371a9b50af5d77a00118 | Python | subbiahs84/LearnPython | /functions_FilterWithLambda.py | UTF-8 | 324 | 3.390625 | 3 | [] | no_license | from functools import reduce
nums = [12,13,15,16,20,25]
evenResult = list(filter(lambda n : n % 2 == 0, nums))
print("Even result from List ",evenResult)
mapResult = list(map(lambda n: n*2, evenResult))
print("Map result - ", mapResult)
sum = reduce(lambda a,b : a+b, evenResult)
print("Calculate SUM using reduce ", ... | true |
188a806927ce60efbbda3b16cfc40f776aaf240a | Python | wangwm/src | /pandas_test/dataframe_test.py | UTF-8 | 444 | 2.734375 | 3 | [] | no_license | #coding:utf-8
import sys
import os
import pandas as pd
import numpy as np
df = pd.DataFrame(np.arange(12).reshape(3,4), columns=[chr(i) for i in range(97,101)])
print df
df.iloc[1,3] = '老王'
for index, row in df.iterrows():
#print row["date"],index
df.iloc[index,3] = '老王'
print df
for index, row in ... | true |
5694067a120713d9364a2974ee7349610186e674 | Python | Airconaaron/Google-Code-Jam-Practise | /2017_APRIL/A_Pancakes/pancakes.py | UTF-8 | 1,835 | 3.34375 | 3 | [] | no_license | #flips = 0
def flip(c):
if c == '+':
return '-'
else:
return '+'
#for my sakes zero index the positions
def flip_num(string, n, pos):
str_length = len(string)
if (pos+n) > str_length:
return []
# sub_str = string[pos:pos+n]
# for i in xrange(n):
# sub_str[i] = flip[i]
# return string[:pos]
for i in ... | true |
d3fb15f43e0160fa1bc34722445b5444ab7aea28 | Python | codingJWilliams/Obf-scation | /input.py | UTF-8 | 46 | 2.90625 | 3 | [
"MIT"
] | permissive | a = 1
b = 2
print(a + b)
print("Hello World") | true |
cebea13e02f6dfe09b0aae3030a2a3f9aa1a0a98 | Python | haarcuba/pimped_subprocess | /pimped_subprocess/pimped_subprocess_.py | UTF-8 | 2,329 | 2.71875 | 3 | [] | no_license | import threading
import logging
import os
import pty
import subprocess
import select
class PimpedSubprocess( object ):
def __init__( self, * popenArgs, ** popenKwargs ):
self._popenArgs = popenArgs
self._popenKwargs = popenKwargs
self._outputMonitors = []
self._subprocess = None
... | true |
354275f64c067772b7ce71f49b47de2bf3aa5d97 | Python | akekic/covid-vaccine-evaluation | /vaccination_policy/generator/available_vaccinations.py | UTF-8 | 1,384 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | from numpy import typing as npt
class UnassignedVaccinations:
def __init__(
self,
initially_available_vaccinations: npt.ArrayLike,
constraints_per_dose: bool,
):
self.available_vaccinations = (
initially_available_vaccinations.sum(axis=0)
if constraints_... | true |
a1ec0f4e1deb7a4c920932ba715767890ba9c6b6 | Python | DrPariah/Goats-Mod-Compilation-1 | /Tools/covers_update.py | UTF-8 | 2,845 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# Make sure you have python3 installed.
# Ensure that the json_formatter is kept in Tools with this script. They must be in the same folder!
# For Windows:
# Using command prompt type "python covers_update.py"
# For Max OS X or Linux:
# Swap any "\\" with "/", then run the script as in windows.
... | true |
4884dee31c31bbb651cddf42ef8a985af2fb320d | Python | panchyni/PseudogenePipeline | /_pipeline_scripts/NameChangers/1_1_4_ReformBlast2.py | UTF-8 | 1,072 | 3.0625 | 3 | [] | no_license | #This script is intended to add species names to my query and database gene
#names in my .blast file.
#Created by David E. Hufnagel 01-04-2012
import sys
blast = open(sys.argv[1]) #the name fo the .blast file to be processed
out = open(sys.argv[2], "w") #the name of the output .blast file
name1 = sys.argv[3] ... | true |
81b9266aa8c4e92695e2d09b33293cf0d8bf16a2 | Python | qmnguyenw/python_py4e | /geeksforgeeks/python/python_all/167_1.py | UTF-8 | 2,814 | 4.21875 | 4 | [] | no_license | Python | Insert list in another list
The problem of inserting a number at any index is a quite common one. But
sometimes we require to insert the whole list into another list. These kinds
of problems occur in Machine Learning while playing with data. Let’s discuss
certain ways in which this problem can be sol... | true |
0fbc4b4a67532e6bab177694dfead91e29594090 | Python | simplesconsultoria/sc.transmogrifier | /src/sc/transmogrifier/sections/asciify.py | UTF-8 | 2,102 | 2.734375 | 3 | [] | no_license | # coding: utf-8
# Author: Joao S. O. Bueno
from sc.transmogrifier import logger
from sc.transmogrifier.utils import blueprint
from sc.transmogrifier.utils import BluePrintBoiler
from sc.transmogrifier.utils import normalize_string
from sc.transmogrifier.utils import NothingToDoHere, ThouShallNotPass
@blueprint("... | true |
cbafecb7255925e640211c11ea617ed51b094246 | Python | jeromew21/speech | /speech.py | UTF-8 | 1,490 | 2.8125 | 3 | [] | no_license | import speech_recognition as sr
import time
import subprocess
import vlc
import responder
from gtts import gTTS
def get_response(words):
return responder.response(words)
def get_speech(r):
with sr.Microphone() as source:
audio = r.listen(source)#, timeout=5.0)
response = {
"transcribe": N... | true |
726ed9c31ad84941de49ff8201dab6e54c690570 | Python | CianLR/judge-solutions | /kattis/pot.py | UTF-8 | 131 | 2.8125 | 3 | [] | no_license | N = int(input())
pre_nums = [int(input()) for _ in range(N)]
post_nums = [(x//10)**(x%10) for x in pre_nums]
print(sum(post_nums))
| true |
3b20cd0faa03f104262f6860e13306aef011d756 | Python | srikanteswartalluri/pyutils | /pythontraining/regex.py | UTF-8 | 730 | 3.171875 | 3 | [
"ISC"
] | permissive | __author__ = 'talluri'
import re
email = 'talluri@gmail.com'
m = re.match('(\w+)@(\w+).(com)',email)
if m:
print m.groups()
emails = 'talluri@gmail.com,support@gmail.com'
m = re.findall('(\w+)@(\w+).(com)',emails)
if m:
for item in m:
print item
string = 'People say Python is cool'
print re.... | true |
90f64ba90e6cf0457afa6a9b81b06299764bd1bb | Python | stereoexplosion/D2_jango_nexttry | /NewsPaper/news/templatetags/_filters.py | UTF-8 | 502 | 2.53125 | 3 | [] | no_license | from django import template
register = template.Library() # если мы не зарегестрируем наши фильтры, то django никогда не узнает где именно их искать и фильтры потеряются(
@register.filter(name='censor')
def censor(value):
arg = ['пидор', 'сука', 'ниггер']
b = value.split(' ')
for c in arg:
for a ... | true |
a92e3725d6336800e2677bcf6bb6ec5168c6615b | Python | Frifon/vk-online-tracker | /app/common/tools.py | UTF-8 | 1,975 | 2.953125 | 3 | [] | no_license | import vk_api
import time
from datetime import datetime
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
from vk_api.vk_api import ApiError
def open_url(url):
"""
Open url and handle all the possible errors
"""
request = Request(url)
try:
response =... | true |
55d6b64222a683d753dacf9097cb28b82c7a439d | Python | karansingh1218/KoutisProject | /DFSalgo.py | UTF-8 | 3,237 | 3.03125 | 3 | [] | no_license | import os
fileDir = os.path.dirname(os.path.realpath('__file__'))
filepath = ".//" + "dataset//"
def adjancency_list(edges):
adjList = {}
for node in sorted(edges):
if node[0] not in adjList:
adjList[node[0]] = [node[1]]
else:
adjList[node[0]].append(node[1])
... | true |
0214465fddba06ffcbc2c97bc12db3d2de3f586f | Python | IgorZn/pyGame | /ship.py | UTF-8 | 1,127 | 3.40625 | 3 | [] | no_license | import pygame
class Ship:
def __init__(self, ai_game):
self.screen = ai_game.screen
self.screen_rect = ai_game.screen.get_rect()
# speed
self.settings = ai_game.settings
# load pic of ship and get form
self.image = pygame.image.load('images/ship.bmp')
# п... | true |
747e6b0327b8bce2a93b74ba4046fbdc1b5d401e | Python | alexliberzonlab/mothpy | /mothpy/simulation.py | UTF-8 | 6,194 | 2.515625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Demonstrations of how to set up models with graphical displays produced using
matplotlib functions.
"""
from __future__ import division
__authors__ = 'Noam Benelli'
import numpy as np
import os
import imp
import mothpy_models
from pompy import models, processors, demos
def moth_simula... | true |
82ee2eccd5ea48656fcfa3727d7a436de4f1b891 | Python | insoPL/PythonHomework | /python4/main.py | UTF-8 | 1,467 | 3.84375 | 4 | [] | no_license | # 4.2
def linijkarz(dl):
st = "|...." * dl + "|\n0"
for it in range(1, dl + 1):
st += "{0:5d}".format(it)
return st
def kwadratura(x, y):
return ("+---" * x + "+\n" + "| " * x + "|\n") * y + "+---" * x + "+\n"
# 4.3
def factorial(n):
suma = 1
for x in range(n):
suma += ... | true |
cdb1c94029a4971c0df6e6d3e6464ec9af20b3e3 | Python | carlostovarmisiontic/retos | /users_with_name_con_casos.py | UTF-8 | 1,154 | 3.46875 | 3 | [] | no_license | import pandas as pd
def get_users_with_name(pname:str, url):
"""Descripción:
-----------
Retorna la cantidad de personas cuyo nombre es igual o similar a uno dado por parámetro
Parámetros:
-----------
pname (str):
Nombre buscado con el cual se espera encontrar... | true |
d3d6ab82352124c423e771decc358b137dc611cb | Python | 14021612946/jisuanqi | /TestCalc.py | UTF-8 | 1,170 | 2.96875 | 3 | [] | no_license | import unittest
from jiafa import Calc
from ddt import ddt
from ddt import data
from ddt import unpack
data1 = [
[1,2,3],
[2,3,5]
]
@ddt
class TestCalcAdd(unittest.TestCase):
@data(*data1)
@unpack
def testAdd(self,s,t,y):
a = s
b = t
p = y
calc = Calc()
sum ... | true |
ddaefddba4da4f9361ede290df2e28e99ff3e1e9 | Python | yourback/MotherboardConnect | /datetimeminus.py | UTF-8 | 284 | 3.328125 | 3 | [] | no_license | import datetime
from time import sleep
if __name__ == '__main__':
TENS = 10
time1 = datetime.datetime.now()
sleep(10)
time2 = datetime.datetime.now()
print(time1)
print(time2)
time3 = time2 - time1
print(time3.seconds == 10)
print(time3.days)
| true |
4e51cd53d96aba36842bb1a5ee9018d11e352fb9 | Python | ovr1/test | /test1/test4_finish/test_tictactoe.py | UTF-8 | 734 | 3.171875 | 3 | [] | no_license | import mygame
import unittest
class MyGameTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("[имитируется бурная деятельность настройки]")
print("v" * 30)
@classmethod
def tearDownClass(cls):
print("^" * 30)
print("[здесь мы всё подчистили типа]")
de... | true |
293a5f4f741c322be743d70225c13fb000171a62 | Python | HectorDD/mockserver | /mockresponder.py | UTF-8 | 1,524 | 2.671875 | 3 | [] | no_license |
class SuccessTemplate:
def __init__(self,url,requestTriggers,response):
self.url=url
self.requestTriggers=requestTriggers
self.response=response
class DefaultTemplate:
def __init__(self,url,response):
self.url=url
self.response=response
class MockResponder:
def __in... | true |
135b160a13d40756fc26f1e723aef5c51104d407 | Python | tadevosiaan/test | /bioinfo/chapter1_replication.py | UTF-8 | 8,918 | 3.125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from collections import Counter
import numpy as np
from tqdm import tqdm
from bio_utils import HammingDistance, ReverseComplement, FASTA_to_lists, KMP
from random import choice
# CHAPTER 1. Where in the genome doest DNA replication begin?
# Algorithmic warmup
# 1A Code challenge
def P... | true |
fb37e9b406d749e588ac144a6f46a16571f2d277 | Python | ccoo/Multiprocessing-and-Multithreading | /Multi-processing and Multi-threading in Python/Multi-processing/multiprocessing_async.py | UTF-8 | 3,889 | 3.4375 | 3 | [
"MIT"
] | permissive | #!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
We can assign asynchronous tasks into a process pool.
This can implemented in two ways:
- one with "concurrent.futures" module
- one with "multiprocessing" module
"""
__author__ = 'Ziang Lu'
import concurrent.futures as cf
import os
import random
import time
from mu... | true |
09fdd49f66b905547496af95e8f6730d8cd43d78 | Python | pani-ps1/my-practice-3-python | /69.nearest distance(f).py | UTF-8 | 246 | 3.265625 | 3 | [] | no_license | import math
def distance (p):
return math.sqrt( p[0]**2 + p[1]**2 )
a = [ (0,1) , (1,2) , (2,4) ,(3,7) ]
b = [distance(i) for i in a]
m = d.index(main(d) )
print ("point {} has the min distance {}."\
.format(a[m],main(d)) )
| true |
67c2a85349b34e5394acddff0a277bf52b7f2bf7 | Python | luishmd/Sports | /count_commuting_savings.py | UTF-8 | 1,922 | 2.546875 | 3 | [] | no_license | # Metadata
#=========
__author__ = "Luis Domingues"
__maintainer__ = "Luis Domingues"
__email__ = "luis.hmd@gmail.com"
#----------------------------------------------------------------------------------------
# IMPORTS
#----------------------------------------------------------------------------------------
... | true |
f411f92eeb34c0de13990475709ebfdd566a24a1 | Python | gtfotis/python_functions | /function1.py | UTF-8 | 539 | 4.0625 | 4 | [] | no_license | #def whatName():
#inputName = input("What is your name? ")
#whatName()
#def square(num):
#return num * num
#print(square(2))
global_variable_example = "Foo"
def localScopeFunction():
local_variable_example = "Bar"
print(global_variable_example + " is Global")
print(local_variable_example + " is Lo... | true |
4756ca84a08ae1057373e663e0c00aaeaf2e4d64 | Python | roskalab/visexpman | /engine/generic/__init__.py | UTF-8 | 3,453 | 2.515625 | 3 | [] | no_license | import numpy
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import os
from visexpA.engine.dataprocessors import generic
import unittest
import itertools
def pack_to_rgb(array_r, array_g=None, array_b = None):
if array_g==None and array_b == None:
return numpy.rollaxis(numpy.a... | true |
10442ebcce7e577709f690036f99dba24c66d76b | Python | rubimeza/topaza_uce | /additional_analyses_2017/bin/read_edit_xml_chimeric_empirical.py | UTF-8 | 2,234 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 26 18:53:16 2017
@author: tobias
"""
import os
import re
import xml.etree.ElementTree as ET
def read_fasta(fasta):
name, seq = None, []
for line in fasta:
line = line.rstrip()
if line.startswith(">"):
if name: yi... | true |
6ed614190f8f7206693e40839513f57393c96f41 | Python | razinkovnik/rugpt2 | /data_twitter.py | UTF-8 | 934 | 2.609375 | 3 | [] | no_license | from corus import load_mokoron
from training_arguments import TrainingArguments
import re
# https://github.com/natasha/corus
def clean(tweet: str):
tweet: str = record.text
tweet = tweet.replace("\\n", " ")
tweet = tweet.replace("\\", "")
tweet = tweet.replace("RT", "")
tweet = re.sub("http[s]*[... | true |
cc3b27d5b5f23f7494b01492a95229ebfe72ecc3 | Python | DanPopa46/neo3-boa | /boa3_test/test_sc/range_test/RangeGivenStart.py | UTF-8 | 123 | 2.515625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | from boa3.builtin import public
@public
def range_example(start: int, stop: int) -> range:
return range(start, stop)
| true |
2a6926f8afd815cce33919f41fe80a82cfc7e7e1 | Python | eminem18753/hackerrank | /Mathemetics/extremely_dangerous_virus.txt | UTF-8 | 422 | 2.796875 | 3 | [] | no_license | #!/bin/python
from __future__ import print_function
import os
import sys
# Complete the solve function below.
def solve(a, b, t):
return pow((a+b)/2,t,1000000007)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
abt = raw_input().split()
a = int(abt[0])
b = int(abt[1])
... | true |
c07bb380fe6cbf1976b5ed8f28ab90350ad33382 | Python | Aasthaengg/IBMdataset | /Python_codes/p03637/s227015882.py | UTF-8 | 294 | 3.09375 | 3 | [] | no_license | n = int(input())
a = list(map(int, input().split()))
two = 0
four = 0
for i in a:
if i%4 == 0:
four += 1
elif i%2 == 0:
two += 1
if n == two:
print("Yes")
elif four/(n - two) >= 0.5:
print("Yes")
elif four/(n - 1) >= 0.5:
print("Yes")
else:
print("No") | true |
0e7547ac789f9a819dd9dc5e30e0270a4c41e777 | Python | malte70/scripts | /website-screenshot | UTF-8 | 3,685 | 3.015625 | 3 | [
"BSD-2-Clause",
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Website screenshot generator
#
# Links:
# - https://www.lambdatest.com/blog/python-selenium-screenshots/
# - https://pythonbasics.org/selenium-screenshot/
# - https://www.vionblog.com/selenium-headless-firefox-webdriver-using-pyvirtualdisplay/
#
import sys
import ... | true |