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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0380a9e419eaefe49786d5c67803050794ab55f5 | Python | Aj588/StatsGroupProject | /MathOperations/multiplication.py | UTF-8 | 125 | 2.5625 | 3 | [] | no_license | class Multiplication:
@staticmethod
def product(multiplier, multiplicand):
return multiplier * multiplicand
| true |
937ba82e576a3f44ac37d91f078d4afc939f02ac | Python | BedaSBa6koi/Homework-14.03.20 | /task12v2.py | UTF-8 | 465 | 3.6875 | 4 | [] | no_license | fahr = print('Enter the desired number and F if you want to convert Fahrenheit to Celsius\n')
cels = print('Enter the desired number and C if you want to convert Celsius to Fahrenheit\n')
t = (input('Enter: \n'))
sign = t[-1]
t = int(t[0:-1])
def calc(t):
if sign == 'C' or sign == 'c':
t = int(t * (9/5) + ... | true |
14666225bc5ae653e830cac95091478ddd479680 | Python | AllanPS98/Compilador | /main.py | UTF-8 | 932 | 3.1875 | 3 | [] | no_license | '''
Versão Python: 3.8
'''
import AnalisadorLexico
import AnalisadorSintatico
import Arquivos
import os
lexan = AnalisadorLexico.AnalisadorLexico()
arquivosEntrada = os.listdir("input")
print(arquivosEntrada)
leitor = Arquivos.Arquivos()
texto = ""
contadorArquivo = 1
for arquivo in arquivosEntrada:
... | true |
1a9644e1315d0be02064c24a7f3163908d60fb44 | Python | ofkarakus/python-assignments | /Python Basics/3-Control Flow Statements/Assignment-7/Assignment - 7 (FizzBuzz).py | UTF-8 | 726 | 4.71875 | 5 | [] | no_license | # Task : Print the FizzBuzz numbers.
# FizzBuzz is a famous code challenge used in interviews to test basic programming
# skills. It's time to write your own implementation.
# Print numbers from 1 to 100 inclusively following these instructions:
# if a number is multiple of 3, print "Fizz" instead of this number,
# i... | true |
ac369ed2adaddd2290ac100bb82c8423ba5b87d8 | Python | MrFrezza/Keras-exercises-repository | /tfcheck.py | UTF-8 | 226 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
print("Tensorflow version is " + str(tf.__version__))
hello = tf.constant('Hello from Tensorflow')
sess = tf.Session()
print(sess.run(hello)) | true |
8f2c272773a219495ac64a9934030b9c939f8a0f | Python | RafalSl/Python-bootcamp-excercises | /zagadka.py | UTF-8 | 2,830 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#P76 średnia ocen - wersja z błędem - podwójny Enter na zakończenie wpisywania
class SrOcen:
l_ocen = ['1', '1.5', '2', '2.5', '3', '3.5', '4', '4.5', '5']
def __init__(self, imie, nazwisko):
self.imie = imie
self.nazwisko = nazwisko
self.oceny = []
... | true |
8ac44d2681ca8d5246b759b634ab9f924727692d | Python | Zhaokugua/MOOC_1261_Eamples | /4-5 Python之while循环.py | UTF-8 | 90 | 3.375 | 3 | [] | no_license | #请求出1~10的乘积。
i = 0
s = 1
while i < 10:
i = i + 1
s = s * i
print(s)
| true |
f3d2dcc976276815a4441e72e1e71138c5be915f | Python | mmmare/Python1 | /stat.py | UTF-8 | 750 | 4.03125 | 4 | [] | no_license |
while True:
try:
numbers = input('please enter values seperated by a space ').split()
addval = sum([int(number)for number in numbers])
addval = int(addval)
average = addval/len(numbers)
intva = int(numbers)
median = sorted(intva)
print("The mean is",average)
if len(numbers)%2 == 0:
evenval = in... | true |
75958e549b0a3393e8ad5f1d7146a27271a9f569 | Python | hyejinHong0602/BOJ | /bronze3/[WEEK6] 5073 - 삼각형과 세 변.py | UTF-8 | 637 | 3.328125 | 3 | [] | no_license | a=1
b=1
c=1
while a!=0 or b!=0 or c!=0:
a, b, c = map(int, input().split())
nums=[a,b,c]
sortedNum=sorted(nums)
if sortedNum[2] >= sortedNum[1]+sortedNum[0]:
if a == 0 and b == 0 and c == 0:
pass
else:
print('Invalid')
else:
if a == b:
if... | true |
f3d5154da0a3a51fb9864148b22375471b9e878e | Python | Quatroctus/CS362-ICA-PY-Unit | /word_count.py | UTF-8 | 120 | 3.078125 | 3 | [] | no_license |
def word_count(sentence: str) -> int:
words = [word.split("-") for word in sentence.split()]
return len(words)
| true |
1e1646630faedcbae936c36387f66cf97a4138ac | Python | NinaHerrmann/ACO-Results | /Scripts/Graphs/TSP/bar_graph_big_problem_routekernel_runtime_comparison.py | UTF-8 | 1,792 | 2.828125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
'../../.'
my_data = pd.read_csv('../../../data_aggregation/TSP/HighLevel/Musket_route_kernel_average.csv', delimiter=',', header=None)
breno_data = pd.read_csv('../../../data_aggregation/TSP/LowLevel/Lowlevel_route_kernel_average.csv', delimiter=','... | true |
81e39c69c0bbfa31bbab73efba156a3bd0839cfd | Python | shawn-stover/LeetCode-Python | /largest-number-at-least-twice-of-others/largest-number-at-least-twice-of-others.py | UTF-8 | 1,156 | 3.734375 | 4 | [] | no_license | class Solution:
def dominantIndex(self, nums: List[int]) -> int:
"""
Trivial cases
- Array only has 1 element
the return must be 0
- An array of length 2
- [3, 6]
[3, 6, 1, 0]
enumerate(nums)
... | true |
df87933633744972644ae149faec3a3be7a41a49 | Python | cphyc/MHD_simulation | /python/simul.py | UTF-8 | 9,256 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/env python3
try:
import numpypy as np
except:
import numpy as np
try:
import cPickle as pickle
except ImportError:
import pickle
#import ipdb
## Tri Diagonal Matrix Algorithm(a.k.a Thomas algorithm) solver
def TDMAsolver(a, b, c, d):
'''
TDMA solver, a b c d can be NumPy array type or Py... | true |
cf6714f9203b10b285b97f0c00803aa7e22582d7 | Python | lenguyen1605/FlaskApp | /app.py | UTF-8 | 753 | 2.71875 | 3 | [] | no_license | from flask import *
from flask import url_for
import argparse
import requests
import os
app = Flask(__name__)
@app.route('/number-cats/<int:number>')
def main(number):
urls = []
directory = "static"
parent_dir = '/Users/lenguyen/Desktop/ProjectFlask'
path = os.path.join(parent_dir, directory)
i... | true |
14983229caa60aa80df9d9d467fd3f6fc18104da | Python | mgeiger/beehive | /beehive/database/database.py | UTF-8 | 2,927 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
import sqlite3 as lite
import logging
import sys
table_name = 'sensor_values'
col_date_time = 'date_time'
col_temperature = 'temperature'
col_temp2 = 'temperature2'
col_pressure = 'pressure'
col_altitude = 'altitude'
col_humidity = 'humidity'
col_light = 'light'
create = "CREATE TABLE IF NOT EXISTS ... | true |
932ff16a4baafeaab6b672f4ebdf649b87c5a79e | Python | JoneCoder/Python_basic | /Project-02/addition.py | UTF-8 | 331 | 3.609375 | 4 | [] | no_license | result = 0
for i in range(50):
result = result + 1
print(result)
result2 = 0
num = 1
for i in range(50):
result2 = result2 + num
num = num + 1
print(result2)
result3 = 0
for num in range(50):
result3 = result3 + num
print (result3)
result4 = 0
for num in range(1, 51):
result4 = result4 + num
pri... | true |
202ffa2acde884466a422385762a776b211e06bc | Python | KrishnaSindhuReddyDodda/NLP-POS-tags | /Task1.py | UTF-8 | 2,885 | 3.1875 | 3 | [] | no_license | import nltk
import stanza
import a1
import accu #accu is a file with accuracy().
from nltk.corpus import brown
print(brown.categories()) #This retrieve categories in genre of brown corpus
sent_pos_adventure = nltk.corpus.brown.tagged_sents(categories = "adventure",tagset="unive... | true |
deeecbe4ba43a9f7960d37e48ffff6a3fae3ed6e | Python | thijskruithof/sqrmelon | /SqrMelon/animationgraph/curvedata.py | UTF-8 | 10,286 | 3.03125 | 3 | [
"MIT"
] | permissive | from pycompat import *
from mathutil import Vec2
class Key(object):
"""
A single key in a curve.
Currently tangent X values, tangentBorken and the TANGENT_USER mode are unused.
"""
TYPE_MANUAL, TYPE_LINEAR, TYPE_FLAT = range(3)
TANGENT_AUTO, TANGENT_SPLINE, TANGENT_LINEAR, TANGENT_FLAT, TANGEN... | true |
81dd10d7da9fcf5fdcb90452428e2b66f1ce55c7 | Python | osk7462/app_store | /customer.py | UTF-8 | 1,979 | 3.765625 | 4 | [] | no_license | from apps import AppStore
class Customer:
"""
A class to represent a customer
Attributes
----------
cart : list
a list to add an app in cart
total : float
store total price of apps in the cart
Methods
-------
add_to_cart(app_name)
add an app to cart
... | true |
cf32d1bde5563f9033ac246c7e8da8f0de7a2299 | Python | NBCisae/RLchallenge | /simonet/trainning.py | UTF-8 | 3,125 | 2.765625 | 3 | [] | no_license | import numpy as np
import pickle
from ple import PLE
from ple.games.flappybird import FlappyBird
from state import new_state
#Retourner l'action en fonction du argmax (0 ou 1)
def get_action(a):
return a*119
#Def epsilon greedy
def epsilon_greedy(Q, new_state, epsilon, state):
a = np.argmax(Q[new_... | true |
2ba6bbd1e9ebdd6aa86859a8f32ec55887181528 | Python | skyxyz-lang/CS_Note | /leetcode/tree/code/54.py | UTF-8 | 827 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: skyxyz-lang
@file: 54.py
@time: 2020/11/21 09:46
@desc:https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof/
二叉搜索树的第k大节点
"""
from tree_node import TreeNode
class Solution(object):
"""
"""
def __init__(self):
self.index = ... | true |
3df032d90ceab58651241481b1cfa04caddb9132 | Python | kmwalsh1/fem | /post/create_pointloads_vtk.py | UTF-8 | 15,356 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/env python
"""
create_pointloads_vtk.py
Creates .vts file, which can be viewed in Paraview, from node and point loads
files.
Here is one solution I found for viewing the loads on the inside of the mesh:
1. Load the mesh into Paraview.
2. Press the "Calculator" button on the top left side of Paraview. The
calc... | true |
325cee2e7e0907b9cb736f36fbedb5eddf2cd7f2 | Python | bamblebam/text-summarizer-thing | /webapp/views.py | UTF-8 | 1,053 | 2.515625 | 3 | [] | no_license | from django.shortcuts import render, redirect
from .text_summarizer_v2 import generate_summary
from django.contrib import messages
# Create your views here.
def home(request):
summarized_text = ''
if request.method == 'POST':
stuff = request.POST.get('stuff')
num_of_lines = int(request.POST.g... | true |
714334ec59c3963710fea9606742a65ead5a0e46 | Python | gary-butler/Learning_Deep_Learning | /cartpole5.py | UTF-8 | 3,405 | 2.65625 | 3 | [] | no_license | import gym
import numpy as np
import tensorflow as tf
def policy_gradient():
params = tf.get_variable("policy_parameters",[4,2])
state = tf.placeholder("float",[None,4])
actions = tf.placeholder("float",[None,2])
advantages = tf.placeholder("float",[None,1])
linear = tf.matmul(state,para... | true |
c9191a6886826502ee2a159bd4fbe6040ddbce65 | Python | srinaveendesu/Programs | /PythonScripts/pattern_command.py | UTF-8 | 2,252 | 4.03125 | 4 | [] | no_license | #Behavioral pattern
# The idea of a Command pattern is to decouple the object that invokes the operation from the
# one that knows how to perform it.
class Screen(object):
def __init__(self, text=''):
self.text = text
self.clip_board = ''
def cut(self, start=0, end=0):
self.clip_board... | true |
6ab37db3189cfdd355913c44cfc240122397a967 | Python | jorgearoce2102/basic-neural-networks | /tests/fit_tests.py | UTF-8 | 1,996 | 3.03125 | 3 | [] | no_license | from nose.tools import *
import NeuralNetwork as NN
import numpy as np
import random
def with_sgd_test():
"""Stocastic gradient descent backpropagation test"""
#create dataset object
filename = "dataset/iris.data"
dataset = NN.Dataset(filename)
#training and testing datasets
train_ratio = 0.7... | true |
cc21e78820522dd40f9783288eca179158a76423 | Python | streamr/marvin | /marvin/tests/fixtures/__init__.py | UTF-8 | 1,143 | 2.84375 | 3 | [
"MIT"
] | permissive | """
marvin.tests.fixtures
~~~~~~~~~~~~~~~~~~~~~
This package contains fixtures that can be used for testing or quickly firing up a test
instance with some test data.
"""
from . import complete as COMPLETE
from marvin import db
import re
#: The regex to check whether a module level variable should ... | true |
95e3fd21779da713c31b9d08b9b3729b3626d153 | Python | viviancui59/Compressing-Genomic-Sequences | /read_data.py | UTF-8 | 2,160 | 2.5625 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
import os
import os.path
import random
import numpy as np
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.Alphabet import generic_dna
# filename ='SRR642636_1.fq'# downloaded multi-fasta file from MITOMAP database
reads = []
# , "rU"
for i in range(2672): #2672 is the num... | true |
0ead2d2f0d60269535f024b1ebb93590016b7f30 | Python | zhouf1234/untitled8 | /正则表达式-demo练习7.py | UTF-8 | 3,319 | 2.90625 | 3 | [] | no_license | import requests
import re
import json
from lxml import etree
import os
#不写user-agent,不换ip地址,不一步步爬取,会被网站发现是爬虫
#先取得所有分页面的url保存成json文件
#读取json文件的所有url,更换ip,爬取所有章节内容并保存为json文件
#最后把章节内容的json文件保存为120个txt文件。
# proxy = {
# "http":"223.93.145.186:8060", #使用89网获取的这个可用ip地址
# }
# header = {"User-Agent":"Mozilla/5.0 (Windo... | true |
c2326f7cd572c6216de220d9826680f737ea3944 | Python | kg-0805/Trimester-9-Lab-Assignments | /Artificial Intelligence/Tic-Tac-Toe/Assignment2.py | UTF-8 | 6,322 | 4.125 | 4 | [] | no_license | #Name : Kartik Gupta
#PRN : 1032170673
#Subject : Artificial Intelligance
#Assignment 2
#Roll No. : PB-40
from time import time
class Game:
def __init__(self):
#initialized the empty tic tac toe board
self.current_state = [
['.', '.', '.'],
['.', '.', '.'],
['.'... | true |
6b1363c8694efed48f6878cc7509f4411fa1b645 | Python | reritom/Esvi | /test/test_models/test_objects/car.py | UTF-8 | 484 | 3.078125 | 3 | [] | no_license | class Car():
def __init__(self, colour=None, size=None, speed=None):
self.colour = colour
self.size = size
self.speed = speed
def serialise(self):
return {'colour': self.colour,
'size': self.size,
'speed': self.speed}
def deserialise(self, c... | true |
159a50cdb9941a7ba3b7a41d76a9f5d1e4352349 | Python | antoniojkim/Orbis-Challenge | /PlayerAI.py | UTF-8 | 2,658 | 3.375 | 3 | [] | no_license | from PythonClientAPI.game.PointUtils import *
from PythonClientAPI.game.Entities import FriendlyUnit, EnemyUnit, Tile
from PythonClientAPI.game.Enums import Team
from PythonClientAPI.game.World import World
from PythonClientAPI.game.TileUtils import TileUtils
from random import choice as choose_random_from
class Playe... | true |
831f86912eab253e770de6c7415b841954a9a9df | Python | DKU-STUDY/Algorithm | /BOJ/solved.ac_class/Class03/9095.1, 2, 3 더하기/sAp00n.py | UTF-8 | 1,285 | 3.671875 | 4 | [] | no_license | # https://www.acmicpc.net/problem/9095
"""
시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 50501 32144 21313 61.645%
문제
정수 4를 1, 2, 3의 합으로 나타내는 방법은 총 7가지가 있다. 합을 나타낼 때는 수를 1개 이상 사용해야 한다.
1+1+1+1
1+1+2
1+2+1
2+1+1
2+2
1+3
3+1
정수 n이 주... | true |
d96e269f9d7a92b640bdba8ed959b44e668dfe75 | Python | zhou952368/Python_One | /pycharm workpance/9.20.py | UTF-8 | 734 | 4.25 | 4 | [] | no_license | # 2. 使用函数式编程,获得1970~2018所有的闰年
# 过滤器
print(list(filter(lambda n: n % 4 == 0 and n % 100 != 0 or n % 400 == 0, range(1970, 2019))))
"""
1. 使用map进行函数式编程实现如下功能:
将 [1,2,3,4,5] 和 ['a','b','c','d','e'] 合并为
{[(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e')]}
"""
# map()函数
l = [1, 2, 3, 4, 5]
l1 = ['a', 'b', 'c', 'd', 'e']
m = list... | true |
c6b7134d427fc8b1dc4dc4c9522dbe33f92260c9 | Python | wootfish/cryptopals | /challenge_44.py | UTF-8 | 2,202 | 2.78125 | 3 | [] | no_license | from hashlib import sha1
from typing import Dict, Any
from challenge_39 import invmod, InvModException
from challenge_43 import DSA, recover_x, BadKError
y = int("2d026f4bf30195ede3a088da85e398ef869611d0f68f07"
"13d51c9c1a3a26c95105d915e2d8cdf26d056b86b8a7b8"
"5519b1c23cc3ecdc6062650462e3063bd179c2a6... | true |
48378e1e72ecbbece17837f3219787f0ee6d5913 | Python | ldakir/Machine-Learning | /lab06/random_forest.py | UTF-8 | 3,647 | 3.34375 | 3 | [] | no_license | """
Implements Random Forests with decision stumps.
Authors: Lamiaa Dakir
Date: 10/27/2019
"""
import util
from random import randrange
from math import sqrt
from Partition import *
from DecisionStump import *
import numpy as np
def random_forest_train_data(train_partition,T):
"""
Training data using the rand... | true |
c35b584a55a4a2b7dc7f94bb16863b740adea0de | Python | nagi930/coding_test | /cluster.py | UTF-8 | 4,035 | 2.859375 | 3 | [] | no_license | import random
from collections import deque
from copy import deepcopy
import turtle
def under60p(board):
cnt = 0
for i in range(A):
for j in range(A):
if board[i][j] == 'X' or board[i][j] == 'V':
cnt += 1
if cnt/A**2 < 0.6:
return True
else:
return F... | true |
d0fd2e713deb1708dca3f06f676b1b3118ce1ab6 | Python | Aasthaengg/IBMdataset | /Python_codes/p02675/s027389381.py | UTF-8 | 120 | 3.140625 | 3 | [] | no_license | N = str(input())
if int(N[-1])==3:
print('bon')
elif int(N[-1]) in [0, 1, 6, 8]:
print('pon')
else:
print('hon')
| true |
903197eba593aaee6a1b3c2062b80462c4311fbc | Python | daniel-reich/ubiquitous-fiesta | /HNjRjrNPueF5vRh9S_0.py | UTF-8 | 150 | 3.03125 | 3 | [] | no_license |
def hamming_code(message):
code = ""
for c in message:
for b in bin(ord(c))[2:].zfill(8):
code += b * 3
return code
| true |
9801c49ad6fcb189fb834bd621f79f579e01f07c | Python | piantado/LOTlib3 | /Hypotheses/Lexicon/SimpleLexicon.py | UTF-8 | 4,507 | 3.34375 | 3 | [] | no_license | from copy import copy
from LOTlib3.Miscellaneous import flip, qq, attrmem
from LOTlib3.Hypotheses.Hypothesis import Hypothesis
from LOTlib3.Hypotheses.FunctionHypothesis import FunctionHypothesis
from LOTlib3.Hypotheses.Proposers import ProposalFailedException
from LOTlib3.Hypotheses.LOTHypothesis import LOTHypothesis
... | true |
11d3ba3947741130c63aef69bf716e7ef86a69db | Python | dpernes/dirsvm | /utils.py | UTF-8 | 919 | 2.8125 | 3 | [] | no_license | import csv
import os
import numpy as np
def read_csv(path, filename, delimiter=','):
f = open(os.path.join(path, filename))
f_csv = csv.reader(f, delimiter=delimiter)
f_csv = list(f_csv)
f.close()
return f_csv
def write_csv(samples, labels, types, path):
ret = [','.join(map(str, s) + [str(l... | true |
fd79140b2d09437eff43b36085ad0e390e12f29f | Python | DongGeun974/Practice_gongsu | /20191105.py | UTF-8 | 1,169 | 4.0625 | 4 | [] | no_license | #컬렉션자료형
"""
리스트-느리다, 딕셔너리, 튜블
넘파이 : 컬렉션자료형의 단점을 보안
"""
import numpy as np
a = np.array([0,1,2,3])
print(a)
print(type(a))
b = np.array((0,1,2,3))
print(b)
print(type(b))
#항목별로 비교연산
c = a == b
print(c.dtype)
print(b.dtype)
d = np.array([True, True, False], dtype=int)
print(d)
"""
#넘파이는 같은자료형?? 장점은 빠른 처리 속도
import ... | true |
58632730325488eada6ee3f2353135e96e3add26 | Python | bstempi/pyswf | /pyswfaws/exceptions.py | UTF-8 | 1,040 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | class ActivityTaskException(Exception):
"""
Exception that is thrown when an activity task fails
"""
def __init__(self, task_name, task_version, task_id, failure_reason, failure_status):
self.task_name = task_name
self.task_version = task_version
self.task_id = task_id
s... | true |
e7971fb58cc622bd24998ef9d1f25f051f5a32c7 | Python | diogojapinto/computer-vision | /2nd_part/01_stereo/stereo_1.py | UTF-8 | 720 | 2.90625 | 3 | [] | no_license | import cv2
from matplotlib import pyplot as plt
import numpy as np
# Load both images
img_left = cv2.imread('left.png', cv2.IMREAD_GRAYSCALE)
img_right = cv2.imread('right.png', cv2.IMREAD_GRAYSCALE)
# obtain the disparity matrix
stereo = cv2.StereoBM_create(numDisparities=80, blockSize=21)
disparity = stereo.compute... | true |
065aa1f787c1ba602f3af37acd3fb85897618f17 | Python | Evertcolombia/AirBnB_clone_alone | /web_flask/2-c_route.py | UTF-8 | 442 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
from flask import Flask
app = Flask(__name__)
@app.route("/", strict_slashes=False)
def home():
return "Hello"
@app.route("/hbnb", strict_slashes=False)
def hbnb():
return "HBNB"
@app.route("/c/<text>", strict_slashes=False)
def c(text=None):
if (text):
text = text.replace('_'... | true |
7d31b978803e94db9091ebf7c98f110ac493d500 | Python | St-Ren/high_school_project | /web/web/paragraph/background/paragraph/3/check.py | UTF-8 | 387 | 2.703125 | 3 | [] | no_license | for num in range(1,127):
f=open('%d.t'%num,'r',encoding='latin1')
lines=f.readlines()
f.close()
f=open('%d.t'%num,'w',encoding='latin1')
for line in lines:
line=line.replace('*','')
line=line.replace(' ',' ')
line=line.replace('??','')
s=line.strip()
if len(s)<10:
try:
print(f)
print(line)... | true |
ce99966c7536666d60b394facc1ed36017e4cc86 | Python | LesGameDevToolsMagique/Messenger | /test/server/pyServ.py | UTF-8 | 1,399 | 2.640625 | 3 | [
"MIT"
] | permissive | import SocketServer
HOST = "localhost"
PORT = 12321
# this server uses ThreadingMixIn - one thread per connection
# replace with ForkMixIn to spawn a new process per connection
class EchoServer(SocketServer.Thr... | true |
df94eed12d0c978d232c19689e51e00e25905a16 | Python | HR-027/Lawnmowing | /Alevel_sprites.py | UTF-8 | 6,670 | 3.21875 | 3 | [] | no_license | import pygame
from Alevel_settings import *
vec = pygame.math.Vector2
# For collisions between a sprite and the walls
def collide_with_walls(sprite, group, direction):
# In the horizontal direction
if direction == 'x':
# Checks for hits between a sprite and the the walls
hits = pygame.sprite.sp... | true |
493c17baed29a8161d172a722061f387786c140e | Python | CSR-Group/Story-Cloze-Test | /postab.py | UTF-8 | 1,847 | 2.96875 | 3 | [] | no_license | from ingest import *
import nltk
from nltk.corpus import wordnet as wn
def getPosTags(sentence):
return nltk.pos_tag(sentence)
def getEntities(sentence):
nouns = set()
entity_type = {'NNPS', 'NNS', 'NNP', 'PRP', 'NN', 'PRP$'}
taggedWords = getPosTags(sentence)
for (x,y) in taggedWords:
if... | true |
1bd3b97e6f3650eebc712c104d73e613f95f5131 | Python | 981377660LMT/algorithm-study | /7_graph/bfs求无权图的最短路径/bfs保持搜索顺序的性质/不连续字符串-dfs生成器搜索字典序.py | UTF-8 | 1,190 | 3.765625 | 4 | [] | no_license | from itertools import islice
from typing import Generator, List
# 2^n
class Solution:
def solve(self, n: int, k: int) -> str:
"""
返回'0''1''2'组成的长为n的字典序的第k个字符串 相邻字符不能相同
用dfs搜,搜出来直接就是字典序,并且用生成器可以节省空间,加速
如果用bfs搜,搜出来是实际大小排序
"""
def bt(index: int, pre: int,... | true |
d436d10ca7cca870683e4e77729d47039ecdb9ed | Python | Tusharsampang/All_LabProjects | /venv/Lab3/Question3.py | UTF-8 | 259 | 3 | 3 | [] | no_license | '''
3. Write a function calledshowNumbersthat takes a parameter calledlimit.
It should print all the numbers between 0 and limit with a label to identify the even and odd numbers.
For example, if the limit is 3, it should print:0 EVEN1 ODD2 EVEN
''' | true |
0fadc0b782afcfe19fde8b27254a7dfadc2b2280 | Python | jcpince/algorithms | /leetcode/rotatedDigits.py | UTF-8 | 6,883 | 3.78125 | 4 | [
"MIT"
] | permissive | #! /usr/bin/python3
# 788. Rotated Digits
# Easy
#
# X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone.
#
# A number is valid if each digit remains a digit after rotation. 0, 1, a... | true |
515cb83e3095d0afab7892d717bdc0309f6e401b | Python | HengjieXu/FYP-NLP | /Data Acquisition/guardian.py | UTF-8 | 3,634 | 2.5625 | 3 | [] | no_license | #api key: 99b71d35-7fbf-4fb1-b58b-b0c25a18775a
import json
import urllib2
from bs4 import BeautifulSoup
class Guardian:
BASEURL = 'http://content.guardianapis.com/search?q='
def __init__(self, company, start, end, pn):
self.company = company
self.start = start
self.end = end
s... | true |
421baec48f3e497d836741ab5669002bcbc1288d | Python | adityataksande/virtualinterview | /speech.py | UTF-8 | 1,391 | 3.296875 | 3 | [] | no_license | import speech_recognition as sr
# get audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print(" What are the basic data types ass... | true |
0800419fce5377c80c359b56d3ba0d1a9221c05b | Python | elizabethguy86/Traffic_Pullovers_WA | /Police_Data_Pandas.py | UTF-8 | 4,310 | 2.796875 | 3 | [] | no_license |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import log_loss
import statsmodels.discrete.discrete_model as sm
data_raw = pd.read_cs... | true |
057f6321f6842390b45181839d9487b08c581cbd | Python | mingles/shape-recognition | /featuriser.py | UTF-8 | 4,389 | 3.046875 | 3 | [] | no_license | __author__ = 'Sam Davies and Mingles'
import cv2
import numpy as np
from countour_finder import ContourFinder
class FeaturiserSimple(object):
def __init__(self, img):
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
contours_sorted, _, _ = self.img_to_contours(gray_img)
min_area = 110
... | true |
3af9f8a3713bd0981e688da88c71f53fdfb74fac | Python | ChaeMyungSeock/Study | /DB/ex01.py | UTF-8 | 2,942 | 3.5 | 4 | [] | no_license | '''
select * from member
/* => 주석처리
from 이후에는 내가 생성한 db 테이블 이름 F5를 눌러서 실행하면
테이블에서 생성한 데이터를 보여줌
*/
--데이터 베이스 구축하기
--데이터 정의어(DDL) : 데이터베이스 만들기
create database Test02;
/*
create database <database명>
위의 쿼리문은 데이터 정의어(DDL) 중의 하나인 create문을 이용하는 쿼리입니다.
위의 쿼리문을 실행시키기 위해서 해당 쿼리문을 블록처리하고 F5를 눌러 실행시킵니다.
그리고... | true |
c875976a2f1dea4fcec2b823ac65156277e6d8f1 | Python | n-schilling/datadog-synthetic-scheduler | /index.py | UTF-8 | 3,325 | 2.515625 | 3 | [
"MIT"
] | permissive | import json
import logging
import os
import sys
import boto3
import urllib3
urllib3.disable_warnings()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
http_pool = urllib3.PoolManager()
secretsmanager_client = boto3.client('secretsmanager')
def changeSyntheticStatus(new_status):
logger.info(f"Start... | true |
a9cb6f90f2f6f38df11577b697b4b9139a0c5c3f | Python | SeanPlusPlus/algorithms | /isPalindrome.py | UTF-8 | 365 | 3.203125 | 3 | [] | no_license | def isPal(li):
if len(li) <= 1:
return True
back = li.pop()
front = li.pop(0)
if back != front:
return False
return isPal(li)
def main():
s1 = 'racecar'
print isPal([c for c in s1])
s2 = 'hello'
print isPal([c for c in s2])
s3 = 'a'
print isPal([c for c in ... | true |
bec2a75ae59c2d3c539514c4b48cc3845d73e797 | Python | qualiaa/aoc | /2022/16/a.py | UTF-8 | 2,241 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from typing import Iterable, Iterator, Tuple
from itertools import chain, combinations
Path = frozenset[str]
def main(lines: Iterable[str]):
adjacency = {}
rates = {}
for line in map(str.split, lines):
key, rate, rest = line[1], line[4], line[9:]
adjacenc... | true |
3e4cd2e04cf87b704b95b55dc47f89c63943b12f | Python | alicank/Translation-Augmented-LibriSpeech-Corpus | /TA-LibriSpeech.py | UTF-8 | 11,066 | 2.890625 | 3 | [
"CC-BY-4.0",
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
import os,sys
import argparse
import sqlite3,math
from shutil import copyfile
from collections import OrderedDict
import re
class TA_LibriSpeech:
parser_message = "Script developed to interact with the database" \
"to extract information easily:" \
"Example use: p... | true |
3143fe62537119feecd982970e3e6bac0d24c236 | Python | iaakanksha/Basic | /simple calculator.py | UTF-8 | 3,037 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
from tkinter import *
root = Tk()
root.title("Simple calculator")
e = Entry(root,width=35,borderwidth=5)
e.grid(row=0,column=0,columnspan=3,padx=10,pady=10)
def button_click(number):
current = e.get()
e.delete(0,END)
e.insert(0,str(current)+str(numbe... | true |
5787133d7827b6ae933689e4c60f8108971f1ba1 | Python | xCiaraG/Kattis | /vauvau.py | UTF-8 | 433 | 3.203125 | 3 | [] | no_license | dog_times = list(map(int, input().strip().split()))
times = list(map(int, input().strip().split()))
for t in times:
if dog_times[0] >= t % (dog_times[0] + dog_times[1]) > 0 and dog_times[2] >= t % (dog_times[2] + dog_times[3]) > 0:
print("both")
elif dog_times[0] >= t % (dog_times[0] + dog_times[1]) > ... | true |
c5c0dba79592ea0219eb51d5b9f06097d86ff773 | Python | gsantam/competitive-programming | /leetcode/easy/is-graph-bipartite.py | UTF-8 | 1,408 | 3 | 3 | [] | no_license | from collections import deque
class Solution:
def isBipartite(self, graph: List[List[int]]) -> bool:
if len(graph)==0:
return True
graph_dict = dict()
vertices = set()
for edge in graph:
for i in range(len(edge)):
v1 = edge[i]
... | true |
125fa061cd53a27a0312cb1a1c3052c6a5e9573b | Python | matthewmichihara/project-euler | /python/p045.py | UTF-8 | 223 | 3.3125 | 3 | [] | no_license | #! /usr/bin/python
tri = []
pen = []
hex = []
for n in range(1,100000):
tri.append(n*(n+1)/2)
pen.append(n*(3*n-1)/2)
hex.append(n*(2*n-1))
t = set(tri)
p = set(pen)
h = set(hex)
print max(t & p & h)
| true |
60a7eca536906ab8f21ac8f953561453c90a0379 | Python | statropy/aoc-2020 | /day20.py | UTF-8 | 7,000 | 2.71875 | 3 | [] | no_license | #day20.py
import math
import re
def getedges(tile):
for line in tile:
size = len(tile)
top = int(tile[0],2)
right, bottom, left = 0,0,0
for i,line in enumerate(tile):
if line[-1] == '1':
right |= (1 << (size-i-1))
if line[0] == '1':
... | true |
e0aede753622c191d61464e60cddaba307fb08cd | Python | dlwire/repo_metrics | /src/test_filtering.py | UTF-8 | 461 | 2.875 | 3 | [] | no_license | from fickle import apply_filters
import unittest
class FilterTest(unittest.TestCase):
def setUp(self):
self.collection = range(1,21)
self.filters = [
lambda x: x % 3 == 0,
lambda x: x % 2 == 0 ]
def test_applies_all_filters_to_collection(self):
result =... | true |
1ef8c7477a71e5b6484ef426b6a9505e7a62c121 | Python | MITMotorsports/Telemetry_GUI | /CAN_Spec_Paser.py | UTF-8 | 3,577 | 2.671875 | 3 | [] | no_license | from collections import OrderedDict
if __name__ == '__main__':
with open('../MY17_Can_Library/can_validator/fsae_can_spec.txt', 'r') as in_file:
with open('CAN_SPEC.py', 'w') as out_file:
out_file.write('from collections import OrderedDict\n\n')
#parse for CAN IDs and data
... | true |
73f00f81c5386ea69f29c26f42c41f82ab0c8fe7 | Python | costapt/linear_regression | /linear_regression.py | UTF-8 | 3,391 | 3.34375 | 3 | [] | no_license | import theano
import numpy as np
import theano.tensor as T
from theano import function
import matplotlib.pyplot as plt
from theano.tensor.shared_randomstreams import RandomStreams
def add_bias(X):
return np.insert(X,0,1,axis=1)
def add_features(X):
(num_points, num_features) = X.shape
for f in range(num_f... | true |
aab2996e9c0b8a1fcc7a20aca4724773385bb894 | Python | hcjun-dev/Python_College | /src/file0306.py | UTF-8 | 1,212 | 4 | 4 | [] | no_license | ##
# Hyungchol Jun
# 2014-03-01
# p6.4 hij
def hfunc(mainlist): # checking if the list is in order
if (mainlist == sorted(mainlist)) or (mainlist == sorted(mainlist, reverse=True)): # in order or in reverse order
return True
return False # if not in order, return False
def ifunc(mainlist): # Dup... | true |
8cfe6ecd5c4b2dac68b974f4178ad2dd9a6b7d0e | Python | joanaalvoeiro/LN-MP1 | /unused_functions.py | UTF-8 | 3,659 | 2.71875 | 3 | [] | no_license | import numpy as np
import nltk
from nltk.corpus import wordnet
from nltk import WordNetLemmatizer
from nltk.stem import PorterStemmer
def cosine_similarity(a1, a2):
return np.dot(a1, np.transpose(a2)) / (np.linalg.norm(a1) * np.linalg.norm(a2))
def tf_idf(test_questions, known_questions):
questions_list = [t... | true |
f7b5f1c1d6a8c71ad1c68bf459f2c7d7d27d7ff7 | Python | srush/tf-fork | /node_and_hyperedge.py | UTF-8 | 17,160 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
''' Two classes that constitute a hypergraph (forest): Node and Hyperedge
On top of these, there is a separate Forest class in forest.py which collects the nodes,
and deals with the loading and dumping of forests.
implementation details:
1. node has a local score "node_score" and... | true |
67b2247c133c4dd2a9277485859bcb5bfafad63b | Python | Majoras-Kid/RedShellDetector | /src/redshelldetector.py | UTF-8 | 3,888 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import argparse
import string
import os
import subprocess
#sudo pip install git+https://github.com/toastdriven/pyskip.git
import pyskip as skiplist
TARGET_DIRECTORY = ""
REDSHELL_LIST = []
REDSHELL_FUNCTIONS = skiplist.Skiplist()
FUNCTION_COUNTER_PER_FILE = dict()
def parse_argumen... | true |
42d0c77b12ad4917e0590719c4a701ac3becf886 | Python | all1m-algorithm-study/2021-1-Algorithm-Study | /week3/Group2/boj1629_kir3i.py | UTF-8 | 329 | 3.015625 | 3 | [] | no_license | import sys
input = sys.stdin.readline
def solv(A, B, C):
if B <= 2:
return (A**B) % C
if B %2 == 1:
return ((solv(A, B // 2, C) % C) ** 2) * A
else:
return (solv(A, B // 2, C) % C) ** 2
if __name__ == '__main__':
A, B, C = map(int, input().strip().split())
print(solv(A, B,... | true |
dce0adb6a198dc43dd62feaa5d94648efe63604d | Python | supermariogo/assign-ee | /caesar/caesar.py | UTF-8 | 7,179 | 3.125 | 3 | [] | no_license | #
# Name:
# ID:
# Date: March 8, 2015
import sys
class CaesarCipher:
"""docstring for CaesarCipher"""
def __init__(self):
self.hash_table={}
for c in "0123456789":
self.hash_table[c] = ord(c)-ord('0')
for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
self.hash_table[c] = o... | true |
7cfacaa5b774ff67d39cc13a8a7544adbf86c208 | Python | abdullahzameek/watson_stuff | /app.py | UTF-8 | 1,355 | 2.515625 | 3 | [] | no_license | import re
import flask
import requests
import json
from flask_cors import CORS
from flask import request
app = flask.Flask(__name__)
CORS(app)
url = 'https://gateway-lon.watsonplatform.net/natural-language-understanding/api/v1/analyze'
user = "apiKey"
pw = "NYrce6xil-76pPdybo0xaNLtf2u2a1iM7zrQlKDppETF"
@app.route... | true |
13e54b1f4a9316b29f943915b282eb6613944cfd | Python | ASY246/DeepLearningFromScratch | /Tensorflow/TensorFlowHDFS.py | UTF-8 | 1,660 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
IMAGE_PIXELS = 28
filenames = ['hdfs://default/user/bdusr01/asy/mergeOneHot.csv']
filename_queue = tf.train.string_input_producer(filenames, shuffle=False) #读入文件名序列
reader = tf.TextLineReader() #读取器,用于输出由换行符分隔的行,读文件名
key, value = reader.read(filename_queue) #返回reader产生的下一个记录
lines = tf.deco... | true |
e0203888c1acf3e601b61328f89a18335b742f97 | Python | aklap/python-crash-course | /ch-13/ball/run_game.py | UTF-8 | 915 | 3.3125 | 3 | [] | no_license | import pygame
import game_functions as gf
from settings import Settings
from stats import Stats
def run_game():
"""Run game."""
# Initialize game
pygame.init()
# Initialize settings
settings = Settings()
# Create window
screen = pygame.display.set_mode((1200, 800))
# Create caption
... | true |
bb328a2be39325c25b4f822181549e1323fe395d | Python | bigdog156/Trie | /run.py | UTF-8 | 2,074 | 3 | 3 | [] | no_license | from trie import Node, Trie
import re
def makeTrie(words,CreateTrie):
for word in words:
CreateTrie.insert(word[1],word[0])
return CreateTrie
#Xử lí file data.txt thành mảng các phần tử gồm seekIndex và từ khoá
def processFileToArray(PATH):
data = open(PATH,'r+')
listData = l... | true |
196b3b5e1b44c274b8b837e5ced30674f8335548 | Python | mridubhatnagar/HackerRank | /Algorithms/20-MigratoryBirds.py | UTF-8 | 1,559 | 3.9375 | 4 | [] | no_license | """
You have been asked to help study the population of birds migrating across the continent.
Each type of bird you are interested in will be identified by an integer value.
Each time a particular kind of bird is spotted, its id number will be added to your array
of sightings. You would like to be able to find out w... | true |
9cc2b2a0672dd2b089c8a122be53f531a50b6225 | Python | erictroebs/wikigraph | /wikigraph/cli/NamedParameter.py | UTF-8 | 778 | 2.90625 | 3 | [] | no_license | class NamedParameter:
def __init__(self, name, description, expects=None, default=None, parse=None):
if not isinstance(name, list):
name = [name]
self.name = name
self.description = description
self.expects = expects
self.default = default
self.parse = pa... | true |
40b64a6dc2382e53773e04a997b604e4d21df27e | Python | mozilla/hera | /hera/__init__.py | UTF-8 | 2,865 | 2.515625 | 3 | [] | no_license | import os
from urlparse import urlparse
from suds.client import Client
from suds.transport.http import HttpAuthenticated
from suds.xsd.doctor import ImportDoctor, Import
class Hera:
def __init__(self, username, password, location, wsdl="System.Cache.wsdl"):
# Sorry windows
cur = os.path.dirname(... | true |
8123e14842c579914c17eeecaf6fea59dcb36d8d | Python | wdsrocha/anime-recommender | /src/lib/content_based_recommender.py | UTF-8 | 618 | 2.5625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
def setup_content_based_recommender(n_neighbors=6):
features = pd.read_csv("data/processed_features.csv")
nbrs = NearestNeighbors(n_neighbors=n_neighbors, algorithm="ball_tree").fit(
features
)
distances, ind... | true |
7e664fa9ded87a27276b27c5b0ce6c527541dc32 | Python | domiee13/ttud | /ex02.py | UTF-8 | 594 | 3.59375 | 4 | [] | no_license | # Viết chương trình kiểm tra một số nguyên dương bất kỳ (2 chữ số trở lên, không quá 9 chữ số) có chữ số bắt đầu và kết thúc bằng nhau hay không.
# Dữ liệu vào: Dòng đầu tiên ghi số bộ test. Mỗi bộ test viết trên một dòng số nguyên dương tương ứng cần kiểm tra.
# Kết quả: Mỗi bộ test viết ra YES hoặc NO, tương ứng v... | true |
c8ad4f9c7071fa2cf2f5d94a1585b5a75be806b4 | Python | niteshthali08/Disaster-Notofication | /wikipedia.py | UTF-8 | 964 | 2.859375 | 3 | [] | no_license | import requests
def clean_uni_gram_candidates(uni_grams, wiki_term):
unknowns = []
knowns = []
for term in wiki_term:
a = term[0].split(' ')
knowns.append(a[0])
knowns.append(a[1])
for word in uni_grams:
if word not in knowns:
unknowns.append(word)
return... | true |
e539bba6128138fbd0c32f41cd67fdcc92fbb50a | Python | Yang11100/python | /jiaoben/studyexample.py | UTF-8 | 51 | 2.890625 | 3 | [] | no_license | x="a"
y="b"
# 不换行输出
print (x),
print (y)
| true |
800db4ed93cf9337d0116f30347f59376feabfaf | Python | zhch-sun/leetcode_szc | /33.search-in-rotated-sorted-array.py | UTF-8 | 2,401 | 4.03125 | 4 | [] | no_license | #
# @lc app=leetcode id=33 lang=python
#
# [33] Search in Rotated Sorted Array
#
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
lo, hi = 0, l... | true |
1df100078a4cdee47e4b44a23b33a6511653fec9 | Python | the-last-question/CodeTask1-Tarcio | /Question03.py | UTF-8 | 480 | 4.28125 | 4 | [
"MIT"
] | permissive | def __checkPerfectNumber(Number):
SumDivisors = 0
for i in range(1, Number):
if(Number % i == 0):
SumDivisors = SumDivisors + i
if (SumDivisors == Number):
return True
else:
return False
def __main__():
print("Displaying all perfect numbers between 1... | true |
015bcbc8c52ffbbba60bec79aecbe4d21b90d91e | Python | Aasthaengg/IBMdataset | /Python_codes/p02804/s846371839.py | UTF-8 | 437 | 2.5625 | 3 | [] | no_license | MOD, ans = 10**9+7, 0
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
kai, gai = [1], [1]
for i in range(n):
kai.append((kai[i] * (i+1)) % MOD)
gai.append(pow((kai[i] * (i+1)) % MOD, MOD-2, MOD))
for i in range(n):
x, y = 0, 0
if i <= (n-k):
x = (a[i] * kai[n-i-1] * gai[n-i-k] * gai[... | true |
18c74588adaceea9a0ceb9b8c687508bbccdbcef | Python | jamesfeixue/Parallel-Algos | /ParallelMatrixMultiplication/matrix_mult_pycuda.py | UTF-8 | 15,494 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
"""
.
.
.
Python Code
.
.
.
"""
#%%
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
#%%
from pycuda import driver, compiler, gpuarray, tools
import time
#%%
import pycuda.autoinit
class Transpose:
def transpose(self, a_cpu):
print("--"*40)
prin... | true |
09099fe7c7618f173603302ac96a87e0d14f6977 | Python | ekr-ccp4/jsCoFE | /pycofe/varut/selectdir.py | UTF-8 | 1,442 | 2.703125 | 3 | [
"MIT"
] | permissive | ##!/usr/bin/python
#
# ============================================================================
#
# 05.07.17 <-- Date of Last Modification.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ----------------------------------------------------------------------------
#
# QT SELECT DIRCTORY DIALOG FOR CLIENT... | true |
2d12b98036008b12719b865fdeff1ccc4eae855b | Python | dannyroberts/couchjock | /test.py | UTF-8 | 2,313 | 2.546875 | 3 | [
"MIT"
] | permissive | from operator import attrgetter
import unittest2
from couchdbkit import Server
import couchdbkit
import couchjock
class CouchjockTestCase(unittest2.TestCase):
server_url = 'http://localhost:5984/'
db_name = 'couchjock__test'
schema = couchjock
def setUp(self):
self.server = Server(uri=self.s... | true |
2a7f7650d5ab997cee3c5929b0bcab0824df0d1b | Python | deepakkarki/pruspeak | /src/userspace_lib/bs_tcp_client.py | UTF-8 | 663 | 3.078125 | 3 | [
"MIT"
] | permissive | import socket
import sys
out = sys.stdout
sentinel = ''
TCP_IP = '127.0.0.1'
TCP_PORT = 6060
BUFFER_SIZE = 1024 * 2
def get_data():
out.write("ps>") #prompt the user
l = []
for line in iter(raw_input, sentinel):
l.append(line) #get the input
out.write("...")
return '\n'.join(l) #return the data entered... | true |
66f26f714c14c10b9759a96f7580a6068dc03013 | Python | tbischler/PEAKachu | /peakachulib/library.py | UTF-8 | 2,125 | 2.5625 | 3 | [
"ISC",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | from os.path import basename, splitext
import pandas as pd
from peakachulib.bam_to_bed import BamToBed
from peakachulib.count import ReadCounter
class Library(object):
'''
This class reads the alignment file for a library and counts and stores
the reads mapping to different annotations
'''
def __i... | true |
8713585b0acfd068e15396482900871c6e62a57d | Python | MayaBishop/Python-projects | /Random Projects/fractals.py | UTF-8 | 2,818 | 3.09375 | 3 | [] | no_license | import math
import pygame
pygame.init()
#ellipse(Surface, color, Rect, width=0) -> Rect
# sand colour r 255 g 180+ b 30+
def coral(sp,length,win,angle=math.pi/2):
epx = sp[0]+(length*math.cos(angle))
epy = sp[1]-(length*math.sin(angle))
ep=(epx,epy)
pygame.draw.line(win,(244, 107, 66),sp,ep)
... | true |
041dd8d5dd9fe7e2ddb9cab956261b3d8733ee4c | Python | thommms/hacker_rank | /algorithms/implementation/python/migratory_birds.py | UTF-8 | 338 | 3.15625 | 3 | [] | no_license | n = int(input())
bird_type = [int(t) for t in input().strip().split(' ')]
from collections import Counter
type_dict = Counter(bird_type)
max_key = max_val = 0
for k, v in type_dict.items():
if v > max_val:
max_val = v
max_key = k
if v == max_val:
if k < max_key:
max_key = ... | true |
40c06be03decf5035a05f4f145d5e3956022ea8d | Python | ParksProjets/kattis-hunter | /kattishunter/codegen/birds.py | UTF-8 | 2,155 | 2.765625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Generate C++ code for getting information about birds.
Copyright (C) 2019, Guillaume Gonnet
This project is under the MIT license.
"""
from typing import List
def num_birds_shoot(N: int, **kargs):
"Get the number of birds for round rindex and rindex+1."
return f"""
if (pState.getRound() == {N... | true |
7569d7bbee7110de9fb8be64751c3e449f420912 | Python | Dipson7/LabExercise | /Lab2/question_no_11.py | UTF-8 | 55 | 2.78125 | 3 | [] | no_license | '''
What is the result of 10**3?
'''
a = 10**3
print(a) | true |
a76578e5239c79d962d4dbb30894334745049a4d | Python | shenbingdy/Steam-game-recommendation | /py/get_data_from_web.py | UTF-8 | 5,438 | 2.875 | 3 | [] | no_license |
import requests,sys,time
import pandas as pd
import numpy as np
import json
## show work status fuction
def F_status (step, total, current=0):
current+=step
Percentage= int((current/total)*100)
status='>'*Percentage+' '*(100-Percentage)
if Percentage < 100:
sys.stdout.write('\rStatus: [{0}]... | true |
7070937c840c58d81b27ea3df449b4ce4b24a165 | Python | Fibird/sosp_plot | /fairness/r2b_reserve_plot_631.py | UTF-8 | 3,536 | 2.75 | 3 | [] | no_license | import matplotlib.pyplot as plt
from datetime import datetime
import numpy as np
import math
color_styles = ['#d73027', '#f46d43', '#2c7bb6', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1',
'#4575b4']
markers = ['x', 'o', '>', 'square', '*', '<']
linestyles = ['solid', 'dashed', 'dash... | true |